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