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

◆ ShapeMap

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

Definition at line 29 of file HcalShapes.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
HPD 
LONG 
ZECOTEK 
HAMAMATSU 
HE2017 
HE2018 
HF 
ZDC 

Definition at line 20 of file HcalShapes.h.

20 { HPD = 101, LONG = 102, ZECOTEK = 201, HAMAMATSU = 202, HE2017 = 203, HE2018 = 206, HF = 301, ZDC = 401 };

Constructor & Destructor Documentation

◆ HcalShapes()

HcalShapes::HcalShapes ( )

Definition at line 12 of file HcalShapes.cc.

12  : theDbService(nullptr) {
13  /*
14  00 - not used (reserved)
15  101 - regular HPD HB/HE/HO shape
16  102 - "special" HB HPD#14 long shape
17  201 - SiPMs Zecotec shape (HO)
18  202 - SiPMs Hamamatsu shape (HO)
19  203 - SiPMs Hamamatsu shape (HE 2017)
20  205 - SiPMs from Data (HE data 2017)
21  206 - SiPMs Hamamatsu shape (HE 2018)
22  207 - SiPMs from Data (HE 2017)
23  208 - SiPMs from Data, 2021 MC phase scan
24  301 - regular HF PMT shape
25  401 - regular ZDC shape
26  */
27 
28  std::vector<int> theHcalShapeNums = {101, 102, 103, 104, 105, 123, 124, 125, 201, 202, 203, 205, 206, 207, 208, 301};
29  // use resize so vector won't invalidate pointers by reallocating memory while filling
30  theHcalShapes.resize(theHcalShapeNums.size());
31  for (unsigned inum = 0; inum < theHcalShapeNums.size(); ++inum) {
32  int num = theHcalShapeNums[inum];
33  theHcalShapes[inum].setShape(num);
36  }
37 
38  // ZDC not yet defined in CalibCalorimetry/HcalAlgos/src/HcalPulseShapes.cc
41 }

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

◆ ~HcalShapes()

HcalShapes::~HcalShapes ( )
override

Definition at line 43 of file HcalShapes.cc.

43  {
44  for (auto& shapeItr : theShapes) {
45  delete shapeItr.second;
46  }
47  theShapes.clear();
48 }

References theShapes.

Member Function Documentation

◆ defaultShape()

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

Definition at line 65 of file HcalShapes.cc.

65  {
66  // try to figure the appropriate shape
67  const CaloVShape* result;
68  const auto& myShapes = getShapeMap(precise);
71  result = myShapes.find(HPD)->second;
72  else if (subdet == HcalGenericDetId::HcalGenOuter)
73  result = myShapes.find(HPD)->second;
74  else if (subdet == HcalGenericDetId::HcalGenForward)
75  result = myShapes.find(HF)->second;
76  else if (subdet == HcalGenericDetId::HcalGenZDC)
77  result = myShapes.find(ZDC)->second;
78  else
79  result = nullptr;
80 
81  edm::LogWarning("HcalShapes") << "Cannot find HCAL MC Params, so the default one is taken for subdet " << subdet;
82 
83  return result;
84 }

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

Referenced by shape().

◆ getShapeMap()

const HcalShapes::ShapeMap & HcalShapes::getShapeMap ( bool  precise) const
private

Definition at line 86 of file HcalShapes.cc.

86  {
88 }

References hltPixelTracks_cff::precise, theShapes, and theShapesPrecise.

Referenced by defaultShape(), and shape().

◆ setDbService()

void HcalShapes::setDbService ( const HcalDbService service)
inline

Definition at line 24 of file HcalShapes.h.

24 { theDbService = service; }

References theDbService.

Referenced by HcalDigitizer::initializeEvent().

◆ shape()

const CaloVShape * HcalShapes::shape ( const DetId detId,
bool  precise = false 
) const
overridevirtual

Reimplemented from CaloShapes.

Definition at line 50 of file HcalShapes.cc.

50  {
51  if (!theDbService) {
52  return defaultShape(detId);
53  }
54  int shapeType = theDbService->getHcalMCParam(detId)->signalShape();
55  const auto& myShapes = getShapeMap(precise);
56  auto shapeMapItr = myShapes.find(shapeType);
57  if (shapeMapItr == myShapes.end()) {
58  edm::LogWarning("HcalShapes") << "HcalShapes::shape - shapeType ? = " << shapeType << std::endl;
59  return defaultShape(detId, precise);
60  } else {
61  return shapeMapItr->second;
62  }
63 }

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

Member Data Documentation

◆ theDbService

const HcalDbService* HcalShapes::theDbService
private

Definition at line 33 of file HcalShapes.h.

Referenced by setDbService(), and shape().

◆ theHcalShapes

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

Definition at line 38 of file HcalShapes.h.

Referenced by HcalShapes().

◆ theShapes

ShapeMap HcalShapes::theShapes
private

Definition at line 34 of file HcalShapes.h.

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

◆ theShapesPrecise

ShapeMap HcalShapes::theShapesPrecise
private

Definition at line 35 of file HcalShapes.h.

Referenced by getShapeMap(), and HcalShapes().

◆ theZDCShape

ZDCShape HcalShapes::theZDCShape
private

Definition at line 36 of file HcalShapes.h.

Referenced by HcalShapes().

service
Definition: service.py:1
HcalShapes::getShapeMap
const ShapeMap & getShapeMap(bool precise) const
Definition: HcalShapes.cc:86
HcalShapes::HE2017
Definition: HcalShapes.h:20
hltPixelTracks_cff.precise
precise
Definition: hltPixelTracks_cff.py:32
HcalGenericDetId
Definition: HcalGenericDetId.h:15
HcalShapes::theShapesPrecise
ShapeMap theShapesPrecise
Definition: HcalShapes.h:35
HcalGenericDetId::HcalGenEndcap
Definition: HcalGenericDetId.h:20
HcalShapes::theZDCShape
ZDCShape theZDCShape
Definition: HcalShapes.h:36
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
HcalShapes::theDbService
const HcalDbService * theDbService
Definition: HcalShapes.h:33
HcalDbService::getHcalMCParam
const HcalMCParam * getHcalMCParam(const HcalGenericDetId &fId) const
Definition: HcalDbService.cc:399
HcalGenericDetId::HcalGenZDC
Definition: HcalGenericDetId.h:24
HcalShapes::theShapes
ShapeMap theShapes
Definition: HcalShapes.h:34
HcalShapes::defaultShape
const CaloVShape * defaultShape(const DetId &detId, bool precise=false) const
Definition: HcalShapes.cc:65
HcalShapes::HPD
Definition: HcalShapes.h:20
CaloCachedShapeIntegrator
Definition: CaloCachedShapeIntegrator.h:12
HcalShapes::HF
Definition: HcalShapes.h:20
HcalShapes::HE2018
Definition: HcalShapes.h:20
HcalShapes::theHcalShapes
std::vector< HcalShape > theHcalShapes
Definition: HcalShapes.h:38
HcalGenericDetId::HcalGenericSubdetector
HcalGenericSubdetector
Definition: HcalGenericDetId.h:17
HcalShapes::LONG
Definition: HcalShapes.h:20
HcalGenericDetId::HcalGenBarrel
Definition: HcalGenericDetId.h:19
CaloVShape
Electronic response of the preamp.
Definition: CaloVShape.h:11
EgammaValidation_cff.num
num
Definition: EgammaValidation_cff.py:34
HcalMCParam::signalShape
unsigned int signalShape() const
Definition: HcalMCParam.h:38
HcalShapes::HAMAMATSU
Definition: HcalShapes.h:20
HcalGenericDetId::genericSubdet
HcalGenericSubdetector genericSubdet() const
Definition: HcalGenericDetId.cc:21
HcalShapes::ZECOTEK
Definition: HcalShapes.h:20
HcalGenericDetId::HcalGenOuter
Definition: HcalGenericDetId.h:21
mps_fire.result
result
Definition: mps_fire.py:311
HcalShapes::ZDC
Definition: HcalShapes.h:20
HcalGenericDetId::HcalGenForward
Definition: HcalGenericDetId.h:22