 |
ATLAS Offline Software
|
#include <PixelSensorSDTool.h>
|
Gaudi::Property< bool > | m_gmxSensor {this, "GmxSensor", false} |
|
ServiceHandle< IGeoDbTagSvc > | m_geoDbTagSvc {this, "GeoDbTagSvc", "GeoDbTagSvc", ""} |
|
Gaudi::Property< std::vector< std::string > > | m_volumeNames {this, "LogicalVolumeNames", {}} |
| All the volumes to which this SD is assigned. More...
|
|
Gaudi::Property< std::vector< std::string > > | m_outputCollectionNames {this, "OutputCollectionNames", {}} |
| Names of all output collections written out by this SD. More...
|
|
Gaudi::Property< bool > | m_noVolumes {this, "NoVolumes", false} |
| This SensitiveDetector has no volumes associated with it. More...
|
|
|
void | setSD (G4VSensitiveDetector *) |
| Set the current SD. More...
|
|
|
G4VSensitiveDetector * | m_SD {} |
| The sensitive detector to which this thing corresponds. More...
|
|
Definition at line 23 of file PixelSensorSDTool.h.
◆ PixelSensorSDTool()
PixelSensorSDTool::PixelSensorSDTool |
( |
const std::string & |
type, |
|
|
const std::string & |
name, |
|
|
const IInterface * |
parent |
|
) |
| |
◆ assignSD()
StatusCode SensitiveDetectorBase::assignSD |
( |
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 69 of file SensitiveDetectorBase.cxx.
78 auto sdMgr = G4SDManager::GetSDMpointer();
79 sdMgr->AddNewDetector(
sd);
81 if(!volumes.empty()) {
83 auto logicalVolumeStore = G4LogicalVolumeStore::GetInstance();
84 for(
const auto& volumeName : volumes) {
90 for(
auto* logVol : *logicalVolumeStore) {
92 ATH_MSG_VERBOSE(
"Check whether "<<logVol->GetName()<<
" belongs to the set of sensitive detectors "<<volumeName);
93 if(
matchStrings( volumeName.data(), logVol->GetName() ) ){
102 " not found in G4LogicalVolumeStore.");
105 ATH_MSG_VERBOSE(
"Found " << numFound <<
" copies of LV " << volumeName <<
106 "; SD " <<
sd->GetName() <<
" assigned.");
115 " and expected at least one. Size of the volume store "<<G4LogicalVolumeStore::GetInstance()->
size() );
116 return StatusCode::FAILURE;
120 return StatusCode::SUCCESS;
◆ Gather() [1/2]
virtual StatusCode SensitiveDetectorBase::Gather |
( |
| ) |
|
|
inlineoverridevirtualinherited |
End of an athena event.
Store the output collection in SG at this point. If we are using a WriteHandle, then this can be empty!
Reimplemented in LArG4::SimpleSDTool, LArG4::CalibSDTool, FCS_Param::FCS_StepInfoSDTool, TBECBackOuterBarretteTool, TBECInnerModuleTool, TBECOuterModuleTool, LArG4H62004HECSDTool, LArG4H62004InactiveSDTool, LArG4H62004EMECSDTool, LArG4H62004ActiveSDTool, LArG4H62004DeadSDTool, LArG4H62004FCALSDTool, MuonWallSDTool, AFP_SensitiveDetectorTool, AFP_SiDSensitiveDetectorTool, AFP_TDSensitiveDetectorTool, ZDC_G4CalibSDTool, CaloCellContainerSDTool, MinBiasScintillatorSDTool, ALFA_SensitiveDetectorTool, ZDC_FiberSDTool, and LArG4H6WarmTCSDTool.
Definition at line 78 of file SensitiveDetectorBase.h.
78 {
return StatusCode::SUCCESS; }
◆ 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 123 of file SensitiveDetectorBase.cxx.
125 #ifdef G4MULTITHREADED
127 const auto tid = std::this_thread::get_id();
129 auto sdPair = m_sdThreadMap.find(tid);
130 if(sdPair == m_sdThreadMap.end())
return nullptr;
131 return sdPair->second;
◆ 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 30 of file SensitiveDetectorBase.cxx.
38 << (
m_noVolumes?
"true" :
"false") <<
", but LogicalVolumeNames = "
40 return StatusCode::FAILURE;
47 return StatusCode::FAILURE;
55 return StatusCode::FAILURE;
63 return StatusCode::SUCCESS;
◆ makeSD()
G4VSensitiveDetector * PixelSensorSDTool::makeSD |
( |
| ) |
const |
|
finaloverrideprotected |
Definition at line 44 of file PixelSensorSDTool.cxx.
48 GeoModelIO::ReadGeoModel* sqlreader =
nullptr;
51 msg(MSG::ERROR) <<
"Could not locate GeoDbTagSvc" <<
endmsg;
◆ 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 150 of file SensitiveDetectorBase.cxx.
◆ setSD()
void SensitiveDetectorBase::setSD |
( |
G4VSensitiveDetector * |
sd | ) |
|
|
privateinherited |
Set the current SD.
In hive, this gets assigned as the thread-local SD.
Definition at line 137 of file SensitiveDetectorBase.cxx.
139 #ifdef G4MULTITHREADED
140 const auto tid = std::this_thread::get_id();
141 ATH_MSG_DEBUG(
"Creating and registering SD " <<
sd <<
" in thread " << tid);
142 m_sdThreadMap.insert( std::make_pair(tid,
sd) );
◆ SetSensitiveDetector()
void SensitiveDetectorBase::SetSensitiveDetector |
( |
G4LogicalVolume * |
logVol, |
|
|
G4VSensitiveDetector * |
aSD |
|
) |
| const |
|
protectedinherited |
Method stolen from G4VUserDetectorConstruction in G4 10.2.
Definition at line 177 of file SensitiveDetectorBase.cxx.
184 G4VSensitiveDetector* originalSD = logVol->GetSensitiveDetector();
185 if ( originalSD ==
nullptr )
187 logVol->SetSensitiveDetector(aSD);
191 G4MultiSensitiveDetector* msd =
dynamic_cast<G4MultiSensitiveDetector*
>(originalSD);
192 if ( msd !=
nullptr )
199 std::stringstream
ss;
200 ss << static_cast<const void*>(logVol);
201 const G4String msdname =
"/MultiSD_" + logVol->GetName() +
ss.str();
203 msd =
new G4MultiSensitiveDetector(msdname);
205 G4SDManager::GetSDMpointer()->AddNewDetector(msd);
206 msd->AddSD(originalSD);
208 logVol->SetSensitiveDetector(msd);
◆ SetupEvent() [1/2]
virtual StatusCode SensitiveDetectorBase::SetupEvent |
( |
| ) |
|
|
inlineoverridevirtualinherited |
◆ SetupEvent() [2/2]
◆ m_geoDbTagSvc
◆ m_gmxSensor
Gaudi::Property<bool> PixelSensorSDTool::m_gmxSensor {this, "GmxSensor", false} |
|
protected |
◆ m_noVolumes
Gaudi::Property<bool> SensitiveDetectorBase::m_noVolumes {this, "NoVolumes", false} |
|
protectedinherited |
◆ m_outputCollectionNames
Gaudi::Property<std::vector<std::string> > SensitiveDetectorBase::m_outputCollectionNames {this, "OutputCollectionNames", {}} |
|
protectedinherited |
◆ m_SD
G4VSensitiveDetector* SensitiveDetectorBase::m_SD {} |
|
privateinherited |
◆ m_volumeNames
Gaudi::Property<std::vector<std::string> > SensitiveDetectorBase::m_volumeNames {this, "LogicalVolumeNames", {}} |
|
protectedinherited |
The documentation for this class was generated from the following files:
G4VSensitiveDetector * m_SD
The sensitive detector to which this thing corresponds.
SensitiveDetectorBase(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
#define ATH_MSG_VERBOSE(x)
G4VSensitiveDetector * getSD()
Retrieve the current SD.
std::pair< StorageIterator, bool > Emplace(std::string const &hitCollectionName, CollectionArgs &&... args)
Insert a container in the map with in-place construction.
::StatusCode StatusCode
StatusCode definition for legacy code.
Gaudi::Property< std::vector< std::string > > m_outputCollectionNames
Names of all output collections written out by this SD.
void SetSensitiveDetector(G4LogicalVolume *, G4VSensitiveDetector *) const
Method stolen from G4VUserDetectorConstruction in G4 10.2.
void Record(std::string const &sgKey, std::string const &hitCollectionName, EventContext const &ctx)
Record the hit collection hitCollectionName to the StoreGate sgKey.
static bool matchStrings(const char *first, const char *second)
Match two strings with wildcard support.
Gaudi::Property< std::vector< std::string > > m_volumeNames
All the volumes to which this SD is assigned.
#define ATH_MSG_WARNING(x)
Gaudi::Property< bool > m_noVolumes
This SensitiveDetector has no volumes associated with it.
void setSD(G4VSensitiveDetector *)
Set the current SD.
StatusCode assignSD(G4VSensitiveDetector *sd, const std::vector< std::string > &volumes) const
Assign SD to a list of volumes.