CMS 3D CMS Logo

HGCPassive.h
Go to the documentation of this file.
1 // File: HGCPassive.cc
3 // copied from SimG4HGCalValidation
4 // Description: Main analysis class for HGCal Validation of G4 Hits
6 
12 
13 // to retreive hits
15 
19 
23 
25 
26 #include "G4LogicalVolumeStore.hh"
27 #include "G4PhysicalVolumeStore.hh"
28 #include "G4Step.hh"
29 #include "G4TouchableHistory.hh"
30 #include "G4Track.hh"
31 
32 #include <array>
33 #include <map>
34 #include <string>
35 #include <vector>
36 
37 class HGCPassive : public SimProducer,
38  public Observer<const BeginOfRun *>,
39  public Observer<const BeginOfEvent *>,
40  public Observer<const G4Step *> {
41 public:
43  ~HGCPassive() override;
44 
45  void produce(edm::Event &, const edm::EventSetup &) override;
46 
47 private:
48  HGCPassive(const HGCPassive &) = delete; // stop default
49  const HGCPassive &operator=(const HGCPassive &) = delete;
50 
51  // observer classes
52  void update(const BeginOfRun *run) override;
53  void update(const BeginOfEvent *evt) override;
54  void update(const G4Step *step) override;
55 
56  // void endOfEvent(edm::PassiveHitContainer &HGCEEAbsE);
57  void endOfEvent(edm::PassiveHitContainer &hgcPH, unsigned int k);
58 
59  typedef std::map<G4LogicalVolume *, std::pair<unsigned int, std::string>>::iterator volumeIterator;
60  G4VPhysicalVolume *getTopPV();
61  volumeIterator findLV(G4LogicalVolume *plv);
62  void storeInfo(
63  const volumeIterator itr, G4LogicalVolume *plv, unsigned int copy, double time, double energy, bool flag);
64 
65 private:
66  std::vector<std::string> LVNames_;
67  G4VPhysicalVolume *topPV_;
68  G4LogicalVolume *topLV_;
69  std::map<G4LogicalVolume *, std::pair<unsigned int, std::string>> mapLV_;
71 
72  // some private members for ananlysis
73  unsigned int count_;
74  bool init_;
75  std::map<std::pair<G4LogicalVolume *, unsigned int>, std::array<double, 3>> store_;
76 };
void storeInfo(const volumeIterator itr, G4LogicalVolume *plv, unsigned int copy, double time, double energy, bool flag)
Definition: HGCPassive.cc:195
std::map< G4LogicalVolume *, std::pair< unsigned int, std::string > >::iterator volumeIterator
Definition: HGCPassive.h:59
G4LogicalVolume * topLV_
Definition: HGCPassive.h:68
void endOfEvent(edm::PassiveHitContainer &hgcPH, unsigned int k)
Definition: HGCPassive.cc:151
volumeIterator findLV(G4LogicalVolume *plv)
Definition: HGCPassive.cc:176
G4VPhysicalVolume * topPV_
Definition: HGCPassive.h:67
G4VPhysicalVolume * getTopPV()
Definition: HGCPassive.cc:172
HGCPassive(const edm::ParameterSet &p)
Definition: HGCPassive.cc:22
std::vector< std::string > LVNames_
Definition: HGCPassive.h:66
~HGCPassive() override
Definition: HGCPassive.cc:40
std::string motherName_
Definition: HGCPassive.h:70
void produce(edm::Event &, const edm::EventSetup &) override
Definition: HGCPassive.cc:42
std::vector< PassiveHit > PassiveHitContainer
Definition: PassiveHit.h:75
unsigned int count_
Definition: HGCPassive.h:73
std::map< std::pair< G4LogicalVolume *, unsigned int >, std::array< double, 3 > > store_
Definition: HGCPassive.h:75
void update(const BeginOfRun *run) override
This routine will be called when the appropriate signal arrives.
Definition: HGCPassive.cc:50
step
Definition: StallMonitor.cc:94
const HGCPassive & operator=(const HGCPassive &)=delete
bool init_
Definition: HGCPassive.h:74
std::map< G4LogicalVolume *, std::pair< unsigned int, std::string > > mapLV_
Definition: HGCPassive.h:69