CMS 3D CMS Logo

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