Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
FCALTBEventAction Class Reference

#include <FCALTBEventAction.hh>

Inheritance diagram for FCALTBEventAction:
G4UserEventAction

Public Member Functions

 FCALTBEventAction (FCALSteppingAction *)
 
virtual ~FCALTBEventAction ()
 
virtual void BeginOfEventAction (const G4Event *)
 
virtual void EndOfEventAction (const G4Event *)
 
void SetDrawFlag (G4String val)
 
void SetPrintModulo (G4int val)
 
- Public Member Functions inherited from G4UserEventAction
 G4UserEventAction ()
 
virtual ~G4UserEventAction ()
 
void SetEventManager (G4EventManager *value)
 

Additional Inherited Members

- Protected Attributes inherited from G4UserEventAction
G4EventManagerfpEventManager
 

Detailed Description

Definition at line 45 of file FCALTBEventAction.hh.

Constructor & Destructor Documentation

FCALTBEventAction::FCALTBEventAction ( FCALSteppingAction SA)

Definition at line 60 of file FCALTBEventAction.cc.

61  :drawFlag("all"),printModulo(10), StepAction(SA), eventMessenger(0)
62 {
63  eventMessenger = new FCALTBEventActionMessenger(this);
64 }
FCALTBEventAction::~FCALTBEventAction ( )
virtual

Definition at line 68 of file FCALTBEventAction.cc.

69 {
70  delete eventMessenger;
71  eventMessenger = 0;
72 }

Member Function Documentation

void FCALTBEventAction::BeginOfEventAction ( const G4Event evt)
virtual

Reimplemented from G4UserEventAction.

Definition at line 76 of file FCALTBEventAction.cc.

References G4cout, G4endl, G4Event::GetEventID(), and FCALSteppingAction::initialize().

77 {
78  G4int evtNb = evt->GetEventID();
79  if (evtNb%printModulo == 0)
80  {
81  G4cout << "\n---> Begin of event: " << evtNb+1 << G4endl;
82 // HepRandom::showEngineStatus();
83  }
84 
85  NTracksOutOfWorld = 0;
86  NSecondaries = 0;
87 
88  StepAction->initialize(evtNb+1);
89 }
int G4int
Definition: G4Types.hh:78
G4int GetEventID() const
Definition: G4Event.hh:140
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void FCALTBEventAction::EndOfEventAction ( const G4Event )
virtual

Reimplemented from G4UserEventAction.

Definition at line 93 of file FCALTBEventAction.cc.

References testem0::app, G4VAnalysisManager::FillH1(), G4cout, G4endl, FCALSteppingAction::GetEdepFCAL(), FCALSteppingAction::GetOutOfWorldTracks(), FCALSteppingAction::GetSecondaries(), and python.hepunit::MeV.

94 {
95  // Fill histograms
96  G4AnalysisManager* man = G4AnalysisManager::Instance();
97 
98  G4int i,j;
99  NTracksOutOfWorld = StepAction->GetOutOfWorldTracks(0, 0);
100  G4cout << "N Tracks out of world " << NTracksOutOfWorld << G4endl;
101 
102  // Write Leaving Particles in File
103  //--------------------------------
104  G4String FileName1 = "OutTracks_802_1mm.dat";
105  std::ios::openmode iostemp1;
106  if(Init1 == 0) {
107  iostemp1 = std::ios::out;
108  Init1++;
109  } else {
110  iostemp1 = std::ios::out|std::ios::app; // std::ios::app;
111  };
112  std::ofstream OutTracks(FileName1, iostemp1);
113 
114  OutTracks << NTracksOutOfWorld << G4endl;
115 
116  G4double OutOfWorld;
117  for(i=1; i<= NTracksOutOfWorld ; i++){
118  for(j=1; j<11 ; j++) {
119  // G4double OutOfWorld = StepAction->GetOutOfWorldTracks(i,j);
120  OutOfWorld = StepAction->GetOutOfWorldTracks(i,j);
121  OutTracks << OutOfWorld << " " ;
122  }
123  OutTracks << std::endl;
124  // G4double OutOfWorld2 = StepAction->GetOutOfWorldTracks(i,j);
125  }
126  OutTracks.close();
127 
128  man->FillH1(1,NTracksOutOfWorld);
129 
130  NSecondaries = StepAction->GetSecondaries(0,0);
131  G4cout << "N Scondaries " << NSecondaries << G4endl;
132 
133  // Write Secondary Particles in File
134  //----------------------------------
135  G4String FileName2 = "SecndTracks_802_1mm.dat";
136  std::ios::openmode iostemp2;
137  if(Init2 == 0) {
138  iostemp2 = std::ios::out;
139  Init2++;
140  } else {
141  iostemp2 = std::ios::out|std::ios::app; // std::ios::app;
142  };
143 
144  std::ofstream SecndTracks(FileName2, iostemp2);
145 
146  SecndTracks << NSecondaries << std::endl;
147 
148  G4double Secondary;
149  for(i=1; i<= NSecondaries ; i++){
150  for(j=1; j<11 ; j++) {
151  Secondary = StepAction->GetSecondaries(i,j);
152  SecndTracks << Secondary << " " ;
153  }
154  SecndTracks << std::endl;
155  // G4double Secondary2 = StepAction->GetSecondaries(i,j);
156  }
157  SecndTracks.close();
158 
159  man->FillH1(2,NSecondaries);
160 
161  // Write Edep in FCAL1 and FCAL2
162  G4String FileName3 = "EdepFCAL_802_1mm.dat";
163  std::ios::openmode iostemp3;
164  if(Init3 == 0) {
165  iostemp3 = std::ios::out;
166  Init3++;
167  } else {
168  iostemp3 = std::ios::out|std::ios::app; // std::ios::app;
169  };
170 
171  std::ofstream EdepFCAL(FileName3, iostemp3);
172 
173  G4double EmEdep = StepAction->GetEdepFCAL("FCALEm");
174  G4double HadEdep = StepAction->GetEdepFCAL("FCALHad");
175 
176  EdepFCAL << EmEdep << " ";
177  EdepFCAL << HadEdep;
178  EdepFCAL << std::endl;
179  EdepFCAL.close();
180 
181  man->FillH1(3,EmEdep/MeV);
182  man->FillH1(4,HadEdep/MeV);
183 
184 
185  G4cout<<"EmEdep is="<<EmEdep/MeV << " MeV " << G4endl;
186  G4cout<<"HadEdep is="<<HadEdep << " MeV" << G4endl;
187 
188  G4cout << "Edep in FCAL1 FCAl2 : " << StepAction->GetEdepFCAL("FCALEm") << " ";
189  G4cout << StepAction->GetEdepFCAL("FCALHad") << G4endl;
190 }
G4double GetSecondaries(G4int, G4int)
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
G4double GetOutOfWorldTracks(G4int, G4int)
G4double GetEdepFCAL(G4String)
G4bool FillH1(G4int id, G4double value, G4double weight=1.0)
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void FCALTBEventAction::SetDrawFlag ( G4String  val)
inline

Definition at line 55 of file FCALTBEventAction.hh.

Referenced by FCALTBEventActionMessenger::SetNewValue().

55 {drawFlag = val;};
void FCALTBEventAction::SetPrintModulo ( G4int  val)
inline

Definition at line 56 of file FCALTBEventAction.hh.

Referenced by FCALTBEventActionMessenger::SetNewValue().

56 {printModulo = val;};

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