CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HGCDigitizer.h
Go to the documentation of this file.
1 #ifndef HGCalSimProducers_HGCDigitizer_h
2 #define HGCalSimProducers_HGCDigitizer_h
3 
8 
11 
19 
20 #include <vector>
21 #include <map>
22 #include <unordered_set>
23 #include <memory>
24 #include <tuple>
25 
26 class PCaloHit;
28 
29 class HGCDigitizer {
30 public:
33 
34  // index , det id, time
35  typedef std::tuple<int, uint32_t, float> HGCCaloHitTuple_t;
37  unsigned int detId_a(std::get<1>(a)), detId_b(std::get<1>(b));
38 
39  if (detId_a < detId_b)
40  return true;
41  if (detId_a > detId_b)
42  return false;
43 
44  double time_a(std::get<2>(a)), time_b(std::get<2>(b));
45  if (time_a < time_b)
46  return true;
47 
48  return false;
49  }
50 
54  void accumulate(edm::Event const& e, edm::EventSetup const& c, CLHEP::HepRandomEngine* hre);
55  void accumulate_forPreMix(edm::Event const& e, edm::EventSetup const& c, CLHEP::HepRandomEngine* hre);
56 
57  void accumulate(PileUpEventPrincipal const& e, edm::EventSetup const& c, CLHEP::HepRandomEngine* hre);
58  void accumulate_forPreMix(PileUpEventPrincipal const& e, edm::EventSetup const& c, CLHEP::HepRandomEngine* hre);
59 
61  int bxCrossing,
62  const HGCalGeometry* geom,
63  CLHEP::HepRandomEngine* hre);
65  int bxCrossing,
66  const HGCalGeometry* geom,
67  CLHEP::HepRandomEngine* hre);
68 
69  void accumulate_forPreMix(const PHGCSimAccumulator& simAccumulator, const bool minbiasFlag);
73  void initializeEvent(edm::Event const& e, edm::EventSetup const& c);
74  void finalizeEvent(edm::Event& e, edm::EventSetup const& c, CLHEP::HepRandomEngine* hre);
75 
77 
78 private:
79  uint32_t getType() const;
81 
82  //digitization type (it's up to the specializations to decide it's meaning)
84 
85  // if true, we're running mixing in premixing stage1 and have to produce the output differently
87 
88  // Minimum charge threshold for premixing stage1
90  // Maximum charge for packing in premixing stage1
92 
93  //handle sim hits
96  std::unique_ptr<hgc::HGCSimHitDataAccumulator> simHitAccumulator_;
97  std::unique_ptr<hgc::HGCPUSimHitDataAccumulator> pusimHitAccumulator_;
100  //debug position
101  void checkPosition(const HGCalDigiCollection* digis) const;
102 
103  //digitizer
104  std::unique_ptr<HGCDigitizerBase> theDigitizer_;
105 
106  //geometries
109  std::unordered_set<DetId> validIds_;
110  const HGCalGeometry* gHGCal_ = nullptr;
111 
112  //misc switches
113  uint32_t verbosity_;
114 
115  //reference speed to evaluate time of arrival at the sensititive detector, assuming the center of CMS
116  float refSpeed_;
117 
118  //delay to apply after evaluating time of arrival at the sensitive detector
119  float tofDelay_;
120 
121  //average occupancies
122  std::array<double, 4> averageOccupancies_;
123  uint32_t nEvents_;
124 
125  //maxBx limit beyond which the Digitizer should filter out all hits
126  static const unsigned int maxBx_ = 14;
127  static const unsigned int thisBx_ = 9;
128  std::vector<float> cce_;
129  std::unordered_map<uint32_t, std::vector<std::pair<float, float> > > hitRefs_bx0;
130  std::unordered_map<uint32_t, std::vector<std::tuple<float, float, float> > > PhitRefs_bx0;
131  std::unordered_map<uint32_t, bool> hitOrder_monitor;
132 };
133 
134 #endif
uint32_t nEvents_
Definition: HGCDigitizer.h:123
bool premixStage1_
Definition: HGCDigitizer.h:86
std::vector< float > cce_
Definition: HGCDigitizer.h:128
const edm::EventSetup & c
void finalizeEvent(edm::Event &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *hre)
int digitizationType_
Definition: HGCDigitizer.h:83
std::string hitCollection_
Definition: HGCDigitizer.h:80
std::unique_ptr< HGCDigitizerBase > theDigitizer_
Definition: HGCDigitizer.h:104
void resetSimHitDataAccumulator()
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geomToken_
Definition: HGCDigitizer.h:107
void initializeEvent(edm::Event const &e, edm::EventSetup const &c)
actions at the start/end of event
const HGCalGeometry * gHGCal_
Definition: HGCDigitizer.h:110
std::string digiCollection_
Definition: HGCDigitizer.h:80
static const unsigned int maxBx_
Definition: HGCDigitizer.h:126
edm::ESWatcher< CaloGeometryRecord > geomWatcher_
Definition: HGCDigitizer.h:108
std::unordered_map< uint32_t, std::vector< std::tuple< float, float, float > > > PhitRefs_bx0
Definition: HGCDigitizer.h:130
std::unordered_map< uint32_t, bool > hitOrder_monitor
Definition: HGCDigitizer.h:131
std::unordered_set< DetId > validIds_
Definition: HGCDigitizer.h:109
static const unsigned int thisBx_
Definition: HGCDigitizer.h:127
uint32_t getType() const
double premixStage1MinCharge_
Definition: HGCDigitizer.h:89
void checkPosition(const HGCalDigiCollection *digis) const
double b
Definition: hdecay.h:118
int maxSimHitsAccTime_
Definition: HGCDigitizer.h:94
double ev_per_eh_pair_
Definition: HGCDigitizer.h:95
std::tuple< int, uint32_t, float > HGCCaloHitTuple_t
Definition: HGCDigitizer.h:35
std::array< double, 4 > averageOccupancies_
Definition: HGCDigitizer.h:122
void accumulate(edm::Event const &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *hre)
handle SimHit accumulation
double a
Definition: hdecay.h:119
std::unordered_map< uint32_t, std::vector< std::pair< float, float > > > hitRefs_bx0
Definition: HGCDigitizer.h:129
HGCDigitizer(const edm::ParameterSet &ps, edm::ConsumesCollector &iC)
std::unique_ptr< hgc::HGCSimHitDataAccumulator > simHitAccumulator_
Definition: HGCDigitizer.h:96
static bool orderByDetIdThenTime(const HGCCaloHitTuple_t &a, const HGCCaloHitTuple_t &b)
Definition: HGCDigitizer.h:36
double bxTime_
Definition: HGCDigitizer.h:95
void accumulate_forPreMix(edm::Event const &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *hre)
double premixStage1MaxCharge_
Definition: HGCDigitizer.h:91
std::unique_ptr< hgc::HGCPUSimHitDataAccumulator > pusimHitAccumulator_
Definition: HGCDigitizer.h:97
std::string digiCollection()
Definition: HGCDigitizer.h:76
uint32_t verbosity_
Definition: HGCDigitizer.h:113
void resetPUSimHitDataAccumulator()