File indexing completed on 2025-01-31 09:21:54
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045 #include <G4Step.hh>
0046 #include <G4StepPoint.hh>
0047 #include <G4VTouchable.hh>
0048 #include <G4VPhysicalVolume.hh>
0049 #include <G4UnitsTable.hh>
0050 #include "CexmcTrackPointsInLeftRightSet.hh"
0051 #include "CexmcSetup.hh"
0052
0053
0054 CexmcTrackPointsInLeftRightSet::CexmcTrackPointsInLeftRightSet(
0055 const G4String & name, const CexmcSetup * setup_ ) :
0056 CexmcTrackPoints( name ), setup( setup_ )
0057 {
0058 }
0059
0060
0061 G4int CexmcTrackPointsInLeftRightSet::GetIndex( G4Step * step )
0062 {
0063 G4int ret( GetTrackId( step ) );
0064 G4StepPoint * preStep( step->GetPreStepPoint() );
0065 G4VPhysicalVolume * pVolume( preStep->GetPhysicalVolume() );
0066
0067 if ( setup->IsRightDetector( pVolume ) )
0068 ret |= 1 << leftRightBitsOffset;
0069
0070 return ret;
0071 }
0072
0073
0074 void CexmcTrackPointsInLeftRightSet::PrintAll( void )
0075 {
0076 G4int nmbOfEntries( eventMap->entries() );
0077
0078 if ( nmbOfEntries == 0 )
0079 return;
0080
0081 PrintHeader( nmbOfEntries );
0082
0083 for ( CexmcTrackPointsCollectionData::iterator
0084 itr( eventMap->GetMap()->begin() );
0085 itr != eventMap->GetMap()->end(); ++itr )
0086 {
0087 G4bool isRightDetector( itr->first >> leftRightBitsOffset );
0088 const G4String detectorSide( isRightDetector ? "right" : "left" );
0089 G4int trackId( itr->first &
0090 ( ( 1 << ( leftRightBitsOffset - 1 ) ) |
0091 ( ( 1 << ( leftRightBitsOffset - 1 ) ) - 1 ) ) );
0092 G4cout << " " << detectorSide << " detector" << G4endl;
0093 G4cout << " , track id " << trackId << G4endl;
0094 G4cout << " , position: " <<
0095 G4BestUnit( itr->second->positionLocal, "Length" ) << G4endl;
0096 G4cout << " , direction: " <<
0097 itr->second->directionLocal << G4endl;
0098 G4cout << " , momentum: " <<
0099 G4BestUnit( itr->second->momentumAmp, "Energy" ) << G4endl;
0100 G4cout << " , particle: " <<
0101 itr->second->particle->GetParticleName() << G4endl;
0102 }
0103 }
0104