MCParticleCreator.h
Go to the documentation of this file.
1 #ifndef MCPARTICLECREATOR_H
2 #define MCPARTICLECREATOR_H 1
3 
5 
8 
9 #include "Geometry/GeometryGAr.h"
10 
11 #include "Api/PandoraApi.h"
12 #include "Objects/Helix.h"
13 
14 #include "CaloHitCreator.h"
15 #include "TrackCreator.h"
16 
17 #include "RotationTransformation.h"
18 
19 namespace gar {
20  namespace gar_pandora {
21 
22  typedef std::vector< art::Ptr<simb::MCTruth> > MCTruthVector;
23  typedef std::vector< art::Ptr<simb::MCParticle> > MCParticleVector;
24  typedef std::vector< simb::MCParticle > RawMCParticleVector;
25  typedef std::map< art::Ptr<simb::MCTruth>, MCParticleVector > MCTruthToMCParticles;
26  typedef std::map< art::Ptr<simb::MCParticle>, art::Ptr<simb::MCTruth> > MCParticlesToMCTruth;
27  typedef std::map< int, art::Ptr<simb::MCParticle> > MCParticleMap;
28 
30  {
31  public:
32 
33  class Settings
34  {
35  public:
36  Settings();
37 
38  std::string m_geantModuleLabel; ///< The geant4 label
39  std::string m_generatorModuleLabel; ///< The generator label
40  };
41 
42  class eveLoc {
43  public:
44  eveLoc(int id)
45  : eveID(id)
46  {}
47 
48  ~eveLoc() {}
49 
50  friend bool operator < (eveLoc const& a, eveLoc const& b) {
51  return a.eveID < b.eveID;
52  }
53 
54  int GetEveID() const { return eveID; }
55 
56  private:
57  int eveID;
58  };
59 
60  MCParticleCreator(const Settings &settings, const pandora::Pandora *const pPandora, const RotationTransformation *const pRotation);
61 
63 
64  pandora::StatusCode CreateMCParticles(const art::Event &pEvent);
65  pandora::StatusCode CreateMCParticles() const;
66  pandora::StatusCode CreateTrackToMCParticleRelationships(const TrackVector &trackVector) const;
67  pandora::StatusCode CreateCaloHitToMCParticleRelationships(const CalorimeterHitVector &calorimeterHitVector) const;
68 
69  void Reset();
70 
71  static const simb::MCParticle* GetFinalStateMCParticle(const MCParticleMap &particleMap, const simb::MCParticle *inputParticle);
72  static bool IsVisible(const art::Ptr<simb::MCParticle> particle);
73 
74  protected:
75 
76  pandora::StatusCode CollectMCParticles(const art::Event &pEvent, const std::string &label, MCParticleVector &particleVector);
77 
78  pandora::StatusCode CollectGeneratorMCParticles(const art::Event &pEvent, const std::string &label, RawMCParticleVector &particleVector);
79 
80  pandora::StatusCode CollectMCParticles(const art::Event &pEvent, const std::string &label, MCTruthToMCParticles &truthToParticles, MCParticlesToMCTruth &particlesToTruth);
81 
82  private:
83  const Settings m_settings; ///< The mc particle creator settings
84  const pandora::Pandora &m_pandora; ///< Reference to the pandora object to create the mc particles
85  float m_bField; ///< The bfield
87  const geo::GeometryCore* fGeo; //Geometry Manager
88 
89  float m_origin[3] = {0, 0, 0};
90 
91  MCParticleVector artMCParticleVector;
92  RawMCParticleVector generatorArtMCParticleVector;
93  MCTruthToMCParticles artMCTruthToMCParticles;
94  MCParticlesToMCTruth artMCParticlesToMCTruth;
95  };
96 
98  {
99  artMCParticleVector.clear();
101  artMCTruthToMCParticles.clear();
102  artMCParticlesToMCTruth.clear();
103  }
104  }
105 }
106 
107 #endif // #ifndef MCPARTICLECREATOR_H
std::string m_geantModuleLabel
The geant4 label.
pandora::StatusCode CollectMCParticles(const art::Event &pEvent, const std::string &label, MCParticleVector &particleVector)
std::vector< art::Ptr< gar::rec::CaloHit > > CalorimeterHitVector
const RotationTransformation & m_rotation
std::string string
Definition: nybbler.cc:12
std::string m_generatorModuleLabel
The generator label.
const pandora::Pandora & m_pandora
Reference to the pandora object to create the mc particles.
static const simb::MCParticle * GetFinalStateMCParticle(const MCParticleMap &particleMap, const simb::MCParticle *inputParticle)
Description of geometry of one entire detector.
Definition: GeometryCore.h:436
std::vector< art::Ptr< simb::MCParticle > > MCParticleVector
Particle class.
const geo::GeometryCore * fGeo
MCTruthToMCParticles artMCTruthToMCParticles
bool operator<(ProductInfo const &a, ProductInfo const &b)
Definition: ProductInfo.cc:51
MCParticleCreator(const Settings &settings, const pandora::Pandora *const pPandora, const RotationTransformation *const pRotation)
std::vector< simb::MCParticle > RawMCParticleVector
MCParticlesToMCTruth artMCParticlesToMCTruth
const double a
pandora::StatusCode CreateCaloHitToMCParticleRelationships(const CalorimeterHitVector &calorimeterHitVector) const
pandora::StatusCode CollectGeneratorMCParticles(const art::Event &pEvent, const std::string &label, RawMCParticleVector &particleVector)
std::map< int, art::Ptr< simb::MCParticle > > MCParticleMap
std::map< art::Ptr< simb::MCParticle >, art::Ptr< simb::MCTruth > > MCParticlesToMCTruth
General GArSoft Utilities.
pandora::StatusCode CreateTrackToMCParticleRelationships(const TrackVector &trackVector) const
std::map< art::Ptr< simb::MCTruth >, MCParticleVector > MCTruthToMCParticles
static bool * b
Definition: config.cpp:1043
std::vector< art::Ptr< gar::rec::Track > > TrackVector
Definition: TrackCreator.h:12
RawMCParticleVector generatorArtMCParticleVector
pandora::StatusCode CreateMCParticles() const
const Settings m_settings
The mc particle creator settings.
art framework interface to geometry description
std::vector< art::Ptr< simb::MCTruth > > MCTruthVector
static bool IsVisible(const art::Ptr< simb::MCParticle > particle)