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

Class to store G4 trajectory information. More...

#include <AtlasTrajectory.h>

Inheritance diagram for AtlasTrajectory:
Collaboration diagram for AtlasTrajectory:

Public Member Functions

 AtlasTrajectory (const G4Track *aTrack, int subDetVolLevel)
 Constructor. More...
 
void AppendStep (const G4Step *aStep)
 Overriden from G4 in order to do vertex analysis. More...
 
void DrawTrajectory (G4int) const
 Visualization stuff. More...
 

Private Attributes

int m_subDetVolLevel
 The level in the G4 volume hierarchy at which can we find the sub-detector name. More...
 

Detailed Description

Class to store G4 trajectory information.

NEEDS DOCUMENTATION

Definition at line 14 of file AtlasTrajectory.h.

Constructor & Destructor Documentation

◆ AtlasTrajectory()

AtlasTrajectory::AtlasTrajectory ( const G4Track *  aTrack,
int  subDetVolLevel 
)

Constructor.

Definition at line 19 of file AtlasTrajectory.cxx.

20  : G4Trajectory(track), m_subDetVolLevel(subDetVolLevel)
21 {}

Member Function Documentation

◆ AppendStep()

void AtlasTrajectory::AppendStep ( const G4Step *  aStep)

Overriden from G4 in order to do vertex analysis.

Definition at line 24 of file AtlasTrajectory.cxx.

25 {
26  // only use truth service if there are new any secondaries
27  const int numSecondaries = aStep->GetSecondaryInCurrentStep()->size();
28  // This method not available until G4 10.2
29  //const int numSecondaries = aStep->GetNumberOfSecondariesInCurrentStep();
30 
31  if (numSecondaries) {
32  // OK, there was an interation. look at the track, if it
33  // is not a secondary (i.e. we have a connected tree) we
34  // apply the MC truth machinery...
35  TrackHelper tHelper(aStep->GetTrack());
36  if (!tHelper.IsSecondary())
37  {
38  const TruthStrategyManager& sManager =
40  sManager.CreateTruthIncident(aStep, m_subDetVolLevel);
41  }
42  }
43 
44  // Call the base class
45  G4Trajectory::AppendStep(aStep);
46 }

◆ DrawTrajectory()

void AtlasTrajectory::DrawTrajectory ( G4int  i_mode = 0) const

Visualization stuff.

Definition at line 49 of file AtlasTrajectory.cxx.

53 {
54  // If i_mode>=0, draws a trajectory as a polyline (blue for
55  // positive, red for negative, green for neutral) and, if i_mode!=0,
56  // adds markers - yellow circles for step points and magenta squares
57  // for auxiliary points, if any - whose screen size in pixels is
58  // given by abs(i_mode)/1000. E.g: i_mode = 5000 gives easily
59  // visible markers.
60 
61  G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
62  if (!pVVisManager) return;
63 
64  const G4double markerSize = abs(i_mode)*0.001;
65  G4bool lineRequired (i_mode >= 0);
66  G4bool markersRequired (markerSize > 0.);
67 
68  G4Polyline trajectoryLine;
69  G4Polymarker stepPoints;
70  G4Polymarker auxiliaryPoints;
71 
72  for (G4int i = 0; i < GetPointEntries() ; i++)
73  {
74  G4VTrajectoryPoint* aTrajectoryPoint = GetPoint(i);
75  const std::vector<G4ThreeVector>* auxiliaries
76  = aTrajectoryPoint->GetAuxiliaryPoints();
77  if (auxiliaries)
78  {
79  for (size_t iAux = 0; iAux < auxiliaries->size(); ++iAux)
80  {
81  const G4ThreeVector pos((*auxiliaries)[iAux]);
82  if (lineRequired)
83  {
84  trajectoryLine.push_back(pos);
85  }
86  if (markersRequired)
87  {
88  auxiliaryPoints.push_back(pos);
89  }
90  }
91  }
92  const G4ThreeVector pos(aTrajectoryPoint->GetPosition());
93  if (lineRequired)
94  {
95  trajectoryLine.push_back(pos);
96  }
97  if (markersRequired)
98  {
99  stepPoints.push_back(pos);
100  }
101  }
102 
103  if (lineRequired)
104  {
105  int visScheme=TruthController::getTruthController()->
106  getVisualizationHelper()->trackVisualizationScheme();
107  G4Colour colour;
108  const G4double charge = GetCharge();
109  if (visScheme==1)
110  {
111  // Geant3-like color code - neutrals are dashed
112  const G4String pname=GetParticleName();
113  if (pname=="e+" || pname=="e-") colour = G4Colour(1.,1.,0.);
114  else if (pname=="mu+" || pname=="mu-") colour = G4Colour(0.,1.,0.);
115  else if (pname=="gamma") colour = G4Colour(0.,0.,1.);
116  else if (pname=="neutron") colour = G4Colour(0.,0.,0.);
117  else if (charge) colour = G4Colour(1.,0.,0.);
118  }
119  else if (visScheme==2)
120  {
121  if(charge>0.) colour = G4Colour(0.,0.,1.); // Blue = positive.
122  else if(charge<0.) colour = G4Colour(1.,0.,0.); // Red = negative.
123  else colour = G4Colour(0.,1.,0.); // Green = neutral.
124  }
125  else if (visScheme==3)
126  {
127  const G4String pname=GetParticleName();
128  if (pname=="e+" || pname=="e-") colour = G4Colour(1.,1.,0.);
129  else if (pname=="mu+" || pname=="mu-") colour = G4Colour(0.,0.,1.);
130  else if (pname=="gamma") colour = G4Colour(60./256.,79./256.,113./256.);
131  else if (pname=="neutron") colour = G4Colour(1.,1.,1.);
132  else if (pname=="pi-"|| pname=="pi+")
133  colour = G4Colour(250/256.,128/256.,114/256.);
134  else colour = G4Colour(176/256.,48/256.,96/256.);
135  }
136  G4VisAttributes trajectoryLineAttribs(colour);
137  if(visScheme==1 && charge==0)
138  {
139  G4VisAttributes::LineStyle style=G4VisAttributes::dotted;
140  trajectoryLineAttribs.SetLineStyle(style);
141  }
142  trajectoryLine.SetVisAttributes(&trajectoryLineAttribs);
143  pVVisManager->Draw(trajectoryLine);
144  }
145  if (markersRequired)
146  {
147  auxiliaryPoints.SetMarkerType(G4Polymarker::squares);
148  auxiliaryPoints.SetScreenSize(markerSize);
149  auxiliaryPoints.SetFillStyle(G4VMarker::filled);
150  G4VisAttributes auxiliaryPointsAttribs(G4Colour(0.,1.,1.)); // Magenta
151  auxiliaryPoints.SetVisAttributes(&auxiliaryPointsAttribs);
152  pVVisManager->Draw(auxiliaryPoints);
153 
154  stepPoints.SetMarkerType(G4Polymarker::circles);
155  stepPoints.SetScreenSize(markerSize);
156  stepPoints.SetFillStyle(G4VMarker::filled);
157  G4VisAttributes stepPointsAttribs(G4Colour(1.,1.,0.)); // Yellow.
158  stepPoints.SetVisAttributes(&stepPointsAttribs);
159  pVVisManager->Draw(stepPoints);
160  }
161 }

Member Data Documentation

◆ m_subDetVolLevel

int AtlasTrajectory::m_subDetVolLevel
private

The level in the G4 volume hierarchy at which can we find the sub-detector name.

Definition at line 36 of file AtlasTrajectory.h.


The documentation for this class was generated from the following files:
Merge_LAr_blobs.filled
list filled
Definition: Merge_LAr_blobs.py:43
TruthStrategyManager::CreateTruthIncident
bool CreateTruthIncident(const G4Step *, int subDetVolLevel) const
Returns true if any of the truth strategies return true.
Definition: TruthStrategyManager.cxx:64
AtlasTrajectory::m_subDetVolLevel
int m_subDetVolLevel
The level in the G4 volume hierarchy at which can we find the sub-detector name.
Definition: AtlasTrajectory.h:36
TruthStrategyManager::GetStrategyManager
static const TruthStrategyManager & GetStrategyManager()
Retrieve the (const) singleton instance.
Definition: TruthStrategyManager.cxx:42
TrackHelper
Definition: TrackHelper.h:14
lumiFormat.i
int i
Definition: lumiFormat.py:85
python.style.style
def style()
Definition: style.py:15
TruthStrategyManager
Singleton class for creating truth incidents.
Definition: TruthStrategyManager.h:23
charge
double charge(const T &p)
Definition: AtlasPID.h:538
python.DetStatusLib.colour
def colour(code)
Definition: DetStatusLib.py:15
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
TruthController::getTruthController
static const TruthController * getTruthController()
Definition: TruthController.cxx:8
xAOD::track
@ track
Definition: TrackingPrimitives.h:512