ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
LArG4H62004InactiveSDTool Class Reference

DEPRECATED AND WILL BE REMOVED. More...

#include <LArG4H62004InactiveSDTool.h>

Inheritance diagram for LArG4H62004InactiveSDTool:
Collaboration diagram for LArG4H62004InactiveSDTool:

Public Member Functions

 LArG4H62004InactiveSDTool (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual ~LArG4H62004InactiveSDTool ()=default
 
virtual StatusCode initializeCalculators () override final
 
StatusCode initializeSD () override final
 
StatusCode Gather () override final
 End of an athena event. More...
 
StatusCode initialize () override final
 
void setupHelpers (LArG4SimpleSD *) const
 Helper method to pass the ID helper pointers to the SDs. More...
 
void setupHelpers (LArG4CalibSD *) const
 Overload of the above method for calib SDs. More...
 
virtual StatusCode SetupEvent () override
 Beginning of an athena event. More...
 
virtual StatusCode SetupEvent (HitCollectionMap &) override
 
virtual StatusCode Gather (HitCollectionMap &) override
 

Protected Member Functions

G4VSensitiveDetector * makeSD () const override final
 
void setupAllSDs (const std::map< G4VSensitiveDetector *, std::vector< std::string > * > &configuration) const
 Method actually doing the work to assign all of these SDs FIXME: this argument type is nasty: More...
 
bool match (const char *first, const char *second) const
 Helper function for matching strings with wildcards. More...
 
StatusCode assignSD (G4VSensitiveDetector *sd, const std::vector< std::string > &volumes) const
 Assign SD to a list of volumes. More...
 
G4VSensitiveDetector * getSD ()
 Retrieve the current SD. More...
 
void SetSensitiveDetector (G4LogicalVolume *, G4VSensitiveDetector *) const
 Method stolen from G4VUserDetectorConstruction in G4 10.2. More...
 

Protected Attributes

Gaudi::Property< G4bool > m_doPID {this, "ParticleID", false}
 Are we set up to run with PID hits? More...
 
Gaudi::Property< std::string > m_timeBinType {this, "TimeBinType", "Default"}
 What time binning type for regular hits? More...
 
Gaudi::Property< float > m_timeBinWidth {this, "TimeBinWidth", 2.5*CLHEP::ns}
 What time bin width for regular hits? More...
 
Gaudi::Property< G4bool > m_useFrozenShowers {this, "UseFrozenShowers", false}
 Is there going to be a fast simulation coming into this SD? More...
 
const LArEM_IDm_larEmID {nullptr}
 Pointers to the identifier helpers. More...
 
const LArFCAL_IDm_larFcalID {nullptr}
 
const LArHEC_IDm_larHecID {nullptr}
 
const CaloDM_IDm_caloDmID {nullptr}
 
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...
 

Private Member Functions

void setSD (G4VSensitiveDetector *)
 Set the current SD. More...
 

Static Private Member Functions

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

Private Attributes

SG::WriteHandle< CaloCalibrationHitContainerm_HitColl
 
ServiceHandle< ILArCalibCalculatorSvcm_emepiwcalc
 
ServiceHandle< ILArCalibCalculatorSvcm_heccalc
 
ServiceHandle< ILArCalibCalculatorSvcm_fcal1calc
 
ServiceHandle< ILArCalibCalculatorSvcm_fcal2calc
 
LArG4CalibSDm_emecSD {nullptr}
 
LArG4CalibSDm_hecSD {nullptr}
 
LArG4CalibSDm_fcal1SD {nullptr}
 
LArG4CalibSDm_fcal2SD {nullptr}
 
Gaudi::Property< std::vector< std::string > > m_emecVolumes {this, "EMECVolumes"}
 
Gaudi::Property< std::vector< std::string > > m_hecVolumes {this, "HECVolumes"}
 
Gaudi::Property< std::vector< std::string > > m_fcal1Volumes {this, "FCAL1Volumes"}
 
Gaudi::Property< std::vector< std::string > > m_fcal2Volumes {this, "FCAL2Volumes"}
 
G4VSensitiveDetector * m_SD {}
 The sensitive detector to which this thing corresponds. More...
 

Detailed Description

DEPRECATED AND WILL BE REMOVED.

Please see LArG4::H62004InactiveSDTool instead.

Definition at line 21 of file LArG4H62004InactiveSDTool.h.

Constructor & Destructor Documentation

◆ LArG4H62004InactiveSDTool()

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

◆ ~LArG4H62004InactiveSDTool()

virtual LArG4H62004InactiveSDTool::~LArG4H62004InactiveSDTool ( )
virtualdefault

Member Function Documentation

◆ 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.

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

◆ Gather() [1/2]

StatusCode LArG4H62004InactiveSDTool::Gather ( )
finaloverridevirtual

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 from SensitiveDetectorBase.

◆ Gather() [2/2]

virtual StatusCode SensitiveDetectorBase::Gather ( HitCollectionMap )
inlineoverridevirtualinherited

◆ 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.

124 {
125 #ifdef G4MULTITHREADED
126  // Get current thread-ID
127  const auto tid = std::this_thread::get_id();
128  // Retrieve it from the SD map
129  auto sdPair = m_sdThreadMap.find(tid);
130  if(sdPair == m_sdThreadMap.end()) return nullptr;
131  return sdPair->second;
132 #else
133  return m_SD;
134 #endif
135 }

◆ initialize()

StatusCode LArG4SDTool::initialize ( )
finaloverrideinherited

◆ initializeCalculators()

virtual StatusCode LArG4H62004InactiveSDTool::initializeCalculators ( )
finaloverridevirtual

Reimplemented from LArG4SDTool.

◆ initializeSD()

StatusCode LArG4H62004InactiveSDTool::initializeSD ( )
finaloverride

◆ makeSD()

G4VSensitiveDetector* LArG4SDTool::makeSD ( ) const
inlinefinaloverrideprotectedinherited

Definition at line 54 of file LArG4SDTool.h.

54 { return nullptr; }

◆ match()

bool LArG4SDTool::match ( const char *  first,
const char *  second 
) const
protectedinherited

Helper function for matching strings with wildcards.

◆ 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.

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

◆ 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.

138 {
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) );
143 #else
144  m_SD = sd;
145 #endif
146 }

◆ 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.

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

◆ setupAllSDs()

void LArG4SDTool::setupAllSDs ( const std::map< G4VSensitiveDetector *, std::vector< std::string > * > &  configuration) const
protectedinherited

Method actually doing the work to assign all of these SDs FIXME: this argument type is nasty:

  • non-const ptr to list of strings

◆ 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 MuonWallSDTool, AFP_SensitiveDetectorTool, AFP_SiDSensitiveDetectorTool, AFP_TDSensitiveDetectorTool, CaloCellContainerSDTool, and ALFA_SensitiveDetectorTool.

Definition at line 70 of file SensitiveDetectorBase.h.

70 { return StatusCode::SUCCESS; }

◆ SetupEvent() [2/2]

virtual StatusCode SensitiveDetectorBase::SetupEvent ( HitCollectionMap )
inlineoverridevirtualinherited

◆ setupHelpers() [1/2]

void LArG4SDTool::setupHelpers ( LArG4CalibSD ) const
inherited

Overload of the above method for calib SDs.

◆ setupHelpers() [2/2]

void LArG4SDTool::setupHelpers ( LArG4SimpleSD ) const
inherited

Helper method to pass the ID helper pointers to the SDs.

Member Data Documentation

◆ m_caloDmID

const CaloDM_ID* LArG4SDTool::m_caloDmID {nullptr}
protectedinherited

Definition at line 74 of file LArG4SDTool.h.

◆ m_doPID

Gaudi::Property<G4bool> LArG4SDTool::m_doPID {this, "ParticleID", false}
protectedinherited

Are we set up to run with PID hits?

Definition at line 57 of file LArG4SDTool.h.

◆ m_emecSD

LArG4CalibSD* LArG4H62004InactiveSDTool::m_emecSD {nullptr}
private

Definition at line 52 of file LArG4H62004InactiveSDTool.h.

◆ m_emecVolumes

Gaudi::Property<std::vector<std::string> > LArG4H62004InactiveSDTool::m_emecVolumes {this, "EMECVolumes"}
private

Definition at line 56 of file LArG4H62004InactiveSDTool.h.

◆ m_emepiwcalc

ServiceHandle<ILArCalibCalculatorSvc> LArG4H62004InactiveSDTool::m_emepiwcalc
private
Initial value:
{this, "EMECPosIWCalibrationCalculator"
, "EMECPosInnerWheelCalibrationCalculator"}

Definition at line 42 of file LArG4H62004InactiveSDTool.h.

◆ m_fcal1calc

ServiceHandle<ILArCalibCalculatorSvc> LArG4H62004InactiveSDTool::m_fcal1calc
private
Initial value:
{this, "FCAL1CalibCalculator"
, "LArFCAL1H62004CalibCalculator"}

Definition at line 46 of file LArG4H62004InactiveSDTool.h.

◆ m_fcal1SD

LArG4CalibSD* LArG4H62004InactiveSDTool::m_fcal1SD {nullptr}
private

Definition at line 54 of file LArG4H62004InactiveSDTool.h.

◆ m_fcal1Volumes

Gaudi::Property<std::vector<std::string> > LArG4H62004InactiveSDTool::m_fcal1Volumes {this, "FCAL1Volumes"}
private

Definition at line 58 of file LArG4H62004InactiveSDTool.h.

◆ m_fcal2calc

ServiceHandle<ILArCalibCalculatorSvc> LArG4H62004InactiveSDTool::m_fcal2calc
private
Initial value:
{this, "FCAL2CalibCalculator"
, "LArFCAL2H62004CalibCalculator"}

Definition at line 48 of file LArG4H62004InactiveSDTool.h.

◆ m_fcal2SD

LArG4CalibSD* LArG4H62004InactiveSDTool::m_fcal2SD {nullptr}
private

Definition at line 55 of file LArG4H62004InactiveSDTool.h.

◆ m_fcal2Volumes

Gaudi::Property<std::vector<std::string> > LArG4H62004InactiveSDTool::m_fcal2Volumes {this, "FCAL2Volumes"}
private

Definition at line 59 of file LArG4H62004InactiveSDTool.h.

◆ m_heccalc

ServiceHandle<ILArCalibCalculatorSvc> LArG4H62004InactiveSDTool::m_heccalc
private
Initial value:
{this, "HECWheelInactiveCalculator"
, "LocalCalibrationInactiveCalculator"}

Definition at line 44 of file LArG4H62004InactiveSDTool.h.

◆ m_hecSD

LArG4CalibSD* LArG4H62004InactiveSDTool::m_hecSD {nullptr}
private

Definition at line 53 of file LArG4H62004InactiveSDTool.h.

◆ m_hecVolumes

Gaudi::Property<std::vector<std::string> > LArG4H62004InactiveSDTool::m_hecVolumes {this, "HECVolumes"}
private

Definition at line 57 of file LArG4H62004InactiveSDTool.h.

◆ m_HitColl

SG::WriteHandle<CaloCalibrationHitContainer> LArG4H62004InactiveSDTool::m_HitColl
private

Definition at line 40 of file LArG4H62004InactiveSDTool.h.

◆ m_larEmID

const LArEM_ID* LArG4SDTool::m_larEmID {nullptr}
protectedinherited

Pointers to the identifier helpers.

Definition at line 71 of file LArG4SDTool.h.

◆ m_larFcalID

const LArFCAL_ID* LArG4SDTool::m_larFcalID {nullptr}
protectedinherited

Definition at line 72 of file LArG4SDTool.h.

◆ m_larHecID

const LArHEC_ID* LArG4SDTool::m_larHecID {nullptr}
protectedinherited

Definition at line 73 of file LArG4SDTool.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.

◆ 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.

◆ m_SD

G4VSensitiveDetector* SensitiveDetectorBase::m_SD {}
privateinherited

The sensitive detector to which this thing corresponds.

Definition at line 125 of file SensitiveDetectorBase.h.

◆ m_timeBinType

Gaudi::Property<std::string> LArG4SDTool::m_timeBinType {this, "TimeBinType", "Default"}
protectedinherited

What time binning type for regular hits?

Definition at line 59 of file LArG4SDTool.h.

◆ m_timeBinWidth

Gaudi::Property<float> LArG4SDTool::m_timeBinWidth {this, "TimeBinWidth", 2.5*CLHEP::ns}
protectedinherited

What time bin width for regular hits?

Definition at line 61 of file LArG4SDTool.h.

◆ m_useFrozenShowers

Gaudi::Property<G4bool> LArG4SDTool::m_useFrozenShowers {this, "UseFrozenShowers", false}
protectedinherited

Is there going to be a fast simulation coming into this SD?

Definition at line 63 of file LArG4SDTool.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.


The documentation for this class was generated from the following file:
SensitiveDetectorBase::SetupEvent
virtual StatusCode SetupEvent() override
Beginning of an athena event.
Definition: SensitiveDetectorBase.h:70
SensitiveDetectorBase::m_SD
G4VSensitiveDetector * m_SD
The sensitive detector to which this thing corresponds.
Definition: SensitiveDetectorBase.h:125
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
python.SystemOfUnits.second
float second
Definition: SystemOfUnits.py:135
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
python.selector.AtlRunQuerySelectorLhcOlc.sd
sd
Definition: AtlRunQuerySelectorLhcOlc.py:611
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
SensitiveDetectorBase::SetSensitiveDetector
void SetSensitiveDetector(G4LogicalVolume *, G4VSensitiveDetector *) const
Method stolen from G4VUserDetectorConstruction in G4 10.2.
Definition: SensitiveDetectorBase.cxx:178
SensitiveDetectorBase::matchStrings
static bool matchStrings(const char *first, const char *second)
Match two strings with wildcard support.
Definition: SensitiveDetectorBase.cxx:150
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
DeMoScan.first
bool first
Definition: DeMoScan.py:534
DEBUG
#define DEBUG
Definition: page_access.h:11
SensitiveDetectorBase::Gather
virtual StatusCode Gather() override
End of an athena event.
Definition: SensitiveDetectorBase.h:78
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:13