eventAnalysis  7.0-49-g0ac7482
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
TTruthTrajectoriesModule.cxx
Go to the documentation of this file.
2 
3 // c++
4 #include <cstdlib>
5 #include <set>
6 // Root
7 #include <TLorentzVector.h>
8 // oaEvent
9 #include <HEPUnits.hxx>
10 #include <TG4Trajectory.hxx>
11 #include <TND280Log.hxx>
12 // oaGeomInfo
13 #include <TGeomInfo.hxx>
14 
16 
17 #include "../cvstags/TTruthTrajectoriesModule.cxx"
18 
19 
21  const char* title)
22  : fMaxNTrajectories(500),
23  fMinLength(0),
24  fSaveOnlyP0DTrackerECALTrajectories(kTRUE),
25  fSaveParentChain(kTRUE),
26  fNTrajLepton(0),
27  fNTrajBaryon(0),
28  fNTrajMeson(0),
29  fNTrajPhoton(0),
30  fNTrajOtherCharged(0),
31  fNTrajOtherNeutral(0),
32  fTrajectories(
33  new TClonesArray("ND::TTruthTrajectoriesModule::TTruthTrajectory",
34  fMaxNTrajectories)) {
35  SetNameTitle(name, title);
36  fIsEnabled = kTRUE;
37  fDescription =
38  "Module storing the truth information for particle trajectories";
40  fCVSID = CVSID;
41 }
42 
44  delete fTrajectories;
45 }
46 
47 Bool_t ND::TTruthTrajectoriesModule::Configure(std::string& option) {
48  if (option == "saveall" || option == "SaveAll") {
49  SetSaveOnlyP0DTrackerECALTrajectories(kFALSE);
50  ND280Info("Setting TTruthTrajectoriesModule to Save All Trajectories");
51  return kTRUE;
52  }
53  return kFALSE;
54 }
55 
57  fOutputTree->Branch("NTraj", &fNTraj, "NTraj/I", fBufferSize)->SetTitle(" Total number of trajectories saved from the event");
58  fOutputTree->Branch("NTrajLepton", &fNTrajLepton, "NTrajLepton/I",
59  fBufferSize)->SetTitle("Number of Charged Lepton trajectories saved from the event ");
60  fOutputTree->Branch("NTrajBaryon", &fNTrajBaryon, "NTrajBaryon/I",
61  fBufferSize)->SetTitle(" Number of Charged Baryon Trajectories saved from the event ");
62  fOutputTree->Branch("NTrajMeson", &fNTrajMeson, "NTrajMeson/I", fBufferSize)->SetTitle("Number of Charged Meson Trajectories saved from the event ");
63  fOutputTree->Branch("NTrajPhoton", &fNTrajPhoton, "NTrajPhoton/I",
64  fBufferSize)->SetTitle(" Number of Photon Trajectories saved from the event ");
65  fOutputTree->Branch("NTrajOtherCharged", &fNTrajOtherCharged,
66  "NTrajOtherCharged/I", fBufferSize)->SetTitle("Number of Other Charged Trajectories saved from the event ");
67  fOutputTree->Branch("NTrajOtherNeutral", &fNTrajOtherNeutral,
68  "NTrajOtherNeutral/I", fBufferSize)->SetTitle(" Number of Other Neutral Trajectories saved from the event");
69  fOutputTree->Branch("NTrajOther", &fNTrajOther, "NTrajOther/I", fBufferSize)->SetTitle(" Number of Any Other Trajectories saved from the event");
70 
71  fOutputTree->Branch("Trajectories", "TClonesArray", &fTrajectories,
72  fBufferSize, fSplitLevel)->SetTitle(" Clones array of ND::TTruthTrajectoriesModule::TTruthTrajectory sorted in ascending ID order");
73 }
74 
75 Bool_t ND::TTruthTrajectoriesModule::ProcessFirstEvent(ND::TND280Event& event) {
76  bool IsDataFile = event.GetContext().IsDetector();
77  if (IsDataFile) {
78  throw ND::EDataFile();
79  }
80  return true;
81 }
82 
84  ND::THandle<ND::TG4TrajectoryContainer> trajectories) {
85  // Create a set of trajectory IDs for trajectories which satisfy the criteria
86  // to be saved
87 
88  ND::TG4TrajectoryContainer::iterator traj_it = trajectories->begin();
89  ND::TG4TrajectoryContainer::iterator traj_end = trajectories->end();
90  ND::TG4Trajectory* traj;
91 
92  for (; traj_it != traj_end; ++traj_it) {
93  traj = &traj_it->second;
94 
95  if (!this->SaveTraj(traj)) continue;
96 
97  fSaveList.insert(traj->GetTrackId());
98  }
99 
100  if (fSaveParentChain) {
101  // Now need to save the parent chain of every trajectory which was
102  // identified in the first set.
103 
104  // Create a copy of the original save set, else our iterators will become
105  // invalid as we add more elements.
106  std::set<int> original_savelist = fSaveList;
107 
108  // For each element in the original save set, iterate up its parent chain
109  // and make sure the entire chain is in the complete save set. This
110  // procedure is not optimised, but it is simple.
111  int id;
112  std::set<int>::iterator original_savelist_it = original_savelist.begin();
113  std::set<int>::iterator original_savelist_end = original_savelist.end();
114  for (; original_savelist_it != original_savelist_end;
115  ++original_savelist_it) {
116  id = *original_savelist_it;
117 
118  while (id > 0) {
119  fSaveList.insert(id);
120  id = trajectories->GetTrajectory(id)->GetParentId();
121  }
122  }
123  }
124 }
125 
126 bool ND::TTruthTrajectoriesModule::FillTree(ND::TND280Event& event) {
127  if (!event.GetContext().IsMC()) {
128  ND280Info(
129  "Event Context reports event is non-MC. Assuming entire file is non-MC "
130  "and disabling the module.");
131  return false; // disable module
132  }
133 
134  fNTraj = 0;
135  fNTrajLepton = 0;
136  fNTrajBaryon = 0;
137  fNTrajMeson = 0;
138  fNTrajPhoton = 0;
139  fNTrajOtherCharged = 0;
140  fNTrajOtherNeutral = 0;
141  fNTrajOther = 0;
142  fTrajectories->Clear();
143 
144  if (!event.Has<ND::TG4TrajectoryContainer>("truth/G4Trajectories")) {
145  ND280Verbose("No trajectories container found, skipping event.");
146  return true; // this happens occasionally, so don't disable the module
147  }
148 
149  ND::THandle<ND::TG4TrajectoryContainer> trajectories =
150  event.Get<ND::TG4TrajectoryContainer>("truth/G4Trajectories");
151 
152  fSaveList.clear();
153  FillSaveList(trajectories);
154 
155  ND::TG4TrajectoryContainer::iterator traj_it = trajectories->begin();
156  ND::TG4TrajectoryContainer::iterator traj_end = trajectories->end();
157  ND::TG4Trajectory* traj;
159 
160  for (; traj_it != traj_end; ++traj_it) {
161  traj = &traj_it->second;
162 
163  // Check if this trajectory is worth saving
164  if (fSaveList.count(traj->GetTrackId()) == 0) continue;
165 
166  // Protect from empty trajectories (bug encountered while testing)
167  if (traj->GetTrackId() == 0) {
168  ND280Error("Found TG4Trajectory with ID = 0");
169  continue;
170  }
171 
172  //
173  // Do the saving
174 
175  trajToFill = new ((*fTrajectories)[fNTraj]) TTruthTrajectory();
176  ++fNTraj;
177 
178  trajToFill->ID = traj->GetTrackId();
179  trajToFill->PDG = traj->GetPDGEncoding();
180  trajToFill->Name = traj->GetParticleName();
181  trajToFill->Category = GetCategory(traj);
182  trajToFill->ParentID = traj->GetParentId();
183  trajToFill->PrimaryID = trajectories->GetPrimaryId(trajToFill->ID);
184 
185  this->FillTrajectoryPoints(traj, trajToFill);
186  // Trace variables
187  this->FillTraces(traj, trajToFill);
188 
189  trajToFill->InitMomentum = traj->GetInitialMomentum();
190  trajToFill->InitPosition = traj->GetInitialPosition();
191  trajToFill->FinalPosition = traj->GetFinalPosition();
192 
193  // Charge and Mass
194 
195  // ND::G4Trajectory::GetParticle can return 0 if the particle's
196  // PDG number is not found in the PDG database. eventAnalysis defines
197  // its own extended database but should still check in case a
198  // new nucleus is added to the MC, for example.
199  // At the moment this is also triggered by isomers - need to handle this
200  if (traj->GetParticle() == 0) {
201  int pdg = traj->GetPDGEncoding();
202  int i = 0;
203  int a = pdg / 10 % 1000;
204  int z = pdg / 10000 % 1000;
205  TGeoElementRN* rn = TGeoElement::GetElementTable()->GetElementRN(a, z, i);
206  trajToFill->Mass = rn->MassNo() * 938.272046; // ROOT TGeoElementRN
207  // stores mass as nucleon
208  // number therefore convert
209  // to MeV/c2
210  trajToFill->Charge = static_cast<Int_t>(rn->AtomicNo() * 3);
211  } else if (traj->GetParticle()) {
212  // In ROOT the TParticlePDG mass is given in GeV, but we
213  // want MeV
214  trajToFill->Mass = traj->GetParticle()->Mass() * 1000.0;
215  trajToFill->Charge = static_cast<Int_t>(traj->GetParticle()->Charge());
216  } else {
217  ND280Error("PDG number " << traj->GetPDGEncoding()
218  << " does not exist in database. Cannot fill "
219  "Mass and Charge values.");
220  }
221  }
222  // END LOOP OVER TRAJECTORIES
223 
224  // Sorty the clones array so trajectories are in order of ascending ID.
225  fTrajectories->Sort();
226 
227  return true;
228 }
229 
231  ND::TG4Trajectory* const traj) const {
232  // Always save primary trajectories
233  if (traj->GetParentId() == 0) {
234  return true;
235  }
236 
237  // Do not save trajectories if they are outside one of the primary detector
238  // systems and the flag to just save detector trajectories is on
239  if (fSaveOnlyP0DTrackerECALTrajectories) {
240  std::vector<TG4TrajectoryPoint>::const_iterator points_it =
241  traj->GetTrajectoryPoints().begin();
242  std::vector<TG4TrajectoryPoint>::const_iterator points_end =
243  traj->GetTrajectoryPoints().end();
244  bool save = false;
245  std::string volume_name;
246  for (; points_it != points_end; ++points_it) {
247  volume_name = points_it->GetVolumeName();
248  if ((volume_name.find("/Tracker_") != std::string::npos) ||
249  (volume_name.find("/P0D_") != std::string::npos) ||
250  (volume_name.find("/SFG_") != std::string::npos) ||
251  (volume_name.find("TOF_") != std::string::npos) ||
252  (volume_name.find("/TopHAT_") != std::string::npos) ||
253  (volume_name.find("/BottomHAT_") != std::string::npos) ||
254  (volume_name.find("/BrlECal_") != std::string::npos) ||
255  (volume_name.find("/DsECal_") != std::string::npos) ||
256  (volume_name.find("/P0DECal_") != std::string::npos)) {
257  save = true;
258  break;
259  }
260  }
261 
262  if (!save) {
263  return false;
264  }
265  }
266 
267  // Non-primary trajectories, even those in detectors are only saved if their
268  // length is sufficiently long
269  TLorentzVector length = traj->GetInitialPosition() - traj->GetFinalPosition();
270  if ((length.Vect().Mag() < GetMinimumTrajectoryLengthToSave()) ||
271  (traj->GetParentId() == 0)) {
272  return false;
273  }
274 
275  return true;
276 }
277 
279  ND::TG4Trajectory* const traj,
281  const ND::TG4Trajectory::Points& points = traj->GetTrajectoryPoints();
282 
283  for (ND::TG4Trajectory::Points::const_iterator pt = points.begin();
284  pt != points.end(); ++pt) {
285  int proc = 0;
286  int subproc = 0;
287 #if !BEFORE_oaEvent(8, 11, 0)
288  switch (pt->GetProcessType()) {
289 #ifndef SKIP_HADRONIC_TRAJECTORY_POINTS
290  case ND::TG4TrajectoryPoint::kProcessHadronic: {
291  proc = pt->GetProcessType();
292  subproc = pt->GetProcessSubtype();
293  break;
294  }
295 #endif
296 #ifdef INCLUDE_TRANSPORT_TRAJECTORY_POINTS
297  case ND::TG4TrajectoryPoint::kProcessTransportation: {
298  proc = pt->GetProcessType();
299  subproc = pt->GetProcessSubtype();
300  break;
301  }
302 #endif
303 #ifdef INCLUDE_ELECTROMAGNETIC_TRAJECTORY_POINTS
304  case ND::TG4TrajectoryPoint::kProcessElectromagnetic: {
305  proc = pt->GetProcessType();
306  subproc = pt->GetProcessSubtype();
307  break;
308  }
309 #endif
310 #ifdef INCLUDE_DECAY_TRAJECTORY_POINTS
311  case ND::TG4TrajectoryPoint::kProcessDecay: {
312  proc = pt->GetProcessType();
313  subproc = pt->GetProcessSubtype();
314  break;
315  }
316 #endif
317  default: {
318 #ifdef FORCE_ALL_TRAJECTORY_POINTS
319  proc = pt->GetProcessType();
320  subproc = pt->GetProcessSubtype();
321 #endif
322  break;
323  }
324  }
325 #else
326  // ROOT TObject bit field may be set to indicate interaction type.
327  // Bits 14 to 23 are available. The definitions are.
328  //
329  // 15: Inelastic hadronic interaction
330  // 16: Elastic hadronic interaction
331  // 17: Hadronic charge exchange
332  //
333  // 20: Bremsstrahlung
334  // 21: Pair production
335  // 22: Compton scattering
336  //
337  if (pt->TestBit(BIT(15)) != 0) {
338  proc = 4;
339  subproc = 121;
340  } else if (pt->TestBit(BIT(16)) != 0) {
341  proc = 4;
342  subproc = 111;
343  } else if (pt->TestBit(BIT(17)) != 0) {
344  proc = 4;
345  subproc = 141;
346  }
347 #endif
348  if (proc == 0) {
349  continue;
350  }
352  point.ProcessType = proc + 1000 * subproc;
353  point.PositionX = pt->GetPosition().X();
354  point.PositionY = pt->GetPosition().Y();
355  point.PositionZ = pt->GetPosition().Z();
356  point.PositionT = pt->GetPosition().T();
357  point.MomentumX = pt->GetMomentum().X();
358  point.MomentumY = pt->GetMomentum().Y();
359  point.MomentumZ = pt->GetMomentum().Z();
360  trajToFill->Points.push_back(point);
361  }
362 }
363 
365  ND::TG4Trajectory* const traj,
367  // get the points from the trajectory
368  std::vector<ND::TG4TrajectoryPoint> points = traj->GetTrajectoryPoints();
369  if (points.size() <= 0) {
370  ND280Error("Found TG4Trajectory with no trajectory points");
371  return;
372  }
373 
374  // Set the enumerations as if set to none of them
377 
378  // used to manipulate values before being passed to TraceInActive
379  // std::vector<bool> inactive;
380  // used to store the previous point - used for exit position/momenta
381  ND::TG4TrajectoryPoint prev_point;
382  // these are used to fill the stopping positions (last_ are filled everytime,
383  // but only used once)
384  TLorentzVector last_pos;
385  TVector3 last_mom;
386 
387  // Loop over all points in traj
388  std::vector<ND::TG4TrajectoryPoint>::iterator pt_iter = points.begin();
389  std::vector<ND::TG4TrajectoryPoint>::iterator pt_end = points.end();
390 
391  // Variables we'll be using in the loop
392  TString curr_path;
393  std::string path_str;
394  bool is_in_active;
395  TLorentzVector pos;
396  TVector3 mom;
397  TLorentzVector prev_pos;
398  TVector3 prev_mom;
399 
400  ND280Debug("---Looping over new trajectory:");
401  for (; pt_iter != pt_end; ++pt_iter) {
402  // get the current geometry path
403  curr_path = pt_iter->GetVolumeName();
404  path_str = curr_path.Data();
405 
406  // convert the path into a subdetector enumeration
407  curr_subdet = eventAnalysisEnums::PathToSubdetector(path_str);
408 
409  // find out if its in an active volume
410  is_in_active = this->GetIsActive(*pt_iter, curr_subdet);
411 
412  ND280Debug(" -> is in active = "
413  << is_in_active
414  << " for det: " << eventAnalysisEnums::DetectorName(curr_subdet)
415  << " from path:" << curr_path.Data());
416 
417  // Fill vectors if the current subdetector has changed or it is the first
418  // point.
419  if (curr_subdet != prev_subdet || pt_iter == points.begin()) {
420  ND280Debug(" --- above is start of different sub det ---");
421 
422  trajToFill->TraceSubdetectors.push_back(static_cast<int>(curr_subdet));
423  // this is just to keep the length of inactive correct, will assign
424  // correct value later
425  // inactive.push_back(false);
426  trajToFill->TraceInActive.push_back(false);
427 
428  // alliases for current and previous points
429  pos = pt_iter->GetPosition();
430  mom = pt_iter->GetMomentum();
431  prev_pos = prev_point.GetPosition();
432  prev_mom = prev_point.GetMomentum();
433 
434  // these are used to fill the stopping positions (last_ are filled
435  // everytime, but only used once)
436  last_pos = pos;
437  last_mom = mom;
438 
439  // fill entrances with current points
440  trajToFill->TraceEntrancePosition.push_back(pos);
441  trajToFill->TraceEntranceMomentum.push_back(mom);
442  if (pt_iter != points.begin()) {
443  // fill exits with previous points
444  trajToFill->TraceExitPosition.push_back(prev_pos);
445  trajToFill->TraceExitMomentum.push_back(prev_mom);
446  }
447  } // end first point or changed subdetector?
448  else {
449  // If it has not exited the last detector then it has stopped so just get
450  // the last point.
451  last_pos = pt_iter->GetPosition();
452  last_mom = pt_iter->GetMomentum();
453  }
454 
455  // Record whether have been in an active volume whilst traversing the
456  // current detector volume
457  if (is_in_active) {
458  // int current_volume_index = inactive.size()-1;
459  int current_volume_index = trajToFill->TraceInActive.size() - 1;
460  ND280Verbose(
461  "--Setting current active vector to true for element "
462  << current_volume_index << " and sub detector "
464  trajToFill->TraceSubdetectors.at(current_volume_index))));
465 
466  trajToFill->TraceInActive[current_volume_index] = true;
467  } // end is_in_active?
468 
469  // used as the previous points in the next iteration of loop
470  prev_subdet = curr_subdet;
471  prev_point = *pt_iter;
472 
473  } // end iterator over G4Points
474 
475  // Fill final trajectory point position and momentum manually
476  trajToFill->TraceExitPosition.push_back(last_pos);
477  trajToFill->TraceExitMomentum.push_back(last_mom);
478 
479  // check to make sure every vector is the same length
480  unsigned int size = trajToFill->TraceSubdetectors.size();
481  if ((trajToFill->TraceInActive.size() != size) ||
482  (trajToFill->TraceEntrancePosition.size() != size) ||
483  (trajToFill->TraceExitPosition.size() != size) ||
484  (trajToFill->TraceEntranceMomentum.size() != size) ||
485  (trajToFill->TraceExitMomentum.size() != size)) {
486  ND280Warn(
487  "Sizes of Trace prefixed variables don't match. Don't trust the "
488  "results!");
489  }
490 }
491 
492 // In principle you could write this method without the subdetector
493 // argument. But because this has to be done from string comparisons at
494 // the moment, sending the detector give a significant performance
495 // benefit.
497  const ND::TG4TrajectoryPoint& point,
499  switch (det) {
501  double dist = ND::TGeomInfo::Get().FGD().EdgeDistanceFGD1(
502  point.GetPosition().X(), point.GetPosition().Y(),
503  point.GetPosition().Z());
504  if (dist >= 0.0)
505  return true;
506  else
507  return false;
508  } break;
509 
511  double dist = ND::TGeomInfo::Get().FGD().EdgeDistanceFGD2(
512  point.GetPosition().X(), point.GetPosition().Y(),
513  point.GetPosition().Z());
514  if (dist >= 0.0)
515  return true;
516  else
517  return false;
518  } break;
519 
523  TString volume = point.GetVolumeName();
524  // I'm not familiar with the TPC geometry. This is the test
525  // which was in place before I got here, and I can't obviously
526  // see what function to use from oaGeomInfo to get whether
527  // or not a point is in the active region of a TPC.
528  if (volume.Contains("Half"))
529  return true;
530  else
531  return false;
532  } break;
533 
543  // Temporary hack to deal with Bug 526
544  //
545  // ND280 does not save sufficient trajectory points that
546  // a particle traversing the detector will dfinitley have
547  // nodes registered in the Active volume of the detector.
548  // Although it is the Active volume the end-user is
549  // interested in, we need to temporarily condier the entire
550  // ECal volume to be of interest, or nothing will be saved
551  // at all.
552  //
553  // ORIGINAL CODE:
554  // TString volume = point.GetVolumeName();
555  // if( volume.Contains("Active") ) return true;
556  // else return false;
557  //
558  // TEMPORARY CODE:
559  return true;
560  } break;
561 
563  double dist = ND::TGeomInfo::Get().P0D().EdgeDistance(
564  point.GetPosition().X(), point.GetPosition().Y(),
565  point.GetPosition().Z());
566  if (dist >= 0.0)
567  return true;
568  else
569  return false;
570  } break;
571 
572  default:
573  return false;
574  break;
575  }
576 }
577 
579  const ND::TG4Trajectory* const traj) {
581  eventAnalysisEnums::PDGInfoToCategory(traj->GetParticle());
582  switch (category) {
584  ++fNTrajLepton;
585  break;
587  ++fNTrajBaryon;
588  break;
590  ++fNTrajMeson;
591  break;
593  ++fNTrajOtherCharged;
594  break;
596  ++fNTrajPhoton;
597  break;
599  ++fNTrajOtherNeutral;
600  break;
601  default:
602  ++fNTrajOther;
603  }
604  return category;
605 }
606 
607 //
608 // Truth Trajectory
609 // =====================================================================
610 //
611 
613  : ID(-1),
614  PDG(-1),
615  Name("unset"),
616  Category(),
617  InitMomentum(-999999.9, -999999.9, -999999.9, -999999.9),
618  InitPosition(-999999.9, -999999.9, -999999.9, -999999.9),
619  FinalPosition(-999999.9, -999999.9, -999999.9, -999999.9),
620  ParentID(-1),
621  PrimaryID(-1),
622  Mass(-999999.9),
623  Charge(-999999) {
624  TraceSubdetectors.clear();
625  TraceInActive.clear();
626  TraceEntrancePosition.clear();
627  TraceExitPosition.clear();
628  TraceEntranceMomentum.clear();
629  TraceExitMomentum.clear();
630 }
631 
633  const TObject* obj) const {
634  // Sorry about the casting, but I don't want to slow down sorting
635  // by checking that everything compared with is of the correct
636  // type. In any case, you get what you ask for if you try and
637  // use this with anything other than another trajectory.
638 
639  if (this->ID <
640  static_cast<const ND::TTruthTrajectoriesModule::TTruthTrajectory*>(obj)
641  ->ID) {
642  return -1;
643  } else if (this->ID >
644  static_cast<const ND::TTruthTrajectoriesModule::TTruthTrajectory*>(
645  obj)
646  ->ID) {
647  return 1;
648  } else // they must be equal
649  {
650  return 0;
651  }
652 }
#define CVSID
virtual Bool_t Configure(std::string &option)
Method for setting behaviour of module.
std::vector< bool > TraceInActive
Vector of booleans indicating whether the particle went through an active part of the corresponding s...
ClassImp(ND::TBeamSummaryDataModule::TBeamSummaryData)
Int_t ParentID
Parent particle&#39;s Trajectory ID.
std::vector< ND::TTruthTrajectoriesModule::TTruthTrajectoryPoint > Points
The trajectory points where interactions occured along the trajectory.
eventAnalysisEnums::EParticleCategory GetCategory(const ND::TG4Trajectory *const traj)
Determines the EParticleCategory to which a trajectory belongs.
std::string fDescription
A longish descrition of the analysis.
std::vector< TVector3 > TraceExitMomentum
Vector of TVector3s that stores the exit momentum of the particle in each subdetector it encounters...
std::string DetectorName(ESubdetector const subdet)
EParticleCategory PDGInfoToCategory(const TParticlePDG *pdgInfo)
TLorentzVector InitMomentum
The Initial momentum of the particle at creation [MeV].
Float_t MomentumX
The X momentum of the particle leaving the trajectory point [MeV].
Float_t PositionT
The time of the trajectory point [ns].
Contains the truth information for points along the particle trajectories generated during Monte Carl...
void FillSaveList(ND::THandle< ND::TG4TrajectoryContainer > trajectories)
Fills a std::set (fSaveList) with the ID of every trajectory which should be saved for the current ev...
Float_t MomentumY
The Y momentum of the particle leaving the trajectory point [MeV].
std::vector< TLorentzVector > TraceEntrancePosition
Vector of TLorentzVectors that stores the entrance position of the particle in each subdetector it en...
Int_t Charge
Charge in units of |e|/3. (e.g. an electron has charge -3)
std::string fCVSID
Defined if an official tagged version.
virtual bool FillTree(ND::TND280Event &)
Called for each event, this method is the master method for retrieving and filling the Truth Trajecto...
Contains the truth information associated with a particle from Monte Carlo simulations.
virtual void InitializeBranches()
Creates the necessary tree and branches for saving the Truth Trajectories information.
virtual Bool_t ProcessFirstEvent(ND::TND280Event &)
Called for the first event This method checks whether this event is a real-data event an if so throws...
void SetNameTitle(char const *name, char const *title)
void FillTraces(ND::TG4Trajectory *const traj, ND::TTruthTrajectoriesModule::TTruthTrajectory *trajToFill)
Fills vectors of entry/exit positions and momenta of the trajectory for every subdetector traversed...
Int_t PrimaryID
ID of the primary particle at the top of this particle&#39;s parent chain.
Float_t PositionY
The Y position of the trajectory point [mm].
std::vector< TVector3 > TraceEntranceMomentum
Vector of TVector3s that stores the entrance momentum of the particle in each subdetector it encounte...
std::vector< TLorentzVector > TraceExitPosition
Vector of TLorentzVectors that stores the exit position of the particle in each subdetector it encoun...
void FillTrajectoryPoints(ND::TG4Trajectory *const traj, ND::TTruthTrajectoriesModule::TTruthTrajectory *trajToFill)
Fills the vector of trajectory points.
Int_t ProcessType
The process type that caused the Monte Carlo to generate this point.
bool GetIsActive(const ND::TG4TrajectoryPoint &point, eventAnalysisEnums::ESubdetector det) const
Determines if a TG4TrajectoryPoint is in the active region of the specified subdetector.
Int_t Category
Classifier of the particle type.
TLorentzVector FinalPosition
Final Position at which the particle stopped or left the simulation [mm].
std::vector< Int_t > TraceSubdetectors
Vector of integer subdetector codes indicating which subdetectors the particle travelled through...
Float_t PositionX
The X position of the trajectory point [mm].
TLorentzVector InitPosition
Initial Position at which the particle was created [mm].
TTruthTrajectoriesModule(const char *name="Trajectories", const char *title="True Trajectory information")
std::string fCVSTagName
Defined if an official tagged version.
#define CVSTAG
Float_t PositionZ
The Z position of the trajectory point [mm].
ESubdetector PathToSubdetector(const std::string path)
bool SaveTraj(ND::TG4Trajectory *const traj) const
Returns true if a trajectory needs to be saved, and false oterwise.
Int_t Compare(const TObject *obj) const
Comparison function of trajectory IDs so that a TClonesArray can be sorted in ascending ID order...
Float_t MomentumZ
The Z position of the particle leaving the trajectory point [MeV].

Package Summary
Package Name: eventAnalysis
Package Version: 7.0-49-g0ac7482
Package Manager:

Generated on Mon Mar 25 2024 14:43:59 for eventAnalysis by doxygen 1.8.5