22 #include "G4LogicalVolumeStore.hh" 23 #include "G4LogicalVolume.hh" 26 #include "G4ParticleTable.hh" 27 #include "G4VProcess.hh" 39 CaloSD(name, cpv, clg, p, manager,
55 G4String myName =
name;
58 if (myName.find(
"HitsEE")!=std::string::npos) {
60 nameX =
"HGCalEESensitive";
61 }
else if (myName.find(
"HitsHEfront")!=std::string::npos) {
63 nameX =
"HGCalHESiliconSensitive";
64 }
else if (myName.find(
"HitsHEback")!=std::string::npos) {
66 nameX =
"HGCalHEScintillatorSensitive";
70 edm::LogInfo(
"HGCSim")<<
"**************************************************" 74 <<
"* Constructing a HGCSD with name " << name <<
"\n" 77 <<
"**************************************************";
79 edm::LogInfo(
"HGCSim") <<
"HGCSD:: Threshold for storing hits: " << eminHit
81 edm::LogInfo(
"HGCSim") <<
"Flag for storing individual Geant4 Hits " 83 edm::LogInfo(
"HGCSim") <<
"Reject MosueBite Flag: " << rejectMB_
84 <<
" Size of wafer " << waferSize <<
" Mouse Bite " 85 << mouseBite <<
":" << mouseBiteCut_ <<
" along " 86 << angles_.size() <<
" axes";
98 if (aStep ==
nullptr) {
101 double r = aStep->GetPreStepPoint()->GetPosition().perp();
102 double z =
std::abs(aStep->GetPreStepPoint()->GetPosition().z());
104 G4int parCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
105 bool notaMuon = (parCode ==
mupPDG || parCode ==
mumPDG ) ?
false :
true;
106 G4LogicalVolume* lv =
107 aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume();
108 edm::LogInfo(
"HGCSim") <<
"HGCSD: Hit from standard path from " 109 << lv->GetName() <<
" for Track " 110 << aStep->GetTrack()->GetTrackID() <<
" (" 111 << aStep->GetTrack()->GetDefinition()->GetParticleName()
112 <<
":" << notaMuon <<
") R = " << r <<
" Z = " << z
113 <<
" slope = " << r/z <<
":" <<
slopeMin_;
116 if (r/z >= slopeMin_) {
128 double wt2 = aStep->GetTrack()->GetWeight();
129 double destep = wt1*(aStep->GetTotalEnergyDeposit());
130 if (wt2 > 0) destep *= wt2;
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 G4ThreeVector localpos = touch->GetHistory()->GetTopTransform().TransformPoint(hitPoint);
151 if (touch->GetHistoryDepth() ==
levelT_) {
152 layer = touch->GetReplicaNumber(0);
156 edm::LogInfo(
"HGCSim") <<
"Depths: " << touch->GetHistoryDepth()
157 <<
" name " << touch->GetVolume(0)->GetName()
158 <<
" layer:module:cell " << layer <<
":" 159 << module <<
":" << cell << std::endl;
162 layer = touch->GetReplicaNumber(2);
163 module = touch->GetReplicaNumber(1);
164 cell = touch->GetReplicaNumber(0);
167 edm::LogInfo(
"HGCSim") <<
"Depths: " << touch->GetHistoryDepth() <<
" name " 168 << touch->GetVolume(0)->GetName()
169 <<
":" << touch->GetReplicaNumber(0) <<
" " 170 << touch->GetVolume(1)->GetName()
171 <<
":" << touch->GetReplicaNumber(1) <<
" " 172 << touch->GetVolume(2)->GetName()
173 <<
":" << touch->GetReplicaNumber(2) <<
" " 174 <<
" layer:module:cell " << layer <<
":" << module
175 <<
":" << cell <<
" Material " << mat->GetName()<<
":" 176 << aStep->GetPreStepPoint()->GetMaterial()->GetRadlen();
179 if (aStep->GetPreStepPoint()->GetMaterial()->GetRadlen() > 100000.)
return 0;
181 uint32_t
id =
setDetUnitId (subdet, layer, module, cell, iz, localpos);
183 int det,
z, lay, wafer,
type, ic;
187 << det <<
":" << z <<
":" << lay <<
":" << wafer
188 <<
":" << type <<
":" << ic << std::endl;
208 edm::LogError(
"HGCSim") <<
"HCalSD : Cannot find HGCalDDDConstants for " 210 throw cms::Exception(
"Unknown",
"HGCSD") <<
"Cannot find HGCalDDDConstants for " <<
nameX <<
"\n";
214 <<
" Slope cut " <<
slopeMin_ <<
" top Level " 220 G4ParticleTable * theParticleTable = G4ParticleTable::GetParticleTable();
222 mumPDG = theParticleTable->FindParticle(particleName=
"mu-")->GetPDGEncoding();
223 mupPDG = theParticleTable->FindParticle(particleName=
"mu+")->GetPDGEncoding();
226 <<
" for mu+ = " <<
mupPDG;
235 int cell,
int iz, G4ThreeVector &
pos) {
242 const G4Track*
theTrack = aStep->GetTrack();
247 if (primaryID == 0) {
249 edm::LogInfo(
"HGCSim") <<
"HGCSD: Problem with primaryID **** set by " 250 <<
"force to TkID **** " <<theTrack->GetTrackID();
252 primaryID = theTrack->GetTrackID();
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
HGCalGeometryMode::GeometryMode m_mode
HGCNumberingScheme * numberingScheme
std::vector< double > angles_
uint32_t getUnitID(ForwardSubdetector subdet, int layer, int module, int cell, int iz, const G4ThreeVector &pos)
assigns the det id to a hit
bool ProcessHits(G4Step *, G4TouchableHistory *) override
type of data representation of DDCompactView
double getEnergyDeposit(G4Step *) override
static TrackerG4SimHitNumberingScheme & numberingScheme(const DDCompactView &cpv, const GeometricDet &det)
void resetForNewPrimary(const G4ThreeVector &, double)
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
HGCalGeometryMode::GeometryMode geomMode() const
virtual G4bool getStepInfo(G4Step *aStep)
bool exclude(G4ThreeVector &point, int zside, int wafer)
G4StepPoint * preStepPoint
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
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)
CaloG4Hit * createNewHit()
int setTrackID(const G4Step *step)
double getEnergyDeposit() const
void NaNTrap(const G4Step *step) const
HGCMouseBite * mouseBite_