CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 17 of file CaloCellManager.h.

Member Typedef Documentation

Definition at line 21 of file CaloCellManager.h.

Constructor & Destructor Documentation

CaloCellManager::CaloCellManager ( unsigned int  theVerbosity)

Definition at line 17 of file CaloCellManager.cc.

References builder(), and init().

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

Definition at line 31 of file CaloCellManager.cc.

References i, and theCellCollection.

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

Member Function Documentation

void CaloCellManager::builder ( )
private

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

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

Definition at line 178 of file CaloCellManager.cc.

References NULL, and theCellCollection.

Referenced by MBUEandQCDValidation::analyze().

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

Definition at line 168 of file CaloCellManager.cc.

References i, and theCellCollection.

Referenced by MBUEandQCDValidation::analyze().

168  {
169 
170  unsigned int theIndex = 1000000;
171  for ( unsigned int i = 0; i < theCellCollection.size(); i++) {
172  if ( theCellCollection[i]->isInCell(eta, phi) ) { theIndex = i; continue; }
173  }
174  return theIndex;
175 
176 }
int i
Definition: DBlmapReader.cc:9
T eta() const
CaloCellCollection theCellCollection
Definition: DDAxes.h:10
std::vector< double > CaloCellManager::getEtaRanges ( )

Definition at line 185 of file CaloCellManager.cc.

References etaLim.

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

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

Definition at line 39 of file CaloCellManager.cc.

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

Referenced by CaloCellManager().

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

Member Data Documentation

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

Definition at line 53 of file CaloCellManager.h.

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

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

Definition at line 40 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 36 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 41 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 37 of file CaloCellManager.h.

Referenced by builder(), and init().

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

Definition at line 42 of file CaloCellManager.h.

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

Definition at line 38 of file CaloCellManager.h.

Referenced by builder(), and init().

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

Definition at line 54 of file CaloCellManager.h.

Referenced by builder(), and init().

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

Definition at line 55 of file CaloCellManager.h.

Referenced by builder(), and init().

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

Definition at line 56 of file CaloCellManager.h.

Referenced by builder(), and init().

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

Definition at line 51 of file CaloCellManager.h.

Referenced by builder(), and init().