6 #include <Math/Transform3D.h>
7 #include <Math/EulerAngles.h>
15 theTopology( topology ) {
36 std::unique_ptr<std::vector<DetId>> p_hbIds{
new std::vector<DetId>};
37 std::unique_ptr<std::vector<DetId>> p_heIds{
new std::vector<DetId>};
38 std::unique_ptr<std::vector<DetId>> p_hoIds{
new std::vector<DetId>};
39 std::unique_ptr<std::vector<DetId>> p_hfIds{
new std::vector<DetId>};
40 std::unique_ptr<std::vector<DetId>> p_emptyIds{
new std::vector<DetId>};
43 for (
unsigned int i ( 0 ) ;
i != baseIds.size() ; ++
i) {
44 const DetId id ( baseIds[
i] );
46 p_hbIds->push_back(
id ) ;
48 p_heIds->push_back(
id ) ;
50 p_hoIds->push_back(
id ) ;
52 p_hfIds->push_back(
id ) ;
55 std::sort( p_hbIds->begin(), p_hbIds->end() ) ;
56 std::sort( p_heIds->begin(), p_heIds->end() ) ;
57 std::sort( p_hoIds->begin(), p_hoIds->end() ) ;
58 std::sort( p_hfIds->begin(), p_hfIds->end() ) ;
59 p_emptyIds->resize( 0 ) ;
69 const std::vector<DetId>&
84 static const double z_long=1100.0;
85 double abseta = fabs(r.
eta());
86 double absz = fabs(r.
z());
92 }
else if (absz >= z_long) {
101 int etaring =
etaRing(bc, abseta);
103 int phibin =
phiBin(bc, etaring, r.
phi());
106 int etabin = (r.
z() > 0) ? etaring : -etaring;
109 static const double z_short=1137.0;
113 HcalDetId bestId(bc,etabin,phibin,((fabs(r.
z()) - z_short >-0.1)?(2):(1)));
119 double pointrz=0, drz=99999.;
120 HcalDetId currentId(bc, etabin, phibin, dbin);
161 const double dR2 ( dR*dR ) ;
162 const double reta ( r.
eta() ) ;
163 const double rphi ( r.
phi() ) ;
164 const double lowEta ( reta - dR ) ;
165 const double highEta ( reta + dR ) ;
166 const double lowPhi ( rphi - dR ) ;
167 const double highPhi ( rphi + dR ) ;
171 if (highEta > -hfEtaHi &&
175 for (
unsigned int is ( 0 ) ; is != 4 ; ++is ) {
176 const int sign ( reta>0 ? 1 : -1 ) ;
177 const int ieta_center ( sign*
etaRing( hs[is], fabs( reta ) ) ) ;
178 const int ieta_lo ( ( 0 < lowEta*sign ? sign : -sign )*
etaRing( hs[is], fabs( lowEta ) ) ) ;
179 const int ieta_hi ( ( 0 < highEta*sign ? sign : -sign )*
etaRing( hs[is], fabs( highEta ) ) ) ;
180 const int iphi_lo (
phiBin( hs[is], ieta_center, lowPhi ) ) ;
181 const int iphi_hi (
phiBin( hs[is], ieta_center, highPhi ) ) ;
182 const int jphi_lo ( iphi_lo>iphi_hi ? iphi_lo - 72 : iphi_lo ) ;
183 const int jphi_hi ( iphi_hi ) ;
185 const int idep_lo ( 1 == is ? 4 : 1 ) ;
187 for (
int ieta ( ieta_lo ) ; ieta <= ieta_hi ; ++ieta) {
189 for (
int jphi ( jphi_lo ) ; jphi <= jphi_hi ; ++jphi) {
190 const int iphi ( 1 > jphi ? jphi+72 : jphi ) ;
191 for (
int idep ( idep_lo ) ; idep <= idep_hi ; ++idep ) {
192 const HcalDetId did ( hs[is], ieta, iphi, idep ) ;
197 const double eta (
p.eta() ) ;
198 const double phi (
p.phi() ) ;
218 const int iphi ( 1 + (4*i)%72 ) ;
225 const int iphi ( 1 + (4*i)%72 ) ;
232 const int iphi ( 1 + (4*i)%72 ) ;
238 const int ring ( i/12 ) ;
239 const int ieta ( 0 == ring ? -11 :
242 3 == ring ? 5 : 11 ) ;
243 const int iphi ( 1 + ( i - ring*12 )*6 ) ;
264 const unsigned int iphi ( hid.
iphi() ) ;
265 const int ieta ( hid.
ieta() ) ;
266 const unsigned int index ( ( 0 < ieta ? nD/2 : 0 ) + ( iphi + 1 )%72/4 ) ;
285 const int ieta ( hid.
ieta() ) ;
286 const int iphi ( hid.
iphi() ) ;
287 const int ring ( ieta < -10 ? 0 :
290 ( ieta < 11 ? 3 : 4 ) ) ) ) ;
292 const unsigned int index ( 12*ring + ( iphi - 1 )/6 ) ;
342 const DetId& detId) {
351 << detId.
rawId() <<
", hid " << hid <<
", din "
352 << din <<
", index ";
360 const unsigned int index ( din
365 const unsigned int index ( din
395 return (( 0 == cell || 0 == cell->
param()) ? 0 : cell ) ;
411 dVec.push_back( *iv ) ;
420 dinsVec.push_back(
i );
426 tr = HepGeom::Translate3D( gp.x(), gp.y(), gp.z() ) ;
429 const CLHEP::Hep3Vector
tt ( tr.getTranslation() ) ;
430 tVec.push_back(
tt.x() ) ;
431 tVec.push_back(
tt.y() ) ;
432 tVec.push_back(
tt.z() ) ;
434 const CLHEP::HepRotation
rr ( tr.getRotation() ) ;
435 const ROOT::Math::Transform3D rtr (
rr.xx(),
rr.xy(),
rr.xz(),
tt.x(),
439 rtr.GetRotation( ea ) ;
440 tVec.push_back( ea.Phi() ) ;
441 tVec.push_back( ea.Theta() ) ;
442 tVec.push_back( ea.Psi() ) ;
447 unsigned int ishape ( 9999 ) ;
448 for(
unsigned int ivv ( 0 ) ; ivv !=
parVecVec().size() ; ++ivv ) {
452 ok = ok && ( fabs( par[
k] - pv[
k] ) < 1.e-6 ) ;
459 assert( 9999 != ishape ) ;
462 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
int phiBin(HcalSubdetector subdet, int etaRing, double phi) const
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
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 maxDepth(HcalSubdetector subdet) const
int etaRing(HcalSubdetector subdet, double eta) const
eta and phi index from eta, phi values
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
int phiBin(HcalSubdetector bc, int etaring, double phi) const
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)
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
Geom::Phi< T > phi() 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.
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)
double etaMax(HcalSubdetector subdet) const