Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
g4lbne
src
LBNEEventAction.cc
Go to the documentation of this file.
1
//
2
//LBNEEventAction.cc
3
//
4
5
//C++
6
#include <string>
7
#include <stdlib.h>
8
9
#include "
LBNEEventAction.hh
"
10
#include "
LBNERunManager.hh
"
11
#include "
LBNEAnalysis.hh
"
12
#include "
LBNETrajectory.hh
"
13
14
#include "G4RunManager.hh"
15
#include "G4Run.hh"
16
#include "G4Event.hh"
17
#include "G4Track.hh"
18
#include "G4EventManager.hh"
19
#include "G4TrajectoryContainer.hh"
20
#include "G4Trajectory.hh"
21
#include "G4ios.hh"
22
#include "
LBNEQuickPiToNu.hh
"
23
24
//-------------------------------------------------------------------------------------
25
LBNEEventAction::LBNEEventAction
()
26
{
27
pRunManager
=(
LBNERunManager
*)LBNERunManager::GetRunManager();
28
29
if
(
pRunManager
->
GetVerboseLevel
() > 0)
30
{
31
std::cout <<
"LBNEEventAction Constructor Called."
<<
std::endl
;
32
}
33
34
}
35
36
//-------------------------------------------------------------------------------------
37
LBNEEventAction::~LBNEEventAction
()
38
{
39
40
if
(
pRunManager
->
GetVerboseLevel
() > 0)
41
{
42
std::cout <<
"LBNEEventAction Destructor Called."
<<
std::endl
;
43
}
44
}
45
46
//-------------------------------------------------------------------------------------
47
void
LBNEEventAction::BeginOfEventAction
(
const
G4Event*
evt
)
48
{
49
if
(
pRunManager
->
GetVerboseLevel
() > 1)
50
{
51
G4cout <<
"LBNEEventAction::BeginOfEventAction called...Beginning Event #"
<< evt->GetEventID() << G4endl;
52
}
53
const
LBNERunAction
*runUserAction =
reinterpret_cast<
const
LBNERunAction
*
>
(G4RunManager::GetRunManager()->GetUserRunAction());
54
if
(runUserAction->
GetDoComputeEDepInGraphite
()) {
55
LBNESteppingAction
*stepAction = (
LBNESteppingAction
*) G4RunManager::GetRunManager()->GetUserSteppingAction();
56
stepAction->
ResetEnergyDepInGraphite
();
57
// std::cerr << " Ready to tally energy deposition in the graphite ... " << std::endl;
58
}
59
if
(runUserAction->
GetDoComputeEDepInArgonGas
()) {
60
LBNESteppingAction
*stepAction = (
LBNESteppingAction
*) G4RunManager::GetRunManager()->GetUserSteppingAction();
61
stepAction->
ResetEnergyDepInArgonGas
();
62
// std::cerr << " Ready to tally energy deposition in the graphite ... " << std::endl;
63
}
64
// This code does not work.. Need to be studied..
65
// if (evt->GetEventID() == -2222) {
66
//
67
// CLHEP::HepRandom::restoreEngineStatus("./rndm/beginRun_103Evt_32135.rndm");
68
// std::cerr << " Reloaded random from 103Evt_32135 " << std::endl;
69
// }
70
//
71
// if (evt->GetEventID() > 32130) {
72
// const G4Run* theRun = pRunManager->GetCurrentRun();
73
// std::ostringstream fOutRndmStrStr;
74
// fOutRndmStrStr << "./rndm/beginRun_" << theRun->GetRunID() << "Evt_" << evt->GetEventID() << ".rndm";
75
// std::string fOutRndmStr(fOutRndmStrStr.str());
76
// CLHEP::HepRandom::saveEngineStatus(fOutRndmStr.c_str());
77
// delete the previous previous file
78
// std::ostringstream fOutRndmPStrStr;
79
// fOutRndmPStrStr << "rm -f ./rndm/beginRun_" << theRun->GetRunID() << "Evt_" << evt->GetEventID()-2 << ".rndm";
80
// std::string fOutRndmPStr(fOutRndmPStrStr.str());
81
// system(fOutRndmPStr.c_str());
82
// Also get the seeds May this what we have to save...
83
// std::cerr << " The seed is now " << CLHEP::HepRandom::getTheSeed() << std::endl;
84
// }
85
86
if
(
pRunManager
->
GetCreateTrkPlaneOutput
()||
pRunManager
->
GetCreateAlcoveTrackingOutput
()){
87
//--for tracking planes
88
LBNEAnalysis
* analysis =
LBNEAnalysis::getInstance
();
89
analysis->
ResetEvent
();
90
}
91
92
}
93
94
95
//-------------------------------------------------------------------------------------
96
void
LBNEEventAction::EndOfEventAction
(
const
G4Event*
evt
)
97
{
98
if
(
pRunManager
->
GetVerboseLevel
() > 1)
99
{
100
G4cout <<
"LBNEEventAction::EndOfEventAction called...Ending Event # "
<< evt-> GetEventID() << G4endl;
101
}
102
if
(
LBNEQuickPiToNuVect::Instance
()->doIt())
LBNEQuickPiToNuVect::Instance
()->
evtOut
();
103
104
const
LBNERunAction
*runUserAction =
reinterpret_cast<
const
LBNERunAction
*
>
(G4RunManager::GetRunManager()->GetUserRunAction());
105
if
(runUserAction->
GetDoComputeEDepInGraphite
()) {
106
const
LBNESteppingAction
*stepAction =
107
reinterpret_cast<
const
LBNESteppingAction
*
>
108
(G4RunManager::GetRunManager()->GetUserSteppingAction());
109
runUserAction->
storeEDepInGraphite
(stepAction->
GetEnergyDepInGraphite
());
110
}
111
if
(runUserAction->
GetDoComputeEDepInArgonGas
()) {
112
const
LBNESteppingAction
*stepAction =
113
reinterpret_cast<
const
LBNESteppingAction
*
>
114
(G4RunManager::GetRunManager()->GetUserSteppingAction());
115
const
double
eDepH1 = stepAction->
GetEnergyDepInArgonGasH1
();
116
const
double
eDepH2 = stepAction->
GetEnergyDepInArgonGasH2
();
117
runUserAction->
storeEDepInArgonGas
(eDepH1, eDepH2);
118
}
119
120
//--for tracking planes
121
if
(
pRunManager
->
GetCreateTrkPlaneOutput
()||
pRunManager
->
GetCreateAlcoveTrackingOutput
()){
122
LBNEAnalysis
* analysis =
LBNEAnalysis::getInstance
();
123
analysis->
FillEvent
();
124
}
125
126
}
127
LBNEAnalysis::ResetEvent
void ResetEvent()
Definition:
LBNEAnalysis.cc:2292
LBNEAnalysis::FillEvent
void FillEvent()
Definition:
LBNEAnalysis.cc:2304
LBNERunAction::GetDoComputeEDepInGraphite
bool GetDoComputeEDepInGraphite() const
Definition:
LBNERunAction.hh:48
LBNEEventAction::BeginOfEventAction
void BeginOfEventAction(const G4Event *)
Definition:
LBNEEventAction.cc:47
LBNERunAction::GetDoComputeEDepInArgonGas
bool GetDoComputeEDepInArgonGas() const
Definition:
LBNERunAction.hh:54
LBNESteppingAction::GetEnergyDepInArgonGasH1
double GetEnergyDepInArgonGasH1() const
Definition:
LBNESteppingAction.hh:158
LBNERunManager::GetCreateAlcoveTrackingOutput
bool GetCreateAlcoveTrackingOutput() const
Definition:
LBNERunManager.hh:128
LBNESteppingAction::GetEnergyDepInGraphite
double GetEnergyDepInGraphite() const
Definition:
LBNESteppingAction.hh:157
LBNERunAction::storeEDepInGraphite
void storeEDepInGraphite(double edep) const
Definition:
LBNERunAction.hh:49
LBNEEventAction.hh
LBNETrajectory.hh
LBNEAnalysis::getInstance
static LBNEAnalysis * getInstance()
Definition:
LBNEAnalysis.cc:134
LBNESteppingAction
Definition:
LBNESteppingAction.hh:24
LBNEEventAction::EndOfEventAction
void EndOfEventAction(const G4Event *)
Definition:
LBNEEventAction.cc:96
LBNESteppingAction::ResetEnergyDepInGraphite
void ResetEnergyDepInGraphite() const
Definition:
LBNESteppingAction.hh:154
LBNERunManager::GetCreateTrkPlaneOutput
bool GetCreateTrkPlaneOutput() const
Definition:
LBNERunManager.hh:97
LBNEQuickPiToNuVect::evtOut
void evtOut()
Definition:
LBNEQuickPiToNu.hh:120
LBNEQuickPiToNuVect::Instance
static LBNEQuickPiToNuVect * Instance()
Definition:
LBNEQuickPiToNu.cc:21
LBNERunAction::storeEDepInArgonGas
void storeEDepInArgonGas(double edepH1, double edepH2) const
Definition:
LBNERunAction.hh:55
LBNEEventAction::~LBNEEventAction
~LBNEEventAction()
Definition:
LBNEEventAction.cc:37
LBNEQuickPiToNu.hh
LBNESteppingAction::ResetEnergyDepInArgonGas
void ResetEnergyDepInArgonGas() const
Definition:
LBNESteppingAction.hh:155
LBNEEventAction::pRunManager
LBNERunManager * pRunManager
Definition:
LBNEEventAction.hh:39
LBNEEventAction::LBNEEventAction
LBNEEventAction()
Definition:
LBNEEventAction.cc:25
LBNEAnalysis
Definition:
LBNEAnalysis.hh:35
LBNERunAction
Definition:
LBNERunAction.hh:16
LBNERunManager::GetVerboseLevel
int GetVerboseLevel() const
Definition:
LBNERunManager.hh:135
tca::evt
TCEvent evt
Definition:
DataStructs.cxx:5
LBNESteppingAction::GetEnergyDepInArgonGasH2
double GetEnergyDepInArgonGasH2() const
Definition:
LBNESteppingAction.hh:159
LBNERunManager.hh
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
LBNEAnalysis.hh
LBNERunManager
Definition:
LBNERunManager.hh:17
Generated by
1.8.11