CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes
HcalShapes Class Reference

#include <HcalShapes.h>

Inheritance diagram for HcalShapes:
CaloShapes

Public Types

enum  {
  HPD =101, LONG =102, ZECOTEK =201, HAMAMATSU =202,
  HE2017 =203, HF =301, ZDC =401
}
 

Public Member Functions

void beginRun (edm::EventSetup const &es)
 
void endRun ()
 
 HcalShapes ()
 
const CaloVShapeshape (const DetId &detId, bool precise=false) const override
 
 ~HcalShapes () override
 
- Public Member Functions inherited from CaloShapes
 CaloShapes ()
 
 CaloShapes (const CaloVShape *shape)
 
virtual ~CaloShapes ()=default
 

Private Types

typedef std::map< int, const CaloVShape * > ShapeMap
 

Private Member Functions

const CaloVShapedefaultShape (const DetId &detId, bool precise=false) const
 
const ShapeMapgetShapeMap (bool precise) const
 

Private Attributes

std::vector< HcalShapetheHcalShapes
 
HcalMCParamstheMCParams
 
ShapeMap theShapes
 
ShapeMap theShapesPrecise
 
const HcalTopologytheTopology
 
ZDCShape theZDCShape
 

Detailed Description

Definition at line 19 of file HcalShapes.h.

Member Typedef Documentation

typedef std::map<int, const CaloVShape *> HcalShapes::ShapeMap
private

Definition at line 32 of file HcalShapes.h.

Member Enumeration Documentation

anonymous enum
Enumerator
HPD 
LONG 
ZECOTEK 
HAMAMATSU 
HE2017 
HF 
ZDC 

Definition at line 22 of file HcalShapes.h.

Constructor & Destructor Documentation

HcalShapes::HcalShapes ( )

Definition at line 12 of file HcalShapes.cc.

References pileupDistInMC::num, theHcalShapes, theShapes, theShapesPrecise, theZDCShape, and ZDC.

13 : theMCParams(nullptr),
14  theTopology(nullptr)
15  {
16 /*
17  00 - not used (reserved)
18  101 - regular HPD HB/HE/HO shape
19  102 - "special" HB HPD#14 long shape
20  201 - SiPMs Zecotec shape (HO)
21  202 - SiPMs Hamamatsu shape (HO)
22  203 - SiPMs Hamamatsu shape (HE 2017)
23  301 - regular HF PMT shape
24  401 - regular ZDC shape
25  */
26 
27  std::vector<int> theHcalShapeNums = {101,102,103,104,105,123,124,125,201,202,203,205,301};
28  // use resize so vector won't invalidate pointers by reallocating memory while filling
29  theHcalShapes.resize(theHcalShapeNums.size());
30  for(unsigned inum = 0; inum < theHcalShapeNums.size(); ++inum){
31  int num = theHcalShapeNums[inum];
32  theHcalShapes[inum].setShape(num);
35  }
36 
37  // ZDC not yet defined in CalibCalorimetry/HcalAlgos/src/HcalPulseShapes.cc
40 }
const HcalTopology * theTopology
Definition: HcalShapes.h:37
ZDCShape theZDCShape
Definition: HcalShapes.h:40
std::vector< HcalShape > theHcalShapes
Definition: HcalShapes.h:42
HcalMCParams * theMCParams
Definition: HcalShapes.h:36
ShapeMap theShapes
Definition: HcalShapes.h:38
ShapeMap theShapesPrecise
Definition: HcalShapes.h:39
HcalShapes::~HcalShapes ( )
override

Definition at line 43 of file HcalShapes.cc.

References theMCParams, theShapes, and theTopology.

44 {
45  for(auto& shapeItr : theShapes)
46  {
47  delete shapeItr.second;
48  }
49  theShapes.clear();
50  if (theMCParams!=nullptr) delete theMCParams;
51  if (theTopology!=nullptr) delete theTopology;
52 }
const HcalTopology * theTopology
Definition: HcalShapes.h:37
HcalMCParams * theMCParams
Definition: HcalShapes.h:36
ShapeMap theShapes
Definition: HcalShapes.h:38

Member Function Documentation

void HcalShapes::beginRun ( edm::EventSetup const &  es)

Definition at line 55 of file HcalShapes.cc.

References edm::EventSetup::get(), AlCaHLTBitMon_ParallelJobs::p, edm::ESHandle< T >::product(), HcalCondObjectContainerBase::setTopo(), theMCParams, and theTopology.

Referenced by HcalDigitizer::beginRun().

56 {
58  es.get<HcalMCParamsRcd>().get(p);
59  theMCParams = new HcalMCParams(*p.product());
60 
61 // here we are making a _copy_ so we need to add a copy of the topology...
62 
64  es.get<HcalRecNumberingRecord>().get(htopo);
65  theTopology=new HcalTopology(*htopo);
67 }
const HcalTopology * theTopology
Definition: HcalShapes.h:37
HcalMCParams * theMCParams
Definition: HcalShapes.h:36
T const * product() const
Definition: ESHandle.h:86
void setTopo(const HcalTopology *topo)
const CaloVShape * HcalShapes::defaultShape ( const DetId detId,
bool  precise = false 
) const
private

Definition at line 96 of file HcalShapes.cc.

References HcalGenericDetId::genericSubdet(), getShapeMap(), HcalGenericDetId::HcalGenBarrel, HcalGenericDetId::HcalGenEndcap, HcalGenericDetId::HcalGenForward, HcalGenericDetId::HcalGenOuter, HcalGenericDetId::HcalGenZDC, HF, HPD, mps_fire::result, and ZDC.

Referenced by shape().

97 {
98  // try to figure the appropriate shape
99  const CaloVShape * result;
100  const auto& myShapes = getShapeMap(precise);
102  = HcalGenericDetId(detId).genericSubdet();
103  if(subdet == HcalGenericDetId::HcalGenBarrel
104  || subdet == HcalGenericDetId::HcalGenEndcap) result = myShapes.find(HPD)->second;
105  else if(subdet == HcalGenericDetId::HcalGenOuter) result = myShapes.find(HPD)->second;
106  else if(subdet == HcalGenericDetId::HcalGenForward) result = myShapes.find(HF)->second;
107  else if(subdet == HcalGenericDetId::HcalGenZDC) result = myShapes.find(ZDC)->second;
108  else result = nullptr;
109 
110  edm::LogWarning("HcalShapes") << "Cannot find HCAL MC Params, so the default one is taken for subdet " << subdet;
111 
112  return result;
113 }
Electronic response of the preamp.
Definition: CaloVShape.h:11
const ShapeMap & getShapeMap(bool precise) const
Definition: HcalShapes.cc:115
HcalGenericSubdetector genericSubdet() const
void HcalShapes::endRun ( )

Definition at line 70 of file HcalShapes.cc.

References theMCParams, and theTopology.

Referenced by HcalDigitizer::endRun().

71 {
72  if (theMCParams) delete theMCParams;
73  theMCParams = nullptr;
74  if (theTopology) delete theTopology;
75  theTopology = nullptr;
76 }
const HcalTopology * theTopology
Definition: HcalShapes.h:37
HcalMCParams * theMCParams
Definition: HcalShapes.h:36
const HcalShapes::ShapeMap & HcalShapes::getShapeMap ( bool  precise) const
private

Definition at line 115 of file HcalShapes.cc.

References theShapes, and theShapesPrecise.

Referenced by defaultShape(), and shape().

115  {
117 }
ShapeMap theShapes
Definition: HcalShapes.h:38
ShapeMap theShapesPrecise
Definition: HcalShapes.h:39
const CaloVShape * HcalShapes::shape ( const DetId detId,
bool  precise = false 
) const
overridevirtual

Reimplemented from CaloShapes.

Definition at line 79 of file HcalShapes.cc.

References defaultShape(), getShapeMap(), HcalCondObjectContainer< Item >::getValues(), HcalMCParam::signalShape(), and theMCParams.

80 {
81  if(!theMCParams) {
82  return defaultShape(detId);
83  }
84  int shapeType = theMCParams->getValues(detId)->signalShape();
85  const auto& myShapes = getShapeMap(precise);
86  auto shapeMapItr = myShapes.find(shapeType);
87  if(shapeMapItr == myShapes.end()) {
88  edm::LogWarning("HcalShapes") << "HcalShapes::shape - shapeType ? = "
89  << shapeType << std::endl;
90  return defaultShape(detId,precise);
91  } else {
92  return shapeMapItr->second;
93  }
94 }
const Item * getValues(DetId fId, bool throwOnFail=true) const
const CaloVShape * defaultShape(const DetId &detId, bool precise=false) const
Definition: HcalShapes.cc:96
const ShapeMap & getShapeMap(bool precise) const
Definition: HcalShapes.cc:115
unsigned int signalShape() const
Definition: HcalMCParam.h:40
HcalMCParams * theMCParams
Definition: HcalShapes.h:36

Member Data Documentation

std::vector<HcalShape> HcalShapes::theHcalShapes
private

Definition at line 42 of file HcalShapes.h.

Referenced by HcalShapes().

HcalMCParams* HcalShapes::theMCParams
private

Definition at line 36 of file HcalShapes.h.

Referenced by beginRun(), endRun(), shape(), and ~HcalShapes().

ShapeMap HcalShapes::theShapes
private

Definition at line 38 of file HcalShapes.h.

Referenced by getShapeMap(), HcalShapes(), and ~HcalShapes().

ShapeMap HcalShapes::theShapesPrecise
private

Definition at line 39 of file HcalShapes.h.

Referenced by getShapeMap(), and HcalShapes().

const HcalTopology* HcalShapes::theTopology
private

Definition at line 37 of file HcalShapes.h.

Referenced by beginRun(), endRun(), and ~HcalShapes().

ZDCShape HcalShapes::theZDCShape
private

Definition at line 40 of file HcalShapes.h.

Referenced by HcalShapes().