ATLAS Offline Software
Loading...
Searching...
No Matches
FCS_Param::FCS_StepInfoSDTool Class Reference

A base class for tools that manage FCS_StepInfoSDs. More...

#include <FCS_StepInfoSDTool.h>

Inheritance diagram for FCS_Param::FCS_StepInfoSDTool:

Public Member Functions

 FCS_StepInfoSDTool (const std::string &type, const std::string &name, const IInterface *parent)
 Constructor.
StatusCode initialize () override final
 Initialize the tool.
StatusCode Gather () override final
 Calls down to all the SDs to pack their hits into one collection.
StatusCode initializeSD () override
 Setup an SD in the current thread.
virtual StatusCode SetupEvent () override
 Beginning of an athena event.
virtual StatusCode SetupEvent (HitCollectionMap &) override
virtual StatusCode Gather (HitCollectionMap &) override

Protected Member Functions

StatusCode assignSD (std::unique_ptr< G4VSensitiveDetector > sd, const std::vector< std::string > &volumes) const
 Assign SD to a list of volumes.
G4VSensitiveDetector * getSD ()
 Retrieve the current SD.
void SetSensitiveDetector (G4LogicalVolume *, G4VSensitiveDetector *) const
 Method stolen from G4VUserDetectorConstruction in G4 10.2.

Protected Attributes

Gaudi::Property< std::vector< std::string > > m_volumeNames {this, "LogicalVolumeNames", {}}
 All the volumes to which this SD is assigned.
Gaudi::Property< std::vector< std::string > > m_outputCollectionNames {this, "OutputCollectionNames", {}}
 Names of all output collections written out by this SD.
Gaudi::Property< bool > m_noVolumes {this, "NoVolumes", false}
 This SensitiveDetector has no volumes associated with it.

Private Member Functions

G4VSensitiveDetector * makeSD () const override final
 Create the SD wrapper for current worker thread.
virtual StatusCode initializeCalculators ()
 Initialize Calculator Services.
FCS_StepInfoSDmakeOneLArSD (const std::string &name, ILArCalculatorSvc *calc, const std::vector< std::string > &volumes) const
 Helper method to create one SD.
FCS_StepInfoSDmakeOneTileSD (const std::string &name, ITileCalculator *calc, const std::vector< std::string > &volumes) const
 Helper method to create one SD.
void setSD (G4VSensitiveDetector *)
 Set the current SD.

Static Private Member Functions

static bool matchStrings (const char *first, const char *second)
 Match two strings with wildcard support.

Private Attributes

std::string m_hitCollName
 Hit collection name.
ServiceHandle< ILArCalculatorSvcm_bpsmodcalc
ServiceHandle< ILArCalculatorSvcm_embcalc
ServiceHandle< ILArCalculatorSvcm_emepiwcalc
ServiceHandle< ILArCalculatorSvcm_emeniwcalc
ServiceHandle< ILArCalculatorSvcm_emepowcalc
ServiceHandle< ILArCalculatorSvcm_emenowcalc
ServiceHandle< ILArCalculatorSvcm_emepscalc
ServiceHandle< ILArCalculatorSvcm_emepobarcalc
ServiceHandle< ILArCalculatorSvcm_emenobarcalc
ServiceHandle< ILArCalculatorSvcm_heccalc
ServiceHandle< ILArCalculatorSvcm_fcal1calc
ServiceHandle< ILArCalculatorSvcm_fcal2calc
ServiceHandle< ILArCalculatorSvcm_fcal3calc
ServiceHandle< ITileCalculatorm_tileCalculator
FCS_Param::Config m_config
G4VSensitiveDetector * m_SD {}
 The sensitive detector to which this thing corresponds.
SD volumes
std::vector< std::string > m_stacVolumes
std::vector< std::string > m_presBarVolumes
std::vector< std::string > m_posIWVolumes
std::vector< std::string > m_negIWVolumes
std::vector< std::string > m_posOWVolumes
std::vector< std::string > m_negOWVolumes
std::vector< std::string > m_presECVolumes
std::vector< std::string > m_pBOBVolumes
std::vector< std::string > m_nBOBVolumes
std::vector< std::string > m_fcal1Volumes
std::vector< std::string > m_fcal2Volumes
std::vector< std::string > m_fcal3Volumes
std::vector< std::string > m_sliceVolumes
std::vector< std::string > m_tileVolumes
Calo identifier helpers
const LArEM_IDm_larEmID
const LArFCAL_IDm_larFcalID
const LArHEC_IDm_larHecID
const TileIDm_tileID

Detailed Description

A base class for tools that manage FCS_StepInfoSDs.

Todo
Add more details.
Author
Steve Farrell Steve.nosp@m.n.Fa.nosp@m.rrell.nosp@m.@cer.nosp@m.n.ch

Definition at line 40 of file FCS_StepInfoSDTool.h.

Constructor & Destructor Documentation

◆ FCS_StepInfoSDTool()

FCS_Param::FCS_StepInfoSDTool::FCS_StepInfoSDTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Constructor.

Definition at line 36 of file FCS_StepInfoSDTool.cxx.

39 : SensitiveDetectorBase(type, name, parent),
40 m_hitCollName("MergedEventSteps"),
41 m_bpsmodcalc("EMBPresamplerCalculator", name),
42 m_embcalc("EMBCalculator", name),
43 m_emepiwcalc("EMECPosInnerWheelCalculator", name),
44 m_emeniwcalc("EMECNegInnerWheelCalculator", name),
45 m_emepowcalc("EMECPosOuterWheelCalculator", name),
46 m_emenowcalc("EMECNegOuterWheelCalculator", name),
47 m_emepscalc("EMECPresamplerCalculator", name),
48 m_emepobarcalc("EMECPosBackOuterBarretteCalculator", name),
49 m_emenobarcalc("EMECNegBackOuterBarretteCalculator", name),
50 m_heccalc("HECWheelCalculator", name),
51 m_fcal1calc("FCAL1Calculator", name),
52 m_fcal2calc("FCAL2Calculator", name),
53 m_fcal3calc("FCAL3Calculator", name),
54 m_tileCalculator("TileGeoG4SDCalc", name),
55 m_larEmID(nullptr),
56 m_larFcalID(nullptr),
57 m_larHecID(nullptr),
58 m_tileID(nullptr),
59 m_config() {
60 declareProperty("HitCollectionName", m_hitCollName);
61 declareProperty("StacVolumes", m_stacVolumes);
62 declareProperty("PresamplerVolumes", m_presBarVolumes);
63 declareProperty("PosIWVolumes", m_posIWVolumes);
64 declareProperty("NegIWVolumes", m_negIWVolumes);
65 declareProperty("PosOWVolumes", m_posOWVolumes);
66 declareProperty("NegOWVolumes", m_negOWVolumes);
67 declareProperty("PresVolumes", m_presECVolumes);
68 declareProperty("PosBOBarretteVolumes", m_pBOBVolumes);
69 declareProperty("NegBOBarretteVolumes", m_nBOBVolumes);
70 declareProperty("FCAL1Volumes", m_fcal1Volumes);
71 declareProperty("FCAL2Volumes", m_fcal2Volumes);
72 declareProperty("FCAL3Volumes", m_fcal3Volumes);
73 declareProperty("SliceVolumes", m_sliceVolumes);
74 declareProperty("TileVolumes", m_tileVolumes);
75
76 declareProperty("EMBPSCalculator", m_bpsmodcalc);
77 declareProperty("EMBCalculator", m_embcalc);
78 declareProperty("EMECPosIWCalculator", m_emepiwcalc);
79 declareProperty("EMECNegIWCalculator", m_emeniwcalc);
80 declareProperty("EMECPosOWCalculator", m_emepowcalc);
81 declareProperty("EMECNegOWCalculator", m_emenowcalc);
82 declareProperty("EMECPSCalculator", m_emepscalc);
83 declareProperty("EMECPosBOBCalculator", m_emepobarcalc);
84 declareProperty("EMECNegBOBCalculator", m_emenobarcalc);
85 declareProperty("HECWActiveCalculator", m_heccalc);
86 declareProperty("FCAL1Calculator", m_fcal1calc);
87 declareProperty("FCAL2Calculator", m_fcal2calc);
88 declareProperty("FCAL3Calculator", m_fcal3calc);
89 declareProperty("TileCalculator", m_tileCalculator);
90
91 declareProperty("shift_lar_subhit", m_config.shift_lar_subhit, "");
92 declareProperty("shorten_lar_step", m_config.shorten_lar_step, "");
93
94 declareProperty("maxRadiusLateral", m_config.m_maxRadiusLateral, "");
95 declareProperty("maxRadiusLongitudinal", m_config.m_maxRadiusLongitudinal,
96 "");
97
98 declareProperty("maxTime", m_config.m_maxTime, "");
99 declareProperty("maxTimeLAr", m_config.m_maxTimeLAr, "");
100 declareProperty("maxTimeHEC", m_config.m_maxTimeHEC, "");
101 declareProperty("maxTimeFCAL", m_config.m_maxTimeFCAL, "");
102 declareProperty("maxTimeTile", m_config.m_maxTimeTile, "");
103}
std::vector< std::string > m_tileVolumes
std::string m_hitCollName
Hit collection name.
ServiceHandle< ILArCalculatorSvc > m_emepobarcalc
std::vector< std::string > m_fcal3Volumes
std::vector< std::string > m_posOWVolumes
ServiceHandle< ILArCalculatorSvc > m_fcal2calc
std::vector< std::string > m_presECVolumes
std::vector< std::string > m_nBOBVolumes
std::vector< std::string > m_stacVolumes
ServiceHandle< ILArCalculatorSvc > m_bpsmodcalc
ServiceHandle< ILArCalculatorSvc > m_emepowcalc
ServiceHandle< ILArCalculatorSvc > m_emepscalc
ServiceHandle< ILArCalculatorSvc > m_fcal3calc
std::vector< std::string > m_pBOBVolumes
ServiceHandle< ILArCalculatorSvc > m_emenowcalc
ServiceHandle< ILArCalculatorSvc > m_emepiwcalc
std::vector< std::string > m_sliceVolumes
ServiceHandle< ITileCalculator > m_tileCalculator
std::vector< std::string > m_fcal1Volumes
ServiceHandle< ILArCalculatorSvc > m_emeniwcalc
std::vector< std::string > m_fcal2Volumes
std::vector< std::string > m_presBarVolumes
std::vector< std::string > m_negIWVolumes
std::vector< std::string > m_negOWVolumes
ServiceHandle< ILArCalculatorSvc > m_fcal1calc
ServiceHandle< ILArCalculatorSvc > m_embcalc
ServiceHandle< ILArCalculatorSvc > m_emenobarcalc
std::vector< std::string > m_posIWVolumes
ServiceHandle< ILArCalculatorSvc > m_heccalc
SensitiveDetectorBase(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.

Member Function Documentation

◆ assignSD()

StatusCode SensitiveDetectorBase::assignSD ( std::unique_ptr< G4VSensitiveDetector > sd,
const std::vector< std::string > & volumes ) const
protectedinherited

Assign SD to a list of volumes.

This method supports wild card matching

Definition at line 64 of file SensitiveDetectorBase.cxx.

66{
67 // Propagate verbosity setting to the SD
68 if(msgLvl(MSG::VERBOSE)) sd->SetVerboseLevel(10);
69 else if(msgLvl(MSG::DEBUG)) sd->SetVerboseLevel(5);
70
71 // Add the sensitive detector to the SD manager in G4 for SDs,
72 // even if it has no volumes associated to it.
73 auto sdMgr = G4SDManager::GetSDMpointer();
74 auto sdPtr = sd.get();
75 // SDManager is now the SD owner
76 sdMgr->AddNewDetector(sd.release());
77
78 if(!volumes.empty()) {
79 bool gotOne = false;
80 auto logicalVolumeStore = G4LogicalVolumeStore::GetInstance();
81 for(const auto& volumeName : volumes) {
82 // Keep track of how many volumes we find with this name string.
83 // We allow for multiple matches.
84 int numFound = 0;
85
86 // Find volumes with this name
87 for(auto* logVol : *logicalVolumeStore) {
88
89 ATH_MSG_VERBOSE("Check whether "<<logVol->GetName()<<" belongs to the set of sensitive detectors "<<volumeName);
90 if( matchStrings( volumeName.data(), logVol->GetName() ) ){
91 ++numFound;
92 SetSensitiveDetector(logVol, sdPtr);
93 }
94
95 }
96 // Warn if no volumes were found
97 if(numFound == 0) {
98 ATH_MSG_WARNING("Volume " << volumeName <<
99 " not found in G4LogicalVolumeStore.");
100 }
101 else {
102 ATH_MSG_VERBOSE("Found " << numFound << " copies of LV " << volumeName <<
103 "; SD " << sd->GetName() << " assigned.");
104 gotOne = true;
105 }
106
107 }
108
109 // Abort if we have failed to assign any volume
110 if(!gotOne) {
111 ATH_MSG_ERROR( "Failed to assign *any* volume to SD " << name() <<
112 " and expected at least one. Size of the volume store "<<G4LogicalVolumeStore::GetInstance()->size() );
113 return StatusCode::FAILURE;
114 }
115 }
116
117 return StatusCode::SUCCESS;
118}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
static bool matchStrings(const char *first, const char *second)
Match two strings with wildcard support.
void SetSensitiveDetector(G4LogicalVolume *, G4VSensitiveDetector *) const
Method stolen from G4VUserDetectorConstruction in G4 10.2.

◆ Gather() [1/2]

StatusCode FCS_Param::FCS_StepInfoSDTool::Gather ( )
finaloverridevirtual

Calls down to all the SDs to pack their hits into one collection.

Reimplemented from SensitiveDetectorBase.

Definition at line 168 of file FCS_StepInfoSDTool.cxx.

168 {
169 ATH_MSG_DEBUG("Gathering hits to write out in " << name());
170 auto* sdWrapper = dynamic_cast<FCS_StepInfoSDWrapper*>(getSD());
171 if (!sdWrapper) {
172 ATH_MSG_ERROR("Failed to cast SD to FCS_StepInfoSDWrapper");
173 return StatusCode::FAILURE;
174 }
175 sdWrapper->EndOfAthenaEvent();
176 return StatusCode::SUCCESS;
177}
#define ATH_MSG_DEBUG(x)
void EndOfAthenaEvent()
Gather the hits into the WriteHandle from all the SDs.
Definition SDWrapper.cxx:70
G4VSensitiveDetector * getSD()
Retrieve the current SD.
detail::SDWrapper< FCS_StepInfoSD, ISF_FCS_Parametrization::FCS_StepInfoCollection > FCS_StepInfoSDWrapper
Template instantiation for LArG4SimpleSD.

◆ Gather() [2/2]

◆ getSD()

G4VSensitiveDetector * SensitiveDetectorBase::getSD ( )
protectedinherited

Retrieve the current SD.

In AthenaMT, this means the thread-local SD. Otherwise, it is simply the single SD.

Definition at line 120 of file SensitiveDetectorBase.cxx.

121{
122#ifdef G4MULTITHREADED
123 // Get current thread-ID
124 const auto tid = std::this_thread::get_id();
125 // Retrieve it from the SD map
126 auto sdPair = m_sdThreadMap.find(tid);
127 if(sdPair == m_sdThreadMap.end()) return nullptr;
128 return sdPair->second;
129#else
130 return m_SD;
131#endif
132}
G4VSensitiveDetector * m_SD
The sensitive detector to which this thing corresponds.

◆ initialize()

StatusCode FCS_Param::FCS_StepInfoSDTool::initialize ( )
finaloverride

Initialize the tool.

Definition at line 108 of file FCS_StepInfoSDTool.cxx.

108 {
109 ATH_MSG_DEBUG("Initializing " << name());
110
111 const CaloIdManager* idMgr = nullptr;
112 CHECK(detStore()->retrieve(idMgr));
113 m_larEmID = idMgr->getEM_ID();
114 if (m_larEmID == nullptr) {
115 ATH_MSG_ERROR("Invalid LAr EM ID helper");
116 return StatusCode::FAILURE;
117 }
118 m_larFcalID = idMgr->getFCAL_ID();
119 if (m_larFcalID == nullptr) {
120 ATH_MSG_ERROR("Invalid LAr FCAL ID helper");
121 return StatusCode::FAILURE;
122 }
123 m_larHecID = idMgr->getHEC_ID();
124 if (m_larHecID == nullptr) {
125 ATH_MSG_ERROR("Invalid LAr HEC ID helper");
126 return StatusCode::FAILURE;
127 }
128 m_tileID = idMgr->getTileID();
129 if (m_tileID == nullptr) {
130 ATH_MSG_ERROR("Invalid Tile ID helper");
131 return StatusCode::FAILURE;
132 }
133
134 // No general volume list for SensitiveDetectorBase
135 m_noVolumes = true;
136
138
139 return StatusCode::SUCCESS;
140}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define CHECK(...)
Evaluate an expression and check for errors.
const TileID * getTileID(void) const
const LArHEC_ID * getHEC_ID(void) const
const LArFCAL_ID * getFCAL_ID(void) const
const LArEM_ID * getEM_ID(void) const
virtual StatusCode initializeCalculators()
Initialize Calculator Services.
Gaudi::Property< bool > m_noVolumes
This SensitiveDetector has no volumes associated with it.
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ initializeCalculators()

StatusCode FCS_Param::FCS_StepInfoSDTool::initializeCalculators ( )
privatevirtual

Initialize Calculator Services.

Definition at line 145 of file FCS_StepInfoSDTool.cxx.

145 {
146 // Lots of calculators !!!
147 ATH_CHECK(m_bpsmodcalc.retrieve());
148 ATH_CHECK(m_embcalc.retrieve());
149 ATH_CHECK(m_emepiwcalc.retrieve());
150 ATH_CHECK(m_emeniwcalc.retrieve());
151 ATH_CHECK(m_emepowcalc.retrieve());
152 ATH_CHECK(m_emenowcalc.retrieve());
153 ATH_CHECK(m_emepscalc.retrieve());
154 ATH_CHECK(m_emepobarcalc.retrieve());
155 ATH_CHECK(m_emenobarcalc.retrieve());
156 ATH_CHECK(m_heccalc.retrieve());
157 ATH_CHECK(m_fcal1calc.retrieve());
158 ATH_CHECK(m_fcal2calc.retrieve());
159 ATH_CHECK(m_fcal3calc.retrieve());
160 ATH_CHECK(m_tileCalculator.retrieve());
161
162 return StatusCode::SUCCESS;
163}

◆ initializeSD()

StatusCode SensitiveDetectorBase::initializeSD ( )
overrideinherited

Setup an SD in the current thread.

Separate from the AthAlgTool initialize() method because it needs to be called once per worker thread in AthenaMT. Don't confuse this with the G4 SD method Initialize which is called at the beginning of every G4 event.

Definition at line 25 of file SensitiveDetectorBase.cxx.

26{
27 ATH_MSG_VERBOSE( name() << "::initializeSD()" );
28
29 // Sanity check for volume configuration problems.
30 // It would be better to have a more robust solution for this.
31 if(m_volumeNames.empty() != m_noVolumes) {
32 ATH_MSG_ERROR("Initializing SD from " << name() << ", NoVolumes = "
33 << (m_noVolumes? "true" : "false") << ", but LogicalVolumeNames = "
34 << m_volumeNames.value());
35 return StatusCode::FAILURE;
36 }
37
38 // Make sure SD isn't already registered
39 if(getSD())
40 {
41 ATH_MSG_ERROR("Trying to create a SD which already exists!");
42 return StatusCode::FAILURE;
43 }
44
45 // Make the SD stored by this tool
46 auto sd = std::unique_ptr<G4VSensitiveDetector>(makeSD());
47 if(!sd)
48 {
49 ATH_MSG_ERROR("Failed to create SD!");
50 return StatusCode::FAILURE;
51 }
52 setSD(sd.get());
53
54 // Assign the SD to our list of volumes
55 ATH_CHECK( assignSD( std::move(sd), m_volumeNames.value() ) );
56
57 ATH_MSG_DEBUG( "Initialized and added SD " << name() );
58 return StatusCode::SUCCESS;
59}
StatusCode assignSD(std::unique_ptr< G4VSensitiveDetector > sd, const std::vector< std::string > &volumes) const
Assign SD to a list of volumes.
Gaudi::Property< std::vector< std::string > > m_volumeNames
All the volumes to which this SD is assigned.
void setSD(G4VSensitiveDetector *)
Set the current SD.

◆ makeOneLArSD()

FCS_StepInfoSD * FCS_Param::FCS_StepInfoSDTool::makeOneLArSD ( const std::string & name,
ILArCalculatorSvc * calc,
const std::vector< std::string > & volumes ) const
private

Helper method to create one SD.

Definition at line 223 of file FCS_StepInfoSDTool.cxx.

225 {
226 ATH_MSG_VERBOSE(name() << " makeOneSD");
227
228 // Parse the wildcard patterns for existing volume names
229 auto parsedVolumes = LArG4::findLogicalVolumes(
230 volumes, msg()); // from LArG4Code/VolumeUtils.h
231
232 // Inject the Calculator into m_config
233 FCS_Param::Config config(m_config);
234 config.m_LArCalculator = calc;
235 if (!calc) {
236 throw GaudiException(
237 "nullptr for ILArCalculatorSvc provided to constructor for: " + sdName,
238 name(), StatusCode::FAILURE);
239 }
240 if (msgLvl(MSG::VERBOSE)) {
241 config.verboseLevel = 10;
242 } else if (msgLvl(MSG::DEBUG)) {
243 config.verboseLevel = 5;
244 }
245 // Create the simple SD
246 auto sd = std::make_unique<LArFCS_StepInfoSD>(sdName, config);
247 auto* sdPtr = sd.get();
248 sd->setupHelpers(m_larEmID, m_larFcalID, m_larHecID, m_tileID);
249
250 // Assign the volumes to the SD, this will give ownership of the pointer to Geant
251 if (this->assignSD(std::move(sd), parsedVolumes).isFailure()) {
252 // TODO: can I just return NULL here?
253 throw GaudiException("Failed to assign sd: " + sdName, name(),
254 StatusCode::FAILURE);
255 }
256 // cppcheck-suppress returnDanglingLifetime
257 return sdPtr;
258}
std::set< std::string > findLogicalVolumes(const std::string &pattern)
Search for logical volumes in the G4 volume store.
MsgStream & msg
Definition testRead.cxx:32

◆ makeOneTileSD()

FCS_StepInfoSD * FCS_Param::FCS_StepInfoSDTool::makeOneTileSD ( const std::string & name,
ITileCalculator * calc,
const std::vector< std::string > & volumes ) const
private

Helper method to create one SD.

Definition at line 263 of file FCS_StepInfoSDTool.cxx.

265 {
266 ATH_MSG_VERBOSE(name() << " makeOneSD");
267
268 // Inject the Calculator into m_config
269 FCS_Param::Config config(m_config);
270 config.m_TileCalculator = calc;
271 if (!calc) {
272 throw GaudiException(
273 "nullptr for ITileCalculator provided to constructor for: " + sdName,
274 name(), StatusCode::FAILURE);
275 }
276 if (msgLvl(MSG::VERBOSE)) {
277 config.verboseLevel = 10;
278 } else if (msgLvl(MSG::DEBUG)) {
279 config.verboseLevel = 5;
280 }
281 // Create the simple SD
282 auto sd = std::make_unique<TileFCS_StepInfoSD>(sdName, config);
283 auto* sdPtr = sd.get();
284 sd->setupHelpers(m_larEmID, m_larFcalID, m_larHecID, m_tileID);
285
286 // Assign the volumes to the SD, this will give ownership of the pointer to Geant
287 if (this->assignSD(std::move(sd), volumes).isFailure()) {
288 // TODO: can I just return NULL here?
289 throw GaudiException("Failed to assign sd: " + sdName, name(),
290 StatusCode::FAILURE);
291 }
292 // cppcheck-suppress returnDanglingLifetime
293 return sdPtr;
294}

◆ makeSD()

G4VSensitiveDetector * FCS_Param::FCS_StepInfoSDTool::makeSD ( ) const
finaloverrideprivate

Create the SD wrapper for current worker thread.

Definition at line 182 of file FCS_StepInfoSDTool.cxx.

182 {
183 // Create the wrapper
184 auto* sdWrapper =
185 new FCS_StepInfoSDWrapper("FCS_StepInfoSDWrapper", m_hitCollName);
186
187 // Create the SDs.
188 sdWrapper->addSD(makeOneLArSD("Barrel::Presampler::Module::StepInfo",
190 sdWrapper->addSD(
191 makeOneLArSD("EMB::STAC::StepInfo", &*m_embcalc, m_stacVolumes));
192 sdWrapper->addSD(makeOneLArSD("EMEC::Pos::InnerWheel::StepInfo",
194 sdWrapper->addSD(makeOneLArSD("EMEC::Neg::InnerWheel::StepInfo",
196 sdWrapper->addSD(makeOneLArSD("EMEC::Pos::OuterWheel::StepInfo",
198 sdWrapper->addSD(makeOneLArSD("EMEC::Neg::OuterWheel::StepInfo",
200 sdWrapper->addSD(makeOneLArSD("Endcap::Presampler::LiquidArgon::StepInfo",
202 sdWrapper->addSD(makeOneLArSD("EMEC::Pos::BackOuterBarrette::StepInfo",
204 sdWrapper->addSD(makeOneLArSD("EMEC::Neg::BackOuterBarrette::StepInfo",
206 sdWrapper->addSD(makeOneLArSD("FCAL::Module1::Gap::StepInfo", &*m_fcal1calc,
208 sdWrapper->addSD(makeOneLArSD("FCAL::Module2::Gap::StepInfo", &*m_fcal2calc,
210 sdWrapper->addSD(makeOneLArSD("FCAL::Module3::Gap::StepInfo", &*m_fcal3calc,
212 sdWrapper->addSD(makeOneLArSD("HEC::Module::Depth::Slice::Wheel::StepInfo",
214 sdWrapper->addSD(makeOneTileSD("Tile::Scintillator::StepInfo",
216
217 return sdWrapper;
218}
FCS_StepInfoSD * makeOneTileSD(const std::string &name, ITileCalculator *calc, const std::vector< std::string > &volumes) const
Helper method to create one SD.
FCS_StepInfoSD * makeOneLArSD(const std::string &name, ILArCalculatorSvc *calc, const std::vector< std::string > &volumes) const
Helper method to create one SD.

◆ matchStrings()

bool SensitiveDetectorBase::matchStrings ( const char * first,
const char * second )
staticprivateinherited

Match two strings with wildcard support.

Compares two strings character by character with optional * wildcard in the first argument

Definition at line 147 of file SensitiveDetectorBase.cxx.

148{
149 // If we reach at the end of both strings, we are done
150 if (*first == '\0' && *second == '\0')
151 return true;
152
153 // If there are consecutive '*' present in the first string
154 // advance to the next character
155 if(*first == '*' && *(first + 1) == '*')
156 return matchStrings(first + 1, second);
157
158 // Make sure that the characters after '*' are present in second string.
159 if (*first == '*' && *(first + 1) != '\0' && *second == '\0')
160 return false;
161
162 // If the current characters of both strings match
163 if (*first == *second)
164 return matchStrings(first + 1, second + 1);
165
166 // If there is *, then there are two possibilities
167 // a) We consider current character of second string
168 // b) We ignore current character of second string.
169 if (*first == '*')
170 return matchStrings(first + 1, second) || matchStrings(first, second + 1);
171 return false;
172}

◆ setSD()

void SensitiveDetectorBase::setSD ( G4VSensitiveDetector * sd)
privateinherited

Set the current SD.

In hive, this gets assigned as the thread-local SD.

Definition at line 134 of file SensitiveDetectorBase.cxx.

135{
136#ifdef G4MULTITHREADED
137 const auto tid = std::this_thread::get_id();
138 ATH_MSG_DEBUG("Creating and registering SD " << sd << " in thread " << tid);
139 m_sdThreadMap.insert( std::make_pair(tid, sd) );
140#else
141 m_SD = sd;
142#endif
143}

◆ SetSensitiveDetector()

void SensitiveDetectorBase::SetSensitiveDetector ( G4LogicalVolume * logVol,
G4VSensitiveDetector * aSD ) const
protectedinherited

Method stolen from G4VUserDetectorConstruction in G4 10.2.

Definition at line 174 of file SensitiveDetectorBase.cxx.

176{
177 // New Logic: allow for "multiple" SDs being attached to a single LV.
178 // To do that we use a special proxy SD called G4MultiSensitiveDetector
179
180 // Get existing SD if already set and check if it is of the special type
181 G4VSensitiveDetector* originalSD = logVol->GetSensitiveDetector();
182 if ( originalSD == nullptr )
183 {
184 logVol->SetSensitiveDetector(aSD);
185 }
186 else
187 {
188 G4MultiSensitiveDetector* msd = dynamic_cast<G4MultiSensitiveDetector*>(originalSD);
189 if ( msd != nullptr )
190 {
191 msd->AddSD(aSD);
192 }
193 else
194 {
195 // Construct a unique name using the volume address
196 std::stringstream ss;
198 const G4String msdname = "/MultiSD_" + logVol->GetName() + ss.str();
199 msd = new G4MultiSensitiveDetector(std::move(msdname));
200 // We need to register the proxy to have correct handling of IDs
201 G4SDManager::GetSDMpointer()->AddNewDetector(msd);
202 msd->AddSD(originalSD);
203 msd->AddSD(aSD);
204 logVol->SetSensitiveDetector(msd);
205 }
206 }
207}
static Double_t ss

◆ SetupEvent() [1/2]

virtual StatusCode SensitiveDetectorBase::SetupEvent ( )
inlineoverridevirtualinherited

Beginning of an athena event.

This is where collection initialization should happen. If we are using a WriteHandle, then this could be empty.

Reimplemented in AFP_SensitiveDetectorTool, AFP_SiDSensitiveDetectorTool, AFP_TDSensitiveDetectorTool, ALFA_SensitiveDetectorTool, CaloCellContainerSDTool, and MuonWallSDTool.

Definition at line 70 of file SensitiveDetectorBase.h.

70{ return StatusCode::SUCCESS; }

◆ SetupEvent() [2/2]

Member Data Documentation

◆ m_bpsmodcalc

ServiceHandle<ILArCalculatorSvc> FCS_Param::FCS_StepInfoSDTool::m_bpsmodcalc
private

Definition at line 92 of file FCS_StepInfoSDTool.h.

◆ m_config

FCS_Param::Config FCS_Param::FCS_StepInfoSDTool::m_config
private

Definition at line 123 of file FCS_StepInfoSDTool.h.

◆ m_embcalc

ServiceHandle<ILArCalculatorSvc> FCS_Param::FCS_StepInfoSDTool::m_embcalc
private

Definition at line 94 of file FCS_StepInfoSDTool.h.

◆ m_emeniwcalc

ServiceHandle<ILArCalculatorSvc> FCS_Param::FCS_StepInfoSDTool::m_emeniwcalc
private

Definition at line 97 of file FCS_StepInfoSDTool.h.

◆ m_emenobarcalc

ServiceHandle<ILArCalculatorSvc> FCS_Param::FCS_StepInfoSDTool::m_emenobarcalc
private

Definition at line 107 of file FCS_StepInfoSDTool.h.

◆ m_emenowcalc

ServiceHandle<ILArCalculatorSvc> FCS_Param::FCS_StepInfoSDTool::m_emenowcalc
private

Definition at line 101 of file FCS_StepInfoSDTool.h.

◆ m_emepiwcalc

ServiceHandle<ILArCalculatorSvc> FCS_Param::FCS_StepInfoSDTool::m_emepiwcalc
private

Definition at line 95 of file FCS_StepInfoSDTool.h.

◆ m_emepobarcalc

ServiceHandle<ILArCalculatorSvc> FCS_Param::FCS_StepInfoSDTool::m_emepobarcalc
private

Definition at line 105 of file FCS_StepInfoSDTool.h.

◆ m_emepowcalc

ServiceHandle<ILArCalculatorSvc> FCS_Param::FCS_StepInfoSDTool::m_emepowcalc
private

Definition at line 99 of file FCS_StepInfoSDTool.h.

◆ m_emepscalc

ServiceHandle<ILArCalculatorSvc> FCS_Param::FCS_StepInfoSDTool::m_emepscalc
private

Definition at line 104 of file FCS_StepInfoSDTool.h.

◆ m_fcal1calc

ServiceHandle<ILArCalculatorSvc> FCS_Param::FCS_StepInfoSDTool::m_fcal1calc
private

Definition at line 111 of file FCS_StepInfoSDTool.h.

◆ m_fcal1Volumes

std::vector<std::string> FCS_Param::FCS_StepInfoSDTool::m_fcal1Volumes
private

Definition at line 84 of file FCS_StepInfoSDTool.h.

◆ m_fcal2calc

ServiceHandle<ILArCalculatorSvc> FCS_Param::FCS_StepInfoSDTool::m_fcal2calc
private

Definition at line 112 of file FCS_StepInfoSDTool.h.

◆ m_fcal2Volumes

std::vector<std::string> FCS_Param::FCS_StepInfoSDTool::m_fcal2Volumes
private

Definition at line 85 of file FCS_StepInfoSDTool.h.

◆ m_fcal3calc

ServiceHandle<ILArCalculatorSvc> FCS_Param::FCS_StepInfoSDTool::m_fcal3calc
private

Definition at line 113 of file FCS_StepInfoSDTool.h.

◆ m_fcal3Volumes

std::vector<std::string> FCS_Param::FCS_StepInfoSDTool::m_fcal3Volumes
private

Definition at line 86 of file FCS_StepInfoSDTool.h.

◆ m_heccalc

ServiceHandle<ILArCalculatorSvc> FCS_Param::FCS_StepInfoSDTool::m_heccalc
private

Definition at line 110 of file FCS_StepInfoSDTool.h.

◆ m_hitCollName

std::string FCS_Param::FCS_StepInfoSDTool::m_hitCollName
private

Hit collection name.

Definition at line 71 of file FCS_StepInfoSDTool.h.

◆ m_larEmID

const LArEM_ID* FCS_Param::FCS_StepInfoSDTool::m_larEmID
private

Definition at line 118 of file FCS_StepInfoSDTool.h.

◆ m_larFcalID

const LArFCAL_ID* FCS_Param::FCS_StepInfoSDTool::m_larFcalID
private

Definition at line 119 of file FCS_StepInfoSDTool.h.

◆ m_larHecID

const LArHEC_ID* FCS_Param::FCS_StepInfoSDTool::m_larHecID
private

Definition at line 120 of file FCS_StepInfoSDTool.h.

◆ m_nBOBVolumes

std::vector<std::string> FCS_Param::FCS_StepInfoSDTool::m_nBOBVolumes
private

Definition at line 83 of file FCS_StepInfoSDTool.h.

◆ m_negIWVolumes

std::vector<std::string> FCS_Param::FCS_StepInfoSDTool::m_negIWVolumes
private

Definition at line 78 of file FCS_StepInfoSDTool.h.

◆ m_negOWVolumes

std::vector<std::string> FCS_Param::FCS_StepInfoSDTool::m_negOWVolumes
private

Definition at line 80 of file FCS_StepInfoSDTool.h.

◆ m_noVolumes

Gaudi::Property<bool> SensitiveDetectorBase::m_noVolumes {this, "NoVolumes", false}
protectedinherited

This SensitiveDetector has no volumes associated with it.

Definition at line 101 of file SensitiveDetectorBase.h.

101{this, "NoVolumes", false};

◆ m_outputCollectionNames

Gaudi::Property<std::vector<std::string> > SensitiveDetectorBase::m_outputCollectionNames {this, "OutputCollectionNames", {}}
protectedinherited

Names of all output collections written out by this SD.

Definition at line 98 of file SensitiveDetectorBase.h.

98{this, "OutputCollectionNames", {}};

◆ m_pBOBVolumes

std::vector<std::string> FCS_Param::FCS_StepInfoSDTool::m_pBOBVolumes
private

Definition at line 82 of file FCS_StepInfoSDTool.h.

◆ m_posIWVolumes

std::vector<std::string> FCS_Param::FCS_StepInfoSDTool::m_posIWVolumes
private

Definition at line 77 of file FCS_StepInfoSDTool.h.

◆ m_posOWVolumes

std::vector<std::string> FCS_Param::FCS_StepInfoSDTool::m_posOWVolumes
private

Definition at line 79 of file FCS_StepInfoSDTool.h.

◆ m_presBarVolumes

std::vector<std::string> FCS_Param::FCS_StepInfoSDTool::m_presBarVolumes
private

Definition at line 76 of file FCS_StepInfoSDTool.h.

◆ m_presECVolumes

std::vector<std::string> FCS_Param::FCS_StepInfoSDTool::m_presECVolumes
private

Definition at line 81 of file FCS_StepInfoSDTool.h.

◆ m_SD

G4VSensitiveDetector* SensitiveDetectorBase::m_SD {}
privateinherited

The sensitive detector to which this thing corresponds.

Definition at line 125 of file SensitiveDetectorBase.h.

125{};

◆ m_sliceVolumes

std::vector<std::string> FCS_Param::FCS_StepInfoSDTool::m_sliceVolumes
private

Definition at line 87 of file FCS_StepInfoSDTool.h.

◆ m_stacVolumes

std::vector<std::string> FCS_Param::FCS_StepInfoSDTool::m_stacVolumes
private

Definition at line 75 of file FCS_StepInfoSDTool.h.

◆ m_tileCalculator

ServiceHandle<ITileCalculator> FCS_Param::FCS_StepInfoSDTool::m_tileCalculator
private

Definition at line 114 of file FCS_StepInfoSDTool.h.

◆ m_tileID

const TileID* FCS_Param::FCS_StepInfoSDTool::m_tileID
private

Definition at line 121 of file FCS_StepInfoSDTool.h.

◆ m_tileVolumes

std::vector<std::string> FCS_Param::FCS_StepInfoSDTool::m_tileVolumes
private

Definition at line 88 of file FCS_StepInfoSDTool.h.

◆ m_volumeNames

Gaudi::Property<std::vector<std::string> > SensitiveDetectorBase::m_volumeNames {this, "LogicalVolumeNames", {}}
protectedinherited

All the volumes to which this SD is assigned.

Definition at line 96 of file SensitiveDetectorBase.h.

96{this, "LogicalVolumeNames", {}};

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