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),
57 G4String myName =
name;
60 if (myName.find(
"HitsEE")!=std::string::npos) {
62 nameX_ =
"HGCalEESensitive";
63 }
else if (myName.find(
"HitsHEfront")!=std::string::npos) {
65 nameX_ =
"HGCalHESiliconSensitive";
69 edm::LogVerbatim(
"HGCSim")<<
"**************************************************" 73 <<
"* Constructing a HGCalSD with name " << name <<
"\n" 76 <<
"**************************************************";
79 << eminHit_ <<
" for " <<
nameX_ <<
" detector " 84 <<
"boundary " << fiducialCut_ <<
" at " 87 <<
" cuts along " << angles_.size() <<
" axes: " 88 << angles_[0] <<
", " << angles_[1];
93 double r = aStep->GetPreStepPoint()->GetPosition().perp();
94 double z =
std::abs(aStep->GetPreStepPoint()->GetPosition().z());
96 G4int parCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
97 G4String parName = aStep->GetTrack()->GetDefinition()->GetParticleName();
99 aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume();
101 << lv->GetName() <<
" for Track " 102 << aStep->GetTrack()->GetTrackID() <<
" (" 103 << parCode <<
":" << parName <<
") R = " << r
104 <<
" Z = " << z <<
" slope = " << r/z <<
":" 108 if (r < z*slopeMin_) {
116 double wt2 = aStep->GetTrack()->GetWeight();
117 double destep =
weight_*wt1*(aStep->GetTotalEnergyDeposit());
118 if (wt2 > 0) destep *= wt2;
121 << wt1 <<
":" << wt2 <<
" Total weight " 122 <<
weight_*wt1*wt2 <<
" deStep: " 123 << aStep->GetTotalEnergyDeposit()
131 const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
132 const G4VTouchable* touch = preStepPoint->GetTouchable();
135 G4ThreeVector hitPoint = preStepPoint->GetPosition();
136 float globalZ = touch->GetTranslation(0).z();
137 int iz( globalZ>0 ? 1 : -1);
140 if ((touch->GetHistoryDepth() ==
levelT1_) ||
141 (touch->GetHistoryDepth() ==
levelT2_)) {
142 layer = touch->GetReplicaNumber(0);
148 <<
" name " << touch->GetVolume(0)->GetName()
149 <<
" layer:module:cell " << layer <<
":" 150 << module <<
":" << cell;
153 layer = touch->GetReplicaNumber(3);
154 module = touch->GetReplicaNumber(2);
155 cell = touch->GetReplicaNumber(1);
158 <<
" name " << touch->GetVolume(0)->GetName()
159 <<
" layer:module:cell " << layer <<
":" 160 << module <<
":" << cell;
164 G4Material* mat = aStep->GetPreStepPoint()->GetMaterial();
166 <<
" name " << touch->GetVolume(0)->GetName()
167 <<
":" << touch->GetReplicaNumber(0) <<
" " 168 << touch->GetVolume(1)->GetName()
169 <<
":" << touch->GetReplicaNumber(1) <<
" " 170 << touch->GetVolume(2)->GetName()
171 <<
":" << touch->GetReplicaNumber(2) <<
" " 172 << touch->GetVolume(3)->GetName()
173 <<
":" << touch->GetReplicaNumber(3) <<
" " 174 << touch->GetVolume(4)->GetName()
175 <<
":" << touch->GetReplicaNumber(4) <<
" " 176 <<
" layer:module:cell " << layer <<
":" 177 << module <<
":" << cell <<
" Material " 178 << mat->GetName() <<
":" << mat->GetRadlen();
181 if (aStep->GetPreStepPoint()->GetMaterial()->GetRadlen() > 100000.)
return 0;
183 uint32_t
id =
setDetUnitId (layer, module, cell, iz, hitPoint);
190 if (
mouseBite_->exclude(hitPoint, iz, uv.first, uv.second)) {
221 <<
" wafer " << waferSize <<
":" << mouseBite;
229 throw cms::Exception(
"Unknown",
"HGCalSD") <<
"Cannot find HGCalDDDConstants for " <<
nameX_ <<
"\n";
241 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 &)
bool maskCell(const DetId &id, int corners) const
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.