LArSoft  v09_90_00
Liquid Argon Software toolkit - https://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 () 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 76 of file DirOfGamma.h.

Constructor & Destructor Documentation

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

Definition at line 64 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().

65  : fCenter2D(center), fPoints2D(hits), fNbins(nbins)
66 {
67 
68  for (unsigned int i = 0; i < fNbins; i++) {
69  fBins.push_back(Bin2D(center.GetPointCm()));
70  }
71 
72  FillBins();
75 
76  fPlane = center.GetHitPtr()->WireID().Plane;
77  fTpc = center.GetHitPtr()->WireID().TPC;
78  fCryo = center.GetHitPtr()->WireID().Cryostat;
79 }
void FillBins()
Definition: DirOfGamma.cxx:81
std::vector< Hit2D * > fPoints2D
Definition: DirOfGamma.h:100
void ComputeMaxCharge()
Definition: DirOfGamma.cxx:119
size_t fNbins
Definition: DirOfGamma.h:101
Hit2D fCenter2D
Definition: DirOfGamma.h:99
size_t fPlane
Definition: DirOfGamma.h:114
void ComputeMeanCharge()
Definition: DirOfGamma.cxx:132
std::vector< Bin2D > fBins
Definition: DirOfGamma.h:106
size_t fCryo
Definition: DirOfGamma.h:116

Member Function Documentation

void ems::EndPoint::ComputeMaxCharge ( )
private

Definition at line 119 of file DirOfGamma.cxx.

References fBins, fMaxCharge, fMaxChargeIdBin, and fNbins.

Referenced by EndPoint().

120 {
121  fMaxCharge = 0.0;
122  unsigned int saveid = 0;
123  for (unsigned int i = 0; i < fNbins; i++)
124  if (fBins[i].Size() && (fMaxCharge < fBins[i].GetTotCharge())) {
125  fMaxCharge = fBins[i].GetTotCharge();
126  saveid = i;
127  }
128 
129  fMaxChargeIdBin = saveid;
130 }
size_t fNbins
Definition: DirOfGamma.h:101
size_t fMaxChargeIdBin
Definition: DirOfGamma.h:108
double fMaxCharge
Definition: DirOfGamma.h:103
std::vector< Bin2D > fBins
Definition: DirOfGamma.h:106
void ems::EndPoint::ComputeMeanCharge ( )
private

Definition at line 132 of file DirOfGamma.cxx.

References fBins, fMaxChargeIdBin, fMeanCharge, and fNbins.

Referenced by EndPoint().

133 {
134  fMeanCharge = 0.0;
135  if (fNbins == 0) return;
136 
137  unsigned int iprev, inext;
138 
139  if (fMaxChargeIdBin > 0)
140  iprev = fMaxChargeIdBin - 1;
141  else
142  iprev = fNbins - 1;
143 
144  inext = (fMaxChargeIdBin + 1) % fNbins;
145 
146  double sumcharge = 0.0;
147  for (unsigned int i = 0; i < fNbins; i++)
148  if ((i != fMaxChargeIdBin) && (i != iprev) && (i != inext))
149  sumcharge += fBins[i].GetTotCharge();
150 
151  fMeanCharge = sumcharge / double(fNbins);
152 }
size_t fNbins
Definition: DirOfGamma.h:101
size_t fMaxChargeIdBin
Definition: DirOfGamma.h:108
double fMeanCharge
Definition: DirOfGamma.h:104
std::vector< Bin2D > fBins
Definition: DirOfGamma.h:106
void ems::EndPoint::FillBins ( )
private

Definition at line 81 of file DirOfGamma.cxx.

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

Referenced by EndPoint().

82 {
83  TVector2 vstart(0, 1);
84 
85  unsigned int saveid = 0;
86  bool exist = false;
87  for (unsigned int i = 0; i < fPoints2D.size(); i++) {
88  if (fPoints2D[i]->GetHitPtr().key() != fCenter2D.GetHitPtr().key()) {
89  TVector2 pos(fPoints2D[i]->GetPointCm());
90  TVector2 centre(fCenter2D.GetPointCm());
91  TVector2 vecp = pos - centre;
92  float sinsign = (vstart.X() * vecp.Y()) - (vstart.Y() * vecp.X());
93  float cosine = (vstart * vecp) / vecp.Mod();
94  float theta = 180.0F * (std::acos(cosine)) / TMath::Pi();
95 
96  unsigned int id = 0;
97  double bin = double(360.0) / double(fNbins);
98 
99  if (sinsign >= 0)
100  id = int(theta / bin);
101  else if (sinsign < 0)
102  id = int(theta / bin) + (fNbins / 2);
103  if (id > (fNbins - 1)) id = (fNbins - 1);
104 
105  fBins[id].Add(fPoints2D[i]);
106  fBins[(id + 1) % fNbins].Add(fPoints2D[i]);
107  }
108  else {
109  saveid = i;
110  exist = true;
111  }
112  }
113 
114  if (exist)
115  for (unsigned int id = 0; id < fNbins; id++)
116  fBins[id].Add(fPoints2D[saveid]);
117 }
std::vector< Hit2D * > fPoints2D
Definition: DirOfGamma.h:100
art::Ptr< recob::Hit > const & GetHitPtr() const
Definition: DirOfGamma.h:38
size_t fNbins
Definition: DirOfGamma.h:101
Hit2D fCenter2D
Definition: DirOfGamma.h:99
key_type key() const noexcept
Definition: Ptr.h:166
float bin[41]
Definition: plottest35.C:14
TVector2 const & GetPointCm() const
Definition: DirOfGamma.h:35
std::vector< Bin2D > fBins
Definition: DirOfGamma.h:106
double ems::EndPoint::GetAsymmetry ( ) const

Definition at line 154 of file DirOfGamma.cxx.

References fMaxCharge, and fMeanCharge.

155 {
156  if ((fMaxCharge + fMeanCharge) == 0) return 0.0;
157  return ((fMaxCharge - fMeanCharge) / (fMaxCharge + fMeanCharge));
158 }
double fMeanCharge
Definition: DirOfGamma.h:104
double fMaxCharge
Definition: DirOfGamma.h:103
std::vector<Bin2D> const& ems::EndPoint::GetBins2D ( ) const
inline

Definition at line 88 of file DirOfGamma.h.

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

Definition at line 96 of file DirOfGamma.h.

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

Definition at line 90 of file DirOfGamma.h.

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

Definition at line 92 of file DirOfGamma.h.

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

Definition at line 84 of file DirOfGamma.h.

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

Definition at line 94 of file DirOfGamma.h.

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

Definition at line 80 of file DirOfGamma.h.

80 { return fCenter2D.GetPointCm(); }
Hit2D fCenter2D
Definition: DirOfGamma.h:99
TVector2 const & GetPointCm() const
Definition: DirOfGamma.h:35
size_t const& ems::EndPoint::GetTPC ( ) const
inline

Definition at line 95 of file DirOfGamma.h.

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

Definition at line 86 of file DirOfGamma.h.

86 { return fBins[fMaxChargeIdBin]; }
size_t fMaxChargeIdBin
Definition: DirOfGamma.h:108
std::vector< Bin2D > fBins
Definition: DirOfGamma.h:106

Member Data Documentation

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

Definition at line 106 of file DirOfGamma.h.

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

Hit2D ems::EndPoint::fCenter2D
private

Definition at line 99 of file DirOfGamma.h.

Referenced by FillBins().

size_t ems::EndPoint::fCryo
private

Definition at line 116 of file DirOfGamma.h.

Referenced by EndPoint().

double ems::EndPoint::fMaxCharge
private

Definition at line 103 of file DirOfGamma.h.

Referenced by ComputeMaxCharge(), and GetAsymmetry().

size_t ems::EndPoint::fMaxChargeIdBin
private

Definition at line 108 of file DirOfGamma.h.

Referenced by ComputeMaxCharge(), and ComputeMeanCharge().

double ems::EndPoint::fMeanCharge
private

Definition at line 104 of file DirOfGamma.h.

Referenced by ComputeMeanCharge(), and GetAsymmetry().

size_t ems::EndPoint::fNbins
private

Definition at line 101 of file DirOfGamma.h.

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

size_t ems::EndPoint::fPlane
private

Definition at line 114 of file DirOfGamma.h.

Referenced by EndPoint().

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

Definition at line 100 of file DirOfGamma.h.

Referenced by FillBins().

size_t ems::EndPoint::fTpc
private

Definition at line 115 of file DirOfGamma.h.

Referenced by EndPoint().


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