LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ems::MCinfo Class Reference

Public Member Functions

 MCinfo ()
 
void Info ()
 
void Findtpcborders ()
 
int GetNgammas () const
 
double GetMompi0 () const
 
double GetMomGamma1 () const
 
double GetMomGamma2 () const
 
double GetCosine ()
 
TVector3 const & GetPrimary () const
 
TVector3 const & GetPospi0 () const
 
TVector3 const & GetPosgamma1 () const
 
TVector3 const & GetPosgamma2 () const
 
TVector3 const & GetDirgamma1 () const
 
TVector3 const & GetDirgamma2 () const
 
bool IsInside1 () const
 
bool IsInside2 () const
 
bool IsCompton () const
 

Private Member Functions

bool insideFidVol (const TLorentzVector &pvtx) const
 

Private Attributes

double fMinx {std::numeric_limits<double>::max()}
 
double fMaxx {std::numeric_limits<double>::min()}
 
double fMiny {std::numeric_limits<double>::max()}
 
double fMaxy {std::numeric_limits<double>::min()}
 
double fMinz {std::numeric_limits<double>::max()}
 
double fMaxz {std::numeric_limits<double>::min()}
 
double fFidVolCut
 
int fNgammas
 
double fMompi0
 
double fGammamom1
 
bool fInside1
 
double fGammamom2
 
bool fInside2
 
double fCosine
 
bool fCompton
 
TVector3 fPrimary
 
TVector3 fPi0pos
 
TVector3 fConvgamma1
 
TVector3 fConvgamma2
 
TVector3 fDirgamma1
 
TVector3 fDirgamma2
 

Detailed Description

Definition at line 42 of file MultiEMShowers_module.cc.

Constructor & Destructor Documentation

ems::MCinfo::MCinfo ( )

Definition at line 100 of file MultiEMShowers_module.cc.

References Findtpcborders(), and Info().

100  : fFidVolCut(2.0)
101 {
102  Info();
103  Findtpcborders();
104 }

Member Function Documentation

void ems::MCinfo::Findtpcborders ( )

Definition at line 106 of file MultiEMShowers_module.cc.

References fMaxx, fMaxy, fMaxz, fMinx, fMiny, fMinz, and geo::GeometryCore::Iterate().

Referenced by MCinfo().

107 {
109  for (const geo::TPCGeo& tpcg : geom->Iterate<geo::TPCGeo>()) {
110  fMinx = std::min(fMinx, tpcg.MinX());
111  fMaxx = std::max(fMaxx, tpcg.MaxX());
112  fMiny = std::min(fMiny, tpcg.MinY());
113  fMaxy = std::max(fMaxy, tpcg.MaxY());
114  fMinz = std::min(fMinz, tpcg.MinZ());
115  fMaxz = std::max(fMaxz, tpcg.MaxZ());
116  }
117 }
details::range_type< T > Iterate() const
Initializes the specified ID with the ID of the first cryostat.
Definition: GeometryCore.h:541
Geometry information for a single TPC.
Definition: TPCGeo.h:36
double ems::MCinfo::GetCosine ( )
inline

Definition at line 54 of file MultiEMShowers_module.cc.

References fCosine.

Referenced by ems::MultiEMShowers::analyze().

54 { return fCosine; }
TVector3 const& ems::MCinfo::GetDirgamma1 ( ) const
inline

Definition at line 61 of file MultiEMShowers_module.cc.

References fDirgamma1.

Referenced by ems::MultiEMShowers::analyze().

61 { return fDirgamma1; }
TVector3 const& ems::MCinfo::GetDirgamma2 ( ) const
inline

Definition at line 62 of file MultiEMShowers_module.cc.

References fDirgamma2.

Referenced by ems::MultiEMShowers::analyze().

62 { return fDirgamma2; }
double ems::MCinfo::GetMomGamma1 ( ) const
inline

Definition at line 51 of file MultiEMShowers_module.cc.

References fGammamom1.

Referenced by ems::MultiEMShowers::analyze().

51 { return fGammamom1; }
double ems::MCinfo::GetMomGamma2 ( ) const
inline

Definition at line 52 of file MultiEMShowers_module.cc.

References fGammamom2.

Referenced by ems::MultiEMShowers::analyze().

52 { return fGammamom2; }
double ems::MCinfo::GetMompi0 ( ) const
inline

Definition at line 50 of file MultiEMShowers_module.cc.

References fMompi0.

Referenced by ems::MultiEMShowers::analyze().

50 { return fMompi0; }
int ems::MCinfo::GetNgammas ( ) const
inline

Definition at line 48 of file MultiEMShowers_module.cc.

References fNgammas.

Referenced by ems::MultiEMShowers::analyze().

48 { return fNgammas; }
TVector3 const& ems::MCinfo::GetPosgamma1 ( ) const
inline

Definition at line 58 of file MultiEMShowers_module.cc.

References fConvgamma1.

Referenced by ems::MultiEMShowers::analyze(), and ems::MultiEMShowers::convCluster().

58 { return fConvgamma1; }
TVector3 const& ems::MCinfo::GetPosgamma2 ( ) const
inline

Definition at line 59 of file MultiEMShowers_module.cc.

References fConvgamma2.

Referenced by ems::MultiEMShowers::analyze(), and ems::MultiEMShowers::convCluster().

59 { return fConvgamma2; }
TVector3 const& ems::MCinfo::GetPospi0 ( ) const
inline

Definition at line 57 of file MultiEMShowers_module.cc.

References fPi0pos.

Referenced by ems::MultiEMShowers::analyze().

57 { return fPi0pos; }
TVector3 const& ems::MCinfo::GetPrimary ( ) const
inline

Definition at line 56 of file MultiEMShowers_module.cc.

References fPrimary.

Referenced by ems::MultiEMShowers::analyze().

56 { return fPrimary; }
void ems::MCinfo::Info ( )

Definition at line 119 of file MultiEMShowers_module.cc.

References sim::ParticleList::begin(), simb::MCParticle::Daughter(), sim::ParticleList::end(), simb::MCParticle::EndProcess(), fCompton, fConvgamma1, fConvgamma2, fCosine, fDirgamma1, fDirgamma2, fGammamom1, fGammamom2, fInside1, fInside2, fMompi0, fNgammas, fPi0pos, fPrimary, insideFidVol(), simb::MCParticle::NumberDaughters(), simb::MCParticle::P(), cheat::ParticleInventoryService::ParticleList(), simb::MCParticle::PdgCode(), simb::MCParticle::Position(), simb::MCParticle::Process(), and cheat::ParticleInventoryService::TrackIdToParticle_P().

Referenced by MCinfo().

120 {
121  fMompi0 = 0.0;
122  fPi0pos.SetXYZ(0, 0, 0);
123  fNgammas = 0;
124  fCosine = 0.0;
125  fInside1 = false;
126  fInside2 = false;
127  fCompton = false;
128 
129  fGammamom1 = 0.0;
130  fGammamom2 = 0.0;
131  fConvgamma1.SetXYZ(0, 0, 0);
132  fConvgamma2.SetXYZ(0, 0, 0);
133  fDirgamma1.SetXYZ(0, 0, 0);
134  fDirgamma2.SetXYZ(0, 0, 0);
135 
137  const sim::ParticleList& plist = pi_serv->ParticleList();
138  for (sim::ParticleList::const_iterator ipar = plist.begin(); ipar != plist.end(); ++ipar) {
139  const simb::MCParticle* particle = ipar->second;
140 
141  if (particle->Process() != "primary") continue;
142 
143  TLorentzVector posvec = particle->Position();
144  TVector3 pose(posvec.X(), posvec.Y(), posvec.Z());
145  fPrimary = pose;
146 
147  if (particle->PdgCode() == 111) {
148  fMompi0 = particle->P();
149 
150  TLorentzVector posvec3 = particle->Position();
151  TVector3 pospi0(posvec3.X(), posvec3.Y(), posvec3.Z());
152  fPi0pos = pospi0;
153 
154  if (particle->NumberDaughters() != 2) continue;
155 
156  const simb::MCParticle* daughter1 = pi_serv->TrackIdToParticle_P(particle->Daughter(0));
157  if (daughter1->PdgCode() != 22) continue;
158 
159  const simb::MCParticle* daughter2 = pi_serv->TrackIdToParticle_P(particle->Daughter(1));
160  if (daughter2->PdgCode() != 22) continue;
161 
162  fNgammas = particle->NumberDaughters();
163  TLorentzVector mom1 = pi_serv->TrackIdToParticle_P(particle->Daughter(0))->Momentum();
164  TLorentzVector mom2 = pi_serv->TrackIdToParticle_P(particle->Daughter(1))->Momentum();
165 
166  // compton process
167  if (daughter1->EndProcess() == "phot") fCompton = true;
168  if (daughter2->EndProcess() == "phot") fCompton = true;
169 
170  TVector3 mom1vec3(mom1.Px(), mom1.Py(), mom1.Pz());
171  fGammamom1 = pi_serv->TrackIdToParticle_P(particle->Daughter(0))->P();
172  TVector3 mom2vec3(mom2.Px(), mom2.Py(), mom2.Pz());
173  fGammamom2 = pi_serv->TrackIdToParticle_P(particle->Daughter(1))->P();
174 
175  TLorentzVector pos1 = pi_serv->TrackIdToParticle_P(particle->Daughter(0))->EndPosition();
176  TLorentzVector pos2 = pi_serv->TrackIdToParticle_P(particle->Daughter(1))->EndPosition();
177 
178  if (insideFidVol(pos1)) fInside1 = true;
179  if (insideFidVol(pos2)) fInside2 = true;
180 
181  fConvgamma1.SetXYZ(pos1.X(), pos1.Y(), pos1.Z());
182  fConvgamma2.SetXYZ(pos2.X(), pos2.Y(), pos2.Z());
183 
184  TVector3 vecnorm1 = mom1vec3.Unit();
185  fDirgamma1 = vecnorm1;
186  TVector3 vecnorm2 = mom2vec3.Unit();
187  fDirgamma2 = vecnorm2;
188 
190  }
191  else {
192  fNgammas = particle->NumberDaughters();
193  }
194  }
195 }
const TLorentzVector & Position(const int i=0) const
Definition: MCParticle.h:220
int PdgCode() const
Definition: MCParticle.h:213
const simb::MCParticle * TrackIdToParticle_P(int id) const
list_type::const_iterator const_iterator
Definition: ParticleList.h:132
std::string Process() const
Definition: MCParticle.h:216
int NumberDaughters() const
Definition: MCParticle.h:218
int Daughter(const int i) const
Definition: MCParticle.cxx:118
std::string EndProcess() const
Definition: MCParticle.h:217
double P(const int i=0) const
Definition: MCParticle.h:235
iterator begin()
Definition: ParticleList.h:305
const sim::ParticleList & ParticleList() const
bool insideFidVol(const TLorentzVector &pvtx) const
bool ems::MCinfo::insideFidVol ( const TLorentzVector &  pvtx) const
private

Definition at line 197 of file MultiEMShowers_module.cc.

References fFidVolCut, fMaxx, fMaxy, fMaxz, fMinx, fMiny, and fMinz.

Referenced by Info(), and IsCompton().

198 {
199 
200  bool inside = false;
201  //x
202  double dista = fabs(fMinx - pvtx.X());
203  double distb = fabs(pvtx.X() - fMaxx);
204  if ((pvtx.X() > fMinx) && (pvtx.X() < fMaxx) && (dista > fFidVolCut) && (distb > fFidVolCut))
205  inside = true;
206  //y
207  dista = fabs(fMaxy - pvtx.Y());
208  distb = fabs(pvtx.Y() - fMiny);
209  if (inside && (pvtx.Y() > fMiny) && (pvtx.Y() < fMaxy) && (dista > fFidVolCut) &&
210  (distb > fFidVolCut))
211  inside = true;
212  else
213  inside = false;
214 
215  //z
216  dista = fabs(fMaxz - pvtx.Z());
217  distb = fabs(pvtx.Z() - fMinz);
218  if (inside && (pvtx.Z() > fMinz) && (pvtx.Z() < fMaxz) && (dista > fFidVolCut) &&
219  (distb > fFidVolCut))
220  inside = true;
221  else
222  inside = false;
223 
224  return inside;
225 }
bool ems::MCinfo::IsCompton ( ) const
inline

Definition at line 67 of file MultiEMShowers_module.cc.

References fCompton, and insideFidVol().

Referenced by ems::MultiEMShowers::analyze().

67 { return fCompton; }
bool ems::MCinfo::IsInside1 ( ) const
inline

Definition at line 64 of file MultiEMShowers_module.cc.

References fInside1.

Referenced by ems::MultiEMShowers::analyze().

64 { return fInside1; }
bool ems::MCinfo::IsInside2 ( ) const
inline

Definition at line 65 of file MultiEMShowers_module.cc.

References fInside2.

Referenced by ems::MultiEMShowers::analyze().

65 { return fInside2; }

Member Data Documentation

bool ems::MCinfo::fCompton
private

Definition at line 90 of file MultiEMShowers_module.cc.

Referenced by Info(), and IsCompton().

TVector3 ems::MCinfo::fConvgamma1
private

Definition at line 94 of file MultiEMShowers_module.cc.

Referenced by GetPosgamma1(), and Info().

TVector3 ems::MCinfo::fConvgamma2
private

Definition at line 95 of file MultiEMShowers_module.cc.

Referenced by GetPosgamma2(), and Info().

double ems::MCinfo::fCosine
private

Definition at line 88 of file MultiEMShowers_module.cc.

Referenced by GetCosine(), and Info().

TVector3 ems::MCinfo::fDirgamma1
private

Definition at line 96 of file MultiEMShowers_module.cc.

Referenced by GetDirgamma1(), and Info().

TVector3 ems::MCinfo::fDirgamma2
private

Definition at line 97 of file MultiEMShowers_module.cc.

Referenced by GetDirgamma2(), and Info().

double ems::MCinfo::fFidVolCut
private

Definition at line 78 of file MultiEMShowers_module.cc.

Referenced by insideFidVol().

double ems::MCinfo::fGammamom1
private

Definition at line 83 of file MultiEMShowers_module.cc.

Referenced by GetMomGamma1(), and Info().

double ems::MCinfo::fGammamom2
private

Definition at line 85 of file MultiEMShowers_module.cc.

Referenced by GetMomGamma2(), and Info().

bool ems::MCinfo::fInside1
private

Definition at line 84 of file MultiEMShowers_module.cc.

Referenced by Info(), and IsInside1().

bool ems::MCinfo::fInside2
private

Definition at line 86 of file MultiEMShowers_module.cc.

Referenced by Info(), and IsInside2().

double ems::MCinfo::fMaxx {std::numeric_limits<double>::min()}
private

Definition at line 72 of file MultiEMShowers_module.cc.

Referenced by Findtpcborders(), and insideFidVol().

double ems::MCinfo::fMaxy {std::numeric_limits<double>::min()}
private

Definition at line 74 of file MultiEMShowers_module.cc.

Referenced by Findtpcborders(), and insideFidVol().

double ems::MCinfo::fMaxz {std::numeric_limits<double>::min()}
private

Definition at line 76 of file MultiEMShowers_module.cc.

Referenced by Findtpcborders(), and insideFidVol().

double ems::MCinfo::fMinx {std::numeric_limits<double>::max()}
private

Definition at line 71 of file MultiEMShowers_module.cc.

Referenced by Findtpcborders(), and insideFidVol().

double ems::MCinfo::fMiny {std::numeric_limits<double>::max()}
private

Definition at line 73 of file MultiEMShowers_module.cc.

Referenced by Findtpcborders(), and insideFidVol().

double ems::MCinfo::fMinz {std::numeric_limits<double>::max()}
private

Definition at line 75 of file MultiEMShowers_module.cc.

Referenced by Findtpcborders(), and insideFidVol().

double ems::MCinfo::fMompi0
private

Definition at line 82 of file MultiEMShowers_module.cc.

Referenced by GetMompi0(), and Info().

int ems::MCinfo::fNgammas
private

Definition at line 80 of file MultiEMShowers_module.cc.

Referenced by GetNgammas(), and Info().

TVector3 ems::MCinfo::fPi0pos
private

Definition at line 93 of file MultiEMShowers_module.cc.

Referenced by GetPospi0(), and Info().

TVector3 ems::MCinfo::fPrimary
private

Definition at line 92 of file MultiEMShowers_module.cc.

Referenced by GetPrimary(), and Info().


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