BOSS 7.1.1
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 36 of file Ext_track.cxx.

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

◆ 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 54 of file Ext_track.cxx.

54 : myMsgFlag(msgFlag),myBFieldOn(BFieldOn),myGeomOptimization(GeomOptimization),m_dir(0),myUseMucKal(aUseMucKal),myMucWindow(aMucWindow)
55{
56 // BesSensitiveManager *besSensitiveManager = new BesSensitiveManager;
57 bes3DetectorConstruction = new ExtBesDetectorConstruction(myBFieldOn,m_detVer);
58 bes3WorldVolume = bes3DetectorConstruction->Construct();
59 extPhysicsList = new ExtPhysicsList;
60 extTrack = new G4Track;
61
62 //for geant4.8.1, move this line to Initialization, extSteppingAction = new ExtSteppingAction;
63 //extTrackingManager = new G4TrackingManager;
64 //RunManagerKernel for geant4.9.0
65 extRunManagerKernel = new G4RunManagerKernel;
66 extTrackingManager=extRunManagerKernel->GetTrackingManager();
67 extRunManagerKernel->DefineWorldVolume(bes3WorldVolume);
68 extRunManagerKernel->SetPhysics(extPhysicsList);
69 extTrackingManager=extRunManagerKernel->GetTrackingManager();
70}

◆ ~Ext_track()

Ext_track::~Ext_track ( )

Definition at line 74 of file Ext_track.cxx.

75{
76 //cout<<"delete 1"<<endl;
77 //if(extRunManagerKernel) delete extRunManagerKernel;
78 //if(extTrackingManager) delete extTrackingManager;
79 // if(extSteppingAction) delete extSteppingAction;
80 //cout<<"delete 2"<<endl;
81 if(extTrack) delete extTrack;
82 //cout<<"delete 3"<<endl;
83 if(bes3DetectorConstruction) delete bes3DetectorConstruction;
84 //cout<<"delete 4"<<endl;
85 if(extPhysicsList) delete extPhysicsList;
86 //cout<<"delete 5"<<endl;
87
88 // open geometry for deletion
89 G4GeometryManager::GetInstance()->OpenGeometry();
90
91 // deletion of Geant4 kernel classes
92 G4SDManager* fSDM = G4SDManager::GetSDMpointerIfExist();
93 if(fSDM)
94 {
95 delete fSDM;
96 }
97 //cout<<"delete 6"<<endl;
98}

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 154 of file Ext_track.h.

154{ m_dir = dir; }

◆ GetStepAction()

ExtSteppingAction * Ext_track::GetStepAction ( )
inline

Definition at line 90 of file Ext_track.h.

90{return extSteppingAction;};

Referenced by TrkExtAlg::execute().

◆ Initialization()

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

Definition at line 104 of file Ext_track.cxx.

105{
106 myMsgFlag=aMsgFlag;
107 myGeomOptimization = GeomOptimization;
108 myBFieldOn=Bfield,
109 myUseMucKal=aUseMucKal;
110 myMucWindow = aMucWindow;
111 //add for geant4.8.1
112 //G4ParticleTable::GetParticleTable()->SetReadiness();
113 //extPhysicsList->ConstructParticle();
114
115 if(myMsgFlag) cout << "Ext_track::Init will execute geant initialization." << endl;
116 //if(!GeometryInitialization()) cout << "Error in Ext_track::GeometryInitialization()" << endl;
117 //PhysicsInitialization();
118 extRunManagerKernel->InitializePhysics();
119 G4cout<<"dzy add output before extRunManagerKernel->RunInitialization()"<<G4endl;
120 extRunManagerKernel->RunInitialization();
121 G4cout<<"dzy add output after extRunManagerKernel->RunInitialization()"<<G4endl;
122
123 extSteppingAction = new ExtSteppingAction;
124 extSteppingAction->SetMsgFlag(aMsgFlag);
125 extSteppingAction->SetMucKalFlag(aUseMucKal);
126 extSteppingAction->SetMucWindow(aMucWindow);
127 //Set extSteppingAction
128 extTrackingManager->SetUserAction(extSteppingAction);
129
130
131
132}
void SetMsgFlag(bool aMsgFalg)
void SetMucWindow(int aMucWindow)
void SetMucKalFlag(bool aMucKalFlag)

Referenced by TrkExtAlg::initialize().

◆ 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 254 of file Ext_track.cxx.

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

Referenced by TrkExtAlg::execute().

◆ TrackExtrapotation()

void Ext_track::TrackExtrapotation ( )

Definition at line 362 of file Ext_track.cxx.

363{
364 extTrackingManager->ProcessOneTrack(extTrack);
365}

Referenced by TrkExtAlg::execute().


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