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

Definition at line 19 of file CaloCellManager.h.

Constructor & Destructor Documentation

CaloCellManager::CaloCellManager ( unsigned int  theVerbosity)

Definition at line 15 of file CaloCellManager.cc.

References builder(), and init().

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

Definition at line 29 of file CaloCellManager.cc.

References i, and theCellCollection.

29  {
30 
31  for (unsigned int i = 0; i < theCellCollection.size(); i++) {
32  delete theCellCollection[i];
33  }
34 
35 }
int i
Definition: DBlmapReader.cc:9
CaloCellCollection theCellCollection

Member Function Documentation

void CaloCellManager::builder ( )
private

Definition at line 108 of file CaloCellManager.cc.

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

Referenced by CaloCellManager().

108  {
109 
110  theCellCollection.reserve(nCaloCell);
111 
112  // Barrel
113 
115 
116  for (unsigned int iphi = 0; iphi < nBarrelPhi; iphi++) {
117  for (unsigned int ieta = 0; ieta < nBarrelEta; ieta++) {
118  CaloCellId* thisCell = new CaloCellId(etaLim[ieta],etaLim[ieta+1],phiLimBar[iphi],phiLimBar[iphi+1],theSys);
119  theCellCollection.push_back(thisCell);
120  }
121  for (unsigned int ieta = 0; ieta < nBarrelEta; ieta++) {
122  CaloCellId* thisCell = new CaloCellId(-1.*etaLim[ieta+1],-1.*etaLim[ieta],phiLimBar[iphi],phiLimBar[iphi+1],theSys);
123  theCellCollection.push_back(thisCell);
124  }
125  }
126 
127  // Endcap
128 
129  theSys = CaloCellId::Endcap;
130 
131  for (unsigned int iphi = 0; iphi < nEndcapPhi; iphi++) {
132  for (unsigned int ieta = nBarrelEta; ieta < nBarrelEta+nEndcapEta; ieta++) {
133  CaloCellId* thisCell = new CaloCellId(etaLim[ieta],etaLim[ieta+1],phiLimEnd[iphi],phiLimEnd[iphi+1],theSys);
134  theCellCollection.push_back(thisCell);
135  }
136  for (unsigned int ieta = nBarrelEta; ieta < nBarrelEta+nEndcapEta; ieta++) {
137  CaloCellId* thisCell = new CaloCellId(-1.*etaLim[ieta+1],-1.*etaLim[ieta],phiLimEnd[iphi],phiLimEnd[iphi+1],theSys);
138  theCellCollection.push_back(thisCell);
139  }
140  }
141 
142  // Forward
143 
144  theSys = CaloCellId::Forward;
145 
146  for (unsigned int iphi = 0; iphi < nForwardPhi; iphi++) {
147  for (unsigned int ieta = nBarrelEta+nEndcapEta; ieta < nBarrelEta+nEndcapEta+nForwardEta; ieta++) {
148  CaloCellId* thisCell = new CaloCellId(etaLim[ieta],etaLim[ieta+1],phiLimFor[iphi],phiLimFor[iphi+1],theSys);
149  theCellCollection.push_back(thisCell);
150  }
151  for (unsigned int ieta = nBarrelEta+nEndcapEta; ieta < nBarrelEta+nEndcapEta+nForwardEta; ieta++) {
152  CaloCellId* thisCell = new CaloCellId(-1.*etaLim[ieta+1],-1.*etaLim[ieta],phiLimFor[iphi],phiLimFor[iphi+1],theSys);
153  theCellCollection.push_back(thisCell);
154  }
155  }
156 
157  if ( verbosity > 0 ) {
158  std::cout << "Number of cells = " << nCaloCell << std::endl;
159  for (unsigned int i = 0; i < theCellCollection.size(); i++) {
160  std::cout << "Cell # " << std::setfill(' ') << std::setw(4) << i << " = " << *(theCellCollection[i]) << std::endl;
161  }
162  }
163 
164 }
int i
Definition: DBlmapReader.cc:9
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
CaloCellId * CaloCellManager::getCellFromIndex ( unsigned int  id)

Definition at line 176 of file CaloCellManager.cc.

References hcalTTPDigis_cfi::id, NULL, and theCellCollection.

Referenced by MBUEandQCDValidation::analyze().

176  {
177 
178  if ( id < theCellCollection.size() ) { return theCellCollection[id]; }
179  return NULL;
180 
181 }
#define NULL
Definition: scimark2.h:8
CaloCellCollection theCellCollection
unsigned int CaloCellManager::getCellIndexFromAngle ( double  eta,
double  phi 
)

Definition at line 166 of file CaloCellManager.cc.

References i, theCellCollection, and mps_update::theIndex.

Referenced by MBUEandQCDValidation::analyze().

166  {
167 
168  unsigned int theIndex = 1000000;
169  for ( unsigned int i = 0; i < theCellCollection.size(); i++) {
170  if ( theCellCollection[i]->isInCell(eta, phi) ) { theIndex = i; continue; }
171  }
172  return theIndex;
173 
174 }
int i
Definition: DBlmapReader.cc:9
int theIndex
Definition: mps_update.py:66
CaloCellCollection theCellCollection
std::vector< double > CaloCellManager::getEtaRanges ( )

Definition at line 183 of file CaloCellManager.cc.

References etaLim.

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

183  {
184 
185  std::vector<double> theEtaRanges(etaLim);
186  return theEtaRanges;
187 
188 }
std::vector< double > etaLim
void CaloCellManager::init ( void  )
private

Definition at line 37 of file CaloCellManager.cc.

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

Referenced by CaloCellManager().

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

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

Definition at line 51 of file CaloCellManager.h.

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

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

Definition at line 38 of file CaloCellManager.h.

Referenced by MBUEandQCDValidation::analyze().

const unsigned int CaloCellManager::nBarrelEta = 16
static
const unsigned int CaloCellManager::nBarrelPhi = 72
static

Definition at line 34 of file CaloCellManager.h.

Referenced by builder(), and init().

const unsigned int CaloCellManager::nCaloCell = nBarrelCell+nEndcapCell+nForwardCell
static
const unsigned int CaloCellManager::nEndcapCell = 2*nEndcapEta*nEndcapPhi
static

Definition at line 39 of file CaloCellManager.h.

Referenced by MBUEandQCDValidation::analyze().

const unsigned int CaloCellManager::nEndcapEta = 12
static
const unsigned int CaloCellManager::nEndcapPhi = 36
static

Definition at line 35 of file CaloCellManager.h.

Referenced by builder(), and init().

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

Definition at line 40 of file CaloCellManager.h.

const unsigned int CaloCellManager::nForwardEta = 12
static
const unsigned int CaloCellManager::nForwardPhi = 36
static

Definition at line 36 of file CaloCellManager.h.

Referenced by builder(), and init().

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

Definition at line 52 of file CaloCellManager.h.

Referenced by builder(), and init().

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

Definition at line 53 of file CaloCellManager.h.

Referenced by builder(), and init().

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

Definition at line 54 of file CaloCellManager.h.

Referenced by builder(), and init().

CaloCellCollection CaloCellManager::theCellCollection
private
unsigned int CaloCellManager::verbosity
private

Definition at line 49 of file CaloCellManager.h.

Referenced by builder(), and init().