CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalShapes.cc
Go to the documentation of this file.
10 
12 : theMCParams(0),
13  theShapes(),
14  theZDCShape(),
15  theHcalShape101(),
16  theHcalShape102(),
17  theHcalShape103(),
18  theHcalShape104(),
19  theHcalShape105(),
20  theHcalShape123(),
21  theHcalShape124(),
22  theHcalShape125(),
23  theHcalShape201(),
24  theHcalShape202(),
25  theHcalShape301(),
26  theHcalShape401()
27  {
28 /*
29  00 - not used (reserved)
30  101 - regular HPD HB/HE/HO shape
31  102 - "special" HB HPD#14 long shape
32  201 - SiPMs Zecotec shape (HO)
33  202 - SiPMs Hamamatsu shape (HO)
34  301 - regular HF PMT shape
35  401 - regular ZDC shape
36  */
37 
38 /*
39  theShapes[HPD] = new CaloCachedShapeIntegrator(&theHcalShape);
40  theShapes[LONG] = theShapes[HPD];
41  theShapes[ZECOTEK] = new CaloCachedShapeIntegrator(&theSiPMShape);
42  theShapes[HAMAMATSU] = theShapes[ZECOTEK];
43  theShapes[HF] = new CaloCachedShapeIntegrator(&theHFShape);
44 */
45 
55  theShapes[105] = new CaloCachedShapeIntegrator(&theHcalShape105); // HPD new
68  // ZDC not yet defined in CalibCalorimetry/HcalAlgos/src/HcalPulseShapes.cc
69  // theHcalShape401(401);
70  // theShapes[401] = new CaloCachedShapeIntegrator(&theHcalShape401);
72 
73 
74 
75  // backward-compatibility with old scheme
76 
77  theShapes[0] = theShapes[HPD];
78  //FIXME "special" HB
79  theShapes[1] = theShapes[LONG];
81  theShapes[3] = theShapes[HF];
82  theShapes[4] = theShapes[ZDC];
83 
84 }
85 
86 
88 {
89  for(ShapeMap::const_iterator shapeItr = theShapes.begin();
90  shapeItr != theShapes.end(); ++shapeItr)
91  {
92  delete shapeItr->second;
93  }
94  theShapes.clear();
95  delete theMCParams;
96 }
97 
98 
100 {
102  es.get<HcalMCParamsRcd>().get(p);
103  theMCParams = new HcalMCParams(*p.product());
104 }
105 
106 
108 {
109  delete theMCParams;
110  theMCParams = 0;
111 }
112 
113 
114 const CaloVShape * HcalShapes::shape(const DetId & detId) const
115 {
116  if(!theMCParams) {
117  return defaultShape(detId);
118  }
119  int shapeType = theMCParams->getValues(detId)->signalShape();
120  /*
121  HcalDetId cell(detId);
122  int sub = cell.subdet();
123  int depth = cell.depth();
124  int inteta = cell.ieta();
125  int intphi = cell.iphi();
126 
127  std::cout << "(SIM)HcalShapes::shape cell:"
128  << " sub, ieta, iphi, depth = "
129  << sub << " " << inteta << " " << intphi
130  << " " << depth << " => ShapeId "<< shapeType
131  << std::endl;
132  */
133  ShapeMap::const_iterator shapeMapItr = theShapes.find(shapeType);
134  if(shapeMapItr == theShapes.end()) {
135  edm::LogWarning("HcalShapes") << "HcalShapes::shape - shapeType ? = "
136  << shapeType << std::endl;
137  return defaultShape(detId);
138  } else {
139  return shapeMapItr->second;
140  }
141 }
142 
143 const CaloVShape * HcalShapes::defaultShape(const DetId & detId) const
144 {
145  // try to figure the appropriate shape
146  const CaloVShape * result;
148  = HcalGenericDetId(detId).genericSubdet();
149  if(subdet == HcalGenericDetId::HcalGenBarrel
150  || subdet == HcalGenericDetId::HcalGenEndcap) result = theShapes.find(0)->second;
151  else if(subdet == HcalGenericDetId::HcalGenOuter) result = theShapes.find(2)->second;
152  else if(subdet == HcalGenericDetId::HcalGenForward) result = theShapes.find(3)->second;
153  else if(subdet == HcalGenericDetId::HcalGenZDC) result = theShapes.find(3)->second;
154  else result = 0;
155 
156  edm::LogWarning("HcalShapes") << "Cannot find HCAL MC Params, so the defalut one is taken for subdet " << subdet;
157 
158  return result;
159 }
const HcalMCParams * theMCParams
Definition: HcalShapes.h:34
HcalShape theHcalShape102
Definition: HcalShapes.h:43
void setShape(int shapeType)
Definition: HcalShape.cc:9
Electronic response of the preamp.
Definition: CaloVShape.h:11
virtual const CaloVShape * shape(const DetId &detId) const
Definition: HcalShapes.cc:114
HcalShape theHcalShape125
Definition: HcalShapes.h:49
HcalShape theHcalShape301
Definition: HcalShapes.h:52
tuple result
Definition: query.py:137
HcalShape theHcalShape101
Definition: HcalShapes.h:42
HcalShape theHcalShape124
Definition: HcalShapes.h:48
void endRun()
Definition: HcalShapes.cc:107
Definition: DetId.h:20
HcalShape theHcalShape103
Definition: HcalShapes.h:44
HcalShape theHcalShape105
Definition: HcalShapes.h:46
HcalShape theHcalShape201
Definition: HcalShapes.h:50
ZDCShape theZDCShape
Definition: HcalShapes.h:39
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
unsigned int signalShape() const
Definition: HcalMCParam.h:38
HcalShape theHcalShape104
Definition: HcalShapes.h:45
void beginRun(edm::EventSetup const &es)
Definition: HcalShapes.cc:99
const CaloVShape * defaultShape(const DetId &detId) const
Definition: HcalShapes.cc:143
HcalGenericSubdetector genericSubdet() const
const Item * getValues(DetId fId) const
HcalShape theHcalShape123
Definition: HcalShapes.h:47
HcalShape theHcalShape202
Definition: HcalShapes.h:51
ShapeMap theShapes
Definition: HcalShapes.h:36