From e2af6f5eae44a2847685a579dafe21c1774bab65 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Fri, 17 Jan 2014 09:12:43 +0100 Subject: [PATCH] Fix for ensuring backward compatibility --- .../interface/HcalCalibrationWidthsSet.h | 13 +- .../interface/HcalCalibrationsSet.h | 13 +- .../src/HcalCalibrationWidthsSet.cc | 14 +- .../HcalObjects/src/HcalCalibrationsSet.cc | 5 +- .../interface/HcalCondObjectContainer.h | 11 +- .../HcalObjects/src/HcalCholeskyMatrices.cc | 12 +- .../HcalObjects/src/HcalCovarianceMatrices.cc | 14 +- DataFormats/ForwardDetId/interface/CFCDetId.h | 8 +- .../interface/ForwardSubdetector.h | 2 +- .../ForwardDetId/interface/HGCEEDetId.h | 42 +++ .../ForwardDetId/interface/HGCHEDetId.h | 43 +++ DataFormats/ForwardDetId/src/CFCDetId.cc | 9 +- DataFormats/ForwardDetId/src/HGCEEDetId.cc | 48 +++ DataFormats/ForwardDetId/src/HGCHEDetId.cc | 48 +++ DataFormats/ForwardDetId/src/classes.h | 2 + DataFormats/ForwardDetId/src/classes_def.xml | 6 + DataFormats/HcalDetId/interface/HcalDetId.h | 4 + .../HcalDetId/interface/HcalZDCDetId.h | 10 +- DataFormats/HcalDetId/src/HcalDetId.cc | 82 ++++- DataFormats/HcalDetId/src/HcalZDCDetId.cc | 107 +++++- .../python/ecalhcalGeometryXML_cfi.py | 1 + Geometry/HGCalCommonData/data/cfc.xml | 126 +++++++ .../data/Phase0/hcalRecNumbering.xml | 2 +- .../HcalCommonData/data/Phase0/hcalsens.xml | 15 + .../HcalCommonData/data/Phase0/hcalsenspm.xml | 15 + .../data/Phase0/hcalsenspmf.xml | 19 ++ .../data/PhaseI/hcalRecNumbering.xml | 2 +- .../data/PhaseII/NoHE/hcalRecNumbering.xml | 1 + .../data/PhaseII/hcalRecNumbering.xml | 2 +- .../data/PhaseII/hcalRecNumberingEta4.xml | 164 +++++++++ .../data/PhaseII/hcalSimNumberingEta4.xml | 313 ++++++++++++++++++ Geometry/HcalCommonData/data/hcalsenspm.xml | 1 + Geometry/HcalCommonData/data/hcalsenspmf.xml | 1 + 33 files changed, 1099 insertions(+), 56 deletions(-) create mode 100644 DataFormats/ForwardDetId/interface/HGCEEDetId.h create mode 100644 DataFormats/ForwardDetId/interface/HGCHEDetId.h create mode 100644 DataFormats/ForwardDetId/src/HGCEEDetId.cc create mode 100644 DataFormats/ForwardDetId/src/HGCHEDetId.cc create mode 100644 Geometry/HGCalCommonData/data/cfc.xml create mode 100644 Geometry/HcalCommonData/data/Phase0/hcalsens.xml create mode 100644 Geometry/HcalCommonData/data/Phase0/hcalsenspm.xml create mode 100644 Geometry/HcalCommonData/data/Phase0/hcalsenspmf.xml create mode 100644 Geometry/HcalCommonData/data/PhaseII/hcalRecNumberingEta4.xml create mode 100644 Geometry/HcalCommonData/data/PhaseII/hcalSimNumberingEta4.xml diff --git a/CalibFormats/HcalObjects/interface/HcalCalibrationWidthsSet.h b/CalibFormats/HcalObjects/interface/HcalCalibrationWidthsSet.h index 57eb04dfa2229..b3c91bc937ddd 100644 --- a/CalibFormats/HcalObjects/interface/HcalCalibrationWidthsSet.h +++ b/CalibFormats/HcalObjects/interface/HcalCalibrationWidthsSet.h @@ -3,6 +3,7 @@ #include "CalibFormats/HcalObjects/interface/HcalCalibrationWidths.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" +#include "DataFormats/HcalDetId/interface/HcalZDCDetId.h" #include /** \class HcalCalibrationWidthsSet @@ -20,7 +21,17 @@ class HcalCalibrationWidthsSet { void clear(); private: struct CalibWidthSetObject { - CalibWidthSetObject(const DetId& aid) : id(aid) { } + CalibWidthSetObject(const DetId& aid) { + if (aid.det()==DetId::Hcal) { + HcalDetId hcid(aid); + id = HcalDetId(hcid.subdet(),hcid.ieta(),hcid.iphi(),hcid.depth()); + } else if (aid.det()==DetId::Calo && aid.subdetId()==HcalZDCDetId::SubdetectorId) { + HcalZDCDetId hcid(aid); + id = HcalZDCDetId(hcid.section(),(hcid.zside()>0),hcid.channel()); + } else { + id = aid; + } + } DetId id; HcalCalibrationWidths calib; bool operator<(const CalibWidthSetObject& cso) const { return id < cso.id; } diff --git a/CalibFormats/HcalObjects/interface/HcalCalibrationsSet.h b/CalibFormats/HcalObjects/interface/HcalCalibrationsSet.h index 6e95779d809d7..38c47e36de755 100644 --- a/CalibFormats/HcalObjects/interface/HcalCalibrationsSet.h +++ b/CalibFormats/HcalObjects/interface/HcalCalibrationsSet.h @@ -3,6 +3,7 @@ #include "CalibFormats/HcalObjects/interface/HcalCalibrations.h" #include "DataFormats/HcalDetId/interface/HcalDetId.h" +#include "DataFormats/HcalDetId/interface/HcalZDCDetId.h" #include /** \class HcalCalibrationsSet @@ -20,7 +21,17 @@ class HcalCalibrationsSet { void clear(); private: struct CalibSetObject { - CalibSetObject(const DetId& aid) : id(aid) { } + CalibSetObject(const DetId& aid) { + if (aid.det()==DetId::Hcal) { + HcalDetId hcid(aid); + id = HcalDetId(hcid.subdet(),hcid.ieta(),hcid.iphi(),hcid.depth()); + } else if (aid.det()==DetId::Calo && aid.subdetId()==HcalZDCDetId::SubdetectorId) { + HcalZDCDetId hcid(aid); + id = HcalZDCDetId(hcid.section(),(hcid.zside()>0),hcid.channel()); + } else { + id = aid; + } + } DetId id; HcalCalibrations calib; bool operator<(const CalibSetObject& cso) const { return id < cso.id; } diff --git a/CalibFormats/HcalObjects/src/HcalCalibrationWidthsSet.cc b/CalibFormats/HcalObjects/src/HcalCalibrationWidthsSet.cc index ebc75efa785f9..e651856f35576 100644 --- a/CalibFormats/HcalObjects/src/HcalCalibrationWidthsSet.cc +++ b/CalibFormats/HcalObjects/src/HcalCalibrationWidthsSet.cc @@ -1,5 +1,7 @@ #include "CalibFormats/HcalObjects/interface/HcalCalibrationWidthsSet.h" #include "DataFormats/HcalDetId/interface/HcalGenericDetId.h" +#include "DataFormats/HcalDetId/interface/HcalDetId.h" +#include "DataFormats/HcalDetId/interface/HcalZDCDetId.h" #include "FWCore/Utilities/interface/Exception.h" #include #include @@ -17,18 +19,22 @@ const HcalCalibrationWidths& HcalCalibrationWidthsSet::getCalibrationWidths(cons else { cell = std::find(mItems.begin(),mItems.end(), target); } - if (cell == mItems.end() || cell->id != fId) + if (cell == mItems.end() || + ((fId.det()==DetId::Hcal && HcalDetId(cell->id) != HcalDetId(fId)) || + (fId.det()==DetId::Calo && fId.subdetId()==HcalZDCDetId::SubdetectorId && HcalZDCDetId(cell->id) != HcalZDCDetId(fId)) || + (fId.det()!=DetId::Hcal && (fId.det()==DetId::Calo && fId.subdetId()!=HcalZDCDetId::SubdetectorId) && (cell->id != fId)))) throw cms::Exception ("Conditions not found") << "Unavailable HcalCalibrationWidths for cell " << HcalGenericDetId(fId); return cell->calib; } void HcalCalibrationWidthsSet::setCalibrationWidths(DetId fId, const HcalCalibrationWidths& ca) { + Item target(fId); sorted_=false; - std::vector::iterator cell=std::find(mItems.begin(),mItems.end(),Item(fId)); //slow, but guaranteed + std::vector::iterator cell=std::find(mItems.begin(),mItems.end(),target); //slow, but guaranteed if (cell==mItems.end()) { - mItems.push_back(Item(fId)); - mItems.at(mItems.size()-1).calib=ca; + target.calib=ca; + mItems.push_back(target); return; } cell->calib=ca; diff --git a/CalibFormats/HcalObjects/src/HcalCalibrationsSet.cc b/CalibFormats/HcalObjects/src/HcalCalibrationsSet.cc index 0b06a04c2a7d8..a08aac56184b2 100644 --- a/CalibFormats/HcalObjects/src/HcalCalibrationsSet.cc +++ b/CalibFormats/HcalObjects/src/HcalCalibrationsSet.cc @@ -17,7 +17,10 @@ const HcalCalibrations& HcalCalibrationsSet::getCalibrations(const DetId fId) co else { cell = std::find(mItems.begin(),mItems.end(), target); } - if (cell == mItems.end() || cell->id != fId) + if (cell == mItems.end() || + ((fId.det()==DetId::Hcal && HcalDetId(cell->id) != HcalDetId(fId)) || + (fId.det()==DetId::Calo && fId.subdetId()==HcalZDCDetId::SubdetectorId && HcalZDCDetId(cell->id) != HcalZDCDetId(fId)) || + (fId.det()!=DetId::Hcal && (fId.det()==DetId::Calo && fId.subdetId()!=HcalZDCDetId::SubdetectorId) && (cell->id != fId)))) throw cms::Exception ("Conditions not found") << "Unavailable HcalCalibrations for cell " << HcalGenericDetId(fId); return cell->calib; } diff --git a/CondFormats/HcalObjects/interface/HcalCondObjectContainer.h b/CondFormats/HcalObjects/interface/HcalCondObjectContainer.h index 4c906e64277e4..7a8c48241495a 100644 --- a/CondFormats/HcalObjects/interface/HcalCondObjectContainer.h +++ b/CondFormats/HcalObjects/interface/HcalCondObjectContainer.h @@ -2,6 +2,7 @@ #define HcalCondObjectContainer_h #include +#include #include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "DataFormats/HcalDetId/interface/HcalOtherDetId.h" #include "DataFormats/HcalDetId/interface/HcalCastorDetId.h" @@ -123,7 +124,6 @@ template const Item* HcalCondObjectContainer::getValues(DetId fId, bool throwOnFail) const { unsigned int index=indexFor(fId); - const Item* cell = NULL; if (index<0xFFFFFFFu) { @@ -147,7 +147,6 @@ HcalCondObjectContainer::getValues(DetId fId, bool throwOnFail) const } } } - // Item emptyItem; // if (cell->rawId() == emptyItem.rawId() ) if ((!cell)) { @@ -155,7 +154,9 @@ HcalCondObjectContainer::getValues(DetId fId, bool throwOnFail) const throw cms::Exception ("Conditions not found") << "Unavailable Conditions of type " << myname() << " for cell " << textForId(fId); } - } else if (cell->rawId() != fId) { + } else if ((fId.det()==DetId::Hcal && HcalDetId(cell->rawId()) != HcalDetId(fId)) || + (fId.det()==DetId::Calo && fId.subdetId()==HcalZDCDetId::SubdetectorId && HcalZDCDetId(cell->rawId()) != HcalZDCDetId(fId)) || + (fId.det()!=DetId::Hcal && (fId.det()==DetId::Calo && fId.subdetId()!=HcalZDCDetId::SubdetectorId) && (cell->rawId() != fId))) { if (throwOnFail) { throw cms::Exception ("Conditions mismatch") << "Requested conditions of type " << myname() << " for cell " << textForId(fId) << " got conditions for cell " << textForId(DetId(cell->rawId())); @@ -172,7 +173,9 @@ HcalCondObjectContainer::exists(DetId fId) const const Item* cell = getValues(fId,false); if (cell) - if (cell->rawId() == fId ) + if ((fId.det()==DetId::Hcal && HcalDetId(cell->rawId()) == HcalDetId(fId)) || + (fId.det()==DetId::Calo && fId.subdetId()==HcalZDCDetId::SubdetectorId && HcalZDCDetId(cell->rawId()) == HcalZDCDetId(fId)) || + (fId.det()!=DetId::Hcal && (fId.det()==DetId::Calo && fId.subdetId()!=HcalZDCDetId::SubdetectorId) && (cell->rawId() == fId))) return true; return false; diff --git a/CondFormats/HcalObjects/src/HcalCholeskyMatrices.cc b/CondFormats/HcalObjects/src/HcalCholeskyMatrices.cc index d152415d76358..2d4c57fc554d8 100644 --- a/CondFormats/HcalObjects/src/HcalCholeskyMatrices.cc +++ b/CondFormats/HcalObjects/src/HcalCholeskyMatrices.cc @@ -44,9 +44,12 @@ HcalCholeskyMatrices::getValues(DetId fId, bool throwOnFail) const // HcalCholeskyMatrix emptyHcalCholeskyMatrix; // if (cell->rawId() == emptyHcalCholeskyMatrix.rawId() ) - if ((!cell) || (cell->rawId() != fId ) ) { + if ((!cell) || + (fId.det()==DetId::Hcal && HcalDetId(cell->rawId()) != HcalDetId(fId)) || + (fId.det()==DetId::Calo && fId.subdetId()==HcalZDCDetId::SubdetectorId && HcalZDCDetId(cell->rawId()) != HcalZDCDetId(fId)) || + (fId.det()!=DetId::Hcal && (fId.det()==DetId::Calo && fId.subdetId()!=HcalZDCDetId::SubdetectorId) && (cell->rawId() != fId))) { if (throwOnFail) { - throw cms::Exception ("Conditions not found") + throw cms::Exception ("Conditions not found") << "Unavailable Conditions of type " << myname() << " for cell " << fId.rawId(); } else { cell=0; @@ -63,8 +66,9 @@ HcalCholeskyMatrices::exists(DetId fId) const // HcalCholeskyMatrix emptyHcalCholeskyMatrix; if (cell) - // if (cell->rawId() != emptyHcalCholeskyMatrix.rawId() ) - if (cell->rawId() == fId ) + if ((fId.det()==DetId::Hcal && HcalDetId(cell->rawId()) == HcalDetId(fId)) || + (fId.det()==DetId::Calo && fId.subdetId()==HcalZDCDetId::SubdetectorId && HcalZDCDetId(cell->rawId()) == HcalZDCDetId(fId)) || + (fId.det()!=DetId::Hcal && (fId.det()==DetId::Calo && fId.subdetId()!=HcalZDCDetId::SubdetectorId) && (cell->rawId() == fId))) return true; return false; diff --git a/CondFormats/HcalObjects/src/HcalCovarianceMatrices.cc b/CondFormats/HcalObjects/src/HcalCovarianceMatrices.cc index bcc80055094e0..aa9cd98564a8f 100644 --- a/CondFormats/HcalObjects/src/HcalCovarianceMatrices.cc +++ b/CondFormats/HcalObjects/src/HcalCovarianceMatrices.cc @@ -24,7 +24,7 @@ HcalCovarianceMatrices::initContainer(DetId fId) case(HcalForward) : for (unsigned int i=0; irawId() == emptyHcalCovarianceMatrix.rawId() ) - if ((!cell) || (cell->rawId() != fId ) ) { + if ((!cell) || + (fId.det()==DetId::Hcal && HcalDetId(cell->rawId()) != HcalDetId(fId)) || + (fId.det()==DetId::Calo && fId.subdetId()==HcalZDCDetId::SubdetectorId && HcalZDCDetId(cell->rawId()) != HcalZDCDetId(fId)) || + (fId.det()!=DetId::Hcal && (fId.det()==DetId::Calo && fId.subdetId()!=HcalZDCDetId::SubdetectorId) && (cell->rawId() != fId))) { if (throwOnFail) { - throw cms::Exception ("Conditions not found") + throw cms::Exception ("Conditions not found") << "Unavailable Conditions of type " << myname() << " for cell " << fId.rawId(); } else { cell=0; @@ -68,8 +71,9 @@ HcalCovarianceMatrices::exists(DetId fId) const // HcalCovarianceMatrix emptyHcalCovarianceMatrix; if (cell) - // if (cell->rawId() != emptyHcalCovarianceMatrix.rawId() ) - if (cell->rawId() == fId ) + if ((fId.det()==DetId::Hcal && HcalDetId(cell->rawId()) == HcalDetId(fId)) || + (fId.det()==DetId::Calo && fId.subdetId()==HcalZDCDetId::SubdetectorId && HcalZDCDetId(cell->rawId()) == HcalZDCDetId(fId)) || + (fId.det()!=DetId::Hcal && (fId.det()==DetId::Calo && fId.subdetId()!=HcalZDCDetId::SubdetectorId) && (cell->rawId() == fId))) return true; return false; diff --git a/DataFormats/ForwardDetId/interface/CFCDetId.h b/DataFormats/ForwardDetId/interface/CFCDetId.h index 05283acb17989..a9c5dd78af8de 100644 --- a/DataFormats/ForwardDetId/interface/CFCDetId.h +++ b/DataFormats/ForwardDetId/interface/CFCDetId.h @@ -12,8 +12,8 @@ class CFCDetId : public DetId { CFCDetId(); /** Create cellid from raw id (0=invalid tower id) */ CFCDetId(uint32_t rawid); - /** Constructor from subdetector, signed ieta,iphi and depth */ - CFCDetId(ForwardSubdetector subdet, int ieta, int iphi, int depth); + /** Constructor from subdetector, signed ieta,iphi, depth and type */ + CFCDetId(ForwardSubdetector subdet, int ieta, int iphi, int depth, int type); /** Constructor from a generic cell id */ CFCDetId(const DetId& id); /** Assignment from a generic cell id */ @@ -30,7 +30,9 @@ class CFCDetId : public DetId { /// get the cell iphi int iphi() const { return id_&0x3FF; } /// get the tower depth - int depth() const { return (id_>>20)&0xF; } + int depth() const { return (id_>>21)&0x7; } + /// get the fibre type + int type() const { return (id_>>20)&0x1; } static const CFCDetId Undefined; diff --git a/DataFormats/ForwardDetId/interface/ForwardSubdetector.h b/DataFormats/ForwardDetId/interface/ForwardSubdetector.h index f1b0b3c4853b7..83af7f8b91048 100644 --- a/DataFormats/ForwardDetId/interface/ForwardSubdetector.h +++ b/DataFormats/ForwardDetId/interface/ForwardSubdetector.h @@ -1,6 +1,6 @@ #ifndef DataFormats_ForwardDetId_ForwardSubDetector_H #define DataFormats_ForwardDetId_ForwardSubDetector_H 1 -enum ForwardSubdetector { ForwardEmpty=0, ForwardCFC=1, ForwardBHM=2}; +enum ForwardSubdetector { ForwardEmpty=0, ForwardCFC=1, ForwardBHM=2, HGCEE=3, HGCHE=4}; #endif diff --git a/DataFormats/ForwardDetId/interface/HGCEEDetId.h b/DataFormats/ForwardDetId/interface/HGCEEDetId.h new file mode 100644 index 0000000000000..4f8c2f20096e6 --- /dev/null +++ b/DataFormats/ForwardDetId/interface/HGCEEDetId.h @@ -0,0 +1,42 @@ +#ifndef DataFormats_ForwardDetId_HGCEEDetId_H +#define DataFormats_ForwardDetId_HGCEEDetId_H 1 + +#include +#include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h" + + +class HGCEEDetId : public DetId { +public: + enum { Subdet=HGCEE}; + /** Create a null cellid*/ + HGCEEDetId(); + /** Create cellid from raw id (0=invalid tower id) */ + HGCEEDetId(uint32_t rawid); + /** Constructor from subdetector, zplus, layer, module, cell numbers */ + HGCEEDetId(ForwardSubdetector subdet, int zp, int lay, int mod, + int cellx, int celly); + /** Constructor from a generic cell id */ + HGCEEDetId(const DetId& id); + /** Assignment from a generic cell id */ + HGCEEDetId& operator=(const DetId& id); + + /// get the subdetector + ForwardSubdetector subdet() const { return HGCEE; } + /// get the z-side of the cell (1/-1) + int zside() const { return (id_&0x1000000)?(1):(-1); } + /// get the absolute value of the cell #'s in x and y + int cellX() const { return (id_>>6)&0x3F; } + int cellY() const { return id_&0x3F; } + /// get the module # + int module() const { return (id_>>12)&0x3F; } + /// get the layer # + int layer() const { return (id_>>18)&0x3F; } + + static const HGCEEDetId Undefined; + +}; + +std::ostream& operator<<(std::ostream&,const HGCEEDetId& id); + +#endif diff --git a/DataFormats/ForwardDetId/interface/HGCHEDetId.h b/DataFormats/ForwardDetId/interface/HGCHEDetId.h new file mode 100644 index 0000000000000..91e3425565009 --- /dev/null +++ b/DataFormats/ForwardDetId/interface/HGCHEDetId.h @@ -0,0 +1,43 @@ +#ifndef DataFormats_ForwardDetId_HGCHEDetId_H +#define DataFormats_ForwardDetId_HGCHEDetId_H 1 + +#include +#include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h" + + +class HGCHEDetId : public DetId { +public: + enum { Subdet=HGCHE}; + /** Create a null cellid*/ + HGCHEDetId(); + /** Create cellid from raw id (0=invalid tower id) */ + HGCHEDetId(uint32_t rawid); + /** Constructor from subdetector, zplus, layer, module, cell numbers */ + HGCHEDetId(ForwardSubdetector subdet, int zp, int lay, int mod, + int cellx, int celly); + /** Constructor from a generic cell id */ + HGCHEDetId(const DetId& id); + /** Assignment from a generic cell id */ + HGCHEDetId& operator=(const DetId& id); + + /// get the subdetector + ForwardSubdetector subdet() const { return HGCHE; } + /// get the z-side of the cell (1/-1) + int zside() const { return (id_&0x1000000)?(1):(-1); } + /// get the absolute value of the cell #'s in x and y + int cellX() const { return (id_>>6)&0x3F; } + int cellY() const { return id_&0x3F; } + /// get the module # + int module() const { return (id_>>12)&0x3F; } + /// get the layer # + int layer() const { return (id_>>18)&0x3F; } + + static const HGCHEDetId Undefined; + +}; + +std::ostream& operator<<(std::ostream&,const HGCHEDetId& id); + +#endif + diff --git a/DataFormats/ForwardDetId/src/CFCDetId.cc b/DataFormats/ForwardDetId/src/CFCDetId.cc index 672044b0b2339..2baf0f4c5e14d 100644 --- a/DataFormats/ForwardDetId/src/CFCDetId.cc +++ b/DataFormats/ForwardDetId/src/CFCDetId.cc @@ -2,7 +2,7 @@ #include "FWCore/Utilities/interface/Exception.h" #include -const CFCDetId CFCDetId::Undefined(ForwardEmpty,0,0,0); +const CFCDetId CFCDetId::Undefined(ForwardEmpty,0,0,0,0); CFCDetId::CFCDetId() : DetId() { } @@ -10,9 +10,10 @@ CFCDetId::CFCDetId() : DetId() { CFCDetId::CFCDetId(uint32_t rawid) : DetId(rawid) { } -CFCDetId::CFCDetId(ForwardSubdetector subdet, int ieta, int iphi, int depth) : DetId(Forward,subdet) { +CFCDetId::CFCDetId(ForwardSubdetector subdet, int ieta, int iphi, int depth, + int type) : DetId(Forward,subdet) { // (no checking at this point!) - id_ |= ((depth&0xF)<<20) | + id_ |= ((depth&0x7)<<21) | ((type&0x1)<20) | ((ieta>0)?(0x1000000|((ieta&0x3FF)<<10)):(((-ieta)&0x3FF)<<10)) | (iphi&0x3FF); } @@ -40,7 +41,7 @@ CFCDetId& CFCDetId::operator=(const DetId& gen) { std::ostream& operator<<(std::ostream& s,const CFCDetId& id) { switch (id.subdet()) { - case(ForwardCFC) : return s << "(CFC " << id.ieta() << ',' << id.iphi() << ',' << id.depth() << ')'; + case(ForwardCFC) : return s << "(CFC " << id.ieta() << ',' << id.iphi() << ',' << id.depth() << ',' << id.type() << ')'; default : return s << id.rawId(); } } diff --git a/DataFormats/ForwardDetId/src/HGCEEDetId.cc b/DataFormats/ForwardDetId/src/HGCEEDetId.cc new file mode 100644 index 0000000000000..4ccabfdec598e --- /dev/null +++ b/DataFormats/ForwardDetId/src/HGCEEDetId.cc @@ -0,0 +1,48 @@ +#include "DataFormats/ForwardDetId/interface/HGCEEDetId.h" +#include "FWCore/Utilities/interface/Exception.h" +#include + +const HGCEEDetId HGCEEDetId::Undefined(ForwardEmpty,0,0,0,0,0); + +HGCEEDetId::HGCEEDetId() : DetId() { +} + +HGCEEDetId::HGCEEDetId(uint32_t rawid) : DetId(rawid) { +} + +HGCEEDetId::HGCEEDetId(ForwardSubdetector subdet, int zp, int lay, int mod, + int cellx, int celly) : DetId(Forward,subdet) { + // (no checking at this point!) + id_ |= (((zp>0) ? 0x1000000 : 0) | ((lay&0x3F)<<18) | ((mod&0x3F)<12) | + ((cellx&0x3F)<<6) | (celly&0x3F)); +} + +HGCEEDetId::HGCEEDetId(const DetId& gen) { + if (!gen.null()) { + ForwardSubdetector subdet=(ForwardSubdetector(gen.subdetId())); + if (gen.det()!=Forward || (subdet!=HGCEE)) { + throw cms::Exception("Invalid DetId") << "Cannot initialize HGCEEDetId from " << std::hex << gen.rawId() << std::dec; + } + } + id_ = gen.rawId(); +} + +HGCEEDetId& HGCEEDetId::operator=(const DetId& gen) { + if (!gen.null()) { + ForwardSubdetector subdet=(ForwardSubdetector(gen.subdetId())); + if (gen.det()!=Forward || (subdet!=HGCEE)) { + throw cms::Exception("Invalid DetId") << "Cannot assign HGCEEDetId from " << std::hex << gen.rawId() << std::dec; + } + } + id_ = gen.rawId(); + return (*this); +} + +std::ostream& operator<<(std::ostream& s,const HGCEEDetId& id) { + switch (id.subdet()) { + case(HGCEE) : return s << "(HGCEE " << id.zside() << ',' << id.layer() << ',' << id.module() << ',' << id.cellX() << ',' << id.cellY() << ')'; + default : return s << id.rawId(); + } +} + + diff --git a/DataFormats/ForwardDetId/src/HGCHEDetId.cc b/DataFormats/ForwardDetId/src/HGCHEDetId.cc new file mode 100644 index 0000000000000..41519edd19988 --- /dev/null +++ b/DataFormats/ForwardDetId/src/HGCHEDetId.cc @@ -0,0 +1,48 @@ +#include "DataFormats/ForwardDetId/interface/HGCHEDetId.h" +#include "FWCore/Utilities/interface/Exception.h" +#include + +const HGCHEDetId HGCHEDetId::Undefined(ForwardEmpty,0,0,0,0,0); + +HGCHEDetId::HGCHEDetId() : DetId() { +} + +HGCHEDetId::HGCHEDetId(uint32_t rawid) : DetId(rawid) { +} + +HGCHEDetId::HGCHEDetId(ForwardSubdetector subdet, int zp, int lay, int mod, + int cellx, int celly) : DetId(Forward,subdet) { + // (no checking at this point!) + id_ |= (((zp>0) ? 0x1000000 : 0) | ((lay&0x3F)<<18) | ((mod&0x3F)<12) | + ((cellx&0x3F)<<6) | (celly&0x3F)); +} + +HGCHEDetId::HGCHEDetId(const DetId& gen) { + if (!gen.null()) { + ForwardSubdetector subdet=(ForwardSubdetector(gen.subdetId())); + if (gen.det()!=Forward || (subdet!=HGCHE)) { + throw cms::Exception("Invalid DetId") << "Cannot initialize HGCHEDetId from " << std::hex << gen.rawId() << std::dec; + } + } + id_ = gen.rawId(); +} + +HGCHEDetId& HGCHEDetId::operator=(const DetId& gen) { + if (!gen.null()) { + ForwardSubdetector subdet=(ForwardSubdetector(gen.subdetId())); + if (gen.det()!=Forward || (subdet!=HGCHE)) { + throw cms::Exception("Invalid DetId") << "Cannot assign HGCHEDetId from " << std::hex << gen.rawId() << std::dec; + } + } + id_ = gen.rawId(); + return (*this); +} + +std::ostream& operator<<(std::ostream& s,const HGCHEDetId& id) { + switch (id.subdet()) { + case(HGCHE) : return s << "(HGCHE " << id.zside() << ',' << id.layer() << ',' << id.module() << ',' << id.cellX() << ',' << id.cellY() << ')'; + default : return s << id.rawId(); + } +} + + diff --git a/DataFormats/ForwardDetId/src/classes.h b/DataFormats/ForwardDetId/src/classes.h index c22f033139801..defa6428e5617 100644 --- a/DataFormats/ForwardDetId/src/classes.h +++ b/DataFormats/ForwardDetId/src/classes.h @@ -1,4 +1,6 @@ #include #include "DataFormats/ForwardDetId/interface/CFCDetId.h" +#include "DataFormats/ForwardDetId/interface/HGCEEDetId.h" +#include "DataFormats/ForwardDetId/interface/HGCHEDetId.h" diff --git a/DataFormats/ForwardDetId/src/classes_def.xml b/DataFormats/ForwardDetId/src/classes_def.xml index ad6226a817ce6..af12be16278b7 100644 --- a/DataFormats/ForwardDetId/src/classes_def.xml +++ b/DataFormats/ForwardDetId/src/classes_def.xml @@ -2,4 +2,10 @@ + + + + + + diff --git a/DataFormats/HcalDetId/interface/HcalDetId.h b/DataFormats/HcalDetId/interface/HcalDetId.h index b3cfee802a3ea..47e0c95c22d76 100644 --- a/DataFormats/HcalDetId/interface/HcalDetId.h +++ b/DataFormats/HcalDetId/interface/HcalDetId.h @@ -27,6 +27,10 @@ class HcalDetId : public DetId { HcalDetId(const DetId& id); /** Assignment from a generic cell id */ HcalDetId& operator=(const DetId& id); + /** Comparison operator */ + bool operator==(DetId id) const; + bool operator!=(DetId id) const; + bool operator<(DetId id) const; /// get the subdetector HcalSubdetector subdet() const { return (HcalSubdetector)(subdetId()); } diff --git a/DataFormats/HcalDetId/interface/HcalZDCDetId.h b/DataFormats/HcalDetId/interface/HcalZDCDetId.h index f414a34e04afc..c20d629e87b62 100644 --- a/DataFormats/HcalDetId/interface/HcalZDCDetId.h +++ b/DataFormats/HcalDetId/interface/HcalZDCDetId.h @@ -31,6 +31,10 @@ class HcalZDCDetId : public DetId { HcalZDCDetId(const DetId& id); /** Assignment from a generic cell id */ HcalZDCDetId& operator=(const DetId& id); + /** Comparison operator */ + bool operator==(DetId id) const; + bool operator!=(DetId id) const; + bool operator<(DetId id) const; /// get the z-side of the cell (1/-1) int zside() const; @@ -54,12 +58,12 @@ class HcalZDCDetId : public DetId { enum { kDepEM = 5, kDepHAD = 4, kDepLUM = 2, - kDepRPD = 16, - kDepTot = kDepEM + kDepHAD + kDepLUM + kDepRPD }; + kDepRPD = 12, + kDepTot = kDepEM + kDepHAD + kDepLUM }; public: - enum { kSizeForDenseIndexing = 2*kDepTot } ; + enum { kSizeForDenseIndexing = 2*kDepTot + 2*kDepRPD }; }; diff --git a/DataFormats/HcalDetId/src/HcalDetId.cc b/DataFormats/HcalDetId/src/HcalDetId.cc index d486f4c107266..a2bf0b637db0c 100644 --- a/DataFormats/HcalDetId/src/HcalDetId.cc +++ b/DataFormats/HcalDetId/src/HcalDetId.cc @@ -1,6 +1,6 @@ #include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "FWCore/Utilities/interface/Exception.h" -#include +#include const HcalDetId HcalDetId::Undefined(HcalEmpty,0,0,0); @@ -28,7 +28,8 @@ HcalDetId::HcalDetId(const DetId& gen) { HcalSubdetector subdet=(HcalSubdetector(gen.subdetId())); if (gen.det()!=Hcal || (subdet!=HcalBarrel && subdet!=HcalEndcap && - subdet!=HcalOuter && subdet!=HcalForward )) { + subdet!=HcalOuter && subdet!=HcalForward && + subdet!=HcalTriggerTower && subdet!=HcalOther)) { throw cms::Exception("Invalid DetId") << "Cannot initialize HcalDetId from " << std::hex << gen.rawId() << std::dec; } } @@ -40,15 +41,84 @@ HcalDetId& HcalDetId::operator=(const DetId& gen) { HcalSubdetector subdet=(HcalSubdetector(gen.subdetId())); if (gen.det()!=Hcal || (subdet!=HcalBarrel && subdet!=HcalEndcap && - subdet!=HcalOuter && subdet!=HcalForward )) - { - throw cms::Exception("Invalid DetId") << "Cannot assign HcalDetId from " << std::hex << gen.rawId() << std::dec; - } + subdet!=HcalOuter && subdet!=HcalForward && + subdet!=HcalTriggerTower && subdet!=HcalOther)) { + throw cms::Exception("Invalid DetId") << "Cannot assign HcalDetId from " << std::hex << gen.rawId() << std::dec; + } } id_=gen.rawId(); return (*this); } +bool HcalDetId::operator==(DetId gen) const { + uint32_t rawid = gen.rawId(); + if (rawid == id_) return true; + int zsid, eta, phi, dep; + if ((rawid&0x1000000)==0) { + zsid = (rawid&0x2000)?(1):(-1); + eta = (rawid>>7)&0x3F; + phi = rawid&0x7F; + dep = (rawid>>14)&0x1F; + } else { + zsid = (rawid&0x800000)?(1):(-1); + eta = (rawid>>10)&0x1FF; + phi = rawid&0x3FF; + dep = (rawid>>19)&0xF; + } + bool result=(zsid==zside() && eta==ietaAbs() && phi==iphi() && dep==depth()); + return result; +} + +bool HcalDetId::operator!=(DetId gen) const { + uint32_t rawid = gen.rawId(); + if (rawid == id_) return false; + int zsid, eta, phi, dep; + if ((rawid&0x1000000)==0) { + zsid = (rawid&0x2000)?(1):(-1); + eta = (rawid>>7)&0x3F; + phi = rawid&0x7F; + dep = (rawid>>14)&0x1F; + } else { + zsid = (rawid&0x800000)?(1):(-1); + eta = (rawid>>10)&0x1FF; + phi = rawid&0x3FF; + dep = (rawid>>19)&0xF; + } + bool result=(zsid!=zside() || eta!=ietaAbs() || phi!=iphi() || dep!=depth()); + return result; +} + +bool HcalDetId::operator<(DetId gen) const { + uint32_t rawid = gen.rawId(); + if ((rawid&0x1000000)==(id_&0x1000000)) { + return id_>7)&0x3F; + phi = rawid&0x7F; + dep = (rawid>>14)&0x1F; + } else { + zsid = (rawid&0x800000)?(1):(-1); + eta = (rawid>>10)&0x1FF; + phi = rawid&0x3FF; + dep = (rawid>>19)&0xF; + } + rawid = 0; + if ((id_&0x1000000) == 0) { + rawid |= ((dep&0x1F)<<14) | + ((zsid>0)?(0x2000|((eta&0x3F)<<7)):((eta&0x3F)<<7)) | + (phi&0x7F); + } else { + rawid |= (0x1000000) | ((dep&0xF)<<19) | + ((zsid>0)?(0x800000|((eta&0x1FF)<<10)):((eta&0x1FF)<<10)) | + (phi&0x3FF); + } + return (id_&0x1FFFFFF)>4)&0x3; + chn = rawid&0xF; + } else { + zsid = (rawid&0x100)?(1):(-1); + sec = (rawid>>5)&0x7; + chn = rawid&0x1F; + } + bool result = (zsid==zside() && sec==section() && chn==channel()); + return result; +} + +bool HcalZDCDetId::operator!=(DetId gen) const { + uint32_t rawid = gen.rawId(); + if (rawid == id_) return false; + int zsid, sec, chn; + if ((rawid&0x10000)==0) { + zsid = (rawid&0x40)?(1):(-1); + sec = (rawid>>4)&0x3; + chn = rawid&0xF; + } else { + zsid = (rawid&0x100)?(1):(-1); + sec = (rawid>>5)&0x7; + chn = rawid&0x1F; + } + bool result = (zsid!=zside() || sec!=section() || chn!=channel()); + return result; +} + +bool HcalZDCDetId::operator<(DetId gen) const { + uint32_t rawid = gen.rawId(); + if ((rawid&0x10000)==(id_&0x10000)) { + return id_>4)&0x3; + chn = rawid&0xF; + } else { + zsid = (rawid&0x100)?(1):(-1); + sec = (rawid>>5)&0x7; + chn = rawid&0x1F; + } + rawid = 0; + if ((id_&0x10000) == 0) { + rawid |= (sec&0x3)<<4; + if (zsid > 0) rawid |= 0x40; + rawid |= chn&0xF; + } else { + rawid |= (sec&0x7)<<5; + if (zsid > 0) rawid |= 0x100; + rawid |= chn&0x1F; + rawid |= 0x10000; + } + return (id_&0x1FFFF)= kDepTot ) ; - const uint32_t in ( di%kDepTot ) ; - const Section se ( in= 2*kDepTot) { + const bool lz ( di >= kDepTot ) ; + const uint32_t in ( di%kDepTot ) ; + const Section se ( in= 2*kDepTot+kDepRPD ) ; + const uint32_t in ((di-2*kDepTot)%kDepRPD ); + const Section se (RPD); + const uint32_t dp ( in+1 ); +// std::cout<<"HcalZDCDetID:: section: "< + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0, 0, 0 + 0.*deg, 0.*deg, 0.*deg + + + + + + + + diff --git a/Geometry/HcalCommonData/data/Phase0/hcalRecNumbering.xml b/Geometry/HcalCommonData/data/Phase0/hcalRecNumbering.xml index 82aae0aed27cf..ead02250e1b26 100644 --- a/Geometry/HcalCommonData/data/Phase0/hcalRecNumbering.xml +++ b/Geometry/HcalCommonData/data/Phase0/hcalRecNumbering.xml @@ -5,7 +5,7 @@ - + diff --git a/Geometry/HcalCommonData/data/Phase0/hcalsens.xml b/Geometry/HcalCommonData/data/Phase0/hcalsens.xml new file mode 100644 index 0000000000000..27741d06e06ef --- /dev/null +++ b/Geometry/HcalCommonData/data/Phase0/hcalsens.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/Geometry/HcalCommonData/data/Phase0/hcalsenspm.xml b/Geometry/HcalCommonData/data/Phase0/hcalsenspm.xml new file mode 100644 index 0000000000000..009c24062d3b1 --- /dev/null +++ b/Geometry/HcalCommonData/data/Phase0/hcalsenspm.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/Geometry/HcalCommonData/data/Phase0/hcalsenspmf.xml b/Geometry/HcalCommonData/data/Phase0/hcalsenspmf.xml new file mode 100644 index 0000000000000..dc1804e0f0022 --- /dev/null +++ b/Geometry/HcalCommonData/data/Phase0/hcalsenspmf.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/HcalCommonData/data/PhaseI/hcalRecNumbering.xml b/Geometry/HcalCommonData/data/PhaseI/hcalRecNumbering.xml index 95901a7ff8567..544bdafb6a94e 100644 --- a/Geometry/HcalCommonData/data/PhaseI/hcalRecNumbering.xml +++ b/Geometry/HcalCommonData/data/PhaseI/hcalRecNumbering.xml @@ -5,7 +5,7 @@ - + diff --git a/Geometry/HcalCommonData/data/PhaseII/NoHE/hcalRecNumbering.xml b/Geometry/HcalCommonData/data/PhaseII/NoHE/hcalRecNumbering.xml index ccc307f73f720..40d8e10494f00 100644 --- a/Geometry/HcalCommonData/data/PhaseII/NoHE/hcalRecNumbering.xml +++ b/Geometry/HcalCommonData/data/PhaseII/NoHE/hcalRecNumbering.xml @@ -5,6 +5,7 @@ + diff --git a/Geometry/HcalCommonData/data/PhaseII/hcalRecNumbering.xml b/Geometry/HcalCommonData/data/PhaseII/hcalRecNumbering.xml index e8b1622471ade..23843daa9cd84 100644 --- a/Geometry/HcalCommonData/data/PhaseII/hcalRecNumbering.xml +++ b/Geometry/HcalCommonData/data/PhaseII/hcalRecNumbering.xml @@ -5,7 +5,7 @@ - + diff --git a/Geometry/HcalCommonData/data/PhaseII/hcalRecNumberingEta4.xml b/Geometry/HcalCommonData/data/PhaseII/hcalRecNumberingEta4.xml new file mode 100644 index 0000000000000..40041d42e60fa --- /dev/null +++ b/Geometry/HcalCommonData/data/PhaseII/hcalRecNumberingEta4.xml @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/HcalCommonData/data/PhaseII/hcalSimNumberingEta4.xml b/Geometry/HcalCommonData/data/PhaseII/hcalSimNumberingEta4.xml new file mode 100644 index 0000000000000..d14b3f9759e5f --- /dev/null +++ b/Geometry/HcalCommonData/data/PhaseII/hcalSimNumberingEta4.xml @@ -0,0 +1,313 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/HcalCommonData/data/hcalsenspm.xml b/Geometry/HcalCommonData/data/hcalsenspm.xml index 009c24062d3b1..9b0c5d35eee40 100644 --- a/Geometry/HcalCommonData/data/hcalsenspm.xml +++ b/Geometry/HcalCommonData/data/hcalsenspm.xml @@ -7,6 +7,7 @@ + diff --git a/Geometry/HcalCommonData/data/hcalsenspmf.xml b/Geometry/HcalCommonData/data/hcalsenspmf.xml index dc1804e0f0022..0ff5219f60d29 100644 --- a/Geometry/HcalCommonData/data/hcalsenspmf.xml +++ b/Geometry/HcalCommonData/data/hcalsenspmf.xml @@ -7,6 +7,7 @@ +