19 #include "G4LogicalVolumeStore.hh"
20 #include "G4LogicalVolume.hh"
23 #include "G4ParticleTable.hh"
24 #include "G4VProcess.hh"
68 G4String myName =
name;
71 if (myName.find(
"HitsEE") != std::string::npos) {
73 nameX_ =
"HGCalEESensitive";
74 }
else if (myName.find(
"HitsHEfront") != std::string::npos) {
76 nameX_ =
"HGCalHESiliconSensitive";
77 }
else if (myName.find(
"HitsHEback") != std::string::npos) {
79 nameX_ =
"HGCalHEScintillatorSensitive";
83 edm::LogVerbatim(
"HGCSim") <<
"**************************************************"
87 <<
"* Constructing a HGCSD with name " <<
name <<
"\n"
90 <<
"**************************************************";
101 double r = aStep->GetPreStepPoint()->GetPosition().perp();
102 double z =
std::abs(aStep->GetPreStepPoint()->GetPosition().z());
105 G4int parCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
106 G4LogicalVolume* lv = aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume();
107 edm::LogVerbatim(
"HGCSim") <<
"HGCSD: Hit from standard path from " << lv->GetName() <<
" for Track "
108 << aStep->GetTrack()->GetTrackID() <<
" ("
109 << aStep->GetTrack()->GetDefinition()->GetParticleName() <<
":" << parCode <<
") R = " <<
r
110 <<
" Z = " <<
z <<
" slope = " <<
r /
z <<
":" <<
slopeMin_;
119 double wt2 = aStep->GetTrack()->GetWeight();
120 double destep = wt1 * aStep->GetTotalEnergyDeposit();
125 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
126 G4double tmptrackE = aStep->GetTrack()->GetKineticEnergy();
127 G4int parCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
128 G4double
angle = (aStep->GetTrack()->GetMomentumDirection().theta()) / CLHEP::deg;
129 G4int layer = ((touch->GetHistoryDepth() ==
levelT_) ? touch->GetReplicaNumber(0) : touch->GetReplicaNumber(2));
130 G4int ilayer = (layer - 1) / 3;
131 if (aStep->GetTotalEnergyDeposit() > 0) {
134 t_dEStep1_.emplace_back(aStep->GetTotalEnergyDeposit());
145 const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
146 const G4VTouchable* touch = preStepPoint->GetTouchable();
149 G4ThreeVector hitPoint = preStepPoint->GetPosition();
150 float globalZ = touch->GetTranslation(0).z();
151 int iz(globalZ > 0 ? 1 : -1);
154 G4ThreeVector localpos = touch->GetHistory()->GetTopTransform().TransformPoint(hitPoint);
159 int layer, module, cell;
160 if (touch->GetHistoryDepth() ==
levelT_) {
161 layer = touch->GetReplicaNumber(0);
165 edm::LogVerbatim(
"HGCSim") <<
"Depths: " << touch->GetHistoryDepth() <<
" name " << touch->GetVolume(0)->GetName()
166 <<
" layer:module:cell " << layer <<
":" << module <<
":" << cell;
169 layer = touch->GetReplicaNumber(2);
170 module = touch->GetReplicaNumber(1);
171 cell = touch->GetReplicaNumber(0);
174 const G4Material* mat = aStep->GetPreStepPoint()->GetMaterial();
175 edm::LogVerbatim(
"HGCSim") <<
"Depths: " << touch->GetHistoryDepth() <<
" name " << touch->GetVolume(0)->GetName()
176 <<
":" << touch->GetReplicaNumber(0) <<
" " << touch->GetVolume(1)->GetName() <<
":"
177 << touch->GetReplicaNumber(1) <<
" " << touch->GetVolume(2)->GetName() <<
":"
178 << touch->GetReplicaNumber(2) <<
" layer:module:cell " << layer <<
":" << module <<
":"
179 << cell <<
" Material " << mat->GetName() <<
":" << mat->GetRadlen();
185 if (aStep->GetPreStepPoint()->GetMaterial()->GetRadlen() > 100000.)
188 uint32_t
id =
setDetUnitId(subdet, layer, module, cell, iz, localpos);
190 int det,
z, lay, wafer,
type, ic;
194 <<
":" << wafer <<
":" <<
type <<
":" << ic;
216 throw cms::Exception(
"Unknown",
"HGCSD") <<
"Cannot find HGCalDDDConstants for " <<
nameX_ <<
"\n";
227 if (
tfile.isAvailable()) {
228 tree_ =
tfile->make<TTree>(
"TreeHGCSD",
"TreeHGCSD");
241 const G4Event* evt = (*g4Event)();