#include <Geometry/HcalTowerAlgo/interface/HcalDDDGeometry.h>
Public Member Functions | |
virtual DetId | getClosestCell (const GlobalPoint &r) const |
virtual std::vector< DetId > const & | getValidDetIds (DetId::Detector det, int subdet) const |
Get a list of valid detector ids (for the given subdetector). | |
HcalDDDGeometry () | |
int | insertCell (std::vector< HcalCellType::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::HcalCellType > | hcalCells_ |
DetId::Detector | lastReqDet_ |
int | lastReqSubdet_ |
double | twopi |
Definition at line 10 of file HcalDDDGeometry.h.
HcalDDDGeometry::HcalDDDGeometry | ( | ) | [explicit] |
Definition at line 6 of file HcalDDDGeometry.cc.
00006 : lastReqDet_(DetId::Detector(0)), 00007 lastReqSubdet_(0), etaMax_(0), 00008 firstHFQuadRing_(40) { 00009 twopi = M_PI + M_PI; 00010 deg = M_PI/180.; 00011 }
HcalDDDGeometry::~HcalDDDGeometry | ( | ) | [virtual] |
The HcalDDDGeometry will delete all its cell geometries at destruction time.
Definition at line 14 of file HcalDDDGeometry.cc.
DetId HcalDDDGeometry::getClosestCell | ( | const GlobalPoint & | r | ) | const [virtual] |
Reimplemented from CaloSubdetectorGeometry.
Definition at line 44 of file HcalDDDGeometry.cc.
References deg, PV3DBase< T, PVType, FrameType >::eta(), etaMax_, gen_hydjet_hard_muon_trigger_cfg::etaMin, firstHFQuadRing_, hcalCells_, HcalForward, i, LogDebug, PV3DBase< T, PVType, FrameType >::mag(), PV3DBase< T, PVType, FrameType >::phi(), phi, radius(), twopi, PV3DBase< T, PVType, FrameType >::z(), and z.
00044 { 00045 00046 // Now find the closest eta_bin, eta value of a bin i is average 00047 // of eta[i] and eta[i-1] 00048 double abseta = fabs(r.eta()); 00049 double phi = r.phi(); 00050 if (phi < 0) phi += twopi; 00051 double radius = r.mag(); 00052 double z = fabs(r.z()); 00053 LogDebug("HCalGeom") << "HcalDDDGeometry::getClosestCell for eta " 00054 << r.eta() << " phi " << phi/deg << " z " << r.z() 00055 << " radius " << radius; 00056 00057 HcalDetId bestId; 00058 if (abseta <= etaMax_) { 00059 for (unsigned int i=0; i<hcalCells_.size(); i++) { 00060 if (abseta >=hcalCells_[i].etaMin() && abseta <=hcalCells_[i].etaMax()) { 00061 HcalSubdetector bc = hcalCells_[i].detType(); 00062 int etaring = hcalCells_[i].etaBin(); 00063 int phibin = static_cast<int>(((phi/deg)+hcalCells_[i].phiOffset())/ 00064 hcalCells_[i].phiBinWidth()) + 1; 00065 // rings 40 and 41 are offset wrt the other phi numbering 00066 // 1 1 1 2 00067 // ------------------------------ 00068 // 72 36 36 1 00069 if (etaring >= firstHFQuadRing_) { 00070 ++phibin; 00071 if (phibin > hcalCells_[i].nPhiBins()) 00072 phibin -= hcalCells_[i].nPhiBins(); 00073 } 00074 00075 // convert to the convention of numbering 1,3,5, in 36 phi bins 00076 // and 1,5,9 in 18 phi bins 00077 phibin = (phibin-1)*(hcalCells_[i].nPhiModule()) + 1; 00078 int dbin = 1; 00079 int etabin = (r.z() > 0) ? etaring : -etaring; 00080 if (bc == HcalForward) { 00081 bestId = HcalDetId(bc, etabin, phibin, dbin); 00082 break; 00083 } else { 00084 double rz = z; 00085 if (hcalCells_[i].depthType()) rz = radius; 00086 if (rz < hcalCells_[i].depthMax()) { 00087 dbin = hcalCells_[i].depthSegment(); 00088 bestId = HcalDetId(bc, etabin, phibin, dbin); 00089 break; 00090 } 00091 } 00092 } 00093 } 00094 } 00095 LogDebug("HCalGeom") << "HcalDDDGeometry::getClosestCell " << bestId; 00096 00097 return bestId; 00098 }
std::vector< DetId > const & HcalDDDGeometry::getValidDetIds | ( | DetId::Detector | det, | |
int | subdet | |||
) | const [virtual] |
Get a list of valid detector ids (for the given subdetector).
Reimplemented from CaloSubdetectorGeometry.
Definition at line 17 of file HcalDDDGeometry.cc.
References begin, CaloSubdetectorGeometry::cellGeometries(), i, id, lastReqDet_, lastReqSubdet_, LogDebug, CaloSubdetectorGeometry::m_validIds, size, and python::multivaluedict::sort().
00018 { 00019 00020 if (lastReqDet_!=det || lastReqSubdet_!=subdet) { 00021 lastReqDet_=det; 00022 lastReqSubdet_=subdet; 00023 m_validIds.clear(); 00024 } 00025 00026 if (m_validIds.empty()) { 00027 m_validIds.reserve(cellGeometries().size()); 00028 CaloSubdetectorGeometry::CellCont::const_iterator i; 00029 for (i=cellGeometries().begin(); i!=cellGeometries().end(); i++) { 00030 DetId id(i->first); 00031 if (id.det()==det && id.subdetId()==subdet) 00032 m_validIds.push_back(id); 00033 } 00034 std::sort(m_validIds.begin(),m_validIds.end()); 00035 } 00036 00037 LogDebug("HCalGeom") << "HcalDDDGeometry::getValidDetIds: " 00038 << m_validIds.size() << " valid IDs found for detector " 00039 << det << " Sub-detector " << subdet; 00040 return m_validIds; 00041 }
int HcalDDDGeometry::insertCell | ( | std::vector< HcalCellType::HcalCellType > const & | cells | ) |
Definition at line 101 of file HcalDDDGeometry.cc.
References gen_hydjet_hard_muon_trigger_cfg::etaMax, etaMax_, hcalCells_, i, LogDebug, and funct::num().
Referenced by HcalDDDGeometryLoader::fill().
00101 { 00102 00103 hcalCells_.insert(hcalCells_.end(), cells.begin(), cells.end()); 00104 int num = static_cast<int>(hcalCells_.size()); 00105 for (unsigned int i=0; i<cells.size(); i++) { 00106 if (cells[i].etaMax() > etaMax_ ) etaMax_ = cells[i].etaMax(); 00107 } 00108 LogDebug("HCalGeom") << "HcalDDDGeometry::insertCell " << cells.size() 00109 << " cells inserted == Total " << num 00110 << " EtaMax = " << etaMax_; 00111 return num; 00112 }
double HcalDDDGeometry::deg [private] |
Definition at line 28 of file HcalDDDGeometry.h.
Referenced by getClosestCell(), and HcalDDDGeometry().
double HcalDDDGeometry::etaMax_ [private] |
double HcalDDDGeometry::firstHFQuadRing_ [private] |
std::vector<HcalCellType::HcalCellType> HcalDDDGeometry::hcalCells_ [private] |
DetId::Detector HcalDDDGeometry::lastReqDet_ [mutable, private] |
int HcalDDDGeometry::lastReqSubdet_ [mutable, private] |
double HcalDDDGeometry::twopi [private] |
Definition at line 28 of file HcalDDDGeometry.h.
Referenced by getClosestCell(), and HcalDDDGeometry().