Skip to content

Commit

Permalink
Merge pull request #3073 from bsunanda/Phase2-HE21
Browse files Browse the repository at this point in the history
Correct for HF ieta 40 and Depth 1 for Phase2 HB
  • Loading branch information
cmsbuild committed Mar 29, 2014
2 parents 92e07eb + 73b21b8 commit b770b2f
Show file tree
Hide file tree
Showing 21 changed files with 150 additions and 76 deletions.
1 change: 1 addition & 0 deletions Geometry/CaloTopology/interface/HcalTopology.h
Expand Up @@ -187,6 +187,7 @@ class HcalTopology : public CaloSubdetectorTopology {
unsigned int numberOfShapes_;

std::vector<double> etaTable, etaTableHF, dPhiTable, dPhiTableHF;
std::vector<double> phioff;
std::vector<int> unitPhi, unitPhiHF;

int topoVersion_;
Expand Down
19 changes: 16 additions & 3 deletions Geometry/CaloTopology/src/HcalTopology.cc
Expand Up @@ -68,6 +68,7 @@ HcalTopology::HcalTopology(const HcalDDDRecConstants* hcons, HcalTopologyMode::T
etaTable = hcons_->getEtaTable();
dPhiTableHF = hcons_->getPhiTableHF();
dPhiTable = hcons_->getPhiTable();
phioff = hcons_->getPhiOffs();
std::pair<int,int> ietaHF = hcons_->getEtaRange(2);
double eta = etaBinsHE_[etaBinsHE_.size()-1].etaMax;
etaHE2HF_ = firstHFRing_;
Expand Down Expand Up @@ -728,17 +729,29 @@ int HcalTopology::etaRing(HcalSubdetector bc, double abseta) const {
int HcalTopology::phiBin(HcalSubdetector bc, int etaring, double phi) const {
static const double twopi = M_PI+M_PI;
//put phi in correct range (0->2pi)
int index(0);
if (bc == HcalBarrel) {
index = (etaring-firstHBRing_);
phi -= phioff[0];
} else if (bc == HcalEndcap) {
index = (etaring-firstHBRing_);
phi -= phioff[1];
} else if (bc == HcalForward) {
index = (etaring-firstHFRing_);
if (index < (int)(dPhiTableHF.size())) {
if (unitPhiHF[index] > 2) phi -= phioff[4];
else phi -= phioff[2];
}
}
if (phi<0.0) phi += twopi;
if (phi>twopi) phi -= twopi;
int phibin(1), unit(1), index(0);
int phibin(1), unit(1);
if (bc == HcalForward) {
index = (etaring-firstHFRing_);
if (index < (int)(dPhiTableHF.size())) {
unit = unitPhiHF[index];
phibin = static_cast<int>(phi/dPhiTableHF[index])+1;
}
} else {
index = (etaring-firstHBRing_);
if (index < (int)(dPhiTable.size())) {
phibin = static_cast<int>(phi/dPhiTable[index])+1;
unit = unitPhi[index];
Expand Down
1 change: 1 addition & 0 deletions Geometry/HcalCommonData/data/NoLayer0/hcalSimNumbering.xml
Expand Up @@ -13,6 +13,7 @@
<Parameter name="phioff" value="0.0*deg"/>
<Parameter name="phioff" value="0.0*deg"/>
<Parameter name="phioff" value="10.0*deg"/>
<Parameter name="phioff" value="10.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
Expand Down
1 change: 1 addition & 0 deletions Geometry/HcalCommonData/data/Phase0/hcalSimNumbering.xml
Expand Up @@ -12,6 +12,7 @@
<Parameter name="phioff" value="0.0*deg"/>
<Parameter name="phioff" value="0.0*deg"/>
<Parameter name="phioff" value="10.0*deg"/>
<Parameter name="phioff" value="10.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
Expand Down
1 change: 1 addition & 0 deletions Geometry/HcalCommonData/data/PhaseI/hcalSimNumbering.xml
Expand Up @@ -12,6 +12,7 @@
<Parameter name="phioff" value="0.0*deg"/>
<Parameter name="phioff" value="0.0*deg"/>
<Parameter name="phioff" value="10.0*deg"/>
<Parameter name="phioff" value="10.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
Expand Down
Expand Up @@ -11,6 +11,7 @@
<Parameter name="phioff" value="0.0*deg"/>
<Parameter name="phioff" value="0.0*deg"/>
<Parameter name="phioff" value="10.0*deg"/>
<Parameter name="phioff" value="10.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
Expand Down
1 change: 1 addition & 0 deletions Geometry/HcalCommonData/data/PhaseII/hcalSimNumbering.xml
Expand Up @@ -12,6 +12,7 @@
<Parameter name="phioff" value="0.0*deg"/>
<Parameter name="phioff" value="0.0*deg"/>
<Parameter name="phioff" value="10.0*deg"/>
<Parameter name="phioff" value="10.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
Expand Down
Expand Up @@ -12,6 +12,7 @@
<Parameter name="phioff" value="0.0*deg"/>
<Parameter name="phioff" value="0.0*deg"/>
<Parameter name="phioff" value="10.0*deg"/>
<Parameter name="phioff" value="10.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
Expand Down
Expand Up @@ -12,6 +12,7 @@
<Parameter name="phioff" value="0.0*deg"/>
<Parameter name="phioff" value="0.0*deg"/>
<Parameter name="phioff" value="10.0*deg"/>
<Parameter name="phioff" value="10.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
Expand Down
1 change: 1 addition & 0 deletions Geometry/HcalCommonData/data/SLHC/hcalSimNumbering.xml
Expand Up @@ -13,6 +13,7 @@
<Parameter name="phioff" value="0.0*deg"/>
<Parameter name="phioff" value="0.0*deg"/>
<Parameter name="phioff" value="10.0*deg"/>
<Parameter name="phioff" value="10.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
Expand Down
1 change: 1 addition & 0 deletions Geometry/HcalCommonData/interface/HcalDDDRecConstants.h
Expand Up @@ -65,6 +65,7 @@ class HcalDDDRecConstants {
int getNEta() const {return nEta;}
double getPhiBin(const int i) const {return phibin[i];}
double getPhiOff(const int i) const {return phioff[i];}
std::vector<double> getPhiOffs() const {return phioff;}
std::vector<double> getPhiTable() const {return phibin;}
std::vector<double> getPhiTableHF() const {return phibinHF;}
std::string getTopoMode() const {return modeTopo;}
Expand Down
1 change: 1 addition & 0 deletions Geometry/HcalCommonData/interface/HcalDDDSimConstants.h
Expand Up @@ -48,6 +48,7 @@ class HcalDDDSimConstants {
double getPhiBin(const int i) const {return phibin[i];}
std::pair<double,double> getPhiCons(int det, int ieta);
double getPhiOff(const int i) const {return phioff[i];}
std::vector<double> getPhiOffs() const {return phioff;}
std::vector<double> getPhiTable() const {return phibin;}
std::vector<double> getPhiTableHF() const {return phitable;}
std::vector<HcalCellType> HcalCellTypes() const;
Expand Down
6 changes: 2 additions & 4 deletions Geometry/HcalCommonData/src/HcalDDDRecConstants.cc
Expand Up @@ -414,10 +414,8 @@ void HcalDDDRecConstants::loadSimConst() {
#endif

//Phi offsets for barrel and endcap & special constants
phioff.clear();
for (int i=0; i<4; ++i)
phioff.push_back(hcons->getPhiOff(i));
nOff = hcons->getNOff();
phioff = hcons->getPhiOffs();
nOff = hcons->getNOff();

//Now the depths
for (int i=0; i<nEta; ++i) {
Expand Down
8 changes: 4 additions & 4 deletions Geometry/HcalCommonData/src/HcalDDDSimConstants.cc
Expand Up @@ -78,7 +78,7 @@ HcalCellType::HcalCell HcalDDDSimConstants::cell(int idet, int zside,
} else {
fioff = phioff[2];
fibin = phitable[etaR-etaMin[2]];
if (etaR > etaMax[2]-2 ) fioff += 0.5*fibin;
if (unitPhi(fibin) > 2) fioff = phioff[4];
}
phi = fioff + (iphi - 0.5)*fibin;
dphi = 0.5*fibin;
Expand Down Expand Up @@ -292,8 +292,8 @@ std::pair<double,double> HcalDDDSimConstants::getPhiCons(int det, int ieta) {
if (det == static_cast<int>(HcalForward)) { // Forward HCal
fioff = phioff[2];
fibin = phitable[ieta-etaMin[2]];
if (ieta > etaMax[2]-2 ) { // HF double-phi
fioff += 0.5*fibin;
if (unitPhi(fibin) > 2) { // HF double-phi
fioff = phioff[4];
}
} else { // Barrel or Endcap
if (det == static_cast<int>(HcalBarrel)) {
Expand Down Expand Up @@ -526,7 +526,7 @@ void HcalDDDSimConstants::loadSpecPars(const DDFilteredView& fv) {
DDsvalues_type sv(fv.mergedSpecifics());

// Phi Offset
int nphi=4;
int nphi=5;
phioff = getDDDArray("phioff",sv,nphi);
#ifdef DebugLog
std::cout << "HcalDDDSimConstants: " << nphi << " phioff values";
Expand Down
1 change: 1 addition & 0 deletions Geometry/HcalTestBeamData/data/TBHcal03SimNumbering.xml
Expand Up @@ -11,6 +11,7 @@
<Parameter name="phioff" value="20.0*deg"/>
<Parameter name="phioff" value="0.0*deg"/>
<Parameter name="phioff" value="0.0*deg"/>
<Parameter name="phioff" value="10.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
Expand Down
1 change: 1 addition & 0 deletions Geometry/HcalTestBeamData/data/TBHcal04SimNumbering.xml
Expand Up @@ -11,6 +11,7 @@
<Parameter name="phioff" value="20.0*deg"/>
<Parameter name="phioff" value="0.0*deg"/>
<Parameter name="phioff" value="0.0*deg"/>
<Parameter name="phioff" value="10.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
Expand Down
1 change: 1 addition & 0 deletions Geometry/HcalTestBeamData/data/TBHcal06SimNumbering.xml
Expand Up @@ -11,6 +11,7 @@
<Parameter name="phioff" value="20.0*deg"/>
<Parameter name="phioff" value="0.0*deg"/>
<Parameter name="phioff" value="0.0*deg"/>
<Parameter name="phioff" value="10.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
<Parameter name="phibin" value="5.0*deg"/>
Expand Down
26 changes: 18 additions & 8 deletions Geometry/HcalTowerAlgo/src/HcalFlexiHardcodeGeometryLoader.cc
Expand Up @@ -50,20 +50,28 @@ std::vector<HcalFlexiHardcodeGeometryLoader::HBHOCellParameters> HcalFlexiHardco
std::vector<HcalDDDRecConstants::HcalEtaBin> etabins = hcons.getEtaBins(0);

#ifdef DebugLog
std::cout << "FlexiGeometryLoader called for " << etabins.size() << " Eta Bins" << std::endl;
std::cout << "FlexiGeometryLoader called for " << etabins.size()
<< " Eta Bins" << std::endl;
for (unsigned int k=0; k<gconsHB.size(); ++k) {
std::cout << "gconsHB[" << k << "] = " << gconsHB[k].first << ":"
<< gconsHB[k].second << " LayerDepth[" << k << "] = "
<< layerDepths[k] << std::endl;
}
#endif
for (unsigned int i=0; i<etabins.size(); ++i) {
int iring = etabins[i].ieta;
int nphi = etabins[i].nPhi;
int depth = etabins[i].depthStart;
for (unsigned int k=0; k<etabins[i].layer.size(); ++k) {
double rmin = layerDepths[etabins[i].layer[k].first-1];
double rmax = layerDepths[etabins[i].layer[k].second-1];
double rmax = layerDepths[etabins[i].layer[k].second];
#ifdef DebugLog
std::cout << "HBRing " << iring << " eta " << etabins[i].etaMin << ":"
<< etabins[i].etaMax << " depth " << depth << " R " << rmin
<< ":" << rmax << " Phi 1:" << nphi << ":" << etabins[i].phi0
<< ":" << etabins[i].dphi << std::endl;
<< ":" << etabins[i].dphi << " layer[" << k << "]: "
<< etabins[i].layer[k].first-1 << ":"
<< etabins[i].layer[k].second << std::endl;
#endif
result.push_back (HcalFlexiHardcodeGeometryLoader::HBHOCellParameters(iring, depth, 1, nphi, 1, etabins[i].phi0, etabins[i].dphi, rmin, rmax, etabins[i].etaMin, etabins[i].etaMax));
depth++;
Expand Down Expand Up @@ -174,7 +182,9 @@ std::vector<HcalFlexiHardcodeGeometryLoader::HECellParameters> HcalFlexiHardcode
std::cout << "HERing " << iring << " eta " << etabins[i].etaMin << ":"
<< etabins[i].etaMax << " depth " << depth << " Z " << zmin
<< ":" << zmax << " Phi 1:" << nphi << ":" << etabins[i].phi0
<< ":" << dphi << ":" << units << ":" << fioff << std::endl;
<< ":" << dphi << ":" << units << ":" << fioff << " layer["
<< k << "]: " << etabins[i].layer[k].first-1 << ":"
<< etabins[i].layer[k].second-1 << std::endl;
#endif
result.push_back(HcalFlexiHardcodeGeometryLoader::HECellParameters(iring, depth, fioff, nphi, units, etabins[i].phi0, dphi, zmin, zmax, etabins[i].etaMin, etabins[i].etaMax));
depth++;
Expand Down Expand Up @@ -309,13 +319,13 @@ void HcalFlexiHardcodeGeometryLoader::fillHF (CaloSubdetectorGeometry* fGeometry

for (size_t iCell = 0; iCell < fCells.size(); ++iCell) {
const HcalFlexiHardcodeGeometryLoader::HFCellParameters& param = fCells[iCell];
int kPhi(0);
for (int iPhi = param.phiFirst; iPhi <= MAX_HCAL_PHI; iPhi += param.phiStep, ++kPhi) {
// int kPhi(0);
for (int iPhi = param.phiFirst; iPhi <= MAX_HCAL_PHI; iPhi += param.phiStep) {
for (int iside = -1; iside <= 1; iside += 2) { // both detector sides are identical
HcalDetId hid (HcalForward, param.eta*iside, iPhi, param.depth);
// middle of the cell
float phiCenter = ((kPhi + 0.5) * param.dphi) * DEGREE2RAD;
// float phiCenter = ((iPhi-1)*360./MAX_HCAL_PHI + 0.5*param.dphi) * DEGREE2RAD;
// float phiCenter = ((kPhi + 0.5) * param.dphi) * DEGREE2RAD;
float phiCenter = ((iPhi-1)*360./MAX_HCAL_PHI + 0.5*param.dphi) * DEGREE2RAD;
GlobalPoint inner (param.rMin, 0, param.zMin);
GlobalPoint outer (param.rMax, 0, param.zMin);
float iEta = inner.eta();
Expand Down
22 changes: 22 additions & 0 deletions Geometry/HcalTowerAlgo/test/HcalGeometryTester.cc
Expand Up @@ -31,6 +31,7 @@ class HcalGeometryTester : public edm::EDAnalyzer {
const HcalTopology& topology, DetId::Detector det,
int subdet, std::string label,
std::vector<int> &dins);
void testFlexiGeomHF(CaloSubdetectorGeometry* geom);

edm::ParameterSet ps0;
std::string m_label;
Expand Down Expand Up @@ -70,6 +71,8 @@ void HcalGeometryTester::analyze(const edm::Event& /*iEvent*/,
testFlexiValidDetIds(geom, topology, DetId::Hcal, HcalEndcap, " ENDCAP ", dins );
testFlexiValidDetIds(geom, topology, DetId::Hcal, HcalOuter, " OUTER ", dins );
testFlexiValidDetIds(geom, topology, DetId::Hcal, HcalForward," FORWARD ", dins );

testFlexiGeomHF(geom);
}

void HcalGeometryTester::testValidDetIds(CaloSubdetectorGeometry* caloGeom,
Expand Down Expand Up @@ -214,4 +217,23 @@ void HcalGeometryTester::testFlexiValidDetIds(CaloSubdetectorGeometry* caloGeom,
}
}

void HcalGeometryTester::testFlexiGeomHF(CaloSubdetectorGeometry* caloGeom) {

std::cout << std::endl << "Test HF Geometry : " << std::endl;
for (int ieta = 29; ieta <=41; ++ieta) {
HcalDetId cell3 (HcalForward, ieta, 3, 1);
const CaloCellGeometry* cellGeometry3 = caloGeom->getGeometry (cell3);
if (cellGeometry3) {
std::cout << "cell geometry iphi=3 -> ieta=" << ieta
<< " eta " << cellGeometry3->getPosition().eta () << "+-"
<< std::abs(cellGeometry3->getCorners()[0].eta() -
cellGeometry3->getCorners()[2].eta())/2
<< " phi " << cellGeometry3->getPosition().phi ()/3.1415*180
<< "+-" << std::abs(cellGeometry3->getCorners()[0].phi() -
cellGeometry3->getCorners()[2].phi())/3.1415*180/2.
<< std::endl;
}
}
}

DEFINE_FWK_MODULE(HcalGeometryTester);
4 changes: 2 additions & 2 deletions Geometry/HcalTowerAlgo/test/runHcalGeometryTester_cfg.py
Expand Up @@ -4,8 +4,8 @@
process = cms.Process("HcalGeometryTest")

#process.load("Configuration.Geometry.GeometryExtendedPostLS2_cff")
#process.load("Geometry.HcalCommonData.testPhase0GeometryXML_cfi")
process.load("Geometry.CMSCommonData.cmsExtendedGeometry2023HGCalXML_cfi")
process.load("Geometry.HcalCommonData.testPhase2GeometryXML_cfi")
#process.load("Geometry.CMSCommonData.cmsExtendedGeometry2023HGCalXML_cfi")
process.load("Geometry.HcalCommonData.hcalSimNumberingInitialization_cfi")
process.load("Geometry.HcalCommonData.hcalRecNumberingInitialization_cfi")
process.load("Geometry.HcalEventSetup.hcalTopologyIdeal_cfi")
Expand Down

0 comments on commit b770b2f

Please sign in to comment.