CMS 3D CMS Logo

HcalPulseContainmentManager.cc
Go to the documentation of this file.
5 #include <iostream>
6 
8  : entries_(), shapes_(), max_fracerror_(max_fracerror) {
9  hcalTimeSlew_delay_ = nullptr;
10 }
11 
14  es.get<HcalTimeSlewRecord>().get("HBHE", delay);
15  hcalTimeSlew_delay_ = &*delay;
16 
17  shapes_.beginRun(es);
18 }
19 
20 void HcalPulseContainmentManager::beginRun(const HcalDbService* conditions, const HcalTimeSlew* delay) {
21  hcalTimeSlew_delay_ = delay;
22 
23  shapes_.beginRun(conditions);
24 }
25 
26 double HcalPulseContainmentManager::correction(const HcalDetId& detId, int toAdd, float fixedphase_ns, double fc_ampl) {
27  /*
28  int sub = detId.subdet();
29  int depth = detId.depth();
30  int inteta = detId.ieta();
31  int intphi = detId.iphi();
32 
33  std::cout << "* HcalPulseContainmentManager::correction, cell:"
34  << " sub, ieta, iphi, depth = "
35  << sub << " " << inteta << " " << intphi
36  << " " << depth << " toAaa= " << toAdd
37  <<" phase = " << fixedphase_ns << " ampl = "
38  << fc_ampl
39  << std::endl;
40  */
41 
42  return get(detId, toAdd, fixedphase_ns)->getCorrection(fc_ampl);
43 }
44 
46  int toAdd,
47  float fixedphase_ns) {
48  // const HcalPulseShape * shape = &(shapes_.shape(detId));
49  const HcalPulseShape* shape = &(shapes_.shapeForReco(detId));
50  for (std::vector<HcalPulseContainmentEntry>::const_iterator entryItr = entries_.begin(); entryItr != entries_.end();
51  ++entryItr) {
52  if (entryItr->shape_ == shape && entryItr->toAdd_ == toAdd && entryItr->fixedphase_ns_ == fixedphase_ns) {
53  return &entryItr->correction_;
54  }
55  }
56 
57  /*
58  int sub = detId.subdet();
59  int depth = detId.depth();
60  int inteta = detId.ieta();
61  int intphi = detId.iphi();
62 
63  std::cout << "* HcalPulseContainmentManager::get new entry, cell:"
64  << " sub, ieta, iphi, depth = "
65  << sub << " " << inteta << " " << intphi
66  << " " << depth
67  << std::endl;
68  */
69 
70  // didn't find it. Make one.
72  toAdd,
73  fixedphase_ns,
74  shape,
76  entries_.push_back(entry);
77  return &(entries_.back().correction_);
78 }
const HcalPulseContainmentCorrection * get(const HcalDetId &detId, int toAdd, float fixedphase_ns)
void beginRun(edm::EventSetup const &es)
const Shape & shapeForReco(const HcalDetId &detId) const
double correction(const HcalDetId &detId, int toAdd, float fixedphase_ns, double fc_ampl)
std::vector< HcalPulseContainmentEntry > entries_
void beginRun(edm::EventSetup const &es)
T get() const
Definition: EventSetup.h:73
HcalPulseContainmentManager(float max_fracerror)