Commit 5bc3a9a4 authored by Adrien Matta's avatar Adrien Matta
Browse files

* Adding option to record all spatial track from simulation

        - recording not yet done
        - add appropriate method to EventAction
        - add correct option to NPOptionManager
parent 342742ab
Pipeline #133023 passed with stages
in 7 minutes and 24 seconds
......@@ -119,6 +119,7 @@ void NPOptionManager::ReadTheInputArgument(int argc, char** argv){
fFirstEntryToAnalyse = 0;
fSpectraServerPort = 9092;
fRandomSeed = -1;
fRecordTrack = 0;
fDisableAllBranchOption = false;
fInputPhysicalTreeOption = false;
fGenerateHistoOption = false ;
......@@ -198,6 +199,8 @@ void NPOptionManager::ReadTheInputArgument(int argc, char** argv){
else if (argument == "--random-seed") fRandomSeed = atoi(argv[++i]) ;
else if (argument == "--record-track") fRecordTrack = true ;
else if (argument == "-F") fFirstEntryToAnalyse = atoi(argv[++i]);
else if (argument == "--last-sim") fLastSimFile = true ;
......@@ -475,6 +478,7 @@ void NPOptionManager::DisplayHelp(){
std::cout << "\t-M <arg>\t\t\tExecute Geant4 macro <arg> at startup" << std::endl ;
std::cout << "\t-B <arg>\t\t\tExecute in batch mode (no ui) with Geant4 macro <arg> at startup" << std::endl ;
std::cout << "\t--random-seed <arg>\t\tSet the random generator seed to <arg> (unsigned int)" << std::endl ;
std::cout << "\t--record-track\t\t\tRecord the track of every simulated particle to the ouput tree" << std::endl ;
std::cout << std::endl << std::endl ;
// exit current program
......
......@@ -114,6 +114,7 @@ class NPOptionManager{
int GetFirstEntryToAnalyse() {return fFirstEntryToAnalyse;}
int GetSpectraServerPort() {return fSpectraServerPort;}
int GetRandomSeed() {return fRandomSeed;}
int GetRecordTrack() {return fRecordTrack;}
std::string GetSharedLibExtension() {return fSharedLibExtension;}
std::string GetLastFile();
std::string GetAnalysisOutputPath(){return m_AnalysisOutputPath;};
......@@ -165,6 +166,7 @@ class NPOptionManager{
int fFirstEntryToAnalyse; // use to set the first event analysed in NPA (total: fFirstEntryToAnalyse -> fFirstEntryToAnalyse + fNumberOfEntryToAnalyse)
int fSpectraServerPort;
int fRandomSeed;
int fRecordTrack;
std::string fSharedLibExtension; // lib extension is platform dependent
std::string fG4MacroPath; // Path to a geant4 macro to execute at start of nps
bool fG4BatchMode; // Execute geant4 in batch mode, running the given macro
......
......@@ -31,6 +31,7 @@
#include "DetectorConstruction.hh"
#include "RootOutput.h"
#include "ParticleStack.hh"
#include "NPOptionManager.h"
#include<iostream>
......@@ -44,7 +45,7 @@ EventAction::EventAction(){
total=0;
mean_rate=0;
displayed=0;
m_record_track=NPOptionManager::getInstance()->GetRecordTrack();
m_tree = RootOutput::getInstance()->GetTree();
// m_tree->Branch("Geant4RandomState",&m_G4State );
......@@ -64,15 +65,15 @@ void EventAction::BeginOfEventAction(const G4Event* event){
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventAction::EndOfEventAction(const G4Event* event){
m_detector->ReadAllSensitive(event) ;
if(m_record_track)
TrackRecording(event);
m_tree->Fill();
m_detector->ClearInteractionCoordinates();
// if(treated%10000==0){
// tree->AutoSave();
// RootOutput::getInstance()->GetFile()->SaveSelf(kTRUE);
// }
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
......@@ -91,6 +92,21 @@ void EventAction::SaveRandomGeneratorInitialState(){
m_Geant4RandomFullState.clear();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventAction::TrackRecording(const G4Event* event){
// Clear the tracks class
// m_Tracks->Clear();
TrajectoryVector* traj = event->GetTrajectoryContainer()->GetVector();
unsigned int size = traj->size();
for(unsigned int i = 0 ; i < size ; i++){
// FILL
// Particle name
// Interaction points
// Initial Momentum
// Particles.insert( (*traj)[i]->GetParticleName());
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventAction::ProgressDisplay(){
if(treated==0){
......
......@@ -47,6 +47,7 @@ class EventAction : public G4UserEventAction{
void BeginOfEventAction(const G4Event*);
void EndOfEventAction(const G4Event*);
void SetDetector(DetectorConstruction* detector);
void TrackRecording(const G4Event* event);
void ProgressDisplay();
void SaveRandomGeneratorInitialState();
void SetRunLength(int);
......@@ -54,6 +55,9 @@ class EventAction : public G4UserEventAction{
private: // tree
TTree* m_tree;
private:
bool m_record_track;
private: // Progress Display
clock_t begin;
clock_t end;
......@@ -62,7 +66,7 @@ class EventAction : public G4UserEventAction{
unsigned int total;
double mean_rate;
int displayed;
private: // Random state
std::ostringstream m_Geant4RandomFullState;
std::string m_G4State;
......
NEBULA_T_ID1 34.9114
NEBULA_T_ID2 34.8487
NEBULA_T_ID3 35.0828
NEBULA_T_ID4 34.7753
NEBULA_T_ID5 35.1731
NEBULA_T_ID6 34.8492
NEBULA_T_ID7 34.8129
NEBULA_T_ID8 35.1259
NEBULA_T_ID9 34.957
NEBULA_T_ID10 34.9146
NEBULA_T_ID11 34.9044
NEBULA_T_ID12 34.9218
NEBULA_T_ID13 34.6699
NEBULA_T_ID14 35.1466
NEBULA_T_ID15 35.0836
NEBULA_T_ID16 34.6919
NEBULA_T_ID17 34.796
NEBULA_T_ID18 34.3545
NEBULA_T_ID19 34.6873
NEBULA_T_ID20 34.5355
NEBULA_T_ID21 34.5093
NEBULA_T_ID22 34.5631
NEBULA_T_ID23 34.6092
NEBULA_T_ID24 34.6205
NEBULA_T_ID25 34.6199
NEBULA_T_ID26 35.161
NEBULA_T_ID27 35.1816
NEBULA_T_ID28 35.0658
NEBULA_T_ID29 35.0873
NEBULA_T_ID30 35.1039
NEBULA_T_ID31 34.6067
NEBULA_T_ID32 34.6076
NEBULA_T_ID33 34.862
NEBULA_T_ID34 34.4877
NEBULA_T_ID35 34.4975
NEBULA_T_ID36 34.4971
NEBULA_T_ID37 34.7477
NEBULA_T_ID38 34.2818
NEBULA_T_ID39 34.6409
NEBULA_T_ID40 34.2638
NEBULA_T_ID41 34.5886
NEBULA_T_ID42 34.4999
NEBULA_T_ID43 35.0054
NEBULA_T_ID44 34.7799
NEBULA_T_ID45 34.7292
NEBULA_T_ID46 34.5549
NEBULA_T_ID47 34.6511
NEBULA_T_ID48 34.9767
NEBULA_T_ID49 34.4121
NEBULA_T_ID50 34.7922
NEBULA_T_ID51 34.5915
NEBULA_T_ID52 34.6975
NEBULA_T_ID53 35.0689
NEBULA_T_ID54 34.7948
NEBULA_T_ID55 34.6392
NEBULA_T_ID56 34.7534
NEBULA_T_ID57 35.1284
NEBULA_T_ID58 35.4314
NEBULA_T_ID59 35.3455
NEBULA_T_ID60 35.3207
NEBULA_T_ID61 34.2079
NEBULA_T_ID62 34.3236
NEBULA_T_ID63 35.7209
NEBULA_T_ID64 34.7389
NEBULA_T_ID65 35.0687
NEBULA_T_ID66 35.4752
NEBULA_T_ID67 35.0603
NEBULA_T_ID68 34.2005
NEBULA_T_ID69 33.6966
NEBULA_T_ID70 34.8085
NEBULA_T_ID71 34.4027
NEBULA_T_ID72 34.1083
NEBULA_T_ID73 34.7039
NEBULA_T_ID74 34.4356
NEBULA_T_ID75 34.3117
NEBULA_T_ID76 35.085
NEBULA_T_ID77 35.0264
NEBULA_T_ID78 33.7459
NEBULA_T_ID79 34.3353
NEBULA_T_ID80 35.0204
NEBULA_T_ID81 34.8225
NEBULA_T_ID82 33.1864
NEBULA_T_ID83 34.8137
NEBULA_T_ID84 34.404
NEBULA_T_ID85 33.5315
NEBULA_T_ID86 34.8705
NEBULA_T_ID87 34.3997
NEBULA_T_ID88 33.2526
NEBULA_T_ID89 34.7098
NEBULA_T_ID90 34.3216
NEBULA_T_ID92 31.9321
NEBULA_T_ID93 34.6501
NEBULA_T_ID94 34.3427
NEBULA_T_ID95 34.6861
NEBULA_T_ID96 34.8366
NEBULA_T_ID97 34.832
NEBULA_T_ID98 35.1193
NEBULA_T_ID99 35.172
NEBULA_T_ID100 35.275
NEBULA_T_ID101 34.459
NEBULA_T_ID102 34.5771
NEBULA_T_ID103 34.926
NEBULA_T_ID104 34.548
NEBULA_T_ID105 35.1097
NEBULA_T_ID106 35.1887
NEBULA_T_ID107 35.0866
NEBULA_T_ID108 34.6665
NEBULA_T_ID109 34.5351
NEBULA_T_ID110 33.65
NEBULA_T_ID111 34.8446
NEBULA_T_ID112 34.9961
NEBULA_T_ID113 34.6419
NEBULA_T_ID114 35.2164
NEBULA_T_ID115 33.7334
NEBULA_T_ID116 34.3578
NEBULA_T_ID117 35.7166
NEBULA_T_ID118 34.5191
NEBULA_T_ID119 35.471
NEBULA_T_ID120 35.0177
NEBULA_T_ID121 33.6312
NEBULA_T_ID122 34.3798
NEBULA_T_ID123 34.6003
NEBULA_T_ID124 34.3961
NEBULA_T_ID125 35.5018
NEBULA_T_ID126 23.4914
NEBULA_T_ID127 34.5968
NEBULA_T_ID128 32.6766
NEBULA_T_ID129 34.45
NEBULA_T_ID130 34.1432
NEBULA_T_ID131 24.0027
NEBULA_T_ID132 32.7579
NEBULA_T_ID133 35.3537
NEBULA_T_ID134 34.55
NEBULA_T_ID135 36.1924
NEBULA_T_ID136 34.9019
NEBULA_T_ID137 32.7547
NEBULA_T_ID138 25.6774
NEBULA_T_ID139 28.3729
NEBULA_T_ID140 19.0246
NEBULA_T_ID141 32.7578
NEBULA_T_ID142 28.4096
NEBULA_T_ID143 28.9315
NEBULA_T_ID144 31.2423
NEBULA_T_ID91 34.6
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment