Skip to content

Commit

Permalink
Merge pull request #32006 from bsunanda/Run3-gex32x
Browse files Browse the repository at this point in the history
Run3-gex32x Complete the changes to the ECAL geometry code (clean up)
  • Loading branch information
cmsbuild committed Nov 3, 2020
2 parents cdc8adf + 9c9b431 commit e375510
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
21 changes: 10 additions & 11 deletions Geometry/EcalAlgo/plugins/EcalBarrelGeometryLoaderFromDDD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ void EcalBGL::fillGeom(EcalBarrelGeometry* geom,
unsigned int ioff = (vv.size() > maxSize) ? (vv.size() - maxSize) : 0;
pv.reserve(size);
for (unsigned int i(0); i != size; ++i) {
unsigned int ii = ioff + i;
const CCGFloat factor(1 == i || 2 == i || 6 == i || 10 == i ? 1 : static_cast<CCGFloat>(scale));
pv.emplace_back(factor * vv[ii]);
pv.emplace_back(factor * vv[i + ioff]);
}

std::vector<GlobalPoint> corners(8);
Expand Down Expand Up @@ -72,7 +71,7 @@ void EcalBGL::fillNamedParams(const DDFilteredView& _fv, EcalBarrelGeometry* geo

// this parameter can only appear once
assert(fvec.size() == 1);
geom->setNumXtalsPhiDirection((int)fvec[0]);
geom->setNumXtalsPhiDirection(static_cast<int>(fvec[0]));
} else
continue;

Expand All @@ -83,7 +82,7 @@ void EcalBGL::fillNamedParams(const DDFilteredView& _fv, EcalBarrelGeometry* geo
// there can only be one such value
assert(fmvec.size() == 1);

geom->setNumXtalsEtaDirection((int)fmvec[0]);
geom->setNumXtalsEtaDirection(static_cast<int>(fmvec[0]));
} else
// once we find nxtalPhi, the rest must also be defined
assert(1 == 0);
Expand All @@ -94,9 +93,9 @@ void EcalBGL::fillNamedParams(const DDFilteredView& _fv, EcalBarrelGeometry* geo
const std::vector<double>& ebvec = valEtaB.doubles();
assert(!ebvec.empty());
std::vector<int> EtaBaskets;
EtaBaskets.resize(ebvec.size());
for (unsigned i = 0; i < ebvec.size(); ++i)
EtaBaskets[i] = (int)ebvec[i];
EtaBaskets.reserve(ebvec.size());
for (const auto& ebv : ebvec)
EtaBaskets.emplace_back(static_cast<int>(ebv));
geom->setEtaBaskets(EtaBaskets);
} else
// once we find nxtalPhi, the rest must also be defined
Expand All @@ -107,7 +106,7 @@ void EcalBGL::fillNamedParams(const DDFilteredView& _fv, EcalBarrelGeometry* geo
if (DDfetch(&sv, valPhi)) {
const std::vector<double>& pvec = valPhi.doubles();
assert(!pvec.empty());
geom->setBasketSizeInPhi((int)pvec[0]);
geom->setBasketSizeInPhi(static_cast<int>(pvec[0]));
} else
// once we find nxtalPhi, the rest must also be defined
assert(1 == 0);
Expand All @@ -125,12 +124,12 @@ void EcalBGL::fillNamedParams(const cms::DDFilteredView& fv, EcalBarrelGeometry*
//nxtalEta
std::vector<double> tempD = fv.get<std::vector<double> >(specName, "nxtalEta");
assert(tempD.size() == 1);
geom->setNumXtalsEtaDirection((int)tempD[0]);
geom->setNumXtalsEtaDirection(static_cast<int>(tempD[0]));

//nxtalPhi
tempD = fv.get<std::vector<double> >(specName, "nxtalPhi");
assert(tempD.size() == 1);
geom->setNumXtalsPhiDirection((int)tempD[0]);
geom->setNumXtalsPhiDirection(static_cast<int>(tempD[0]));

//EtaBaskets
tempD = fv.get<std::vector<double> >(specName, "EtaBaskets");
Expand All @@ -140,5 +139,5 @@ void EcalBGL::fillNamedParams(const cms::DDFilteredView& fv, EcalBarrelGeometry*
//PhiBaskets
tempD = fv.get<std::vector<double> >(specName, "PhiBaskets");
assert(!tempD.empty());
geom->setBasketSizeInPhi((int)tempD[0]);
geom->setBasketSizeInPhi(static_cast<int>(tempD[0]));
}
13 changes: 6 additions & 7 deletions Geometry/EcalAlgo/plugins/EcalEndcapGeometryLoaderFromDDD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ void EcalEGL::fillGeom(EcalEndcapGeometry* geom,
unsigned int ioff = (vv.size() > maxSize) ? (vv.size() - maxSize) : 0;
pv.reserve(size);
for (unsigned int i(0); i != size; ++i) {
unsigned int ii = ioff + i;
const CCGFloat factor(1 == i || 2 == i || 6 == i || 10 == i ? 1 : scale);
pv.emplace_back(factor * vv[ii]);
const CCGFloat factor(1 == i || 2 == i || 6 == i || 10 == i ? 1 : static_cast<CCGFloat>(scale));
pv.emplace_back(factor * vv[i + ioff]);
}

std::vector<GlobalPoint> corners(8);
Expand Down Expand Up @@ -69,7 +68,7 @@ void EcalEGL::fillNamedParams(const DDFilteredView& _fv, EcalEndcapGeometry* geo

// this parameter can only appear once
assert(fvec.size() == 1);
geom->setNumberOfCrystalPerModule((int)fvec[0]);
geom->setNumberOfCrystalPerModule(static_cast<int>(fvec[0]));
} else
continue;

Expand All @@ -80,7 +79,7 @@ void EcalEGL::fillNamedParams(const DDFilteredView& _fv, EcalEndcapGeometry* geo

// there can only be one such value
assert(fmvec.size() == 1);
geom->setNumberOfModules((int)fmvec[0]);
geom->setNumberOfModules(static_cast<int>(fmvec[0]));
}

break;
Expand All @@ -96,10 +95,10 @@ void EcalEGL::fillNamedParams(const cms::DDFilteredView& fv, EcalEndcapGeometry*
//ncrys
std::vector<double> tempD = fv.get<std::vector<double> >(specName, "ncrys");
assert(tempD.size() == 1);
geom->setNumberOfCrystalPerModule((int)tempD[0]);
geom->setNumberOfCrystalPerModule(static_cast<int>(tempD[0]));

//nmods
tempD = fv.get<std::vector<double> >(specName, "nmods");
assert(tempD.size() == 1);
geom->setNumberOfModules((int)tempD[0]);
geom->setNumberOfModules(static_cast<int>(tempD[0]));
}

0 comments on commit e375510

Please sign in to comment.