| 1 |
#include <iostream> |
| 2 |
#include "TObject.h" |
| 3 |
|
| 4 |
using namespace std; |
| 5 |
|
| 6 |
#ifndef OPT_INIT_MODE_H |
| 7 |
#define OPT_INIT_MODE_H |
| 8 |
|
| 9 |
|
| 10 |
#include "TSystem.h" |
| 11 |
|
| 12 |
struct pInitModeOpt : public TObject { |
| 13 |
TString fg4Config_path, fg4Config_C_name, fg4Config_in_name; |
| 14 |
Bool_t fuse_pbs_jobcookie, fuse_nocalo; |
| 15 |
TString fout_tmp_dir, fout_path, fout_file_pattern; |
| 16 |
|
| 17 |
pInitModeOpt( TString g4Config_path, TString g4Config_C_name, TString g4Config_in_name, Bool_t use_pbs_jobcookie, Bool_t use_nocalo, |
| 18 |
TString out_tmp_dir, TString out_path, TString out_file_pattern): |
| 19 |
fg4Config_path(g4Config_path), fg4Config_C_name(g4Config_C_name), fg4Config_in_name(g4Config_in_name), fuse_pbs_jobcookie(use_pbs_jobcookie), fuse_nocalo(use_nocalo), |
| 20 |
fout_tmp_dir(out_tmp_dir), fout_path(out_path), fout_file_pattern(out_file_pattern) {}; |
| 21 |
|
| 22 |
virtual void Print(const Option_t* = "") const { |
| 23 |
cout<<"--->Init Options: "<<endl; |
| 24 |
cout<<" g4Config macro: "<<fg4Config_path<<"/"<<fg4Config_C_name<<endl; |
| 25 |
cout<<" G4 extra macro: "<<fg4Config_path<<"/"<<fg4Config_in_name<<endl; |
| 26 |
cout<<" use PBS cookie: "<<fuse_pbs_jobcookie<<endl; |
| 27 |
if ( fuse_pbs_jobcookie ) cout <<" temp path: "<< fout_tmp_dir<<endl; |
| 28 |
cout<<" use NoCalo: "<<fuse_nocalo<<endl; |
| 29 |
cout<<" output ROOT-file: "<<fout_path<<"/"<<fout_file_pattern<<".root"<<endl; |
| 30 |
cout<<" output PAM-file: "<<fout_path<<"/"<<fout_file_pattern<<".pam"<<endl; |
| 31 |
}; |
| 32 |
}; |
| 33 |
|
| 34 |
#endif //OPT_INIT_MODE_H |
| 35 |
|
| 36 |
|
| 37 |
#ifndef OPT_RND_MODE_H |
| 38 |
#define OPT_RND_MODE_H |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
struct pRandomModeOpt : public TObject { |
| 43 |
Bool_t fread_from_file_mode; /* 0 - generate, 1 - read from file */ |
| 44 |
TString fread_g4_seed_path; /* full path to root-file with g4random engine snapshots */ |
| 45 |
Bool_t fgenerate_g4_seed_user; /* 1 - generate random use user-defined seeds, 0 - autogenerate them */ |
| 46 |
Int_t fseed1, fseed2; |
| 47 |
Bool_t fwrite_to_file_mode; /* 0 - don't save g4 random snapshots into root-file, 1 - do it */ |
| 48 |
TString fwrite_g4_rnd_path, fwrite_g4_rnd_filename; /* path and filename with g4 random snapshots */ |
| 49 |
|
| 50 |
|
| 51 |
pRandomModeOpt( Bool_t read_from_file_mode, TString read_g4_seed_path, Bool_t generate_g4_seed_user, |
| 52 |
Int_t seed1, Int_t seed2, Bool_t write_to_file_mode, |
| 53 |
TString write_g4_rnd_path, TString write_g4_rnd_filename ): |
| 54 |
fread_from_file_mode( read_from_file_mode), fread_g4_seed_path(read_g4_seed_path), fgenerate_g4_seed_user(generate_g4_seed_user), |
| 55 |
fseed1(seed1), fseed2(seed2), fwrite_to_file_mode(write_to_file_mode),fwrite_g4_rnd_path(write_g4_rnd_path), fwrite_g4_rnd_filename(write_g4_rnd_filename) {}; |
| 56 |
|
| 57 |
virtual void Print(const Option_t* = "") const { |
| 58 |
TString tt; |
| 59 |
if ( fread_from_file_mode ) tt = "read from file: "; else tt = "generate "; |
| 60 |
cout<<"--->Random Options: "<<endl; |
| 61 |
cout<<" G4Random numbers will "<<tt; |
| 62 |
if ( fread_from_file_mode ){ |
| 63 |
cout << fread_g4_seed_path <<endl; |
| 64 |
} else { |
| 65 |
if ( fwrite_to_file_mode ) cout<<"and written in file: "<<fwrite_g4_rnd_path<<"/"<<fwrite_g4_rnd_filename<<endl; else cout<<endl; |
| 66 |
} |
| 67 |
if( fgenerate_g4_seed_user ){ |
| 68 |
tt = "user-defined random seed numbers: "; |
| 69 |
tt += fseed1; |
| 70 |
tt += ", "; |
| 71 |
tt += fseed2; |
| 72 |
} else tt = " random seed numbers will be generated automatically via TRandom3(0) object"; |
| 73 |
if (!fread_from_file_mode ) cout<<" Generation mode: "<<tt<<endl; |
| 74 |
}; |
| 75 |
}; |
| 76 |
|
| 77 |
#endif //OPT_RND_MODE_H |
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
#ifndef OPT_RUN_MODE_H |
| 82 |
#define OPT_RUN_MODE_H |
| 83 |
enum Save_cond { EVERYTHING, TRIG_ONLY, ACCEPT_ONLY}; |
| 84 |
enum Save_mode { ALL_DETECTORS, ONLY_PRIMARIES }; |
| 85 |
|
| 86 |
struct pRuntimeModeOpt : public TObject { |
| 87 |
Int_t fverbose_lev; //verbose level |
| 88 |
Int_t fmaxstep; //maximum number of allowed steps for a given particle |
| 89 |
Save_cond fsv_c; //condition to save given event |
| 90 |
Save_mode fsv_m; //what information I wish to save |
| 91 |
|
| 92 |
pRuntimeModeOpt(Int_t verbose_lev, Int_t maxstep, Save_cond sv_c, Save_mode sv_m): fverbose_lev(verbose_lev), fmaxstep(maxstep), fsv_c(sv_c), fsv_m(sv_m){; }; |
| 93 |
|
| 94 |
virtual void Print(const Option_t* = "") const { |
| 95 |
cout<<"--->Runtime Options: "<<endl; |
| 96 |
cout<<" Verbose level: "<<fverbose_lev<<endl; |
| 97 |
cout<<" Max number of steps: "<<fmaxstep<<endl; |
| 98 |
TString tt=""; |
| 99 |
if(fsv_c == EVERYTHING) tt = "EVERYTHING"; |
| 100 |
if(fsv_c == TRIG_ONLY) tt = "TRIG_ONLY"; |
| 101 |
if(fsv_c == ACCEPT_ONLY) tt = "ACCEPT_ONLY"; |
| 102 |
cout<<" Save condition: "<<tt<<endl; |
| 103 |
tt=""; |
| 104 |
if(fsv_m == ALL_DETECTORS) tt = "ALL_DETECTORS"; |
| 105 |
if(fsv_m == ONLY_PRIMARIES) tt = "ONLY_PRIMARIES"; |
| 106 |
cout<<" Save mode: "<<tt<<endl; |
| 107 |
}; |
| 108 |
|
| 109 |
}; |
| 110 |
#endif //OPT_RUN_MODE_H |
| 111 |
|
| 112 |
|
| 113 |
#ifndef OPT_PRIMARY_MODE_H |
| 114 |
#define OPT_PRIMARY_MODE_H |
| 115 |
|
| 116 |
enum Momentum_mode{ FIXED, FLAT, POWERLAW}; |
| 117 |
enum Momentum_units{ GV_p, GV_R, GeV_T}; |
| 118 |
enum Nevents_mode { NEV_TOT, NEV_ACCEPT, NEV_TRIGG }; |
| 119 |
|
| 120 |
struct pPrimaryModeOpt : public TObject { |
| 121 |
Bool_t fread_mode; // 0 - generate primary kinematics, 1 -read from file; |
| 122 |
TString fread_path; // path to file with primary kinematics |
| 123 |
Int_t fpdg; //PDG code of primary |
| 124 |
Bool_t fspt_mode; // 0 - dome; 1 - user defined angles and vertex point |
| 125 |
Bool_t fvert_mode; //0 - fixed point, 1 - vertex box |
| 126 |
Bool_t fang_mode; // 0 - fixed angle, 1 - isotropic |
| 127 |
Momentum_mode fmom_mode; // fixed, flat, powerlaw |
| 128 |
|
| 129 |
Momentum_units funits; // GV_p, GV_R, GeV |
| 130 |
Double_t fmom_fix; //Momentum, Rig, Kine |
| 131 |
Double_t fmom_min, fmom_max, fgamma; //momentum for flat case |
| 132 |
|
| 133 |
Nevents_mode fnv_m; //Total, accept, trigg |
| 134 |
Int_t fnevents; //number of events |
| 135 |
|
| 136 |
//Spatial and angular coordinates for fixed-isotropic case |
| 137 |
Double_t fx0, fy0, fz0, fx0_min, fx0_max, fy0_min, fy0_max, fz0_min, fz0_max; |
| 138 |
Double_t ftheta, fphi, ftheta_min, ftheta_max, fphi_min, fphi_max; |
| 139 |
|
| 140 |
pPrimaryModeOpt(Bool_t read_mode, TString read_path, Int_t pdg, Bool_t spt_mode, Bool_t vert_mode, Bool_t ang_mode, |
| 141 |
Momentum_mode mom_mode, Momentum_units units, Double_t mom_fix, Double_t mom_min, Double_t mom_max, |
| 142 |
Double_t gamma, Nevents_mode nv_m, Int_t nevents, Double_t x0, Double_t y0, Double_t z0, |
| 143 |
Double_t x0_min, Double_t x0_max, Double_t y0_min, Double_t y0_max, Double_t z0_min, Double_t z0_max, |
| 144 |
Double_t theta, Double_t phi, Double_t theta_min, Double_t theta_max, Double_t phi_min, Double_t phi_max): |
| 145 |
fread_mode(read_mode), fread_path(read_path), fpdg(pdg), fspt_mode(spt_mode), fvert_mode(vert_mode), fang_mode(ang_mode), |
| 146 |
fmom_mode(mom_mode), funits(units), fmom_fix(mom_fix), fmom_min(mom_min), fmom_max(mom_max), fgamma(gamma), |
| 147 |
fnv_m(nv_m), fnevents(nevents), fx0(x0), fy0(y0), fz0(z0), fx0_min(x0_min), fx0_max(x0_max), fy0_min(y0_min), fy0_max(y0_max), |
| 148 |
fz0_min(z0_min),fz0_max(z0_max), ftheta(theta), fphi(phi), ftheta_min(theta_min), ftheta_max(theta_max), |
| 149 |
fphi_min(phi_min), fphi_max(phi_max){ ; } |
| 150 |
|
| 151 |
virtual void Print(const Option_t* = "") const { |
| 152 |
cout<<"--->Primary Options: "<<endl; |
| 153 |
if( fread_mode ){ |
| 154 |
cout<<" Reading kinematics from file: "<<fread_path<<endl; |
| 155 |
cout<<" NEVENTS to process: all events from file"<<endl; |
| 156 |
} else { |
| 157 |
cout<<" PDG: "<<fpdg<<endl; |
| 158 |
if(! fspt_mode ) { |
| 159 |
cout<<" Spatial distribution: Generation Over the Dome (GOD mode) "<<endl; |
| 160 |
} else { |
| 161 |
cout<<" Spatial distribution: User-defined "<<endl; |
| 162 |
if( fvert_mode ){ |
| 163 |
cout<<" Vertex distribution: Parallelepiped ( x_min, x_max, y_min, y_max, z_min, z_max) = (" |
| 164 |
<<fx0_min<<", "<<fx0_max<<", "<<fy0_min<<", "<<fy0_max<<", "<<fz0_min<<", "<<fz0_max<<" ) (cm)"<<endl; |
| 165 |
} else { |
| 166 |
cout<<" Vertex distribution: Fixed Point ( "<<fx0<<", "<<fy0<<", "<<fz0<<" ) (cm)"<<endl; |
| 167 |
|
| 168 |
} |
| 169 |
if( fang_mode ){ |
| 170 |
cout<<" Angular distribution: Isotropic (theta_min, theta_max, phi_min, phi_max) = ( " |
| 171 |
<<ftheta_min<<", "<<ftheta_max<<", "<<fphi_min<<", "<<fphi_max<<" ) (rad)"<<endl; |
| 172 |
} else { |
| 173 |
cout<<" Angular distribution: Fixed Angles (theta, phi) = ( "<<ftheta<<", "<<fphi<<" ) (rad)"<<endl; |
| 174 |
} |
| 175 |
} |
| 176 |
TString un; |
| 177 |
TString un_det; |
| 178 |
if (funits == GV_p){ |
| 179 |
un = "GV (p)"; |
| 180 |
un_det = "Momentum"; |
| 181 |
} |
| 182 |
if (funits == GV_R){ |
| 183 |
un = "GV (R)"; |
| 184 |
un_det = "Rigidity"; |
| 185 |
} |
| 186 |
if (funits == GeV_T){ |
| 187 |
un = "GeV_T"; |
| 188 |
un_det = "Kinetic energy"; |
| 189 |
} |
| 190 |
if( fmom_mode == FIXED ){ |
| 191 |
cout<<" "<<un_det<<" distribution: Fixed "<< fmom_fix<<" "<<un<<endl; |
| 192 |
} |
| 193 |
if( fmom_mode == FLAT ){ |
| 194 |
cout<<" "<<un_det<<" distribution: Flat ( "<<fmom_min<<", "<<fmom_max<<" ) "<<un<<endl; |
| 195 |
} |
| 196 |
if( fmom_mode == POWERLAW ){ |
| 197 |
cout<<" "<<un_det<<" distribution: Power-law ( "<<fmom_min<<", "<<fmom_max<<" ) "<<un<<" gamma: "<<fgamma<<endl; |
| 198 |
} |
| 199 |
|
| 200 |
TString nev_cond; |
| 201 |
if( fnv_m == NEV_TOT ) nev_cond = " TOTAL"; |
| 202 |
if( fnv_m == NEV_ACCEPT ) nev_cond = " IN ACCEPTANCE"; |
| 203 |
if( fnv_m == NEV_TRIGG ) nev_cond = " TRIGGERED"; |
| 204 |
cout<<" NEVENTS to process: "<<fnevents<<nev_cond<<endl; |
| 205 |
} |
| 206 |
} |
| 207 |
}; |
| 208 |
#endif //OPT_PRIMARY_MODE_H |