13 #include "G4LogicalVolumeStore.hh" 14 #include "G4LogicalVolume.hh" 17 #include "G4ParticleTable.hh" 18 #include "G4VProcess.hh" 67 G4String myName =
name;
70 if (myName.find(
"HitsEE") != std::string::npos) {
72 nameX_ =
"HGCalEESensitive";
73 }
else if (myName.find(
"HitsHEfront") != std::string::npos) {
75 nameX_ =
"HGCalHESiliconSensitive";
79 edm::LogVerbatim(
"HGCSim") <<
"**************************************************" 83 <<
"* Constructing a HGCalSD with name " <<
name <<
"\n" 86 <<
"**************************************************";
98 double r = aStep->GetPreStepPoint()->GetPosition().perp();
99 double z =
std::abs(aStep->GetPreStepPoint()->GetPosition().z());
101 G4int parCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
102 G4String parName = aStep->GetTrack()->GetDefinition()->GetParticleName();
103 G4LogicalVolume* lv = aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume();
104 edm::LogVerbatim(
"HGCSim") <<
"HGCalSD: Hit from standard path from " << lv->GetName() <<
" for Track " 105 << aStep->GetTrack()->GetTrackID() <<
" (" << parCode <<
":" << parName <<
") R = " <<
r 106 <<
" Z = " <<
z <<
" slope = " <<
r /
z <<
":" <<
slopeMin_;
117 double wt2 = aStep->GetTrack()->GetWeight();
118 double destep =
weight_ * wt1 * (aStep->GetTotalEnergyDeposit());
123 <<
weight_ * wt1 * wt2 <<
" deStep: " << aStep->GetTotalEnergyDeposit() <<
":" << destep;
129 const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
130 const G4VTouchable* touch = preStepPoint->GetTouchable();
137 G4ThreeVector hitPoint = preStepPoint->GetPosition();
138 float globalZ = touch->GetTranslation(0).z();
139 int iz(globalZ > 0 ? 1 : -1);
144 layer = touch->GetReplicaNumber(2);
145 module = touch->GetReplicaNumber(1);
146 }
else if (touch->GetHistoryDepth() >
levelT2_) {
147 layer = touch->GetReplicaNumber(4);
148 module = touch->GetReplicaNumber(3);
149 cell = touch->GetReplicaNumber(1);
151 layer = touch->GetReplicaNumber(3);
152 module = touch->GetReplicaNumber(2);
156 <<
useSimWt_ <<
" name " << touch->GetVolume(0)->GetName() <<
" layer:module:cell " 160 }
else if ((touch->GetHistoryDepth() ==
levelT1_) || (touch->GetHistoryDepth() ==
levelT2_)) {
161 layer = touch->GetReplicaNumber(0);
164 <<
" name " << touch->GetVolume(0)->GetName() <<
" layer:module:cell " <<
layer <<
":" 168 layer = touch->GetReplicaNumber(3);
169 module = touch->GetReplicaNumber(2);
170 cell = touch->GetReplicaNumber(1);
172 edm::LogVerbatim(
"HGCSim") <<
"DepthsInside: " << touch->GetHistoryDepth() <<
" name " 173 << touch->GetVolume(0)->GetName() <<
" layer:module:cell " <<
layer <<
":" <<
module 178 G4Material* mat = aStep->GetPreStepPoint()->GetMaterial();
179 edm::LogVerbatim(
"HGCSim") <<
"Depths: " << touch->GetHistoryDepth() <<
" name " << touch->GetVolume(0)->GetName()
180 <<
":" << touch->GetReplicaNumber(0) <<
" " << touch->GetVolume(1)->GetName() <<
":" 181 << touch->GetReplicaNumber(1) <<
" " << touch->GetVolume(2)->GetName() <<
":" 182 << touch->GetReplicaNumber(2) <<
" " << touch->GetVolume(3)->GetName() <<
":" 183 << touch->GetReplicaNumber(3) <<
" " << touch->GetVolume(4)->GetName() <<
":" 184 << touch->GetReplicaNumber(4) <<
" " 185 <<
" layer:module:cell " <<
layer <<
":" <<
module <<
":" << cell <<
" Material " 186 << mat->GetName() <<
":" << mat->GetRadlen();
189 if (aStep->GetPreStepPoint()->GetMaterial()->GetRadlen() > 100000.)
198 if (
mouseBite_->exclude(hitPoint, iz, uv.first, uv.second)) {
212 std::string_view pid = (cshift ?
"HGCSim" :
"HGCalSim");
215 double xx = (hid1.
zside() > 0) ?
xy.first : -
xy.first;
216 double dx =
xx - (hitPoint.x() / CLHEP::cm);
217 double dy =
xy.second - (hitPoint.y() / CLHEP::cm);
219 constexpr
double tol = 2.0;
221 if ((
diff > tol) || (!valid1))
225 <<
", " << hitPoint.y() / CLHEP::cm <<
"); position from ID (" <<
xx <<
", " <<
xy.second
226 <<
") distance " <<
diff <<
" Valid " << valid1 <<
" Wafer type|rotation " << partn.first
227 <<
":" << partn.second <<
" CassetteShift " << cshift;
245 << waferSize <<
":" << mouseBite;
252 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 *)
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
bool cassetteShiftSilicon(int layer, int waferU, int waferV) 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
bool isItinFidVolume(const G4ThreeVector &)
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
std::unique_ptr< HGCMouseBite > mouseBite_
double getResponseWt(const G4Track *)
int levelTop(int ind=0) const
double waferSize(bool reco) const
double distFromEdgeHex(double x, double y, double z) const
void update(const BeginOfJob *) override
This routine will be called when the appropriate signal arrives.