Skip to content

Commit

Permalink
minor renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
ghugo83 committed Oct 29, 2020
1 parent 22a0bf7 commit de23b83
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions Geometry/EcalCommonData/src/EcalPreshowerNumberingScheme.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,15 @@ EcalPreshowerNumberingScheme::~EcalPreshowerNumberingScheme() {
edm::LogVerbatim("EcalGeom") << "Deleting EcalPreshowerNumberingScheme";
}

/*
* Compute the Ecal Preshower DetId.
* General NB: if possible, it would be way better to just access the DetID from a hash map from G4 Volume,
* rather than recomputing it for each SimHit - see Tracker.
*/
uint32_t EcalPreshowerNumberingScheme::getUnitID(const EcalBaseNumber& baseNumber) const {
int level = baseNumber.getLevels();
const int numberOfHierarchyLevels = baseNumber.getLevels();
uint32_t intIndex = 0;
if (level > 0) {
if (numberOfHierarchyLevels > 0) {
// depth index - silicon layer 1-st or 2-nd
int layer = 0;
if (baseNumber.getLevelName(0).find("SFSX") != std::string::npos) {
Expand All @@ -105,18 +110,25 @@ uint32_t EcalPreshowerNumberingScheme::getUnitID(const EcalBaseNumber& baseNumbe
<< " of Presh. Si. Strip : " << baseNumber.getLevelName(0);
}

// Access different hierarchy levels
static constexpr int stripHierachyLevel = 0;
static constexpr int boxHierachyLevel = 2;
static constexpr int ladderHierachyLevel = 3;
static constexpr int regionHierachyLevel = 5;

// Z index +Z = 1 ; -Z = 2
int zs = baseNumber.getCopyNumber(5);

int zs = baseNumber.getCopyNumber(regionHierachyLevel);
int zside = 2 * (1 - zs) + 1;

// box number
int box = baseNumber.getCopyNumber(2);
int box = baseNumber.getCopyNumber(boxHierachyLevel);

int x = 0, y = 0, ix, iy, id;
int mapX[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int mapY[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
const std::string& ladd = baseNumber.getLevelName(3).substr(0, 6);
int ladd_copy = baseNumber.getCopyNumber(3);
int ladd_copy = baseNumber.getCopyNumber(ladderHierachyLevel);

if (ladd == "SFLX0a" || ladd == "SFLY0a") {
mapX[5] = mapX[6] = mapX[7] = mapX[8] = mapX[9] = 1;
Expand Down Expand Up @@ -397,7 +409,7 @@ uint32_t EcalPreshowerNumberingScheme::getUnitID(const EcalBaseNumber& baseNumbe
}

// strip number inside wafer
int strip = baseNumber.getCopyNumber(0);
int strip = baseNumber.getCopyNumber(stripHierachyLevel);

if (layer == 1) {
if (zside > 0 && y <= 20)
Expand All @@ -419,7 +431,7 @@ uint32_t EcalPreshowerNumberingScheme::getUnitID(const EcalBaseNumber& baseNumbe
<< " layer " << layer << " strip " << strip << " UnitID 0x" << std::hex << intIndex
<< std::dec;

for (int ich = 0; ich < level; ich++)
for (int ich = 0; ich < numberOfHierarchyLevels; ich++)
edm::LogVerbatim("EcalGeom") << "Name = " << baseNumber.getLevelName(ich)
<< " copy = " << baseNumber.getCopyNumber(ich);
#endif
Expand Down

0 comments on commit de23b83

Please sign in to comment.