#include <HcalDDDGeometry.h>
Public Member Functions | |
virtual DetId | getClosestCell (const GlobalPoint &r) const |
virtual const std::vector < DetId > & | getValidDetIds (DetId::Detector det=DetId::Detector(0), int subdet=0) const |
Get a list of valid detector ids (for the given subdetector) | |
HcalDDDGeometry () | |
int | insertCell (std::vector< HcalCellType > const &) |
virtual | ~HcalDDDGeometry () |
The HcalDDDGeometry will delete all its cell geometries at destruction time. | |
Private Attributes | |
double | deg |
double | etaMax_ |
double | firstHFQuadRing_ |
std::vector< HcalCellType > | hcalCells_ |
DetId::Detector | lastReqDet_ |
int | lastReqSubdet_ |
std::vector< DetId > | m_validIds |
double | twopi |
Definition at line 10 of file HcalDDDGeometry.h.
HcalDDDGeometry::HcalDDDGeometry | ( | ) | [explicit] |
Definition at line 10 of file HcalDDDGeometry.cc.
References deg, M_PI, and twopi.
: lastReqDet_(DetId::Detector(0)), lastReqSubdet_(0), etaMax_(0), firstHFQuadRing_(40) { twopi = M_PI + M_PI; deg = M_PI/180.; }
HcalDDDGeometry::~HcalDDDGeometry | ( | ) | [virtual] |
The HcalDDDGeometry will delete all its cell geometries at destruction time.
Definition at line 18 of file HcalDDDGeometry.cc.
{}
DetId HcalDDDGeometry::getClosestCell | ( | const GlobalPoint & | r | ) | const [virtual] |
Reimplemented from CaloSubdetectorGeometry.
Definition at line 55 of file HcalDDDGeometry.cc.
References deg, PV3DBase< T, PVType, FrameType >::eta(), etaMax_, jptDQMConfig_cff::etaMin, hcalCells_, HcalForward, i, LogDebug, PV3DBase< T, PVType, FrameType >::mag(), PV3DBase< T, PVType, FrameType >::phi(), phi, CosmicsPD_Skims::radius, twopi, PV3DBase< T, PVType, FrameType >::z(), and z.
{ // Now find the closest eta_bin, eta value of a bin i is average // of eta[i] and eta[i-1] double abseta = fabs(r.eta()); double phi = r.phi(); if (phi < 0) phi += twopi; double radius = r.mag(); double z = fabs(r.z()); #ifdef DebugLog LogDebug("HCalGeom") << "HcalDDDGeometry::getClosestCell for eta " << r.eta() << " phi " << phi/deg << " z " << r.z() << " radius " << radius; #endif HcalDetId bestId; if (abseta <= etaMax_) { for (unsigned int i=0; i<hcalCells_.size(); i++) { if (abseta >=hcalCells_[i].etaMin() && abseta <=hcalCells_[i].etaMax()) { HcalSubdetector bc = hcalCells_[i].detType(); int etaring = hcalCells_[i].etaBin(); int phibin = 0; if (hcalCells_[i].unitPhi() == 4) { // rings 40 and 41 are offset wrt the other phi numbering // 1 1 1 2 // ------------------------------ // 72 36 36 1 phibin = static_cast<int>(((phi/deg)+hcalCells_[i].phiOffset()+ 0.5*hcalCells_[i].phiBinWidth())/ hcalCells_[i].phiBinWidth()); if (phibin == 0) phibin = hcalCells_[i].nPhiBins(); phibin = phibin*4 - 1; } else { phibin = static_cast<int>(((phi/deg)+hcalCells_[i].phiOffset())/ hcalCells_[i].phiBinWidth()) + 1; // convert to the convention of numbering 1,3,5, in 36 phi bins phibin = (phibin-1)*(hcalCells_[i].unitPhi()) + 1; } int dbin = 1; int etabin = (r.z() > 0) ? etaring : -etaring; if (bc == HcalForward) { bestId = HcalDetId(bc, etabin, phibin, dbin); break; } else { double rz = z; if (hcalCells_[i].depthType()) rz = radius; if (rz < hcalCells_[i].depthMax()) { dbin = hcalCells_[i].depthSegment(); bestId = HcalDetId(bc, etabin, phibin, dbin); break; } } } } } #ifdef DebugLog LogDebug("HCalGeom") << "HcalDDDGeometry::getClosestCell " << bestId; #endif return bestId; }
std::vector< DetId > const & HcalDDDGeometry::getValidDetIds | ( | DetId::Detector | det = DetId::Detector ( 0 ) , |
int | subdet = 0 |
||
) | const [virtual] |
Get a list of valid detector ids (for the given subdetector)
Reimplemented from CaloSubdetectorGeometry.
Definition at line 21 of file HcalDDDGeometry.cc.
References CaloSubdetectorGeometry::getValidDetIds(), i, lastReqDet_, lastReqSubdet_, LogDebug, m_validIds, and python::multivaluedict::sort().
{ const std::vector<DetId>& baseIds(CaloSubdetectorGeometry::getValidDetIds()); if (det == DetId::Detector( 0 ) && subdet == 0) { return baseIds ; } if (lastReqDet_ != det || lastReqSubdet_ != subdet ) { lastReqDet_ = det ; lastReqSubdet_ = subdet ; m_validIds.clear(); m_validIds.reserve( baseIds.size() ) ; } if (m_validIds.empty() ) { for (unsigned int i = 0 ; i != baseIds.size() ; ++i ) { const DetId id ( baseIds[i] ); if (id.det() == det && id.subdetId() == subdet ) { m_validIds.push_back( id ) ; } } std::sort(m_validIds.begin(),m_validIds.end()); } #ifdef DebugLog LogDebug("HCalGeom") << "HcalDDDGeometry::getValidDetIds: " << m_validIds.size() << " valid IDs found for detector " << det << " Sub-detector " << subdet; #endif return m_validIds; }
int HcalDDDGeometry::insertCell | ( | std::vector< HcalCellType > const & | cells | ) |
Definition at line 118 of file HcalDDDGeometry.cc.
References jptDQMConfig_cff::etaMax, etaMax_, hcalCells_, i, and LogDebug.
Referenced by HcalDDDGeometryLoader::fill().
{ hcalCells_.insert(hcalCells_.end(), cells.begin(), cells.end()); int num = static_cast<int>(hcalCells_.size()); for (unsigned int i=0; i<cells.size(); i++) { if (cells[i].etaMax() > etaMax_ ) etaMax_ = cells[i].etaMax(); } #ifdef DebugLog LogDebug("HCalGeom") << "HcalDDDGeometry::insertCell " << cells.size() << " cells inserted == Total " << num << " EtaMax = " << etaMax_; #endif return num; }
double HcalDDDGeometry::deg [private] |
Definition at line 33 of file HcalDDDGeometry.h.
Referenced by getClosestCell(), and HcalDDDGeometry().
double HcalDDDGeometry::etaMax_ [private] |
Definition at line 34 of file HcalDDDGeometry.h.
Referenced by getClosestCell(), and insertCell().
double HcalDDDGeometry::firstHFQuadRing_ [private] |
Definition at line 34 of file HcalDDDGeometry.h.
std::vector<HcalCellType> HcalDDDGeometry::hcalCells_ [private] |
Definition at line 29 of file HcalDDDGeometry.h.
Referenced by getClosestCell(), and insertCell().
DetId::Detector HcalDDDGeometry::lastReqDet_ [mutable, private] |
Definition at line 30 of file HcalDDDGeometry.h.
Referenced by getValidDetIds().
int HcalDDDGeometry::lastReqSubdet_ [mutable, private] |
Definition at line 31 of file HcalDDDGeometry.h.
Referenced by getValidDetIds().
std::vector<DetId> HcalDDDGeometry::m_validIds [mutable, private] |
Reimplemented from CaloSubdetectorGeometry.
Definition at line 27 of file HcalDDDGeometry.h.
Referenced by getValidDetIds().
double HcalDDDGeometry::twopi [private] |
Definition at line 33 of file HcalDDDGeometry.h.
Referenced by getClosestCell(), and HcalDDDGeometry().