ATLAS Offline Software
Loading...
Searching...
No Matches
MuonWallSD Class Reference

#include <MuonWallSD.h>

Inheritance diagram for MuonWallSD:
Collaboration diagram for MuonWallSD:

Public Types

using HitVectorBuilder = TileHitVectorCellBuilder<NCells>

Public Member Functions

 MuonWallSD (const std::string &name, const std::string &hitCollectionName, int verbose)
 ~MuonWallSD ()=default
void Initialize (G4HCofThisEvent *) override final
G4bool ProcessHits (G4Step *, G4TouchableHistory *) override final

Static Public Attributes

static constexpr int NCells = 18

Private Member Functions

HitVectorBuilderGetHitCollection ()

Private Attributes

const TileTBIDm_tileTBID {}
Identifier m_id [NCells]
const std::string m_hitCollectionName
HitVectorBuilderm_hitCollection {}

Static Private Attributes

static const int s_nCellMu = 14
static const int s_nCellS = 4

Detailed Description

Definition at line 31 of file MuonWallSD.h.

Member Typedef Documentation

◆ HitVectorBuilder

Constructor & Destructor Documentation

◆ MuonWallSD()

MuonWallSD::MuonWallSD ( const std::string & name,
const std::string & hitCollectionName,
int verbose )

Definition at line 29 of file MuonWallSD.cxx.

30 : G4VSensitiveDetector(name),
31 m_hitCollectionName(hitCollectionName)
32{
33 verboseLevel = std::max(verboseLevel, verbose);
34
35 SmartIF<StoreGateSvc> detStore{Gaudi::svcLocator()->service("DetectorStore")};
36 if ( !detStore ) {
37 G4ExceptionDescription description;
38 description << "Constructor: DetectorStoreSvc not found!";
39 G4Exception("MuonWallSD", "NoDetStore", FatalException, description);
40 abort();
41 } else if (verboseLevel >= 5) {
42 G4cout << "DetectorStoreSvc initialized" << G4endl;
43 }
44
45 if (detStore->retrieve(m_tileTBID).isFailure()) {
46 G4ExceptionDescription description;
47 description << "Constructor: No TileTBID helper!";
48 G4Exception("MuonWallSD", "NoTileTBIDHelper", FatalException, description);
49 abort();
50 } else if (verboseLevel >= 5) {
51 G4cout << "TileTBID helper retrieved" << G4endl;
52 }
53
55 for (int channel=0; channel<s_nCellMu; ++channel) {
56 m_id[channel] = m_tileTBID->channel_id(type,module,channel);
57 }
58
59 module=TileTBID::CRACK_WALL;
60 for (int channel=0; channel<s_nCellS; ++channel) {
61 m_id[channel+s_nCellMu] = m_tileTBID->channel_id(type,module,channel);
62 }
63}
static const int s_nCellMu
Definition MuonWallSD.h:46
Identifier m_id[NCells]
Definition MuonWallSD.h:51
const TileTBID * m_tileTBID
Definition MuonWallSD.h:44
const std::string m_hitCollectionName
Definition MuonWallSD.h:52
static const int s_nCellS
Definition MuonWallSD.h:47
std::string description
glabal timer - how long have I taken so far?
Definition hcg.cxx:93
bool verbose
Definition hcg.cxx:75

◆ ~MuonWallSD()

MuonWallSD::~MuonWallSD ( )
default

Member Function Documentation

◆ GetHitCollection()

MuonWallSD::HitVectorBuilder * MuonWallSD::GetHitCollection ( )
private

Definition at line 65 of file MuonWallSD.cxx.

66{
67 auto* eventManager = G4EventManager::GetEventManager();
68 if (!eventManager) {
69 return nullptr;
70 }
71
72 auto* eventInfo = dynamic_cast<AtlasG4EventUserInfo*>(eventManager->GetUserInformation());
73 if (!eventInfo) {
74 return nullptr;
75 }
76
77 auto hitCollections = eventInfo->GetHitCollectionMap();
78 return hitCollections ? hitCollections->Find<HitVectorBuilder>(m_hitCollectionName) : nullptr;
79}
TileHitVectorCellBuilder< NCells > HitVectorBuilder
Definition MuonWallSD.h:38

◆ Initialize()

void MuonWallSD::Initialize ( G4HCofThisEvent * )
finaloverride

Definition at line 81 of file MuonWallSD.cxx.

81 {
82 if (verboseLevel >= 5) {
83 G4cout << "MuonWallSD::Initialize()" << G4endl;
84 }
85
87}
HitVectorBuilder * GetHitCollection()
HitVectorBuilder * m_hitCollection
Definition MuonWallSD.h:53

◆ ProcessHits()

G4bool MuonWallSD::ProcessHits ( G4Step * aStep,
G4TouchableHistory *  )
finaloverride

Definition at line 89 of file MuonWallSD.cxx.

89 {
90 if (verboseLevel >= 10) {
91 G4cout << "MuonWallSD::ProcessHits" << G4endl;
92 }
93
94 const G4TouchableHistory* theTouchable = static_cast<const G4TouchableHistory*>(aStep->GetPreStepPoint()->GetTouchable());
95 const G4VPhysicalVolume* physVol = theTouchable->GetVolume();
96 const G4LogicalVolume* logiVol = physVol->GetLogicalVolume();
97 const G4String nameLogiVol = logiVol->GetName();
98 const G4int nScinti = physVol->GetCopyNo();
99
100 const G4double edep = aStep->GetTotalEnergyDeposit() * aStep->GetTrack()->GetWeight();
101 G4double stepl = 0.;
102
103 if (aStep->GetTrack()->GetDefinition()->GetPDGCharge() != 0.){ // FIXME not-equal check on double
104
105 stepl = aStep->GetStepLength();
106 }
107
108 if ((edep == 0.) && (stepl == 0.)) { //FIXME equality check on double
109
110 return false;
111 }
112
113 int ind;
114
115 if(nameLogiVol.find("MuScintillatorLayer") !=G4String::npos) {
116 // for muon wall, nScinti-1 is the correct indice.
117 ind = nScinti-1;
118 } else if(nameLogiVol.find("S1") !=G4String::npos) {
119 ind = s_nCellMu + 0;
120 } else if(nameLogiVol.find("S2") !=G4String::npos) {
121 ind = s_nCellMu + 1;
122 } else if(nameLogiVol.find("S3") !=G4String::npos) {
123 ind = s_nCellMu + 2;
124 } else {
125 ind = s_nCellMu + 3;
126 }
127
128 if (verboseLevel >= 10) {
130 G4cout << ((hitCollection && hitCollection->HasHit(ind))?"Additional hit in ":"First hit in ")
131 << ((ind<s_nCellMu)?"MuonWall ":"beam counter S")
132 << ((ind<s_nCellMu)?nScinti:(ind-s_nCellMu+1))
133 << " time=" << aStep->GetPostStepPoint()->GetGlobalTime()
134 << " ene=" << edep << G4endl;
135 }
136
138 if (!hitCollection) {
139 if (verboseLevel >= 5) {
140 G4cout << "MuonWallSD::ProcessHits WARNING hit collection is not available" << G4endl;
141 }
142 return false;
143 }
144 m_hitCollection = hitCollection;
145 hitCollection->AddHit(ind, m_id[ind], edep);
146
147 return true;
148}

Member Data Documentation

◆ m_hitCollection

HitVectorBuilder* MuonWallSD::m_hitCollection {}
private

Definition at line 53 of file MuonWallSD.h.

53{};

◆ m_hitCollectionName

const std::string MuonWallSD::m_hitCollectionName
private

Definition at line 52 of file MuonWallSD.h.

◆ m_id

Identifier MuonWallSD::m_id[NCells]
private

Definition at line 51 of file MuonWallSD.h.

◆ m_tileTBID

const TileTBID* MuonWallSD::m_tileTBID {}
private

Definition at line 44 of file MuonWallSD.h.

44{};

◆ NCells

int MuonWallSD::NCells = 18
staticconstexpr

Definition at line 37 of file MuonWallSD.h.

◆ s_nCellMu

const int MuonWallSD::s_nCellMu = 14
staticprivate

Definition at line 46 of file MuonWallSD.h.

◆ s_nCellS

const int MuonWallSD::s_nCellS = 4
staticprivate

Definition at line 47 of file MuonWallSD.h.


The documentation for this class was generated from the following files: