CMS 3D CMS Logo

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
HGCDigitizer::HGCDigitizer
HGCDigitizer(const edm::ParameterSet &ps, edm::ConsumesCollector &iC)
Definition: HGCDigitizer.cc:231
PHGCSimAccumulator
Definition: PHGCSimAccumulator.h:8
HGCDigitizer::thisBx_
static const unsigned int thisBx_
Definition: HGCDigitizer.h:127
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
edm::ESWatcher< CaloGeometryRecord >
HGCDigitizer::premixStage1MinCharge_
double premixStage1MinCharge_
Definition: HGCDigitizer.h:89
HGCDigitizer::simHitAccumulator_
std::unique_ptr< hgc::HGCSimHitDataAccumulator > simHitAccumulator_
Definition: HGCDigitizer.h:96
HGCDigitizer::digiCollection
std::string digiCollection()
Definition: HGCDigitizer.h:76
HGCDigitizer::gHGCal_
const HGCalGeometry * gHGCal_
Definition: HGCDigitizer.h:110
HGCDigitizer::nEvents_
uint32_t nEvents_
Definition: HGCDigitizer.h:123
HGCDigitizer::HGCCaloHitTuple_t
std::tuple< int, uint32_t, float > HGCCaloHitTuple_t
Definition: HGCDigitizer.h:35
edm::SortedCollection
Definition: SortedCollection.h:49
PileUpEventPrincipal
Definition: PileUpEventPrincipal.h:19
HGCDigitizer::maxBx_
static const unsigned int maxBx_
Definition: HGCDigitizer.h:126
HGCDigitizer::refSpeed_
float refSpeed_
Definition: HGCDigitizer.h:116
HGCDigitizer::theDigitizer_
std::unique_ptr< HGCDigitizerBase > theDigitizer_
Definition: HGCDigitizer.h:104
HGCDigitizer::premixStage1_
bool premixStage1_
Definition: HGCDigitizer.h:86
HGCDigitizer::ev_per_eh_pair_
double ev_per_eh_pair_
Definition: HGCDigitizer.h:95
edm::Handle
Definition: AssociativeIterator.h:50
HcalGeometry.h
ForwardSubdetector.h
HGCDigitizer::accumulate_forPreMix
void accumulate_forPreMix(edm::Event const &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *hre)
Definition: HGCDigitizer.cc:343
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
HGCDigitizer::pusimHitAccumulator_
std::unique_ptr< hgc::HGCPUSimHitDataAccumulator > pusimHitAccumulator_
Definition: HGCDigitizer.h:97
HGCDigitizer::orderByDetIdThenTime
static bool orderByDetIdThenTime(const HGCCaloHitTuple_t &a, const HGCCaloHitTuple_t &b)
Definition: HGCDigitizer.h:36
HGCalGeometry
Definition: HGCalGeometry.h:29
b
double b
Definition: hdecay.h:118
CaloGeometryRecord.h
HGCDigitizer::hitCollection_
std::string hitCollection_
Definition: HGCDigitizer.h:80
HGCalGeometry.h
edm::ParameterSet
Definition: ParameterSet.h:47
a
double a
Definition: hdecay.h:119
HGCDigitizer::accumulate
void accumulate(edm::Event const &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *hre)
handle SimHit accumulation
Definition: HGCDigitizer.cc:365
HGCDigitizer::maxSimHitsAccTime_
int maxSimHitsAccTime_
Definition: HGCDigitizer.h:94
HGCDigitizer::finalizeEvent
void finalizeEvent(edm::Event &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *hre)
Definition: HGCDigitizer.cc:299
HGCDigitizer::geomToken_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geomToken_
Definition: HGCDigitizer.h:107
PCaloHit.h
HGCDigitizer::resetSimHitDataAccumulator
void resetSimHitDataAccumulator()
Definition: HGCDigitizer.cc:714
HGCDigitizer::hitRefs_bx0
std::unordered_map< uint32_t, std::vector< std::pair< float, float > > > hitRefs_bx0
Definition: HGCDigitizer.h:129
HGCDigiCollections.h
HGCDigitizer::~HGCDigitizer
~HGCDigitizer()
Definition: HGCDigitizer.h:32
edm::EventSetup
Definition: EventSetup.h:58
HGCDigitizer::digitizationType_
int digitizationType_
Definition: HGCDigitizer.h:83
PHGCSimAccumulator.h
PCaloHit
Definition: PCaloHit.h:8
HGCDigitizerBase.h
HGCDigitizer::PhitRefs_bx0
std::unordered_map< uint32_t, std::vector< std::tuple< float, float, float > > > PhitRefs_bx0
Definition: HGCDigitizer.h:130
edm::ESGetToken< CaloGeometry, CaloGeometryRecord >
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HGCDigitizer::validIds_
std::unordered_set< DetId > validIds_
Definition: HGCDigitizer.h:109
HGCDigitizer::bxTime_
double bxTime_
Definition: HGCDigitizer.h:95
HGCDigitizer::tofDelay_
float tofDelay_
Definition: HGCDigitizer.h:119
HGCDigitizer::premixStage1MaxCharge_
double premixStage1MaxCharge_
Definition: HGCDigitizer.h:91
HGCDigitizer::initializeEvent
void initializeEvent(edm::Event const &e, edm::EventSetup const &c)
actions at the start/end of event
Definition: HGCDigitizer.cc:269
HGCDigitizer::verbosity_
uint32_t verbosity_
Definition: HGCDigitizer.h:113
HGCDigitizer::digiCollection_
std::string digiCollection_
Definition: HGCDigitizer.h:80
DetId.h
Frameworkfwd.h
ESWatcher.h
CaloGeometry.h
HGCDigitizer::resetPUSimHitDataAccumulator
void resetPUSimHitDataAccumulator()
HGCDigitizer
Definition: HGCDigitizer.h:29
HGCDigitizer::geomWatcher_
edm::ESWatcher< CaloGeometryRecord > geomWatcher_
Definition: HGCDigitizer.h:108
HGCDigitizer::checkPosition
void checkPosition(const HGCalDigiCollection *digis) const
Definition: HGCDigitizer.cc:742
PCaloHitContainer.h
HGCDigitizer::cce_
std::vector< float > cce_
Definition: HGCDigitizer.h:128
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
edm::Event
Definition: Event.h:73
HGCDigitizer::getType
uint32_t getType() const
Definition: HGCDigitizer.cc:721
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
HGCDigitizer::hitOrder_monitor
std::unordered_map< uint32_t, bool > hitOrder_monitor
Definition: HGCDigitizer.h:131
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
HGCDigitizer::averageOccupancies_
std::array< double, 4 > averageOccupancies_
Definition: HGCDigitizer.h:122