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.
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  theHcalShape301(),
27  theHcalShape401()
28  {
29 /*
30  00 - not used (reserved)
31  101 - regular HPD HB/HE/HO shape
32  102 - "special" HB HPD#14 long shape
33  201 - SiPMs Zecotec shape (HO)
34  202 - SiPMs Hamamatsu shape (HO)
35  301 - regular HF PMT shape
36  401 - regular ZDC shape
37  */
38 
39 /*
40  theShapes[HPD] = new CaloCachedShapeIntegrator(&theHcalShape);
41  theShapes[LONG] = theShapes[HPD];
42  theShapes[ZECOTEK] = new CaloCachedShapeIntegrator(&theSiPMShape);
43  theShapes[HAMAMATSU] = theShapes[ZECOTEK];
44  theShapes[HF] = new CaloCachedShapeIntegrator(&theHFShape);
45 */
46 
56  theShapes[105] = new CaloCachedShapeIntegrator(&theHcalShape105); // HPD new
69  // ZDC not yet defined in CalibCalorimetry/HcalAlgos/src/HcalPulseShapes.cc
70  // theHcalShape401(401);
71  // theShapes[401] = new CaloCachedShapeIntegrator(&theHcalShape401);
73 
74 
75 
76  // backward-compatibility with old scheme
77 
78  theShapes[0] = theShapes[HPD];
79  //FIXME "special" HB
80  theShapes[1] = theShapes[LONG];
82  theShapes[3] = theShapes[HF];
83  theShapes[4] = theShapes[ZDC];
84 
85  theMCParams=0;
86  theTopology=0;
87 }
88 
89 
91 {
92  for(ShapeMap::const_iterator shapeItr = theShapes.begin();
93  shapeItr != theShapes.end(); ++shapeItr)
94  {
95  delete shapeItr->second;
96  }
97  theShapes.clear();
98  if (theMCParams!=0) delete theMCParams;
99  if (theTopology!=0) delete theTopology;
100 }
101 
102 
104 {
106  es.get<HcalMCParamsRcd>().get(p);
107  theMCParams = new HcalMCParams(*p.product());
108 
109 // here we are making a _copy_ so we need to add a copy of the topology...
110 
112  es.get<IdealGeometryRecord>().get(htopo);
113  theTopology=new HcalTopology(*htopo);
115 }
116 
117 
119 {
120  if (theMCParams) delete theMCParams;
121  theMCParams = 0;
122  if (theTopology) delete theTopology;
123  theTopology = 0;
124 }
125 
126 
127 const CaloVShape * HcalShapes::shape(const DetId & detId) const
128 {
129  if(!theMCParams) {
130  return defaultShape(detId);
131  }
132  int shapeType = theMCParams->getValues(detId)->signalShape();
133  /*
134  HcalDetId cell(detId);
135  int sub = cell.subdet();
136  int depth = cell.depth();
137  int inteta = cell.ieta();
138  int intphi = cell.iphi();
139 
140  std::cout << "(SIM)HcalShapes::shape cell:"
141  << " sub, ieta, iphi, depth = "
142  << sub << " " << inteta << " " << intphi
143  << " " << depth << " => ShapeId "<< shapeType
144  << std::endl;
145  */
146  ShapeMap::const_iterator shapeMapItr = theShapes.find(shapeType);
147  if(shapeMapItr == theShapes.end()) {
148  edm::LogWarning("HcalShapes") << "HcalShapes::shape - shapeType ? = "
149  << shapeType << std::endl;
150  return defaultShape(detId);
151  } else {
152  return shapeMapItr->second;
153  }
154 }
155 
156 const CaloVShape * HcalShapes::defaultShape(const DetId & detId) const
157 {
158  // try to figure the appropriate shape
159  const CaloVShape * result;
161  = HcalGenericDetId(detId).genericSubdet();
162  if(subdet == HcalGenericDetId::HcalGenBarrel
163  || subdet == HcalGenericDetId::HcalGenEndcap) result = theShapes.find(0)->second;
164  else if(subdet == HcalGenericDetId::HcalGenOuter) result = theShapes.find(2)->second;
165  else if(subdet == HcalGenericDetId::HcalGenForward) result = theShapes.find(3)->second;
166  else if(subdet == HcalGenericDetId::HcalGenZDC) result = theShapes.find(3)->second;
167  else result = 0;
168 
169  edm::LogWarning("HcalShapes") << "Cannot find HCAL MC Params, so the defalut one is taken for subdet " << subdet;
170 
171  return result;
172 }
const HcalMCParams * theMCParams
Definition: HcalShapes.h:35
HcalShape theHcalShape102
Definition: HcalShapes.h:45
void setShape(int shapeType)
Definition: HcalShape.cc:9
void setTopo(const HcalTopology *topo) const
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:127
HcalShape theHcalShape125
Definition: HcalShapes.h:51
HcalShape theHcalShape301
Definition: HcalShapes.h:54
tuple result
Definition: query.py:137
HcalShape theHcalShape101
Definition: HcalShapes.h:44
HcalShape theHcalShape124
Definition: HcalShapes.h:50
void endRun()
Definition: HcalShapes.cc:118
Definition: DetId.h:20
HcalShape theHcalShape103
Definition: HcalShapes.h:46
HcalShape theHcalShape105
Definition: HcalShapes.h:48
const HcalTopology * theTopology
Definition: HcalShapes.h:36
HcalShape theHcalShape201
Definition: HcalShapes.h:52
ZDCShape theZDCShape
Definition: HcalShapes.h:41
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:47
void beginRun(edm::EventSetup const &es)
Definition: HcalShapes.cc:103
const CaloVShape * defaultShape(const DetId &detId) const
Definition: HcalShapes.cc:156
HcalGenericSubdetector genericSubdet() const
HcalShape theHcalShape123
Definition: HcalShapes.h:49
HcalShape theHcalShape202
Definition: HcalShapes.h:53
ShapeMap theShapes
Definition: HcalShapes.h:38