From ec2c9c1e41f212aad6179bab1b3f9f3ad8c9ef7c Mon Sep 17 00:00:00 2001 From: Ianna Osborne Date: Wed, 15 Jul 2015 12:36:40 +0200 Subject: [PATCH] Clean up Hcal rec constants and use Hcal parameters --- .../interface/HcalDDDRecConstants.h | 25 +--- .../HcalCommonData/src/HcalDDDRecConstants.cc | 120 ++++-------------- 2 files changed, 35 insertions(+), 110 deletions(-) diff --git a/Geometry/HcalCommonData/interface/HcalDDDRecConstants.h b/Geometry/HcalCommonData/interface/HcalDDDRecConstants.h index f717b44e2f7a3..6f0d335bc0eb3 100644 --- a/Geometry/HcalCommonData/interface/HcalDDDRecConstants.h +++ b/Geometry/HcalCommonData/interface/HcalDDDRecConstants.h @@ -56,23 +56,23 @@ class HcalDDDRecConstants { std::vector getEtaBins(const int itype) const; std::pair getEtaPhi(int subdet, int ieta, int iphi) const; std::pair getEtaRange(const int i) const - {return std::pair(iEtaMin[i],iEtaMax[i]);} - const std::vector & getEtaTable() const {return etaTable;} + {return std::pair(hpar->etaMin[i],hpar->etaMax[i]);} + const std::vector & getEtaTable() const {return hpar->etaTable;} const std::vector & getEtaTableHF() const {return hpar->etaTableHF;} std::pair getEtaLimit(const int i) const - {return std::pair(etaTable[i],etaTable[i+1]);} + {return std::pair(hpar->etaTable[i],hpar->etaTable[i+1]);} HcalID getHCID(int subdet, int ieta, int iphi, int lay, int idepth) const; - int getMaxDepth(const int type) const {return maxDepth[type];} - int getNEta() const {return nEta;} + int getMaxDepth(const int type) const {return hpar->maxDepth[type];} + int getNEta() const {return hpar->etagroup.size();} double getPhiBin(const int i) const {return phibin[i];} double getPhiOff(const int i) const {return hpar->phioff[i];} const std::vector & getPhiOffs() const {return hpar->phioff;} const std::vector & getPhiTable() const {return phibin;} - const std::vector & getPhiTableHF() const {return phibinHF;} + const std::vector & getPhiTableHF() const {return hpar->phitable;} double getRZ(int subdet, int ieta, int depth) const; std::vector getThickActive(const int type) const; - int getTopoMode() const {return modeTopo_;} + int getTopoMode() const {return hpar->topologyMode;} std::vector HcalCellTypes(HcalSubdetector) const; unsigned int numberOfCells(HcalSubdetector) const; unsigned int nCells(HcalSubdetector) const; @@ -83,26 +83,15 @@ class HcalDDDRecConstants { unsigned int layerGroupSize( unsigned int eta ) const; unsigned int layerGroup( unsigned int eta, unsigned int i ) const; - bool tobeInitialized; const HcalParameters *hpar; const HcalDDDSimConstants &hcons; - int modeTopo_; // Mode for topology - std::vector etaGroup; // Eta Grouping std::vector > etaSimValu; // eta ranges at Sim stage - std::vector etaTable; // Eta table (HB+HE) std::vector ietaMap; // Map Sim level ieta to Rec level ieta - std::vector iEtaMin, iEtaMax; // Minimum and maximum eta - std::vector maxDepth; // Maximum depth in HB/HE/HF/HO - int nEta; // Number of bins in eta for HB and HE - std::vector phiGroup; // Eta Grouping std::vector phibin; // Phi step for all eta bins (HB, HE, HO) - std::vector phibinHF; // Phi step for all eta bins (HF) std::vector phiUnitS; // Phi unit at SIM stage - std::vector nOff; // Speical eta bin #'s in barrel and endcap std::vector > gconsHB; // Geometry constatnts HB std::vector > gconsHE; // Geometry constatnts HE int nModule[2], nHalves[2]; // Modules, Halves for HB/HE - enum { kHOSizePreLS1 = 2160, kHFSizePreLS1 = 1728 } ; }; #endif diff --git a/Geometry/HcalCommonData/src/HcalDDDRecConstants.cc b/Geometry/HcalCommonData/src/HcalDDDRecConstants.cc index 553e2cf3e4c1e..732cc9385e57b 100644 --- a/Geometry/HcalCommonData/src/HcalDDDRecConstants.cc +++ b/Geometry/HcalCommonData/src/HcalDDDRecConstants.cc @@ -7,6 +7,7 @@ #include "CLHEP/Units/GlobalSystemOfUnits.h" //#define DebugLog +enum { kHOSizePreLS1 = 2160, kHFSizePreLS1 = 1728 } ; HcalDDDRecConstants::HcalDDDRecConstants(const HcalParameters* hp, const HcalDDDSimConstants& hc) : @@ -30,14 +31,14 @@ HcalDDDRecConstants::getEtaBins(const int itype) const { std::vector bins; unsigned int type = (itype == 0) ? 0 : 1; unsigned int lymax = (type == 0) ? 17 : 19; - for (int ieta = iEtaMin[type]; ieta <= iEtaMax[type]; ++ieta) { + for (int ieta = hpar->etaMin[type]; ieta <= hpar->etaMax[type]; ++ieta) { int nfi = (int)((20.001*nModule[itype]*CLHEP::deg)/phibin[ieta-1]); - HcalDDDRecConstants::HcalEtaBin etabin = HcalDDDRecConstants::HcalEtaBin(ieta,etaTable[ieta-1], etaTable[ieta], nfi, hpar->phioff[type], phibin[ieta-1]); + HcalDDDRecConstants::HcalEtaBin etabin = HcalDDDRecConstants::HcalEtaBin(ieta,hpar->etaTable[ieta-1], hpar->etaTable[ieta], nfi, hpar->phioff[type], phibin[ieta-1]); int dstart = -1; if (layerGroupSize( ieta-1 ) > 0) { int lmin(0), lmax(0); int dep = layerGroup( ieta-1, 0 ); - if (type == 1 && ieta == iEtaMin[type]) dep = 3; + if (type == 1 && ieta == hpar->etaMin[type]) dep = 3; unsigned lymx0 = (layerGroupSize( ieta-1 ) > lymax) ? lymax : layerGroupSize( ieta-1 ); for (unsigned int l=0; l 2) break; + if (type == 0 && ieta == hpar->etaMax[type] && dep > 2) break; } if (lmax >= lmin) { if (ieta+1 == hpar->noff[1]) { } else if (ieta == hpar->noff[1]) { - HcalDDDRecConstants::HcalEtaBin etabin0 = HcalDDDRecConstants::HcalEtaBin(ieta-1,etaTable[ieta-2], etaTable[ieta], nfi, hpar->phioff[type], phibin[ieta-1]); + HcalDDDRecConstants::HcalEtaBin etabin0 = HcalDDDRecConstants::HcalEtaBin(ieta-1,hpar->etaTable[ieta-2], hpar->etaTable[ieta], nfi, hpar->phioff[type], phibin[ieta-1]); etabin0.depthStart = dep; etabin0.layer.push_back(std::pair(lmin,lmax)); bins.push_back(etabin0); @@ -96,16 +97,16 @@ HcalDDDRecConstants::getEtaPhi(int subdet, int ieta, int iphi) const { (subdet == static_cast(HcalOuter))) { // Use Eta Table int unit = (int)(phibin[ietaAbs-1]/fiveDegInRad+0.5); int kphi = (unit == 2) ? ((iphi-1)/2 + 1) : iphi; - double foff = (ietaAbs <= iEtaMax[0]) ? hpar->phioff[0] : hpar->phioff[1]; - eta = 0.5*(etaTable[ietaAbs-1]+etaTable[ietaAbs]); + double foff = (ietaAbs <= hpar->etaMax[0]) ? hpar->phioff[0] : hpar->phioff[1]; + eta = 0.5*(hpar->etaTable[ietaAbs-1]+hpar->etaTable[ietaAbs]); phi = foff + (kphi-0.5)*phibin[ietaAbs-1]; } else { - ietaAbs -= iEtaMin[3]; - int unit = (int)(phibinHF[ietaAbs-1]/fiveDegInRad+0.5); + ietaAbs -= hpar->etaMin[3]; + int unit = (int)(hpar->phitable[ietaAbs-1]/fiveDegInRad+0.5); int kphi = (unit == 4) ? ((iphi-3)/4 + 1) : ((iphi-1)/2 + 1); double foff = (unit > 2) ? hpar->phioff[4] : hpar->phioff[2]; eta = 0.5*(hpar->etaTableHF[ietaAbs-1]+hpar->etaTableHF[ietaAbs]); - phi = foff + (kphi-0.5)*phibinHF[ietaAbs-1]; + phi = foff + (kphi-0.5)*hpar->phitable[ietaAbs-1]; } if (ieta < 0) eta = -eta; if (phi > M_PI) phi -= (2*M_PI); @@ -141,7 +142,7 @@ HcalDDDRecConstants::getHCID(int subdet, int ieta, int iphi, int lay, unit = hcons.unitPhi(phibin[eta-1]); phi = hcons.phiNumber(phi0,unit); depth = layerGroup( eta-1, lay-1 ); - if (eta == iEtaMin[1]) { + if (eta == hpar->etaMin[1]) { if (subdet == static_cast(HcalBarrel)) { if (depth > 2) depth = 2; } else { @@ -171,7 +172,7 @@ double HcalDDDRecConstants::getRZ(int subdet, int ieta, int depth) const { #ifdef DebugLog int lay(0); #endif - if (ietaAbs < nEta) { + if (ietaAbs < hpar->etaMax[1]) { for (unsigned int k=0; k< layerGroupSize( ietaAbs-1 ); ++k) { if (depth == (int)layerGroup( ietaAbs-1, k )) { rz = ((subdet == static_cast(HcalBarrel)) ? (gconsHB[k].first) : @@ -307,7 +308,6 @@ unsigned int HcalDDDRecConstants::numberOfCells(HcalSubdetector subdet) const { } else { return hcons.numberOfCells(subdet); } - } unsigned int HcalDDDRecConstants::nCells(HcalSubdetector subdet) const { @@ -334,46 +334,11 @@ unsigned int HcalDDDRecConstants::nCells() const { } void HcalDDDRecConstants::initialize(void) { - - //Topology Mode - modeTopo_ = hpar->topologyMode; - - //Eta grouping - nEta = (int)(hpar->etagroup.size()); - if (nEta != (int)(hpar->phigroup.size())) { - edm::LogError("HCalGeom") << "HcalDDDRecConstants: sizes of the vectors " - << " etaGroup (" << nEta << ") and phiGroup (" - << hpar->phigroup.size() << ") do not match"; - throw cms::Exception("DDException") << "HcalDDDRecConstants: inconsistent array sizes" << nEta << ":" << hpar->phigroup.size(); - } - - //Layer grouping - for (int i=0; ilayerGroupEtaRec); - // if (k < hpar->layerGroupEtaRec.size()) { - // layerGroup[i] = hpar->layerGroupEtaRec[k].layerGroup; - // } else { - // layerGroup[i] = layerGroup[i-1]; - // } -#ifdef DebugLog - std::cout << "HcalDDDRecConstants:Read LayerGroup" << i << ":"; - for (unsigned int k=0; ketaTable[ieta]); etaSimValu.push_back(std::pair(ef,ieta)); } - for (int k=0; k<(hpar->etagroup[i]); ++k) ietaMap.push_back(i+1); - if (ieta <= iEtaMax[0]) ietaHB = i+1; - if (ieta <= iEtaMin[1]) ietaHE = i+1; - iEtaMax[1] = i+1; + for (int k=0; ketagroup[i]; ++k) ietaMap.push_back(i+1); + if (ieta <= hpar->etaMax[0]) ietaHB = i+1; + if (ieta <= hpar->etaMin[1]) ietaHE = i+1; } - iEtaMin[1] = ietaHE; - iEtaMax[0] = ietaHB; + assert( hpar->etaMin[1] == ietaHE ); + assert( hpar->etaMax[0] == ietaHB ); // Then Phi bins ieta = 0; phibin.clear(); phiUnitS.clear(); - for (int i=0; ietagroup.size(); ++i) { double dphi = (hpar->phigroup[i])*(hpar->phibin[ieta]); phibin.push_back(dphi); ieta += (hpar->etagroup[i]); @@ -408,11 +371,11 @@ void HcalDDDRecConstants::initialize(void) { int unit = hcons.unitPhi(hpar->phibin[i-1]); phiUnitS.push_back(unit); } - phibinHF = hpar->phitable; + #ifdef DebugLog - std::cout << "Modified eta/deltaphi table for " << nEta << " bins" << std::endl; - for (int i=0; ietagroup.size() << " bins" << std::endl; + for (unsigned int i=0; ietagroup.size(); ++i) + std::cout << "Eta[" << i << "] = " << hpar->etaTable[i] << ":" << hpar->etaTable[i+1] << ":" << etaSimValu[i].first << ":" << etaSimValu[i].second << " PhiBin[" << i << "] = " << phibin[i]/CLHEP::deg <= iEtaMin[1]-1 && i < iEtaMax[1]) { -#ifdef DebugLog - std::cout << "HE " << i << " " << imx << " " << laymax << std::endl; -#endif - if (maxDepth[1] < laymax) maxDepth[1] = laymax; - } - } -#ifdef DebugLog - for (int i=0; i<4; ++i) - std::cout << "Detector Type[" << i << "] iEta " << iEtaMin[i] << ":" - << iEtaMax[i] << " MaxDepth " << maxDepth[i] << std::endl; -#endif - //Now the geometry constants nModule[0] = hpar->modHB[0]; nHalves[0] = hpar->modHB[1]; @@ -470,7 +406,7 @@ void HcalDDDRecConstants::initialize(void) { std::cout << "rHB[" << i << "] = " << gconsHB[i].first << " +- " << gconsHB[i].second << std::endl; #endif - nModule[1] = hpar->modHE[0];; + nModule[1] = hpar->modHE[0]; nHalves[1] = hpar->modHE[1]; for (unsigned int i=0; izHE.size(); ++i) { gconsHE.push_back(std::pair(hpar->zHE[i]/CLHEP::cm,