Skip to content

Commit 665cbdf

Browse files
authored
Merge pull request cms-sw#42696 from bsunanda/Phase2-hgx345
Phase2-hgx345 Modify HGCMouseBite such that it can work for both standard HGCal as well as for TB setups with 6 inch wafers
2 parents a0d12d6 + a195a9d commit 665cbdf

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

SimG4CMS/Calo/interface/HGCMouseBite.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,23 @@
22
#define SimG4CMS_HGCMouseBite_h
33

44
#include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h"
5+
#include "Geometry/HGCalTBCommonData/interface/HGCalTBDDDConstants.h"
56
#include "G4ThreeVector.hh"
67

78
#include <vector>
89

910
class HGCMouseBite {
1011
public:
1112
HGCMouseBite(const HGCalDDDConstants& hgc, const std::vector<double>& angle, double maxLength, bool waferRotate);
13+
HGCMouseBite(const HGCalTBDDDConstants& hgc, const std::vector<double>& angle, double maxLength, bool waferRotate);
1214
bool exclude(G4ThreeVector& point, int zside, int layer, int waferU, int waferV);
1315

1416
private:
15-
const HGCalDDDConstants& hgcons_;
17+
void init(const std::vector<double>& angle);
18+
19+
const HGCalDDDConstants* hgcons_;
20+
const HGCalTBDDDConstants* hgTBcons_;
21+
const bool ifTB_;
1622
double cut_;
1723
bool rot_;
1824
bool modeUV_;

SimG4CMS/Calo/src/HGCMouseBite.cc

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,18 @@
77
//#define EDM_ML_DEBUG
88

99
HGCMouseBite::HGCMouseBite(const HGCalDDDConstants& hgc, const std::vector<double>& angle, double maxL, bool rot)
10-
: hgcons_(hgc), cut_(maxL), rot_(rot) {
11-
modeUV_ = hgcons_.waferHexagon8();
10+
: hgcons_(&hgc), hgTBcons_(nullptr), ifTB_(false), cut_(maxL), rot_(rot) {
11+
modeUV_ = hgcons_->waferHexagon8();
12+
init(angle);
13+
}
14+
15+
HGCMouseBite::HGCMouseBite(const HGCalTBDDDConstants& hgc, const std::vector<double>& angle, double maxL, bool rot)
16+
: hgcons_(nullptr), hgTBcons_(&hgc), ifTB_(true), cut_(maxL), rot_(rot) {
17+
modeUV_ = false;
18+
init(angle);
19+
}
20+
21+
void HGCMouseBite::init(const std::vector<double>& angle) {
1222
for (auto ang : angle) {
1323
projXY_.push_back(std::pair<double, double>(cos(ang * CLHEP::deg), sin(ang * CLHEP::deg)));
1424
}
@@ -25,8 +35,12 @@ bool HGCMouseBite::exclude(G4ThreeVector& point, int zside, int lay, int waferU,
2535
bool check(false);
2636
double dx(0), dy(0);
2737
if (point == G4ThreeVector()) {
28-
std::pair<double, double> xy =
29-
(modeUV_ ? hgcons_.waferPosition(lay, waferU, waferV, false, false) : hgcons_.waferPosition(waferU, false));
38+
std::pair<double, double> xy;
39+
if (ifTB_)
40+
xy = hgTBcons_->waferPosition(waferU, false);
41+
else
42+
xy =
43+
(modeUV_ ? hgcons_->waferPosition(lay, waferU, waferV, false, false) : hgcons_->waferPosition(waferU, false));
3044
double xx = (zside > 0) ? xy.first : -xy.first;
3145
if (rot_) {
3246
dx = std::abs(point.y() - xy.second);

0 commit comments

Comments
 (0)