6 #include <Math/Transform3D.h> 7 #include <Math/EulerAngles.h> 17 m_topology(topology), m_mergePosition(topology.getMergePositionFlag()) {
26 std::cout <<
"HcalGeometry: " <<
"HcalGeometry::init() " 41 std::unique_ptr<std::vector<DetId>> p_hbIds{
new std::vector<DetId>};
42 std::unique_ptr<std::vector<DetId>> p_heIds{
new std::vector<DetId>};
43 std::unique_ptr<std::vector<DetId>> p_hoIds{
new std::vector<DetId>};
44 std::unique_ptr<std::vector<DetId>> p_hfIds{
new std::vector<DetId>};
45 std::unique_ptr<std::vector<DetId>> p_emptyIds{
new std::vector<DetId>};
48 for (
unsigned int i ( 0 ) ;
i != baseIds.size() ; ++
i) {
51 p_hbIds->push_back(
id ) ;
53 p_heIds->push_back(
id ) ;
55 p_hoIds->push_back(
id ) ;
57 p_hfIds->push_back(
id ) ;
60 std::sort( p_hbIds->begin(), p_hbIds->end() ) ;
61 std::sort( p_heIds->begin(), p_heIds->end() ) ;
62 std::sort( p_hoIds->begin(), p_hoIds->end() ) ;
63 std::sort( p_hfIds->begin(), p_hfIds->end() ) ;
64 p_emptyIds->resize( 0 ) ;
74 const std::vector<DetId>&
89 static const double z_long=1100.0;
90 double abseta = fabs(r.
eta());
91 double absz = fabs(r.
z());
97 }
else if (absz >= z_long) {
106 int etaring =
etaRing(bc, abseta);
108 int phibin =
phiBin(bc, etaring, r.
phi());
111 int etabin = (r.
z() > 0) ? etaring : -etaring;
114 static const double z_short=1137.0;
118 HcalDetId bestId(bc,etabin,phibin,((fabs(r.
z()) - z_short >-0.1)?(2):(1)));
123 int zside = (r.
z() > 0) ? 1 : -1;
125 double pointrz(0), drz(99999.);
126 HcalDetId currentId(bc, etabin, phibin, dbin);
162 std::vector<HcalDetId> ids;
172 std::vector<HcalDetId> ids;
177 for (
unsigned int k=0;
k<4; ++
k) {
178 mcorners[
k] = mcf[
k];
179 mcorners[
k+4] = mcb[
k+4];
201 const double dR2 ( dR*dR ) ;
202 const double reta ( r.
eta() ) ;
203 const double rphi ( r.
phi() ) ;
204 const double lowEta ( reta - dR ) ;
205 const double highEta ( reta + dR ) ;
206 const double lowPhi ( rphi - dR ) ;
207 const double highPhi ( rphi + dR ) ;
211 if (highEta > -hfEtaHi &&
215 for (
unsigned int is ( 0 ) ; is != 4 ; ++is ) {
216 const int sign ( reta>0 ? 1 : -1 ) ;
217 const int ieta_center ( sign*
etaRing( hs[is], fabs( reta ) ) ) ;
218 const int ieta_lo ( ( 0 < lowEta*sign ? sign : -sign )*
etaRing( hs[is], fabs( lowEta ) ) ) ;
219 const int ieta_hi ( ( 0 < highEta*sign ? sign : -sign )*
etaRing( hs[is], fabs( highEta ) ) ) ;
220 const int iphi_lo (
phiBin( hs[is], ieta_center, lowPhi ) ) ;
221 const int iphi_hi (
phiBin( hs[is], ieta_center, highPhi ) ) ;
222 const int jphi_lo ( iphi_lo>iphi_hi ? iphi_lo - 72 : iphi_lo ) ;
223 const int jphi_hi ( iphi_hi ) ;
225 const int idep_lo ( 1 == is ? 4 : 1 ) ;
227 for (
int ieta ( ieta_lo ) ; ieta <= ieta_hi ; ++ieta) {
229 for (
int jphi ( jphi_lo ) ; jphi <= jphi_hi ; ++jphi) {
230 const int iphi ( 1 > jphi ? jphi+72 : jphi ) ;
231 for (
int idep ( idep_lo ) ; idep <= idep_hi ; ++idep ) {
232 const HcalDetId did ( hs[is], ieta, iphi, idep ) ;
237 const double eta (
p.eta() ) ;
238 const double phi (
p.phi() ) ;
254 unsigned int hxsize(0);
267 const int iphi ( 1 + (4*i)%72 ) ;
274 const int iphi ( 1 + (4*i)%72 ) ;
281 const int iphi ( 1 + (4*i)%72 ) ;
287 const int ring ( i/12 ) ;
288 const int ieta ( 0 == ring ? -11 :
291 3 == ring ? 5 : 11 ) ;
292 const int iphi ( 1 + ( i - ring*12 )*6 ) ;
313 const unsigned int iphi ( hid.
iphi() ) ;
314 const int ieta ( hid.
ieta() ) ;
315 const unsigned int index ( ( 0 < ieta ? nD/2 : 0 ) + ( iphi + 1 )%72/4 ) ;
316 assert( index < nD ) ;
334 const int ieta ( hid.
ieta() ) ;
335 const int iphi ( hid.
iphi() ) ;
336 const int ring ( ieta < -10 ? 0 :
339 ( ieta < 11 ? 3 : 4 ) ) ) ) ;
341 const unsigned int index ( 12*ring + ( iphi - 1 )/6 ) ;
391 const DetId& detId) {
399 std::cout <<
"HcalGeometry: " <<
" newCell subdet " 401 << detId.
rawId() <<
", hid " << hid <<
", din " 402 << din <<
", index " << std::endl;
411 const unsigned int index ( din
416 const unsigned int index ( din
430 const DetId& detId) {
442 const DetId& detId) {
469 return (( 0 == cell || 0 == cell->
param()) ? 0 : cell ) ;
486 dVec.push_back( *iv ) ;
495 dinsVec.push_back(
i );
499 unsigned int ishape ( 9999 ) ;
501 for(
unsigned int ivv ( 0 ) ; ivv !=
parVecVec().size() ; ++ivv ) {
505 ok = ok && ( fabs( par[
k] - pv[
k] ) < 1.e-6 ) ;
512 assert( 9999 != ishape ) ;
514 const unsigned int nn ((
numberOfShapes()==1) ? (
unsigned int)1 : m_dins.size() ) ;
515 if( iVec.size() <
nn ) iVec.push_back( ishape ) ;
521 tr = HepGeom::Translate3D(
gp.x(),
gp.y(),
gp.z() ) ;
524 const CLHEP::Hep3Vector
tt ( tr.getTranslation() ) ;
525 tVec.push_back(
tt.x() ) ;
526 tVec.push_back(
tt.y() ) ;
527 tVec.push_back(
tt.z() ) ;
529 const CLHEP::HepRotation
rr ( tr.getRotation() ) ;
530 const ROOT::Math::Transform3D rtr (
rr.xx(),
rr.xy(),
rr.xz(),
tt.x(),
534 rtr.GetRotation( ea ) ;
535 tVec.push_back( ea.Phi() ) ;
536 tVec.push_back( ea.Theta() ) ;
537 tVec.push_back( ea.Psi() ) ;
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)
const HcalDDDRecConstants * dddConstants() const
virtual unsigned int detId2denseId(const DetId &id) const
return a linear packed id
std::vector< CCGFloat > DimVec
unsigned int getHOSize() const
CaloCellGeometry::Pt3DVec Pt3DVec
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)
unsigned int getHxSize(const int type) const
static DetId detIdFromOuterAlignmentIndex(unsigned int i)
Geom::Phi< T > phi() const
const HcalTopology & m_topology
std::vector< unsigned int > IVec
edm::AtomicPtrCache< std::vector< DetId > > m_emptyIds
bool isHE(int etabin, int depth)
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 isHB(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)
HcalDetId mergedDepthDetId(const HcalDetId &id) const
CaloCellGeometry::Tr3D Tr3D
uint32_t rawId() const
get the raw id
void newCellFast(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId)
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)
int getMinDepth(const int itype, const int ieta, const int iphi, const int zside) const
virtual void getTransform(Tr3D &tr, Pt3DVec *lptr) const
--------— only needed by specific utility; overloaded when needed -—
std::vector< DetId > m_validIds
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
DetId correctId(const DetId &id) const
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)
static DetId detIdFromBarrelAlignmentIndex(unsigned int i)
void unmergeDepthDetId(const HcalDetId &id, std::vector< HcalDetId > &ids) const
CaloCellGeometry::CCGFloat CCGFloat
virtual DetId denseId2detId(unsigned int) const
return a linear packed id
int phiBin(HcalSubdetector bc, int etaring, double phi) const
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) ...
GlobalPoint getPosition(const DetId &id) const
void localCorners(Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
static unsigned int alignmentOuterIndexLocal(const DetId &id)
std::vector< IdealZPrism > HFCellVec
int iphi() const
get the cell iphi
bool incrementDepth(HcalDetId &id) const
static unsigned int numberOfEndcapAlignments()
CaloCellGeometry::Pt3D Pt3D
AlgebraicVector EulerAngles
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::CornersVec getCorners(const DetId &id) const
HepGeom::Point3D< CCGFloat > Pt3D
bool isHF(int etabin, int depth)
virtual bool valid(const DetId &id) const
std::vector< IdealObliquePrism > HBCellVec
virtual const CaloCellGeometry * cellGeomPtr(unsigned int index) const
unsigned int getHESize() const
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
CaloCellGeometry::Tr3D Tr3D
void increaseReserve(unsigned int extra)
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)
GlobalPoint getBackPosition(const DetId &id) const
HcalDetId idFront(const HcalDetId &id) const
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
bool withSpecialRBXHBHE() const
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.
unsigned int newCellImpl(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId)
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