Skip to content

Commit 6a36f96

Browse files
author
Sunanda
committed
Add a few more utility methoods in RecHitTools which depend on the chosen detector geometry scenario
1 parent 86b5751 commit 6a36f96

File tree

2 files changed

+68
-1
lines changed

2 files changed

+68
-1
lines changed

RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ namespace edm {
2222
namespace hgcal {
2323
class RecHitTools {
2424
public:
25+
struct siliconWaferInfo {
26+
int32_t type, partialType, orientation, placementIndex, cassette;
27+
siliconWaferInfo(int32_t t = 0, int32_t p = 0, int32_t o = 0, int32_t i = 0, int32_t c = 0) : type(t), partialType(p), orientation(o), placementIndex(i), cassette(c) {}
28+
};
29+
struct scintillatorTileInfo {
30+
int32_t type, sipm, cassette;
31+
scintillatorTileInfo(int32_t t = 0, int32_t s = 0, int32_t c = 0) : type(t), sipm(s), cassette(c) {}
32+
};
2533
RecHitTools()
2634
: geom_(nullptr),
2735
eeOffset_(0),
@@ -63,6 +71,7 @@ namespace hgcal {
6371

6472
bool isSilicon(const DetId&) const;
6573
bool isScintillator(const DetId&) const;
74+
bool isScintillatorFine(const DetId& id) const;
6675
bool isBarrel(const DetId&) const;
6776

6877
bool isOnlySilicon(const unsigned int layer) const;
@@ -76,7 +85,8 @@ namespace hgcal {
7685
float getEta(const DetId& id, const float& vertex_z = 0.) const;
7786
float getPhi(const DetId& id) const;
7887
float getPt(const DetId& id, const float& hitEnergy, const float& vertex_z = 0.) const;
79-
88+
int getScintMaxIphi(const DetId& id) const;
89+
8090
inline const CaloGeometry* getGeometry() const { return geom_; };
8191
unsigned int lastLayerEE(bool nose = false) const { return (nose ? HFNoseDetId::HFNoseLayerEEmax : fhOffset_); }
8292
unsigned int lastLayerFH() const { return fhLastLayer_; }
@@ -93,6 +103,9 @@ namespace hgcal {
93103
inline int getGeometryType() const { return geometryType_; }
94104
bool maskCell(const DetId& id, int corners = 3) const;
95105

106+
// Informaion of the wafer/tile
107+
siliconWaferInfo getWaferInfo(const DetId& id) const;
108+
scintillatorTileInfo getTileInfo(const DetId& id) const;
96109
private:
97110
const CaloGeometry* geom_;
98111
unsigned int eeOffset_, fhOffset_, bhFirstLayer_, bhLastLayer_, bhOffset_, fhLastLayer_, noseLastLayer_;

RecoLocalCalo/HGCalRecAlgos/src/RecHitTools.cc

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ namespace {
4040
return ddd;
4141
}
4242

43+
inline const HGCalDDDConstants* get_ddd(const CaloSubdetectorGeometry* geom, const HGCScintillatorDetId& detid) {
44+
const HGCalGeometry* hg = static_cast<const HGCalGeometry*>(geom);
45+
const HGCalDDDConstants* ddd = &(hg->topology().dddConstants());
46+
check_ddd(ddd);
47+
return ddd;
48+
}
49+
4350
inline const HGCalDDDConstants* get_ddd(const CaloSubdetectorGeometry* geom, const HGCSiliconDetId& detid) {
4451
const HGCalGeometry* hg = static_cast<const HGCalGeometry*>(geom);
4552
const HGCalDDDConstants* ddd = &(hg->topology().dddConstants());
@@ -496,6 +503,14 @@ bool RecHitTools::isSilicon(const DetId& id) const {
496503

497504
bool RecHitTools::isScintillator(const DetId& id) const { return (id.det() == DetId::HGCalHSc); }
498505

506+
bool RecHitTools::isScintillatorFine(const DetId& id) const {
507+
if (id.det() == DetId::HGCalHSc) {
508+
auto hg = static_cast<const HGCalGeometry*>(getSubdetectorGeometry(id));
509+
return hg->topology().dddConstants().scintFine(HGCScintillatorDetId(id).layer());
510+
} else {
511+
return false;
512+
}
513+
}
499514
bool RecHitTools::isBarrel(const DetId& id) const { return (id.det() == DetId::Ecal || id.det() == DetId::Hcal); }
500515
bool RecHitTools::isOnlySilicon(const unsigned int layer) const {
501516
// HFnose TODO
@@ -538,6 +553,15 @@ float RecHitTools::getPt(const DetId& id, const float& hitEnergy, const float& v
538553
return pt;
539554
}
540555

556+
int RecHitTools::getScintMaxIphi(const DetId& id) const {
557+
if (id.det() == DetId::HGCalHSc) {
558+
auto hg = static_cast<const HGCalGeometry*>(getSubdetectorGeometry(id));
559+
return hg->topology().dddConstants().maxCells(HGCScintillatorDetId(id).layer(), true);
560+
} else {
561+
return 0;
562+
}
563+
}
564+
541565
std::pair<uint32_t, uint32_t> RecHitTools::firstAndLastLayer(DetId::Detector det, int subdet) const {
542566
if ((det == DetId::HGCalEE) || ((det == DetId::Forward) && (subdet == HGCEE))) {
543567
return std::make_pair(eeOffset_ + 1, fhOffset_);
@@ -558,3 +582,33 @@ bool RecHitTools::maskCell(const DetId& id, int corners) const {
558582
return hg->topology().dddConstants().maskCell(id, corners);
559583
}
560584
}
585+
586+
RecHitTools::siliconWaferInfo RecHitTools::getWaferInfo(const DetId& id) const {
587+
RecHitTools::siliconWaferInfo info;
588+
if ((id.det() == DetId::HGCalEE) || (id.det() == DetId::HGCalHSi)) {
589+
auto geom = getSubdetectorGeometry(id);
590+
HGCSiliconDetId hid(id);
591+
auto ddd = get_ddd(geom, hid);
592+
HGCalParameters::waferInfo info2 = ddd->waferInfo(hid.layer(), hid.waferU(), hid.waferV());
593+
info.type = info2.type;
594+
info.partialType = info2.part;
595+
info.orientation = info2.orient;
596+
info.cassette = info2.cassette;
597+
info.placementIndex = ddd->placementIndex(hid);
598+
}
599+
return info;
600+
}
601+
602+
RecHitTools::scintillatorTileInfo RecHitTools::getTileInfo(const DetId& id) const {
603+
RecHitTools::scintillatorTileInfo info;
604+
if (isScintillator(id)) {
605+
auto geom = getSubdetectorGeometry(id);
606+
HGCScintillatorDetId hid(id);
607+
auto ddd = get_ddd(geom, hid);
608+
HGCalParameters::tileInfo info2 = ddd->tileInfo(hid.zside(), hid.layer(), hid.ring());
609+
info.type = info2.type;
610+
info.sipm = info2.sipm;
611+
info.cassette = info2.cassette;
612+
}
613+
return info;
614+
}

0 commit comments

Comments
 (0)