20 #include "G4LogicalVolumeStore.hh"
21 #include "G4LogicalVolume.hh"
24 #include "G4ParticleTable.hh"
25 #include "G4VProcess.hh"
37 CaloSD(name, cpv, clg, p, manager,
38 (float)(p.getParameter<edm::
ParameterSet>(
"HGCSD").getParameter<double>(
"TimeSliceUnit")),
39 p.getParameter<edm::
ParameterSet>(
"HGCSD").getParameter<bool>(
"IgnoreTrackID")),
49 if (myName.find(
"HitsEE")!=std::string::npos) {
51 nameX =
"HGCalEESensitive";
52 }
else if (myName.find(
"HitsHEfront")!=std::string::npos) {
54 nameX =
"HGCalHESiliconSensitive";
55 }
else if (myName.find(
"HitsHEback")!=std::string::npos) {
57 nameX =
"HGCalHEScintillatorSensitive";
61 edm::LogInfo(
"HGCSim")<<
"**************************************************"
65 <<
"* Constructing a HGCSD with name " << name <<
"\n"
68 <<
"**************************************************";
84 double r = aStep->GetPreStepPoint()->GetPosition().perp();
85 double z =
std::abs(aStep->GetPreStepPoint()->GetPosition().z());
87 G4int parCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
88 bool notaMuon = (parCode ==
mupPDG || parCode ==
mumPDG ) ?
false :
true;
90 aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume();
91 edm::LogInfo(
"HGCSim") <<
"HGCSD: Hit from standard path from "
92 << lv->GetName() <<
" for Track "
93 << aStep->GetTrack()->GetTrackID() <<
" ("
94 << aStep->GetTrack()->GetDefinition()->GetParticleName()
95 <<
":" << notaMuon <<
") R = " << r <<
" Z = " << z
96 <<
" slope = " << r/z <<
":" <<
slopeMin_;
99 if (r/z >= slopeMin_) {
110 double destep = aStep->GetTotalEnergyDeposit();
117 const G4VTouchable* touch = preStepPoint->GetTouchable();
120 G4ThreeVector hitPoint = preStepPoint->GetPosition();
121 float globalZ=touch->GetTranslation(0).z();
122 int iz( globalZ>0 ? 1 : -1);
125 G4ThreeVector localpos = touch->GetHistory()->GetTopTransform().TransformPoint(hitPoint);
130 int layer(0),
module(0), cell(0);
132 layer = touch->GetReplicaNumber(0);
133 module = touch->GetReplicaNumber(1);
135 if (touch->GetHistoryDepth() ==
levelT_) {
136 layer = touch->GetReplicaNumber(0);
140 std::cout <<
"Depths: " << touch->GetHistoryDepth() <<
" name "
141 << touch->GetVolume(0)->GetLogicalVolume()->GetName()
142 <<
" layer:module:cell " << layer <<
":" <<
module <<
":"
143 << cell << std::endl;
146 layer = touch->GetReplicaNumber(2);
147 module = touch->GetReplicaNumber(1);
148 cell = touch->GetReplicaNumber(0);
166 edm::LogError(
"HGCSim") <<
"HCalSD : Cannot find HGCalDDDConstants for "
168 throw cms::Exception(
"Unknown",
"HGCSD") <<
"Cannot find HGCalDDDConstants for " <<
nameX <<
"\n";
172 <<
" Slope cut " <<
slopeMin_ <<
" top Level "
178 G4ParticleTable * theParticleTable = G4ParticleTable::GetParticleTable();
179 G4String particleName;
180 mumPDG = theParticleTable->FindParticle(particleName=
"mu-")->GetPDGEncoding();
181 mupPDG = theParticleTable->FindParticle(particleName=
"mu+")->GetPDGEncoding();
184 <<
" for mu+ = " <<
mupPDG;
193 int cell,
int iz, G4ThreeVector &pos) {
203 if (primaryID == 0) {
205 edm::LogInfo(
"HGCSim") <<
"HGCSD: Problem with primaryID **** set by "
206 <<
"force to TkID **** " <<
theTrack->GetTrackID();
T getParameter(std::string const &) const
HGCSD(G4String, const DDCompactView &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
HGCNumberingScheme * numberingScheme
virtual bool ProcessHits(G4Step *, G4TouchableHistory *)
uint32_t getUnitID(ForwardSubdetector subdet, int layer, int module, int cell, int iz, const G4ThreeVector &pos)
assigns the det id to a hit
virtual void update(const BeginOfJob *)
This routine will be called when the appropriate signal arrives.
type of data representation of DDCompactView
static TrackerG4SimHitNumberingScheme & numberingScheme(const DDCompactView &cpv, const GeometricDet &det)
void resetForNewPrimary(const G4ThreeVector &, double)
Abs< T >::type abs(const T &t)
void NaNTrap(G4Step *step)
virtual G4bool getStepInfo(G4Step *aStep)
G4StepPoint * preStepPoint
virtual double getEnergyDeposit(G4Step *)
virtual bool filterHit(CaloG4Hit *, double)
int setTrackID(G4Step *step)
ForwardSubdetector myFwdSubdet_
virtual uint32_t setDetUnitId(G4Step *step)
CaloG4Hit * createNewHit()
double getEnergyDeposit() const