ATLAS Offline Software
Classes | Public Member Functions | Private Attributes | List of all members
G4UA::CosmicPerigeeAction Class Referencefinal

NEEDS DOCUMENTATION. More...

#include <CosmicPerigeeAction.h>

Inheritance diagram for G4UA::CosmicPerigeeAction:
Collaboration diagram for G4UA::CosmicPerigeeAction:

Classes

struct  Config
 

Public Member Functions

 CosmicPerigeeAction (const Config &config)
 
virtual void UserSteppingAction (const G4Step *) override
 
virtual void EndOfEventAction (const G4Event *) override
 
virtual void BeginOfEventAction (const G4Event *) override
 
virtual void PreUserTrackingAction (const G4Track *) override
 

Private Attributes

Config m_config
 Configuration options. More...
 
SG::WriteHandle< TrackRecordCollectionm_trackRecordCollection
 Output track track record. More...
 
bool m_hasBeenSaved
 State members. More...
 
double m_idZ
 
double m_idR
 

Detailed Description

NEEDS DOCUMENTATION.

Definition at line 21 of file CosmicPerigeeAction.h.

Constructor & Destructor Documentation

◆ CosmicPerigeeAction()

G4UA::CosmicPerigeeAction::CosmicPerigeeAction ( const Config config)

Definition at line 20 of file CosmicPerigeeAction.cxx.

21  : m_config(config)
22  , m_trackRecordCollection("CosmicPerigee")
23  , m_hasBeenSaved(false)
24  , m_idZ(3490.) // ID maximum Z coordiate by default.
25  , m_idR(1150.) // ID outer radius by default.
26  {
27  }

Member Function Documentation

◆ BeginOfEventAction()

void G4UA::CosmicPerigeeAction::BeginOfEventAction ( const G4Event *  )
overridevirtual

Definition at line 30 of file CosmicPerigeeAction.cxx.

31  {
32  if (!m_trackRecordCollection.isValid()) {
33  m_trackRecordCollection = std::make_unique<TrackRecordCollection>(
35  }
36 
37  //FIXME need a nice way of getting the maximum size of the ID envelope in R and Z.
38  //EnvelopeGeometryManager *gm=EnvelopeGeometryManager::GetGeometryManager();
39  //m_idR = gm->IdetOuterRadius();
40  //m_idZ = gm->IdetMaxZ();
41  }

◆ EndOfEventAction()

void G4UA::CosmicPerigeeAction::EndOfEventAction ( const G4Event *  )
overridevirtual

Definition at line 44 of file CosmicPerigeeAction.cxx.

45  {
46  }

◆ PreUserTrackingAction()

void G4UA::CosmicPerigeeAction::PreUserTrackingAction ( const G4Track *  )
overridevirtual

Definition at line 49 of file CosmicPerigeeAction.cxx.

50  {
51  // reset the field
52  m_hasBeenSaved = false;
53  }

◆ UserSteppingAction()

void G4UA::CosmicPerigeeAction::UserSteppingAction ( const G4Step *  aStep)
overridevirtual

Definition at line 56 of file CosmicPerigeeAction.cxx.

57  {
58  // See if this is a new track
59  if (aStep->GetPreStepPoint()->GetStepStatus() == fUndefined)
60  m_hasBeenSaved = false;
61 
62  // See if we've already saved it
63  if (m_hasBeenSaved) return;
64 
65  // Only save muons or tracks in the ID
66  if (aStep->GetTrack()->GetDefinition() != G4MuonPlus::Definition() &&
67  aStep->GetTrack()->GetDefinition() != G4MuonMinus::Definition() &&
68  ( aStep->GetPostStepPoint()->GetPosition().rho() > m_idR ||
69  aStep->GetPostStepPoint()->GetPosition().z() > m_idZ ||
70  aStep->GetPostStepPoint()->GetPosition().z() < -m_idZ ) ){
71  // Both not a muon and not in the ID
72  return;
73  }
74 
75  // Check momentum
76  if (aStep->GetTrack()->GetMomentum().mag() < m_config.pMinPrimary) return;
77 
78  // First order approximation of the answer to "is this the perigee"
79  // if it is now moving away from the perigee and has not been saved, save it
80  // That is true if mom dot pos > 0
81  if ( aStep->GetTrack()->GetMomentum().x() * aStep->GetPostStepPoint()->GetPosition().x() +
82  aStep->GetTrack()->GetMomentum().y() * aStep->GetPostStepPoint()->GetPosition().y() < 0) return;
83 
84  // Save the vertex...
85  m_hasBeenSaved = true;
86 
87  // Decide whether to save the prestep or poststep point
88  // - which one is closer to Perigee?
89  G4StepPoint* preStep = aStep->GetPreStepPoint();
90  G4StepPoint* postStep = aStep->GetPostStepPoint();
91  G4StepPoint* theStep = preStep;
92  if ( fabs( preStep->GetMomentumDirection().x() * preStep->GetPosition().x() +
93  preStep->GetMomentumDirection().y() * preStep->GetPosition().y() ) >
94  fabs( postStep->GetMomentumDirection().x() * postStep->GetPosition().x() +
95  postStep->GetMomentumDirection().y() * postStep->GetPosition().y() ) )
96  {
97  // Using the post step point
98  theStep = postStep;
99  }
100 
101  // Could the following code be optimized?
102  // There seems to be a bit of object copying.
103  int pdgcode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
104  double ener = theStep->GetTotalEnergy();
105  G4ThreeVector pos = theStep->GetPosition();
106  G4ThreeVector mom = theStep->GetMomentum();
107  double time = theStep->GetGlobalTime();
108  G4VPhysicalVolume *preVol = theStep->GetPhysicalVolume();
109 
110  if (aStep->GetTrack()->GetDefinition() == G4Geantino::Definition() ) pdgcode=999;
111  if (aStep->GetTrack()->GetDefinition() == G4ChargedGeantino::Definition() ) pdgcode=998;
112 
113  // Create the TimedTrackRecord
114  TrackHelper trHelp(aStep->GetTrack());
115  const int barcode = trHelp.GetBarcode(); // FIXME barcode based
116  const int id = trHelp.GetUniqueID();
117  const int status = trHelp.GetStatus();
118  m_trackRecordCollection->Emplace(
119  pdgcode,
120  status,
121  ener,
122  mom,
123  pos,
124  time,
125  barcode, // FIXME barcode based
126  id,
127  preVol->GetName());
128  }

Member Data Documentation

◆ m_config

Config G4UA::CosmicPerigeeAction::m_config
private

Configuration options.

Definition at line 43 of file CosmicPerigeeAction.h.

◆ m_hasBeenSaved

bool G4UA::CosmicPerigeeAction::m_hasBeenSaved
private

State members.

Definition at line 49 of file CosmicPerigeeAction.h.

◆ m_idR

double G4UA::CosmicPerigeeAction::m_idR
private

Definition at line 51 of file CosmicPerigeeAction.h.

◆ m_idZ

double G4UA::CosmicPerigeeAction::m_idZ
private

Definition at line 50 of file CosmicPerigeeAction.h.

◆ m_trackRecordCollection

SG::WriteHandle<TrackRecordCollection> G4UA::CosmicPerigeeAction::m_trackRecordCollection
private

Output track track record.

Definition at line 46 of file CosmicPerigeeAction.h.


The documentation for this class was generated from the following files:
G4UA::CosmicPerigeeAction::m_idZ
double m_idZ
Definition: CosmicPerigeeAction.h:50
AtlasDetDescr::fUndefined
@ fUndefined
Definition: AtlasDetTechnology.h:30
G4UA::CosmicPerigeeAction::m_idR
double m_idR
Definition: CosmicPerigeeAction.h:51
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
G4UA::CosmicPerigeeAction::m_config
Config m_config
Configuration options.
Definition: CosmicPerigeeAction.h:43
TrackHelper
Definition: TrackHelper.h:14
ParticleGun_EoverP_Config.mom
mom
Definition: ParticleGun_EoverP_Config.py:63
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
G4UA::CosmicPerigeeAction::Config::pMinPrimary
float pMinPrimary
Definition: CosmicPerigeeAction.h:30
G4UA::CosmicPerigeeAction::m_trackRecordCollection
SG::WriteHandle< TrackRecordCollection > m_trackRecordCollection
Output track track record.
Definition: CosmicPerigeeAction.h:46
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
G4UA::CosmicPerigeeAction::m_hasBeenSaved
bool m_hasBeenSaved
State members.
Definition: CosmicPerigeeAction.h:49
merge.status
status
Definition: merge.py:17