-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42183 from Pruthvi-ch/guardring_partial
Implementation of inactive regions along partial wafer cuts
- Loading branch information
Showing
4 changed files
with
92 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef SimG4CMS_HGCGuardRingPartial_h | ||
#define SimG4CMS_HGCGuardRingPartial_h | ||
|
||
#include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" | ||
#include "G4ThreeVector.hh" | ||
|
||
#include <vector> | ||
#include <array> | ||
|
||
class HGCGuardRingPartial { | ||
public: | ||
HGCGuardRingPartial(const HGCalDDDConstants& hgc); | ||
bool exclude(G4ThreeVector& point, int zside, int frontBack, int layer, int waferU, int waferV); | ||
static bool insidePolygon(double x, double y, const std::vector<std::pair<double, double> >& xyv); | ||
|
||
private: | ||
static constexpr double sqrt3_ = 1.732050807568877; // std::sqrt(3.0) in double precision | ||
const HGCalDDDConstants& hgcons_; | ||
const HGCalGeometryMode::GeometryMode modeUV_; | ||
const double waferSize_, guardRingOffset_; | ||
static constexpr std::array<double, 12> tan_1 = { | ||
{-sqrt3_, sqrt3_, 0.0, -sqrt3_, sqrt3_, 0.0, sqrt3_, -sqrt3_, 0.0, sqrt3_, -sqrt3_, 0.0}}; | ||
static constexpr std::array<double, 12> cos_1 = {{0.5, -0.5, -1.0, -0.5, 0.5, 1.0, -0.5, 0.5, 1.0, 0.5, -0.5, -1.0}}; | ||
static constexpr std::array<double, 12> cot_1 = { | ||
{sqrt3_, -sqrt3_, 0.0, sqrt3_, -sqrt3_, 0.0, -sqrt3_, sqrt3_, 0.0, -sqrt3_, sqrt3_, 0.0}}; | ||
double offset_, xmax_, ymax_; | ||
}; | ||
|
||
#endif // HGCGuardRing_h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#include "SimG4CMS/Calo/interface/HGCGuardRingPartial.h" | ||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
#include "Geometry/HGCalCommonData/interface/HGCalWaferMask.h" | ||
#include "Geometry/HGCalCommonData/interface/HGCalWaferType.h" | ||
#include "Geometry/HGCalCommonData/interface/HGCalTypes.h" | ||
#include <iostream> | ||
|
||
//#define EDM_ML_DEBUG | ||
|
||
HGCGuardRingPartial::HGCGuardRingPartial(const HGCalDDDConstants& hgc) | ||
: hgcons_(hgc), | ||
modeUV_(hgcons_.geomMode()), | ||
waferSize_(hgcons_.waferSize(false)), | ||
guardRingOffset_(hgcons_.getParameter()->guardRingOffset_) { | ||
offset_ = guardRingOffset_; | ||
#ifdef EDM_ML_DEBUG | ||
edm::LogVerbatim("HGCSim") << "Creating HGCGuardRingPartial with wafer size " << waferSize_ << ", Offsets " | ||
<< ":" << guardRingOffset_ << ":" << offset_ << ", and mode " << modeUV_; | ||
#endif | ||
} | ||
|
||
bool HGCGuardRingPartial::exclude(G4ThreeVector& point, int zside, int frontBack, int layer, int waferU, int waferV) { | ||
bool check(false); | ||
if (modeUV_ == HGCalGeometryMode::Hexagon8Cassette) { | ||
int index = HGCalWaferIndex::waferIndex(layer, waferU, waferV); | ||
int partial = HGCalWaferType::getPartial(index, hgcons_.getParameter()->waferInfoMap_); | ||
int type = HGCalWaferType::getType(index, hgcons_.getParameter()->waferInfoMap_); | ||
if (partial == HGCalTypes::WaferFull) { | ||
return (check); | ||
} else { | ||
int orient = HGCalWaferType::getOrient(index, hgcons_.getParameter()->waferInfoMap_); | ||
int placement = HGCalCell::cellPlacementIndex(zside, frontBack, orient); | ||
double delX = 0.5 * waferSize_; | ||
double delY = 2 * delX / sqrt3_; | ||
double dx = (zside > 0) ? -point.x() : point.x(); | ||
double dy = point.y(); | ||
double tresh = std::abs(offset_ / cos_1[placement]); | ||
if (type > 0) { | ||
check |= std::abs(dy - (dx * tan_1[placement])) < tresh; | ||
check |= std::abs(dy - (dx * tan_1[placement]) + ((HGCalTypes::c10 * delY * 0.5) / cos_1[placement])) < tresh; | ||
check |= std::abs(dy * cot_1[placement] - (dx)) < tresh; | ||
} else { | ||
check |= std::abs((dy * cot_1[placement]) - dx + ((HGCalTypes::c22 * delX) / cos_1[placement])) < tresh; | ||
check |= std::abs(dy - (dx * tan_1[placement]) - ((HGCalTypes::c27 * delY) / cos_1[placement])) < tresh; | ||
check |= std::abs(dy - (dx * tan_1[placement]) + ((HGCalTypes::c27 * delY) / cos_1[placement])) < tresh; | ||
} | ||
} | ||
#ifdef EDM_ML_DEBUG | ||
edm::LogVerbatim("HGCSim") << "HGCGuardRingPartial:: Point " << point << " zside " << zside << " layer " << layer | ||
<< " wafer " << waferU << ":" << waferV << " partial type " << partial << " type " | ||
<< type << " check " << check; | ||
#endif | ||
} | ||
return check; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters