BOSS 7.0.9
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 "ReadBoostRoot.hh"
20
22 :m_runId(0), m_MCTruthFlag(1),
23 m_asciiFlag(""),m_asciiFile(""),m_asciiIO(0),m_rootFlag(true),m_rootFile(""),m_rootIO(0),
24 m_tuningIO(0),m_TDSFlag(false),m_TDSWriter(0)
25{
26 //m_runMessenger = new BesRunActionMessenger(this);
27}
28
30{
31 //delete m_runMessenger;
32}
33
34void BesRunAction::BeginOfRunAction(const G4Run* aRun)
35{
36 //set run Id, use old BES convention, -9 as default
37 //aRun->SetRunID(runNumber);
38 G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
39 m_runId= aRun->GetRunID();
40
41 G4int flag[8];
42 G4int allflag=0;
43 for (G4int i=0;i<8;i++)
44 {
45 flag[i]=m_asciiFlag[i]-'0';
46 allflag += flag[i];
47 }
48 if (allflag)
49 m_asciiIO = new BesAsciiIO(flag[0],flag[1],flag[2],flag[3],flag[4],flag[5],flag[6],flag[7],m_asciiFile);
50
51 if (m_rootFlag)
52 m_rootIO = new BesRootIO(1,1,1,1,1,1,1,1,m_rootFile);
53
54 if (m_TDSFlag)
55 m_TDSWriter = new BesTDSWriter;
56
58 std::vector<std::string>::iterator pd;
59 for (pd = m_tuningFile.begin(); pd != m_tuningFile.end(); pd++){
60 std::cout << "BesRunAction tuning File: " << *pd << std::endl;
61 }
62
63 m_tuningIO = new BesTuningIO(m_tuningFile);
64 }
65}
66
67
69{
70 if (m_asciiIO)
71 delete m_asciiIO;
72 if (m_rootIO)
73 delete m_rootIO;
74 if (m_TDSFlag)
75 delete m_TDSWriter;
76 if (m_tuningIO)
77 delete m_tuningIO;
78}
void EndOfRunAction(const G4Run *)
Definition: BesRunAction.cc:68
void BeginOfRunAction(const G4Run *)
Definition: BesRunAction.cc:34
static G4int GetTuning()