7 #include <Math/Transform3D.h>
8 #include <Math/EulerAngles.h>
16 theTopology( topology ) {
41 for(
unsigned int i ( 0 ) ;
i != baseIds.size() ; ++
i )
43 const DetId id ( baseIds[
i] );
78 const std::vector<DetId>&
95 double abseta = fabs(r.
eta());
108 static const double z_short=1137.0;
109 int etaring =
etaRing(bc, abseta);
123 int etabin = (r.
z() > 0) ? etaring : -etaring;
127 HcalDetId bestId(bc,etabin,phibin,((fabs(r.
z()) - z_short >-0.1)?(2):(1)));
132 int etaring =
etaRing(bc, abseta);
137 int etabin = (r.
z() > 0) ? etaring : -etaring;
141 double pointrz=0, drz=99999.;
142 HcalDetId currentId(bc, etabin, phibin, dbin);
197 if(phi<0.0) phi += twopi;
198 if(phi>twopi) phi -= twopi;
200 int phibin=
static_cast<int>(phi/twopi*nphibins)+1;
210 phibin=
static_cast<int>(phi/twopi*nphibins);
211 if (phibin==0) phibin=18;
215 iphi=(phibin-1)*(72/nphibins) + 1;
235 const double dR2 ( dR*dR ) ;
236 const double reta ( r.
eta() ) ;
237 const double rphi ( r.
phi() ) ;
238 const double lowEta ( reta - dR ) ;
239 const double highEta ( reta + dR ) ;
240 const double lowPhi ( rphi - dR ) ;
241 const double highPhi ( rphi + dR ) ;
246 if( highEta > -hfEtaHi &&
251 for(
unsigned int is ( 0 ) ; is != 4 ; ++is )
253 const int sign ( reta>0 ? 1 : -1 ) ;
254 const int ieta_center ( sign*
etaRing( hs[is], fabs( reta ) ) ) ;
255 const int ieta_lo ( ( 0 < lowEta*sign ? sign : -sign )*
etaRing( hs[is], fabs( lowEta ) ) ) ;
256 const int ieta_hi ( ( 0 < highEta*sign ? sign : -sign )*
etaRing( hs[is], fabs( highEta ) ) ) ;
257 const int iphi_lo (
phiBin( lowPhi , ieta_center ) ) ;
258 const int iphi_hi (
phiBin( highPhi, ieta_center ) ) ;
259 const int jphi_lo ( iphi_lo>iphi_hi ? iphi_lo - 72 : iphi_lo ) ;
260 const int jphi_hi ( iphi_hi ) ;
262 const int idep_lo ( 1 == is ? 4 : 1 ) ;
263 const int idep_hi ( 1 == is ? 4 :
264 ( 2 == is ? 3 : 2 ) ) ;
265 for(
int ieta ( ieta_lo ) ; ieta <= ieta_hi ; ++ieta )
269 for(
int jphi ( jphi_lo ) ; jphi <= jphi_hi ; ++jphi )
271 const int iphi ( 1 > jphi ? jphi+72 : jphi ) ;
273 for(
int idep ( idep_lo ) ; idep <= idep_hi ; ++idep )
275 const HcalDetId did ( hs[is], ieta, iphi, idep ) ;
283 const double eta (
p.eta() ) ;
284 const double phi (
p.phi() ) ;
306 const int iphi ( 1 + (4*i)%72 ) ;
315 const int iphi ( 1 + (4*i)%72 ) ;
324 const int iphi ( 1 + (4*i)%72 ) ;
332 const int ring ( i/12 ) ;
333 const int ieta ( 0 == ring ? -11 :
336 3 == ring ? 5 : 11 ) ;
337 const int iphi ( 1 + ( i - ring*12 )*6 ) ;
362 const unsigned int iphi ( hid.
iphi() ) ;
363 const int ieta ( hid.
ieta() ) ;
364 const unsigned int index ( ( 0 < ieta ? nD/2 : 0 ) + ( iphi + 1 )%72/4 ) ;
365 assert( index < nD ) ;
390 const int ieta ( hid.
ieta() ) ;
391 const int iphi ( hid.
iphi() ) ;
392 const int ring ( ieta < -10 ? 0 :
395 ( ieta < 11 ? 3 : 4 ) ) ) ) ;
397 const unsigned int index ( 12*ring + ( iphi - 1 )/6 ) ;
418 const unsigned int index (
458 const DetId& detId ) {
467 << detId.
rawId() <<
", hid " << hid <<
", din "
468 << din <<
", index ";
476 const unsigned int index ( din
481 const unsigned int index ( din
514 const unsigned int index ( din
526 const unsigned int index ( din
536 return (( 0 == cell || 0 == cell->
param()) ? 0 : cell ) ;
548 dinsVec.reserve(
m_dins.size() );
552 const ParVec& pv ( *ivv ) ;
555 dVec.push_back( *iv ) ;
566 dinsVec.push_back(
i );
573 tr = HepGeom::Translate3D( gp.x(), gp.y(), gp.z() ) ;
576 const CLHEP::Hep3Vector
tt ( tr.getTranslation() ) ;
577 tVec.push_back(
tt.x() ) ;
578 tVec.push_back(
tt.y() ) ;
579 tVec.push_back(
tt.z() ) ;
582 const CLHEP::HepRotation
rr ( tr.getRotation() ) ;
583 const ROOT::Math::Transform3D rtr (
rr.xx(),
rr.xy(),
rr.xz(),
tt.x(),
585 rr.zx(),
rr.zy(),
rr.zz(),
tt.z() ) ;
587 rtr.GetRotation( ea ) ;
588 tVec.push_back( ea.Phi() ) ;
589 tVec.push_back( ea.Theta() ) ;
590 tVec.push_back( ea.Psi() ) ;
595 unsigned int ishape ( 9999 ) ;
596 for(
unsigned int ivv ( 0 ) ; ivv !=
parVecVec().size() ; ++ivv )
602 ok = ok && ( fabs( par[
k] - pv[
k] ) < 1.e-6 ) ;
610 assert( 9999 != ishape ) ;
614 if( iVec.size() < nn ) iVec.push_back( ishape ) ;
static unsigned int numberOfBarrelAlignments()
std::vector< DetId > m_heIds
unsigned int getHFSize() const
virtual void newCell(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId)
virtual DetId getClosestCell(const GlobalPoint &r) const
std::set< DetId > DetIdSet
static unsigned int alignmentTransformIndexLocal(const DetId &id)
virtual unsigned int detId2denseId(const DetId &id) const
return a linear packed id
std::vector< CCGFloat > DimVec
unsigned int getHOSize() const
static unsigned int alignmentEndcapIndexLocal(const DetId &id)
HcalSubdetector subdet() const
get the subdetector
std::vector< DetId > m_emptyIds
virtual void getSummary(CaloSubdetectorGeometry::TrVec &trVector, CaloSubdetectorGeometry::IVec &iVector, CaloSubdetectorGeometry::DimVec &dimVector, CaloSubdetectorGeometry::IVec &dinsVector) const
static DetId detIdFromOuterAlignmentIndex(unsigned int i)
Geom::Phi< T > phi() const
std::vector< unsigned int > IVec
int nPhiBins(int etaRing) const
how many phi segments in this ring
std::vector< CCGFloat > TrVec
const_iterator begin() const
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
HepGeom::Transform3D Tr3D
std::vector< IdealObliquePrism > HECellVec
std::vector< Pt3D > Pt3DVec
bool isHE(int etabin, int depth)
CaloCellGeometry::CCGFloat CCGFloat
virtual unsigned int numberOfParametersPerShape() 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)
virtual CaloSubdetectorGeometry::DetIdSet getCells(const GlobalPoint &r, double dR) const
Get a list of all cells within a dR of the given cell.
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)
const HcalTopology & theTopology
uint32_t rawId() const
get the raw id
std::vector< DetId > m_hbIds
CaloCellGeometry::Pt3DVec Pt3DVec
std::vector< DetId > m_hoIds
virtual DetIdSet getCells(const GlobalPoint &r, double dR) const
Get a list of all cells within a dR of the given cell.
const CCGFloat * param() const
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
virtual void getTransform(Tr3D &tr, Pt3DVec *lptr) const
--------— only needed by specific utility; overloaded when needed -—
std::vector< IdealObliquePrism > HOCellVec
static unsigned int numberOfOuterAlignments()
int ieta() const
get the cell ieta
static DetId detIdFromForwardAlignmentIndex(unsigned int i)
static unsigned int alignmentTransformIndexGlobal(const DetId &id)
static unsigned int alignmentBarrelIndexLocal(const DetId &id)
Abs< T >::type abs(const T &t)
CaloCellGeometry::CCGFloat CCGFloat
static DetId detIdFromBarrelAlignmentIndex(unsigned int i)
std::vector< DetId > m_hfIds
virtual DetId denseId2detId(unsigned int) const
return a linear packed id
bool isHB(int etabin, int depth)
static DetId detIdFromLocalAlignmentIndex(unsigned int i)
int etaRing(HcalSubdetector bc, double abseta) const
helper methods for getClosestCell
CaloSubdetectorGeometry::IVec m_dins
HcalGeometry(const HcalTopology &topology)
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
void localCorners(Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
static unsigned int alignmentOuterIndexLocal(const DetId &id)
CaloCellGeometry::Pt3D Pt3D
std::vector< IdealZPrism > HFCellVec
int iphi() const
get the cell iphi
bool incrementDepth(HcalDetId &id) const
static unsigned int numberOfEndcapAlignments()
AlgebraicVector EulerAngles
bool isHF(int etabin, int depth)
void addValidID(const DetId &id)
static const double theHFEtaBounds[]
virtual ~HcalGeometry()
The HcalGeometry will delete all its cell geometries at destruction time.
CaloCellGeometry::CornersMgr * cornersMgr()
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
CaloCellGeometry::Pt3DVec Pt3DVec
HepGeom::Point3D< CCGFloat > Pt3D
virtual bool valid(const DetId &id) const
std::vector< IdealObliquePrism > HBCellVec
virtual const CaloCellGeometry * cellGeomPtr(unsigned int index) const
int firstHFQuadPhiRing() const
unsigned int getHESize() const
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
CaloCellGeometry::Tr3D Tr3D
MgrType::const_iterator const_iterator
virtual unsigned int numberOfShapes() const
const_iterator end() const
static unsigned int numberOfForwardAlignments()
static unsigned int alignmentForwardIndexLocal(const DetId &id)
static DetId detIdFromEndcapAlignmentIndex(unsigned int i)
static unsigned int alignmentBarEndForIndexLocal(const DetId &id, unsigned int nD)
virtual unsigned int numberOfTransformParms() const
CaloCellGeometry::Pt3D Pt3D
Detector det() const
get the detector field from this detid
unsigned int getHBSize() const
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
static const double theHBHEEtaBounds[]
int phiBin(double phi, int etaring) const
static unsigned int numberOfAlignments()
virtual unsigned int ncells() const
return a count of valid cells (for dense indexing use)