BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Ext_track Class Reference

#include <Ext_track.h>

Public Member Functions

 Ext_track ()
 Ext_track (const bool msgFlag, const bool myBFieldOn, const bool GeomOptimization, const int m_detVer, const bool UseMucKal, const int MucWindow)
 ~Ext_track ()
void Initialization (const bool aMsgFlag, const bool Bfield, const bool GeomOptimization, const bool aUseMucKal, const int aMucWindow)
bool Set (const Hep3Vector &xv3, const Hep3Vector &pv3, const HepSymMatrix &err, const std::string &particleName, const double pathInMDC, const double tofInMdc)
void TrackExtrapotation ()
void Dir (const int dir)
ExtSteppingActionGetStepAction ()

Detailed Description

Definition at line 40 of file Ext_track.h.

Constructor & Destructor Documentation

◆ Ext_track() [1/2]

Ext_track::Ext_track ( )

Definition at line 37 of file Ext_track.cxx.

38 : myMsgFlag( true )
39 , myBFieldOn( true )
40 , myGeomOptimization( true )
41 , m_dir( 0 )
42 , m_detVer( 1 )
43 , myUseMucKal( true )
44 , myMucWindow( 6 ) {
45 // BesSensitiveManager *besSensitiveManager = new BesSensitiveManager;
46 bes3DetectorConstruction = new ExtBesDetectorConstruction( myBFieldOn, m_detVer );
47 bes3WorldVolume = bes3DetectorConstruction->Construct();
48 extPhysicsList = new ExtPhysicsList;
49 extTrack = new G4Track;
50
51 // for geant4.8.1, move this line to Initialization, extSteppingAction = new
52 // ExtSteppingAction; extTrackingManager = new G4TrackingManager;
53
54 // RunManagerKernel for geant4.9.0
55 extRunManagerKernel = new G4RunManagerKernel;
56 extRunManagerKernel->DefineWorldVolume( bes3WorldVolume );
57 extRunManagerKernel->SetPhysics( extPhysicsList );
58 extTrackingManager = extRunManagerKernel->GetTrackingManager();
59}

◆ Ext_track() [2/2]

Ext_track::Ext_track ( const bool msgFlag,
const bool myBFieldOn,
const bool GeomOptimization,
const int m_detVer,
const bool UseMucKal,
const int MucWindow )

Definition at line 61 of file Ext_track.cxx.

63 : myMsgFlag( msgFlag )
64 , myBFieldOn( BFieldOn )
65 , myGeomOptimization( GeomOptimization )
66 , m_dir( 0 )
67 , myUseMucKal( aUseMucKal )
68 , myMucWindow( aMucWindow ) {
69 // BesSensitiveManager *besSensitiveManager = new BesSensitiveManager;
70 bes3DetectorConstruction = new ExtBesDetectorConstruction( myBFieldOn, m_detVer );
71 bes3WorldVolume = bes3DetectorConstruction->Construct();
72 extPhysicsList = new ExtPhysicsList;
73 extTrack = new G4Track;
74
75 // for geant4.8.1, move this line to Initialization, extSteppingAction = new
76 // ExtSteppingAction; extTrackingManager = new G4TrackingManager; RunManagerKernel for
77 // geant4.9.0
78 extRunManagerKernel = new G4RunManagerKernel;
79 extTrackingManager = extRunManagerKernel->GetTrackingManager();
80 extRunManagerKernel->DefineWorldVolume( bes3WorldVolume );
81 extRunManagerKernel->SetPhysics( extPhysicsList );
82 extTrackingManager = extRunManagerKernel->GetTrackingManager();
83}

◆ ~Ext_track()

Ext_track::~Ext_track ( )

Definition at line 87 of file Ext_track.cxx.

87 {
88 // cout<<"delete 1"<<endl;
89 // if(extRunManagerKernel) delete extRunManagerKernel;
90 // if(extTrackingManager) delete extTrackingManager;
91 // if(extSteppingAction) delete extSteppingAction;
92 // cout<<"delete 2"<<endl;
93 if ( extTrack ) delete extTrack;
94 // cout<<"delete 3"<<endl;
95 if ( bes3DetectorConstruction ) delete bes3DetectorConstruction;
96 // cout<<"delete 4"<<endl;
97 if ( extPhysicsList ) delete extPhysicsList;
98 // cout<<"delete 5"<<endl;
99
100 // open geometry for deletion
101 G4GeometryManager::GetInstance()->OpenGeometry();
102
103 // deletion of Geant4 kernel classes
104 G4SDManager* fSDM = G4SDManager::GetSDMpointerIfExist();
105 if ( fSDM ) { delete fSDM; }
106 // cout<<"delete 6"<<endl;
107}

Member Function Documentation

◆ Dir()

void Ext_track::Dir ( const int dir)
inline

Termination of the track extrapolation. Accessors for the parameters. Modifiers for the parameters. Modifiers for the track direction. (0/1)=(outgoing/incoming).

Definition at line 151 of file Ext_track.h.

151{ m_dir = dir; }

◆ GetStepAction()

ExtSteppingAction * Ext_track::GetStepAction ( )
inline

Definition at line 90 of file Ext_track.h.

90{ return extSteppingAction; };

◆ Initialization()

void Ext_track::Initialization ( const bool aMsgFlag,
const bool Bfield,
const bool GeomOptimization,
const bool aUseMucKal,
const int aMucWindow )

Definition at line 113 of file Ext_track.cxx.

115 {
116 myMsgFlag = aMsgFlag;
117 myGeomOptimization = GeomOptimization;
118 myBFieldOn = Bfield, myUseMucKal = aUseMucKal;
119 myMucWindow = aMucWindow;
120 // add for geant4.8.1
121 // G4ParticleTable::GetParticleTable()->SetReadiness();
122 // extPhysicsList->ConstructParticle();
123
124 if ( myMsgFlag ) cout << "Ext_track::Init will execute geant initialization." << endl;
125 // if(!GeometryInitialization()) cout << "Error in Ext_track::GeometryInitialization()" <<
126 // endl; PhysicsInitialization();
127 extRunManagerKernel->InitializePhysics();
128 G4cout << "dzy add output before extRunManagerKernel->RunInitialization()" << G4endl;
129 extRunManagerKernel->RunInitialization();
130 G4cout << "dzy add output after extRunManagerKernel->RunInitialization()" << G4endl;
131
132 extSteppingAction = new ExtSteppingAction;
133 extSteppingAction->SetMsgFlag( aMsgFlag );
134 extSteppingAction->SetMucKalFlag( aUseMucKal );
135 extSteppingAction->SetMucWindow( aMucWindow );
136 // Set extSteppingAction
137 extTrackingManager->SetUserAction( extSteppingAction );
138}

◆ Set()

bool Ext_track::Set ( const Hep3Vector & xv3,
const Hep3Vector & pv3,
const HepSymMatrix & err,
const std::string & particleName,
const double pathInMDC,
const double tofInMdc )

Setup the error skip list as a part of the initialization. errskip_list – Name of the error skip file. Print out the contents of the error skip list.

Definition at line 253 of file Ext_track.cxx.

255 {
256 if ( err.num_row() != 6 )
257 { // ?static const int Ndim_err=6, see Ext_errmx.h line58
258 std::cerr << "%ERROR at Ext_track::Set. Dimension of error matrix: " << err.num_row()
259 << " should be 6" << std::endl;
260 exit( 0 ); // TODO: Maybe exit(1) is more appropriate? [mrli, 2024-09-14]
261 }
262
263 m_vect[0] = xv3.x(); // ?set starting position,private data
264 m_vect[1] = xv3.y();
265 m_vect[2] = xv3.z();
266
267 // m_errskip_flag = 0;
268 // m_errskip_level = 0;
269
270 // Check the starting point is inside the setup.
271 if ( !CheckVertexInsideWorld( xv3 ) ) return false;
272
273 float p( pv3.mag() );
274 m_vect[3] = pv3.x() / p; //?set direction of momentum
275 m_vect[4] = pv3.y() / p;
276 m_vect[5] = pv3.z() / p;
277 m_vect[6] = p;
278
279 // check Particlename
280 if ( particleName != "e+" && particleName != "e-" && particleName != "mu+" &&
281 particleName != "mu-" && particleName != "pi+" && particleName != "pi-" &&
282 particleName != "kaon+" && particleName != "kaon-" && particleName != "proton" &&
283 particleName != "anti_proton" && particleName != "gamma" )
284 {
285 std::cerr << "Unknown or unconstructed Particle." << std::endl;
286 return false;
287 }
288
289 double mass;
290 double Q;
291
292 G4ParticleDefinition* particleDefinition =
293 G4ParticleTable::GetParticleTable()->FindParticle( particleName );
294 Q = particleDefinition->GetPDGCharge();
295 mass = particleDefinition->GetPDGMass();
296
297 Hep3Vector xv( m_vect[0], m_vect[1], m_vect[2] );
298 Hep3Vector pv( m_vect[3] * m_vect[6], m_vect[4] * m_vect[6], m_vect[5] * m_vect[6] );
299
300 m_xp_err.set_err( err, xv, pv, Q, mass ); // Set error matrix.
301
302 extSteppingAction->SetXpErrPointer( &m_xp_err );
303 extSteppingAction->SetInitialPath( pathInMDC );
304 extSteppingAction->SetInitialTof( tofInMdc );
305
306 double betaInMDC = p / sqrt( mass * mass + p * p ); // velocity
307 extSteppingAction->SetBetaInMDC( betaInMDC );
308 // double tofInMDC = pathInMDC/(betaInMDC*299.792458);
309 // if(myMsgFlag) cout<<"TOF in MDC: "<<tofInMDC<<endl;
310
311 // extSteppingAction->Reset();
312 extSteppingAction->MucReset();
313 // extTrack Initialization.
314
315 /* // comment 2008.04.07 due to memory loss
316 // Initialize a G4PrimaryParticle.
317 G4PrimaryParticle* primaryParticle = new
318 G4PrimaryParticle(particleDefinition,pv3.x(),pv3.y(),pv3.z());
319 primaryParticle->SetMass(mass);
320 primaryParticle->SetCharge(Q);
321
322 // Initialize a G4DynamicParticle.
323 // G4DynamicParticle* DP = new
324 G4DynamicParticle(particleDefinition,primaryParticle->GetMomentum());
325 // DP->SetPrimaryParticle(primaryParticle);
326 */
327 G4DynamicParticle* DP = new G4DynamicParticle( particleDefinition, pv );
328
329 delete extTrack; // add on 2008.04.07 to avoid memory loss
330 extTrack = new G4Track( DP, 0.0, xv3 );
331 // extTrack->CopyTrackInfo(G4Track::G4Track(DP,0.0,xv3));
332
333 // Reset navigator
334 Hep3Vector center( 0, 0, 0 );
335 G4Navigator* navigator =
336 G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();
337 navigator->LocateGlobalPointAndSetup( center, 0, false );
338
339 return true;
340}
double mass

◆ TrackExtrapotation()

void Ext_track::TrackExtrapotation ( )

Definition at line 356 of file Ext_track.cxx.

356{ extTrackingManager->ProcessOneTrack( extTrack ); }

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