CMS 3D CMS Logo

HGCDigitizerBase.h
Go to the documentation of this file.
1 #ifndef SimCalorimetry_HGCSimProducers_hgcdigitizerbase
2 #define SimCalorimetry_HGCSimProducers_hgcdigitizerbase
3 
4 #include <array>
5 #include <iostream>
6 #include <vector>
7 #include <memory>
8 #include <unordered_map>
9 #include <unordered_set>
10 
15 
17 
19 
23 
24 namespace hgc = hgc_digi;
25 
26 namespace hgc_digi_utils {
27  using hgc::HGCCellInfo;
28 
29  inline void addCellMetadata(HGCCellInfo& info,
30  const HcalGeometry* geom,
31  const DetId& detid ) {
32  //base time samples for each DetId, initialized to 0
33  info.size = 1.0;
34  info.thickness = 1.0;
35  }
36 
37  inline void addCellMetadata(HGCCellInfo& info,
38  const HGCalGeometry* geom,
39  const DetId& detid ) {
40  const auto& dddConst = geom->topology().dddConstants();
41  bool isHalf = (((dddConst.geomMode() == HGCalGeometryMode::Hexagon) ||
42  (dddConst.geomMode() == HGCalGeometryMode::HexagonFull)) ?
43  dddConst.isHalfCell(HGCalDetId(detid).wafer(),HGCalDetId(detid).cell()) :
44  false);
45  //base time samples for each DetId, initialized to 0
46  info.size = (isHalf ? 0.5 : 1.0);
47  info.thickness = dddConst.waferType(detid);
48  }
49 
50  inline void addCellMetadata(HGCCellInfo& info,
52  const DetId& detid ) {
53  if( DetId::Hcal == detid.det() ) {
54  const HcalGeometry* hc = static_cast<const HcalGeometry*>(geom);
55  addCellMetadata(info,hc,detid);
56  } else {
57  const HGCalGeometry* hg = static_cast<const HGCalGeometry*>(geom);
58  addCellMetadata(info,hg,detid);
59  }
60  }
61 
62 }
63 
64 
65 template <class DFr>
67  public:
68 
69  typedef DFr DigiType;
70 
72 
80  void run(std::unique_ptr<DColl> &digiColl, hgc::HGCSimHitDataAccumulator &simData,
81  const CaloSubdetectorGeometry* theGeom, const std::unordered_set<DetId>& validIds,
82  uint32_t digitizationType,CLHEP::HepRandomEngine* engine);
83 
87  float keV2fC() const { return keV2fC_; }
88  bool toaModeByEnergy() const { return (myFEelectronics_->toaMode()==HGCFEElectronics<DFr>::WEIGHTEDBYE); }
89  float tdcOnset() const { return myFEelectronics_->getTDCOnset(); }
90  std::array<float,3> tdcForToAOnset() const { return myFEelectronics_->getTDCForToAOnset(); }
91 
95  void runSimple(std::unique_ptr<DColl> &coll, hgc::HGCSimHitDataAccumulator &simData,
96  const CaloSubdetectorGeometry* theGeom, const std::unordered_set<DetId>& validIds,
97  CLHEP::HepRandomEngine* engine);
98 
102  void updateOutput(std::unique_ptr<DColl> &coll, const DFr& rawDataFrame);
103 
107  virtual void runDigitizer(std::unique_ptr<DColl> &coll, hgc::HGCSimHitDataAccumulator &simData,
108  const CaloSubdetectorGeometry* theGeom, const std::unordered_set<DetId>& validIds,
109  uint32_t digitizerType, CLHEP::HepRandomEngine* engine)
110  {
111  throw cms::Exception("HGCDigitizerBaseException") << " Failed to find specialization of runDigitizer";
112  }
113 
117  virtual ~HGCDigitizerBase()
118  { };
119 
120 
121 
122  protected:
123 
124  //baseline configuration
126 
127  //1keV in fC
128  float keV2fC_;
129 
130  //noise level
131  std::vector<float> noise_fC_;
132 
133  //charge collection efficiency
134  std::vector<double> cce_;
135 
136  //front-end electronics model
137  std::unique_ptr<HGCFEElectronics<DFr> > myFEelectronics_;
138 
139  //bunch time
140  double bxTime_;
141 
142  //if true will put both in time and out-of-time samples in the event
144 
145 };
146 
147 #endif
std::vector< float > noise_fC_
static const TGPicture * info(bool iBackgroundIsBlack)
std::array< float, 3 > tdcForToAOnset() const
void addCellMetadata(HGCCellInfo &info, const HcalGeometry *geom, const DetId &detid)
virtual ~HGCDigitizerBase()
DTOR.
edm::ParameterSet myCfg_
std::unordered_map< uint32_t, HGCCellInfo > HGCSimHitDataAccumulator
edm::SortedCollection< DFr > DColl
float tdcOnset() const
const HGCalTopology & topology() const
std::unique_ptr< HGCFEElectronics< DFr > > myFEelectronics_
float keV2fC() const
getters
std::vector< double > cce_
int waferType(DetId const &id) const
Definition: DetId.h:18
JetCorrectorParametersCollection coll
Definition: classes.h:10
const HGCalDDDConstants & dddConstants() const
virtual void runDigitizer(std::unique_ptr< DColl > &coll, hgc::HGCSimHitDataAccumulator &simData, const CaloSubdetectorGeometry *theGeom, const std::unordered_set< DetId > &validIds, uint32_t digitizerType, CLHEP::HepRandomEngine *engine)
to be specialized by top class
susybsm::HSCParticleCollection hc
Definition: classes.h:25
models the behavior of the front-end electronics
bool toaModeByEnergy() const
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39