22 #include "G4LogicalVolumeStore.hh" 23 #include "G4LogicalVolume.hh" 26 #include "G4ParticleTable.hh" 27 #include "G4VProcess.hh" 39 CaloSD(name, cpv, clg, p, manager,
42 slopeMin_(0), levelT_(99) {
61 G4String myName =
name;
64 if (myName.find(
"HitsEE")!=std::string::npos) {
66 nameX_ =
"HGCalEESensitive";
67 }
else if (myName.find(
"HitsHEfront")!=std::string::npos) {
69 nameX_ =
"HGCalHESiliconSensitive";
70 }
else if (myName.find(
"HitsHEback")!=std::string::npos) {
72 nameX_ =
"HGCalHEScintillatorSensitive";
76 edm::LogVerbatim(
"HGCSim")<<
"**************************************************" 80 <<
"* Constructing a HGCSD with name " << name <<
"\n" 83 <<
"**************************************************";
91 <<
" Size of wafer " << waferSize
92 <<
" Mouse Bite " << mouseBite <<
":" 93 << mouseBiteCut_ <<
" along " << angles_.size()
99 double r = aStep->GetPreStepPoint()->GetPosition().perp();
100 double z =
std::abs(aStep->GetPreStepPoint()->GetPosition().z());
103 G4int parCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
104 G4LogicalVolume* lv =
105 aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume();
107 << lv->GetName() <<
" for Track " 108 << aStep->GetTrack()->GetTrackID() <<
" (" 109 << aStep->GetTrack()->GetDefinition()->GetParticleName()
110 <<
") R = " << r <<
" Z = " 111 << z <<
" slope = " << r/z <<
":" <<
slopeMin_;
115 if (r < z*slopeMin_) {
return 0.0; }
118 double wt2 = aStep->GetTrack()->GetWeight();
119 double destep = wt1*aStep->GetTotalEnergyDeposit();
120 if (wt2 > 0) destep *= wt2;
126 const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
127 const G4VTouchable* touch = preStepPoint->GetTouchable();
130 G4ThreeVector hitPoint = preStepPoint->GetPosition();
131 float globalZ=touch->GetTranslation(0).z();
132 int iz( globalZ>0 ? 1 : -1);
135 G4ThreeVector localpos = touch->GetHistory()->GetTopTransform().TransformPoint(hitPoint);
141 if (touch->GetHistoryDepth() ==
levelT_) {
142 layer = touch->GetReplicaNumber(0);
147 <<
" name " << touch->GetVolume(0)->GetName()
148 <<
" layer:module:cell " << layer <<
":" 149 << module <<
":" << cell;
152 layer = touch->GetReplicaNumber(2);
153 module = touch->GetReplicaNumber(1);
154 cell = touch->GetReplicaNumber(0);
158 <<
" name " << touch->GetVolume(0)->GetName()
159 <<
":" << touch->GetReplicaNumber(0) <<
" " 160 << touch->GetVolume(1)->GetName()
161 <<
":" << touch->GetReplicaNumber(1) <<
" " 162 << touch->GetVolume(2)->GetName()
163 <<
":" << touch->GetReplicaNumber(2) <<
" " 164 <<
" layer:module:cell " << layer <<
":" 165 << module <<
":" << cell <<
" Material " 166 << mat->GetName() <<
":" 167 << aStep->GetPreStepPoint()->GetMaterial()->GetRadlen();
171 if (aStep->GetPreStepPoint()->GetMaterial()->GetRadlen() > 100000.)
return 0;
173 uint32_t
id =
setDetUnitId (subdet, layer, module, cell, iz, localpos);
175 int det,
z, lay, wafer,
type, ic;
179 <<
" Decode " << det <<
":" << z <<
":" << lay
180 <<
":" << wafer <<
":" << type <<
":" << ic;
182 if (
mouseBite_->exclude(hitPoint, z, wafer, 0))
id = 0;
201 edm::LogError(
"HGCSim") <<
"HCalSD : Cannot find HGCalDDDConstants for " 204 <<
"Cannot find HGCalDDDConstants for " <<
nameX_ <<
"\n";
208 <<
" Slope cut " <<
slopeMin_ <<
" top Level " 221 int cell,
int iz, G4ThreeVector &
pos) {
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
double getEnergyDeposit(const G4Step *) override
void setNumberCheckedHits(int val)
std::vector< double > angles_
Compact representation of the geometrical detector hierarchy.
HGCalGeometryMode::GeometryMode geom_mode_
std::unique_ptr< HGCMouseBite > mouseBite_
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
HGCalGeometryMode::GeometryMode geomMode() const
std::unique_ptr< HGCNumberingScheme > numberingScheme_
HGCSD(const std::string &, const DDCompactView &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
uint32_t setDetUnitId(const G4Step *step) override
void update(const BeginOfJob *) override
This routine will be called when the appropriate signal arrives.
bool filterHit(CaloG4Hit *, double) override
int levelTop(int ind=0) const
double getResponseWt(const G4Track *)
ForwardSubdetector myFwdSubdet_
static void unpackHexagonIndex(const uint32_t &idx, int &subdet, int &z, int &lay, int &wafer, int &celltyp, int &cell)
double getEnergyDeposit() const