CMS 3D CMS Logo

HcalShapes.cc
Go to the documentation of this file.
11 
13 : theMCParams(0),
14  theShapes(),
15  theZDCShape(),
16  theHcalShape101(),
17  theHcalShape102(),
18  theHcalShape103(),
19  theHcalShape104(),
20  theHcalShape105(),
21  theHcalShape123(),
22  theHcalShape124(),
23  theHcalShape125(),
24  theHcalShape201(),
25  theHcalShape202(),
26  theHcalShape203(),
27  theHcalShape301(),
28  theHcalShape401()
29  {
30 /*
31  00 - not used (reserved)
32  101 - regular HPD HB/HE/HO shape
33  102 - "special" HB HPD#14 long shape
34  201 - SiPMs Zecotec shape (HO)
35  202 - SiPMs Hamamatsu shape (HO)
36  203 - SiPMs Hamamatsu shape (HE 2017)
37  301 - regular HF PMT shape
38  401 - regular ZDC shape
39  */
40 
50  theShapes[105] = new CaloCachedShapeIntegrator(&theHcalShape105); // HPD new
65  // ZDC not yet defined in CalibCalorimetry/HcalAlgos/src/HcalPulseShapes.cc
66  // theHcalShape401(401);
67  // theShapes[401] = new CaloCachedShapeIntegrator(&theHcalShape401);
69 
70  theMCParams=0;
71  theTopology=0;
72 }
73 
74 
76 {
77  for(ShapeMap::const_iterator shapeItr = theShapes.begin();
78  shapeItr != theShapes.end(); ++shapeItr)
79  {
80  delete shapeItr->second;
81  }
82  theShapes.clear();
83  if (theMCParams!=0) delete theMCParams;
84  if (theTopology!=0) delete theTopology;
85 }
86 
87 
89 {
91  es.get<HcalMCParamsRcd>().get(p);
92  theMCParams = new HcalMCParams(*p.product());
93 
94 // here we are making a _copy_ so we need to add a copy of the topology...
95 
97  es.get<HcalRecNumberingRecord>().get(htopo);
98  theTopology=new HcalTopology(*htopo);
100 }
101 
102 
104 {
105  if (theMCParams) delete theMCParams;
106  theMCParams = 0;
107  if (theTopology) delete theTopology;
108  theTopology = 0;
109 }
110 
111 
112 const CaloVShape * HcalShapes::shape(const DetId & detId) const
113 {
114  if(!theMCParams) {
115  return defaultShape(detId);
116  }
117  int shapeType = theMCParams->getValues(detId)->signalShape();
118  ShapeMap::const_iterator shapeMapItr = theShapes.find(shapeType);
119  if(shapeMapItr == theShapes.end()) {
120  edm::LogWarning("HcalShapes") << "HcalShapes::shape - shapeType ? = "
121  << shapeType << std::endl;
122  return defaultShape(detId);
123  } else {
124  return shapeMapItr->second;
125  }
126 }
127 
128 const CaloVShape * HcalShapes::defaultShape(const DetId & detId) const
129 {
130  // try to figure the appropriate shape
131  const CaloVShape * result;
133  = HcalGenericDetId(detId).genericSubdet();
134  if(subdet == HcalGenericDetId::HcalGenBarrel
135  || subdet == HcalGenericDetId::HcalGenEndcap) result = theShapes.find(HPD)->second;
136  else if(subdet == HcalGenericDetId::HcalGenOuter) result = theShapes.find(HPD)->second;
137  else if(subdet == HcalGenericDetId::HcalGenForward) result = theShapes.find(HF)->second;
138  else if(subdet == HcalGenericDetId::HcalGenZDC) result = theShapes.find(ZDC)->second;
139  else result = 0;
140 
141  edm::LogWarning("HcalShapes") << "Cannot find HCAL MC Params, so the default one is taken for subdet " << subdet;
142 
143  return result;
144 }
HcalShape theHcalShape102
Definition: HcalShapes.h:40
void setShape(int shapeType)
Definition: HcalShape.cc:8
HcalShape theHcalShape203
Definition: HcalShapes.h:49
Electronic response of the preamp.
Definition: CaloVShape.h:11
const Item * getValues(DetId fId, bool throwOnFail=true) const
virtual const CaloVShape * shape(const DetId &detId) const
Definition: HcalShapes.cc:112
HcalShape theHcalShape125
Definition: HcalShapes.h:46
HcalShape theHcalShape301
Definition: HcalShapes.h:50
HcalShape theHcalShape101
Definition: HcalShapes.h:39
HcalShape theHcalShape124
Definition: HcalShapes.h:45
void endRun()
Definition: HcalShapes.cc:103
Definition: DetId.h:18
HcalShape theHcalShape103
Definition: HcalShapes.h:41
HcalShape theHcalShape105
Definition: HcalShapes.h:43
const HcalTopology * theTopology
Definition: HcalShapes.h:34
HcalShape theHcalShape201
Definition: HcalShapes.h:47
ZDCShape theZDCShape
Definition: HcalShapes.h:37
const T & get() const
Definition: EventSetup.h:56
unsigned int signalShape() const
Definition: HcalMCParam.h:40
HcalShape theHcalShape104
Definition: HcalShapes.h:42
void beginRun(edm::EventSetup const &es)
Definition: HcalShapes.cc:88
const CaloVShape * defaultShape(const DetId &detId) const
Definition: HcalShapes.cc:128
HcalGenericSubdetector genericSubdet() const
HcalMCParams * theMCParams
Definition: HcalShapes.h:33
T const * product() const
Definition: ESHandle.h:86
HcalShape theHcalShape123
Definition: HcalShapes.h:44
void setTopo(const HcalTopology *topo)
HcalShape theHcalShape202
Definition: HcalShapes.h:48
ShapeMap theShapes
Definition: HcalShapes.h:36