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

 HcalShapes ()
 
void setDbService (const HcalDbService *service)
 
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

const HcalDbServicetheDbService
 
std::vector< HcalShapetheHcalShapes
 
ShapeMap theShapes
 
ShapeMap theShapesPrecise
 
ZDCShape theZDCShape
 

Detailed Description

Definition at line 18 of file HcalShapes.h.

Member Typedef Documentation

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

Definition at line 30 of file HcalShapes.h.

Member Enumeration Documentation

anonymous enum
Enumerator
HPD 
LONG 
ZECOTEK 
HAMAMATSU 
HE2017 
HE2018 
HF 
ZDC 

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

Definition at line 45 of file HcalShapes.cc.

References theShapes.

46 {
47  for(auto& shapeItr : theShapes)
48  {
49  delete shapeItr.second;
50  }
51  theShapes.clear();
52 }
ShapeMap theShapes
Definition: HcalShapes.h:35

Member Function Documentation

const CaloVShape * HcalShapes::defaultShape ( const DetId detId,
bool  precise = false 
) const
private

Definition at line 72 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().

73 {
74  // try to figure the appropriate shape
75  const CaloVShape * result;
76  const auto& myShapes = getShapeMap(precise);
80  || subdet == HcalGenericDetId::HcalGenEndcap) result = myShapes.find(HPD)->second;
81  else if(subdet == HcalGenericDetId::HcalGenOuter) result = myShapes.find(HPD)->second;
82  else if(subdet == HcalGenericDetId::HcalGenForward) result = myShapes.find(HF)->second;
83  else if(subdet == HcalGenericDetId::HcalGenZDC) result = myShapes.find(ZDC)->second;
84  else result = nullptr;
85 
86  edm::LogWarning("HcalShapes") << "Cannot find HCAL MC Params, so the default one is taken for subdet " << subdet;
87 
88  return result;
89 }
Electronic response of the preamp.
Definition: CaloVShape.h:11
const ShapeMap & getShapeMap(bool precise) const
Definition: HcalShapes.cc:91
HcalGenericSubdetector genericSubdet() const
const HcalShapes::ShapeMap & HcalShapes::getShapeMap ( bool  precise) const
private

Definition at line 91 of file HcalShapes.cc.

References theShapes, and theShapesPrecise.

Referenced by defaultShape(), and shape().

91  {
93 }
ShapeMap theShapes
Definition: HcalShapes.h:35
ShapeMap theShapesPrecise
Definition: HcalShapes.h:36
void HcalShapes::setDbService ( const HcalDbService service)
inline

Definition at line 25 of file HcalShapes.h.

References hiDetachedQuadStep_cff::precise, shape(), and theDbService.

Referenced by HcalDigitizer::initializeEvent().

25 {theDbService = service;}
const HcalDbService * theDbService
Definition: HcalShapes.h:34
const CaloVShape * HcalShapes::shape ( const DetId detId,
bool  precise = false 
) const
overridevirtual

Reimplemented from CaloShapes.

Definition at line 55 of file HcalShapes.cc.

References defaultShape(), HcalDbService::getHcalMCParam(), getShapeMap(), HcalMCParam::signalShape(), and theDbService.

Referenced by setDbService().

56 {
57  if(!theDbService) {
58  return defaultShape(detId);
59  }
60  int shapeType = theDbService->getHcalMCParam(detId)->signalShape();
61  const auto& myShapes = getShapeMap(precise);
62  auto shapeMapItr = myShapes.find(shapeType);
63  if(shapeMapItr == myShapes.end()) {
64  edm::LogWarning("HcalShapes") << "HcalShapes::shape - shapeType ? = "
65  << shapeType << std::endl;
66  return defaultShape(detId,precise);
67  } else {
68  return shapeMapItr->second;
69  }
70 }
const CaloVShape * defaultShape(const DetId &detId, bool precise=false) const
Definition: HcalShapes.cc:72
const HcalMCParam * getHcalMCParam(const HcalGenericDetId &fId) const
const ShapeMap & getShapeMap(bool precise) const
Definition: HcalShapes.cc:91
unsigned int signalShape() const
Definition: HcalMCParam.h:40
const HcalDbService * theDbService
Definition: HcalShapes.h:34

Member Data Documentation

const HcalDbService* HcalShapes::theDbService
private

Definition at line 34 of file HcalShapes.h.

Referenced by setDbService(), and shape().

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

Definition at line 39 of file HcalShapes.h.

Referenced by HcalShapes().

ShapeMap HcalShapes::theShapes
private

Definition at line 35 of file HcalShapes.h.

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

ShapeMap HcalShapes::theShapesPrecise
private

Definition at line 36 of file HcalShapes.h.

Referenced by getShapeMap(), and HcalShapes().

ZDCShape HcalShapes::theZDCShape
private

Definition at line 37 of file HcalShapes.h.

Referenced by HcalShapes().