16 #include "G4LogicalVolumeStore.hh" 17 #include "G4LogicalVolume.hh" 20 #include "G4ParticleTable.hh" 21 #include "G4VProcess.hh" 33 CaloSD(name, cpv, clg, p, manager,
36 hgcons_(
nullptr), slopeMin_(0), levelT1_(99), levelT2_(99),
56 G4String myName =
name;
59 if (myName.find(
"HitsEE")!=std::string::npos) {
61 nameX_ =
"HGCalEESensitive";
62 }
else if (myName.find(
"HitsHEfront")!=std::string::npos) {
64 nameX_ =
"HGCalHESiliconSensitive";
68 edm::LogVerbatim(
"HGCSim")<<
"**************************************************" 72 <<
"* Constructing a HGCalSD with name " << name <<
"\n" 75 <<
"**************************************************";
78 << eminHit_ <<
" for " <<
nameX_ <<
" detector " 83 <<
"boundary " << fiducialCut_ <<
" at " 86 <<
" cuts along " << angles_.size() <<
" axes: " 87 << angles_[0] <<
", " << angles_[1];
92 double r = aStep->GetPreStepPoint()->GetPosition().perp();
93 double z =
std::abs(aStep->GetPreStepPoint()->GetPosition().z());
95 G4int parCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
96 G4String parName = aStep->GetTrack()->GetDefinition()->GetParticleName();
98 aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume();
100 << lv->GetName() <<
" for Track " 101 << aStep->GetTrack()->GetTrackID() <<
" (" 102 << parCode <<
":" << parName <<
") R = " << r
103 <<
" Z = " << z <<
" slope = " << r/z <<
":" 107 if (r < z*slopeMin_) {
115 double wt2 = aStep->GetTrack()->GetWeight();
116 double destep =
weight_*wt1*(aStep->GetTotalEnergyDeposit());
117 if (wt2 > 0) destep *= wt2;
120 << wt1 <<
":" << wt2 <<
" Total weight " 121 <<
weight_*wt1*wt2 <<
" deStep: " 122 << aStep->GetTotalEnergyDeposit()
130 const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
131 const G4VTouchable* touch = preStepPoint->GetTouchable();
134 G4ThreeVector hitPoint = preStepPoint->GetPosition();
135 float globalZ = touch->GetTranslation(0).z();
136 int iz( globalZ>0 ? 1 : -1);
139 if ((touch->GetHistoryDepth() ==
levelT1_) ||
140 (touch->GetHistoryDepth() ==
levelT2_)) {
141 layer = touch->GetReplicaNumber(0);
147 <<
" name " << touch->GetVolume(0)->GetName()
148 <<
" layer:module:cell " << layer <<
":" 149 << module <<
":" << cell;
152 layer = touch->GetReplicaNumber(3);
153 module = touch->GetReplicaNumber(2);
154 cell = touch->GetReplicaNumber(1);
157 <<
" name " << touch->GetVolume(0)->GetName()
158 <<
" layer:module:cell " << layer <<
":" 159 << module <<
":" << cell;
163 G4Material* mat = aStep->GetPreStepPoint()->GetMaterial();
165 <<
" name " << touch->GetVolume(0)->GetName()
166 <<
":" << touch->GetReplicaNumber(0) <<
" " 167 << touch->GetVolume(1)->GetName()
168 <<
":" << touch->GetReplicaNumber(1) <<
" " 169 << touch->GetVolume(2)->GetName()
170 <<
":" << touch->GetReplicaNumber(2) <<
" " 171 << touch->GetVolume(3)->GetName()
172 <<
":" << touch->GetReplicaNumber(3) <<
" " 173 << touch->GetVolume(4)->GetName()
174 <<
":" << touch->GetReplicaNumber(4) <<
" " 175 <<
" layer:module:cell " << layer <<
":" 176 << module <<
":" << cell <<
" Material " 177 << mat->GetName() <<
":" << mat->GetRadlen();
180 if (aStep->GetPreStepPoint()->GetMaterial()->GetRadlen() > 100000.)
return 0;
182 uint32_t
id =
setDetUnitId (layer, module, cell, iz, hitPoint);
189 if (
mouseBite_->exclude(hitPoint, iz, uv.first, uv.second)) {
217 <<
" wafer " << waferSize <<
":" << mouseBite;
225 throw cms::Exception(
"Unknown",
"HGCalSD") <<
"Cannot find HGCalDDDConstants for " <<
nameX_ <<
"\n";
237 G4ThreeVector &
pos) {
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void setNumberCheckedHits(int val)
std::unique_ptr< HGCalNumberingScheme > numberingScheme_
Compact representation of the geometrical detector hierarchy.
HGCalSD(const std::string &, const DDCompactView &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
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
std::pair< int, int > waferUV() const
bool isItinFidVolume(const G4ThreeVector &)
HGCalGeometryMode::GeometryMode geom_mode_
bool filterHit(CaloG4Hit *, double) override
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.