19 #include "G4LogicalVolumeStore.hh"
20 #include "G4LogicalVolume.hh"
23 #include "G4ParticleTable.hh"
24 #include "G4VProcess.hh"
67 G4String myName =
name;
70 if (myName.find(
"HitsEE") != std::string::npos) {
72 nameX_ =
"HGCalEESensitive";
73 }
else if (myName.find(
"HitsHEfront") != std::string::npos) {
75 nameX_ =
"HGCalHESiliconSensitive";
76 }
else if (myName.find(
"HitsHEback") != std::string::npos) {
78 nameX_ =
"HGCalHEScintillatorSensitive";
82 edm::LogVerbatim(
"HGCSim") <<
"**************************************************"
86 <<
"* Constructing a HGCSD with name " <<
name <<
"\n"
89 <<
"**************************************************";
100 double r = aStep->GetPreStepPoint()->GetPosition().perp();
101 double z =
std::abs(aStep->GetPreStepPoint()->GetPosition().z());
104 G4int parCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
105 G4LogicalVolume* lv = aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume();
106 edm::LogVerbatim(
"HGCSim") <<
"HGCSD: Hit from standard path from " << lv->GetName() <<
" for Track "
107 << aStep->GetTrack()->GetTrackID() <<
" ("
108 << aStep->GetTrack()->GetDefinition()->GetParticleName() <<
":" << parCode <<
") R = " <<
r
109 <<
" Z = " <<
z <<
" slope = " <<
r /
z <<
":" <<
slopeMin_;
118 double wt2 = aStep->GetTrack()->GetWeight();
119 double destep = wt1 * aStep->GetTotalEnergyDeposit();
124 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
125 G4double tmptrackE = aStep->GetTrack()->GetKineticEnergy();
126 G4int parCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
127 G4double
angle = (aStep->GetTrack()->GetMomentumDirection().theta()) / CLHEP::deg;
128 G4int layer = ((touch->GetHistoryDepth() ==
levelT_) ? touch->GetReplicaNumber(0) : touch->GetReplicaNumber(2));
129 G4int ilayer = (layer - 1) / 3;
130 if (aStep->GetTotalEnergyDeposit() > 0) {
133 t_dEStep1_.emplace_back(aStep->GetTotalEnergyDeposit());
144 const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
145 const G4VTouchable* touch = preStepPoint->GetTouchable();
148 G4ThreeVector hitPoint = preStepPoint->GetPosition();
149 float globalZ = touch->GetTranslation(0).z();
150 int iz(globalZ > 0 ? 1 : -1);
153 G4ThreeVector localpos = touch->GetHistory()->GetTopTransform().TransformPoint(hitPoint);
159 if (touch->GetHistoryDepth() ==
levelT_) {
160 layer = touch->GetReplicaNumber(0);
164 edm::LogVerbatim(
"HGCSim") <<
"Depths: " << touch->GetHistoryDepth() <<
" name " << touch->GetVolume(0)->GetName()
165 <<
" layer:module:cell " << layer <<
":" <<
module <<
":" << cell;
168 layer = touch->GetReplicaNumber(2);
169 module = touch->GetReplicaNumber(1);
170 cell = touch->GetReplicaNumber(0);
173 const G4Material* mat = aStep->GetPreStepPoint()->GetMaterial();
174 edm::LogVerbatim(
"HGCSim") <<
"Depths: " << touch->GetHistoryDepth() <<
" name " << touch->GetVolume(0)->GetName()
175 <<
":" << touch->GetReplicaNumber(0) <<
" " << touch->GetVolume(1)->GetName() <<
":"
176 << touch->GetReplicaNumber(1) <<
" " << touch->GetVolume(2)->GetName() <<
":"
177 << touch->GetReplicaNumber(2) <<
" layer:module:cell " << layer <<
":" <<
module <<
":"
178 << cell <<
" Material " << mat->GetName() <<
":" << mat->GetRadlen();
184 if (aStep->GetPreStepPoint()->GetMaterial()->GetRadlen() > 100000.)
189 int det,
z, lay, wafer,
type, ic;
193 <<
":" << wafer <<
":" <<
type <<
":" << ic;
215 throw cms::Exception(
"Unknown",
"HGCSD") <<
"Cannot find HGCalDDDConstants for " <<
nameX_ <<
"\n";
226 if (
tfile.isAvailable()) {
227 tree_ =
tfile->make<TTree>(
"TreeHGCSD",
"TreeHGCSD");
240 const G4Event* evt = (*g4Event)();