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;
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_forPreMix(edm::Event const& e, edm::EventSetup const& c, CLHEP::HepRandomEngine* hre);
57 
58  void accumulate(PileUpEventPrincipal const& e, edm::EventSetup const& c, CLHEP::HepRandomEngine* hre);
59  void accumulate_forPreMix(PileUpEventPrincipal const& e, edm::EventSetup const& c, CLHEP::HepRandomEngine* hre);
60 
61  template <typename GEOM>
63  int bxCrossing,
64  const GEOM* geom,
65  CLHEP::HepRandomEngine* hre);
66  template <typename GEOM>
68  int bxCrossing,
69  const GEOM* geom,
70  CLHEP::HepRandomEngine* hre);
71 
72  void accumulate_forPreMix(const PHGCSimAccumulator& simAccumulator, const bool minbiasFlag);
76  void initializeEvent(edm::Event const& e, edm::EventSetup const& c);
77  void finalizeEvent(edm::Event& e, edm::EventSetup const& c, CLHEP::HepRandomEngine* hre);
78 
86  int geometryType() { return geometryType_; }
87 
91  void beginRun(const edm::EventSetup& es);
92  void endRun();
93 
94 private:
95  uint32_t getType() const;
96  bool getWeight(std::array<float, 3>& tdcForToAOnset, float& keV2fC) const;
98 
99  //geometry type (0 pre-TDR; 1 TDR)
101 
102  //digitization type (it's up to the specializations to decide it's meaning)
104 
105  // if true, we're running mixing in premixing stage1 and have to produce the output differently
107 
108  // Minimum charge threshold for premixing stage1
110  // Maximum charge for packing in premixing stage1
112 
113  //handle sim hits
116  std::unique_ptr<hgc::HGCSimHitDataAccumulator> simHitAccumulator_;
117  std::unique_ptr<hgc::HGCPUSimHitDataAccumulator> pusimHitAccumulator_;
120  //debug position
121  void checkPosition(const HGCalDigiCollection* digis) const;
122 
123  //digitizers
124  std::unique_ptr<HGCEEDigitizer> theHGCEEDigitizer_;
125  std::unique_ptr<HGCHEbackDigitizer> theHGCHEbackDigitizer_;
126  std::unique_ptr<HGCHEfrontDigitizer> theHGCHEfrontDigitizer_;
127  std::unique_ptr<HFNoseDigitizer> theHFNoseDigitizer_;
128 
129  //geometries
130  std::unordered_set<DetId> validIds_;
133 
134  //detector and subdetector id
137 
138  //misc switches
139  uint32_t verbosity_;
140 
141  //reference speed to evaluate time of arrival at the sensititive detector, assuming the center of CMS
142  float refSpeed_;
143 
144  //delay to apply after evaluating time of arrival at the sensitive detector
145  float tofDelay_;
146 
147  //average occupancies
148  std::array<double, 4> averageOccupancies_;
149  uint32_t nEvents_;
150 
151  //maxBx limit beyond which the Digitizer should filter out all hits
152  static const unsigned int maxBx_ = 14;
153  static const unsigned int thisBx_ = 9;
154  std::vector<float> cce_;
155  std::unordered_map<uint32_t, std::vector<std::pair<float, float> > > hitRefs_bx0;
156  std::unordered_map<uint32_t, bool> hitOrder_monitor;
157 };
158 
159 #endif
HGCDigitizer::HGCDigitizer
HGCDigitizer(const edm::ParameterSet &ps, edm::ConsumesCollector &iC)
Definition: HGCDigitizer.cc:263
PHGCSimAccumulator
Definition: PHGCSimAccumulator.h:8
HGCDigitizer::thisBx_
static const unsigned int thisBx_
Definition: HGCDigitizer.h:153
HGCDigitizer::producesHFNoseDigis
bool producesHFNoseDigis()
Definition: HGCDigitizer.h:84
HGCDigitizer::producesHEfrontDigis
bool producesHEfrontDigis()
Definition: HGCDigitizer.h:82
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
HGCDigitizer::premixStage1MinCharge_
double premixStage1MinCharge_
Definition: HGCDigitizer.h:109
HGCDigitizer::simHitAccumulator_
std::unique_ptr< hgc::HGCSimHitDataAccumulator > simHitAccumulator_
Definition: HGCDigitizer.h:116
HGCDigitizer::digiCollection
std::string digiCollection()
Definition: HGCDigitizer.h:85
ESHandle.h
HGCDigitizer::gHGCal_
const HGCalGeometry * gHGCal_
Definition: HGCDigitizer.h:131
HGCDigitizer::theHGCHEbackDigitizer_
std::unique_ptr< HGCHEbackDigitizer > theHGCHEbackDigitizer_
Definition: HGCDigitizer.h:125
ForwardSubdetector
ForwardSubdetector
Definition: ForwardSubdetector.h:4
HGCDigitizer::endRun
void endRun()
Definition: HGCDigitizer.cc:789
HGCDigitizer::nEvents_
uint32_t nEvents_
Definition: HGCDigitizer.h:149
HGCHEbackDigitizer.h
HGCDigitizer::HGCCaloHitTuple_t
std::tuple< int, uint32_t, float > HGCCaloHitTuple_t
Definition: HGCDigitizer.h:36
edm::SortedCollection
Definition: SortedCollection.h:49
PileUpEventPrincipal
Definition: PileUpEventPrincipal.h:19
HGCDigitizer::maxBx_
static const unsigned int maxBx_
Definition: HGCDigitizer.h:152
HGCDigitizer::beginRun
void beginRun(const edm::EventSetup &es)
actions at the start/end of run
Definition: HGCDigitizer.cc:750
HGCDigitizer::refSpeed_
float refSpeed_
Definition: HGCDigitizer.h:142
HGCDigitizer::producesHEbackDigis
bool producesHEbackDigis()
Definition: HGCDigitizer.h:83
HGCDigitizer::premixStage1_
bool premixStage1_
Definition: HGCDigitizer.h:106
HGCDigitizer::ev_per_eh_pair_
double ev_per_eh_pair_
Definition: HGCDigitizer.h:115
edm::Handle
Definition: AssociativeIterator.h:50
HcalGeometry.h
ForwardSubdetector.h
DetId::HGCalHSi
Definition: DetId.h:33
DetId::HGCalEE
Definition: DetId.h:32
HGCDigitizer::accumulate_forPreMix
void accumulate_forPreMix(edm::Event const &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *hre)
Definition: HGCDigitizer.cc:415
HGCDigitizer::geometryType
int geometryType()
Definition: HGCDigitizer.h:86
HFNose
Definition: ForwardSubdetector.h:11
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
HGCDigitizer::pusimHitAccumulator_
std::unique_ptr< hgc::HGCPUSimHitDataAccumulator > pusimHitAccumulator_
Definition: HGCDigitizer.h:117
HGCDigitizer::orderByDetIdThenTime
static bool orderByDetIdThenTime(const HGCCaloHitTuple_t &a, const HGCCaloHitTuple_t &b)
Definition: HGCDigitizer.h:37
HGCDigitizer::gHcal_
const HcalGeometry * gHcal_
Definition: HGCDigitizer.h:132
HGCalGeometry
Definition: HGCalGeometry.h:30
b
double b
Definition: hdecay.h:118
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HGCEE
Definition: ForwardSubdetector.h:8
HGCDigitizer::hitCollection_
std::string hitCollection_
Definition: HGCDigitizer.h:97
HGCalGeometry.h
edm::ParameterSet
Definition: ParameterSet.h:36
a
double a
Definition: hdecay.h:119
HGCDigitizer::theHGCEEDigitizer_
std::unique_ptr< HGCEEDigitizer > theHGCEEDigitizer_
Definition: HGCDigitizer.h:124
HGCDigitizer::accumulate
void accumulate(edm::Event const &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *hre)
handle SimHit accumulation
Definition: HGCDigitizer.cc:438
HGCDigitizer::maxSimHitsAccTime_
int maxSimHitsAccTime_
Definition: HGCDigitizer.h:114
HGCDigitizer::finalizeEvent
void finalizeEvent(edm::Event &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *hre)
Definition: HGCDigitizer.cc:339
HGCDigitizer::theHGCHEfrontDigitizer_
std::unique_ptr< HGCHEfrontDigitizer > theHGCHEfrontDigitizer_
Definition: HGCDigitizer.h:126
PCaloHit.h
HGCDigitizer::resetSimHitDataAccumulator
void resetSimHitDataAccumulator()
Definition: HGCDigitizer.cc:792
HGCDigitizer::hitRefs_bx0
std::unordered_map< uint32_t, std::vector< std::pair< float, float > > > hitRefs_bx0
Definition: HGCDigitizer.h:155
HGCDigiCollections.h
HGCDigitizer::~HGCDigitizer
~HGCDigitizer()
Definition: HGCDigitizer.h:33
DetId::Detector
Detector
Definition: DetId.h:24
edm::EventSetup
Definition: EventSetup.h:57
HGCDigitizer::digitizationType_
int digitizationType_
Definition: HGCDigitizer.h:103
PHGCSimAccumulator.h
PCaloHit
Definition: PCaloHit.h:8
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
HGCDigitizer::validIds_
std::unordered_set< DetId > validIds_
Definition: HGCDigitizer.h:130
HGCDigitizer::bxTime_
double bxTime_
Definition: HGCDigitizer.h:115
HGCDigitizer::tofDelay_
float tofDelay_
Definition: HGCDigitizer.h:145
HGCDigitizer::premixStage1MaxCharge_
double premixStage1MaxCharge_
Definition: HGCDigitizer.h:111
HGCDigitizer::initializeEvent
void initializeEvent(edm::Event const &e, edm::EventSetup const &c)
actions at the start/end of event
Definition: HGCDigitizer.cc:331
HGCDigitizer::myDet_
DetId::Detector myDet_
Definition: HGCDigitizer.h:135
HGCDigitizer::verbosity_
uint32_t verbosity_
Definition: HGCDigitizer.h:139
HGCDigitizer::digiCollection_
std::string digiCollection_
Definition: HGCDigitizer.h:97
DetId.h
Frameworkfwd.h
DetId::HGCalHSc
Definition: DetId.h:34
HGCDigitizer::getWeight
bool getWeight(std::array< float, 3 > &tdcForToAOnset, float &keV2fC) const
Definition: HGCDigitizer.cc:839
HGCHEfrontDigitizer.h
HGCDigitizer::resetPUSimHitDataAccumulator
void resetPUSimHitDataAccumulator()
HGCDigitizer
Definition: HGCDigitizer.h:30
HGCEEDigitizer.h
HGCDigitizer::theHFNoseDigitizer_
std::unique_ptr< HFNoseDigitizer > theHFNoseDigitizer_
Definition: HGCDigitizer.h:127
HGCDigitizer::checkPosition
void checkPosition(const HGCalDigiCollection *digis) const
Definition: HGCDigitizer.cc:895
HGCDigitizer::producesEEDigis
bool producesEEDigis()
Definition: HGCDigitizer.h:81
PCaloHitContainer.h
HFNoseDigitizer.h
HGCDigitizer::cce_
std::vector< float > cce_
Definition: HGCDigitizer.h:154
HGCDigitizer::mySubDet_
ForwardSubdetector mySubDet_
Definition: HGCDigitizer.h:136
HGCHEF
Definition: ForwardSubdetector.h:9
DetId::Forward
Definition: DetId.h:30
edm::Event
Definition: Event.h:73
HGCDigitizer::getType
uint32_t getType() const
Definition: HGCDigitizer.cc:799
HcalGeometry
Definition: HcalGeometry.h:17
edm::ConsumesCollector
Definition: ConsumesCollector.h:39
HGCDigitizer::hitOrder_monitor
std::unordered_map< uint32_t, bool > hitOrder_monitor
Definition: HGCDigitizer.h:156
hgcalTriggerNtuples_cfi.keV2fC
keV2fC
Definition: hgcalTriggerNtuples_cfi.py:11
HGCHEB
Definition: ForwardSubdetector.h:10
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
HGCDigitizer::averageOccupancies_
std::array< double, 4 > averageOccupancies_
Definition: HGCDigitizer.h:148
HGCDigitizer::geometryType_
int geometryType_
Definition: HGCDigitizer.h:100