00001 //--------------------------------------------------------------------------- 00002 //Description: Sensitive detector definition for Monitor 00003 //Author: Wu Chen(wuchen@mail.ihep.ac.cn) 00004 //Created: 17 Oct, 2012 00005 //Comment: 00006 //---------------------------------------------------------------------------// 00007 00008 #ifndef MonitorSD_h 00009 #define MonitorSD_h 1 00010 00011 #include "myglobals.hh" 00012 00013 #include <iostream> 00014 #include <vector> 00015 00016 #include "MonitorHit.hh" 00017 #include "MySD.hh" 00018 00019 class G4Step; 00020 class G4HCofThisEvent; 00021 class MyVGeometryParameter; 00022 class PrimaryGeneratorAction; 00023 00024 class MonitorSD : public MySD 00025 { 00026 public: 00027 MonitorSD(G4String, MyVGeometryParameter*); 00028 virtual ~MonitorSD(); 00029 00030 void Initialize(G4HCofThisEvent*); 00031 G4bool ProcessHits(G4Step*, G4TouchableHistory*); 00032 void EndOfEvent(G4HCofThisEvent*); 00033 00034 //inherit from MySD 00035 void SetBranch(); 00036 00037 void ReadOutputCard(G4String filename); 00038 00039 //=> Access 00040 double Get_m_Ox( int i ) { return m_Ox[i]; } 00041 double Get_m_local_Ox( int i ) { return m_local_Ox[i]; } 00042 double Get_m_Oy( int i ) { return m_Oy[i]; } 00043 double Get_m_local_Oy( int i ) { return m_local_Oy[i]; } 00044 double Get_m_Oz( int i ) { return m_Oz[i]; } 00045 double Get_m_local_Oz( int i ) { return m_local_Oz[i]; } 00046 double Get_m_Ot( int i ) { return m_Ot[i]; } 00047 double Get_m_x( int i ) { return m_x[i]; } 00048 double Get_m_local_x( int i ) { return m_local_x[i]; } 00049 double Get_m_y( int i ) { return m_y[i]; } 00050 double Get_m_local_y( int i ) { return m_local_y[i]; } 00051 double Get_m_z( int i ) { return m_z[i]; } 00052 double Get_m_local_z( int i ) { return m_local_z[i]; } 00053 double Get_m_t( int i ) { return m_t[i]; } 00054 double Get_m_Opx( int i ) { return m_Opx[i]; } 00055 double Get_m_Opy( int i ) { return m_Opy[i]; } 00056 double Get_m_Opz( int i ) { return m_Opz[i]; } 00057 double Get_m_px( int i ) { return m_px[i]; } 00058 double Get_m_py( int i ) { return m_py[i]; } 00059 double Get_m_pz( int i ) { return m_pz[i]; } 00060 double Get_m_ox( int i ) { return m_ox[i]; } 00061 double Get_m_local_ox( int i ) { return m_local_ox[i]; } 00062 double Get_m_oy( int i ) { return m_oy[i]; } 00063 double Get_m_local_oy( int i ) { return m_local_oy[i]; } 00064 double Get_m_oz( int i ) { return m_oz[i]; } 00065 double Get_m_local_oz( int i ) { return m_local_oz[i]; } 00066 double Get_m_ot( int i ) { return m_ot[i]; } 00067 double Get_m_opx( int i ) { return m_opx[i]; } 00068 double Get_m_opy( int i ) { return m_opy[i]; } 00069 double Get_m_opz( int i ) { return m_opz[i]; } 00070 double Get_m_ekin( int i ) { return m_ekin[i]; } 00071 double Get_m_e( int i ) { return m_e[i]; } 00072 double Get_m_edep( int i ) { return m_edep[i]; } 00073 double Get_m_edepAll( int i ) { return m_edepAll[i]; } 00074 double Get_m_stepL( int i ) { return m_stepL[i]; } 00075 int Get_m_volID( int i ) { return m_volID[i]; } 00076 std::string Get_m_volName( int i ) { return m_volName[i]; } 00077 int Get_m_ppid( int i ) { return m_ppid[i]; } 00078 int Get_m_ptid( int i ) { return m_ptid[i]; } 00079 std::string Get_m_oprocess( int i ) { return m_oprocess[i]; } 00080 std::string Get_m_ovolName( int i ) { return m_ovolName[i]; } 00081 int Get_m_tid( int i ) { return m_tid[i]; } 00082 int Get_m_pid( int i ) { return m_pid[i]; } 00083 int Get_m_charge( int i ) { return m_charge[i]; } 00084 int Get_m_stopped( int i ) { return m_stopped[i]; } 00085 double Get_m_stop_time( int i ) { return m_stop_time[i]; } 00086 int Get_m_killed( int i ) { return m_killed[i]; } 00087 double Get_m_kill_time( int i ) { return m_kill_time[i]; } 00088 std::string Get_unitName_Ox() { return unitName_Ox; } 00089 std::string Get_unitName_local_Ox() { return unitName_local_Ox; } 00090 std::string Get_unitName_Oy() { return unitName_Oy; } 00091 std::string Get_unitName_local_Oy() { return unitName_local_Oy; } 00092 std::string Get_unitName_Oz() { return unitName_Oz; } 00093 std::string Get_unitName_local_Oz() { return unitName_local_Oz; } 00094 std::string Get_unitName_Ot() { return unitName_Ot; } 00095 std::string Get_unitName_x() { return unitName_x; } 00096 std::string Get_unitName_local_x() { return unitName_local_x; } 00097 std::string Get_unitName_y() { return unitName_y; } 00098 std::string Get_unitName_local_y() { return unitName_local_y; } 00099 std::string Get_unitName_z() { return unitName_z; } 00100 std::string Get_unitName_local_z() { return unitName_local_z; } 00101 std::string Get_unitName_t() { return unitName_t; } 00102 std::string Get_unitName_Opx() { return unitName_Opx; } 00103 std::string Get_unitName_Opy() { return unitName_Opy; } 00104 std::string Get_unitName_Opz() { return unitName_Opz; } 00105 std::string Get_unitName_px() { return unitName_px; } 00106 std::string Get_unitName_py() { return unitName_py; } 00107 std::string Get_unitName_pz() { return unitName_pz; } 00108 std::string Get_unitName_ox() { return unitName_ox; } 00109 std::string Get_unitName_local_ox() { return unitName_local_ox; } 00110 std::string Get_unitName_oy() { return unitName_oy; } 00111 std::string Get_unitName_local_oy() { return unitName_local_oy; } 00112 std::string Get_unitName_oz() { return unitName_oz; } 00113 std::string Get_unitName_local_oz() { return unitName_local_oz; } 00114 std::string Get_unitName_ot() { return unitName_ot; } 00115 std::string Get_unitName_opx() { return unitName_opx; } 00116 std::string Get_unitName_opy() { return unitName_opy; } 00117 std::string Get_unitName_opz() { return unitName_opz; } 00118 std::string Get_unitName_ekin() { return unitName_ekin; } 00119 std::string Get_unitName_e() { return unitName_e; } 00120 std::string Get_unitName_edep() { return unitName_edep; } 00121 std::string Get_unitName_edepAll() { return unitName_edepAll; } 00122 std::string Get_unitName_stepL() { return unitName_stepL; } 00123 std::string Get_unitName_stop_time() { return unitName_stop_time; } 00124 std::string Get_unitName_kill_time() { return unitName_kill_time; } 00125 double Get_unit_Ox() { return unit_Ox; } 00126 double Get_unit_local_Ox() { return unit_local_Ox; } 00127 double Get_unit_Oy() { return unit_Oy; } 00128 double Get_unit_local_Oy() { return unit_local_Oy; } 00129 double Get_unit_Oz() { return unit_Oz; } 00130 double Get_unit_local_Oz() { return unit_local_Oz; } 00131 double Get_unit_Ot() { return unit_Ot; } 00132 double Get_unit_x() { return unit_x; } 00133 double Get_unit_local_x() { return unit_local_x; } 00134 double Get_unit_y() { return unit_y; } 00135 double Get_unit_local_y() { return unit_local_y; } 00136 double Get_unit_z() { return unit_z; } 00137 double Get_unit_local_z() { return unit_local_z; } 00138 double Get_unit_t() { return unit_t; } 00139 double Get_unit_Opx() { return unit_Opx; } 00140 double Get_unit_Opy() { return unit_Opy; } 00141 double Get_unit_Opz() { return unit_Opz; } 00142 double Get_unit_px() { return unit_px; } 00143 double Get_unit_py() { return unit_py; } 00144 double Get_unit_pz() { return unit_pz; } 00145 double Get_unit_ox() { return unit_ox; } 00146 double Get_unit_local_ox() { return unit_local_ox; } 00147 double Get_unit_oy() { return unit_oy; } 00148 double Get_unit_local_oy() { return unit_local_oy; } 00149 double Get_unit_oz() { return unit_oz; } 00150 double Get_unit_local_oz() { return unit_local_oz; } 00151 double Get_unit_ot() { return unit_ot; } 00152 double Get_unit_opx() { return unit_opx; } 00153 double Get_unit_opy() { return unit_opy; } 00154 double Get_unit_opz() { return unit_opz; } 00155 double Get_unit_ekin() { return unit_ekin; } 00156 double Get_unit_e() { return unit_e; } 00157 double Get_unit_edep() { return unit_edep; } 00158 double Get_unit_edepAll() { return unit_edepAll; } 00159 double Get_unit_stepL() { return unit_stepL; } 00160 double Get_unit_stop_time() { return unit_stop_time; } 00161 double Get_unit_kill_time() { return unit_kill_time; } 00162 int Get_nHits() { return nHits; } 00163 00164 private: 00165 00166 void ReSet(); 00167 void ShowOutCard(); 00168 00169 MonitorHitsCollection* hitsCollection; 00170 PrimaryGeneratorAction* pPrimaryGeneratorAction; 00171 00172 //For root objects 00173 std::vector<double> m_Ox; 00174 std::vector<double> m_local_Ox; 00175 std::vector<double> m_Oy; 00176 std::vector<double> m_local_Oy; 00177 std::vector<double> m_Oz; 00178 std::vector<double> m_local_Oz; 00179 std::vector<double> m_Ot; 00180 std::vector<double> m_x; 00181 std::vector<double> m_local_x; 00182 std::vector<double> m_y; 00183 std::vector<double> m_local_y; 00184 std::vector<double> m_z; 00185 std::vector<double> m_local_z; 00186 std::vector<double> m_t; 00187 std::vector<double> m_Opx; 00188 std::vector<double> m_Opy; 00189 std::vector<double> m_Opz; 00190 std::vector<double> m_px; 00191 std::vector<double> m_py; 00192 std::vector<double> m_pz; 00193 std::vector<double> m_ox; 00194 std::vector<double> m_local_ox; 00195 std::vector<double> m_oy; 00196 std::vector<double> m_local_oy; 00197 std::vector<double> m_oz; 00198 std::vector<double> m_local_oz; 00199 std::vector<double> m_ot; 00200 std::vector<double> m_opx; 00201 std::vector<double> m_opy; 00202 std::vector<double> m_opz; 00203 std::vector<double> m_ekin; 00204 std::vector<double> m_e; 00205 std::vector<double> m_edep; 00206 std::vector<double> m_edepAll; 00207 std::vector<double> m_stepL; 00208 std::vector<int> m_volID; 00209 std::vector<std::string> m_volName; 00210 std::vector<int> m_ppid; 00211 std::vector<int> m_ptid; 00212 std::vector<std::string> m_oprocess; 00213 std::vector<std::string> m_ovolName; 00214 std::vector<int> m_tid; 00215 std::vector<int> m_pid; 00216 std::vector<std::string> m_particleName; 00217 std::vector<int> m_charge; 00218 std::vector<int> m_stopped; 00219 std::vector<double> m_stop_time; 00220 std::vector<int> m_killed; 00221 std::vector<double> m_kill_time; 00222 std::string unitName_Ox; 00223 std::string unitName_local_Ox; 00224 std::string unitName_Oy; 00225 std::string unitName_local_Oy; 00226 std::string unitName_Oz; 00227 std::string unitName_local_Oz; 00228 std::string unitName_Ot; 00229 std::string unitName_x; 00230 std::string unitName_local_x; 00231 std::string unitName_y; 00232 std::string unitName_local_y; 00233 std::string unitName_z; 00234 std::string unitName_local_z; 00235 std::string unitName_t; 00236 std::string unitName_Opx; 00237 std::string unitName_Opy; 00238 std::string unitName_Opz; 00239 std::string unitName_px; 00240 std::string unitName_py; 00241 std::string unitName_pz; 00242 std::string unitName_ox; 00243 std::string unitName_local_ox; 00244 std::string unitName_oy; 00245 std::string unitName_local_oy; 00246 std::string unitName_oz; 00247 std::string unitName_local_oz; 00248 std::string unitName_ot; 00249 std::string unitName_opx; 00250 std::string unitName_opy; 00251 std::string unitName_opz; 00252 std::string unitName_ekin; 00253 std::string unitName_e; 00254 std::string unitName_edep; 00255 std::string unitName_edepAll; 00256 std::string unitName_stepL; 00257 std::string unitName_stop_time; 00258 std::string unitName_kill_time; 00259 double unit_Ox; 00260 double unit_local_Ox; 00261 double unit_Oy; 00262 double unit_local_Oy; 00263 double unit_Oz; 00264 double unit_local_Oz; 00265 double unit_Ot; 00266 double unit_x; 00267 double unit_local_x; 00268 double unit_y; 00269 double unit_local_y; 00270 double unit_z; 00271 double unit_local_z; 00272 double unit_t; 00273 double unit_Opx; 00274 double unit_Opy; 00275 double unit_Opz; 00276 double unit_px; 00277 double unit_py; 00278 double unit_pz; 00279 double unit_ox; 00280 double unit_local_ox; 00281 double unit_oy; 00282 double unit_local_oy; 00283 double unit_oz; 00284 double unit_local_oz; 00285 double unit_ot; 00286 double unit_opx; 00287 double unit_opy; 00288 double unit_opz; 00289 double unit_ekin; 00290 double unit_e; 00291 double unit_edep; 00292 double unit_edepAll; 00293 double unit_stepL; 00294 double unit_stop_time; 00295 double unit_kill_time; 00296 00297 //for output setting 00298 int nHits; 00299 bool flag_nHits; 00300 bool flag_Ox; 00301 bool flag_local_Ox; 00302 bool flag_Oy; 00303 bool flag_local_Oy; 00304 bool flag_Oz; 00305 bool flag_local_Oz; 00306 bool flag_Ot; 00307 bool flag_x; 00308 bool flag_local_x; 00309 bool flag_y; 00310 bool flag_local_y; 00311 bool flag_z; 00312 bool flag_local_z; 00313 bool flag_t; 00314 bool flag_Opx; 00315 bool flag_Opy; 00316 bool flag_Opz; 00317 bool flag_px; 00318 bool flag_py; 00319 bool flag_pz; 00320 bool flag_ox; 00321 bool flag_local_ox; 00322 bool flag_oy; 00323 bool flag_local_oy; 00324 bool flag_oz; 00325 bool flag_local_oz; 00326 bool flag_ot; 00327 bool flag_opx; 00328 bool flag_opy; 00329 bool flag_opz; 00330 bool flag_ekin; 00331 bool flag_e; 00332 bool flag_edep; 00333 bool flag_edepAll; 00334 bool flag_stepL; 00335 bool flag_volID; 00336 bool flag_volName; 00337 bool flag_ppid; 00338 bool flag_ptid; 00339 bool flag_oprocess; 00340 bool flag_ovolName; 00341 bool flag_tid; 00342 bool flag_pid; 00343 bool flag_particleName; 00344 bool flag_charge; 00345 bool flag_stopped; 00346 bool flag_stop_time; 00347 bool flag_killed; 00348 bool flag_kill_time; 00349 //for filter 00350 bool Switch; 00351 bool neutralCut; 00352 bool needstopped; 00353 G4int maxn; 00354 G4double minp; 00355 G4double mine; 00356 G4double tres; 00357 G4double mint; 00358 G4double maxt; 00359 G4double minedep; 00360 std::vector<int> white_list; 00361 std::vector<int> black_list; 00362 }; 00363 00364 #endif 00365