CMS 3D CMS Logo

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

#include <CaloCellManager.h>

Public Types

typedef std::vector< CaloCellId * > CaloCellCollection
 

Public Member Functions

 CaloCellManager (unsigned int theVerbosity)
 
CaloCellIdgetCellFromIndex (unsigned int id)
 
unsigned int getCellIndexFromAngle (double eta, double phi)
 
std::vector< double > getEtaRanges ()
 
virtual ~CaloCellManager ()
 

Static Public Attributes

static const unsigned int nBarrelCell = 2 * nBarrelEta * nBarrelPhi
 
static const unsigned int nBarrelEta = 16
 
static const unsigned int nBarrelPhi = 72
 
static const unsigned int nCaloCell = nBarrelCell + nEndcapCell + nForwardCell
 
static const unsigned int nEndcapCell = 2 * nEndcapEta * nEndcapPhi
 
static const unsigned int nEndcapEta = 12
 
static const unsigned int nEndcapPhi = 36
 
static const unsigned int nForwardCell = 2 * nForwardEta * nForwardPhi
 
static const unsigned int nForwardEta = 12
 
static const unsigned int nForwardPhi = 36
 

Private Member Functions

void builder ()
 
void init ()
 

Private Attributes

std::vector< double > etaLim
 
std::vector< double > phiLimBar
 
std::vector< double > phiLimEnd
 
std::vector< double > phiLimFor
 
CaloCellCollection theCellCollection
 
unsigned int verbosity
 

Detailed Description

Definition at line 15 of file CaloCellManager.h.

Member Typedef Documentation

◆ CaloCellCollection

Definition at line 17 of file CaloCellManager.h.

Constructor & Destructor Documentation

◆ CaloCellManager()

CaloCellManager::CaloCellManager ( unsigned int  theVerbosity)

Definition at line 15 of file CaloCellManager.cc.

References builder(), and init().

15  : verbosity(theVerbosity) {
16  //initialize constants
17 
18  init();
19 
20  // build the calo cells identifiers
21 
22  builder();
23 }
unsigned int verbosity

◆ ~CaloCellManager()

CaloCellManager::~CaloCellManager ( )
virtual

Definition at line 25 of file CaloCellManager.cc.

References mps_fire::i, and theCellCollection.

25  {
26  for (unsigned int i = 0; i < theCellCollection.size(); i++) {
27  delete theCellCollection[i];
28  }
29 }
CaloCellCollection theCellCollection

Member Function Documentation

◆ builder()

void CaloCellManager::builder ( )
private

Definition at line 100 of file CaloCellManager.cc.

References CaloCellId::Barrel, gather_cfg::cout, CaloCellId::Endcap, etaLim, CaloCellId::Forward, mps_fire::i, LEDCalibrationChannels::ieta, LEDCalibrationChannels::iphi, nBarrelEta, nBarrelPhi, nCaloCell, nEndcapEta, nEndcapPhi, nForwardEta, nForwardPhi, phiLimBar, phiLimEnd, phiLimFor, theCellCollection, and verbosity.

Referenced by CaloCellManager().

100  {
101  theCellCollection.reserve(nCaloCell);
102 
103  // Barrel
104 
106 
107  for (unsigned int iphi = 0; iphi < nBarrelPhi; iphi++) {
108  for (unsigned int ieta = 0; ieta < nBarrelEta; ieta++) {
109  CaloCellId* thisCell =
110  new CaloCellId(etaLim[ieta], etaLim[ieta + 1], phiLimBar[iphi], phiLimBar[iphi + 1], theSys);
111  theCellCollection.push_back(thisCell);
112  }
113  for (unsigned int ieta = 0; ieta < nBarrelEta; ieta++) {
114  CaloCellId* thisCell =
115  new CaloCellId(-1. * etaLim[ieta + 1], -1. * etaLim[ieta], phiLimBar[iphi], phiLimBar[iphi + 1], theSys);
116  theCellCollection.push_back(thisCell);
117  }
118  }
119 
120  // Endcap
121 
122  theSys = CaloCellId::Endcap;
123 
124  for (unsigned int iphi = 0; iphi < nEndcapPhi; iphi++) {
125  for (unsigned int ieta = nBarrelEta; ieta < nBarrelEta + nEndcapEta; ieta++) {
126  CaloCellId* thisCell =
127  new CaloCellId(etaLim[ieta], etaLim[ieta + 1], phiLimEnd[iphi], phiLimEnd[iphi + 1], theSys);
128  theCellCollection.push_back(thisCell);
129  }
130  for (unsigned int ieta = nBarrelEta; ieta < nBarrelEta + nEndcapEta; ieta++) {
131  CaloCellId* thisCell =
132  new CaloCellId(-1. * etaLim[ieta + 1], -1. * etaLim[ieta], phiLimEnd[iphi], phiLimEnd[iphi + 1], theSys);
133  theCellCollection.push_back(thisCell);
134  }
135  }
136 
137  // Forward
138 
139  theSys = CaloCellId::Forward;
140 
141  for (unsigned int iphi = 0; iphi < nForwardPhi; iphi++) {
142  for (unsigned int ieta = nBarrelEta + nEndcapEta; ieta < nBarrelEta + nEndcapEta + nForwardEta; ieta++) {
143  CaloCellId* thisCell =
144  new CaloCellId(etaLim[ieta], etaLim[ieta + 1], phiLimFor[iphi], phiLimFor[iphi + 1], theSys);
145  theCellCollection.push_back(thisCell);
146  }
147  for (unsigned int ieta = nBarrelEta + nEndcapEta; ieta < nBarrelEta + nEndcapEta + nForwardEta; ieta++) {
148  CaloCellId* thisCell =
149  new CaloCellId(-1. * etaLim[ieta + 1], -1. * etaLim[ieta], phiLimFor[iphi], phiLimFor[iphi + 1], theSys);
150  theCellCollection.push_back(thisCell);
151  }
152  }
153 
154  if (verbosity > 0) {
155  std::cout << "Number of cells = " << nCaloCell << std::endl;
156  for (unsigned int i = 0; i < theCellCollection.size(); i++) {
157  std::cout << "Cell # " << std::setfill(' ') << std::setw(4) << i << " = " << *(theCellCollection[i]) << std::endl;
158  }
159  }
160 }
static const unsigned int nForwardPhi
static const unsigned int nForwardEta
std::vector< double > etaLim
static const unsigned int nEndcapEta
unsigned int verbosity
std::vector< double > phiLimBar
static const unsigned int nCaloCell
std::vector< double > phiLimFor
static const unsigned int nBarrelEta
CaloCellCollection theCellCollection
std::vector< double > phiLimEnd
static const unsigned int nBarrelPhi
static const unsigned int nEndcapPhi

◆ getCellFromIndex()

CaloCellId * CaloCellManager::getCellFromIndex ( unsigned int  id)

Definition at line 173 of file CaloCellManager.cc.

References triggerObjects_cff::id, and theCellCollection.

Referenced by MBUEandQCDValidation::analyze().

173  {
174  if (id < theCellCollection.size()) {
175  return theCellCollection[id];
176  }
177  return nullptr;
178 }
CaloCellCollection theCellCollection

◆ getCellIndexFromAngle()

unsigned int CaloCellManager::getCellIndexFromAngle ( double  eta,
double  phi 
)

Definition at line 162 of file CaloCellManager.cc.

References PVValHelper::eta, mps_fire::i, phi, and theCellCollection.

Referenced by MBUEandQCDValidation::analyze().

162  {
163  unsigned int theIndex = 1000000;
164  for (unsigned int i = 0; i < theCellCollection.size(); i++) {
165  if (theCellCollection[i]->isInCell(eta, phi)) {
166  theIndex = i;
167  continue;
168  }
169  }
170  return theIndex;
171 }
CaloCellCollection theCellCollection

◆ getEtaRanges()

std::vector< double > CaloCellManager::getEtaRanges ( )

Definition at line 180 of file CaloCellManager.cc.

References etaLim.

Referenced by MBUEandQCDValidation::analyze(), and MBUEandQCDValidation::getHFbin().

180  {
181  std::vector<double> theEtaRanges(etaLim);
182  return theEtaRanges;
183 }
std::vector< double > etaLim

◆ init()

void CaloCellManager::init ( void  )
private

Definition at line 31 of file CaloCellManager.cc.

References gather_cfg::cout, etaLim, mps_fire::i, nBarrelEta, nBarrelPhi, nEndcapEta, nEndcapPhi, nForwardEta, nForwardPhi, phiLimBar, phiLimEnd, phiLimFor, and verbosity.

Referenced by CaloCellManager().

31  {
32  etaLim.reserve(nBarrelEta + nEndcapEta + nForwardEta + 1);
33  phiLimBar.reserve(nBarrelEta + 1);
34  phiLimEnd.reserve(nEndcapEta + 1);
35  phiLimFor.reserve(nForwardEta + 1);
36 
37  // Barrel ranges
38 
39  double firstEta = 0.;
40  double etaBarrelBin = 0.087;
41  for (unsigned int ietabin = 0; ietabin <= nBarrelEta; ietabin++) {
42  etaLim.push_back(firstEta + ietabin * etaBarrelBin);
43  }
44 
45  double firstPhi = -180.;
46  double phiBarrelBin = (double)360 / nBarrelPhi;
47  for (unsigned int iphibin = 0; iphibin <= nBarrelPhi; iphibin++) {
48  phiLimBar.push_back((firstPhi + iphibin * phiBarrelBin) * CLHEP::degree);
49  }
50 
51  // Endcap ranges (compromise wrt real CMS)
52 
53  firstEta = etaBarrelBin * nBarrelEta;
54  double etaEndcapBin = 0.131;
55  for (unsigned int ietabin = 1; ietabin <= nEndcapEta; ietabin++) {
56  etaLim.push_back(firstEta + ietabin * etaEndcapBin);
57  }
58  double phiEndcapBin = (double)360 / nEndcapPhi;
59  for (unsigned int iphibin = 0; iphibin <= nEndcapPhi; iphibin++) {
60  phiLimEnd.push_back((firstPhi + iphibin * phiEndcapBin) * CLHEP::degree);
61  }
62 
63  // Forward ranges (compromise wrt real CMS)
64 
65  etaLim.push_back(3.139);
66  etaLim.push_back(3.314);
67  etaLim.push_back(3.489);
68  etaLim.push_back(3.664);
69  etaLim.push_back(3.839);
70  etaLim.push_back(4.013);
71  etaLim.push_back(4.191);
72  etaLim.push_back(4.363);
73  etaLim.push_back(4.538);
74  etaLim.push_back(4.716);
75  etaLim.push_back(4.889);
76  etaLim.push_back(5.191);
77 
78  double phiForwardBin = (double)360 / nForwardPhi;
79  for (unsigned int iphibin = 0; iphibin <= nForwardPhi; iphibin++) {
80  phiLimFor.push_back((firstPhi + iphibin * phiForwardBin) * CLHEP::degree);
81  }
82 
83  if (verbosity > 0) {
84  std::cout << "Number of eta ranges = " << nBarrelEta + nEndcapEta + nForwardEta << std::endl;
85  for (unsigned int i = 0; i < etaLim.size(); i++) {
86  std::cout << "Eta range limit # " << i << " = " << etaLim[i] << std::endl;
87  }
88  for (unsigned int i = 0; i < phiLimBar.size(); i++) {
89  std::cout << "Phi barrel range limit # " << i << " = " << phiLimBar[i] << std::endl;
90  }
91  for (unsigned int i = 0; i < phiLimEnd.size(); i++) {
92  std::cout << "Phi endcap range limit # " << i << " = " << phiLimEnd[i] << std::endl;
93  }
94  for (unsigned int i = 0; i < phiLimFor.size(); i++) {
95  std::cout << "Phi forward range limit # " << i << " = " << phiLimFor[i] << std::endl;
96  }
97  }
98 }
static const unsigned int nForwardPhi
static const unsigned int nForwardEta
std::vector< double > etaLim
static const unsigned int nEndcapEta
unsigned int verbosity
std::vector< double > phiLimBar
std::vector< double > phiLimFor
static const unsigned int nBarrelEta
std::vector< double > phiLimEnd
static const unsigned int nBarrelPhi
static const unsigned int nEndcapPhi

Member Data Documentation

◆ etaLim

std::vector<double> CaloCellManager::etaLim
private

Definition at line 48 of file CaloCellManager.h.

Referenced by builder(), getEtaRanges(), and init().

◆ nBarrelCell

const unsigned int CaloCellManager::nBarrelCell = 2 * nBarrelEta * nBarrelPhi
static

Definition at line 36 of file CaloCellManager.h.

Referenced by MBUEandQCDValidation::analyze().

◆ nBarrelEta

const unsigned int CaloCellManager::nBarrelEta = 16
static

◆ nBarrelPhi

const unsigned int CaloCellManager::nBarrelPhi = 72
static

Definition at line 32 of file CaloCellManager.h.

Referenced by builder(), and init().

◆ nCaloCell

const unsigned int CaloCellManager::nCaloCell = nBarrelCell + nEndcapCell + nForwardCell
static

◆ nEndcapCell

const unsigned int CaloCellManager::nEndcapCell = 2 * nEndcapEta * nEndcapPhi
static

Definition at line 37 of file CaloCellManager.h.

Referenced by MBUEandQCDValidation::analyze().

◆ nEndcapEta

const unsigned int CaloCellManager::nEndcapEta = 12
static

◆ nEndcapPhi

const unsigned int CaloCellManager::nEndcapPhi = 36
static

Definition at line 33 of file CaloCellManager.h.

Referenced by builder(), and init().

◆ nForwardCell

const unsigned int CaloCellManager::nForwardCell = 2 * nForwardEta * nForwardPhi
static

Definition at line 38 of file CaloCellManager.h.

◆ nForwardEta

const unsigned int CaloCellManager::nForwardEta = 12
static

◆ nForwardPhi

const unsigned int CaloCellManager::nForwardPhi = 36
static

Definition at line 34 of file CaloCellManager.h.

Referenced by builder(), and init().

◆ phiLimBar

std::vector<double> CaloCellManager::phiLimBar
private

Definition at line 49 of file CaloCellManager.h.

Referenced by builder(), and init().

◆ phiLimEnd

std::vector<double> CaloCellManager::phiLimEnd
private

Definition at line 50 of file CaloCellManager.h.

Referenced by builder(), and init().

◆ phiLimFor

std::vector<double> CaloCellManager::phiLimFor
private

Definition at line 51 of file CaloCellManager.h.

Referenced by builder(), and init().

◆ theCellCollection

CaloCellCollection CaloCellManager::theCellCollection
private

◆ verbosity

unsigned int CaloCellManager::verbosity
private

Definition at line 46 of file CaloCellManager.h.

Referenced by builder(), and init().