14 #include "G4LogicalVolumeStore.hh" 15 #include "G4LogicalVolume.hh" 18 #include "G4ParticleTable.hh" 19 #include "G4VProcess.hh" 70 G4String myName =
name;
73 if (myName.find(
"HitsEE") != std::string::npos) {
75 nameX_ =
"HGCalEESensitive";
76 }
else if (myName.find(
"HitsHEfront") != std::string::npos) {
78 nameX_ =
"HGCalHESiliconSensitive";
82 edm::LogVerbatim(
"HGCSim") <<
"**************************************************" 86 <<
"* Constructing a HGCalSD with name " <<
name <<
"\n" 89 <<
"**************************************************";
101 double r = aStep->GetPreStepPoint()->GetPosition().perp();
102 double z =
std::abs(aStep->GetPreStepPoint()->GetPosition().z());
104 G4int parCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
105 G4String parName = aStep->GetTrack()->GetDefinition()->GetParticleName();
106 G4LogicalVolume* lv = aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume();
107 edm::LogVerbatim(
"HGCSim") <<
"HGCalSD: Hit from standard path from " << lv->GetName() <<
" for Track " 108 << aStep->GetTrack()->GetTrackID() <<
" (" << parCode <<
":" << parName <<
") R = " <<
r 109 <<
" Z = " <<
z <<
" slope = " <<
r /
z <<
":" <<
slopeMin_;
120 double wt2 = aStep->GetTrack()->GetWeight();
121 double destep =
weight_ * wt1 * (aStep->GetTotalEnergyDeposit());
126 <<
weight_ * wt1 * wt2 <<
" deStep: " << aStep->GetTotalEnergyDeposit() <<
":" << destep;
132 const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
133 const G4VTouchable* touch = preStepPoint->GetTouchable();
140 G4ThreeVector hitPoint = preStepPoint->GetPosition();
141 float globalZ = touch->GetTranslation(0).z();
142 int iz(globalZ > 0 ? 1 : -1);
144 int layer(0), moduleLev(-1), cell(-1);
146 layer = touch->GetReplicaNumber(2);
148 }
else if (touch->GetHistoryDepth() >
levelT2_) {
149 layer = touch->GetReplicaNumber(4);
150 cell = touch->GetReplicaNumber(1);
153 layer = touch->GetReplicaNumber(3);
156 int module = touch->GetReplicaNumber(moduleLev);
159 <<
useSimWt_ <<
" name " << touch->GetVolume(0)->GetName() <<
" layer:module:cell " 160 <<
layer <<
":" << moduleLev <<
":" <<
module <<
":" << cell;
162 G4Material* mat = aStep->GetPreStepPoint()->GetMaterial();
163 edm::LogVerbatim(
"HGCSim") <<
"Depths: " << touch->GetHistoryDepth() <<
" name " << touch->GetVolume(0)->GetName()
164 <<
":" << touch->GetReplicaNumber(0) <<
" " << touch->GetVolume(1)->GetName() <<
":" 165 << touch->GetReplicaNumber(1) <<
" " << touch->GetVolume(2)->GetName() <<
":" 166 << touch->GetReplicaNumber(2) <<
" " << touch->GetVolume(3)->GetName() <<
":" 167 << touch->GetReplicaNumber(3) <<
" " << touch->GetVolume(4)->GetName() <<
":" 168 << touch->GetReplicaNumber(4) <<
" " 169 <<
" layer:module:cell " <<
layer <<
":" <<
module <<
":" << cell <<
" Material " 170 << mat->GetName() <<
":" << mat->GetRadlen();
173 if (aStep->GetPreStepPoint()->GetMaterial()->GetRadlen() > 100000.)
182 G4ThreeVector
local = (touch->GetHistory()->GetTransform(moduleLev).TransformPoint(hitPoint));
207 std::string_view pid = (cshift ?
"HGCSim" :
"HGCalSim");
210 double xx = (hid1.
zside() > 0) ?
xy.first : -
xy.first;
211 double dx =
xx - (hitPoint.x() / CLHEP::cm);
212 double dy =
xy.second - (hitPoint.y() / CLHEP::cm);
214 constexpr
double tol = 2.0 * 2.0;
216 if ((
diff > tol) || (!valid1))
221 <<
module <<
":" << cell <<
":" << moduleLev <<
" SimWt:history " <<
useSimWt_ <<
":" 222 << touch->GetHistoryDepth() <<
":" <<
levelT1_ <<
":" <<
levelT2_ <<
" input position: (" 223 << hitPoint.x() / CLHEP::cm <<
", " << hitPoint.y() / CLHEP::cm <<
":" 224 <<
convertRadToDeg(std::atan2(hitPoint.y(), hitPoint.x())) <<
"); position from ID (" <<
xx 226 <<
" Valid " << valid1 <<
" Wafer type|rotation " << partn.first <<
":" << partn.second
230 if ((
diff > tol) || (!valid1)) {
256 << waferSize <<
":" << mouseBite <<
" useOffset " << useOffset;
263 guardRing_ = std::make_unique<HGCGuardRing>(*hgcons_);
265 throw cms::Exception(
"Unknown",
"HGCalSD") <<
"Cannot find HGCalDDDConstants for " <<
nameX_ <<
"\n";
bool maskCell(const DetId &id, int corners) const
Log< level::Info, true > LogVerbatim
T getParameter(std::string const &) const
void setNumberCheckedHits(int val)
const HGCalParameters * getParameter() const
HGCalSD(const std::string &, const HGCalDDDConstants *, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
constexpr NumType convertRadToDeg(NumType radians)
int cellU() const
get the cell #'s in u,v or in x,y
std::unique_ptr< HGCalNumberingScheme > numberingScheme_
std::pair< int, int > waferTypeRotation(int layer, int waferU, int waferV, bool fromFile, bool debug) const
std::pair< int, int > waferUV() const
HGCalGeometryMode::GeometryMode geomMode() const
bool isValidHex8(int lay, int waferU, int waferV, bool fullAndPart) const
T getUntrackedParameter(std::string const &, T const &) const
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
int layer() const
get the layer #
double getEnergyDeposit(const G4Step *) override
uint32_t setDetUnitId(const G4Step *step) override
std::tuple< int, int, int, int > waferFileInfo(unsigned int kk) const
std::vector< double > angles_
const HGCalDDDConstants * hgcons_
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
double mouseBite(bool reco) const
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
int zside() const
get the z-side of the cell (1/-1)
double getEnergyDeposit() const
HGCalGeometryMode::GeometryMode geom_mode_
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
bool waferHexagon8File() const
void printDetectorLevels(const G4VTouchable *) const
bool filterHit(CaloG4Hit *, double) override
bool cassetteShiftSilicon(int zside, int layer, int waferU, int waferV) const
std::unique_ptr< HGCGuardRing > guardRing_
std::unique_ptr< HGCMouseBite > mouseBite_
double getResponseWt(const G4Track *)
int levelTop(int ind=0) const
static int32_t layerFrontBack(int32_t layerOrient)
double waferSize(bool reco) const
int layerType(int lay) const
void update(const BeginOfJob *) override
This routine will be called when the appropriate signal arrives.