Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phase2-hgx358E Update the DetId for HGCal scintillator in view of changes for the V19 version of HGCal geometry #45383

Merged
merged 2 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,34 @@
[9:16] |ring| index (starting from a minimum radius depending on type)
[17:21] Layer #
[22] Trigger(1)/Detector(0) cell
[23] SiPM type (0 for 2mm: 1 for 4mm)
[24] Free
[23] SiPM type (0 for Small: 1 for Large)
[24] Granularity of the tile (0 normal; 1 fine)
[25:25] z-side (0 for +z; 1 for -z)
[26:27] Tile granularity and type (0 fine divisions of scintillators;
1 coarse divisions of type "c";
2 coarse divisions of type "m")
[26:27] Tile make (1 of type "c"; 2 of type "m")
[28:31] Detector type (HGCalHSc)
*/

class HGCScintillatorDetId : public DetId {
public:
enum tileGranularity { HGCalTileNormal = 0, HGCalTileFine = 1 };
enum sipmType { HGCalSiPMSmall = 0, HGCalSiPMLarge = 1 };
enum tileType { HGCalTileTypeUnknown = 0, HGCalTileTypeCaste = 1, HGCalTileTypeMould = 2 };
/** Create a null cellid*/
constexpr HGCScintillatorDetId() : DetId() {}
/** Create cellid from raw id (0=invalid tower id) */
constexpr HGCScintillatorDetId(uint32_t rawid) : DetId(rawid) {}
/** Constructor from subdetector, zplus, layer, module, cell numbers */
constexpr HGCScintillatorDetId(int type, int layer, int ring, int phi, bool trigger = false, int sipm = 0)
constexpr HGCScintillatorDetId(
int type, int layer, int ring, int phi, bool trigger = false, int sipm = 0, int granularity = 0)
: DetId(HGCalHSc, ForwardEmpty) {
int zside = (ring < 0) ? 1 : 0;
int itrig = trigger ? 1 : 0;
int ringAbs = std::abs(ring);
id_ |= (((type & kHGCalTypeMask) << kHGCalTypeOffset) | ((zside & kHGCalZsideMask) << kHGCalZsideOffset) |
((sipm & kHGCalSiPMMask) << kHGCalSiPMOffset) | ((itrig & kHGCalTriggerMask) << kHGCalTriggerOffset) |
((layer & kHGCalLayerMask) << kHGCalLayerOffset) | ((ringAbs & kHGCalRadiusMask) << kHGCalRadiusOffset) |
((phi & kHGCalPhiMask) << kHGCalPhiOffset));
((phi & kHGCalPhiMask) << kHGCalPhiOffset) |
((granularity & kHGCalGranularityMask) << kHGCalGranularityOffset));
}

/** Constructor from a generic cell id */
Expand Down Expand Up @@ -80,6 +83,11 @@ class HGCScintillatorDetId : public DetId {
id_ &= kHGCalTypeMask0;
id_ |= ((type & kHGCalTypeMask) << kHGCalTypeOffset);
}
constexpr int granularity() const { return (id_ >> kHGCalGranularityOffset) & kHGCalGranularityMask; }
constexpr void setGranularity(int granularity) {
id_ &= kHGCalGranularityMask0;
id_ |= ((granularity & kHGCalGranularityMask) << kHGCalGranularityOffset);
}

/// get the z-side of the cell (1/-1)
constexpr int zside() const { return (((id_ >> kHGCalZsideOffset) & kHGCalZsideMask) ? -1 : 1); }
Expand Down Expand Up @@ -145,6 +153,9 @@ class HGCScintillatorDetId : public DetId {
static constexpr int kHGCalTriggerMask = 0x1;
static constexpr int kHGCalSiPMOffset = 23;
static constexpr int kHGCalSiPMMask = 0x1;
static constexpr int kHGCalGranularityOffset = 24;
static constexpr int kHGCalGranularityMask = 0x1;
static constexpr int kHGCalGranularityMask0 = 0xFFDFFFFF;
static constexpr int kHGCalSiPMMask0 = 0xFF7FFFFF;
static constexpr int kHGCalZsideOffset = 25;
static constexpr int kHGCalZsideMask = 0x1;
Expand Down
5 changes: 3 additions & 2 deletions DataFormats/ForwardDetId/src/HGCScintillatorDetId.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ std::vector<HGCScintillatorDetId> HGCScintillatorDetId::detectorCells() const {

std::ostream& operator<<(std::ostream& s, const HGCScintillatorDetId& id) {
return s << " HGCScintillatorDetId::EE:HE= " << id.isEE() << ":" << id.isHE() << " trigger= " << id.trigger()
<< " type= " << id.type() << " SiPM= " << id.sipm() << " layer= " << id.layer() << " ring= " << id.iradius()
<< ":" << id.iradiusTrigger() << " phi= " << id.iphi() << ":" << id.iphiTrigger();
<< " granularity= " << id.granularity() << " type= " << id.type() << " SiPM= " << id.sipm()
<< " layer= " << id.layer() << " ring= " << id.iradius() << ":" << id.iradiusTrigger()
<< " phi= " << id.iphi() << ":" << id.iphiTrigger();
}