From 911b2665b3ed1bafe7661d36471be8a937bf01f2 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Thu, 29 Jun 2023 09:56:52 +0200 Subject: [PATCH 1/3] Try to address the issues of ieta=18 and ieta=1 layer=2 of HCAL --- .../HcalCommonData/src/HcalDDDRecConstants.cc | 34 +++---- .../HcalCommonData/src/HcalDDDSimConstants.cc | 51 +++++------ .../HcalCommonData/src/HcalHitRelabeller.cc | 46 +++++----- .../test/python/runHcalHitRelabeller_cfg.py | 88 +++++++++++++++++++ 4 files changed, 152 insertions(+), 67 deletions(-) create mode 100644 SimG4CMS/Calo/test/python/runHcalHitRelabeller_cfg.py diff --git a/Geometry/HcalCommonData/src/HcalDDDRecConstants.cc b/Geometry/HcalCommonData/src/HcalDDDRecConstants.cc index 4ee9d2c6b0d0c..a156854a9e9d3 100644 --- a/Geometry/HcalCommonData/src/HcalDDDRecConstants.cc +++ b/Geometry/HcalCommonData/src/HcalDDDRecConstants.cc @@ -238,7 +238,7 @@ std::vector HcalDDDRecConstants::getHFCel if (maxDepth[2] > 0) { for (unsigned int k = 0; k < nEta; ++k) { int ieta = iEtaMin[2] + k; - int dphi = (int)(0.001 + hcons.getPhiTableHF()[k] / (5._deg)); + int dphi = static_cast(0.001 + hcons.getPhiTableHF()[k] / (5._deg)); int iphi = (dphi == 4) ? 3 : 1; int nphi = 72 / dphi; double rMin = hcons.getRTableHF()[nEta - k - 1] / CLHEP::cm; @@ -254,7 +254,7 @@ std::vector HcalDDDRecConstants::getHFCel for (unsigned int k = 0; k < hcons.getIdHF2QIE().size(); ++k) { int ieta = hcons.getIdHF2QIE()[k].ieta(); int ind = std::abs(ieta) - iEtaMin[2]; - int dphi = (int)(0.001 + hcons.getPhiTableHF()[ind] / (5._deg)); + int dphi = static_cast(0.001 + hcons.getPhiTableHF()[ind] / (5._deg)); int iphi = hcons.getIdHF2QIE()[k].iphi(); double rMin = hcons.getRTableHF()[nEta - ind - 1] / CLHEP::cm; double rMax = hcons.getRTableHF()[nEta - ind] / CLHEP::cm; @@ -264,7 +264,7 @@ std::vector HcalDDDRecConstants::getHFCel } else { for (unsigned int k = 0; k < nEta; ++k) { int ieta = iEtaMin[2] + k; - int dphi = (int)(0.001 + hcons.getPhiTableHF()[k] / (5._deg)); + int dphi = static_cast(0.001 + hcons.getPhiTableHF()[k] / (5._deg)); int iphi = (dphi == 4) ? 3 : 1; int nphi = 72 / dphi; double rMin = hcons.getRTableHF()[nEta - k - 1] / CLHEP::cm; @@ -307,7 +307,7 @@ int HcalDDDRecConstants::getLayerBack(const int& idet, const int& ieta, const in int laymax = hcons.getLastLayer(subdet, ieta); if (layBack < 0 && eta <= hpar->etaMax[1]) { for (unsigned int k = 0; k < layerGroupSize(eta - 1); ++k) { - if (depth + 1 == (int)layerGroup(eta - 1, k)) { + if ((depth + 1) == static_cast(layerGroup(eta - 1, k))) { layBack = k - 1; break; } @@ -333,8 +333,8 @@ int HcalDDDRecConstants::getLayerFront(const int& idet, const int& ieta, const i layFront = laymin; } else if (eta <= hpar->etaMax[1]) { for (unsigned int k = 0; k < layerGroupSize(eta - 1); ++k) { - if (depth == (int)layerGroup(eta - 1, k)) { - if ((int)(k) >= laymin) { + if (depth == static_cast(layerGroup(eta - 1, k))) { + if (static_cast(k) >= laymin) { layFront = k; break; } @@ -361,7 +361,7 @@ int HcalDDDRecConstants::getMaxDepth(const int& itype, const int& ieta, const in if (layerGroupSize(ieta - 1) > 0) { if (layerGroupSize(ieta - 1) < lymax) lymax = layerGroupSize(ieta - 1); - lmax = (int)(layerGroup(ieta - 1, lymax - 1)); + lmax = static_cast(layerGroup(ieta - 1, lymax - 1)); if (type == 0 && ieta == iEtaMax[type]) lmax = hcons.getDepthEta16M(1); if (type == 1 && ieta >= hpar->noff[1]) @@ -388,7 +388,7 @@ int HcalDDDRecConstants::getMinDepth(const int& itype, const int& ieta, const in if (type == 1 && ieta == iEtaMin[type]) lmin = hcons.getDepthEta16M(2); else - lmin = (int)(layerGroup(ieta - 1, 0)); + lmin = static_cast(layerGroup(ieta - 1, 0)); } } } @@ -455,7 +455,7 @@ double HcalDDDRecConstants::getRZ(const int& subdet, const int& ieta, const int& double HcalDDDRecConstants::getRZ(const int& subdet, const int& layer) const { double rz(0); - if (layer > 0 && layer <= (int)(layerGroupSize(0))) + if (layer > 0 && layer <= static_cast(layerGroupSize(0))) rz = ((subdet == static_cast(HcalBarrel)) ? (gconsHB[layer - 1].first) : (gconsHE[layer - 1].first)); #ifdef EDM_ML_DEBUG edm::LogVerbatim("HCalGeom") << "getRZ: subdet|layer " << subdet << "|" << layer << " rz " << rz; @@ -581,7 +581,7 @@ std::vector HcalDDDRecConstants::HcalCellTypes(HcalSubdetector sub } } for (unsigned int il = 0; il < etabin.layer.size(); ++il) { - int depth = etabin.depthStart + (int)(il); + int depth = etabin.depthStart + static_cast(il); temp[il].setEta(ieta, etabin.etaMin, etabin.etaMax); temp[il].setDepth(depth, dmin[il], dmax[il]); double foff = (etabin.ieta <= iEtaMax[0]) ? hpar->phioff[0] : hpar->phioff[1]; @@ -766,7 +766,7 @@ void HcalDDDRecConstants::getOneEtaBin(HcalSubdetector subdet, edm::LogVerbatim("HCalGeom") << "[" << l << "] " << phis[l].first << ":" << convertRadToDeg(phis[l].second); #endif for (itr = layers.begin(); itr != layers.end(); ++itr) { - if (itr->first <= (int)(lymx0)) { + if (itr->first <= static_cast(lymx0)) { if (itr->second == dep) { if (lmin == 0) lmin = itr->first; @@ -790,7 +790,7 @@ void HcalDDDRecConstants::getOneEtaBin(HcalSubdetector subdet, lmax = lymx0; break; } - if (itr->first == (int)(lymx0)) + if (itr->first == static_cast(lymx0)) lmax = lymx0; } } @@ -825,8 +825,8 @@ void HcalDDDRecConstants::getOneEtaBin(HcalSubdetector subdet, void HcalDDDRecConstants::initialize(void) { //Eta grouping - int nEta = (int)(hpar->etagroup.size()); - if (nEta != (int)(hpar->phigroup.size())) { + int nEta = static_cast(hpar->etagroup.size()); + if (nEta != static_cast(hpar->phigroup.size())) { edm::LogError("HCalGeom") << "HcalDDDRecConstants: sizes of the vectors " << " etaGroup (" << nEta << ") and phiGroup (" << hpar->phigroup.size() << ") do not match"; @@ -845,7 +845,7 @@ void HcalDDDRecConstants::initialize(void) { for (int i = 0; i < nEta; ++i) { int ef = ieta + 1; ieta += (hpar->etagroup[i]); - if (ieta >= (int)(hpar->etaTable.size())) { + if (ieta >= static_cast(hpar->etaTable.size())) { edm::LogError("HCalGeom") << "HcalDDDRecConstants: Going beyond the array boundary " << hpar->etaTable.size() << " at index " << i << " of etaTable from SimConstant"; throw cms::Exception("DDException") @@ -878,7 +878,7 @@ void HcalDDDRecConstants::initialize(void) { for (int i = 0; i < nEta; ++i) { double dphi = (hpar->phigroup[i]) * (hpar->phibin[ieta]); phibin.emplace_back(dphi); - int nphi = (int)((2._pi + 0.001) / dphi); + int nphi = static_cast((2._pi + 0.001) / dphi); if (ieta <= iEtaMax[0]) { if (nphi > nPhiBins[0]) nPhiBins[3] = nPhiBins[0] = nphi; @@ -894,7 +894,7 @@ void HcalDDDRecConstants::initialize(void) { phiUnitS.emplace_back(unit); } for (double i : hpar->phitable) { - int nphi = (int)((2._pi + 0.001) / i); + int nphi = static_cast((2._pi + 0.001) / i); if (nphi > nPhiBins[2]) nPhiBins[2] = nphi; } diff --git a/Geometry/HcalCommonData/src/HcalDDDSimConstants.cc b/Geometry/HcalCommonData/src/HcalDDDSimConstants.cc index 0179463958cca..bafddaab39200 100644 --- a/Geometry/HcalCommonData/src/HcalDDDSimConstants.cc +++ b/Geometry/HcalCommonData/src/HcalDDDSimConstants.cc @@ -42,7 +42,7 @@ HcalCellType::HcalCell HcalDDDSimConstants::cell( idet == static_cast(HcalOuter) || idet == static_cast(HcalForward)) && etaR >= etaMn && etaR <= etaMx && depth > 0) ok = true; - if (idet == static_cast(HcalEndcap) && depth > (int)(hpar->zHE.size())) + if (idet == static_cast(HcalEndcap) && depth > static_cast(hpar->zHE.size())) ok = false; else if (idet == static_cast(HcalBarrel) && depth > maxLayerHB_ + 1) ok = false; @@ -83,8 +83,8 @@ HcalCellType::HcalCell HcalDDDSimConstants::cell( } else if (etaR <= nEta) { int laymin(depth), laymax(depth); if (idet == static_cast(HcalOuter)) { - laymin = (etaR > hpar->noff[2]) ? ((int)(hpar->zHE.size())) : ((int)(hpar->zHE.size())) - 1; - laymax = ((int)(hpar->zHE.size())); + laymin = (etaR > hpar->noff[2]) ? (static_cast(hpar->zHE.size())) : (static_cast(hpar->zHE.size())) - 1; + laymax = (static_cast(hpar->zHE.size())); } double d1 = 0, d2 = 0; if (idet == static_cast(HcalEndcap)) { @@ -127,7 +127,7 @@ unsigned int HcalDDDSimConstants::findLayer(const int& layer, const std::vector& layerGroup) const { unsigned int id = layerGroup.size(); for (unsigned int i = 0; i < layerGroup.size(); i++) { - if (layer == (int)(layerGroup[i].layer)) { + if (layer == static_cast(layerGroup[i].layer)) { id = i; break; } @@ -264,8 +264,9 @@ std::pair HcalDDDSimConstants::getEtaDepth( } else { if (lay >= 0) { depth = layerGroup(det, etaR, phi, zside, lay - 1); + if (((det == 2) && (etaR == 18)) || ((det == 1) && (etaR == 15))) if (etaR == hpar->noff[0] && lay > 1) { - int kphi = phi + int((hpar->phioff[3] + 0.1) / hpar->phibin[etaR - 1]); + int kphi = phi + static_cast((hpar->phioff[3] + 0.1) / hpar->phibin[etaR - 1]); kphi = (kphi - 1) % 4 + 1; if (kphi == 2 || kphi == 3) depth = layerGroup(det, etaR, phi, zside, lay - 2); @@ -371,7 +372,7 @@ int HcalDDDSimConstants::getLayerFront( if (det == 1 || det == 2) { layer = 1; for (int l = 0; l < getLayerMax(eta, depth); ++l) { - if ((int)(layerGroup(eta - 1, l)) == depth) { + if (static_cast(layerGroup(eta - 1, l)) == depth) { layer = l + 1; break; } @@ -397,7 +398,7 @@ int HcalDDDSimConstants::getLayerBack( } int HcalDDDSimConstants::getLayerMax(const int& eta, const int& depth) const { - int layermx = ((eta < hpar->etaMin[1]) && depth - 1 < maxDepth[0]) ? maxLayerHB_ + 1 : (int)layerGroupSize(eta - 1); + int layermx = ((eta < hpar->etaMin[1]) && depth - 1 < maxDepth[0]) ? maxLayerHB_ + 1 : static_cast(layerGroupSize(eta - 1)); return layermx; } @@ -442,7 +443,7 @@ int HcalDDDSimConstants::getMinDepth( if (ldmap_.isValid(det, phi, zside)) { lmin = ldmap_.getDepths(eta).first; } else if (layerGroupSize(eta - 1) > 0) { - lmin = (int)(layerGroup(eta - 1, 0)); + lmin = static_cast(layerGroup(eta - 1, 0)); unsigned int type = (det == 1) ? 0 : 1; if (type == 1 && eta == hpar->etaMin[1]) lmin = getDepthEta16(det, phi, zside); @@ -671,7 +672,7 @@ unsigned int HcalDDDSimConstants::numberOfCells(const HcalSubdetector& subdet) c unsigned int num = 0; std::vector cellTypes = HcalCellTypes(subdet); for (auto& cellType : cellTypes) { - num += (unsigned int)(cellType.nPhiBins()); + num += static_cast(cellType.nPhiBins()); } #ifdef EDM_ML_DEBUG edm::LogVerbatim("HCalGeom") << "HcalDDDSimConstants:numberOfCells " << cellTypes.size() << " " << num @@ -790,7 +791,7 @@ void HcalDDDSimConstants::initialize(void) { int layermx = getLayerMax(k + 1, i + 1); int ll = layermx; for (int l = layermx - 1; l >= 0; --l) { - if ((int)layerGroup(k, l) == i + 1) { + if (static_cast(layerGroup(k, l)) == i + 1) { ll = l + 1; break; } @@ -837,14 +838,14 @@ void HcalDDDSimConstants::initialize(void) { int noffsize = 7 + hpar->noff[5] + hpar->noff[6]; int noffl(noffsize + 5); - if ((int)(hpar->noff.size()) > (noffsize + 3)) { + if (static_cast(hpar->noff.size()) > (noffsize + 3)) { depthEta16[0] = hpar->noff[noffsize]; depthEta16[1] = hpar->noff[noffsize + 1]; depthEta29[0] = hpar->noff[noffsize + 2]; depthEta29[1] = hpar->noff[noffsize + 3]; - if ((int)(hpar->noff.size()) > (noffsize + 4)) { + if (static_cast(hpar->noff.size()) > (noffsize + 4)) { noffl += (2 * hpar->noff[noffsize + 4]); - if ((int)(hpar->noff.size()) > noffl) + if (static_cast(hpar->noff.size()) > noffl) isBH_ = (hpar->noff[noffl] > 0); } } else { @@ -860,7 +861,7 @@ void HcalDDDSimConstants::initialize(void) { << depthEta29[1] << ")"; #endif - if ((int)(hpar->noff.size()) > (noffsize + 4)) { + if (static_cast(hpar->noff.size()) > (noffsize + 4)) { int npair = hpar->noff[noffsize + 4]; int kk = noffsize + 4; for (int k = 0; k < npair; ++k) { @@ -893,16 +894,16 @@ void HcalDDDSimConstants::initialize(void) { } depthMaxSp_ = std::pair(0, 0); int noffk(noffsize + 5); - if ((int)(hpar->noff.size()) > (noffsize + 5)) { + if (static_cast(hpar->noff.size()) > (noffsize + 5)) { noffk += (2 * hpar->noff[noffsize + 4]); - if ((int)(hpar->noff.size()) >= noffk + 7) { + if (static_cast(hpar->noff.size()) >= noffk + 7) { int dtype = hpar->noff[noffk + 1]; int nphi = hpar->noff[noffk + 2]; int ndeps = hpar->noff[noffk + 3]; int ndp16 = hpar->noff[noffk + 4]; int ndp29 = hpar->noff[noffk + 5]; double wt = 0.1 * (hpar->noff[noffk + 6]); - if ((int)(hpar->noff.size()) >= (noffk + 7 + nphi + 3 * ndeps)) { + if (static_cast(hpar->noff.size()) >= (noffk + 7 + nphi + 3 * ndeps)) { if (dtype == 1 || dtype == 2) { std::vector ifi, iet, ily, idp; for (int i = 0; i < nphi; ++i) @@ -931,15 +932,15 @@ void HcalDDDSimConstants::initialize(void) { } } int noffm = (noffk + 7 + nphi + 3 * ndeps); - if ((int)(hpar->noff.size()) > noffm) { + if (static_cast(hpar->noff.size()) > noffm) { int ndnext = hpar->noff[noffm]; - if (ndnext > 4 && (int)(hpar->noff.size()) >= noffm + ndnext) { + if (ndnext > 4 && static_cast(hpar->noff.size()) >= noffm + ndnext) { for (int i = 0; i < 2; ++i) layFHB[i] = hpar->noff[noffm + i + 1]; for (int i = 0; i < 3; ++i) layFHE[i] = hpar->noff[noffm + i + 3]; } - if (ndnext > 11 && (int)(hpar->noff.size()) >= noffm + ndnext) { + if (ndnext > 11 && static_cast(hpar->noff.size()) >= noffm + ndnext) { for (int i = 0; i < 3; ++i) layBHB[i] = hpar->noff[noffm + i + 6]; for (int i = 0; i < 4; ++i) @@ -1200,10 +1201,10 @@ void HcalDDDSimConstants::printTileHE(const int& eta, const int& phi, const int& unsigned int HcalDDDSimConstants::layerGroupSize(int eta) const { unsigned int k = 0; for (auto const& it : hpar->layerGroupEtaSim) { - if (it.layer == (unsigned int)(eta + 1)) { + if (it.layer == static_cast(eta + 1)) { return it.layerGroup.size(); } - if (it.layer > (unsigned int)(eta + 1)) + if (it.layer > static_cast(eta + 1)) break; k = it.layerGroup.size(); } @@ -1213,10 +1214,10 @@ unsigned int HcalDDDSimConstants::layerGroupSize(int eta) const { unsigned int HcalDDDSimConstants::layerGroup(int eta, int i) const { unsigned int k = 0; for (auto const& it : hpar->layerGroupEtaSim) { - if (it.layer == (unsigned int)(eta + 1)) { + if (it.layer == static_cast(eta + 1)) { return it.layerGroup.at(i); } - if (it.layer > (unsigned int)(eta + 1)) + if (it.layer > static_cast(eta + 1)) break; k = it.layerGroup.at(i); } @@ -1225,6 +1226,6 @@ unsigned int HcalDDDSimConstants::layerGroup(int eta, int i) const { unsigned int HcalDDDSimConstants::layerGroup(int det, int eta, int phi, int zside, int lay) const { int depth0 = findDepth(det, eta, phi, zside, lay); - unsigned int depth = (depth0 > 0) ? (unsigned int)(depth0) : layerGroup(eta - 1, lay); + unsigned int depth = (depth0 > 0) ? static_cast(depth0) : layerGroup(eta - 1, lay); return depth; } diff --git a/Geometry/HcalCommonData/src/HcalHitRelabeller.cc b/Geometry/HcalCommonData/src/HcalHitRelabeller.cc index 41fdc015925ed..f7c5a9699d08c 100644 --- a/Geometry/HcalCommonData/src/HcalHitRelabeller.cc +++ b/Geometry/HcalCommonData/src/HcalHitRelabeller.cc @@ -23,19 +23,23 @@ void HcalHitRelabeller::process(std::vector& hcalHits) { edm::LogVerbatim("HcalSim") << "Hit[" << ii << "] " << std::hex << hcalHit.id() << std::dec << " Neutral density " << neutralDensity_; #endif - double energy = (hcalHit.energy()); - if (neutralDensity_) { - energy *= (energyWt(hcalHit.id())); - hcalHit.setEnergy(energy); - } - DetId newid = relabel(hcalHit.id()); + uint32_t hid; + int det, z, depth, eta, phi, layer; + HcalTestNumbering::unpackHcalIndex(hcalHit.id(), det, z, depth, eta, phi, layer); + if ((det == 2) && (layer == 2) && (eta == 18)) + depth = 2; + hid = HcalTestNumbering::packHcalIndex(det, z, depth, eta, phi, layer); + double wt = (neutralDensity_) ? (energyWt(hid)) : 1.0; + double energy = wt * (hcalHit.energy()); + hcalHit.setEnergy(energy); + uint32_t newid = relabel(hid).rawId(); #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HcalSim") << "Hit " << ii << " out of " << hcalHits.size() << " " << std::hex << newid.rawId() - << std::dec << " E " << energy; + edm::LogVerbatim("HcalSim") << "Hit " << ii << " out of " << hcalHits.size() << " " << std::hex << newid + << std::dec << " E " << energy << " wt " << wt; #endif - hcalHit.setID(newid.rawId()); + hcalHit.setID(newid); #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HcalSim") << "Modified Hit " << HcalDetId(hcalHit.id()); + edm::LogVerbatim("HcalSim") << "Final Setting::subdet: " << HcalDetId(newid).subdet() << " z: " << HcalDetId(newid).zside() << " depth: " << HcalDetId(newid).depth() << " ieta: " << HcalDetId(newid).ietaAbs() << " iphi: " << HcalDetId(newid).iphi() << " wt " << wt; ++ii; #endif } @@ -57,30 +61,22 @@ DetId HcalHitRelabeller::relabel(const uint32_t testId, const HcalDDDRecConstant HcalDetId hid; int det, z, depth, eta, phi, layer, sign; HcalTestNumbering::unpackHcalIndex(testId, det, z, depth, eta, phi, layer); -#ifdef EDM_ML_DEBUG - edm::LogVerbatim("HcalSim") << "det: " << det << " " - << "z: " << z << " " - << "depth: " << depth << " " - << "ieta: " << eta << " " - << "iphi: " << phi << " " - << "layer: " << layer; -#endif + sign = (z == 0) ? (-1) : (1); HcalDDDRecConstants::HcalID id = theRecNumber->getHCID(det, sign * eta, phi, layer, depth); + int depth0 = ((det == 1) && (layer == 2) && (eta == 15)) ? depth : id.depth; if (id.subdet == int(HcalBarrel)) { - hid = HcalDetId(HcalBarrel, sign * id.eta, id.phi, id.depth); + hid = HcalDetId(HcalBarrel, sign * id.eta, id.phi, depth0); } else if (id.subdet == int(HcalEndcap)) { - hid = HcalDetId(HcalEndcap, sign * id.eta, id.phi, id.depth); + hid = HcalDetId(HcalEndcap, sign * id.eta, id.phi, depth0); } else if (id.subdet == int(HcalOuter)) { - hid = HcalDetId(HcalOuter, sign * id.eta, id.phi, id.depth); + hid = HcalDetId(HcalOuter, sign * id.eta, id.phi, depth0); } else if (id.subdet == int(HcalForward)) { - hid = HcalDetId(HcalForward, sign * id.eta, id.phi, id.depth); + hid = HcalDetId(HcalForward, sign * id.eta, id.phi, depth0); } #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HcalSim") << " new HcalDetId -> hex.RawID = " << std::hex << hid.rawId() << std::dec - << " det, z, depth, eta, phi = " << det << " " << z << " " << id.depth << " " << id.eta - << " " << id.phi << " ---> " << hid; + edm::LogVerbatim("HcalSim") << "Initial indices:" << "subdet: " << det << " " << "z: " << z << " " << "depth: " << depth << " " << "ieta: " << eta << " " << "iphi: " << phi << " " << "layer: " << layer << " new HcalDetId -> hex.RawID = " << std::hex << hid.rawId() << std::dec << " subdet, z, depth, eta, phi = " << det << " " << z << " " << id.depth << " " << id.eta << " " << id.phi << " ---> " << hid; #endif return hid; } diff --git a/SimG4CMS/Calo/test/python/runHcalHitRelabeller_cfg.py b/SimG4CMS/Calo/test/python/runHcalHitRelabeller_cfg.py new file mode 100644 index 0000000000000..eeb05f8fa5394 --- /dev/null +++ b/SimG4CMS/Calo/test/python/runHcalHitRelabeller_cfg.py @@ -0,0 +1,88 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.StandardSequences.Eras import eras +process = cms.Process("TEST",eras.Run3) +### RANDOM setting (change last digit(s) to make runs different !) +process.load("Configuration.StandardSequences.SimulationRandomNumberGeneratorSeeds_cff") + +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load("SimG4Core.Application.g4SimHits_cfi") +process.load("SimCalorimetry.Configuration.ecalDigiSequence_cff") +process.load("SimCalorimetry.Configuration.hcalDigiSequence_cff") +process.load("SimGeneral.PileupInformation.AddPileupSummary_cfi") +process.load("Configuration.StandardSequences.Reconstruction_cff") + +process.load("Configuration.EventContent.EventContent_cff") +process.load("SimGeneral.MixingModule.mixNoPU_cfi") +process.load("Configuration.StandardSequences.DigiToRaw_cff") +process.load("Configuration.StandardSequences.RawToDigi_cff") + +process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") +from Configuration.AlCa.autoCond import autoCond +process.GlobalTag.globaltag = autoCond["phase1_2022_realistic"] + +process.load("IOMC.EventVertexGenerators.VtxSmearedGauss_cfi") +process.load("Configuration.StandardSequences.GeometryDB_cff") +process.load("Configuration.StandardSequences.MagneticField_cff") +process.g4SimHits.UseMagneticField = False + +from Configuration.AlCa.autoCond import autoCond +process.GlobalTag.globaltag = autoCond['phase1_2022_realistic'] + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(500) +) + +if 'MessageLogger' in process.__dict__: + process.MessageLogger.HcalSim=dict() + +process.source = cms.Source("EmptySource") +process.generator = cms.EDProducer("FlatRandomEGunProducer", + PGunParameters = cms.PSet( + PartID = cms.vint32(13), #mu ieta=15-18 + MinEta = cms.double(1.22), + MaxEta = cms.double(1.56), + MinPhi = cms.double(-3.15926), + MaxPhi = cms.double(3.15926), + MinE = cms.double(20.0), + MaxE = cms.double(20.0) + ), + firstRun = cms.untracked.uint32(1), + AddAntiParticle = cms.bool(False) +) + +process.VtxSmeared.SigmaX = 0.00001 +process.VtxSmeared.SigmaY = 0.00001 +process.VtxSmeared.SigmaZ = 0.00001 + +process.FEVT = cms.OutputModule("PoolOutputModule", + outputCommands = process.FEVTDEBUGEventContent.outputCommands, + splitLevel = cms.untracked.int32(0), + fileName = cms.untracked.string("output.root") +) + +process.VtxSmeared.src = cms.InputTag("generator", "unsmeared") +process.generatorSmeared = cms.EDProducer("GeneratorSmearedProducer") +process.g4SimHits.Generator.HepMCProductLabel = cms.InputTag('VtxSmeared') +process.g4SimHits.LHCTransport = False + +process.p = cms.Path( + process.generator * + process.VtxSmeared * + process.generatorSmeared * + process.g4SimHits * + process.mix * + process.ecalDigiSequence * + process.hcalDigiSequence * + process.addPileupInfo * + process.bunchSpacingProducer * + process.ecalPacker * + process.esDigiToRaw * + process.hcalRawData * + process.rawDataCollector * + process.ecalDigis * + process.ecalPreshowerDigis * + process.hcalDigis +) + +###process.outpath = cms.EndPath(process.FEVT) From 459148059f4c8e972eb41a93665e1df2a391c014 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Thu, 29 Jun 2023 10:25:50 +0200 Subject: [PATCH 2/3] Code check --- .../HcalCommonData/src/HcalDDDSimConstants.cc | 18 ++++++++++-------- .../HcalCommonData/src/HcalHitRelabeller.cc | 17 ++++++++++++++--- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/Geometry/HcalCommonData/src/HcalDDDSimConstants.cc b/Geometry/HcalCommonData/src/HcalDDDSimConstants.cc index bafddaab39200..17183660eaede 100644 --- a/Geometry/HcalCommonData/src/HcalDDDSimConstants.cc +++ b/Geometry/HcalCommonData/src/HcalDDDSimConstants.cc @@ -83,7 +83,8 @@ HcalCellType::HcalCell HcalDDDSimConstants::cell( } else if (etaR <= nEta) { int laymin(depth), laymax(depth); if (idet == static_cast(HcalOuter)) { - laymin = (etaR > hpar->noff[2]) ? (static_cast(hpar->zHE.size())) : (static_cast(hpar->zHE.size())) - 1; + laymin = + (etaR > hpar->noff[2]) ? (static_cast(hpar->zHE.size())) : (static_cast(hpar->zHE.size())) - 1; laymax = (static_cast(hpar->zHE.size())); } double d1 = 0, d2 = 0; @@ -265,12 +266,12 @@ std::pair HcalDDDSimConstants::getEtaDepth( if (lay >= 0) { depth = layerGroup(det, etaR, phi, zside, lay - 1); if (((det == 2) && (etaR == 18)) || ((det == 1) && (etaR == 15))) - if (etaR == hpar->noff[0] && lay > 1) { - int kphi = phi + static_cast((hpar->phioff[3] + 0.1) / hpar->phibin[etaR - 1]); - kphi = (kphi - 1) % 4 + 1; - if (kphi == 2 || kphi == 3) - depth = layerGroup(det, etaR, phi, zside, lay - 2); - } + if (etaR == hpar->noff[0] && lay > 1) { + int kphi = phi + static_cast((hpar->phioff[3] + 0.1) / hpar->phibin[etaR - 1]); + kphi = (kphi - 1) % 4 + 1; + if (kphi == 2 || kphi == 3) + depth = layerGroup(det, etaR, phi, zside, lay - 2); + } } else if (det == static_cast(HcalBarrel)) { if (depth > getMaxDepth(det, etaR, phi, zside, false)) depth = getMaxDepth(det, etaR, phi, zside, false); @@ -398,7 +399,8 @@ int HcalDDDSimConstants::getLayerBack( } int HcalDDDSimConstants::getLayerMax(const int& eta, const int& depth) const { - int layermx = ((eta < hpar->etaMin[1]) && depth - 1 < maxDepth[0]) ? maxLayerHB_ + 1 : static_cast(layerGroupSize(eta - 1)); + int layermx = ((eta < hpar->etaMin[1]) && depth - 1 < maxDepth[0]) ? maxLayerHB_ + 1 + : static_cast(layerGroupSize(eta - 1)); return layermx; } diff --git a/Geometry/HcalCommonData/src/HcalHitRelabeller.cc b/Geometry/HcalCommonData/src/HcalHitRelabeller.cc index f7c5a9699d08c..b1ff33cb843fa 100644 --- a/Geometry/HcalCommonData/src/HcalHitRelabeller.cc +++ b/Geometry/HcalCommonData/src/HcalHitRelabeller.cc @@ -27,7 +27,7 @@ void HcalHitRelabeller::process(std::vector& hcalHits) { int det, z, depth, eta, phi, layer; HcalTestNumbering::unpackHcalIndex(hcalHit.id(), det, z, depth, eta, phi, layer); if ((det == 2) && (layer == 2) && (eta == 18)) - depth = 2; + depth = 2; hid = HcalTestNumbering::packHcalIndex(det, z, depth, eta, phi, layer); double wt = (neutralDensity_) ? (energyWt(hid)) : 1.0; double energy = wt * (hcalHit.energy()); @@ -39,7 +39,10 @@ void HcalHitRelabeller::process(std::vector& hcalHits) { #endif hcalHit.setID(newid); #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HcalSim") << "Final Setting::subdet: " << HcalDetId(newid).subdet() << " z: " << HcalDetId(newid).zside() << " depth: " << HcalDetId(newid).depth() << " ieta: " << HcalDetId(newid).ietaAbs() << " iphi: " << HcalDetId(newid).iphi() << " wt " << wt; + edm::LogVerbatim("HcalSim") << "Final Setting::subdet: " << HcalDetId(newid).subdet() + << " z: " << HcalDetId(newid).zside() << " depth: " << HcalDetId(newid).depth() + << " ieta: " << HcalDetId(newid).ietaAbs() << " iphi: " << HcalDetId(newid).iphi() + << " wt " << wt; ++ii; #endif } @@ -76,7 +79,15 @@ DetId HcalHitRelabeller::relabel(const uint32_t testId, const HcalDDDRecConstant hid = HcalDetId(HcalForward, sign * id.eta, id.phi, depth0); } #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HcalSim") << "Initial indices:" << "subdet: " << det << " " << "z: " << z << " " << "depth: " << depth << " " << "ieta: " << eta << " " << "iphi: " << phi << " " << "layer: " << layer << " new HcalDetId -> hex.RawID = " << std::hex << hid.rawId() << std::dec << " subdet, z, depth, eta, phi = " << det << " " << z << " " << id.depth << " " << id.eta << " " << id.phi << " ---> " << hid; + edm::LogVerbatim("HcalSim") << "Initial indices:" + << "subdet: " << det << " " + << "z: " << z << " " + << "depth: " << depth << " " + << "ieta: " << eta << " " + << "iphi: " << phi << " " + << "layer: " << layer << " new HcalDetId -> hex.RawID = " << std::hex << hid.rawId() + << std::dec << " subdet, z, depth, eta, phi = " << det << " " << z << " " << id.depth + << " " << id.eta << " " << id.phi << " ---> " << hid; #endif return hid; } From 08f8c4aab07576fba12377707f6d8d71ac697b77 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Fri, 30 Jun 2023 08:45:16 +0200 Subject: [PATCH 3/3] Remove the files which are not needed in the bug fix --- .../HcalCommonData/src/HcalDDDRecConstants.cc | 34 +++++----- .../HcalCommonData/src/HcalDDDSimConstants.cc | 63 +++++++++---------- 2 files changed, 47 insertions(+), 50 deletions(-) diff --git a/Geometry/HcalCommonData/src/HcalDDDRecConstants.cc b/Geometry/HcalCommonData/src/HcalDDDRecConstants.cc index a156854a9e9d3..4ee9d2c6b0d0c 100644 --- a/Geometry/HcalCommonData/src/HcalDDDRecConstants.cc +++ b/Geometry/HcalCommonData/src/HcalDDDRecConstants.cc @@ -238,7 +238,7 @@ std::vector HcalDDDRecConstants::getHFCel if (maxDepth[2] > 0) { for (unsigned int k = 0; k < nEta; ++k) { int ieta = iEtaMin[2] + k; - int dphi = static_cast(0.001 + hcons.getPhiTableHF()[k] / (5._deg)); + int dphi = (int)(0.001 + hcons.getPhiTableHF()[k] / (5._deg)); int iphi = (dphi == 4) ? 3 : 1; int nphi = 72 / dphi; double rMin = hcons.getRTableHF()[nEta - k - 1] / CLHEP::cm; @@ -254,7 +254,7 @@ std::vector HcalDDDRecConstants::getHFCel for (unsigned int k = 0; k < hcons.getIdHF2QIE().size(); ++k) { int ieta = hcons.getIdHF2QIE()[k].ieta(); int ind = std::abs(ieta) - iEtaMin[2]; - int dphi = static_cast(0.001 + hcons.getPhiTableHF()[ind] / (5._deg)); + int dphi = (int)(0.001 + hcons.getPhiTableHF()[ind] / (5._deg)); int iphi = hcons.getIdHF2QIE()[k].iphi(); double rMin = hcons.getRTableHF()[nEta - ind - 1] / CLHEP::cm; double rMax = hcons.getRTableHF()[nEta - ind] / CLHEP::cm; @@ -264,7 +264,7 @@ std::vector HcalDDDRecConstants::getHFCel } else { for (unsigned int k = 0; k < nEta; ++k) { int ieta = iEtaMin[2] + k; - int dphi = static_cast(0.001 + hcons.getPhiTableHF()[k] / (5._deg)); + int dphi = (int)(0.001 + hcons.getPhiTableHF()[k] / (5._deg)); int iphi = (dphi == 4) ? 3 : 1; int nphi = 72 / dphi; double rMin = hcons.getRTableHF()[nEta - k - 1] / CLHEP::cm; @@ -307,7 +307,7 @@ int HcalDDDRecConstants::getLayerBack(const int& idet, const int& ieta, const in int laymax = hcons.getLastLayer(subdet, ieta); if (layBack < 0 && eta <= hpar->etaMax[1]) { for (unsigned int k = 0; k < layerGroupSize(eta - 1); ++k) { - if ((depth + 1) == static_cast(layerGroup(eta - 1, k))) { + if (depth + 1 == (int)layerGroup(eta - 1, k)) { layBack = k - 1; break; } @@ -333,8 +333,8 @@ int HcalDDDRecConstants::getLayerFront(const int& idet, const int& ieta, const i layFront = laymin; } else if (eta <= hpar->etaMax[1]) { for (unsigned int k = 0; k < layerGroupSize(eta - 1); ++k) { - if (depth == static_cast(layerGroup(eta - 1, k))) { - if (static_cast(k) >= laymin) { + if (depth == (int)layerGroup(eta - 1, k)) { + if ((int)(k) >= laymin) { layFront = k; break; } @@ -361,7 +361,7 @@ int HcalDDDRecConstants::getMaxDepth(const int& itype, const int& ieta, const in if (layerGroupSize(ieta - 1) > 0) { if (layerGroupSize(ieta - 1) < lymax) lymax = layerGroupSize(ieta - 1); - lmax = static_cast(layerGroup(ieta - 1, lymax - 1)); + lmax = (int)(layerGroup(ieta - 1, lymax - 1)); if (type == 0 && ieta == iEtaMax[type]) lmax = hcons.getDepthEta16M(1); if (type == 1 && ieta >= hpar->noff[1]) @@ -388,7 +388,7 @@ int HcalDDDRecConstants::getMinDepth(const int& itype, const int& ieta, const in if (type == 1 && ieta == iEtaMin[type]) lmin = hcons.getDepthEta16M(2); else - lmin = static_cast(layerGroup(ieta - 1, 0)); + lmin = (int)(layerGroup(ieta - 1, 0)); } } } @@ -455,7 +455,7 @@ double HcalDDDRecConstants::getRZ(const int& subdet, const int& ieta, const int& double HcalDDDRecConstants::getRZ(const int& subdet, const int& layer) const { double rz(0); - if (layer > 0 && layer <= static_cast(layerGroupSize(0))) + if (layer > 0 && layer <= (int)(layerGroupSize(0))) rz = ((subdet == static_cast(HcalBarrel)) ? (gconsHB[layer - 1].first) : (gconsHE[layer - 1].first)); #ifdef EDM_ML_DEBUG edm::LogVerbatim("HCalGeom") << "getRZ: subdet|layer " << subdet << "|" << layer << " rz " << rz; @@ -581,7 +581,7 @@ std::vector HcalDDDRecConstants::HcalCellTypes(HcalSubdetector sub } } for (unsigned int il = 0; il < etabin.layer.size(); ++il) { - int depth = etabin.depthStart + static_cast(il); + int depth = etabin.depthStart + (int)(il); temp[il].setEta(ieta, etabin.etaMin, etabin.etaMax); temp[il].setDepth(depth, dmin[il], dmax[il]); double foff = (etabin.ieta <= iEtaMax[0]) ? hpar->phioff[0] : hpar->phioff[1]; @@ -766,7 +766,7 @@ void HcalDDDRecConstants::getOneEtaBin(HcalSubdetector subdet, edm::LogVerbatim("HCalGeom") << "[" << l << "] " << phis[l].first << ":" << convertRadToDeg(phis[l].second); #endif for (itr = layers.begin(); itr != layers.end(); ++itr) { - if (itr->first <= static_cast(lymx0)) { + if (itr->first <= (int)(lymx0)) { if (itr->second == dep) { if (lmin == 0) lmin = itr->first; @@ -790,7 +790,7 @@ void HcalDDDRecConstants::getOneEtaBin(HcalSubdetector subdet, lmax = lymx0; break; } - if (itr->first == static_cast(lymx0)) + if (itr->first == (int)(lymx0)) lmax = lymx0; } } @@ -825,8 +825,8 @@ void HcalDDDRecConstants::getOneEtaBin(HcalSubdetector subdet, void HcalDDDRecConstants::initialize(void) { //Eta grouping - int nEta = static_cast(hpar->etagroup.size()); - if (nEta != static_cast(hpar->phigroup.size())) { + int 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"; @@ -845,7 +845,7 @@ void HcalDDDRecConstants::initialize(void) { for (int i = 0; i < nEta; ++i) { int ef = ieta + 1; ieta += (hpar->etagroup[i]); - if (ieta >= static_cast(hpar->etaTable.size())) { + if (ieta >= (int)(hpar->etaTable.size())) { edm::LogError("HCalGeom") << "HcalDDDRecConstants: Going beyond the array boundary " << hpar->etaTable.size() << " at index " << i << " of etaTable from SimConstant"; throw cms::Exception("DDException") @@ -878,7 +878,7 @@ void HcalDDDRecConstants::initialize(void) { for (int i = 0; i < nEta; ++i) { double dphi = (hpar->phigroup[i]) * (hpar->phibin[ieta]); phibin.emplace_back(dphi); - int nphi = static_cast((2._pi + 0.001) / dphi); + int nphi = (int)((2._pi + 0.001) / dphi); if (ieta <= iEtaMax[0]) { if (nphi > nPhiBins[0]) nPhiBins[3] = nPhiBins[0] = nphi; @@ -894,7 +894,7 @@ void HcalDDDRecConstants::initialize(void) { phiUnitS.emplace_back(unit); } for (double i : hpar->phitable) { - int nphi = static_cast((2._pi + 0.001) / i); + int nphi = (int)((2._pi + 0.001) / i); if (nphi > nPhiBins[2]) nPhiBins[2] = nphi; } diff --git a/Geometry/HcalCommonData/src/HcalDDDSimConstants.cc b/Geometry/HcalCommonData/src/HcalDDDSimConstants.cc index 17183660eaede..0179463958cca 100644 --- a/Geometry/HcalCommonData/src/HcalDDDSimConstants.cc +++ b/Geometry/HcalCommonData/src/HcalDDDSimConstants.cc @@ -42,7 +42,7 @@ HcalCellType::HcalCell HcalDDDSimConstants::cell( idet == static_cast(HcalOuter) || idet == static_cast(HcalForward)) && etaR >= etaMn && etaR <= etaMx && depth > 0) ok = true; - if (idet == static_cast(HcalEndcap) && depth > static_cast(hpar->zHE.size())) + if (idet == static_cast(HcalEndcap) && depth > (int)(hpar->zHE.size())) ok = false; else if (idet == static_cast(HcalBarrel) && depth > maxLayerHB_ + 1) ok = false; @@ -83,9 +83,8 @@ HcalCellType::HcalCell HcalDDDSimConstants::cell( } else if (etaR <= nEta) { int laymin(depth), laymax(depth); if (idet == static_cast(HcalOuter)) { - laymin = - (etaR > hpar->noff[2]) ? (static_cast(hpar->zHE.size())) : (static_cast(hpar->zHE.size())) - 1; - laymax = (static_cast(hpar->zHE.size())); + laymin = (etaR > hpar->noff[2]) ? ((int)(hpar->zHE.size())) : ((int)(hpar->zHE.size())) - 1; + laymax = ((int)(hpar->zHE.size())); } double d1 = 0, d2 = 0; if (idet == static_cast(HcalEndcap)) { @@ -128,7 +127,7 @@ unsigned int HcalDDDSimConstants::findLayer(const int& layer, const std::vector& layerGroup) const { unsigned int id = layerGroup.size(); for (unsigned int i = 0; i < layerGroup.size(); i++) { - if (layer == static_cast(layerGroup[i].layer)) { + if (layer == (int)(layerGroup[i].layer)) { id = i; break; } @@ -265,13 +264,12 @@ std::pair HcalDDDSimConstants::getEtaDepth( } else { if (lay >= 0) { depth = layerGroup(det, etaR, phi, zside, lay - 1); - if (((det == 2) && (etaR == 18)) || ((det == 1) && (etaR == 15))) - if (etaR == hpar->noff[0] && lay > 1) { - int kphi = phi + static_cast((hpar->phioff[3] + 0.1) / hpar->phibin[etaR - 1]); - kphi = (kphi - 1) % 4 + 1; - if (kphi == 2 || kphi == 3) - depth = layerGroup(det, etaR, phi, zside, lay - 2); - } + if (etaR == hpar->noff[0] && lay > 1) { + int kphi = phi + int((hpar->phioff[3] + 0.1) / hpar->phibin[etaR - 1]); + kphi = (kphi - 1) % 4 + 1; + if (kphi == 2 || kphi == 3) + depth = layerGroup(det, etaR, phi, zside, lay - 2); + } } else if (det == static_cast(HcalBarrel)) { if (depth > getMaxDepth(det, etaR, phi, zside, false)) depth = getMaxDepth(det, etaR, phi, zside, false); @@ -373,7 +371,7 @@ int HcalDDDSimConstants::getLayerFront( if (det == 1 || det == 2) { layer = 1; for (int l = 0; l < getLayerMax(eta, depth); ++l) { - if (static_cast(layerGroup(eta - 1, l)) == depth) { + if ((int)(layerGroup(eta - 1, l)) == depth) { layer = l + 1; break; } @@ -399,8 +397,7 @@ int HcalDDDSimConstants::getLayerBack( } int HcalDDDSimConstants::getLayerMax(const int& eta, const int& depth) const { - int layermx = ((eta < hpar->etaMin[1]) && depth - 1 < maxDepth[0]) ? maxLayerHB_ + 1 - : static_cast(layerGroupSize(eta - 1)); + int layermx = ((eta < hpar->etaMin[1]) && depth - 1 < maxDepth[0]) ? maxLayerHB_ + 1 : (int)layerGroupSize(eta - 1); return layermx; } @@ -445,7 +442,7 @@ int HcalDDDSimConstants::getMinDepth( if (ldmap_.isValid(det, phi, zside)) { lmin = ldmap_.getDepths(eta).first; } else if (layerGroupSize(eta - 1) > 0) { - lmin = static_cast(layerGroup(eta - 1, 0)); + lmin = (int)(layerGroup(eta - 1, 0)); unsigned int type = (det == 1) ? 0 : 1; if (type == 1 && eta == hpar->etaMin[1]) lmin = getDepthEta16(det, phi, zside); @@ -674,7 +671,7 @@ unsigned int HcalDDDSimConstants::numberOfCells(const HcalSubdetector& subdet) c unsigned int num = 0; std::vector cellTypes = HcalCellTypes(subdet); for (auto& cellType : cellTypes) { - num += static_cast(cellType.nPhiBins()); + num += (unsigned int)(cellType.nPhiBins()); } #ifdef EDM_ML_DEBUG edm::LogVerbatim("HCalGeom") << "HcalDDDSimConstants:numberOfCells " << cellTypes.size() << " " << num @@ -793,7 +790,7 @@ void HcalDDDSimConstants::initialize(void) { int layermx = getLayerMax(k + 1, i + 1); int ll = layermx; for (int l = layermx - 1; l >= 0; --l) { - if (static_cast(layerGroup(k, l)) == i + 1) { + if ((int)layerGroup(k, l) == i + 1) { ll = l + 1; break; } @@ -840,14 +837,14 @@ void HcalDDDSimConstants::initialize(void) { int noffsize = 7 + hpar->noff[5] + hpar->noff[6]; int noffl(noffsize + 5); - if (static_cast(hpar->noff.size()) > (noffsize + 3)) { + if ((int)(hpar->noff.size()) > (noffsize + 3)) { depthEta16[0] = hpar->noff[noffsize]; depthEta16[1] = hpar->noff[noffsize + 1]; depthEta29[0] = hpar->noff[noffsize + 2]; depthEta29[1] = hpar->noff[noffsize + 3]; - if (static_cast(hpar->noff.size()) > (noffsize + 4)) { + if ((int)(hpar->noff.size()) > (noffsize + 4)) { noffl += (2 * hpar->noff[noffsize + 4]); - if (static_cast(hpar->noff.size()) > noffl) + if ((int)(hpar->noff.size()) > noffl) isBH_ = (hpar->noff[noffl] > 0); } } else { @@ -863,7 +860,7 @@ void HcalDDDSimConstants::initialize(void) { << depthEta29[1] << ")"; #endif - if (static_cast(hpar->noff.size()) > (noffsize + 4)) { + if ((int)(hpar->noff.size()) > (noffsize + 4)) { int npair = hpar->noff[noffsize + 4]; int kk = noffsize + 4; for (int k = 0; k < npair; ++k) { @@ -896,16 +893,16 @@ void HcalDDDSimConstants::initialize(void) { } depthMaxSp_ = std::pair(0, 0); int noffk(noffsize + 5); - if (static_cast(hpar->noff.size()) > (noffsize + 5)) { + if ((int)(hpar->noff.size()) > (noffsize + 5)) { noffk += (2 * hpar->noff[noffsize + 4]); - if (static_cast(hpar->noff.size()) >= noffk + 7) { + if ((int)(hpar->noff.size()) >= noffk + 7) { int dtype = hpar->noff[noffk + 1]; int nphi = hpar->noff[noffk + 2]; int ndeps = hpar->noff[noffk + 3]; int ndp16 = hpar->noff[noffk + 4]; int ndp29 = hpar->noff[noffk + 5]; double wt = 0.1 * (hpar->noff[noffk + 6]); - if (static_cast(hpar->noff.size()) >= (noffk + 7 + nphi + 3 * ndeps)) { + if ((int)(hpar->noff.size()) >= (noffk + 7 + nphi + 3 * ndeps)) { if (dtype == 1 || dtype == 2) { std::vector ifi, iet, ily, idp; for (int i = 0; i < nphi; ++i) @@ -934,15 +931,15 @@ void HcalDDDSimConstants::initialize(void) { } } int noffm = (noffk + 7 + nphi + 3 * ndeps); - if (static_cast(hpar->noff.size()) > noffm) { + if ((int)(hpar->noff.size()) > noffm) { int ndnext = hpar->noff[noffm]; - if (ndnext > 4 && static_cast(hpar->noff.size()) >= noffm + ndnext) { + if (ndnext > 4 && (int)(hpar->noff.size()) >= noffm + ndnext) { for (int i = 0; i < 2; ++i) layFHB[i] = hpar->noff[noffm + i + 1]; for (int i = 0; i < 3; ++i) layFHE[i] = hpar->noff[noffm + i + 3]; } - if (ndnext > 11 && static_cast(hpar->noff.size()) >= noffm + ndnext) { + if (ndnext > 11 && (int)(hpar->noff.size()) >= noffm + ndnext) { for (int i = 0; i < 3; ++i) layBHB[i] = hpar->noff[noffm + i + 6]; for (int i = 0; i < 4; ++i) @@ -1203,10 +1200,10 @@ void HcalDDDSimConstants::printTileHE(const int& eta, const int& phi, const int& unsigned int HcalDDDSimConstants::layerGroupSize(int eta) const { unsigned int k = 0; for (auto const& it : hpar->layerGroupEtaSim) { - if (it.layer == static_cast(eta + 1)) { + if (it.layer == (unsigned int)(eta + 1)) { return it.layerGroup.size(); } - if (it.layer > static_cast(eta + 1)) + if (it.layer > (unsigned int)(eta + 1)) break; k = it.layerGroup.size(); } @@ -1216,10 +1213,10 @@ unsigned int HcalDDDSimConstants::layerGroupSize(int eta) const { unsigned int HcalDDDSimConstants::layerGroup(int eta, int i) const { unsigned int k = 0; for (auto const& it : hpar->layerGroupEtaSim) { - if (it.layer == static_cast(eta + 1)) { + if (it.layer == (unsigned int)(eta + 1)) { return it.layerGroup.at(i); } - if (it.layer > static_cast(eta + 1)) + if (it.layer > (unsigned int)(eta + 1)) break; k = it.layerGroup.at(i); } @@ -1228,6 +1225,6 @@ unsigned int HcalDDDSimConstants::layerGroup(int eta, int i) const { unsigned int HcalDDDSimConstants::layerGroup(int det, int eta, int phi, int zside, int lay) const { int depth0 = findDepth(det, eta, phi, zside, lay); - unsigned int depth = (depth0 > 0) ? static_cast(depth0) : layerGroup(eta - 1, lay); + unsigned int depth = (depth0 > 0) ? (unsigned int)(depth0) : layerGroup(eta - 1, lay); return depth; }