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, HE2018 =206, 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 
HE2018 
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  205 - SiPMs from Data (HE data 2017)
24  206 - SiPMs Hamamatsu shape (HE 2018)
25  207 - SiPMs from Data (HE 2017)
26  301 - regular HF PMT shape
27  401 - regular ZDC shape
28  */
29 
30  std::vector<int> theHcalShapeNums = {101,102,103,104,105,123,124,125,201,202,203,205,206,207,301};
31  // use resize so vector won't invalidate pointers by reallocating memory while filling
32  theHcalShapes.resize(theHcalShapeNums.size());
33  for(unsigned inum = 0; inum < theHcalShapeNums.size(); ++inum){
34  int num = theHcalShapeNums[inum];
35  theHcalShapes[inum].setShape(num);
38  }
39 
40  // ZDC not yet defined in CalibCalorimetry/HcalAlgos/src/HcalPulseShapes.cc
43 }
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 46 of file HcalShapes.cc.

References theMCParams, theShapes, and theTopology.

47 {
48  for(auto& shapeItr : theShapes)
49  {
50  delete shapeItr.second;
51  }
52  theShapes.clear();
53  if (theMCParams!=nullptr) delete theMCParams;
54  if (theTopology!=nullptr) delete theTopology;
55 }
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 58 of file HcalShapes.cc.

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

Referenced by HcalDigitizer::beginRun().

59 {
61  es.get<HcalMCParamsRcd>().get(p);
62  theMCParams = new HcalMCParams(*p.product());
63 
64 // here we are making a _copy_ so we need to add a copy of the topology...
65 
67  es.get<HcalRecNumberingRecord>().get(htopo);
68  theTopology=new HcalTopology(*htopo);
70 }
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 99 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().

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

Definition at line 73 of file HcalShapes.cc.

References theMCParams, and theTopology.

Referenced by HcalDigitizer::endRun().

74 {
75  if (theMCParams) delete theMCParams;
76  theMCParams = nullptr;
77  if (theTopology) delete theTopology;
78  theTopology = nullptr;
79 }
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 118 of file HcalShapes.cc.

References theShapes, and theShapesPrecise.

Referenced by defaultShape(), and shape().

118  {
120 }
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 82 of file HcalShapes.cc.

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

83 {
84  if(!theMCParams) {
85  return defaultShape(detId);
86  }
87  int shapeType = theMCParams->getValues(detId)->signalShape();
88  const auto& myShapes = getShapeMap(precise);
89  auto shapeMapItr = myShapes.find(shapeType);
90  if(shapeMapItr == myShapes.end()) {
91  edm::LogWarning("HcalShapes") << "HcalShapes::shape - shapeType ? = "
92  << shapeType << std::endl;
93  return defaultShape(detId,precise);
94  } else {
95  return shapeMapItr->second;
96  }
97 }
const Item * getValues(DetId fId, bool throwOnFail=true) const
const CaloVShape * defaultShape(const DetId &detId, bool precise=false) const
Definition: HcalShapes.cc:99
const ShapeMap & getShapeMap(bool precise) const
Definition: HcalShapes.cc:118
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().