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 | Protected Member Functions | Private Attributes
HcalDDDGeometry Class Reference

#include <HcalDDDGeometry.h>

Inheritance diagram for HcalDDDGeometry:
CaloSubdetectorGeometry

Public Types

typedef std::vector
< IdealObliquePrism
HBCellVec
 
typedef std::vector
< IdealObliquePrism
HECellVec
 
typedef std::vector< IdealZPrismHFCellVec
 
typedef std::vector
< IdealObliquePrism
HOCellVec
 
- Public Types inherited from CaloSubdetectorGeometry
typedef CaloCellGeometry::CCGFloat CCGFloat
 
typedef std::set< DetIdDetIdSet
 
typedef std::vector< CCGFloatDimVec
 
typedef std::vector< unsigned int > IVec
 
typedef CaloCellGeometry::ParMgr ParMgr
 
typedef CaloCellGeometry::ParVec ParVec
 
typedef CaloCellGeometry::ParVecVec ParVecVec
 
typedef std::vector< CCGFloatTrVec
 

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 void newCell (const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId)
 
virtual ~HcalDDDGeometry ()
 The HcalDDDGeometry will delete all its cell geometries at destruction time. More...
 
- Public Member Functions inherited from CaloSubdetectorGeometry
void allocateCorners (CaloCellGeometry::CornersVec::size_type n)
 
void allocatePar (ParVec::size_type n, unsigned int m)
 
 CaloSubdetectorGeometry ()
 
CaloCellGeometry::CornersMgrcornersMgr ()
 
CCGFloat deltaEta (const DetId &detId) const
 
CCGFloat 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...
 

Protected Member Functions

virtual const CaloCellGeometrycellGeomPtr (uint32_t index) const
 

Private Attributes

double deg
 
double etaMax_
 
double firstHFQuadRing_
 
std::vector< HcalCellTypehcalCells_
 
DetId::Detector lastReqDet_
 
int lastReqSubdet_
 
HBCellVec m_hbCellVec
 
HECellVec m_heCellVec
 
HFCellVec m_hfCellVec
 
HOCellVec m_hoCellVec
 
std::vector< DetIdm_validIds
 
double twopi
 

Additional Inherited Members

- Static Protected Member Functions inherited from CaloSubdetectorGeometry
static CCGFloat deltaR (const GlobalPoint &p1, const GlobalPoint &p2)
 
- Protected Attributes inherited from CaloSubdetectorGeometry
ParVecVec m_parVecVec
 
std::vector< DetIdm_validIds
 

Detailed Description

Definition at line 18 of file HcalDDDGeometry.h.

Member Typedef Documentation

Definition at line 22 of file HcalDDDGeometry.h.

Definition at line 23 of file HcalDDDGeometry.h.

Definition at line 25 of file HcalDDDGeometry.h.

Definition at line 24 of file HcalDDDGeometry.h.

Constructor & Destructor Documentation

HcalDDDGeometry::HcalDDDGeometry ( )
explicit

Definition at line 11 of file HcalDDDGeometry.cc.

References deg, M_PI, and twopi.

11  :
13  lastReqSubdet_(0),
14  etaMax_(0),
15  firstHFQuadRing_(40) ,
20 {
21  twopi = M_PI + M_PI;
22  deg = M_PI/180.;
23 }
HBCellVec m_hbCellVec
#define M_PI
Definition: BFit3D.cc:3
HECellVec m_heCellVec
Detector
Definition: DetId.h:26
HFCellVec m_hfCellVec
DetId::Detector lastReqDet_
HOCellVec m_hoCellVec
HcalDDDGeometry::~HcalDDDGeometry ( )
virtual

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

Definition at line 26 of file HcalDDDGeometry.cc.

27 {
28 }

Member Function Documentation

const CaloCellGeometry * HcalDDDGeometry::cellGeomPtr ( uint32_t  index) const
protectedvirtual

Implements CaloSubdetectorGeometry.

Definition at line 190 of file HcalDDDGeometry.cc.

References cropTnPTrees::din, getHLTprescales::index, m_hbCellVec, m_heCellVec, m_hfCellVec, m_hoCellVec, and CaloCellGeometry::param().

191 {
192  const CaloCellGeometry* cell ( 0 ) ;
193  if( m_hbCellVec.size() > din )
194  {
195  cell = &m_hbCellVec[ din ] ;
196  }
197  else
198  {
199  if( m_hbCellVec.size() +
200  m_heCellVec.size() > din )
201  {
202  const unsigned int index ( din - m_hbCellVec.size() ) ;
203  cell = &m_heCellVec[ index ] ;
204  }
205  else
206  {
207  if( m_hbCellVec.size() +
208  m_heCellVec.size() +
209  m_hoCellVec.size() > din )
210  {
211  const unsigned int index ( din
212  - m_hbCellVec.size()
213  - m_heCellVec.size() ) ;
214  cell = &m_hoCellVec[ index ] ;
215  }
216  else
217  {
218  if( m_hbCellVec.size() +
219  m_heCellVec.size() +
220  m_hoCellVec.size() +
221  m_hfCellVec.size() > din )
222  {
223  const unsigned int index ( din
224  - m_hbCellVec.size()
225  - m_heCellVec.size()
226  - m_hoCellVec.size() ) ;
227  cell = &m_hfCellVec[ index ] ;
228  }
229  }
230  }
231  }
232  return ( 0 == cell || 0 == cell->param() ? 0 : cell ) ;
233 }
HBCellVec m_hbCellVec
HECellVec m_heCellVec
HFCellVec m_hfCellVec
HOCellVec m_hoCellVec
DetId HcalDDDGeometry::getClosestCell ( const GlobalPoint r) const
virtual

Reimplemented from CaloSubdetectorGeometry.

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

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

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

32  {
33 
34  const std::vector<DetId>& baseIds(CaloSubdetectorGeometry::getValidDetIds());
35  if (det == DetId::Detector( 0 ) && subdet == 0) {
36  return baseIds ;
37  }
38 
39  if (lastReqDet_ != det || lastReqSubdet_ != subdet ) {
40  lastReqDet_ = det ;
41  lastReqSubdet_ = subdet ;
42  m_validIds.clear();
43  m_validIds.reserve( baseIds.size() ) ;
44  }
45 
46  if (m_validIds.empty() ) {
47  for (unsigned int i = 0 ; i != baseIds.size() ; ++i ) {
48  const DetId id ( baseIds[i] );
49  if (id.det() == det && id.subdetId() == subdet ) {
50  m_validIds.push_back( id ) ;
51  }
52  }
53  std::sort(m_validIds.begin(),m_validIds.end());
54  }
55 
56 #ifdef DebugLog
57  LogDebug("HCalGeom") << "HcalDDDGeometry::getValidDetIds: "
58  << m_validIds.size() << " valid IDs found for detector "
59  << det << " Sub-detector " << subdet;
60 #endif
61  return m_validIds;
62 }
#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 128 of file HcalDDDGeometry.cc.

References jptDQMConfig_cff::etaMax, etaMax_, hcalCells_, i, and LogDebug.

Referenced by HcalDDDGeometryLoader::fill().

128  {
129 
130  hcalCells_.insert(hcalCells_.end(), cells.begin(), cells.end());
131  int num = static_cast<int>(hcalCells_.size());
132  for (unsigned int i=0; i<cells.size(); i++) {
133  if (cells[i].etaMax() > etaMax_ ) etaMax_ = cells[i].etaMax();
134  }
135 #ifdef DebugLog
136  LogDebug("HCalGeom") << "HcalDDDGeometry::insertCell " << cells.size()
137  << " cells inserted == Total " << num
138  << " EtaMax = " << etaMax_;
139 #endif
140  return num;
141 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
std::vector< HcalCellType > hcalCells_
long long int num
Definition: procUtils.cc:71
void HcalDDDGeometry::newCell ( const GlobalPoint f1,
const GlobalPoint f2,
const GlobalPoint f3,
const CCGFloat parm,
const DetId detId 
)
virtual

Implements CaloSubdetectorGeometry.

Definition at line 144 of file HcalDDDGeometry.cc.

References CaloSubdetectorGeometry::cornersMgr(), CaloGenericDetId::denseIndex(), cropTnPTrees::din, getHLTprescales::index, CaloGenericDetId::isHB(), CaloGenericDetId::isHcal(), CaloGenericDetId::isHE(), CaloGenericDetId::isHO(), m_hbCellVec, m_heCellVec, m_hfCellVec, m_hoCellVec, and m_validIds.

149 {
150  const CaloGenericDetId cgid ( detId ) ;
151 
152  const unsigned int din ( cgid.denseIndex() ) ;
153 
154  assert( cgid.isHcal() ) ;
155 
156  if( cgid.isHB() )
157  {
158  m_hbCellVec[ din ] = IdealObliquePrism( f1, cornersMgr(), parm ) ;
159  }
160  else
161  {
162  if( cgid.isHE() )
163  {
164  const unsigned int index ( din - m_hbCellVec.size() ) ;
165  m_heCellVec[ index ] = IdealObliquePrism( f1, cornersMgr(), parm ) ;
166  }
167  else
168  {
169  if( cgid.isHO() )
170  {
171  const unsigned int index ( din
172  - m_hbCellVec.size()
173  - m_heCellVec.size() ) ;
174  m_hoCellVec[ index ] = IdealObliquePrism( f1, cornersMgr(), parm ) ;
175  }
176  else
177  {
178  const unsigned int index ( din
179  - m_hbCellVec.size()
180  - m_heCellVec.size()
181  - m_hoCellVec.size() ) ;
182  m_hfCellVec[ index ] = IdealZPrism( f1, cornersMgr(), parm ) ;
183  }
184  }
185  }
186  m_validIds.push_back( detId ) ;
187 }
HBCellVec m_hbCellVec
HECellVec m_heCellVec
CaloCellGeometry::CornersMgr * cornersMgr()
std::vector< DetId > m_validIds
HFCellVec m_hfCellVec
HOCellVec m_hoCellVec

Member Data Documentation

double HcalDDDGeometry::deg
private

Definition at line 56 of file HcalDDDGeometry.h.

Referenced by getClosestCell(), and HcalDDDGeometry().

double HcalDDDGeometry::etaMax_
private

Definition at line 57 of file HcalDDDGeometry.h.

Referenced by getClosestCell(), and insertCell().

double HcalDDDGeometry::firstHFQuadRing_
private

Definition at line 57 of file HcalDDDGeometry.h.

std::vector<HcalCellType> HcalDDDGeometry::hcalCells_
private

Definition at line 52 of file HcalDDDGeometry.h.

Referenced by getClosestCell(), and insertCell().

DetId::Detector HcalDDDGeometry::lastReqDet_
mutableprivate

Definition at line 53 of file HcalDDDGeometry.h.

Referenced by getValidDetIds().

int HcalDDDGeometry::lastReqSubdet_
mutableprivate

Definition at line 54 of file HcalDDDGeometry.h.

Referenced by getValidDetIds().

HBCellVec HcalDDDGeometry::m_hbCellVec
private

Definition at line 59 of file HcalDDDGeometry.h.

Referenced by cellGeomPtr(), and newCell().

HECellVec HcalDDDGeometry::m_heCellVec
private

Definition at line 60 of file HcalDDDGeometry.h.

Referenced by cellGeomPtr(), and newCell().

HFCellVec HcalDDDGeometry::m_hfCellVec
private

Definition at line 62 of file HcalDDDGeometry.h.

Referenced by cellGeomPtr(), and newCell().

HOCellVec HcalDDDGeometry::m_hoCellVec
private

Definition at line 61 of file HcalDDDGeometry.h.

Referenced by cellGeomPtr(), and newCell().

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

Definition at line 50 of file HcalDDDGeometry.h.

Referenced by getValidDetIds(), and newCell().

double HcalDDDGeometry::twopi
private

Definition at line 56 of file HcalDDDGeometry.h.

Referenced by getClosestCell(), and HcalDDDGeometry().