18 #include "GaudiKernel/ISvcLocator.h"
19 #include "GaudiKernel/Bootstrap.h"
21 #include "G4HCofThisEvent.hh"
22 #include "G4VPhysicalVolume.hh"
24 #include "G4VTouchable.hh"
25 #include "G4TouchableHistory.hh"
28 : G4VSensitiveDetector(
name),
31 m_HitColl(hitCollectionName)
35 SmartIF<StoreGateSvc>
detStore{Gaudi::svcLocator()->service(
"DetectorStore")};
38 description <<
"Constructor: DetectorStoreSvc not found!";
39 G4Exception(
"MuonWallSD",
"NoDetStore", FatalException,
description);
41 }
else if (verboseLevel >= 5) {
42 G4cout <<
"DetectorStoreSvc initialized" << G4endl;
48 G4Exception(
"MuonWallSD",
"NoTileTBIDHelper", FatalException,
description);
50 }
else if (verboseLevel >= 5) {
51 G4cout <<
"TileTBID helper retrieved" << G4endl;
66 if (verboseLevel >= 5) {
67 G4cout <<
"Initializing SD" << G4endl;
74 if (verboseLevel >= 5) {
75 G4cout <<
"MuonWallSD::Initialize()" << G4endl;
84 if (verboseLevel >= 10) {
85 G4cout <<
"MuonWallSD::ProcessHits" << G4endl;
88 const G4TouchableHistory* theTouchable = (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
89 const G4VPhysicalVolume* physVol = theTouchable->GetVolume();
90 const G4LogicalVolume* logiVol = physVol->GetLogicalVolume();
91 const G4String nameLogiVol = logiVol->GetName();
92 const G4int nScinti = physVol->GetCopyNo();
94 const G4double edep = aStep->GetTotalEnergyDeposit() * aStep->GetTrack()->GetWeight();
97 if (aStep->GetTrack()->GetDefinition()->GetPDGCharge() != 0.){
99 stepl = aStep->GetStepLength();
102 if ((edep == 0.) && (stepl == 0.)) {
109 if(nameLogiVol.find(
"MuScintillatorLayer") !=G4String::npos) {
112 }
else if(nameLogiVol.find(
"S1") !=G4String::npos) {
114 }
else if(nameLogiVol.find(
"S2") !=G4String::npos) {
116 }
else if(nameLogiVol.find(
"S3") !=G4String::npos) {
122 if (verboseLevel >= 10) {
123 G4cout << ((
m_nhits[
ind] > 0)?
"Additional hit in ":
"First hit in ")
126 <<
" time=" << aStep->GetPostStepPoint()->GetGlobalTime()
127 <<
" ene=" << edep << G4endl;
146 if (verboseLevel >= 5) {
153 }
else if (verboseLevel >= 10) {
155 <<
" nhit=0" << G4endl;
159 if (verboseLevel >= 5) {
160 G4cout <<
"Total number of hits is " <<
m_HitColl->size() << G4endl;