14 #include "G4LogicalVolumeStore.hh" 15 #include "G4LogicalVolume.hh" 18 #include "G4ParticleTable.hh" 19 #include "G4VProcess.hh" 72 G4String myName =
name;
75 if (myName.find(
"HitsEE") != std::string::npos) {
77 nameX_ =
"HGCalEESensitive";
78 }
else if (myName.find(
"HitsHEfront") != std::string::npos) {
80 nameX_ =
"HGCalHESiliconSensitive";
84 edm::LogVerbatim(
"HGCSim") <<
"**************************************************" 88 <<
"* Constructing a HGCalSD with name " <<
name <<
"\n" 91 <<
"**************************************************";
103 double r = aStep->GetPreStepPoint()->GetPosition().perp();
104 double z =
std::abs(aStep->GetPreStepPoint()->GetPosition().z());
106 G4int parCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
107 G4String parName = aStep->GetTrack()->GetDefinition()->GetParticleName();
108 G4LogicalVolume* lv = aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume();
109 edm::LogVerbatim(
"HGCSim") <<
"HGCalSD: Hit from standard path from " << lv->GetName() <<
" for Track " 110 << aStep->GetTrack()->GetTrackID() <<
" (" << parCode <<
":" << parName <<
") R = " <<
r 111 <<
" Z = " <<
z <<
" slope = " <<
r /
z <<
":" <<
slopeMin_;
122 double wt2 = aStep->GetTrack()->GetWeight();
123 double destep =
weight_ * wt1 * (aStep->GetTotalEnergyDeposit());
128 <<
weight_ * wt1 * wt2 <<
" deStep: " << aStep->GetTotalEnergyDeposit() <<
":" << destep;
134 const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
135 const G4VTouchable* touch = preStepPoint->GetTouchable();
142 G4ThreeVector hitPoint = preStepPoint->GetPosition();
143 float globalZ = touch->GetTranslation(0).z();
144 int iz(globalZ > 0 ? 1 : -1);
146 int layer(0), moduleLev(-1), cell(-1);
148 layer = touch->GetReplicaNumber(2);
150 }
else if (touch->GetHistoryDepth() >
levelT2_) {
151 layer = touch->GetReplicaNumber(4);
152 cell = touch->GetReplicaNumber(1);
155 layer = touch->GetReplicaNumber(3);
158 int module = touch->GetReplicaNumber(moduleLev);
161 <<
useSimWt_ <<
" name " << touch->GetVolume(0)->GetName() <<
" layer:module:cell " 162 <<
layer <<
":" << moduleLev <<
":" <<
module <<
":" << cell;
164 G4Material* mat = aStep->GetPreStepPoint()->GetMaterial();
165 edm::LogVerbatim(
"HGCSim") <<
"Depths: " << touch->GetHistoryDepth() <<
" name " << touch->GetVolume(0)->GetName()
166 <<
":" << touch->GetReplicaNumber(0) <<
" " << touch->GetVolume(1)->GetName() <<
":" 167 << touch->GetReplicaNumber(1) <<
" " << touch->GetVolume(2)->GetName() <<
":" 168 << touch->GetReplicaNumber(2) <<
" " << touch->GetVolume(3)->GetName() <<
":" 169 << touch->GetReplicaNumber(3) <<
" " << touch->GetVolume(4)->GetName() <<
":" 170 << touch->GetReplicaNumber(4) <<
" " 171 <<
" layer:module:cell " <<
layer <<
":" <<
module <<
":" << cell <<
" Material " 172 << mat->GetName() <<
":" << mat->GetRadlen();
175 if (aStep->GetPreStepPoint()->GetMaterial()->GetRadlen() > 100000.)
184 G4ThreeVector
local = (touch->GetHistory()->GetTransform(moduleLev).TransformPoint(hitPoint));
210 std::string_view pid = (cshift ?
"HGCSim" :
"HGCalSim");
213 double xx = (hid1.
zside() > 0) ?
xy.first : -
xy.first;
214 double dx =
xx - (hitPoint.x() / CLHEP::cm);
215 double dy =
xy.second - (hitPoint.y() / CLHEP::cm);
217 constexpr
double tol = 2.0 * 2.0;
219 if ((
diff > tol) || (!valid1))
224 <<
module <<
":" << cell <<
":" << moduleLev <<
" SimWt:history " <<
useSimWt_ <<
":" 225 << touch->GetHistoryDepth() <<
":" <<
levelT1_ <<
":" <<
levelT2_ <<
" input position: (" 226 << hitPoint.x() / CLHEP::cm <<
", " << hitPoint.y() / CLHEP::cm <<
":" 227 <<
convertRadToDeg(std::atan2(hitPoint.y(), hitPoint.x())) <<
"); position from ID (" <<
xx 229 <<
" Valid " << valid1 <<
" Wafer type|rotation " << partn.first <<
":" << partn.second
233 if ((
diff > tol) || (!valid1)) {
257 double mouseBiteNew = (
fiducialCut_) ? (mouseBite + guardRingOffset + sensorSizeOffset /
cos30deg_) : mouseBite;
262 << waferSize <<
":" << mouseBite <<
":" << guardRingOffset <<
":" << sensorSizeOffset
263 <<
":" << mouseBiteNew <<
":" <<
mouseBiteCut_ <<
" useOffset " << useOffset;
270 guardRing_ = std::make_unique<HGCGuardRing>(*hgcons_);
274 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.