13 #include "G4LogicalVolumeStore.hh"
14 #include "G4LogicalVolume.hh"
17 #include "G4ParticleTable.hh"
18 #include "G4VProcess.hh"
37 static_cast<float>(p.getParameter<edm::
ParameterSet>(
"HGCSD").getParameter<double>(
"TimeSliceUnit")),
38 p.getParameter<edm::
ParameterSet>(
"HGCSD").getParameter<bool>(
"IgnoreTrackID")),
43 tan30deg_(std::
tan(30.0 * CLHEP::deg)) {
57 if (storeAllG4Hits_) {
63 G4String myName =
name;
66 if (myName.find(
"HitsEE") != std::string::npos) {
68 nameX_ =
"HGCalEESensitive";
69 }
else if (myName.find(
"HitsHEfront") != std::string::npos) {
71 nameX_ =
"HGCalHESiliconSensitive";
75 edm::LogVerbatim(
"HGCSim") <<
"**************************************************"
79 <<
"* Constructing a HGCalSD with name " << name <<
"\n"
82 <<
"**************************************************";
89 edm::LogVerbatim(
"HGCSim") <<
"Reject MosueBite Flag: " << rejectMB_ <<
" cuts along " << angles_.size()
90 <<
" axes: " << angles_[0] <<
", " << angles_[1];
94 double r = aStep->GetPreStepPoint()->GetPosition().perp();
95 double z =
std::abs(aStep->GetPreStepPoint()->GetPosition().z());
97 G4int parCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
98 G4String parName = aStep->GetTrack()->GetDefinition()->GetParticleName();
99 G4LogicalVolume* lv = aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume();
100 edm::LogVerbatim(
"HGCSim") <<
"HGCalSD: Hit from standard path from " << lv->GetName() <<
" for Track "
101 << aStep->GetTrack()->GetTrackID() <<
" (" << parCode <<
":" << parName <<
") R = " << r
102 <<
" Z = " << z <<
" slope = " << r / z <<
":" <<
slopeMin_;
105 if (r < z * slopeMin_) {
113 double wt2 = aStep->GetTrack()->GetWeight();
114 double destep =
weight_ * wt1 * (aStep->GetTotalEnergyDeposit());
119 <<
weight_ * wt1 * wt2 <<
" deStep: " << aStep->GetTotalEnergyDeposit() <<
":" << destep;
125 const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
126 const G4VTouchable* touch = preStepPoint->GetTouchable();
133 G4ThreeVector hitPoint = preStepPoint->GetPosition();
134 float globalZ = touch->GetTranslation(0).z();
135 int iz(globalZ > 0 ? 1 : -1);
139 if (touch->GetHistoryDepth() >
levelT2_) {
140 layer = touch->GetReplicaNumber(4);
141 module = touch->GetReplicaNumber(3);
142 cell = touch->GetReplicaNumber(1);
144 layer = touch->GetReplicaNumber(3);
145 module = touch->GetReplicaNumber(2);
149 <<
" name " << touch->GetVolume(0)->GetName() <<
" layer:module:cell " <<
layer <<
":"
153 }
else if ((touch->GetHistoryDepth() ==
levelT1_) || (touch->GetHistoryDepth() ==
levelT2_)) {
154 layer = touch->GetReplicaNumber(0);
157 <<
" name " << touch->GetVolume(0)->GetName() <<
" layer:module:cell " <<
layer <<
":"
161 layer = touch->GetReplicaNumber(3);
162 module = touch->GetReplicaNumber(2);
163 cell = touch->GetReplicaNumber(1);
165 edm::LogVerbatim(
"HGCSim") <<
"DepthsInside: " << touch->GetHistoryDepth() <<
" name "
166 << touch->GetVolume(0)->GetName() <<
" layer:module:cell " <<
layer <<
":" <<
module
171 G4Material* mat = aStep->GetPreStepPoint()->GetMaterial();
172 edm::LogVerbatim(
"HGCSim") <<
"Depths: " << touch->GetHistoryDepth() <<
" name " << touch->GetVolume(0)->GetName()
173 <<
":" << touch->GetReplicaNumber(0) <<
" " << touch->GetVolume(1)->GetName() <<
":"
174 << touch->GetReplicaNumber(1) <<
" " << touch->GetVolume(2)->GetName() <<
":"
175 << touch->GetReplicaNumber(2) <<
" " << touch->GetVolume(3)->GetName() <<
":"
176 << touch->GetReplicaNumber(3) <<
" " << touch->GetVolume(4)->GetName() <<
":"
177 << touch->GetReplicaNumber(4) <<
" "
178 <<
" layer:module:cell " <<
layer <<
":" <<
module <<
":" << cell <<
" Material "
179 << mat->GetName() <<
":" << mat->GetRadlen();
182 if (aStep->GetPreStepPoint()->GetMaterial()->GetRadlen() > 100000.)
191 if (
mouseBite_->exclude(hitPoint, iz, uv.first, uv.second)) {
216 <<
" top Level " <<
levelT1_ <<
":" <<
levelT2_ <<
" wafer " << waferSize <<
":"
224 throw cms::Exception(
"Unknown",
"HGCalSD") <<
"Cannot find HGCalDDDConstants for " <<
nameX_ <<
"\n";
Log< level::Info, true > LogVerbatim
T getUntrackedParameter(std::string const &, T const &) const
void setNumberCheckedHits(int val)
uint16_t *__restrict__ id
HGCalSD(const std::string &, const HGCalDDDConstants *, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
std::pair< int, int > waferUV() const
std::unique_ptr< HGCalNumberingScheme > numberingScheme_
constexpr std::array< uint8_t, layerIndexSize > layer
double getEnergyDeposit(const G4Step *) override
uint32_t setDetUnitId(const G4Step *step) override
double mouseBite(bool reco) const
std::vector< double > angles_
const HGCalDDDConstants * hgcons_
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
HGCalGeometryMode::GeometryMode geomMode() const
double waferSize(bool reco) const
bool isItinFidVolume(const G4ThreeVector &)
bool maskCell(const DetId &id, int corners) const
T getParameter(std::string const &) const
HGCalGeometryMode::GeometryMode geom_mode_
bool filterHit(CaloG4Hit *, double) override
void printDetectorLevels(const G4VTouchable *) const
std::unique_ptr< HGCMouseBite > mouseBite_
int levelTop(int ind=0) const
double getResponseWt(const G4Track *)
double distFromEdgeHex(double x, double y, double z) const
double getEnergyDeposit() const
void update(const BeginOfJob *) override
This routine will be called when the appropriate signal arrives.