All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 104 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.

78  : fCenter2D(center), fPoints2D(hits), fNbins(nbins)
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:164
void ComputeMaxCharge()
Definition: DirOfGamma.cxx:134
size_t fNbins
Definition: DirOfGamma.h:165
Hit2D fCenter2D
Definition: DirOfGamma.h:163
size_t fPlane
Definition: DirOfGamma.h:178
void ComputeMeanCharge()
Definition: DirOfGamma.cxx:148
std::vector< Bin2D > fBins
Definition: DirOfGamma.h:170
size_t fCryo
Definition: DirOfGamma.h:180

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:165
size_t fMaxChargeIdBin
Definition: DirOfGamma.h:172
double fMaxCharge
Definition: DirOfGamma.h:167
std::vector< Bin2D > fBins
Definition: DirOfGamma.h:170
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:165
size_t fMaxChargeIdBin
Definition: DirOfGamma.h:172
double fMeanCharge
Definition: DirOfGamma.h:168
std::vector< Bin2D > fBins
Definition: DirOfGamma.h:170
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:164
constexpr details::BinObj< T > bin(T value)
Returns a wrapper to print the specified data in binary format.
art::Ptr< recob::Hit > const & GetHitPtr() const
Definition: DirOfGamma.h:47
size_t fNbins
Definition: DirOfGamma.h:165
Hit2D fCenter2D
Definition: DirOfGamma.h:163
TVector2 const & GetPointCm() const
Definition: DirOfGamma.h:36
std::vector< Bin2D > fBins
Definition: DirOfGamma.h:170
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:168
double fMaxCharge
Definition: DirOfGamma.h:167
std::vector<Bin2D> const& ems::EndPoint::GetBins2D ( ) const
inline

Definition at line 129 of file DirOfGamma.h.

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

Definition at line 157 of file DirOfGamma.h.

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

Definition at line 135 of file DirOfGamma.h.

136  {
137  return fCenter2D.GetHitPtr();
138  }
art::Ptr< recob::Hit > const & GetHitPtr() const
Definition: DirOfGamma.h:47
Hit2D fCenter2D
Definition: DirOfGamma.h:163
const std::vector<art::Ptr<recob::Hit> > ems::EndPoint::GetIniHits ( ) const
inline

Definition at line 141 of file DirOfGamma.h.

142  {
143  return MaxChargeBin().GetIniHits();
144  }
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:123
double ems::EndPoint::GetMaxCharge ( ) const
inline

Definition at line 117 of file DirOfGamma.h.

118  {
119  return fMaxCharge;
120  }
double fMaxCharge
Definition: DirOfGamma.h:167
size_t const& ems::EndPoint::GetPlane ( ) const
inline

Definition at line 147 of file DirOfGamma.h.

148  {
149  return fPlane;
150  }
size_t fPlane
Definition: DirOfGamma.h:178
TVector2 const& ems::EndPoint::GetPosition ( ) const
inline

Definition at line 109 of file DirOfGamma.h.

110  {
111  return fCenter2D.GetPointCm();
112  }
Hit2D fCenter2D
Definition: DirOfGamma.h:163
TVector2 const & GetPointCm() const
Definition: DirOfGamma.h:36
size_t const& ems::EndPoint::GetTPC ( ) const
inline

Definition at line 152 of file DirOfGamma.h.

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

Definition at line 123 of file DirOfGamma.h.

124  {
125  return fBins[fMaxChargeIdBin];
126  }
size_t fMaxChargeIdBin
Definition: DirOfGamma.h:172
std::vector< Bin2D > fBins
Definition: DirOfGamma.h:170

Member Data Documentation

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

Definition at line 170 of file DirOfGamma.h.

Hit2D ems::EndPoint::fCenter2D
private

Definition at line 163 of file DirOfGamma.h.

size_t ems::EndPoint::fCryo
private

Definition at line 180 of file DirOfGamma.h.

double ems::EndPoint::fMaxCharge
private

Definition at line 167 of file DirOfGamma.h.

size_t ems::EndPoint::fMaxChargeIdBin
private

Definition at line 172 of file DirOfGamma.h.

double ems::EndPoint::fMeanCharge
private

Definition at line 168 of file DirOfGamma.h.

size_t ems::EndPoint::fNbins
private

Definition at line 165 of file DirOfGamma.h.

size_t ems::EndPoint::fPlane
private

Definition at line 178 of file DirOfGamma.h.

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

Definition at line 164 of file DirOfGamma.h.

size_t ems::EndPoint::fTpc
private

Definition at line 179 of file DirOfGamma.h.


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