BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
BesEventAction Class Reference

#include <BesEventAction.hh>

+ Inheritance diagram for BesEventAction:

Public Member Functions

 BesEventAction (BesRunAction *)
 
virtual ~BesEventAction ()
 
virtual void BeginOfEventAction (const G4Event *)
 
virtual void EndOfEventAction (const G4Event *)
 

Detailed Description

Definition at line 14 of file BesEventAction.hh.

Constructor & Destructor Documentation

◆ BesEventAction()

BesEventAction::BesEventAction ( BesRunAction * runAction)

Definition at line 36 of file BesEventAction.cc.

37 :m_runAction(runAction)
38{
39 ISvcLocator* svcLocator = Gaudi::svcLocator();
40 IRealizationSvc *tmpReal;
41 StatusCode sc = svcLocator->service("RealizationSvc",tmpReal);
42 if (!sc.isSuccess())
43 {
44 std::cout << " Could not initialize Realization Service in BesEventAction" << std::endl;
45 } else {
46 m_RealizationSvc=dynamic_cast<RealizationSvc*>(tmpReal);
47 }
48
49 m_DM = G4DigiManager::GetDMpointer();
50
52 {
53 BesMdcDigitizer* mdcDM = new BesMdcDigitizer("BesMdcDigitizer");
54 m_DM->AddNewModule(mdcDM);
55 }
57 {
58 BesTofDigitizer* tofDM = new BesTofDigitizer("BesTofDigitizer");
59 m_DM->AddNewModule(tofDM);
60 }
62 {
63 BesEmcDigitizer* emcDM = new BesEmcDigitizer("BesEmcDigitizer");
64 m_DM->AddNewModule(emcDM);
65 }
67 {
68 BesMucDigitizer* mucDM = new BesMucDigitizer("BesMucDigitizer");
69 m_DM->AddNewModule(mucDM);
70 }
71
72}
static G4int GetMdc()
static G4int GetMuc()
static G4int GetTof()
static G4int GetEmc()

◆ ~BesEventAction()

BesEventAction::~BesEventAction ( )
virtual

Definition at line 74 of file BesEventAction.cc.

75{
76 delete m_DM;
77}

Member Function Documentation

◆ BeginOfEventAction()

void BesEventAction::BeginOfEventAction ( const G4Event * evt)
virtual

Definition at line 79 of file BesEventAction.cc.

80{
81
82 G4int eventId = evt->GetEventID();
83 //if (eventId%5000==0)
84 // G4cout<<"---> Begin of event: "<<eventId<<G4endl;
85
86 G4UImanager* uiMgr = G4UImanager::GetUIpointer();
87 //if(eventId == 46 || eventId == 75)
88 // uiMgr->ApplyCommand("/tracking/verbose 1");
89 //else
90 // uiMgr->ApplyCommand("/tracking/verbose 0");
91
92 //mc truth
93 if (m_runAction)
94 if (m_runAction->GetMCTruthFlag()!=0)
95 {
97 sensitiveManager->BeginOfTruthEvent(evt);
98 }
99}
G4int GetMCTruthFlag()
void BeginOfTruthEvent(const G4Event *)
static BesSensitiveManager * GetSensitiveManager()

◆ EndOfEventAction()

void BesEventAction::EndOfEventAction ( const G4Event * evt)
virtual

Definition at line 101 of file BesEventAction.cc.

102{
103 if (G4VVisManager::GetConcreteInstance())
104 {
105 G4TrajectoryContainer* trajectoryContainer = evt->GetTrajectoryContainer();
106 G4int n_trajectories = 0;
107 if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
108
109 for (G4int i=0; i<n_trajectories; i++)
110 {
111 G4Trajectory* trj = (G4Trajectory*)
112 ((*(evt->GetTrajectoryContainer()))[i]);
113
114 //trj->DrawTrajectory(50);
115
116 }
117 }
118
119 //mc truth
121 if (m_runAction)
122 if (m_runAction->GetMCTruthFlag()!=0)
123 {
124 sensitiveManager->EndOfTruthEvent(evt);
125 }
126
128 if (m_runAction)
129 {
130 //Ascii I/O, output hit collections
131 BesAsciiIO* asciiIO = m_runAction->GetAsciiIO();
132 if (asciiIO) {
133 if (m_RealizationSvc->UseDBFlag() == true) asciiIO->SaveHitAsciiEvents(m_RealizationSvc->getRunId(), evt);
134 else asciiIO->SaveHitAsciiEvents(m_runAction->GetRunId(), evt);
135 }
136
137 //Root I/O, output MdcHit collections
138 BesRootIO* rootIO = m_runAction->GetRootIO();
139 if (rootIO){
140 //emc digitization
141 if (ReadBoostRoot::GetEmc()) m_DM->Digitize("BesEmcDigitizer");
142
143 if (m_RealizationSvc->UseDBFlag() == true) rootIO->SaveHitRootEvent(m_RealizationSvc->getRunId(), evt);
144 else rootIO->SaveHitRootEvent(m_runAction->GetRunId(), evt);
145 }
146 }
147 }else{
148 //Tuning I/O
150 if (m_runAction)
151 {
152 BesTuningIO* tuningIO = m_runAction->GetTuningIO();
153 if (tuningIO){
155 {
156 tuningIO->GetRootEvent(evt->GetEventID());
157 }
158 else{
159 tuningIO->GetNextEvents();
160 }
161 }
162
163 }
164 }
165 //mdc digitization
166
168 m_DM->Digitize("BesMdcDigitizer");
169
170 //tof digitization
172 m_DM->Digitize("BesTofDigitizer");
173
174 //emc digitization
176 m_DM->Digitize("BesEmcDigitizer");
177
178 //muc digitization
180 m_DM->Digitize("BesMucDigitizer");
181
182
183 if (m_runAction)
184 {
185 //Ascii I/O, output digi collections
186 BesAsciiIO* asciiIO = m_runAction->GetAsciiIO();
187 if (asciiIO)
188 {
189 if (m_RealizationSvc->UseDBFlag() == true) asciiIO->SaveAsciiEvents(m_RealizationSvc->getRunId(), evt);
190 else asciiIO->SaveAsciiEvents(m_runAction->GetRunId(), evt);
191 }
192
193 // Root I/O,output digi collections
194 BesTDSWriter* tdsWriter = m_runAction->GetTDSWriter();
195 if (tdsWriter)
196 {
197 if (m_RealizationSvc->UseDBFlag() == true) tdsWriter->SaveAll(evt, m_RealizationSvc->getRunId() );
198 else tdsWriter->SaveAll(evt, m_runAction->GetRunId() );
199 }
200 }
201 }
202
203 sensitiveManager->ClearEvent();
204 //HepRandom::saveEngineStatus("EndSimCurrEvt.rndm");
205}
void SaveHitAsciiEvents(G4int, const G4Event *)
void SaveAsciiEvents(G4int, const G4Event *)
Definition BesAsciiIO.cc:61
void SaveHitRootEvent(G4int, const G4Event *)
Definition BesRootIO.cc:65
BesTuningIO * GetTuningIO()
G4int GetRunId()
BesRootIO * GetRootIO()
BesTDSWriter * GetTDSWriter()
BesAsciiIO * GetAsciiIO()
void EndOfTruthEvent(const G4Event *)
void SaveAll(const G4Event *, int)
void GetRootEvent(int evtID)
void GetNextEvents(void)
static G4int GetFormatAR()
static G4int GetHitOut()
static G4int GetTuning()

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