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 
20 
21 #include <vector>
22 #include <map>
23 #include <unordered_set>
24 #include <memory>
25 #include <tuple>
26 
27 class PCaloHit;
29 
30 class HGCDigitizer {
31 public:
34 
35  // index , det id, time
36  typedef std::tuple<int, uint32_t, float> HGCCaloHitTuple_t;
37  static bool orderByDetIdThenTime(const HGCCaloHitTuple_t& a, const HGCCaloHitTuple_t& b) {
38  unsigned int detId_a(std::get<1>(a)), detId_b(std::get<1>(b));
39 
40  if (detId_a < detId_b)
41  return true;
42  if (detId_a > detId_b)
43  return false;
44 
45  double time_a(std::get<2>(a)), time_b(std::get<2>(b));
46  if (time_a < time_b)
47  return true;
48 
49  return false;
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>
59  int bxCrossing,
60  const GEOM* geom,
61  CLHEP::HepRandomEngine* hre);
62  // for premixing
63  void accumulate(const PHGCSimAccumulator& simAccumulator);
64 
68  void initializeEvent(edm::Event const& e, edm::EventSetup const& c);
69  void finalizeEvent(edm::Event& e, edm::EventSetup const& c, CLHEP::HepRandomEngine* hre);
70 
78  int geometryType() { return geometryType_; }
79 
83  void beginRun(const edm::EventSetup& es);
84  void endRun();
85 
86 private:
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  //debug position
114  void checkPosition(const HGCalDigiCollection* digis) const;
115 
116  //digitizers
117  std::unique_ptr<HGCEEDigitizer> theHGCEEDigitizer_;
118  std::unique_ptr<HGCHEbackDigitizer> theHGCHEbackDigitizer_;
119  std::unique_ptr<HGCHEfrontDigitizer> theHGCHEfrontDigitizer_;
120  std::unique_ptr<HFNoseDigitizer> theHFNoseDigitizer_;
121 
122  //geometries
123  std::unordered_set<DetId> validIds_;
126 
127  //detector and subdetector id
130 
131  //misc switches
132  uint32_t verbosity_;
133 
134  //reference speed to evaluate time of arrival at the sensititive detector, assuming the center of CMS
135  float refSpeed_;
136 
137  //delay to apply after evaluating time of arrival at the sensitive detector
138  float tofDelay_;
139 
140  //average occupancies
141  std::array<double, 4> averageOccupancies_;
142  uint32_t nEvents_;
143 
144  std::vector<float> cce_;
145 
146  std::map<uint32_t, std::vector<std::pair<float, float> > > hitRefs_bx0;
147 };
148 
149 #endif
uint32_t nEvents_
Definition: HGCDigitizer.h:142
bool premixStage1_
Definition: HGCDigitizer.h:100
std::vector< float > cce_
Definition: HGCDigitizer.h:144
void finalizeEvent(edm::Event &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *hre)
ForwardSubdetector mySubDet_
Definition: HGCDigitizer.h:129
int digitizationType_
Definition: HGCDigitizer.h:97
std::string hitCollection_
Definition: HGCDigitizer.h:91
void resetSimHitDataAccumulator()
std::map< uint32_t, std::vector< std::pair< float, float > > > hitRefs_bx0
Definition: HGCDigitizer.h:146
void initializeEvent(edm::Event const &e, edm::EventSetup const &c)
actions at the start/end of event
DetId::Detector myDet_
Definition: HGCDigitizer.h:128
ForwardSubdetector
std::unique_ptr< HFNoseDigitizer > theHFNoseDigitizer_
Definition: HGCDigitizer.h:120
const HGCalGeometry * gHGCal_
Definition: HGCDigitizer.h:124
bool producesEEDigis()
Definition: HGCDigitizer.h:73
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:123
bool producesHFNoseDigis()
Definition: HGCDigitizer.h:76
bool producesHEfrontDigis()
Definition: HGCDigitizer.h:74
uint32_t getType() const
std::unique_ptr< HGCHEbackDigitizer > theHGCHEbackDigitizer_
Definition: HGCDigitizer.h:118
double premixStage1MinCharge_
Definition: HGCDigitizer.h:103
void checkPosition(const HGCalDigiCollection *digis) const
bool producesHEbackDigis()
Definition: HGCDigitizer.h:75
Detector
Definition: DetId.h:24
double b
Definition: hdecay.h:118
int maxSimHitsAccTime_
Definition: HGCDigitizer.h:108
double ev_per_eh_pair_
Definition: HGCDigitizer.h:109
std::unique_ptr< HGCHEfrontDigitizer > theHGCHEfrontDigitizer_
Definition: HGCDigitizer.h:119
std::tuple< int, uint32_t, float > HGCCaloHitTuple_t
Definition: HGCDigitizer.h:36
std::unique_ptr< HGCEEDigitizer > theHGCEEDigitizer_
Definition: HGCDigitizer.h:117
std::array< double, 4 > averageOccupancies_
Definition: HGCDigitizer.h:141
void accumulate(edm::Event const &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *hre)
handle SimHit accumulation
double a
Definition: hdecay.h:119
HGCDigitizer(const edm::ParameterSet &ps, edm::ConsumesCollector &iC)
int geometryType()
Definition: HGCDigitizer.h:78
std::unique_ptr< hgc::HGCSimHitDataAccumulator > simHitAccumulator_
Definition: HGCDigitizer.h:110
static bool orderByDetIdThenTime(const HGCCaloHitTuple_t &a, const HGCCaloHitTuple_t &b)
Definition: HGCDigitizer.h:37
double bxTime_
Definition: HGCDigitizer.h:109
double premixStage1MaxCharge_
Definition: HGCDigitizer.h:105
std::string digiCollection()
Definition: HGCDigitizer.h:77
const HcalGeometry * gHcal_
Definition: HGCDigitizer.h:125
uint32_t verbosity_
Definition: HGCDigitizer.h:132