CMS 3D CMS Logo

HGCDigitizer.h
Go to the documentation of this file.
1 #ifndef HGCalSimProducers_HGCDigitizer_h
2 #define HGCalSimProducers_HGCDigitizer_h
3 
7 
10 
19 
20 #include <vector>
21 #include <map>
22 #include <unordered_set>
23 #include <memory>
24 #include <tuple>
25 
26 class PCaloHit;
28 
30 {
31 public:
32 
35 
36  // index , det id, time
37  typedef std::tuple<int,uint32_t,float> HGCCaloHitTuple_t;
38  static bool orderByDetIdThenTime(const HGCCaloHitTuple_t &a, const HGCCaloHitTuple_t &b)
39  {
40  unsigned int detId_a(std::get<1>(a)), detId_b(std::get<1>(b));
41 
42  if(detId_a<detId_b) return true;
43  if(detId_a>detId_b) return false;
44 
45  double time_a(std::get<2>(a)), time_b(std::get<2>(b));
46  if(time_a<time_b) return true;
47 
48  return false;
49  }
50 
51 
55  void accumulate(edm::Event const& e, edm::EventSetup const& c, CLHEP::HepRandomEngine* hre);
56  void accumulate(PileUpEventPrincipal const& e, edm::EventSetup const& c, CLHEP::HepRandomEngine* hre);
57  template<typename GEOM>
58  void accumulate(edm::Handle<edm::PCaloHitContainer> const &hits, int bxCrossing,const GEOM *geom, CLHEP::HepRandomEngine* hre);
59  // for premixing
60  void accumulate(const PHGCSimAccumulator& simAccumulator);
61 
65  void initializeEvent(edm::Event const& e, edm::EventSetup const& c);
66  void finalizeEvent(edm::Event& e, edm::EventSetup const& c, CLHEP::HepRandomEngine* hre);
67 
70  bool producesEEDigis() {
77  int geometryType() { return geometryType_; }
78 
82  void beginRun(const edm::EventSetup & es);
83  void endRun();
84 
85 private :
86 
87  uint32_t getType() const;
88  bool getWeight(std::array<float,3>& tdcForToAOnset, float& keV2fC) const;
89 
90  //input/output names
92 
93  //geometry type (0 pre-TDR; 1 TDR)
95 
96  //digitization type (it's up to the specializations to decide it's meaning)
98 
99  // if true, we're running mixing in premixing stage1 and have to produce the output differently
101 
102  // Minimum charge threshold for premixing stage1
104  // Maximum charge for packing in premixing stage1
106 
107  //handle sim hits
110  std::unique_ptr<hgc::HGCSimHitDataAccumulator> simHitAccumulator_;
112 
113  //digitizers
114  std::unique_ptr<HGCEEDigitizer> theHGCEEDigitizer_;
115  std::unique_ptr<HGCHEbackDigitizer> theHGCHEbackDigitizer_;
116  std::unique_ptr<HGCHEfrontDigitizer> theHGCHEfrontDigitizer_;
117 
118  //geometries
119  std::unordered_set<DetId> validIds_;
122 
123  //detector and subdetector id
126 
127  //misc switches
128  uint32_t verbosity_;
129 
130  //reference speed to evaluate time of arrival at the sensititive detector, assuming the center of CMS
131  float refSpeed_;
132 
133  //delay to apply after evaluating time of arrival at the sensitive detector
134  float tofDelay_;
135 
136  //average occupancies
137  std::array<double,3> averageOccupancies_;
138  uint32_t nEvents_;
139 
140  std::vector<float> cce_;
141 
142  std::map< uint32_t, std::vector< std::pair<float, float> > > hitRefs_bx0;
143 };
144 
145 
146 #endif
147 
148 
149 
uint32_t nEvents_
Definition: HGCDigitizer.h:138
bool premixStage1_
Definition: HGCDigitizer.h:100
std::vector< float > cce_
Definition: HGCDigitizer.h:140
void finalizeEvent(edm::Event &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *hre)
ForwardSubdetector mySubDet_
Definition: HGCDigitizer.h:125
int digitizationType_
Definition: HGCDigitizer.h:97
std::string hitCollection_
Definition: HGCDigitizer.h:91
void resetSimHitDataAccumulator()
std::tuple< int, uint32_t, float > HGCCaloHitTuple_t
Definition: HGCDigitizer.h:37
void initializeEvent(edm::Event const &e, edm::EventSetup const &c)
actions at the start/end of event
DetId::Detector myDet_
Definition: HGCDigitizer.h:124
ForwardSubdetector
const HGCalGeometry * gHGCal_
Definition: HGCDigitizer.h:120
bool producesEEDigis()
Definition: HGCDigitizer.h:70
bool getWeight(std::array< float, 3 > &tdcForToAOnset, float &keV2fC) const
std::string digiCollection_
Definition: HGCDigitizer.h:91
void beginRun(const edm::EventSetup &es)
actions at the start/end of run
std::unordered_set< DetId > validIds_
Definition: HGCDigitizer.h:119
bool producesHEfrontDigis()
Definition: HGCDigitizer.h:72
uint32_t getType() const
std::unique_ptr< HGCHEbackDigitizer > theHGCHEbackDigitizer_
Definition: HGCDigitizer.h:115
double premixStage1MinCharge_
Definition: HGCDigitizer.h:103
bool producesHEbackDigis()
Definition: HGCDigitizer.h:74
Detector
Definition: DetId.h:26
double b
Definition: hdecay.h:120
int maxSimHitsAccTime_
Definition: HGCDigitizer.h:108
double ev_per_eh_pair_
Definition: HGCDigitizer.h:109
std::unique_ptr< HGCHEfrontDigitizer > theHGCHEfrontDigitizer_
Definition: HGCDigitizer.h:116
std::unique_ptr< HGCEEDigitizer > theHGCEEDigitizer_
Definition: HGCDigitizer.h:114
void accumulate(edm::Event const &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *hre)
handle SimHit accumulation
double a
Definition: hdecay.h:121
std::map< uint32_t, std::vector< std::pair< float, float > > > hitRefs_bx0
Definition: HGCDigitizer.h:142
HGCDigitizer(const edm::ParameterSet &ps, edm::ConsumesCollector &iC)
std::array< double, 3 > averageOccupancies_
Definition: HGCDigitizer.h:137
int geometryType()
Definition: HGCDigitizer.h:77
std::unique_ptr< hgc::HGCSimHitDataAccumulator > simHitAccumulator_
Definition: HGCDigitizer.h:110
static bool orderByDetIdThenTime(const HGCCaloHitTuple_t &a, const HGCCaloHitTuple_t &b)
Definition: HGCDigitizer.h:38
double bxTime_
Definition: HGCDigitizer.h:109
double premixStage1MaxCharge_
Definition: HGCDigitizer.h:105
std::string digiCollection()
Definition: HGCDigitizer.h:76
const HcalGeometry * gHcal_
Definition: HGCDigitizer.h:121
uint32_t verbosity_
Definition: HGCDigitizer.h:128