7 #include <Math/Transform3D.h>
8 #include <Math/EulerAngles.h>
16 theTopology( topology ) {
39 std::unique_ptr<std::vector<DetId>> p_hbIds{
new std::vector<DetId>};
40 std::unique_ptr<std::vector<DetId>> p_heIds{
new std::vector<DetId>};
41 std::unique_ptr<std::vector<DetId>> p_hoIds{
new std::vector<DetId>};
42 std::unique_ptr<std::vector<DetId>> p_hfIds{
new std::vector<DetId>};
43 std::unique_ptr<std::vector<DetId>> p_emptyIds{
new std::vector<DetId>};
46 for(
unsigned int i ( 0 ) ;
i != baseIds.size() ; ++
i )
48 const DetId id ( baseIds[
i] );
51 p_hbIds->push_back(
id ) ;
57 p_heIds->push_back(
id ) ;
63 p_hoIds->push_back(
id ) ;
69 p_hfIds->push_back(
id ) ;
75 std::sort( p_hbIds->begin(), p_hbIds->end() ) ;
76 std::sort( p_heIds->begin(), p_heIds->end() ) ;
77 std::sort( p_hoIds->begin(), p_hoIds->end() ) ;
78 std::sort( p_hfIds->begin(), p_hfIds->end() ) ;
79 p_emptyIds->resize( 0 ) ;
89 const std::vector<DetId>&
105 double abseta = fabs(r.
eta());
118 static const double z_short=1137.0;
119 int etaring =
etaRing(bc, abseta);
133 int etabin = (r.
z() > 0) ? etaring : -etaring;
137 HcalDetId bestId(bc,etabin,phibin,((fabs(r.
z()) - z_short >-0.1)?(2):(1)));
142 int etaring =
etaRing(bc, abseta);
147 int etabin = (r.
z() > 0) ? etaring : -etaring;
151 double pointrz=0, drz=99999.;
152 HcalDetId currentId(bc, etabin, phibin, dbin);
207 if(phi<0.0) phi += twopi;
208 if(phi>twopi) phi -= twopi;
210 int phibin=
static_cast<int>(phi/twopi*nphibins)+1;
220 phibin=
static_cast<int>(phi/twopi*nphibins);
221 if (phibin==0) phibin=18;
225 iphi=(phibin-1)*(72/nphibins) + 1;
245 const double dR2 ( dR*dR ) ;
246 const double reta ( r.
eta() ) ;
247 const double rphi ( r.
phi() ) ;
248 const double lowEta ( reta - dR ) ;
249 const double highEta ( reta + dR ) ;
250 const double lowPhi ( rphi - dR ) ;
251 const double highPhi ( rphi + dR ) ;
256 if( highEta > -hfEtaHi &&
261 for(
unsigned int is ( 0 ) ; is != 4 ; ++is )
263 const int sign ( reta>0 ? 1 : -1 ) ;
264 const int ieta_center ( sign*
etaRing( hs[is], fabs( reta ) ) ) ;
265 const int ieta_lo ( ( 0 < lowEta*sign ? sign : -sign )*
etaRing( hs[is], fabs( lowEta ) ) ) ;
266 const int ieta_hi ( ( 0 < highEta*sign ? sign : -sign )*
etaRing( hs[is], fabs( highEta ) ) ) ;
267 const int iphi_lo (
phiBin( lowPhi , ieta_center ) ) ;
268 const int iphi_hi (
phiBin( highPhi, ieta_center ) ) ;
269 const int jphi_lo ( iphi_lo>iphi_hi ? iphi_lo - 72 : iphi_lo ) ;
270 const int jphi_hi ( iphi_hi ) ;
272 const int idep_lo ( 1 == is ? 4 : 1 ) ;
273 const int idep_hi ( 1 == is ? 4 :
274 ( 2 == is ? 3 : 2 ) ) ;
275 for(
int ieta ( ieta_lo ) ; ieta <= ieta_hi ; ++ieta )
279 for(
int jphi ( jphi_lo ) ; jphi <= jphi_hi ; ++jphi )
281 const int iphi ( 1 > jphi ? jphi+72 : jphi ) ;
283 for(
int idep ( idep_lo ) ; idep <= idep_hi ; ++idep )
285 const HcalDetId did ( hs[is], ieta, iphi, idep ) ;
293 const double eta (
p.eta() ) ;
294 const double phi (
p.phi() ) ;
316 const int iphi ( 1 + (4*i)%72 ) ;
325 const int iphi ( 1 + (4*i)%72 ) ;
334 const int iphi ( 1 + (4*i)%72 ) ;
342 const int ring ( i/12 ) ;
343 const int ieta ( 0 == ring ? -11 :
346 3 == ring ? 5 : 11 ) ;
347 const int iphi ( 1 + ( i - ring*12 )*6 ) ;
372 const unsigned int iphi ( hid.
iphi() ) ;
373 const int ieta ( hid.
ieta() ) ;
374 const unsigned int index ( ( 0 < ieta ? nD/2 : 0 ) + ( iphi + 1 )%72/4 ) ;
375 assert( index < nD ) ;
400 const int ieta ( hid.
ieta() ) ;
401 const int iphi ( hid.
iphi() ) ;
402 const int ring ( ieta < -10 ? 0 :
405 ( ieta < 11 ? 3 : 4 ) ) ) ) ;
407 const unsigned int index ( 12*ring + ( iphi - 1 )/6 ) ;
428 const unsigned int index (
468 const DetId& detId ) {
477 << detId.
rawId() <<
", hid " << hid <<
", din "
478 << din <<
", index ";
486 const unsigned int index ( din
491 const unsigned int index ( din
524 const unsigned int index ( din
536 const unsigned int index ( din
546 return (( 0 == cell || 0 == cell->
param()) ? 0 : cell ) ;
558 dinsVec.reserve(
m_dins.size() );
565 dVec.push_back( *iv ) ;
576 dinsVec.push_back(
i );
583 tr = HepGeom::Translate3D( gp.x(), gp.y(), gp.z() ) ;
586 const CLHEP::Hep3Vector
tt ( tr.getTranslation() ) ;
587 tVec.push_back(
tt.x() ) ;
588 tVec.push_back(
tt.y() ) ;
589 tVec.push_back(
tt.z() ) ;
592 const CLHEP::HepRotation
rr ( tr.getRotation() ) ;
593 const ROOT::Math::Transform3D rtr (
rr.xx(),
rr.xy(),
rr.xz(),
tt.x(),
595 rr.zx(),
rr.zy(),
rr.zz(),
tt.z() ) ;
597 rtr.GetRotation( ea ) ;
598 tVec.push_back( ea.Phi() ) ;
599 tVec.push_back( ea.Theta() ) ;
600 tVec.push_back( ea.Psi() ) ;
605 unsigned int ishape ( 9999 ) ;
606 for(
unsigned int ivv ( 0 ) ; ivv !=
parVecVec().size() ; ++ivv )
612 ok = ok && ( fabs( par[
k] - pv[
k] ) < 1.e-6 ) ;
620 assert( 9999 != ishape ) ;
624 if( iVec.size() < nn ) iVec.push_back( ishape ) ;
static unsigned int numberOfBarrelAlignments()
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
edm::AtomicPtrCache< std::vector< DetId > > m_heIds
static unsigned int alignmentEndcapIndexLocal(const DetId &id)
HcalSubdetector subdet() const
get the subdetector
virtual void getSummary(CaloSubdetectorGeometry::TrVec &trVector, CaloSubdetectorGeometry::IVec &iVector, CaloSubdetectorGeometry::DimVec &dimVector, CaloSubdetectorGeometry::IVec &dinsVector) const
CaloTopology const * topology(0)
static DetId detIdFromOuterAlignmentIndex(unsigned int i)
Geom::Phi< T > phi() const
std::vector< unsigned int > IVec
edm::AtomicPtrCache< std::vector< DetId > > m_emptyIds
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
CaloCellGeometry::Pt3DVec Pt3DVec
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)
double deltaR2(const T1 &t1, const T2 &t2)
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[]
bool set(std::unique_ptr< T > iNewValue) const
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
CaloCellGeometry::Tr3D Tr3D
MgrType::const_iterator const_iterator
virtual unsigned int numberOfShapes() const
edm::AtomicPtrCache< std::vector< DetId > > m_hfIds
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
edm::AtomicPtrCache< std::vector< DetId > > m_hoIds
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
edm::AtomicPtrCache< std::vector< DetId > > m_hbIds
static unsigned int numberOfAlignments()
virtual unsigned int ncells() const
return a count of valid cells (for dense indexing use)