22 #include "G4LogicalVolumeStore.hh" 23 #include "G4LogicalVolume.hh" 26 #include "G4ParticleTable.hh" 27 #include "G4VProcess.hh" 39 CaloSD(name, cpv, clg, p, manager,
42 hgcons_(
nullptr), slopeMin_(0), levelT1_(99), levelT2_(99),
62 G4String myName =
name;
65 if (myName.find(
"HitsEE")!=std::string::npos) {
67 nameX_ =
"HGCalEESensitive";
68 }
else if (myName.find(
"HitsHEfront")!=std::string::npos) {
70 nameX_ =
"HGCalHESiliconSensitive";
74 edm::LogVerbatim(
"HGCSim")<<
"**************************************************" 78 <<
"* Constructing a HGCalSD with name " << name <<
"\n" 81 <<
"**************************************************";
84 << eminHit_ <<
" for " <<
nameX_ <<
" detector " 89 <<
"boundary " << fiducialCut_ <<
" at " 92 <<
" cuts along " << angles_.size() <<
" axes: " 93 << angles_[0] <<
", " << angles_[1];
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 =
104 aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume();
106 << lv->GetName() <<
" for Track " 107 << aStep->GetTrack()->GetTrackID() <<
" (" 108 << parCode <<
":" << parName <<
") R = " << r
109 <<
" Z = " << z <<
" slope = " << r/z <<
":" 113 if (r < z*slopeMin_) {
121 double wt2 = aStep->GetTrack()->GetWeight();
122 double destep =
weight_*wt1*(aStep->GetTotalEnergyDeposit());
123 if (wt2 > 0) destep *= wt2;
126 << wt1 <<
":" << wt2 <<
" Total weight " 127 <<
weight_*wt1*wt2 <<
" deStep: " 128 <<aStep->GetTotalEnergyDeposit()
136 const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
137 const G4VTouchable* touch = preStepPoint->GetTouchable();
140 G4ThreeVector hitPoint = preStepPoint->GetPosition();
141 float globalZ = touch->GetTranslation(0).z();
142 int iz( globalZ>0 ? 1 : -1);
145 if ((touch->GetHistoryDepth() ==
levelT1_) ||
146 (touch->GetHistoryDepth() ==
levelT2_)) {
147 layer = touch->GetReplicaNumber(0);
153 <<
" name " << touch->GetVolume(0)->GetName()
154 <<
" layer:module:cell " << layer <<
":" 155 << module <<
":" << cell;
158 layer = touch->GetReplicaNumber(3);
159 module = touch->GetReplicaNumber(2);
160 cell = touch->GetReplicaNumber(1);
163 <<
" name " << touch->GetVolume(0)->GetName()
164 <<
" layer:module:cell " << layer <<
":" 165 << module <<
":" << cell;
169 G4Material* mat = aStep->GetPreStepPoint()->GetMaterial();
171 <<
" name " << touch->GetVolume(0)->GetName()
172 <<
":" << touch->GetReplicaNumber(0) <<
" " 173 << touch->GetVolume(1)->GetName()
174 <<
":" << touch->GetReplicaNumber(1) <<
" " 175 << touch->GetVolume(2)->GetName()
176 <<
":" << touch->GetReplicaNumber(2) <<
" " 177 << touch->GetVolume(3)->GetName()
178 <<
":" << touch->GetReplicaNumber(3) <<
" " 179 << touch->GetVolume(4)->GetName()
180 <<
":" << touch->GetReplicaNumber(4) <<
" " 181 <<
" layer:module:cell " << layer <<
":" 182 << module <<
":" << cell <<
" Material " 183 << mat->GetName() <<
":" << mat->GetRadlen();
186 if (aStep->GetPreStepPoint()->GetMaterial()->GetRadlen() > 100000.)
return 0;
188 uint32_t
id =
setDetUnitId (layer, module, cell, iz, hitPoint);
195 if (
mouseBite_->exclude(hitPoint, iz, uv.first, uv.second)) {
223 <<
" wafer " << waferSize <<
":" << mouseBite;
231 throw cms::Exception(
"Unknown",
"HGCalSD") <<
"Cannot find HGCalDDDConstants for " <<
nameX_ <<
"\n";
243 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.