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 
17 
18 #include <vector>
19 #include <map>
20 #include <unordered_set>
21 #include <memory>
22 #include <tuple>
23 
24 class PCaloHit;
26 
27 class HGCDigitizer {
28 public:
31 
32  // index , det id, time
33  typedef std::tuple<int, uint32_t, float> HGCCaloHitTuple_t;
35  unsigned int detId_a(std::get<1>(a)), detId_b(std::get<1>(b));
36 
37  if (detId_a < detId_b)
38  return true;
39  if (detId_a > detId_b)
40  return false;
41 
42  double time_a(std::get<2>(a)), time_b(std::get<2>(b));
43  if (time_a < time_b)
44  return true;
45 
46  return false;
47  }
48 
52  void accumulate(edm::Event const& e, edm::EventSetup const& c, CLHEP::HepRandomEngine* hre);
53  void accumulate_forPreMix(edm::Event const& e, edm::EventSetup const& c, CLHEP::HepRandomEngine* hre);
54 
55  void accumulate(PileUpEventPrincipal const& e, edm::EventSetup const& c, CLHEP::HepRandomEngine* hre);
56  void accumulate_forPreMix(PileUpEventPrincipal const& e, edm::EventSetup const& c, CLHEP::HepRandomEngine* hre);
57 
59  int bxCrossing,
60  const HGCalGeometry* geom,
61  CLHEP::HepRandomEngine* hre);
63  int bxCrossing,
64  const HGCalGeometry* geom,
65  CLHEP::HepRandomEngine* hre);
66 
67  void accumulate_forPreMix(const PHGCSimAccumulator& simAccumulator, const bool minbiasFlag);
71  void initializeEvent(edm::Event const& e, edm::EventSetup const& c);
72  void finalizeEvent(edm::Event& e, edm::EventSetup const& c, CLHEP::HepRandomEngine* hre);
73 
75 
79  void beginRun(const edm::EventSetup& es);
80  void endRun();
81 
82 private:
83  uint32_t getType() const;
85 
86  //digitization type (it's up to the specializations to decide it's meaning)
88 
89  // if true, we're running mixing in premixing stage1 and have to produce the output differently
91 
92  // Minimum charge threshold for premixing stage1
94  // Maximum charge for packing in premixing stage1
96 
97  //handle sim hits
100  std::unique_ptr<hgc::HGCSimHitDataAccumulator> simHitAccumulator_;
101  std::unique_ptr<hgc::HGCPUSimHitDataAccumulator> pusimHitAccumulator_;
104  //debug position
105  void checkPosition(const HGCalDigiCollection* digis) const;
106 
107  //digitizer
108  std::unique_ptr<HGCDigitizerBase> theDigitizer_;
109 
110  //geometries
111  std::unordered_set<DetId> validIds_;
113 
114  //misc switches
115  uint32_t verbosity_;
116 
117  //reference speed to evaluate time of arrival at the sensititive detector, assuming the center of CMS
118  float refSpeed_;
119 
120  //delay to apply after evaluating time of arrival at the sensitive detector
121  float tofDelay_;
122 
123  //average occupancies
124  std::array<double, 4> averageOccupancies_;
125  uint32_t nEvents_;
126 
127  //maxBx limit beyond which the Digitizer should filter out all hits
128  static const unsigned int maxBx_ = 14;
129  static const unsigned int thisBx_ = 9;
130  std::vector<float> cce_;
131  std::unordered_map<uint32_t, std::vector<std::pair<float, float> > > hitRefs_bx0;
132  std::unordered_map<uint32_t, std::vector<std::tuple<float, float, float> > > PhitRefs_bx0;
133  std::unordered_map<uint32_t, bool> hitOrder_monitor;
134 };
135 
136 #endif
HGCDigitizer::HGCDigitizer
HGCDigitizer(const edm::ParameterSet &ps, edm::ConsumesCollector &iC)
Definition: HGCDigitizer.cc:233
PHGCSimAccumulator
Definition: PHGCSimAccumulator.h:8
HGCDigitizer::thisBx_
static const unsigned int thisBx_
Definition: HGCDigitizer.h:129
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
HGCDigitizer::premixStage1MinCharge_
double premixStage1MinCharge_
Definition: HGCDigitizer.h:93
HGCDigitizer::simHitAccumulator_
std::unique_ptr< hgc::HGCSimHitDataAccumulator > simHitAccumulator_
Definition: HGCDigitizer.h:100
HGCDigitizer::digiCollection
std::string digiCollection()
Definition: HGCDigitizer.h:74
ESHandle.h
HGCDigitizer::gHGCal_
const HGCalGeometry * gHGCal_
Definition: HGCDigitizer.h:112
HGCDigitizer::endRun
void endRun()
Definition: HGCDigitizer.cc:718
HGCDigitizer::nEvents_
uint32_t nEvents_
Definition: HGCDigitizer.h:125
HGCDigitizer::HGCCaloHitTuple_t
std::tuple< int, uint32_t, float > HGCCaloHitTuple_t
Definition: HGCDigitizer.h:33
edm::SortedCollection
Definition: SortedCollection.h:49
PileUpEventPrincipal
Definition: PileUpEventPrincipal.h:19
HGCDigitizer::maxBx_
static const unsigned int maxBx_
Definition: HGCDigitizer.h:128
HGCDigitizer::beginRun
void beginRun(const edm::EventSetup &es)
actions at the start/end of run
Definition: HGCDigitizer.cc:694
HGCDigitizer::refSpeed_
float refSpeed_
Definition: HGCDigitizer.h:118
HGCDigitizer::theDigitizer_
std::unique_ptr< HGCDigitizerBase > theDigitizer_
Definition: HGCDigitizer.h:108
HGCDigitizer::premixStage1_
bool premixStage1_
Definition: HGCDigitizer.h:90
HGCDigitizer::ev_per_eh_pair_
double ev_per_eh_pair_
Definition: HGCDigitizer.h:99
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:323
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
HGCDigitizer::pusimHitAccumulator_
std::unique_ptr< hgc::HGCPUSimHitDataAccumulator > pusimHitAccumulator_
Definition: HGCDigitizer.h:101
HGCDigitizer::orderByDetIdThenTime
static bool orderByDetIdThenTime(const HGCCaloHitTuple_t &a, const HGCCaloHitTuple_t &b)
Definition: HGCDigitizer.h:34
HGCalGeometry
Definition: HGCalGeometry.h:29
b
double b
Definition: hdecay.h:118
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HGCDigitizer::hitCollection_
std::string hitCollection_
Definition: HGCDigitizer.h:84
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:345
HGCDigitizer::maxSimHitsAccTime_
int maxSimHitsAccTime_
Definition: HGCDigitizer.h:98
HGCDigitizer::finalizeEvent
void finalizeEvent(edm::Event &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *hre)
Definition: HGCDigitizer.cc:279
PCaloHit.h
HGCDigitizer::resetSimHitDataAccumulator
void resetSimHitDataAccumulator()
Definition: HGCDigitizer.cc:721
HGCDigitizer::hitRefs_bx0
std::unordered_map< uint32_t, std::vector< std::pair< float, float > > > hitRefs_bx0
Definition: HGCDigitizer.h:131
HGCDigiCollections.h
HGCDigitizer::~HGCDigitizer
~HGCDigitizer()
Definition: HGCDigitizer.h:30
edm::EventSetup
Definition: EventSetup.h:58
HGCDigitizer::digitizationType_
int digitizationType_
Definition: HGCDigitizer.h:87
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:132
HGCDigitizer::validIds_
std::unordered_set< DetId > validIds_
Definition: HGCDigitizer.h:111
HGCDigitizer::bxTime_
double bxTime_
Definition: HGCDigitizer.h:99
HGCDigitizer::tofDelay_
float tofDelay_
Definition: HGCDigitizer.h:121
HGCDigitizer::premixStage1MaxCharge_
double premixStage1MaxCharge_
Definition: HGCDigitizer.h:95
HGCDigitizer::initializeEvent
void initializeEvent(edm::Event const &e, edm::EventSetup const &c)
actions at the start/end of event
Definition: HGCDigitizer.cc:271
HGCDigitizer::verbosity_
uint32_t verbosity_
Definition: HGCDigitizer.h:115
HGCDigitizer::digiCollection_
std::string digiCollection_
Definition: HGCDigitizer.h:84
DetId.h
Frameworkfwd.h
HGCDigitizer::resetPUSimHitDataAccumulator
void resetPUSimHitDataAccumulator()
HGCDigitizer
Definition: HGCDigitizer.h:27
HGCDigitizer::checkPosition
void checkPosition(const HGCalDigiCollection *digis) const
Definition: HGCDigitizer.cc:749
PCaloHitContainer.h
HGCDigitizer::cce_
std::vector< float > cce_
Definition: HGCDigitizer.h:130
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
edm::Event
Definition: Event.h:73
HGCDigitizer::getType
uint32_t getType() const
Definition: HGCDigitizer.cc:728
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
HGCDigitizer::hitOrder_monitor
std::unordered_map< uint32_t, bool > hitOrder_monitor
Definition: HGCDigitizer.h:133
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
HGCDigitizer::averageOccupancies_
std::array< double, 4 > averageOccupancies_
Definition: HGCDigitizer.h:124