CGEM BOSS 6.6.5.h
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 38 of file BesEventAction.cc.

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

◆ ~BesEventAction()

BesEventAction::~BesEventAction ( )
virtual

Definition at line 82 of file BesEventAction.cc.

83{
84 delete m_DM;
85}

Member Function Documentation

◆ BeginOfEventAction()

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

Definition at line 87 of file BesEventAction.cc.

88{
89
90 G4int eventId = evt->GetEventID();
91 //if (eventId%5000==0)
92 // G4cout<<"---> Begin of event: "<<eventId<<G4endl;
93
94 G4UImanager* uiMgr = G4UImanager::GetUIpointer();
95 //if(eventId == 46 || eventId == 75)
96 // uiMgr->ApplyCommand("/tracking/verbose 1");
97 //else
98 // uiMgr->ApplyCommand("/tracking/verbose 0");
99
100 //mc truth
101 if (m_runAction)
102 if (m_runAction->GetMCTruthFlag()!=0)
103 {
105 sensitiveManager->BeginOfTruthEvent(evt);
106 }
107}
G4int GetMCTruthFlag()
void BeginOfTruthEvent(const G4Event *)
static BesSensitiveManager * GetSensitiveManager()

◆ EndOfEventAction()

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

Definition at line 109 of file BesEventAction.cc.

110{
111 if (G4VVisManager::GetConcreteInstance())
112 {
113 G4TrajectoryContainer* trajectoryContainer = evt->GetTrajectoryContainer();
114 G4int n_trajectories = 0;
115 if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
116
117 for (G4int i=0; i<n_trajectories; i++)
118 {
119 G4Trajectory* trj = (G4Trajectory*)
120 ((*(evt->GetTrajectoryContainer()))[i]);
121
122 trj->DrawTrajectory(50);
123
124 }
125 }
126
127 //mc truth
129 if (m_runAction)
130 if (m_runAction->GetMCTruthFlag()!=0)
131 {
132 sensitiveManager->EndOfTruthEvent(evt);
133 }
134
136 if (m_runAction)
137 {
138 //Ascii I/O, output hit collections
139 BesAsciiIO* asciiIO = m_runAction->GetAsciiIO();
140 if (asciiIO) {
141 if (m_RealizationSvc->UseDBFlag() == true) asciiIO->SaveHitAsciiEvents(m_RealizationSvc->getRunId(), evt);
142 else asciiIO->SaveHitAsciiEvents(m_runAction->GetRunId(), evt);
143 }
144
145 //Root I/O, output MdcHit collections
146 BesRootIO* rootIO = m_runAction->GetRootIO();
147 if (rootIO){
148 //emc digitization
149 if (ReadBoostRoot::GetEmc()) m_DM->Digitize("BesEmcDigitizer");
150
151 if (m_RealizationSvc->UseDBFlag() == true) rootIO->SaveHitRootEvent(m_RealizationSvc->getRunId(), evt);
152 else rootIO->SaveHitRootEvent(m_runAction->GetRunId(), evt);
153 }
154 }
155 }else{
156 //Tuning I/O
158 if (m_runAction)
159 {
160 BesTuningIO* tuningIO = m_runAction->GetTuningIO();
161 if (tuningIO){
163 {
164 tuningIO->GetRootEvent(evt->GetEventID());
165 }
166 else{
167 tuningIO->GetNextEvents();
168 }
169 }
170
171 }
172 }
173 //mdc digitization
174
176 m_DM->Digitize("BesMdcDigitizer");
177
178 //cgem digitization
179
181 m_DM->Digitize("BesCgemDigitizer");
182
183 //tof digitization
185 m_DM->Digitize("BesTofDigitizer");
186
187 //emc digitization
189 m_DM->Digitize("BesEmcDigitizer");
190
191 //muc digitization
193 m_DM->Digitize("BesMucDigitizer");
194
195
196 if (m_runAction)
197 {
198 //Ascii I/O, output digi collections
199 BesAsciiIO* asciiIO = m_runAction->GetAsciiIO();
200 if (asciiIO)
201 {
202 if (m_RealizationSvc->UseDBFlag() == true) asciiIO->SaveAsciiEvents(m_RealizationSvc->getRunId(), evt);
203 else asciiIO->SaveAsciiEvents(m_runAction->GetRunId(), evt);
204 }
205
206 // Root I/O,output digi collections
207 BesTDSWriter* tdsWriter = m_runAction->GetTDSWriter();
208 if (tdsWriter)
209 {
210 if (m_RealizationSvc->UseDBFlag() == true) tdsWriter->SaveAll(evt, m_RealizationSvc->getRunId() );
211 else tdsWriter->SaveAll(evt, m_runAction->GetRunId() );
212 }
213 }
214 }
215
216 sensitiveManager->ClearEvent();
217 //HepRandom::saveEngineStatus("EndSimCurrEvt.rndm");
218}
void SaveHitAsciiEvents(G4int, const G4Event *)
void SaveAsciiEvents(G4int, const G4Event *)
Definition BesAsciiIO.cc:65
void SaveHitRootEvent(G4int, const G4Event *)
Definition BesRootIO.cc:68
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: