Public Member Functions | Private Member Functions | Private Attributes | List of all members
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 () const
 
double GetAsymmetry () const
 
double GetMaxCharge () const
 
Bin2D const & MaxChargeBin () const
 
std::vector< Bin2D > const & GetBins2D () const
 
art::Ptr< recob::Hit > const & GetHit () const
 
const std::vector< art::Ptr< recob::Hit > > GetIniHits () const
 
size_t const & GetPlane () const
 
size_t const & GetTPC () const
 
size_t const & GetCryo () 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 102 of file DirOfGamma.h.

Constructor & Destructor Documentation

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

Definition at line 77 of file DirOfGamma.cxx.

79 {
80 
81  for (unsigned int i = 0; i < fNbins; i++) {
82  fBins.push_back(Bin2D(center.GetPointCm()));
83  }
84 
85  FillBins();
88 
89  fPlane = center.GetHitPtr()->WireID().Plane;
90  fTpc = center.GetHitPtr()->WireID().TPC;
91  fCryo = center.GetHitPtr()->WireID().Cryostat;
92 }
void FillBins()
Definition: DirOfGamma.cxx:95
std::vector< Hit2D * > fPoints2D
Definition: DirOfGamma.h:162
void ComputeMaxCharge()
Definition: DirOfGamma.cxx:134
size_t fNbins
Definition: DirOfGamma.h:163
Hit2D fCenter2D
Definition: DirOfGamma.h:161
size_t fPlane
Definition: DirOfGamma.h:176
def center(depos, point)
Definition: depos.py:117
void ComputeMeanCharge()
Definition: DirOfGamma.cxx:148
std::vector< Bin2D > fBins
Definition: DirOfGamma.h:168
size_t fCryo
Definition: DirOfGamma.h:178

Member Function Documentation

void ems::EndPoint::ComputeMaxCharge ( )
private

Definition at line 134 of file DirOfGamma.cxx.

135 {
136  fMaxCharge = 0.0;
137  unsigned int saveid = 0;
138  for (unsigned int i = 0; i < fNbins; i++)
139  if (fBins[i].Size() && (fMaxCharge < fBins[i].GetTotCharge())) {
140  fMaxCharge = fBins[i].GetTotCharge();
141  saveid = i;
142  }
143 
144  fMaxChargeIdBin = saveid;
145 }
size_t fNbins
Definition: DirOfGamma.h:163
size_t fMaxChargeIdBin
Definition: DirOfGamma.h:170
double fMaxCharge
Definition: DirOfGamma.h:165
std::vector< Bin2D > fBins
Definition: DirOfGamma.h:168
void ems::EndPoint::ComputeMeanCharge ( )
private

Definition at line 148 of file DirOfGamma.cxx.

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

Definition at line 95 of file DirOfGamma.cxx.

96 {
97  TVector2 vstart(0, 1);
98 
99  unsigned int saveid = 0;
100  bool exist = false;
101  for (unsigned int i = 0; i < fPoints2D.size(); i++) {
102  if (fPoints2D[i]->GetHitPtr().key() != fCenter2D.GetHitPtr().key()) {
103  TVector2 pos(fPoints2D[i]->GetPointCm());
104  TVector2 centre(fCenter2D.GetPointCm());
105  TVector2 vecp = pos - centre;
106  float sinsign = (vstart.X() * vecp.Y()) - (vstart.Y() * vecp.X());
107  float cosine = (vstart * vecp) / vecp.Mod();
108  float theta = 180.0F * (std::acos(cosine)) / TMath::Pi();
109 
110  unsigned int id = 0;
111  double bin = double(360.0) / double(fNbins);
112 
113  if (sinsign >= 0)
114  id = int(theta / bin);
115  else if (sinsign < 0)
116  id = int(theta / bin) + (fNbins / 2);
117  if (id > (fNbins - 1)) id = (fNbins - 1);
118 
119  fBins[id].Add(fPoints2D[i]);
120  fBins[(id + 1) % fNbins].Add(fPoints2D[i]);
121  }
122  else {
123  saveid = i;
124  exist = true;
125  }
126  }
127 
128  if (exist)
129  for (unsigned int id = 0; id < fNbins; id++)
130  fBins[id].Add(fPoints2D[saveid]);
131 }
std::vector< Hit2D * > fPoints2D
Definition: DirOfGamma.h:162
art::Ptr< recob::Hit > const & GetHitPtr() const
Definition: DirOfGamma.h:45
size_t fNbins
Definition: DirOfGamma.h:163
Hit2D fCenter2D
Definition: DirOfGamma.h:161
key_type key() const noexcept
Definition: Ptr.h:216
QTextStream & bin(QTextStream &s)
TVector2 const & GetPointCm() const
Definition: DirOfGamma.h:34
std::vector< Bin2D > fBins
Definition: DirOfGamma.h:168
double ems::EndPoint::GetAsymmetry ( ) const

Definition at line 171 of file DirOfGamma.cxx.

172 {
173  if ((fMaxCharge + fMeanCharge) == 0) return 0.0;
174  return ((fMaxCharge - fMeanCharge) / (fMaxCharge + fMeanCharge));
175 }
double fMeanCharge
Definition: DirOfGamma.h:166
double fMaxCharge
Definition: DirOfGamma.h:165
std::vector<Bin2D> const& ems::EndPoint::GetBins2D ( ) const
inline

Definition at line 127 of file DirOfGamma.h.

128  {
129  return fBins;
130  }
std::vector< Bin2D > fBins
Definition: DirOfGamma.h:168
size_t const& ems::EndPoint::GetCryo ( ) const
inline

Definition at line 155 of file DirOfGamma.h.

156  {
157  return fCryo;
158  }
size_t fCryo
Definition: DirOfGamma.h:178
art::Ptr<recob::Hit> const& ems::EndPoint::GetHit ( ) const
inline

Definition at line 133 of file DirOfGamma.h.

134  {
135  return fCenter2D.GetHitPtr();
136  }
art::Ptr< recob::Hit > const & GetHitPtr() const
Definition: DirOfGamma.h:45
Hit2D fCenter2D
Definition: DirOfGamma.h:161
const std::vector<art::Ptr<recob::Hit> > ems::EndPoint::GetIniHits ( ) const
inline

Definition at line 139 of file DirOfGamma.h.

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

Definition at line 115 of file DirOfGamma.h.

116  {
117  return fMaxCharge;
118  }
double fMaxCharge
Definition: DirOfGamma.h:165
size_t const& ems::EndPoint::GetPlane ( ) const
inline

Definition at line 145 of file DirOfGamma.h.

146  {
147  return fPlane;
148  }
size_t fPlane
Definition: DirOfGamma.h:176
TVector2 const& ems::EndPoint::GetPosition ( ) const
inline

Definition at line 107 of file DirOfGamma.h.

108  {
109  return fCenter2D.GetPointCm();
110  }
Hit2D fCenter2D
Definition: DirOfGamma.h:161
TVector2 const & GetPointCm() const
Definition: DirOfGamma.h:34
size_t const& ems::EndPoint::GetTPC ( ) const
inline

Definition at line 150 of file DirOfGamma.h.

151  {
152  return fTpc;
153  }
Bin2D const& ems::EndPoint::MaxChargeBin ( ) const
inline

Definition at line 121 of file DirOfGamma.h.

122  {
123  return fBins[fMaxChargeIdBin];
124  }
size_t fMaxChargeIdBin
Definition: DirOfGamma.h:170
std::vector< Bin2D > fBins
Definition: DirOfGamma.h:168

Member Data Documentation

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

Definition at line 168 of file DirOfGamma.h.

Hit2D ems::EndPoint::fCenter2D
private

Definition at line 161 of file DirOfGamma.h.

size_t ems::EndPoint::fCryo
private

Definition at line 178 of file DirOfGamma.h.

double ems::EndPoint::fMaxCharge
private

Definition at line 165 of file DirOfGamma.h.

size_t ems::EndPoint::fMaxChargeIdBin
private

Definition at line 170 of file DirOfGamma.h.

double ems::EndPoint::fMeanCharge
private

Definition at line 166 of file DirOfGamma.h.

size_t ems::EndPoint::fNbins
private

Definition at line 163 of file DirOfGamma.h.

size_t ems::EndPoint::fPlane
private

Definition at line 176 of file DirOfGamma.h.

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

Definition at line 162 of file DirOfGamma.h.

size_t ems::EndPoint::fTpc
private

Definition at line 177 of file DirOfGamma.h.


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