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 ISvcLocator* svcLocator = Gaudi::svcLocator();
38 if (svcLocator->service(
"DetectorStore",
detStore).isFailure()) {
40 description <<
"Constructor: DetectorStoreSvc not found!";
41 G4Exception(
"MuonWallSD",
"NoDetStore", FatalException,
description);
43 }
else if (verboseLevel >= 5) {
44 G4cout <<
"DetectorStoreSvc initialized" << G4endl;
50 G4Exception(
"MuonWallSD",
"NoTileTBIDHelper", FatalException,
description);
52 }
else if (verboseLevel >= 5) {
53 G4cout <<
"TileTBID helper retrieved" << G4endl;
71 if (verboseLevel >= 5) {
72 G4cout <<
"Initializing SD" << G4endl;
79 if (verboseLevel >= 5) {
80 G4cout <<
"MuonWallSD::Initialize()" << G4endl;
89 if (verboseLevel >= 10) {
90 G4cout <<
"MuonWallSD::ProcessHits" << G4endl;
93 const G4TouchableHistory* theTouchable = (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
94 const G4VPhysicalVolume* physVol = theTouchable->GetVolume();
95 const G4LogicalVolume* logiVol = physVol->GetLogicalVolume();
96 const G4String nameLogiVol = logiVol->GetName();
97 const G4int nScinti = physVol->GetCopyNo();
99 const G4double edep = aStep->GetTotalEnergyDeposit() * aStep->GetTrack()->GetWeight();
102 if (aStep->GetTrack()->GetDefinition()->GetPDGCharge() != 0.){
104 stepl = aStep->GetStepLength();
107 if ((edep == 0.) && (stepl == 0.)) {
114 if(nameLogiVol.find(
"MuScintillatorLayer") !=G4String::npos) {
117 }
else if(nameLogiVol.find(
"S1") !=G4String::npos) {
119 }
else if(nameLogiVol.find(
"S2") !=G4String::npos) {
121 }
else if(nameLogiVol.find(
"S3") !=G4String::npos) {
127 if (verboseLevel >= 10) {
128 G4cout << ((
m_nhits[
ind] > 0)?
"Additional hit in ":
"First hit in ")
131 <<
" time=" << aStep->GetPostStepPoint()->GetGlobalTime()
132 <<
" ene=" << edep << G4endl;
151 if (verboseLevel >= 5) {
158 }
else if (verboseLevel >= 10) {
160 <<
" nhit=0" << G4endl;
164 if (verboseLevel >= 5) {
165 G4cout <<
"Total number of hits is " <<
m_HitColl->size() << G4endl;