CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
HcalDDDGeometry Class Reference

#include <HcalDDDGeometry.h>

Inheritance diagram for HcalDDDGeometry:
CaloSubdetectorGeometry

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) More...
 
 HcalDDDGeometry ()
 
int insertCell (std::vector< HcalCellType > const &)
 
virtual ~HcalDDDGeometry ()
 The HcalDDDGeometry will delete all its cell geometries at destruction time. More...
 
- Public Member Functions inherited from CaloSubdetectorGeometry
void addCell (const DetId &id, CaloCellGeometry *ccg)
 Add a cell to the geometry. More...
 
void allocateCorners (CaloCellGeometry::CornersVec::size_type n)
 
void allocatePar (ParVec::size_type n, unsigned int m)
 
 CaloSubdetectorGeometry ()
 
const CellContcellGeometries () const
 the cells More...
 
CaloCellGeometry::CornersMgrcornersMgr ()
 
double deltaEta (const DetId &detId) const
 
double deltaPhi (const DetId &detId) const
 
virtual void fillDefaultNamedParameters () const
 
virtual DetIdSet getCells (const GlobalPoint &r, double dR) const
 Get a list of all cells within a dR of the given cell. More...
 
virtual const CaloCellGeometrygetGeometry (const DetId &id) const
 Get the cell geometry of a given detector id. Should return false if not found. More...
 
void getSummary (TrVec &trVector, IVec &iVector, DimVec &dimVector) const
 
virtual void initializeParms ()
 
virtual unsigned int numberOfParametersPerShape () const
 
virtual unsigned int numberOfShapes () const
 
virtual unsigned int numberOfTransformParms () const
 
ParMgrparMgr ()
 
const ParMgrparMgrConst () const
 
ParVecVecparVecVec ()
 
const ParVecVecparVecVec () const
 
virtual bool present (const DetId &id) const
 is this detid present in the geometry? More...
 
virtual ~CaloSubdetectorGeometry ()
 The base class DOES assume that it owns the CaloCellGeometry objects. More...
 

Private Attributes

double deg
 
double etaMax_
 
double firstHFQuadRing_
 
std::vector< HcalCellTypehcalCells_
 
DetId::Detector lastReqDet_
 
int lastReqSubdet_
 
std::vector< DetIdm_validIds
 
double twopi
 

Additional Inherited Members

- Public Types inherited from CaloSubdetectorGeometry
typedef std::vector< const
CaloCellGeometry * > 
CellCont
 
typedef std::set< DetIdDetIdSet
 
typedef std::vector< double > DimVec
 
typedef std::vector< unsigned int > IVec
 
typedef CaloCellGeometry::ParMgr ParMgr
 
typedef CaloCellGeometry::ParVec ParVec
 
typedef CaloCellGeometry::ParVecVec ParVecVec
 
typedef std::vector< double > TrVec
 
- Static Protected Member Functions inherited from CaloSubdetectorGeometry
static double deltaR (const GlobalPoint &p1, const GlobalPoint &p2)
 
- Protected Attributes inherited from CaloSubdetectorGeometry
ParVecVec m_parVecVec
 

Detailed Description

Definition at line 10 of file HcalDDDGeometry.h.

Constructor & Destructor Documentation

HcalDDDGeometry::HcalDDDGeometry ( )
explicit

Definition at line 10 of file HcalDDDGeometry.cc.

References deg, M_PI, and twopi.

11  lastReqSubdet_(0), etaMax_(0),
12  firstHFQuadRing_(40) {
13  twopi = M_PI + M_PI;
14  deg = M_PI/180.;
15 }
#define M_PI
Definition: BFit3D.cc:3
Detector
Definition: DetId.h:26
DetId::Detector lastReqDet_
HcalDDDGeometry::~HcalDDDGeometry ( )
virtual

The HcalDDDGeometry will delete all its cell geometries at destruction time.

Definition at line 18 of file HcalDDDGeometry.cc.

18 {}

Member Function Documentation

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(), phi, PV3DBase< T, PVType, FrameType >::phi(), CosmicsPD_Skims::radius, twopi, detailsBasic3DVector::z, and PV3DBase< T, PVType, FrameType >::z().

55  {
56 
57  // Now find the closest eta_bin, eta value of a bin i is average
58  // of eta[i] and eta[i-1]
59  double abseta = fabs(r.eta());
60  double phi = r.phi();
61  if (phi < 0) phi += twopi;
62  double radius = r.mag();
63  double z = fabs(r.z());
64 #ifdef DebugLog
65  LogDebug("HCalGeom") << "HcalDDDGeometry::getClosestCell for eta "
66  << r.eta() << " phi " << phi/deg << " z " << r.z()
67  << " radius " << radius;
68 #endif
69 
70  HcalDetId bestId;
71  if (abseta <= etaMax_) {
72  for (unsigned int i=0; i<hcalCells_.size(); i++) {
73  if (abseta >=hcalCells_[i].etaMin() && abseta <=hcalCells_[i].etaMax()) {
74  HcalSubdetector bc = hcalCells_[i].detType();
75  int etaring = hcalCells_[i].etaBin();
76  int phibin = 0;
77  if (hcalCells_[i].unitPhi() == 4) {
78  // rings 40 and 41 are offset wrt the other phi numbering
79  // 1 1 1 2
80  // ------------------------------
81  // 72 36 36 1
82  phibin = static_cast<int>(((phi/deg)+hcalCells_[i].phiOffset()+
83  0.5*hcalCells_[i].phiBinWidth())/
84  hcalCells_[i].phiBinWidth());
85  if (phibin == 0) phibin = hcalCells_[i].nPhiBins();
86  phibin = phibin*4 - 1;
87  } else {
88  phibin = static_cast<int>(((phi/deg)+hcalCells_[i].phiOffset())/
89  hcalCells_[i].phiBinWidth()) + 1;
90  // convert to the convention of numbering 1,3,5, in 36 phi bins
91  phibin = (phibin-1)*(hcalCells_[i].unitPhi()) + 1;
92  }
93 
94  int dbin = 1;
95  int etabin = (r.z() > 0) ? etaring : -etaring;
96  if (bc == HcalForward) {
97  bestId = HcalDetId(bc, etabin, phibin, dbin);
98  break;
99  } else {
100  double rz = z;
101  if (hcalCells_[i].depthType()) rz = radius;
102  if (rz < hcalCells_[i].depthMax()) {
103  dbin = hcalCells_[i].depthSegment();
104  bestId = HcalDetId(bc, etabin, phibin, dbin);
105  break;
106  }
107  }
108  }
109  }
110  }
111 #ifdef DebugLog
112  LogDebug("HCalGeom") << "HcalDDDGeometry::getClosestCell " << bestId;
113 #endif
114  return bestId;
115 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
Geom::Phi< T > phi() const
Definition: PV3DBase.h:63
double double double z
T mag() const
Definition: PV3DBase.h:61
T z() const
Definition: PV3DBase.h:58
HcalSubdetector
Definition: HcalAssistant.h:32
std::vector< HcalCellType > hcalCells_
T eta() const
Definition: PV3DBase.h:70
Definition: DDAxes.h:10
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)

Note
The implementation in this class is relevant for SubdetectorGeometries which handle only a single subdetector at a time. It does not look at the det and subdet arguments.

Reimplemented from CaloSubdetectorGeometry.

Definition at line 21 of file HcalDDDGeometry.cc.

References CaloSubdetectorGeometry::getValidDetIds(), i, lastReqDet_, lastReqSubdet_, LogDebug, m_validIds, and python.multivaluedict::sort().

22  {
23 
24  const std::vector<DetId>& baseIds(CaloSubdetectorGeometry::getValidDetIds());
25  if (det == DetId::Detector( 0 ) && subdet == 0) {
26  return baseIds ;
27  }
28 
29  if (lastReqDet_ != det || lastReqSubdet_ != subdet ) {
30  lastReqDet_ = det ;
31  lastReqSubdet_ = subdet ;
32  m_validIds.clear();
33  m_validIds.reserve( baseIds.size() ) ;
34  }
35 
36  if (m_validIds.empty() ) {
37  for (unsigned int i = 0 ; i != baseIds.size() ; ++i ) {
38  const DetId id ( baseIds[i] );
39  if (id.det() == det && id.subdetId() == subdet ) {
40  m_validIds.push_back( id ) ;
41  }
42  }
43  std::sort(m_validIds.begin(),m_validIds.end());
44  }
45 
46 #ifdef DebugLog
47  LogDebug("HCalGeom") << "HcalDDDGeometry::getValidDetIds: "
48  << m_validIds.size() << " valid IDs found for detector "
49  << det << " Sub-detector " << subdet;
50 #endif
51  return m_validIds;
52 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
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)
Definition: DetId.h:20
Detector
Definition: DetId.h:26
std::vector< DetId > m_validIds
DetId::Detector lastReqDet_
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().

118  {
119 
120  hcalCells_.insert(hcalCells_.end(), cells.begin(), cells.end());
121  int num = static_cast<int>(hcalCells_.size());
122  for (unsigned int i=0; i<cells.size(); i++) {
123  if (cells[i].etaMax() > etaMax_ ) etaMax_ = cells[i].etaMax();
124  }
125 #ifdef DebugLog
126  LogDebug("HCalGeom") << "HcalDDDGeometry::insertCell " << cells.size()
127  << " cells inserted == Total " << num
128  << " EtaMax = " << etaMax_;
129 #endif
130  return num;
131 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
std::vector< HcalCellType > hcalCells_
long long int num
Definition: procUtils.cc:71

Member Data Documentation

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_
mutableprivate

Definition at line 30 of file HcalDDDGeometry.h.

Referenced by getValidDetIds().

int HcalDDDGeometry::lastReqSubdet_
mutableprivate

Definition at line 31 of file HcalDDDGeometry.h.

Referenced by getValidDetIds().

std::vector<DetId> HcalDDDGeometry::m_validIds
mutableprivate

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