CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes

CaloCellManager Class Reference

#include <CaloCellManager.h>

List of all members.

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().

                                                               :
  verbosity(theVerbosity)
{

  //initialize constants

  init();

  // build the calo cells identifiers

  builder();

}
CaloCellManager::~CaloCellManager ( ) [virtual]

Definition at line 31 of file CaloCellManager.cc.

References i, and theCellCollection.

                                 {

  for (unsigned int i = 0; i < theCellCollection.size(); i++) {
    delete theCellCollection[i];
  }

}

Member Function Documentation

void CaloCellManager::builder ( ) [private]

Definition at line 110 of file CaloCellManager.cc.

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

Referenced by CaloCellManager().

                             {

  theCellCollection.reserve(nCaloCell);

  // Barrel

  CaloCellId::System theSys = CaloCellId::Barrel;

  for (unsigned int iphi = 0; iphi < nBarrelPhi; iphi++) {
    for (unsigned int ieta = 0; ieta < nBarrelEta; ieta++) {
      CaloCellId* thisCell = new CaloCellId(etaLim[ieta],etaLim[ieta+1],phiLimBar[iphi],phiLimBar[iphi+1],theSys);
      theCellCollection.push_back(thisCell);
    }
    for (unsigned int ieta = 0; ieta < nBarrelEta; ieta++) {
      CaloCellId* thisCell = new CaloCellId(-1.*etaLim[ieta+1],-1.*etaLim[ieta],phiLimBar[iphi],phiLimBar[iphi+1],theSys);
      theCellCollection.push_back(thisCell);
    }
  }

  // Endcap

  theSys = CaloCellId::Endcap;

  for (unsigned int iphi = 0; iphi < nEndcapPhi; iphi++) {
    for (unsigned int ieta = nBarrelEta; ieta < nBarrelEta+nEndcapEta; ieta++) {
      CaloCellId* thisCell = new CaloCellId(etaLim[ieta],etaLim[ieta+1],phiLimEnd[iphi],phiLimEnd[iphi+1],theSys);
      theCellCollection.push_back(thisCell);
    }
    for (unsigned int ieta = nBarrelEta; ieta < nBarrelEta+nEndcapEta; ieta++) {
      CaloCellId* thisCell = new CaloCellId(-1.*etaLim[ieta+1],-1.*etaLim[ieta],phiLimEnd[iphi],phiLimEnd[iphi+1],theSys);
      theCellCollection.push_back(thisCell);
    }
  }
  
  // Forward

  theSys = CaloCellId::Forward;

  for (unsigned int iphi = 0; iphi < nForwardPhi; iphi++) {
    for (unsigned int ieta = nBarrelEta+nEndcapEta; ieta < nBarrelEta+nEndcapEta+nForwardEta; ieta++) {
      CaloCellId* thisCell = new CaloCellId(etaLim[ieta],etaLim[ieta+1],phiLimFor[iphi],phiLimFor[iphi+1],theSys);
      theCellCollection.push_back(thisCell);
    }
    for (unsigned int ieta = nBarrelEta+nEndcapEta; ieta < nBarrelEta+nEndcapEta+nForwardEta; ieta++) {
      CaloCellId* thisCell = new CaloCellId(-1.*etaLim[ieta+1],-1.*etaLim[ieta],phiLimFor[iphi],phiLimFor[iphi+1],theSys);
      theCellCollection.push_back(thisCell);
    }
  }

  if ( verbosity > 0 ) {
    std::cout << "Number of cells = " << nCaloCell << std::endl;
    for (unsigned int i = 0; i < theCellCollection.size(); i++) {
      std::cout << "Cell # " << std::setfill(' ') << std::setw(4) << i << " = " << *(theCellCollection[i]) << std::endl;
    }
  }

}
CaloCellId * CaloCellManager::getCellFromIndex ( unsigned int  id)

Definition at line 178 of file CaloCellManager.cc.

References errorMatrix2Lands_multiChannel::id, NULL, and theCellCollection.

Referenced by MBUEandQCDValidation::analyze().

                                                            {

  if ( id < theCellCollection.size() ) { return theCellCollection[id]; }
  return NULL; 

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

Definition at line 168 of file CaloCellManager.cc.

References i, and theCellCollection.

Referenced by MBUEandQCDValidation::analyze().

                                                                         {

  unsigned int theIndex = 1000000;
  for ( unsigned int i = 0; i < theCellCollection.size(); i++) {
    if ( theCellCollection[i]->isInCell(eta, phi) ) { theIndex = i; continue; }
  }
  return theIndex;

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

Definition at line 185 of file CaloCellManager.cc.

References etaLim.

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

                                               {

  std::vector<double> theEtaRanges(etaLim); 
  return theEtaRanges;

}
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().

                          {

  etaLim.reserve(nBarrelEta+nEndcapEta+nForwardEta+1);
  phiLimBar.reserve(nBarrelEta+1);
  phiLimEnd.reserve(nEndcapEta+1);
  phiLimFor.reserve(nForwardEta+1);

  // Barrel ranges

  double firstEta = 0.;
  double etaBarrelBin = 0.087;
  for (unsigned int ietabin = 0; ietabin <= nBarrelEta; ietabin++) {
    etaLim.push_back(firstEta+ietabin*etaBarrelBin);
  }

  double firstPhi = -180.;
  double phiBarrelBin = (double)360/nBarrelPhi;
  for (unsigned int iphibin = 0; iphibin <= nBarrelPhi; iphibin++) {
    phiLimBar.push_back((firstPhi+iphibin*phiBarrelBin)*CLHEP::degree);
  }

  // Endcap ranges (compromise wrt real CMS)

  firstEta = etaBarrelBin*nBarrelEta;
  double etaEndcapBin = 0.131;
  for (unsigned int ietabin = 1; ietabin <= nEndcapEta; ietabin++) {
    etaLim.push_back(firstEta+ietabin*etaEndcapBin);
  }
  double phiEndcapBin = (double)360/nEndcapPhi;
  for (unsigned int iphibin = 0; iphibin <= nEndcapPhi; iphibin++) {
    phiLimEnd.push_back((firstPhi+iphibin*phiEndcapBin)*CLHEP::degree);
  }
  
  // Forward ranges (compromise wrt real CMS)

  etaLim.push_back(3.139);
  etaLim.push_back(3.314);
  etaLim.push_back(3.489);
  etaLim.push_back(3.664);
  etaLim.push_back(3.839);
  etaLim.push_back(4.013);
  etaLim.push_back(4.191);
  etaLim.push_back(4.363);
  etaLim.push_back(4.538);
  etaLim.push_back(4.716);
  etaLim.push_back(4.889);
  etaLim.push_back(5.191);

  double phiForwardBin = (double)360/nForwardPhi;
  for (unsigned int iphibin = 0; iphibin <= nForwardPhi; iphibin++) {
    phiLimFor.push_back((firstPhi+iphibin*phiForwardBin)*CLHEP::degree);
  }

  if ( verbosity > 0 ) {
    std::cout << "Number of eta ranges = " << nBarrelEta+nEndcapEta+nForwardEta << std::endl;
    for (unsigned int i = 0; i < etaLim.size(); i++) {
      std::cout << "Eta range limit # " << i << " = " << etaLim[i] << std::endl;
    }
    for (unsigned int i = 0; i < phiLimBar.size(); i++) {
      std::cout << "Phi barrel range limit # " << i << " = " << phiLimBar[i] << std::endl;
    }
    for (unsigned int i = 0; i < phiLimEnd.size(); i++) {
      std::cout << "Phi endcap range limit # " << i << " = " << phiLimEnd[i] << std::endl;
    }
    for (unsigned int i = 0; i < phiLimFor.size(); i++) {
      std::cout << "Phi forward range limit # " << i << " = " << phiLimFor[i] << std::endl;
    }
  }

}

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::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().

unsigned int CaloCellManager::verbosity [private]

Definition at line 51 of file CaloCellManager.h.

Referenced by builder(), and init().