BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
BesRunAction.cc
Go to the documentation of this file.
1//---------------------------------------------------------------------------//
2// BOOST --- BESIII Object_Oriented Simulation Tool //
3//---------------------------------------------------------------------------//
4// Description: class for BesRunAction (simple)
5// Author: Liuhm
6// Created: May 25, 2003
7// Modified:
8// Comment:
9//---------------------------------------------------------------------------//
10
11#include "BesRunAction.hh"
12#include "G4Run.hh"
13// #include "BesRunActionMessenger.hh"
14#include "BesAsciiIO.hh"
15#include "BesRootIO.hh"
16#include "BesTDSWriter.hh"
17#include "BesTuningIO.hh"
18
19#include "SimUtil/ReadBoostRoot.hh"
20
22 : m_runId( 0 )
23 , m_MCTruthFlag( 1 )
24 , m_asciiFlag( "" )
25 , m_asciiFile( "" )
26 , m_asciiIO( 0 )
27 , m_rootFlag( true )
28 , m_rootFile( "" )
29 , m_rootIO( 0 )
30 , m_tuningIO( 0 )
31 , m_TDSFlag( true )
32 , m_TDSWriter( 0 ) {
33 // m_runMessenger = new BesRunActionMessenger(this);
34}
35
37 // delete m_runMessenger;
38}
39
40void BesRunAction::BeginOfRunAction( const G4Run* aRun ) {
41 // set run Id, use old BES convention, -9 as default
42 // aRun->SetRunID(runNumber);
43 G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
44 m_runId = aRun->GetRunID();
45
46 G4int flag[8];
47 G4int allflag = 0;
48 for ( G4int i = 0; i < 8; i++ )
49 {
50 flag[i] = m_asciiFlag[i] - '0';
51 allflag += flag[i];
52 }
53 if ( allflag )
54 m_asciiIO = new BesAsciiIO( flag[0], flag[1], flag[2], flag[3], flag[4], flag[5], flag[6],
55 flag[7], m_asciiFile );
56
57 if ( m_rootFlag ) m_rootIO = new BesRootIO( 1, 1, 1, 1, 1, 1, 1, 1, m_rootFile );
58
59 if ( m_TDSFlag ) m_TDSWriter = new BesTDSWriter;
60
62 {
63 std::vector<std::string>::iterator pd;
64 for ( pd = m_tuningFile.begin(); pd != m_tuningFile.end(); pd++ )
65 { std::cout << "BesRunAction tuning File: " << *pd << std::endl; }
66
67 m_tuningIO = new BesTuningIO( m_tuningFile );
68 }
69}
70
71void BesRunAction::EndOfRunAction( const G4Run* ) {
72 if ( m_asciiIO ) delete m_asciiIO;
73 if ( m_rootIO ) delete m_rootIO;
74 if ( m_TDSFlag ) delete m_TDSWriter;
75 if ( m_tuningIO ) delete m_tuningIO;
76}
void EndOfRunAction(const G4Run *)
void BeginOfRunAction(const G4Run *)