LArSoft  v10_04_05
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 43 of file MultiEMShowers_module.cc.

Constructor & Destructor Documentation

ems::MCinfo::MCinfo ( )

Definition at line 101 of file MultiEMShowers_module.cc.

References Findtpcborders(), and Info().

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

Member Function Documentation

void ems::MCinfo::Findtpcborders ( )

Definition at line 107 of file MultiEMShowers_module.cc.

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

Referenced by MCinfo().

108 {
110  for (const geo::TPCGeo& tpcg : geom->Iterate<geo::TPCGeo>()) {
111  fMinx = std::min(fMinx, tpcg.MinX());
112  fMaxx = std::max(fMaxx, tpcg.MaxX());
113  fMiny = std::min(fMiny, tpcg.MinY());
114  fMaxy = std::max(fMaxy, tpcg.MaxY());
115  fMinz = std::min(fMinz, tpcg.MinZ());
116  fMaxz = std::max(fMaxz, tpcg.MaxZ());
117  }
118 }
Geometry information for a single TPC.
Definition: TPCGeo.h:33
double ems::MCinfo::GetCosine ( )
inline

Definition at line 55 of file MultiEMShowers_module.cc.

References fCosine.

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

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

Definition at line 62 of file MultiEMShowers_module.cc.

References fDirgamma1.

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

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

Definition at line 63 of file MultiEMShowers_module.cc.

References fDirgamma2.

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

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

Definition at line 52 of file MultiEMShowers_module.cc.

References fGammamom1.

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

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

Definition at line 53 of file MultiEMShowers_module.cc.

References fGammamom2.

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

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

Definition at line 51 of file MultiEMShowers_module.cc.

References fMompi0.

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

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

Definition at line 49 of file MultiEMShowers_module.cc.

References fNgammas.

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

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

Definition at line 59 of file MultiEMShowers_module.cc.

References fConvgamma1.

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

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

Definition at line 60 of file MultiEMShowers_module.cc.

References fConvgamma2.

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

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

Definition at line 58 of file MultiEMShowers_module.cc.

References fPi0pos.

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

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

Definition at line 57 of file MultiEMShowers_module.cc.

References fPrimary.

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

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

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

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

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

Referenced by Info(), and IsCompton().

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

Definition at line 68 of file MultiEMShowers_module.cc.

References fCompton, and insideFidVol().

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

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

Definition at line 65 of file MultiEMShowers_module.cc.

References fInside1.

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

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

Definition at line 66 of file MultiEMShowers_module.cc.

References fInside2.

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

66 { return fInside2; }

Member Data Documentation

bool ems::MCinfo::fCompton
private

Definition at line 91 of file MultiEMShowers_module.cc.

Referenced by Info(), and IsCompton().

TVector3 ems::MCinfo::fConvgamma1
private

Definition at line 95 of file MultiEMShowers_module.cc.

Referenced by GetPosgamma1(), and Info().

TVector3 ems::MCinfo::fConvgamma2
private

Definition at line 96 of file MultiEMShowers_module.cc.

Referenced by GetPosgamma2(), and Info().

double ems::MCinfo::fCosine
private

Definition at line 89 of file MultiEMShowers_module.cc.

Referenced by GetCosine(), and Info().

TVector3 ems::MCinfo::fDirgamma1
private

Definition at line 97 of file MultiEMShowers_module.cc.

Referenced by GetDirgamma1(), and Info().

TVector3 ems::MCinfo::fDirgamma2
private

Definition at line 98 of file MultiEMShowers_module.cc.

Referenced by GetDirgamma2(), and Info().

double ems::MCinfo::fFidVolCut
private

Definition at line 79 of file MultiEMShowers_module.cc.

Referenced by insideFidVol().

double ems::MCinfo::fGammamom1
private

Definition at line 84 of file MultiEMShowers_module.cc.

Referenced by GetMomGamma1(), and Info().

double ems::MCinfo::fGammamom2
private

Definition at line 86 of file MultiEMShowers_module.cc.

Referenced by GetMomGamma2(), and Info().

bool ems::MCinfo::fInside1
private

Definition at line 85 of file MultiEMShowers_module.cc.

Referenced by Info(), and IsInside1().

bool ems::MCinfo::fInside2
private

Definition at line 87 of file MultiEMShowers_module.cc.

Referenced by Info(), and IsInside2().

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

Definition at line 73 of file MultiEMShowers_module.cc.

Referenced by Findtpcborders(), and insideFidVol().

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

Definition at line 75 of file MultiEMShowers_module.cc.

Referenced by Findtpcborders(), and insideFidVol().

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

Definition at line 77 of file MultiEMShowers_module.cc.

Referenced by Findtpcborders(), and insideFidVol().

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

Definition at line 72 of file MultiEMShowers_module.cc.

Referenced by Findtpcborders(), and insideFidVol().

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

Definition at line 74 of file MultiEMShowers_module.cc.

Referenced by Findtpcborders(), and insideFidVol().

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

Definition at line 76 of file MultiEMShowers_module.cc.

Referenced by Findtpcborders(), and insideFidVol().

double ems::MCinfo::fMompi0
private

Definition at line 83 of file MultiEMShowers_module.cc.

Referenced by GetMompi0(), and Info().

int ems::MCinfo::fNgammas
private

Definition at line 81 of file MultiEMShowers_module.cc.

Referenced by GetNgammas(), and Info().

TVector3 ems::MCinfo::fPi0pos
private

Definition at line 94 of file MultiEMShowers_module.cc.

Referenced by GetPospi0(), and Info().

TVector3 ems::MCinfo::fPrimary
private

Definition at line 93 of file MultiEMShowers_module.cc.

Referenced by GetPrimary(), and Info().


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