38 #include "G4NavigationHistory.hh"
39 #include "G4TouchableHistory.hh"
41 #include "CLHEP/Units/GlobalSystemOfUnits.h"
42 #include "CLHEP/Units/GlobalPhysicalConstants.h"
53 public Observer<const BeginOfEvent*>,
110 <<
"observer of begin events and of G4step "
111 <<
"with Parameter values: \n\tLabel : " <<
labelLayer_ <<
" and with "
112 <<
names_.size() <<
" detectors";
113 for (
unsigned int k = 0;
k <
names_.size(); ++
k)
137 G4String
nameX =
"HGCal";
143 else if (detType == 1)
151 else if (detType == 1)
157 nameX =
"HGCalEESensitive";
158 else if (detType == 1)
159 nameX =
"HGCalHESiliconSensitive";
161 nameX =
"HGCalHEScintillatorSensitive";
180 throw cms::Exception(
"Unknown",
"ValidHGCal") <<
"Cannot find HGCalDDDConstants for " <<
nameX <<
"\n";
189 }
else if (detType == 1) {
204 int iev = (*evt)()->GetEventID();
207 <<
"event = " <<
iev;
226 if (aStep !=
nullptr) {
227 G4VPhysicalVolume* curPV = aStep->GetPreStepPoint()->GetPhysicalVolume();
228 const G4String&
name = curPV->GetName();
229 G4VSensitiveDetector* curSD = aStep->GetPreStepPoint()->GetSensitiveDetector();
232 << aStep->GetPreStepPoint()->GetPosition();
235 if (curSD !=
nullptr) {
237 for (
unsigned int k = 0;
k <
names_.size(); ++
k) {
238 if (
name.find(
names_[
k].c_str()) != std::string::npos) {
250 const G4TouchableHistory* touchable =
251 static_cast<const G4TouchableHistory*>(aStep->GetPreStepPoint()->GetTouchable());
252 unsigned int index(0);
254 G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
256 G4ThreeVector localpos = touchable->GetHistory()->GetTopTransform().TransformPoint(hitPoint);
257 float globalZ = touchable->GetTranslation(0).z();
258 int iz(globalZ > 0 ? 1 : -1);
259 int module(-1), cell(-1);
261 if (touchable->GetHistoryDepth() ==
levelT1_) {
262 layer = touchable->GetReplicaNumber(0);
264 layer = touchable->GetReplicaNumber(2);
265 module = touchable->GetReplicaNumber(1);
266 cell = touchable->GetReplicaNumber(0);
271 if ((touchable->GetHistoryDepth() ==
levelT1_) || (touchable->GetHistoryDepth() ==
levelT2_)) {
272 layer = touchable->GetReplicaNumber(0);
274 layer = touchable->GetReplicaNumber(3);
275 module = touchable->GetReplicaNumber(2);
276 cell = touchable->GetReplicaNumber(1);
285 double edeposit = aStep->GetTotalEnergyDeposit();
288 << edeposit <<
" hit at " << hitPoint;
293 }
else if (detType == 1) {
302 G4String nextVolume(
"XXX");
303 if (aStep->GetTrack()->GetNextVolume() !=
nullptr)
304 nextVolume = aStep->GetTrack()->GetNextVolume()->GetName();
306 if (nextVolume.c_str() !=
name.c_str()) {