ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
RecordingEnvelope Class Reference

Responsible for finding the G4LogicalVolume pointer for each recording envelope and for creating and filling the corresponding TrackRecordCollection. More...

#include <RecordingEnvelope.h>

Collaboration diagram for RecordingEnvelope:

Public Member Functions

 RecordingEnvelope (const std::string &envelopeVolumeName, const std::string &trackRecordCollectionName)
 Constructor. More...
 
 ~RecordingEnvelope ()
 Destructor. More...
 
bool Initialize ()
 Finds the pointer to the G4LogicalVolume called m_envelopeVolumeName and the number of levels beneath the world volume that it lies. More...
 
void BeginOfEvent (TrackRecordCollection *)
 Called at the start of each G4 event. More...
 
int GetLevel () const
 Returns the number of levels beneath the world volume that the G4LogicalVolume associated with this recording envelope lies. More...
 
const std::string & GetVolumeName () const
 Returns the name of the recording envelope volume. More...
 
const G4LogicalVolume * GetLogicalVolume () const
 Returns the pointer to the G4LogicalVolume used by this recording envelope. More...
 
const std::string & GetTrackRecordCollectionName () const
 Returns the name of the TrackRecordCollection to which tracks crossing this recording envelope should be written. More...
 
void AddTrackRecord (const G4Step *aStep)
 Add a TrackRecord to the TrackRecordCollection owned by this recording envelope based on the information in aStep. More...
 

Private Member Functions

bool checkDaughters (const G4LogicalVolume *possibleParent, const G4VPhysicalVolume *thePhysicalVolume, int &level) const
 Recursively called method used to hunt for the G4LogicalVolume associated with this recording envelope by the Initialize method. More...
 

Private Attributes

int m_level
 The number of levels beneath the world that the G4LogicalVolume called m_envelopeVolumeName lies. More...
 
G4LogicalVolume * m_logicalVolume
 Pointer to the G4LogicalVolume used by this recording envelope. More...
 
const std::string m_envelopeVolumeName
 Name of the G4LogicalVolume used by this recording envelope. More...
 
TrackRecordCollectionm_trackRecordCollection {}
 TrackRecordCollection used by this envelope. More...
 
std::string m_trackRecordCollectionName
 

Detailed Description

Responsible for finding the G4LogicalVolume pointer for each recording envelope and for creating and filling the corresponding TrackRecordCollection.

Definition at line 23 of file RecordingEnvelope.h.

Constructor & Destructor Documentation

◆ RecordingEnvelope()

RecordingEnvelope::RecordingEnvelope ( const std::string &  envelopeVolumeName,
const std::string &  trackRecordCollectionName 
)

Constructor.

Definition at line 20 of file RecordingEnvelope.cxx.

20  :
21  m_level(-1),
22  m_logicalVolume(nullptr),
23  m_envelopeVolumeName(envelopeVolumeName),
24  m_trackRecordCollectionName(trackRecordCollectionName)
25 {
26 
27 }

◆ ~RecordingEnvelope()

RecordingEnvelope::~RecordingEnvelope ( )

Destructor.

Definition at line 29 of file RecordingEnvelope.cxx.

30 {
31 
32 }

Member Function Documentation

◆ AddTrackRecord()

void RecordingEnvelope::AddTrackRecord ( const G4Step *  aStep)

Add a TrackRecord to the TrackRecordCollection owned by this recording envelope based on the information in aStep.

Definition at line 68 of file RecordingEnvelope.cxx.

69 {
70  const std::string pname = aStep->GetTrack()->GetDefinition()->GetParticleName();
71  const int pdgcode = (pname=="geantino") ? 999 : aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
72  TrackHelper trHelp(aStep->GetTrack());
73  const int barcode = trHelp.GetBarcode();
74  const int status = trHelp.GetStatus();
75  const int id = trHelp.GetUniqueID();
76 
77  G4StepPoint *postStep=aStep->GetPostStepPoint();
78  G4ThreeVector pos=postStep->GetPosition();
79  G4ThreeVector mom=postStep->GetMomentum();
80  const double ener=postStep->GetTotalEnergy();
81  const double time=postStep->GetGlobalTime();
82 
83  G4StepPoint *preStep=aStep->GetPreStepPoint();
84  G4VPhysicalVolume *preVol=preStep->GetPhysicalVolume();
85 
86  m_trackRecordCollection->Emplace(pdgcode,status,ener,mom,pos,time,barcode,id,preVol->GetName());
87 }

◆ BeginOfEvent()

void RecordingEnvelope::BeginOfEvent ( TrackRecordCollection trackRecordCollection)

Called at the start of each G4 event.

Recreates the TrackRecordCollection if necessary.

Definition at line 64 of file RecordingEnvelope.cxx.

65 {
66  m_trackRecordCollection = trackRecordCollection;
67 }

◆ checkDaughters()

bool RecordingEnvelope::checkDaughters ( const G4LogicalVolume *  possibleParent,
const G4VPhysicalVolume *  thePhysicalVolume,
int &  level 
) const
private

Recursively called method used to hunt for the G4LogicalVolume associated with this recording envelope by the Initialize method.

Definition at line 34 of file RecordingEnvelope.cxx.

35 {
36  if (possibleParent->IsDaughter(thePhysicalVolume))
37  {
38  ++level;
39  return true;
40  }
41  // Otherwise Loop over the daughters
42  const G4int nDaughters(possibleParent->GetNoDaughters());
43  for(G4int daughter(0); daughter<nDaughters; ++daughter)
44  {
45  const G4VPhysicalVolume* daughterPhysVol = possibleParent->GetDaughter(daughter);
46  const G4LogicalVolume* daughterLogVol = daughterPhysVol->GetLogicalVolume();
47  if (this->checkDaughters(daughterLogVol, thePhysicalVolume,level))
48  {
49  ++level;
50  return true;
51  }
52  }
53  return false;
54 }

◆ GetLevel()

int RecordingEnvelope::GetLevel ( ) const
inline

Returns the number of levels beneath the world volume that the G4LogicalVolume associated with this recording envelope lies.

Definition at line 98 of file RecordingEnvelope.h.

99 {
100  return m_level;
101 }

◆ GetLogicalVolume()

const G4LogicalVolume * RecordingEnvelope::GetLogicalVolume ( ) const
inline

Returns the pointer to the G4LogicalVolume used by this recording envelope.

Definition at line 88 of file RecordingEnvelope.h.

89 {
90  return m_logicalVolume;
91 }

◆ GetTrackRecordCollectionName()

const std::string & RecordingEnvelope::GetTrackRecordCollectionName ( ) const
inline

Returns the name of the TrackRecordCollection to which tracks crossing this recording envelope should be written.

Definition at line 93 of file RecordingEnvelope.h.

94 {
96 }

◆ GetVolumeName()

const std::string & RecordingEnvelope::GetVolumeName ( ) const
inline

Returns the name of the recording envelope volume.

Definition at line 83 of file RecordingEnvelope.h.

84 {
85  return m_envelopeVolumeName;
86 }

◆ Initialize()

bool RecordingEnvelope::Initialize ( )

Finds the pointer to the G4LogicalVolume called m_envelopeVolumeName and the number of levels beneath the world volume that it lies.

Definition at line 55 of file RecordingEnvelope.cxx.

56 {
57  const G4VPhysicalVolume *thePhysicalVolume = G4PhysicalVolumeStore::GetInstance()->GetVolume(m_envelopeVolumeName,false);
58  m_logicalVolume=thePhysicalVolume->GetLogicalVolume();
59  const G4LogicalVolume * logicalWorld = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume()->GetLogicalVolume();
60  m_level=0;
61  return this->checkDaughters(logicalWorld, thePhysicalVolume,m_level);
62 }

Member Data Documentation

◆ m_envelopeVolumeName

const std::string RecordingEnvelope::m_envelopeVolumeName
private

Name of the G4LogicalVolume used by this recording envelope.

Definition at line 76 of file RecordingEnvelope.h.

◆ m_level

int RecordingEnvelope::m_level
private

The number of levels beneath the world that the G4LogicalVolume called m_envelopeVolumeName lies.

Definition at line 68 of file RecordingEnvelope.h.

◆ m_logicalVolume

G4LogicalVolume* RecordingEnvelope::m_logicalVolume
private

Pointer to the G4LogicalVolume used by this recording envelope.

Definition at line 73 of file RecordingEnvelope.h.

◆ m_trackRecordCollection

TrackRecordCollection* RecordingEnvelope::m_trackRecordCollection {}
private

TrackRecordCollection used by this envelope.

Definition at line 79 of file RecordingEnvelope.h.

◆ m_trackRecordCollectionName

std::string RecordingEnvelope::m_trackRecordCollectionName
private

Definition at line 80 of file RecordingEnvelope.h.


The documentation for this class was generated from the following files:
RecordingEnvelope::m_level
int m_level
The number of levels beneath the world that the G4LogicalVolume called m_envelopeVolumeName lies.
Definition: RecordingEnvelope.h:68
RecordingEnvelope::m_trackRecordCollection
TrackRecordCollection * m_trackRecordCollection
TrackRecordCollection used by this envelope.
Definition: RecordingEnvelope.h:79
RecordingEnvelope::m_trackRecordCollectionName
std::string m_trackRecordCollectionName
Definition: RecordingEnvelope.h:80
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
AtlasHitsVector::Emplace
void Emplace(Args &&... args)
Definition: AtlasHitsVector.h:80
TrackHelper
Definition: TrackHelper.h:16
ParticleGun_EoverP_Config.mom
mom
Definition: ParticleGun_EoverP_Config.py:63
RecordingEnvelope::checkDaughters
bool checkDaughters(const G4LogicalVolume *possibleParent, const G4VPhysicalVolume *thePhysicalVolume, int &level) const
Recursively called method used to hunt for the G4LogicalVolume associated with this recording envelop...
Definition: RecordingEnvelope.cxx:34
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
RecordingEnvelope::m_logicalVolume
G4LogicalVolume * m_logicalVolume
Pointer to the G4LogicalVolume used by this recording envelope.
Definition: RecordingEnvelope.h:73
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:16
RecordingEnvelope::m_envelopeVolumeName
const std::string m_envelopeVolumeName
Name of the G4LogicalVolume used by this recording envelope.
Definition: RecordingEnvelope.h:76
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
merge.status
status
Definition: merge.py:16