14 #include "G4LogicalVolumeStore.hh" 15 #include "G4LogicalVolume.hh" 18 #include "G4ParticleTable.hh" 19 #include "G4VProcess.hh" 65 dd4hep_ =
p.getParameter<
bool>(
"g4GeometryDD4hepSource");
73 G4String myName =
name;
76 if (myName.find(
"HitsEE") != std::string::npos) {
78 nameX_ =
"HGCalEESensitive";
79 }
else if (myName.find(
"HitsHEfront") != std::string::npos) {
81 nameX_ =
"HGCalHESiliconSensitive";
85 edm::LogVerbatim(
"HGCSim") <<
"**************************************************" 89 <<
"* Constructing a HGCalSD with name " <<
name <<
"\n" 92 <<
"**************************************************";
104 double r = aStep->GetPreStepPoint()->GetPosition().perp();
105 double z =
std::abs(aStep->GetPreStepPoint()->GetPosition().z());
107 G4int parCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
108 G4String parName = aStep->GetTrack()->GetDefinition()->GetParticleName();
109 G4LogicalVolume* lv = aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume();
110 edm::LogVerbatim(
"HGCSim") <<
"HGCalSD: Hit from standard path from " << lv->GetName() <<
" for Track " 111 << aStep->GetTrack()->GetTrackID() <<
" (" << parCode <<
":" << parName <<
") R = " <<
r 112 <<
" Z = " <<
z <<
" slope = " <<
r /
z <<
":" <<
slopeMin_;
123 double wt2 = aStep->GetTrack()->GetWeight();
124 double destep =
weight_ * wt1 * (aStep->GetTotalEnergyDeposit());
129 <<
weight_ * wt1 * wt2 <<
" deStep: " << aStep->GetTotalEnergyDeposit() <<
":" << destep;
135 const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
136 const G4VTouchable* touch = preStepPoint->GetTouchable();
143 G4ThreeVector hitPoint = preStepPoint->GetPosition();
144 float globalZ = touch->GetTranslation(0).z();
145 int iz(globalZ > 0 ? 1 : -1);
147 int layer(0), moduleLev(-1), cell(-1);
149 layer = touch->GetReplicaNumber(2);
151 }
else if (touch->GetHistoryDepth() >
levelT2_) {
152 layer = touch->GetReplicaNumber(4);
153 cell = touch->GetReplicaNumber(1);
156 layer = touch->GetReplicaNumber(3);
159 int module = touch->GetReplicaNumber(moduleLev);
161 edm::LogVerbatim(
"HGCSim") <<
"Top " << touch->GetVolume(0)->GetName() <<
" Module " 162 << touch->GetVolume(moduleLev)->GetName();
165 <<
useSimWt_ <<
" name " << touch->GetVolume(0)->GetName() <<
" layer:module:cell " 166 <<
layer <<
":" << moduleLev <<
":" <<
module <<
":" << cell;
168 G4Material* mat = aStep->GetPreStepPoint()->GetMaterial();
169 edm::LogVerbatim(
"HGCSim") <<
"Depths: " << touch->GetHistoryDepth() <<
" name " << touch->GetVolume(0)->GetName()
170 <<
":" << touch->GetReplicaNumber(0) <<
" " << touch->GetVolume(1)->GetName() <<
":" 171 << touch->GetReplicaNumber(1) <<
" " << touch->GetVolume(2)->GetName() <<
":" 172 << touch->GetReplicaNumber(2) <<
" " << touch->GetVolume(3)->GetName() <<
":" 173 << touch->GetReplicaNumber(3) <<
" " << touch->GetVolume(4)->GetName() <<
":" 174 << touch->GetReplicaNumber(4) <<
" " 175 <<
" layer:module:cell " <<
layer <<
":" <<
module <<
":" << cell <<
" Material " 176 << mat->GetName() <<
":" << mat->GetRadlen();
179 if (aStep->GetPreStepPoint()->GetMaterial()->GetRadlen() > 100000.)
188 G4ThreeVector
local = (touch->GetHistory()->GetTransform(moduleLev).TransformPoint(hitPoint));
214 std::string_view pid = (cshift ?
"HGCSim" :
"HGCalSim");
217 double xx = (hid1.
zside() > 0) ?
xy.first : -
xy.first;
218 double dx =
xx - (hitPoint.x() / CLHEP::cm);
219 double dy =
xy.second - (hitPoint.y() / CLHEP::cm);
221 constexpr
double tol = 2.0 * 2.0;
223 if ((
diff > tol) || (!valid1))
228 <<
module <<
":" << cell <<
":" << moduleLev <<
" SimWt:history " <<
useSimWt_ <<
":" 229 << touch->GetHistoryDepth() <<
":" <<
levelT1_ <<
":" <<
levelT2_ <<
" input position: (" 230 << hitPoint.x() / CLHEP::cm <<
", " << hitPoint.y() / CLHEP::cm <<
":" 231 <<
convertRadToDeg(std::atan2(hitPoint.y(), hitPoint.x())) <<
"); position from ID (" <<
xx 233 <<
" Valid " << valid1 <<
" Wafer type|rotation " << partn.first <<
":" << partn.second
237 if ((
diff > tol) || (!valid1)) {
265 double mouseBiteNew = (
fiducialCut_) ? (mouseBite + guardRingOffset + sensorSizeOffset /
cos30deg_) : mouseBite;
270 << waferSize <<
":" << mouseBite <<
":" << guardRingOffset <<
":" << sensorSizeOffset
271 <<
":" << mouseBiteNew <<
":" <<
mouseBiteCut_ <<
" useOffset " << useOffset
279 guardRing_ = std::make_unique<HGCGuardRing>(*hgcons_);
283 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
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
Cos< T >::type cos(const T &t)
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
std::unique_ptr< HGCGuardRingPartial > guardRingPartial_
bool filterHit(CaloG4Hit *, double) override
bool cassetteShiftSilicon(int zside, int layer, int waferU, int waferV) const
double guardRingOffset(bool reco) const
std::unique_ptr< HGCGuardRing > guardRing_
double sensorSizeOffset(bool reco) const
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.