LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
ems::EndPoint Class Reference

#include "DirOfGamma.h"

Public Member Functions

 EndPoint (const Hit2D &center, const std::vector< Hit2D * > &hits, unsigned int nbins)
 
TVector2 const & GetPosition (void) const
 
double GetAsymmetry (void) const
 
double GetMaxCharge (void) const
 
Bin2D const & MaxChargeBin (void) const
 
std::vector< Bin2D > const & GetBins2D (void) const
 
art::Ptr< recob::Hit > const & GetHit (void) const
 
const std::vector< art::Ptr< recob::Hit > > GetIniHits (void) const
 
size_t const & GetPlane (void) const
 
size_t const & GetTPC (void) const
 
size_t const & GetCryo (void) const
 

Private Member Functions

void FillBins ()
 
void ComputeMaxCharge ()
 
void ComputeMeanCharge ()
 

Private Attributes

Hit2D fCenter2D
 
std::vector< Hit2D * > fPoints2D
 
size_t fNbins
 
double fMaxCharge
 
double fMeanCharge
 
std::vector< Bin2DfBins
 
size_t fMaxChargeIdBin
 
size_t fPlane
 
size_t fTpc
 
size_t fCryo
 

Detailed Description

Definition at line 74 of file DirOfGamma.h.

Constructor & Destructor Documentation

ems::EndPoint::EndPoint ( const Hit2D center,
const std::vector< Hit2D * > &  hits,
unsigned int  nbins 
)

Definition at line 89 of file DirOfGamma.cxx.

References ComputeMaxCharge(), ComputeMeanCharge(), geo::CryostatID::Cryostat, fBins, fCryo, FillBins(), fNbins, fPlane, fTpc, ems::Hit2D::GetHitPtr(), ems::Hit2D::GetPointCm(), geo::PlaneID::Plane, geo::TPCID::TPC, and recob::Hit::WireID().

89  :
90 fCenter2D(center),
91 fPoints2D(hits),
92 fNbins(nbins)
93 {
94 
95  for (unsigned int i = 0; i < fNbins; i++)
96  {
97  fBins.push_back(Bin2D(center.GetPointCm()));
98  }
99 
100  FillBins();
103 
104  fPlane = center.GetHitPtr()->WireID().Plane;
105  fTpc = center.GetHitPtr()->WireID().TPC;
106  fCryo = center.GetHitPtr()->WireID().Cryostat;
107 }
void ComputeMaxCharge()
Definition: DirOfGamma.cxx:141
size_t fNbins
Definition: DirOfGamma.h:100
Hit2D fCenter2D
Definition: DirOfGamma.h:98
std::vector< Hit2D * > fPoints2D
Definition: DirOfGamma.h:99
std::vector< Bin2D > fBins
Definition: DirOfGamma.h:105
size_t fPlane
Definition: DirOfGamma.h:113
void ComputeMeanCharge()
Definition: DirOfGamma.cxx:155
size_t fCryo
Definition: DirOfGamma.h:115

Member Function Documentation

void ems::EndPoint::ComputeMaxCharge ( )
private

Definition at line 141 of file DirOfGamma.cxx.

References fBins, fMaxCharge, fMaxChargeIdBin, and fNbins.

Referenced by EndPoint().

142 {
143  fMaxCharge = 0.0;
144  unsigned int saveid = 0;
145  for (unsigned int i = 0; i < fNbins; i++)
146  if (fBins[i].Size() && (fMaxCharge < fBins[i].GetTotCharge()))
147  {
148  fMaxCharge = fBins[i].GetTotCharge();
149  saveid = i;
150  }
151 
152  fMaxChargeIdBin = saveid;
153 }
size_t fNbins
Definition: DirOfGamma.h:100
std::vector< Bin2D > fBins
Definition: DirOfGamma.h:105
size_t fMaxChargeIdBin
Definition: DirOfGamma.h:107
double fMaxCharge
Definition: DirOfGamma.h:102
void ems::EndPoint::ComputeMeanCharge ( )
private

Definition at line 155 of file DirOfGamma.cxx.

References fBins, fMaxChargeIdBin, fMeanCharge, and fNbins.

Referenced by EndPoint().

156 {
157  fMeanCharge = 0.0;
158  if (fNbins == 0) return;
159 
160  unsigned int iprev, inext;
161 
162  if (fMaxChargeIdBin > 0) iprev = fMaxChargeIdBin - 1;
163  else iprev = fNbins - 1;
164 
165  inext = (fMaxChargeIdBin + 1) % fNbins;
166 
167  double sumcharge = 0.0;
168  for (unsigned int i = 0; i < fNbins; i++)
169  if ((i!=fMaxChargeIdBin) && (i!=iprev) && (i!=inext)) sumcharge += fBins[i].GetTotCharge();
170 
171  fMeanCharge = sumcharge / double (fNbins);
172 }
size_t fNbins
Definition: DirOfGamma.h:100
std::vector< Bin2D > fBins
Definition: DirOfGamma.h:105
size_t fMaxChargeIdBin
Definition: DirOfGamma.h:107
double fMeanCharge
Definition: DirOfGamma.h:103
void ems::EndPoint::FillBins ( )
private

Definition at line 109 of file DirOfGamma.cxx.

References bin, fBins, fCenter2D, fNbins, fPoints2D, ems::Hit2D::GetHitPtr(), ems::Hit2D::GetPointCm(), and art::Ptr< T >::key().

Referenced by EndPoint().

110 {
111  TVector2 vstart(0, 1);
112 
113  unsigned int saveid = 0; bool exist = false;
114  for (unsigned int i = 0; i < fPoints2D.size(); i++)
115  {
116  if (fPoints2D[i]->GetHitPtr().key() != fCenter2D.GetHitPtr().key())
117  {
118  TVector2 pos(fPoints2D[i]->GetPointCm());
119  TVector2 centre(fCenter2D.GetPointCm());
120  TVector2 vecp = pos - centre;
121  float sinsign = (vstart.X() * vecp.Y()) - (vstart.Y() * vecp.X());
122  float cosine = (vstart * vecp) / vecp.Mod();
123  float theta = 180.0F * (std::acos(cosine)) / TMath::Pi();
124 
125  unsigned int id = 0; double bin = double(360.0) / double(fNbins);
126 
127  if (sinsign >= 0) id = int (theta / bin);
128  else if (sinsign < 0) id = int (theta / bin) + (fNbins / 2);
129  if (id > (fNbins - 1)) id = (fNbins - 1);
130 
131  fBins[id].Add(fPoints2D[i]);
132  fBins[(id + 1) % fNbins].Add(fPoints2D[i]);
133  }
134  else {saveid = i; exist = true;}
135  }
136 
137  if (exist)
138  for (unsigned int id = 0; id < fNbins; id++) fBins[id].Add(fPoints2D[saveid]);
139 }
key_type key() const
Definition: Ptr.h:356
art::Ptr< recob::Hit > const & GetHitPtr(void) const
Definition: DirOfGamma.h:36
size_t fNbins
Definition: DirOfGamma.h:100
Hit2D fCenter2D
Definition: DirOfGamma.h:98
std::vector< Hit2D * > fPoints2D
Definition: DirOfGamma.h:99
std::vector< Bin2D > fBins
Definition: DirOfGamma.h:105
float bin[41]
Definition: plottest35.C:14
TVector2 const & GetPointCm(void) const
Definition: DirOfGamma.h:33
double ems::EndPoint::GetAsymmetry ( void  ) const

Definition at line 174 of file DirOfGamma.cxx.

References fMaxCharge, and fMeanCharge.

175 {
176  if ((fMaxCharge + fMeanCharge) == 0) return 0.0;
177  else return ((fMaxCharge - fMeanCharge) / (fMaxCharge + fMeanCharge));
178 }
double fMeanCharge
Definition: DirOfGamma.h:103
double fMaxCharge
Definition: DirOfGamma.h:102
std::vector< Bin2D > const& ems::EndPoint::GetBins2D ( void  ) const
inline

Definition at line 87 of file DirOfGamma.h.

87 { return fBins; }
std::vector< Bin2D > fBins
Definition: DirOfGamma.h:105
size_t const& ems::EndPoint::GetCryo ( void  ) const
inline

Definition at line 95 of file DirOfGamma.h.

95 { return fCryo; }
size_t fCryo
Definition: DirOfGamma.h:115
art::Ptr< recob::Hit > const& ems::EndPoint::GetHit ( void  ) const
inline

Definition at line 89 of file DirOfGamma.h.

89 { return fCenter2D.GetHitPtr(); }
art::Ptr< recob::Hit > const & GetHitPtr(void) const
Definition: DirOfGamma.h:36
Hit2D fCenter2D
Definition: DirOfGamma.h:98
const std::vector< art::Ptr< recob::Hit > > ems::EndPoint::GetIniHits ( void  ) const
inline

Definition at line 91 of file DirOfGamma.h.

91 { return MaxChargeBin().GetIniHits(); }
std::vector< art::Ptr< recob::Hit > > GetIniHits(const double radius=10.0, const unsigned int nhits=10) const
Definition: DirOfGamma.cxx:73
Bin2D const & MaxChargeBin(void) const
Definition: DirOfGamma.h:85
double ems::EndPoint::GetMaxCharge ( void  ) const
inline

Definition at line 83 of file DirOfGamma.h.

83 { return fMaxCharge; }
double fMaxCharge
Definition: DirOfGamma.h:102
size_t const& ems::EndPoint::GetPlane ( void  ) const
inline

Definition at line 93 of file DirOfGamma.h.

93 { return fPlane; }
size_t fPlane
Definition: DirOfGamma.h:113
TVector2 const& ems::EndPoint::GetPosition ( void  ) const
inline

Definition at line 79 of file DirOfGamma.h.

79 { return fCenter2D.GetPointCm(); }
Hit2D fCenter2D
Definition: DirOfGamma.h:98
TVector2 const & GetPointCm(void) const
Definition: DirOfGamma.h:33
size_t const& ems::EndPoint::GetTPC ( void  ) const
inline

Definition at line 94 of file DirOfGamma.h.

94 { return fTpc; }
Bin2D const& ems::EndPoint::MaxChargeBin ( void  ) const
inline

Definition at line 85 of file DirOfGamma.h.

85 { return fBins[fMaxChargeIdBin]; }
std::vector< Bin2D > fBins
Definition: DirOfGamma.h:105
size_t fMaxChargeIdBin
Definition: DirOfGamma.h:107

Member Data Documentation

std::vector< Bin2D > ems::EndPoint::fBins
private

Definition at line 105 of file DirOfGamma.h.

Referenced by ComputeMaxCharge(), ComputeMeanCharge(), EndPoint(), and FillBins().

Hit2D ems::EndPoint::fCenter2D
private

Definition at line 98 of file DirOfGamma.h.

Referenced by FillBins().

size_t ems::EndPoint::fCryo
private

Definition at line 115 of file DirOfGamma.h.

Referenced by EndPoint().

double ems::EndPoint::fMaxCharge
private

Definition at line 102 of file DirOfGamma.h.

Referenced by ComputeMaxCharge(), and GetAsymmetry().

size_t ems::EndPoint::fMaxChargeIdBin
private

Definition at line 107 of file DirOfGamma.h.

Referenced by ComputeMaxCharge(), and ComputeMeanCharge().

double ems::EndPoint::fMeanCharge
private

Definition at line 103 of file DirOfGamma.h.

Referenced by ComputeMeanCharge(), and GetAsymmetry().

size_t ems::EndPoint::fNbins
private

Definition at line 100 of file DirOfGamma.h.

Referenced by ComputeMaxCharge(), ComputeMeanCharge(), EndPoint(), and FillBins().

size_t ems::EndPoint::fPlane
private

Definition at line 113 of file DirOfGamma.h.

Referenced by EndPoint().

std::vector< Hit2D* > ems::EndPoint::fPoints2D
private

Definition at line 99 of file DirOfGamma.h.

Referenced by FillBins().

size_t ems::EndPoint::fTpc
private

Definition at line 114 of file DirOfGamma.h.

Referenced by EndPoint().


The documentation for this class was generated from the following files: