G4Alg.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // $Id: G4Alg.cxx,v 1.6 2012-12-03 23:52:01 rhatcher Exp $
3 //
4 // Geant4 Driver Module
5 //
6 // brebel@fnal.gov
7 //
8 ////////////////////////////////////////////////////////////////////////
9 #include <cassert>
10 #include <cstdlib>
11 #include <string>
12 #include <sstream>
13 #include <sys/stat.h>
14 #include <vector>
15 #include <map>
16 #include <unistd.h>
17 
18 // NOvA includes
19 #include "Geometry/Geometry.h"
20 #include "g4nova/G4Alg.h"
23 #include "nug4/G4Base/UserActionManager.h"
24 #include "nug4/G4Base/UserActionFactory.h"
25 #include "nug4/G4Base/G4Helper.h"
27 #include "Simulation/FLSHitList.h"
28 #include "Simulation/Particle.h"
29 
30 // Framework includes
31 #include "fhiclcpp/ParameterSet.h"
34 #include "cetlib/search_path.h"
35 
36 // Geant4 includes
37 #include "Geant4/G4ParticleTable.hh"
38 #include "Geant4/G4MaterialPropertiesTable.hh"
39 
40 // Includ needed to configure neutron substitution
42 
43 namespace g4n {
44 
45  //____________________________________________________________________________
46  // Constructor
48  : fG4Help(0)
49  , fG4PhysListName (pset.get< std::string >("G4PhysListName", "QGSP_BERT" ) )
50  , fEnergyThresh (pset.get< double >("G4EnergyThreshold") )
51  , fManyParticles (pset.get< bool >("ManyParticles") )
52  , fSparseTrajectories (pset.get< bool >("SparseTrajectories") )
53  , fIsRockVetoUsed (pset.get< bool >("G4CheckRockVeto") )
54  , fSlimSimParticles (pset.get< bool >("SlimSimParticles") )
55  , fGenModuleLabel (pset.get< std::string >("GenModuleLabel") )
56  , fPlaIndex(0)
57  , fFlsIndex(0)
58  , fPrintTables (pset.get< bool >("PrintTables") )
59  {
60 
61  /// In principle the next two should just be always the start of the
62  /// UserAction list, but for now handle these separately until they
63  /// learn to config from Config()
64  // fUserActions.push_back("ParticleListAction");
65  // fUserActions.push_back("FLSHitListAction");
66 
67  /// dummy vector in case user didn't set "AddedUserActions" in fcl file
68  std::vector<std::string> nullstrvec; // empty vector of strings
69  const std::vector<std::string>& psetstrvec =
70  pset.get< std::vector<std::string> >("AddedUserActions",nullstrvec);
71 
72  for (size_t j=0; j < psetstrvec.size(); ++j) {
73  fUserActions.push_back(psetstrvec[j]); // append user entries to list of actions
74  }
75 
76  /// dummy vectors in case user didn't set "OverrideLifetimePDG"
77  /// or "OverrideLifetimeNS"
78  std::vector<int> nullintvec;
79  std::vector<double> nulldblvec;
80  fOverrideLifetimePDG = pset.get< std::vector<int> >("OverrideLifetimePDG",nullintvec);
81  fOverrideLifetimeNS = pset.get< std::vector<double> >("OverrideLifetimeNS",nulldblvec);
82  size_t npdg = fOverrideLifetimePDG.size();
83  size_t ntime = fOverrideLifetimeNS.size();
84 
85  if ( npdg != ntime ) {
86  mf::LogError("G4Alg")
87  << "Attempt to override PDG lifetime in Geant4 failed\n"
88  << "due to size mismatch: "
89  << npdg << " PDG vs. " << ntime << " times";
90 
91  fOverrideLifetimePDG.clear();
92  fOverrideLifetimeNS.clear();
93 
94  throw cet::exception("OverrideLifetimePairMismatch")
95  << "Can't override G4 particle lifetimes without matching set: "
96  << npdg << " PDG vs. " << ntime << " times" << "\n"
97  << __FILE__ << ":" << __LINE__ << "\n";
98  }
99 
100  // Configure neutron substitution. There doesn't seem to be any built in
101  // way to configure physics processes in geant?
102  if(fG4PhysListName.find("g4n::NeutronSubstitutionPhysics") != std::string::npos){
103  g4n::NeutronSubstitutionPhysics::SetMinKE(pset.get<double>("NeutronSubstitutionMinKE"));
104  g4n::NeutronSubstitutionPhysics::SetMaxKE(pset.get<double>("NeutronSubstitutionMaxKE"));
105  g4n::NeutronSubstitutionPhysics::SetFatesFile(pset.get<std::string>("NeutronSubstitutionFatesFile"));
106  }
107 
108  // Constructor decides if initialized value is a path or
109  // an environment variable
110  cet::search_path sp("FW_SEARCH_PATH");
111 
112  sp.find_file(pset.get< std::string >("G4MacroPath"), fG4MacroPath);
113  struct stat sb;
114  if ( fG4MacroPath.empty() || stat(fG4MacroPath.c_str(), &sb)!=0 ) {
115  // failed to resolve the file name
116  throw cet::exception("NoG4Macro")
117  << "G4 macro file " << fG4MacroPath << " not found!\n"
118  << __FILE__ << ":" << __LINE__ << "\n";
119  }
120 
121  // need to instantiate the G4Helper in order to make the
122  // G4RunManager and pass it the physics list - G4 really dislikes
123  // it if you try to make a G4UserRunAction (ie UserActionManager)
124  // before passing a physics list to the run manager
126  fG4Help = new g4b::G4Helper(fG4MacroPath,
128  geo->GDMLFile());
129 
130  // more control over GDML processing (before InitPhysics)
131  const bool dfltOverlap = false;
132  const bool dfltSchema = true;
133  bool overlapCheck = pset.get< bool >("G4OverlapCheck",dfltOverlap);
134  bool validateGDMLSchema = pset.get< bool >("G4ValidateGDMLSchema",dfltSchema);
135  if ( dfltOverlap != overlapCheck || dfltSchema != validateGDMLSchema ) {
136  mf::LogInfo("G4Alg") << "non-standard GDML processing: "
137  << std::boolalpha
138  << "overlapCheck " << overlapCheck
139  << " [" << dfltOverlap << "] "
140  << "validateGDMLSchema " << validateGDMLSchema
141  << " ]" << dfltSchema << "] "
142  << std::noboolalpha;
143  }
144  fG4Help->SetOverlapCheck(overlapCheck);
145  fG4Help->SetValidateGDMLSchema(validateGDMLSchema);
146 
147  // Initialize the helper (physics stage)
148  fG4Help->InitPhysics();
149 
150  G4Material * steel = G4Material::GetMaterial("Steel");
151 
152  if(steel != NULL){
153  if(steel->GetMaterialPropertiesTable() == NULL)
154  steel->SetMaterialPropertiesTable(new G4MaterialPropertiesTable);
155  steel->GetMaterialPropertiesTable()->AddConstProperty("conductor", 1);
156  }
157 
158  // Geant4 comes with "user hooks" that allows users to perform
159  // special tasks at the beginning and end of runs, events, tracks,
160  // steps. By using the UserActionManager, we've separated each
161  // set of user tasks into their own class; e.g., there can be one
162  // class for processing voxels, one class for processing
163  // particles, one class for histograms, etc.
164 
165  // All UserActions must be adopted after the InitMC call
166 
167  // Setup the user actions that we want to use.
168  g4b::UserActionManager* uam = g4b::UserActionManager::Instance();
169 
171  fls->SetName("g4n::FLSHitListAction");
172  fls->Config( pset );
173 
175  pl->SetName("g4n::ParticleListAction");
176  pl->Config( pset );
177 
178  // the ParticleListAction must be added to the UserActionManager
179  // first as it has to define the track ID in the case that the
180  // current particle to track is from an EM process that would cause
181  // it not to be added to the list and the track ID has to be
182  // reassigned to be the same as its mother.
183  uam->AddAndAdoptAction(pl);
184  fPlaIndex = uam->GetSize() - 1;
185  //if (false) std::cerr << "RWH: fPlaIndex " << fPlaIndex
186  // << " vs " << uam->GetIndex("g4n::ParticleListAction")
187  // << std::endl;
188 
189 
190  uam->AddAndAdoptAction(fls);
191  fFlsIndex = uam->GetSize() - 1;
192  //if (false) std::cerr << "RWH: fFlsIndex " << fFlsIndex
193  // << " vs " << uam->GetIndex("g4n::FLSHitListAction")
194  // << std::endl;
195 
197 
198  uam->PrintActionList("config");
199 
200  // Complete the initialize the helper (actions+finalize stage)
201  fG4Help->SetUserAction();
202 
203  // Allow user to adjust particle lifetimes
205 
206  return;
207  }// end of constructor
208 
209  //____________________________________________________________________________
210  // Destructor
212  {
213  if (fG4Help) delete fG4Help;
214  } // end of destructor
215 
216  //______________________________________________________________________________
217  void G4Alg::ConfigUserActionManager(std::vector<std::string> const& actionList,
218  fhicl::ParameterSet const& pset)
219  {
220 
221  /// additional user supplied UserAction classes
222 
223  // UserActionManager is a singleton, so get a handle
224  g4b::UserActionManager* uam = g4b::UserActionManager::Instance();
225 
226  // The factory is also a singleton
227  g4b::UserActionFactory& uafactory = g4b::UserActionFactory::Instance();
228 
229 
230  // given a list of classes, ask the factory for a copy and configure
231  // it before handing it to the manager
232 
233  for (size_t j = 0; j < actionList.size(); ++j ) {
234 
235  std::string uaname = actionList[j]; // will use name for finding pset too
236  g4b::UserAction* ua = uafactory.GetUserAction(uaname);
237 
238  if( ua ){
239  // factory constructed a UserAction, now configure it
240  // parameter set name can't have colons
241  // (ie not namespace qualified class used to create our object)
242  // take only the class name portion
243  size_t icolon = uaname.find_last_of(":");
244  if ( icolon == std::string::npos ) icolon = -1;
245  std::string psetname = uaname.substr(icolon+1); // don't include colon
246 
247  // check if there is a sub-pset with the same name as the
248  // (non-namespaced) class name we're trying to configure
249  fhicl::ParameterSet uapset; // for holding results of fetching sub-pset
250  bool found = pset.get_if_present< fhicl::ParameterSet >(psetname,uapset);
251 
252  mf::LogInfo("G4Alg") << "UserAction \"" << uaname << "\" to be Config() with "
253  << ( ( found ) ? "\"" : "G4AlgPSet, couldn't find \"" )
254  << psetname << "\" pset";
255 
256  // if no named sub-pset available, pass the one G4Alg got
257  fhicl::ParameterSet const& pset2pass = ( found ) ? uapset : pset;
258 
259  // configure using _some_ pset
260  ua->Config(pset2pass);
261  // add to the manager
262  uam->AddAndAdoptAction(ua);
263 
264  }
265  else {
266  // ooops, factory failed ... let someone know
267 
268  const std::vector<std::string>& availActions = uafactory.AvailableUserActions();
269  LOG_VERBATIM("G4Alg") << "g4n::G4Alg requested UserAction \"" << uaname << "\" from "
270  << "g4b::UserActionFactory" << std::endl
271  << "but it only knows about: ";
272  for(size_t k=0; k<availActions.size(); ++k)
273  LOG_VERBATIM("G4Alg") << " " << availActions[k];
274  LOG_VERBATIM("G4Alg") << "proceeding without this action";
275  }
276  }
277  }
278 
279  //______________________________________________________________________________
280  void G4Alg::RunGeant(std::vector< art::Handle< std::vector<simb::MCTruth> > >& mclists,
281  std::vector< sim::FLSHitList >& flshitlist,
282  std::vector< sim::Particle >& particlelist,
283  std::vector< std::vector< std::pair<size_t, size_t> > >& pListLimits)
284  {
285  g4b::UserActionManager* uam = g4b::UserActionManager::Instance();
286  dynamic_cast<g4n::ParticleListAction*>(uam->GetAction(fPlaIndex))->ResetAbortFlag();
287  dynamic_cast<ParticleListAction *>(uam->GetAction(fPlaIndex))->ResetTrackIDOffset();
288 
289  particlelist.clear();
290  flshitlist .clear();
291 
292  // pListLimits keeps track of the index of first particle for a given MCTruth
293  // in the particlelist vector and the index beyond the last particle
294  pListLimits .clear();
295  pListLimits .resize(mclists.size());
296 
297  // Need to process Geant4 simulation for each interaction separately.
298  for(size_t mcl = 0; mcl < mclists.size(); ++mcl){
299 
300  art::Handle< std::vector<simb::MCTruth> > mclistHandle = mclists[mcl];
301 
302  for(size_t i = 0; i < mclistHandle->size(); ++i){
303  const simb::MCTruth* mct(&(*mclistHandle)[i]);
304 
305  size_t start = particlelist.size();
306  this->RunGeant(mct, flshitlist, particlelist);
307  size_t end = particlelist.size();
308 
309  pListLimits[mcl].push_back(std::pair<size_t, size_t>(start, end));
310 
311  }// end of loop over interactions in the current handle
312  }// end loop over handles
313 
314  return;
315  }// end of RunGeant
316 
317  //______________________________________________________________________________
318  void G4Alg::RunGeant(std::vector< const simb::MCTruth* >& mctruths,
319  std::vector< sim::FLSHitList >& flshitlist,
320  std::vector< sim::Particle >& particlelist,
321  std::map<int, size_t>& trackIDToMCTruthIndex)
322  {
323  g4b::UserActionManager* uam = g4b::UserActionManager::Instance();
324  dynamic_cast<g4n::ParticleListAction*>(uam->GetAction(fPlaIndex))->ResetAbortFlag();
325  ParticleListAction* pla = dynamic_cast<ParticleListAction *>(uam->GetAction(fPlaIndex));
326  pla->ResetTrackIDOffset();
327 
328  particlelist.clear();
329  flshitlist .clear();
330 
331  // trackIDToMCTruthIndex keeps track of which trackIDs correspond to which MCTruth
332  // in mctruths
333  trackIDToMCTruthIndex.clear();
334 
335  fG4Help->G4Run(mctruths);
336 
337  this->CollectFLSHitsAndParticles(flshitlist, particlelist);
338  trackIDToMCTruthIndex = pla->TrackIDToMCTruthIndexMap();
339 
340  return;
341  }// end of RunGeant
342 
343  //______________________________________________________________________________
345  std::vector< sim::FLSHitList >& flshitlist,
346  std::vector< sim::Particle >& particlelist,
347  int trackIDOffset)
348  {
349  this->RunGeant(mctruth.get(), flshitlist, particlelist, trackIDOffset);
350  }
351 
352  //______________________________________________________________________________
353  void G4Alg::RunGeant(const simb::MCTruth* mctruth,
354  std::vector< sim::FLSHitList > & flshitlist,
355  std::vector< sim::Particle > & particlelist,
356  int trackIDOffset)
357  {
358  g4b::UserActionManager* uam = g4b::UserActionManager::Instance();
359  dynamic_cast<g4n::ParticleListAction*>(uam->GetAction(fPlaIndex))->ResetAbortFlag();
360 
361  LOG_DEBUG("G4Alg") << *mctruth;
362 
363  if(trackIDOffset > 0){
364  dynamic_cast<ParticleListAction *>(uam->GetAction(fPlaIndex))->ResetTrackIDOffset(trackIDOffset);
365  }
366 
367  // The following tells Geant4 to track the particles in this interaction.
368  fG4Help->G4Run(mctruth);
369 
370  this->CollectFLSHitsAndParticles(flshitlist, particlelist);
371 
372  return;
373  }// end RunGeant for a single simb::MCTruth
374 
376  {
377  g4b::UserActionManager* uam = g4b::UserActionManager::Instance();
378  return dynamic_cast<g4n::ParticleListAction*>(uam->GetAction(fPlaIndex))->IsAborted();
379  } // Check whether Geant event was aborted
380 
381  //______________________________________________________________________________
382  // this method does the work of sorting out the various fls hits and particles that
383  // we want returned from the simulation, ie removing those that leave no trace in
384  // a detector, etc
385  void G4Alg::CollectFLSHitsAndParticles(std::vector< sim::FLSHitList > & flshitlist,
386  std::vector< sim::Particle > & particlelist)
387  {
388  // Make auto_pts of the lists.
389  g4b::UserActionManager* uam = g4b::UserActionManager::Instance();
390  sim::FLSHitList& flshl = *(dynamic_cast<FLSHitListAction *>(uam->GetAction(fFlsIndex))->GetList());
391  std::vector<sim::Particle> pl = dynamic_cast<ParticleListAction *>(uam->GetAction(fPlaIndex))->GetList();
392 
394  for(unsigned int n = 0; n < pl.size(); ++n){
395  pl[n].SparsifyTrajectory();
396  }
397  }
398 
399  /* If the list of FLS hits for this MCTruth is empty, then we
400  should not store any of the associated sim::Particle objects.
401  (Just be done at this point and return.) */
402  if(fSlimSimParticles){
403  if ( flshl.fHits.empty() ) return;
404  }
405 
406  // Push them to the total vector of FLSHitList
407  flshitlist.push_back(flshl);
408 
409  if ( fSlimSimParticles ) {
410  // Keep only particles associated with FLS hits, either directly
411  // or through an ancestor (e.g. if it entered or exited the detector)
412  std::set<int> IDsToStore;
413  // First start with IDs directly associated with FLS hits
414  for ( size_t h = 0; h < flshl.fHits.size(); ++h ) {
415  IDsToStore.insert(flshl.fHits[h].GetTrackID());
416  }
417  // Loop through particles to find descendants of FLS-hit-makers
418  std::set<sim::Particle> partsToStore;
419  for ( size_t p = 0; p < pl.size(); ++p ) {
420  sim::Particle *thisParticle = &pl[p];
421  bool assocWithFLS(false);
422  if ( IDsToStore.find( thisParticle->TrackId() ) != IDsToStore.end() ) {
423  // Directly associated with an FLS hit! Keep it.
424  assocWithFLS = true;
425  }
426  int motherTrkID = thisParticle->Mother();
427  while ( !assocWithFLS && motherTrkID != 0 ) {
428  // Is this ancestor associated with an FLS hit?
429  if ( IDsToStore.find( motherTrkID ) != IDsToStore.end() ) assocWithFLS = true;
430  for ( size_t i = 0; i < pl.size(); ++i ) {
431  if ( pl[i].TrackId() == motherTrkID ) motherTrkID = pl[i].Mother();
432  }
433  }
434  if ( assocWithFLS ) {
435  partsToStore.insert( *thisParticle );
436  IDsToStore.insert( thisParticle->TrackId() );
437  }
438  }
439  // Loop through selected particles to find and include all of their ancestors
440  for ( size_t p = 0; p < pl.size(); ++p ) {
441  if ( IDsToStore.find(pl[p].TrackId()) != IDsToStore.end() ) {
442  // Add this particle and its ancestors to the list of particles to keep
443  sim::Particle *thisParticle = &pl[p];
444  while ( thisParticle->Mother() != 0 ) {
445  // Get the mother
446  for ( size_t i = 0; i < pl.size(); ++i ) {
447  if ( pl[i].TrackId() == thisParticle->Mother() ) {
448  thisParticle = &pl[i];
449  }
450  }
451  partsToStore.insert( *thisParticle );
452  IDsToStore.insert( thisParticle->TrackId() );
453  }
454  }
455  }
456  // One more loop to keep all primaries (particles with Mother ID = 0)
457  for ( size_t p = 0; p < pl.size(); ++p ) {
458  sim::Particle *thisParticle = &pl[p];
459  if ( thisParticle->Mother() == 0 ) {
460  partsToStore.insert( *thisParticle );
461  IDsToStore.insert( thisParticle->TrackId() );
462  }
463  }
464  // Transfer the selected particles to the particle list
465  for( std::set<sim::Particle>::iterator p = partsToStore.begin();
466  p != partsToStore.end(); ++p ) {
467  // Recreate this particle in order to slim down the daughter list, too
468  sim::Particle newParticle(p->TrackId(),
469  p->PdgCode(),
470  p->Process(),
471  p->Mother(),
472  p->Mass(),
473  p->StatusCode() );
474  newParticle.SetPolarization( p->Polarization() );
475  sim::Particle part = *p; newParticle.SetGvtx( part.GetGvtx() );
476  newParticle.SetRescatter( p->Rescatter() );
477  newParticle.SetWeight( p->Weight() );
478  simb::MCTrajectory traj = p->Trajectory();
479  for ( int t = 0; t < (int)traj.size(); ++t ) {
480  newParticle.AddTrajectoryPoint( traj.Position(t), traj.Momentum(t) );
481  }
482  for ( int d = 0; d < p->NumberDaughters(); ++d ) {
483  int trkID = p->Daughter(d);
484  if ( IDsToStore.find( trkID ) != IDsToStore.end() ) {
485  newParticle.AddDaughter( trkID );
486  }
487  }
488  // Save it!
489  particlelist.push_back( newParticle );
490  }
491  } else {
492  // Keep all sim::Particles from this event
493  for(size_t p = 0; p < pl.size(); ++p){
494  particlelist.push_back(pl[p]);
495  }
496  }
497 
498  return;
499  }
500 
501 
502  //______________________________________________________________________________
504  {
505  int n = fOverrideLifetimePDG.size();
506  for (int k=0; k<n; ++k) {
507  int pdg = fOverrideLifetimePDG[k];
508  double lifetime = fOverrideLifetimeNS[k];
509  G4ParticleDefinition* g4pdef =
510  G4ParticleTable::GetParticleTable()->FindParticle(pdg);
511  if ( ! g4pdef ) {
512  LOG_ERROR("G4Alg")
513  << "Attempt to override PDG lifetime in Geant4 failed "
514  << "to get a G4ParticleDefintions for PDG=" << pdg;
515  continue;
516  }
517  LOG_INFO("G4Alg")
518  << "Modifying the G4ParticleDefinition for PDG=" << pdg
519  << ", lifetime was " << g4pdef->GetPDGLifeTime()/CLHEP::ns << " (ns) to "
520  << lifetime;
521  g4pdef->SetPDGLifeTime(lifetime*CLHEP::ns);
522  }
523 
524  }
525 
526 
527 } // end namespace
TruthSlim – remove generated objects that don&#39;t contribute.
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
void RunGeant(std::vector< art::Handle< std::vector< simb::MCTruth > > > &mclists, std::vector< sim::FLSHitList > &flshitlist, std::vector< sim::Particle > &particlelist, std::vector< std::vector< std::pair< size_t, size_t > > > &pListLimits)
Definition: G4Alg.cxx:280
std::vector< sim::FLSHit > fHits
Definition: FLSHitList.h:21
bool fIsRockVetoUsed
Is RockVeto check used?
Definition: G4Alg.h:74
int fPlaIndex
index of the ParticleListAction in the UserActionManager
Definition: G4Alg.h:82
void push_back(value_type const &v)
void OverridePDGLifetimes()
Definition: G4Alg.cxx:503
std::vector< double > fOverrideLifetimeNS
new lifetime of PDG in ns
Definition: G4Alg.h:88
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
int Mother() const
Definition: MCParticle.h:212
const char * p
Definition: xmltok.h:285
bool IsAborted()
Definition: G4Alg.cxx:375
static constexpr double ns
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
int fFlsIndex
index of the FLSHitListAction in the UserActionManager
Definition: G4Alg.h:83
Use Geant4&#39;s user "hooks" to maintain a list of particles generated by Geant4.
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
TLorentzVector GetGvtx() const
Definition: MCParticle.h:244
std::string find_file(std::string const &filename) const
double fEnergyThresh
threshold for stopping the tracking of a particle in GeV
Definition: G4Alg.h:71
void Config(fhicl::ParameterSet const &pset)
int TrackId() const
Definition: MCParticle.h:209
void ResetTrackIDOffset(int offset=0)
TString part[npart]
Definition: Style.C:32
void SetPolarization(const TVector3 &p)
Definition: MCParticle.h:265
list of energy deposits from Geant4
std::string fG4MacroPath
path to G4 macro
Definition: G4Alg.h:69
T get(std::string const &key) const
Definition: ParameterSet.h:231
virtual ~G4Alg()
Definition: G4Alg.cxx:211
void ConfigUserActionManager(std::vector< std::string > const &actionList, fhicl::ParameterSet const &pset)
Definition: G4Alg.cxx:217
Float_t d
Definition: plot.C:236
bool get_if_present(std::string const &key, T &value) const
Definition: ParameterSet.h:208
const double j
Definition: BetheBloch.cxx:29
static void SetFatesFile(const std::string &s)
void CollectFLSHitsAndParticles(std::vector< sim::FLSHitList > &flshitlist, std::vector< sim::Particle > &particlelist)
Definition: G4Alg.cxx:385
const TLorentzVector & Position(const size_type) const
The accessor methods described above.
std::vector< int > fOverrideLifetimePDG
list of pdg code to change
Definition: G4Alg.h:87
void Config(fhicl::ParameterSet const &pset)
std::string GDMLFile() const
Definition: GeometryBase.h:235
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
bool fSparseTrajectories
if true, only save necessary points in particle trajectories
Definition: G4Alg.h:73
size_type size() const
Definition: MCTrajectory.h:165
T const * get() const
Definition: Ptr.h:321
A vector of FLSHit from single neutrino interaction.
Definition: FLSHitList.h:13
std::vector< std::string > fUserActions
UserAction classes.
Definition: G4Alg.h:85
#define LOG_VERBATIM(category)
Event generator information.
Definition: MCTruth.h:32
#define LOG_INFO(stream)
Definition: Messenger.h:144
std::map< int, size_t > TrackIDToMCTruthIndexMap() const
Helper for AttenCurve.
Definition: Path.h:10
const TLorentzVector & Momentum(const size_type) const
bool fManyParticles
if true, keep individual track ids from processes like compt and brem
Definition: G4Alg.h:72
std::string fG4PhysListName
name of G4 physics list to use
Definition: G4Alg.h:70
#define LOG_ERROR(stream)
Definition: Messenger.h:129
Encapsulate the geometry of one entire detector (near, far, ndos)
g4b::G4Helper * fG4Help
G4Helper object.
Definition: G4Alg.h:68
G4Alg(fhicl::ParameterSet const &pset)
Definition: G4Alg.cxx:47
bool fSlimSimParticles
if true, only save particles which lead to an FLS hit
Definition: G4Alg.h:75