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  shapes_.endRun();
27 }
28 
30  int toAdd, float fixedphase_ns, double fc_ampl)
31 {
32 
33  /*
34  int sub = detId.subdet();
35  int depth = detId.depth();
36  int inteta = detId.ieta();
37  int intphi = detId.iphi();
38 
39  std::cout << "* HcalPulseContainmentManager::correction, cell:"
40  << " sub, ieta, iphi, depth = "
41  << sub << " " << inteta << " " << intphi
42  << " " << depth << " toAaa= " << toAdd
43  <<" phase = " << fixedphase_ns << " ampl = "
44  << fc_ampl
45  << std::endl;
46  */
47 
48  return get(detId, toAdd, fixedphase_ns)->getCorrection(fc_ampl);
49 }
50 
52 HcalPulseContainmentManager::get(const HcalDetId & detId, int toAdd, float fixedphase_ns)
53 {
54  // const HcalPulseShape * shape = &(shapes_.shape(detId));
55  const HcalPulseShape * shape = &(shapes_.shapeForReco(detId));
56  for(std::vector<HcalPulseContainmentEntry>::const_iterator entryItr = entries_.begin();
57  entryItr != entries_.end(); ++entryItr)
58  {
59  if (entryItr->shape_ == shape && entryItr->toAdd_ == toAdd && entryItr->fixedphase_ns_ == fixedphase_ns)
60  {
61  return &entryItr->correction_;
62  }
63  }
64 
65  /*
66  int sub = detId.subdet();
67  int depth = detId.depth();
68  int inteta = detId.ieta();
69  int intphi = detId.iphi();
70 
71  std::cout << "* HcalPulseContainmentManager::get new entry, cell:"
72  << " sub, ieta, iphi, depth = "
73  << sub << " " << inteta << " " << intphi
74  << " " << depth
75  << std::endl;
76  */
77 
78  // didn't find it. Make one.
79  HcalPulseContainmentEntry entry(toAdd, fixedphase_ns, shape, HcalPulseContainmentCorrection(shape, toAdd, fixedphase_ns, max_fracerror_, hcalTimeSlew_delay_));
80  entries_.push_back(entry);
81  return &(entries_.back().correction_);
82 }
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_
const T & get() const
Definition: EventSetup.h:58
void beginRun(edm::EventSetup const &es)
HcalPulseContainmentManager(float max_fracerror)