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 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::vector
< CaloCellGeometry const * > 
CellSet
 
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 (const HcalTopology &theTopo)
 
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 CellSet getCellSet (const GlobalPoint &r, double dR) const
 
virtual const CaloCellGeometrygetGeometry (const DetId &id) const
 Get the cell geometry of a given detector id. Should return false if not found. More...
 
virtual void getSummary (TrVec &trVector, IVec &iVector, DimVec &dimVector, IVec &dinsVector) 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
 
- Protected Member Functions inherited from CaloSubdetectorGeometry
void addValidID (const DetId &id)
 
virtual unsigned int indexFor (const DetId &id) const
 
virtual unsigned int sizeForDenseIndex (const DetId &id) const
 

Private Member Functions

void fillDetIds () const
 

Private Attributes

double etaMax_
 
std::vector< HcalCellTypehcalCells_
 
std::vector< DetIdm_emptyIds
 
HBCellVec m_hbCellVec
 
std::vector< DetIdm_hbIds
 
HECellVec m_heCellVec
 
std::vector< DetIdm_heIds
 
HFCellVec m_hfCellVec
 
std::vector< DetIdm_hfIds
 
HOCellVec m_hoCellVec
 
std::vector< DetIdm_hoIds
 
const HcalTopologytopo_
 

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
 

Detailed Description

Definition at line 13 of file HcalDDDGeometry.h.

Member Typedef Documentation

Definition at line 17 of file HcalDDDGeometry.h.

Definition at line 18 of file HcalDDDGeometry.h.

Definition at line 20 of file HcalDDDGeometry.h.

Definition at line 19 of file HcalDDDGeometry.h.

Constructor & Destructor Documentation

HcalDDDGeometry::HcalDDDGeometry ( const HcalTopology theTopo)
explicit

Definition at line 7 of file HcalDDDGeometry.cc.

8  : topo_(topo),
9  etaMax_(0),
10  m_hbCellVec ( topo.getHBSize() ) ,
11  m_heCellVec ( topo.getHESize() ) ,
12  m_hoCellVec ( topo.getHOSize() ) ,
13  m_hfCellVec ( topo.getHFSize() )
14 {
15 }
const HcalTopology & topo_
HBCellVec m_hbCellVec
HECellVec m_heCellVec
HFCellVec m_hfCellVec
HOCellVec m_hoCellVec
HcalDDDGeometry::~HcalDDDGeometry ( )
virtual

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

Definition at line 17 of file HcalDDDGeometry.cc.

18 {
19 }

Member Function Documentation

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

Implements CaloSubdetectorGeometry.

Definition at line 202 of file HcalDDDGeometry.cc.

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

203 {
204  const CaloCellGeometry* cell ( 0 ) ;
205  if( m_hbCellVec.size() > din )
206  {
207  cell = &m_hbCellVec[ din ] ;
208  }
209  else
210  {
211  if( m_hbCellVec.size() +
212  m_heCellVec.size() > din )
213  {
214  const unsigned int index ( din - m_hbCellVec.size() ) ;
215  cell = &m_heCellVec[ index ] ;
216  }
217  else
218  {
219  if( m_hbCellVec.size() +
220  m_heCellVec.size() +
221  m_hoCellVec.size() > din )
222  {
223  const unsigned int index ( din
224  - m_hbCellVec.size()
225  - m_heCellVec.size() ) ;
226  cell = &m_hoCellVec[ index ] ;
227  }
228  else
229  {
230  if( m_hbCellVec.size() +
231  m_heCellVec.size() +
232  m_hoCellVec.size() +
233  m_hfCellVec.size() > din )
234  {
235  const unsigned int index ( din
236  - m_hbCellVec.size()
237  - m_heCellVec.size()
238  - m_hoCellVec.size() ) ;
239  cell = &m_hfCellVec[ index ] ;
240  }
241  }
242  }
243  }
244  return ( 0 == cell || 0 == cell->param() ? 0 : cell ) ;
245 }
HBCellVec m_hbCellVec
HECellVec m_heCellVec
HFCellVec m_hfCellVec
HOCellVec m_hoCellVec
void HcalDDDGeometry::fillDetIds ( ) const
private

Definition at line 22 of file HcalDDDGeometry.cc.

References CaloSubdetectorGeometry::getValidDetIds(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, i, m_emptyIds, m_hbIds, m_heIds, m_hfIds, m_hoIds, and python.multivaluedict::sort().

Referenced by getValidDetIds().

23 {
24  const std::vector<DetId>& baseIds ( CaloSubdetectorGeometry::getValidDetIds() ) ;
25  for( unsigned int i ( 0 ) ; i != baseIds.size() ; ++i )
26  {
27  const DetId id ( baseIds[i] );
28  if( id.subdetId() == HcalBarrel )
29  {
30  m_hbIds.push_back( id ) ;
31  }
32  else
33  {
34  if( id.subdetId() == HcalEndcap )
35  {
36  m_heIds.push_back( id ) ;
37  }
38  else
39  {
40  if( id.subdetId() == HcalOuter )
41  {
42  m_hoIds.push_back( id ) ;
43  }
44  else
45  {
46  if( id.subdetId() == HcalForward )
47  {
48  m_hfIds.push_back( id ) ;
49  }
50  }
51  }
52  }
53  }
54  std::sort( m_hbIds.begin(), m_hbIds.end() ) ;
55  std::sort( m_heIds.begin(), m_heIds.end() ) ;
56  std::sort( m_hoIds.begin(), m_hoIds.end() ) ;
57  std::sort( m_hfIds.begin(), m_hfIds.end() ) ;
58 
59  m_emptyIds.resize( 0 ) ;
60 }
int i
Definition: DBlmapReader.cc:9
std::vector< DetId > m_hfIds
std::vector< DetId > m_heIds
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)
std::vector< DetId > m_hbIds
Definition: DetId.h:18
std::vector< DetId > m_emptyIds
std::vector< DetId > m_hoIds
DetId HcalDDDGeometry::getClosestCell ( const GlobalPoint r) const
virtual

Reimplemented from CaloSubdetectorGeometry.

Definition at line 76 of file HcalDDDGeometry.cc.

References constexpr, PV3DBase< T, PVType, FrameType >::eta(), etaMax_, jptDQMConfig_cff::etaMin, hcalCells_, HcalForward, i, LogDebug, M_PI, PV3DBase< T, PVType, FrameType >::mag(), phi, PV3DBase< T, PVType, FrameType >::phi(), CosmicsPD_Skims::radius, detailsBasic3DVector::z, and PV3DBase< T, PVType, FrameType >::z().

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

References fillDetIds(), CaloSubdetectorGeometry::getValidDetIds(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, m_emptyIds, m_hbIds, m_heIds, m_hfIds, and m_hoIds.

65 {
66  if( 0 != subdet &&
67  0 == m_hbIds.size() ) fillDetIds() ;
68  return ( 0 == subdet ? CaloSubdetectorGeometry::getValidDetIds() :
69  ( HcalBarrel == subdet ? m_hbIds :
70  ( HcalEndcap == subdet ? m_heIds :
71  ( HcalOuter == subdet ? m_hoIds :
72  ( HcalForward == subdet ? m_hfIds : m_emptyIds ) ) ) ) ) ;
73 }
std::vector< DetId > m_hfIds
std::vector< DetId > m_heIds
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)
std::vector< DetId > m_hbIds
void fillDetIds() const
std::vector< DetId > m_emptyIds
std::vector< DetId > m_hoIds
int HcalDDDGeometry::insertCell ( std::vector< HcalCellType > const &  cells)

Definition at line 140 of file HcalDDDGeometry.cc.

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

Referenced by HcalDDDGeometryLoader::fill().

140  {
141 
142  hcalCells_.insert(hcalCells_.end(), cells.begin(), cells.end());
143  int num = static_cast<int>(hcalCells_.size());
144  for (unsigned int i=0; i<cells.size(); i++) {
145  if (cells[i].etaMax() > etaMax_ ) etaMax_ = cells[i].etaMax();
146  }
147 
148  LogDebug("HCalGeom") << "HcalDDDGeometry::insertCell " << cells.size()
149  << " cells inserted == Total " << num
150  << " EtaMax = " << etaMax_;
151  return num;
152 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
std::vector< HcalCellType > hcalCells_
void HcalDDDGeometry::newCell ( const GlobalPoint f1,
const GlobalPoint f2,
const GlobalPoint f3,
const CCGFloat parm,
const DetId detId 
)
virtual

Implements CaloSubdetectorGeometry.

Definition at line 155 of file HcalDDDGeometry.cc.

References CaloSubdetectorGeometry::addValidID(), CaloSubdetectorGeometry::cornersMgr(), DetId::det(), HcalTopology::detId2denseId(), cropTnPTrees::din, DetId::Hcal, HcalBarrel, HcalEndcap, HcalOuter, getHLTprescales::index, m_hbCellVec, m_heCellVec, m_hfCellVec, m_hoCellVec, and topo_.

160 {
161 
162  assert( detId.det()==DetId::Hcal );
163 
164  const unsigned int din(topo_.detId2denseId(detId));
165 
166  HcalDetId hId(detId);
167 
168  if( hId.subdet()==HcalBarrel )
169  {
170  m_hbCellVec[ din ] = IdealObliquePrism( f1, cornersMgr(), parm ) ;
171  }
172  else
173  {
174  if( hId.subdet()==HcalEndcap )
175  {
176  const unsigned int index ( din - m_hbCellVec.size() ) ;
177  m_heCellVec[ index ] = IdealObliquePrism( f1, cornersMgr(), parm ) ;
178  }
179  else
180  {
181  if( hId.subdet()==HcalOuter )
182  {
183  const unsigned int index ( din
184  - m_hbCellVec.size()
185  - m_heCellVec.size() ) ;
186  m_hoCellVec[ index ] = IdealObliquePrism( f1, cornersMgr(), parm ) ;
187  }
188  else
189  { // assuming HcalForward here!
190  const unsigned int index ( din
191  - m_hbCellVec.size()
192  - m_heCellVec.size()
193  - m_hoCellVec.size() ) ;
194  m_hfCellVec[ index ] = IdealZPrism( f1, cornersMgr(), parm ) ;
195  }
196  }
197  }
198  addValidID( detId ) ;
199 }
virtual unsigned int detId2denseId(const DetId &id) const
return a linear packed id
const HcalTopology & topo_
HBCellVec m_hbCellVec
void addValidID(const DetId &id)
HECellVec m_heCellVec
CaloCellGeometry::CornersMgr * cornersMgr()
HFCellVec m_hfCellVec
HOCellVec m_hoCellVec
Detector det() const
get the detector field from this detid
Definition: DetId.h:35

Member Data Documentation

double HcalDDDGeometry::etaMax_
private

Definition at line 55 of file HcalDDDGeometry.h.

Referenced by getClosestCell(), and insertCell().

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

Definition at line 47 of file HcalDDDGeometry.h.

Referenced by getClosestCell(), and insertCell().

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

Definition at line 52 of file HcalDDDGeometry.h.

Referenced by fillDetIds(), and getValidDetIds().

HBCellVec HcalDDDGeometry::m_hbCellVec
private

Definition at line 57 of file HcalDDDGeometry.h.

Referenced by cellGeomPtr(), and newCell().

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

Definition at line 48 of file HcalDDDGeometry.h.

Referenced by fillDetIds(), and getValidDetIds().

HECellVec HcalDDDGeometry::m_heCellVec
private

Definition at line 58 of file HcalDDDGeometry.h.

Referenced by cellGeomPtr(), and newCell().

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

Definition at line 49 of file HcalDDDGeometry.h.

Referenced by fillDetIds(), and getValidDetIds().

HFCellVec HcalDDDGeometry::m_hfCellVec
private

Definition at line 60 of file HcalDDDGeometry.h.

Referenced by cellGeomPtr(), and newCell().

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

Definition at line 51 of file HcalDDDGeometry.h.

Referenced by fillDetIds(), and getValidDetIds().

HOCellVec HcalDDDGeometry::m_hoCellVec
private

Definition at line 59 of file HcalDDDGeometry.h.

Referenced by cellGeomPtr(), and newCell().

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

Definition at line 50 of file HcalDDDGeometry.h.

Referenced by fillDetIds(), and getValidDetIds().

const HcalTopology& HcalDDDGeometry::topo_
private

Definition at line 54 of file HcalDDDGeometry.h.

Referenced by newCell().