Geant4  10.02.p03
CexmcTrackPoints Class Reference

#include <CexmcTrackPoints.hh>

Inheritance diagram for CexmcTrackPoints:
Collaboration diagram for CexmcTrackPoints:

Public Member Functions

 CexmcTrackPoints (const G4String &name)
 
void Initialize (G4HCofThisEvent *hcOfThisEvent)
 
void EndOfEvent (G4HCofThisEvent *hcOfThisEvent)
 
void DrawAll (void)
 
void PrintAll (void)
 
void clear (void)
 
- Public Member Functions inherited from CexmcPrimitiveScorer
 CexmcPrimitiveScorer (const G4String &name)
 
virtual ~CexmcPrimitiveScorer ()
 
void InitializeMessenger (void)
 
- Public Member Functions inherited from G4VPrimitiveScorer
 G4VPrimitiveScorer (G4String name, G4int depth=0)
 
virtual ~G4VPrimitiveScorer ()
 
G4int GetCollectionID (G4int)
 
void SetUnit (const G4String &unit)
 
const G4String & GetUnit () const
 
G4double GetUnitValue () const
 
void SetMultiFunctionalDetector (G4MultiFunctionalDetector *d)
 
G4MultiFunctionalDetector * GetMultiFunctionalDetector () const
 
G4String GetName () const
 
void SetFilter (G4VSDFilter *f)
 
G4VSDFilter * GetFilter () const
 
void SetVerboseLevel (G4int vl)
 
G4int GetVerboseLevel () const
 
void SetNijk (G4int i, G4int j, G4int k)
 

Protected Member Functions

G4int GetTrackId (G4Step *step)
 
G4int GetIndex (G4Step *step)
 
G4bool ProcessHits (G4Step *step, G4TouchableHistory *tHistory)
 
- Protected Member Functions inherited from CexmcPrimitiveScorer
void PrintHeader (G4int nmbOfEntries) const
 
- Protected Member Functions inherited from G4VPrimitiveScorer
void CheckAndSetUnit (const G4String &unit, const G4String &category)
 

Protected Attributes

CexmcTrackPointsCollection * eventMap
 
- Protected Attributes inherited from G4VPrimitiveScorer
G4String primitiveName
 
G4MultiFunctionalDetector * detector
 
G4VSDFilter * filter
 
G4int verboseLevel
 
G4int indexDepth
 
G4String unitName
 
G4double unitValue
 
G4int fNi
 
G4int fNj
 
G4int fNk
 

Private Attributes

G4int hcId
 

Detailed Description

Definition at line 61 of file CexmcTrackPoints.hh.

Constructor & Destructor Documentation

◆ CexmcTrackPoints()

CexmcTrackPoints::CexmcTrackPoints ( const G4String &  name)
explicit

Definition at line 51 of file CexmcTrackPoints.cc.

51  :
52  CexmcPrimitiveScorer( name ), hcId( -1 )
53 {
54 }
CexmcPrimitiveScorer(const G4String &name)

Member Function Documentation

◆ clear()

void CexmcTrackPoints::clear ( void  )
virtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 134 of file CexmcTrackPoints.cc.

135 {
136  eventMap->clear();
137 }
void clear()
Definition: G4THitsMap.hh:209
CexmcTrackPointsCollection * eventMap
Here is the call graph for this function:

◆ DrawAll()

void CexmcTrackPoints::DrawAll ( void  )
virtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 140 of file CexmcTrackPoints.cc.

141 {
142 }

◆ EndOfEvent()

void CexmcTrackPoints::EndOfEvent ( G4HCofThisEvent *  hcOfThisEvent)
virtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 127 of file CexmcTrackPoints.cc.

128 {
129  if ( GetVerboseLevel() > 0 )
130  PrintAll();
131 }
G4int GetVerboseLevel() const
Here is the call graph for this function:

◆ GetIndex()

G4int CexmcTrackPoints::GetIndex ( G4Step *  step)
protectedvirtual

Reimplemented from G4VPrimitiveScorer.

Reimplemented in CexmcTrackPointsInLeftRightSet, and CexmcTrackPointsInCalorimeter.

Definition at line 73 of file CexmcTrackPoints.cc.

74 {
75  return GetTrackId( step );
76 }
G4int GetTrackId(G4Step *step)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetTrackId()

G4int CexmcTrackPoints::GetTrackId ( G4Step *  step)
protected

Definition at line 57 of file CexmcTrackPoints.cc.

58 {
59  /* NB: trackInfo for these tracks shall always exist as far as
60  * track points filter decline tracks without it */
61  CexmcTrackInfo * trackInfo( static_cast< CexmcTrackInfo * >(
62  step->GetTrack()->GetUserInformation() ) );
63 
64  G4int ret( trackInfo->GetTrackType() );
65 
67  ret += trackInfo->GetCopyNumber();
68 
69  return ret;
70 }
int G4int
Definition: G4Types.hh:78
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Initialize()

void CexmcTrackPoints::Initialize ( G4HCofThisEvent *  hcOfThisEvent)
virtual

Reimplemented from G4VPrimitiveScorer.

Definition at line 115 of file CexmcTrackPoints.cc.

116 {
118  primitiveName );
119 
120  if ( hcId < 0 )
121  hcId = GetCollectionID( 0 );
122 
123  hcOfEvent->AddHitsCollection( hcId, eventMap );
124 }
CexmcTrackPointsCollection * eventMap
G4THitsMap< CexmcTrackPointInfo > CexmcTrackPointsCollection
G4int GetCollectionID(G4int)
G4MultiFunctionalDetector * detector
Here is the call graph for this function:

◆ PrintAll()

void CexmcTrackPoints::PrintAll ( void  )
virtual

Reimplemented from G4VPrimitiveScorer.

Reimplemented in CexmcTrackPointsInLeftRightSet, and CexmcTrackPointsInCalorimeter.

Definition at line 145 of file CexmcTrackPoints.cc.

146 {
147  G4int nmbOfEntries( eventMap->entries() );
148 
149  if ( nmbOfEntries == 0 )
150  return;
151 
152  PrintHeader( nmbOfEntries );
153 
154  for ( CexmcTrackPointsCollectionData::iterator
155  itr( eventMap->GetMap()->begin() );
156  itr != eventMap->GetMap()->end(); ++itr )
157  {
158  G4cout << " track id " << itr->first << G4endl;
159  G4cout << " , position: " <<
160  G4BestUnit( itr->second->positionLocal, "Length" ) << G4endl;
161  G4cout << " , direction: " <<
162  itr->second->directionLocal << G4endl;
163  G4cout << " , momentum: " <<
164  G4BestUnit( itr->second->momentumAmp, "Energy" ) << G4endl;
165  G4cout << " , particle: " <<
166  itr->second->particle->GetParticleName() << G4endl;
167  }
168 }
std::map< G4int, T * > * GetMap() const
Definition: G4THitsMap.hh:68
CexmcTrackPointsCollection * eventMap
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
G4int entries() const
Definition: G4THitsMap.hh:79
#define G4endl
Definition: G4ios.hh:61
void PrintHeader(G4int nmbOfEntries) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ProcessHits()

G4bool CexmcTrackPoints::ProcessHits ( G4Step *  step,
G4TouchableHistory *  tHistory 
)
protectedvirtual

Implements G4VPrimitiveScorer.

Definition at line 79 of file CexmcTrackPoints.cc.

80 {
81  G4int index( GetIndex( step ) );
82 
83  if ( ( *eventMap )[ index ] )
84  return false;
85 
86  G4Track * track( step->GetTrack() );
87  G4ParticleDefinition * particle( track->GetDefinition() );
88  CexmcTrackType trackType( CexmcInsipidTrack );
89 
90  G4StepPoint * preStepPoint( step->GetPreStepPoint() );
91  G4ThreeVector position( preStepPoint->GetPosition() );
92  G4ThreeVector direction( preStepPoint->GetMomentumDirection() );
93 
94  const G4AffineTransform & transform( preStepPoint->GetTouchable()->
95  GetHistory()->GetTopTransform() );
96 
97  CexmcTrackInfo * trackInfo( static_cast< CexmcTrackInfo * >(
98  track->GetUserInformation() ) );
99  trackType = trackInfo->GetTrackType();
100 
101  CexmcTrackPointInfo trackPointInfo( transform.TransformPoint( position ),
102  position,
103  transform.TransformAxis( direction ),
104  direction,
105  preStepPoint->GetMomentum().mag(),
106  particle, track->GetTrackID(),
107  trackType );
108 
109  eventMap->set( index, trackPointInfo );
110 
111  return true;
112 }
Int_t index
CexmcTrackPointsCollection * eventMap
int G4int
Definition: G4Types.hh:78
G4int set(const G4int &key, T *&aHit) const
Definition: G4THitsMap.hh:165
#define position
Definition: xmlparse.cc:622
G4int GetIndex(G4Step *step)
CexmcTrackType
Definition: CexmcCommon.hh:115
Here is the call graph for this function:

Member Data Documentation

◆ eventMap

CexmcTrackPointsCollection* CexmcTrackPoints::eventMap
protected

Definition at line 85 of file CexmcTrackPoints.hh.

◆ hcId

G4int CexmcTrackPoints::hcId
private

Definition at line 88 of file CexmcTrackPoints.hh.


The documentation for this class was generated from the following files: