00001
00002
00003
00004
00005
00006
00007
00008 #include "myglobals.hh"
00009 #include "G4DigiManager.hh"
00010 #include "G4HCofThisEvent.hh"
00011 #include "G4Step.hh"
00012 #include "G4ThreeVector.hh"
00013 #include "G4SDManager.hh"
00014 #include "G4TransportationManager.hh"
00015 #include "G4FieldManager.hh"
00016 #include "G4MagneticField.hh"
00017 #include "G4UnitsTable.hh"
00018 #include "G4ios.hh"
00019 #include "G4RunManager.hh"
00020 #include "G4TrackStatus.hh"
00021
00022 #include "CLHEP/Geometry/Vector3D.h"
00023 #include "CLHEP/Geometry/Point3D.h"
00024
00025 #include "TVector3.h"
00026
00027 #include <iostream>
00028
00029 #include "MyString2Anything.hh"
00030 #include "SimpleGeometryParameter.hh"
00031 #include "MonitorHit.hh"
00032 #include "MyRoot.hh"
00033 #include "MySD.hh"
00034 #include "McTruthSvc.hh"
00035 #include "PrimaryGeneratorAction.hh"
00036
00037 #include "MonitorSD.hh"
00038
00039 #ifndef ENABLE_BACKWARDS_COMPATIBILITY
00040 typedef HepGeom::Point3D<double> HepPoint3D;
00041 typedef HepGeom::Vector3D<double> HepVector3D;
00042 #endif
00043
00044 MonitorSD::MonitorSD(G4String name, MyVGeometryParameter* pointer)
00045 :MySD(name, pointer), hitsCollection(0)
00046 {}
00047
00048 MonitorSD::~MonitorSD(){
00049 }
00050
00051
00052
00053 void MonitorSD::Initialize(G4HCofThisEvent* HCE)
00054 {
00055 pPrimaryGeneratorAction = PrimaryGeneratorAction::GetPrimaryGeneratorAction();
00056 hitsCollection = new MonitorHitsCollection
00057 (SensitiveDetectorName,collectionName[0]);
00058
00059 G4int HCID = -1;
00060 HCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
00061 if ( HCID < 0 ){
00062 G4Exception("MonitorSD::Initialize()",
00063 "InvalidSetup", FatalException,
00064 "Cann not find hitsCollection of this event");
00065 }
00066 HCE->AddHitsCollection( HCID, hitsCollection );
00067
00068 nHits = 0;
00069 m_Ox.clear();
00070 m_local_Ox.clear();
00071 m_Oy.clear();
00072 m_local_Oy.clear();
00073 m_Oz.clear();
00074 m_local_Oz.clear();
00075 m_x.clear();
00076 m_local_x.clear();
00077 m_y.clear();
00078 m_local_y.clear();
00079 m_z.clear();
00080 m_local_z.clear();
00081 m_t.clear();
00082 m_Ot.clear();
00083 m_Opx.clear();
00084 m_Opy.clear();
00085 m_Opz.clear();
00086 m_px.clear();
00087 m_py.clear();
00088 m_pz.clear();
00089 m_ox.clear();
00090 m_local_ox.clear();
00091 m_oy.clear();
00092 m_local_oy.clear();
00093 m_oz.clear();
00094 m_local_oz.clear();
00095 m_ot.clear();
00096 m_opx.clear();
00097 m_opy.clear();
00098 m_opz.clear();
00099 m_ekin.clear();
00100 m_e.clear();
00101 m_edep.clear();
00102 m_edepAll.clear();
00103 m_stepL.clear();
00104 m_volID.clear();
00105 m_volName.clear();
00106 m_ppid.clear();
00107 m_ptid.clear();
00108 m_oprocess.clear();
00109 m_ovolName.clear();
00110 m_tid.clear();
00111 m_pid.clear();
00112 m_particleName.clear();
00113 m_charge.clear();
00114 m_stopped.clear();
00115 m_stop_time.clear();
00116 m_killed.clear();
00117 m_kill_time.clear();
00118 }
00119
00120
00121
00122 void MonitorSD::SetBranch(){
00123 if (!Switch) return;
00124 MyRoot* myRoot = MyRoot::GetMyRoot();
00125 G4String volName = get_VolName();
00126 if( flag_nHits ) myRoot->SetBranch(volName+"_nHits", &nHits);
00127 if( flag_Ox ) myRoot->SetBranch(volName+"_Ox", &m_Ox);
00128 if( flag_local_Ox ) myRoot->SetBranch(volName+"_local_Ox", &m_local_Ox);
00129 if( flag_Oy ) myRoot->SetBranch(volName+"_Oy", &m_Oy);
00130 if( flag_local_Oy ) myRoot->SetBranch(volName+"_local_Oy", &m_local_Oy);
00131 if( flag_Oz ) myRoot->SetBranch(volName+"_Oz", &m_Oz);
00132 if( flag_local_Oz ) myRoot->SetBranch(volName+"_local_Oz", &m_local_Oz);
00133 if( flag_Ot ) myRoot->SetBranch(volName+"_Ot", &m_Ot);
00134 if( flag_x ) myRoot->SetBranch(volName+"_x", &m_x);
00135 if( flag_local_x ) myRoot->SetBranch(volName+"_local_x", &m_local_x);
00136 if( flag_y ) myRoot->SetBranch(volName+"_y", &m_y);
00137 if( flag_local_y ) myRoot->SetBranch(volName+"_local_y", &m_local_y);
00138 if( flag_z ) myRoot->SetBranch(volName+"_z", &m_z);
00139 if( flag_local_z ) myRoot->SetBranch(volName+"_local_z", &m_local_z);
00140 if( flag_t ) myRoot->SetBranch(volName+"_t", &m_t);
00141 if( flag_Opx ) myRoot->SetBranch(volName+"_Opx", &m_Opx);
00142 if( flag_Opy ) myRoot->SetBranch(volName+"_Opy", &m_Opy);
00143 if( flag_Opz ) myRoot->SetBranch(volName+"_Opz", &m_Opz);
00144 if( flag_px ) myRoot->SetBranch(volName+"_px", &m_px);
00145 if( flag_py ) myRoot->SetBranch(volName+"_py", &m_py);
00146 if( flag_pz ) myRoot->SetBranch(volName+"_pz", &m_pz);
00147 if( flag_ox ) myRoot->SetBranch(volName+"_ox", &m_ox);
00148 if( flag_local_ox ) myRoot->SetBranch(volName+"_local_ox", &m_local_ox);
00149 if( flag_oy ) myRoot->SetBranch(volName+"_oy", &m_oy);
00150 if( flag_local_oy ) myRoot->SetBranch(volName+"_local_oy", &m_local_oy);
00151 if( flag_oz ) myRoot->SetBranch(volName+"_oz", &m_oz);
00152 if( flag_local_oz ) myRoot->SetBranch(volName+"_local_oz", &m_local_oz);
00153 if( flag_ot ) myRoot->SetBranch(volName+"_ot", &m_ot);
00154 if( flag_opx ) myRoot->SetBranch(volName+"_opx", &m_opx);
00155 if( flag_opy ) myRoot->SetBranch(volName+"_opy", &m_opy);
00156 if( flag_opz ) myRoot->SetBranch(volName+"_opz", &m_opz);
00157 if( flag_ekin ) myRoot->SetBranch(volName+"_ekin", &m_ekin);
00158 if( flag_e ) myRoot->SetBranch(volName+"_e", &m_e);
00159 if( flag_edep ) myRoot->SetBranch(volName+"_edep", &m_edep);
00160 if( flag_edepAll ) myRoot->SetBranch(volName+"_edepAll", &m_edepAll);
00161 if( flag_stepL ) myRoot->SetBranch(volName+"_stepL", &m_stepL);
00162 if( flag_volID ) myRoot->SetBranch(volName+"_volID", &m_volID);
00163 if( flag_volName ) myRoot->SetBranch(volName+"_volName", &m_volName);
00164 if( flag_ppid) myRoot->SetBranch(volName+"_ppid", &m_ppid);
00165 if( flag_ptid) myRoot->SetBranch(volName+"_ptid", &m_ptid);
00166 if( flag_oprocess) myRoot->SetBranch(volName+"_oprocess", &m_oprocess);
00167 if( flag_ovolName) myRoot->SetBranch(volName+"_ovolName", &m_ovolName);
00168 if( flag_tid ) myRoot->SetBranch(volName+"_tid", &m_tid);
00169 if( flag_pid ) myRoot->SetBranch(volName+"_pid", &m_pid);
00170 if( flag_particleName ) myRoot->SetBranch(volName+"_particleName", &m_particleName);
00171 if( flag_charge ) myRoot->SetBranch(volName+"_charge", &m_charge);
00172 if( flag_stopped ) myRoot->SetBranch(volName+"_stopped", &m_stopped);
00173 if( flag_stop_time ) myRoot->SetBranch(volName+"_stop_time", &m_stop_time);
00174 if( flag_killed ) myRoot->SetBranch(volName+"_killed", &m_killed);
00175 if( flag_kill_time ) myRoot->SetBranch(volName+"_kill_time", &m_kill_time);
00176 }
00177
00178
00179
00180 void MonitorSD::ReadOutputCard(G4String filename){
00181 ReSet();
00182 std::ifstream fin_card(filename);
00183 if(!fin_card){
00184 std::cout<<"In MonitorSD::ReadOutputCard, cannot open "<<filename<<"!!!"<<std::endl;
00185 G4Exception("MonitorSD::ReadOutputCard()",
00186 "InvalidSetup", FatalException,
00187 "cannot find output card");
00188 }
00189 std::stringstream buf_card;
00190 G4String s_card;
00191 G4String volName = get_VolName();
00192 int n_output_section_symbol = 0;
00193 int n_filter_section_symbol = 0;
00194 G4String BRANCHSECTIONNAME = volName + "_SECTION";
00195 G4String FILTERSECTIONNAME = volName + "_FILTERSECTION";
00196 while(getline(fin_card,s_card)){
00197 buf_card.str("");
00198 buf_card.clear();
00199 buf_card<<s_card;
00200
00201
00202 const char* c_card = s_card.c_str();
00203 int length = strlen(c_card);
00204 int offset = 0;
00205 for ( ; offset < length; offset++ ){
00206 if ( c_card[offset] != ' ' ) break;
00207 }
00208 if ( c_card[offset] == '#' || (c_card[offset] == '/' && c_card[offset+1] == '/') || length - offset == 0 ){
00209 continue;
00210 }
00211
00212 G4String name, unit;
00213 buf_card>>name;
00214 if ( n_output_section_symbol == 0 ){
00215 if ( name == BRANCHSECTIONNAME ){
00216 n_output_section_symbol++;
00217 }
00218 }
00219 else if ( n_output_section_symbol == 1 ){
00220 if ( name == BRANCHSECTIONNAME ){
00221 n_output_section_symbol++;
00222 }
00223 else if( name == "nHits" ) {flag_nHits = true;}
00224 else if( name == "Ox" ) {{flag_Ox = true; buf_card>>unitName_Ox; unit_Ox = MyString2Anything::get_U(unitName_Ox);}}
00225 else if( name == "local_Ox" ) {{flag_local_Ox = true; buf_card>>unitName_local_Ox; unit_local_Ox = MyString2Anything::get_U(unitName_local_Ox);}}
00226 else if( name == "Oy" ) {{flag_Oy = true; buf_card>>unitName_Oy; unit_Oy = MyString2Anything::get_U(unitName_Oy);}}
00227 else if( name == "local_Oy" ) {{flag_local_Oy = true; buf_card>>unitName_local_Oy; unit_local_Oy = MyString2Anything::get_U(unitName_local_Oy);}}
00228 else if( name == "Oz" ) {{flag_Oz = true; buf_card>>unitName_Oz; unit_Oz = MyString2Anything::get_U(unitName_Oz);}}
00229 else if( name == "local_Oz" ) {{flag_local_Oz = true; buf_card>>unitName_local_Oz; unit_local_Oz = MyString2Anything::get_U(unitName_local_Oz);}}
00230 else if( name == "Ot" ) {{flag_Ot = true; buf_card>>unitName_Ot; unit_Ot = MyString2Anything::get_U(unitName_Ot);}}
00231 else if( name == "x" ) {{flag_x = true; buf_card>>unitName_x; unit_x = MyString2Anything::get_U(unitName_x);}}
00232 else if( name == "local_x" ) {{flag_local_x = true; buf_card>>unitName_local_x; unit_local_x = MyString2Anything::get_U(unitName_local_x);}}
00233 else if( name == "y" ) {{flag_y = true; buf_card>>unitName_y; unit_y = MyString2Anything::get_U(unitName_y);}}
00234 else if( name == "local_y" ) {{flag_local_y = true; buf_card>>unitName_local_y; unit_local_y = MyString2Anything::get_U(unitName_local_y);}}
00235 else if( name == "z" ) {{flag_z = true; buf_card>>unitName_z; unit_z = MyString2Anything::get_U(unitName_z);}}
00236 else if( name == "local_z" ) {{flag_local_z = true; buf_card>>unitName_local_z; unit_local_z = MyString2Anything::get_U(unitName_local_z);}}
00237 else if( name == "t" ) {{flag_t = true; buf_card>>unitName_t; unit_t = MyString2Anything::get_U(unitName_t);}}
00238 else if( name == "Opx" ) {{flag_Opx = true; buf_card>>unitName_Opx; unit_Opx = MyString2Anything::get_U(unitName_Opx);}}
00239 else if( name == "Opy" ) {{flag_Opy = true; buf_card>>unitName_Opy; unit_Opy = MyString2Anything::get_U(unitName_Opy);}}
00240 else if( name == "Opz" ) {{flag_Opz = true; buf_card>>unitName_Opz; unit_Opz = MyString2Anything::get_U(unitName_Opz);}}
00241 else if( name == "px" ) {{flag_px = true; buf_card>>unitName_px; unit_px = MyString2Anything::get_U(unitName_px);}}
00242 else if( name == "py" ) {{flag_py = true; buf_card>>unitName_py; unit_py = MyString2Anything::get_U(unitName_py);}}
00243 else if( name == "pz" ) {{flag_pz = true; buf_card>>unitName_pz; unit_pz = MyString2Anything::get_U(unitName_pz);}}
00244 else if( name == "ox" ) {{flag_ox = true; buf_card>>unitName_ox; unit_ox = MyString2Anything::get_U(unitName_ox);}}
00245 else if( name == "local_ox" ) {{flag_local_ox = true; buf_card>>unitName_local_ox; unit_local_ox = MyString2Anything::get_U(unitName_local_ox);}}
00246 else if( name == "oy" ) {{flag_oy = true; buf_card>>unitName_oy; unit_oy = MyString2Anything::get_U(unitName_oy);}}
00247 else if( name == "local_oy" ) {{flag_local_oy = true; buf_card>>unitName_local_oy; unit_local_oy = MyString2Anything::get_U(unitName_local_oy);}}
00248 else if( name == "oz" ) {{flag_oz = true; buf_card>>unitName_oz; unit_oz = MyString2Anything::get_U(unitName_oz);}}
00249 else if( name == "local_oz" ) {{flag_local_oz = true; buf_card>>unitName_local_oz; unit_local_oz = MyString2Anything::get_U(unitName_local_oz);}}
00250 else if( name == "ot" ) {{flag_ot = true; buf_card>>unitName_ot; unit_ot = MyString2Anything::get_U(unitName_ot);}}
00251 else if( name == "opx" ) {{flag_opx = true; buf_card>>unitName_opx; unit_opx = MyString2Anything::get_U(unitName_opx);}}
00252 else if( name == "opy" ) {{flag_opy = true; buf_card>>unitName_opy; unit_opy = MyString2Anything::get_U(unitName_opy);}}
00253 else if( name == "opz" ) {{flag_opz = true; buf_card>>unitName_opz; unit_opz = MyString2Anything::get_U(unitName_opz);}}
00254 else if( name == "ekin" ) {{flag_ekin = true; buf_card>>unitName_ekin; unit_ekin = MyString2Anything::get_U(unitName_ekin);}}
00255 else if( name == "e" ) {{flag_e = true; buf_card>>unitName_e; unit_e = MyString2Anything::get_U(unitName_e);}}
00256 else if( name == "edep" ) {{flag_edep = true; buf_card>>unitName_edep; unit_edep = MyString2Anything::get_U(unitName_edep);}}
00257 else if( name == "edepAll" ) {{flag_edepAll = true; buf_card>>unitName_edepAll; unit_edepAll = MyString2Anything::get_U(unitName_edepAll);}}
00258 else if( name == "stepL" ) {{flag_stepL = true; buf_card>>unitName_stepL; unit_stepL = MyString2Anything::get_U(unitName_stepL);}}
00259 else if( name == "volID" ) {flag_volID = true;}
00260 else if( name == "volName" ) {flag_volName = true;}
00261 else if( name == "ppid" ) {flag_ppid = true;}
00262 else if( name == "ptid" ) {flag_ptid = true;}
00263 else if( name == "oprocess" ) {flag_oprocess = true;}
00264 else if( name == "ovolName" ) {flag_ovolName = true;}
00265 else if( name == "tid" ) {flag_tid = true;}
00266 else if( name == "pid" ) {flag_pid = true;}
00267 else if( name == "particleName" ) flag_particleName = true;
00268 else if( name == "charge" ) {flag_charge = true;}
00269 else if( name == "stopped" ) {flag_stopped = true;}
00270 else if( name == "stop_time" ) {{flag_stop_time = true; buf_card>>unitName_stop_time; unit_stop_time = MyString2Anything::get_U(unitName_stop_time);}}
00271 else if( name == "killed" ) {flag_killed = true;}
00272 else if( name == "kill_time" ) {{flag_kill_time = true; buf_card>>unitName_kill_time; unit_kill_time = MyString2Anything::get_U(unitName_kill_time);}}
00273 else{
00274 std::cout<<"In MonitorSD::ReadOutputCard, unknown name: "<<name<<" in file "<<filename<<std::endl;
00275 std::cout<<"Will ignore this line!"<<std::endl;
00276 }
00277 }
00278
00279 if ( n_filter_section_symbol == 0 ){
00280 if ( name == FILTERSECTIONNAME ){
00281 n_filter_section_symbol++;
00282 }
00283 }
00284 else if ( n_filter_section_symbol == 1 ){
00285 if ( name == FILTERSECTIONNAME ){
00286 n_filter_section_symbol++;
00287 }
00288 else if( name == "Switch" ) Switch = true;
00289 else if( name == "stopped" ) needstopped = true;
00290 else if( name == "neutralCut" ) neutralCut = true;
00291 else if( name == "maxn" ) buf_card>>maxn;
00292 else if( name == "WL" ){
00293 int pid = 0;
00294 buf_card>>pid;
00295 white_list.push_back(pid);
00296 }
00297 else if( name == "BL" ){
00298 int pid = 0;
00299 buf_card>>pid;
00300 black_list.push_back(pid);
00301 }
00302 else{
00303 G4double para;
00304 G4String unit;
00305 buf_card>>para>>unit;
00306 para *= MyString2Anything::get_U(unit);
00307 if( name == "minp" ) minp = para;
00308 else if( name == "mine" ) mine = para;
00309 else if ( name == "minedep" ) minedep = para;
00310 else if( name == "mint" ) mint = para;
00311 else if( name == "maxt" ) maxt = para;
00312
00313
00314
00315 else if( name == "tres" ) tres = para<0? 1e10*s : para ;
00316 else{
00317 std::cout<<"In MonitorSD::ReadOutputCard, unknown name: "<<name<<" in file "<<filename<<std::endl;
00318 std::cout<<"Will ignore this line!"<<std::endl;
00319 }
00320 }
00321 }
00322
00323 if ( n_output_section_symbol > 1 && n_filter_section_symbol > 1 ){
00324 break;
00325 }
00326 }
00327 buf_card.str("");
00328 buf_card.clear();
00329 if ( n_output_section_symbol <= 1 ){
00330 std::cout<<"*****************WARNING********************"<<std::endl;
00331 std::cout<<"In MonitorSD::ReadOutputCard, failed to find enough section seperators \""<<BRANCHSECTIONNAME<<"\" for output in file "<<filename<<std::endl;
00332 std::cout<<"Will use default settings."<<std::endl;
00333 std::cout<<"********************************************"<<std::endl;
00334 }
00335 if ( n_filter_section_symbol<= 1 ){
00336 std::cout<<"*****************WARNING********************"<<std::endl;
00337 std::cout<<"In MonitorSD::ReadOutputCard, failed to find enough section seperators \""<<FILTERSECTIONNAME<<"\" for filter in file "<<filename<<std::endl;
00338 std::cout<<"Will use default settings."<<std::endl;
00339 std::cout<<"********************************************"<<std::endl;
00340 }
00341 fin_card.close();
00342 ShowOutCard();
00343 }
00344
00345
00346
00347 void MonitorSD::ReSet(){
00348
00349 flag_nHits = false;
00350 flag_Ox = false;
00351 flag_local_Ox = false;
00352 flag_Oy = false;
00353 flag_local_Oy = false;
00354 flag_Oz = false;
00355 flag_local_Oz = false;
00356 flag_Ot = false;
00357 flag_x = false;
00358 flag_local_x = false;
00359 flag_y = false;
00360 flag_local_y = false;
00361 flag_z = false;
00362 flag_local_z = false;
00363 flag_t = false;
00364 flag_Opx = false;
00365 flag_Opy = false;
00366 flag_Opz = false;
00367 flag_px = false;
00368 flag_py = false;
00369 flag_pz = false;
00370 flag_ox = false;
00371 flag_local_ox = false;
00372 flag_oy = false;
00373 flag_local_oy = false;
00374 flag_oz = false;
00375 flag_local_oz = false;
00376 flag_ot = false;
00377 flag_opx = false;
00378 flag_opy = false;
00379 flag_opz = false;
00380 flag_ekin = false;
00381 flag_e = false;
00382 flag_edep = false;
00383 flag_edepAll = false;
00384 flag_stepL = false;
00385 flag_volID = false;
00386 flag_volName = false;
00387 flag_ppid = false;
00388 flag_ptid = false;
00389 flag_oprocess = false;
00390 flag_ovolName = false;
00391 flag_tid = false;
00392 flag_pid = false;
00393 flag_particleName = false;
00394 flag_charge = false;
00395 flag_stopped = false;
00396 flag_stop_time = false;
00397 flag_killed = false;
00398 flag_kill_time = false;
00399
00400 Switch = false;
00401 neutralCut = false;
00402 needstopped = false;
00403 minp = 0;
00404 mine = 0;
00405 maxn = 0;
00406 mint = 0;
00407 maxt = 0;
00408 tres = 0;
00409 minedep = -1*MeV;
00410 white_list.clear();
00411 black_list.clear();
00412
00413 unitName_Ox = "cm";
00414 unitName_local_Ox = "cm";
00415 unitName_Oy = "cm";
00416 unitName_local_Oy = "cm";
00417 unitName_Oz = "cm";
00418 unitName_local_Oz = "cm";
00419 unitName_Ot = "ns";
00420 unitName_x = "cm";
00421 unitName_local_x = "cm";
00422 unitName_y = "cm";
00423 unitName_local_y = "cm";
00424 unitName_z = "cm";
00425 unitName_local_z = "cm";
00426 unitName_t = "ns";
00427 unitName_Opx = "GeV";
00428 unitName_Opy = "GeV";
00429 unitName_Opz = "GeV";
00430 unitName_px = "GeV";
00431 unitName_py = "GeV";
00432 unitName_pz = "GeV";
00433 unitName_ox = "cm";
00434 unitName_local_ox = "cm";
00435 unitName_oy = "cm";
00436 unitName_local_oy = "cm";
00437 unitName_oz = "cm";
00438 unitName_local_oz = "cm";
00439 unitName_ot = "ns";
00440 unitName_opx = "GeV";
00441 unitName_opy = "GeV";
00442 unitName_opz = "GeV";
00443 unitName_ekin = "GeV";
00444 unitName_e = "GeV";
00445 unitName_edep = "GeV";
00446 unitName_edepAll = "GeV";
00447 unitName_stepL = "cm";
00448 unitName_stop_time = "ns";
00449 unitName_kill_time = "ns";
00450 unit_Ox = MyString2Anything::get_U(unitName_Ox);
00451 unit_local_Ox = MyString2Anything::get_U(unitName_local_Ox);
00452 unit_Oy = MyString2Anything::get_U(unitName_Oy);
00453 unit_local_Oy = MyString2Anything::get_U(unitName_local_Oy);
00454 unit_Oz = MyString2Anything::get_U(unitName_Oz);
00455 unit_local_Oz = MyString2Anything::get_U(unitName_local_Oz);
00456 unit_Ot = MyString2Anything::get_U(unitName_Ot);
00457 unit_x = MyString2Anything::get_U(unitName_x);
00458 unit_local_x = MyString2Anything::get_U(unitName_local_x);
00459 unit_y = MyString2Anything::get_U(unitName_y);
00460 unit_local_y = MyString2Anything::get_U(unitName_local_y);
00461 unit_z = MyString2Anything::get_U(unitName_z);
00462 unit_local_z = MyString2Anything::get_U(unitName_local_z);
00463 unit_t = MyString2Anything::get_U(unitName_t);
00464 unit_Opx = MyString2Anything::get_U(unitName_Opx);
00465 unit_Opy = MyString2Anything::get_U(unitName_Opy);
00466 unit_Opz = MyString2Anything::get_U(unitName_Opz);
00467 unit_px = MyString2Anything::get_U(unitName_px);
00468 unit_py = MyString2Anything::get_U(unitName_py);
00469 unit_pz = MyString2Anything::get_U(unitName_pz);
00470 unit_ox = MyString2Anything::get_U(unitName_ox);
00471 unit_local_ox = MyString2Anything::get_U(unitName_local_ox);
00472 unit_oy = MyString2Anything::get_U(unitName_oy);
00473 unit_local_oy = MyString2Anything::get_U(unitName_local_oy);
00474 unit_oz = MyString2Anything::get_U(unitName_oz);
00475 unit_local_oz = MyString2Anything::get_U(unitName_local_oz);
00476 unit_ot = MyString2Anything::get_U(unitName_ot);
00477 unit_opx = MyString2Anything::get_U(unitName_opx);
00478 unit_opy = MyString2Anything::get_U(unitName_opy);
00479 unit_opz = MyString2Anything::get_U(unitName_opz);
00480 unit_ekin = MyString2Anything::get_U(unitName_ekin);
00481 unit_e = MyString2Anything::get_U(unitName_e);
00482 unit_edep = MyString2Anything::get_U(unitName_edep);
00483 unit_edepAll = MyString2Anything::get_U(unitName_edepAll);
00484 unit_stepL = MyString2Anything::get_U(unitName_stepL);
00485 unit_stop_time = MyString2Anything::get_U(unitName_stop_time);
00486 unit_kill_time = MyString2Anything::get_U(unitName_kill_time);
00487 }
00488
00489
00490
00491 void MonitorSD::ShowOutCard(){
00492 std::cout<<"*************************Output settings for "<<get_VolName()<<"***************************"<<std::endl;
00493
00494 std::cout<<"output nHits? "<<(flag_nHits?" yes":" no")<<std::endl;
00495 std::cout<<"output Ox? "<<(flag_Ox?" yes":" no")<<", unit: "<<unitName_Ox<<std::endl;
00496 std::cout<<"output Ox? "<<(flag_local_Ox?" yes":" no")<<", unit: "<<unitName_local_Ox<<std::endl;
00497 std::cout<<"output Oy? "<<(flag_Oy?" yes":" no")<<", unit: "<<unitName_Oy<<std::endl;
00498 std::cout<<"output Oy? "<<(flag_local_Oy?" yes":" no")<<", unit: "<<unitName_local_Oy<<std::endl;
00499 std::cout<<"output Oz? "<<(flag_Oz?" yes":" no")<<", unit: "<<unitName_Oz<<std::endl;
00500 std::cout<<"output Oz? "<<(flag_local_Oz?" yes":" no")<<", unit: "<<unitName_local_Oz<<std::endl;
00501 std::cout<<"output Ot? "<<(flag_Ot?" yes":" no")<<", unit: "<<unitName_Ot<<std::endl;
00502 std::cout<<"output Opx? "<<(flag_Opx?" yes":" no")<<", unit: "<<unitName_Opx<<std::endl;
00503 std::cout<<"output Opy? "<<(flag_Opy?" yes":" no")<<", unit: "<<unitName_Opy<<std::endl;
00504 std::cout<<"output Opz? "<<(flag_Opz?" yes":" no")<<", unit: "<<unitName_Opz<<std::endl;
00505 std::cout<<"output x? "<<(flag_x?" yes":" no")<<", unit: "<<unitName_x<<std::endl;
00506 std::cout<<"output x? "<<(flag_local_x?" yes":" no")<<", unit: "<<unitName_local_x<<std::endl;
00507 std::cout<<"output y? "<<(flag_y?" yes":" no")<<", unit: "<<unitName_y<<std::endl;
00508 std::cout<<"output y? "<<(flag_local_y?" yes":" no")<<", unit: "<<unitName_local_y<<std::endl;
00509 std::cout<<"output z? "<<(flag_z?" yes":" no")<<", unit: "<<unitName_z<<std::endl;
00510 std::cout<<"output z? "<<(flag_local_z?" yes":" no")<<", unit: "<<unitName_local_z<<std::endl;
00511 std::cout<<"output t? "<<(flag_t?" yes":" no")<<", unit: "<<unitName_t<<std::endl;
00512 std::cout<<"output px? "<<(flag_px?" yes":" no")<<", unit: "<<unitName_px<<std::endl;
00513 std::cout<<"output py? "<<(flag_py?" yes":" no")<<", unit: "<<unitName_py<<std::endl;
00514 std::cout<<"output pz? "<<(flag_pz?" yes":" no")<<", unit: "<<unitName_pz<<std::endl;
00515 std::cout<<"output ox? "<<(flag_ox?" yes":" no")<<", unit: "<<unitName_ox<<std::endl;
00516 std::cout<<"output ox? "<<(flag_local_ox?" yes":" no")<<", unit: "<<unitName_local_ox<<std::endl;
00517 std::cout<<"output oy? "<<(flag_oy?" yes":" no")<<", unit: "<<unitName_oy<<std::endl;
00518 std::cout<<"output oy? "<<(flag_local_oy?" yes":" no")<<", unit: "<<unitName_local_oy<<std::endl;
00519 std::cout<<"output oz? "<<(flag_oz?" yes":" no")<<", unit: "<<unitName_oz<<std::endl;
00520 std::cout<<"output oz? "<<(flag_local_oz?" yes":" no")<<", unit: "<<unitName_local_oz<<std::endl;
00521 std::cout<<"output ot? "<<(flag_ot?" yes":" no")<<", unit: "<<unitName_ot<<std::endl;
00522 std::cout<<"output opx? "<<(flag_opx?" yes":" no")<<", unit: "<<unitName_opx<<std::endl;
00523 std::cout<<"output opy? "<<(flag_opy?" yes":" no")<<", unit: "<<unitName_opy<<std::endl;
00524 std::cout<<"output opz? "<<(flag_opz?" yes":" no")<<", unit: "<<unitName_opz<<std::endl;
00525 std::cout<<"output ekin? "<<(flag_ekin?" yes":" no")<<", unit: "<<unitName_ekin<<std::endl;
00526 std::cout<<"output e? "<<(flag_e?" yes":" no")<<", unit: "<<unitName_e<<std::endl;
00527 std::cout<<"output edep? "<<(flag_edep?" yes":" no")<<", unit: "<<unitName_edep<<std::endl;
00528 std::cout<<"output edepAll? "<<(flag_edepAll?" yes":" no")<<", unit: "<<unitName_edepAll<<std::endl;
00529 std::cout<<"output stepL? "<<(flag_stepL?" yes":" no")<<", unit: "<<unitName_stepL<<std::endl;
00530 std::cout<<"output volID? "<<(flag_volID?" yes":" no")<<std::endl;
00531 std::cout<<"output volName? "<<(flag_volName?" yes":" no")<<std::endl;
00532 std::cout<<"output ppid? "<<(flag_ppid?" yes":" no")<<std::endl;
00533 std::cout<<"output ptid? "<<(flag_ptid?" yes":" no")<<std::endl;
00534 std::cout<<"output oprocess?"<<(flag_oprocess?" yes":" no")<<std::endl;
00535 std::cout<<"output ovolName?"<<(flag_ovolName?" yes":" no")<<std::endl;
00536 std::cout<<"output tid? "<<(flag_tid?" yes":" no")<<std::endl;
00537 std::cout<<"output pid? "<<(flag_pid?" yes":" no")<<std::endl;
00538 std::cout<<"output particleName? "<<(flag_particleName?" yes":" no")<<std::endl;
00539 std::cout<<"output charge? "<<(flag_charge?" yes":" no")<<std::endl;
00540 std::cout<<"output stopped? "<<(flag_stopped?" yes":" no")<<std::endl;
00541 std::cout<<"output stop_time?"<<(flag_stop_time?" yes":" no")<<", unit: "<<unitName_stop_time<<std::endl;
00542 std::cout<<"output killed? "<<(flag_killed?" yes":" no")<<std::endl;
00543 std::cout<<"output kill_time?"<<(flag_kill_time?" yes":" no")<<", unit: "<<unitName_kill_time<<std::endl;
00544
00545 std::cout<<"Switch on? "<<(Switch?"yes":"no")<<std::endl;
00546 std::cout<<"neutralCut on? "<<(neutralCut?"yes":"no")<<std::endl;
00547 std::cout<<"Need stopped? "<<(needstopped?"yes":"no")<<std::endl;
00548 std::cout<<"minp = "<<minp/MeV<<"MeV"<<std::endl;
00549 std::cout<<"mine = "<<mine/MeV<<"MeV"<<std::endl;
00550 std::cout<<"maxn = "<<maxn<<std::endl;
00551 std::cout<<"mint = "<<mint/ns<<"ns"<<std::endl;
00552 std::cout<<"maxt = "<<maxt/ns<<"ns"<<std::endl;
00553 std::cout<<"tres = "<<tres/ns<<"ns"<<std::endl;
00554 std::cout<<"minedep = "<<minedep/MeV<<"MeV"<<std::endl;
00555 std::cout<<"white list: "<<std::endl;
00556 for ( int i = 0; i< white_list.size(); i++){
00557 std::cout <<" Only tracks with these following PDGCodes will be recorded:"<<std::endl;
00558 std::cout<<" "<<i<<": "<<white_list[i]<<std::endl;
00559 }
00560 if ( white_list.size() == 0 ){
00561 std::cout <<" Empty! So all tracks will be recorded!"<<std::endl;
00562 }
00563 std::cout<<"black list: "<<std::endl;
00564 for ( int i = 0; i< black_list.size(); i++){
00565 std::cout <<" Tracks with these following PDGCodes will NOT be recorded:"<<std::endl;
00566 std::cout<<" "<<i<<": "<<black_list[i]<<std::endl;
00567 }
00568 std::cout<<"******************************************************************************"<<std::endl;
00569 }
00570
00571
00572
00573 G4bool MonitorSD::ProcessHits(G4Step* aStep,G4TouchableHistory* touchableHistory)
00574 {
00575
00576
00577
00578
00579 G4Track* aTrack = aStep->GetTrack() ;
00580 G4int trackID= aTrack->GetTrackID();
00581 G4int charge = aTrack->GetDefinition()->GetPDGCharge();
00582 G4int pid = aTrack->GetDefinition()->GetPDGEncoding();
00583 std::string particleName = aTrack->GetParticleDefinition()->GetParticleName();
00584
00585
00586 G4StepPoint* prePoint = aStep->GetPreStepPoint() ;
00587 G4double total_e = prePoint->GetTotalEnergy();
00588 G4double ekin = prePoint->GetKineticEnergy();
00589 G4ThreeVector pointIn_mom = prePoint->GetMomentum();
00590 G4double pointIn_pa = pointIn_mom.mag();
00591 G4ThreeVector pointIn_pos = prePoint->GetPosition();
00592 G4double pointIn_time = prePoint->GetGlobalTime();
00593 G4StepPoint* postPoint = aStep->GetPostStepPoint() ;
00594 G4double pointOut_time = postPoint->GetGlobalTime();
00595 G4ThreeVector pointOut_mom = postPoint->GetMomentum();
00596 G4double pointOut_pa = pointOut_mom.mag();
00597 G4ThreeVector pointOut_pos = postPoint->GetPosition();
00598
00599
00600 const G4VTouchable *touchable = prePoint->GetTouchable();
00601 G4int ReplicaNo = touchable->GetVolume(0)->GetCopyNo();
00602 G4String VolName = touchable->GetVolume(0)->GetName();
00603
00604
00605 G4ThreeVector pointIn_local_pos = touchable->GetHistory()->GetTopTransform().TransformPoint(pointIn_pos);
00606 G4ThreeVector pointOut_local_pos = touchable->GetHistory()->GetTopTransform().TransformPoint(pointOut_pos);
00607
00608
00609 G4double edep = aStep->GetTotalEnergyDeposit();
00610 G4double edepNonIoni = aStep->GetNonIonizingEnergyDeposit();
00611 G4double edepIoni = edep - edepNonIoni;
00612 G4double stepL = aStep->GetStepLength();
00613
00614
00615
00616 if (!Switch) return false;
00617
00618
00619 if ( charge == 0 && neutralCut ) return false;
00620
00621
00622 if ( maxn && nHits >= maxn ) return false;
00623
00624
00625 bool foundit = false;
00626 for (int i = 0; i<white_list.size(); i++){
00627 if (pid == white_list[i]) foundit=true;
00628 if (white_list[i]==0&&pid<1e7) foundit = true;
00629 if (white_list[i]==-1&&trackID==1) foundit = true;
00630 }
00631 if (!foundit&&white_list.size()) return false;
00632
00633 foundit = false;
00634 for (int i = 0; i<black_list.size(); i++){
00635 if (pid == black_list[i]) foundit=true;
00636 if (black_list[i]==0&&pid<1e7) foundit = true;
00637 if (black_list[i]==-1&&trackID==1) foundit = true;
00638 }
00639 if (foundit) return false;
00640
00641
00642 if ( minp && pointIn_pa < minp ) return false;
00643
00644 if (mine&&aTrack->GetTotalEnergy()<mine) return false;
00645
00646
00647 if(isnan(pointIn_time)){
00648 G4cout<<"MonitorSD:error, pointIn_time is nan "<<G4endl;
00649 return false;
00650 }
00651 if ( pointIn_time < mint && mint ) return false;
00652 if ( pointIn_time > maxt && maxt ) return false;
00653
00654
00655 if( edepIoni <= minedep ) return false;
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667
00668
00669 G4TrackStatus fTrackStatus = aTrack->GetTrackStatus();
00670
00671
00672
00673
00674
00675
00676
00677
00678 bool stopped = false;
00679 double stop_time = 0;
00680 bool killed = false;
00681 double kill_time = 0;
00682 if (fTrackStatus == fStopButAlive || fTrackStatus == fStopAndKill){
00683 stopped = true;
00684 stop_time = pointIn_time;
00685 }
00686 if (fTrackStatus == fStopAndKill || fTrackStatus == fKillTrackAndSecondaries){
00687 killed = true;
00688 kill_time = pointIn_time;
00689 }
00690
00691 if (needstopped&&(!killed&&!stopped)) return false;
00692
00693
00694 bool willPush = true;
00695
00696 G4int index = -1;
00697 G4double dt = 1e10*s;
00698 for ( int i = 0; i < nHits; i++ ){
00699 if ( m_tid[i] == trackID
00700 && m_volName[i] == VolName
00701 && m_volID[i] == ReplicaNo
00702 ){
00703
00704 G4double dtime = fabs(pointOut_time - m_t[i]*unit_t);
00705
00706
00707 if ( dtime < dt ){
00708 index = i;
00709 dt = dtime;
00710
00711 if( willPush && dt < tres) willPush=false;
00712 }
00713 }
00714 }
00715
00716 if (willPush){
00717 MonitorHit* newHit = new MonitorHit();
00718 newHit->SetTrackID(trackID);
00719 newHit->SetVolID(ReplicaNo);
00720 newHit->SetEdep(edepIoni);
00721 newHit->SetPos(pointIn_pos);
00722 newHit->SetGlobalT(pointIn_time);
00723 hitsCollection->insert(newHit);
00724
00725 if(flag_Ox) m_Ox.push_back(pointOut_pos.x()/unit_Ox);
00726 if(flag_local_Ox) m_local_Ox.push_back(pointOut_local_pos.x()/unit_local_Ox);
00727 if(flag_Oy) m_Oy.push_back(pointOut_pos.y()/unit_Oy);
00728 if(flag_local_Oy) m_local_Oy.push_back(pointOut_local_pos.y()/unit_local_Oy);
00729 if(flag_Oz) m_Oz.push_back(pointOut_pos.z()/unit_Oz);
00730 if(flag_local_Oz) m_local_Oz.push_back(pointOut_local_pos.z()/unit_local_Oz);
00731 if(flag_Ot) m_Ot.push_back(pointOut_time/unit_Ot);
00732 if(flag_Opx) m_Opx.push_back(pointOut_mom.x()/unit_Opx);
00733 if(flag_Opy) m_Opy.push_back(pointOut_mom.y()/unit_Opy);
00734 if(flag_Opz) m_Opz.push_back(pointOut_mom.z()/unit_Opz);
00735 if(flag_x) m_x.push_back(pointIn_pos.x()/unit_x);
00736 if(flag_local_x) m_local_x.push_back(pointIn_local_pos.x()/unit_local_x);
00737 if(flag_y) m_y.push_back(pointIn_pos.y()/unit_y);
00738 if(flag_local_y) m_local_y.push_back(pointIn_local_pos.y()/unit_local_y);
00739 if(flag_z) m_z.push_back(pointIn_pos.z()/unit_z);
00740 if(flag_local_z) m_local_z.push_back(pointIn_local_pos.z()/unit_local_z);
00741 m_t.push_back(pointIn_time/unit_t);
00742
00743 if(flag_px) m_px.push_back(pointIn_mom.x()/unit_px);
00744 if(flag_py) m_py.push_back(pointIn_mom.y()/unit_py);
00745 if(flag_pz) m_pz.push_back(pointIn_mom.z()/unit_pz);
00746 if(flag_ekin) m_ekin.push_back(ekin/unit_ekin);
00747 if(flag_e) m_e.push_back(total_e/unit_e);
00748 if(flag_edep) m_edep.push_back(edepIoni/unit_edep);
00749 if(flag_edepAll) m_edepAll.push_back(edep/unit_edepAll);
00750 if(flag_stepL) m_stepL.push_back(stepL/unit_stepL);
00751 m_volID.push_back(ReplicaNo);
00752 m_volName.push_back(VolName);
00753 m_tid.push_back(trackID);
00754 if(flag_pid) m_pid.push_back(pid);
00755 if(flag_particleName) m_particleName.push_back(particleName);
00756 if(flag_charge) m_charge.push_back(charge);
00757 if(flag_stopped) m_stopped.push_back(stopped);
00758 if(flag_killed) m_killed.push_back(killed);
00759 if(flag_stop_time) m_stop_time.push_back(stop_time/unit_stop_time);
00760 if(flag_kill_time) m_kill_time.push_back(kill_time/unit_kill_time);
00761 if(flag_ptid){
00762 int ptid = aTrack->GetParentID();
00763 if (trackID==1){
00764 void *result = pPrimaryGeneratorAction->get_extra("ptid");
00765 if (result) ptid = *((int*)result);
00766 }
00767 m_ptid.push_back(ptid);
00768 }
00769 if(flag_ppid){
00770 int ptid = aTrack->GetParentID();
00771 int ppid = McTruthSvc::GetMcTruthSvc()->tid2pid(ptid);
00772 if (trackID==1){
00773 void *result = pPrimaryGeneratorAction->get_extra("ppid");
00774 if (result) ppid = *((int*)result);
00775 }
00776 m_ppid.push_back(ppid);
00777 }
00778 if(flag_oprocess){
00779 G4String processName;
00780 const G4VProcess* process = aTrack->GetCreatorProcess();
00781 if (process) {
00782 processName = process->GetProcessName();
00783 }
00784 else{
00785 processName = "NULL";
00786 }
00787 if (trackID==1){
00788 void *result = pPrimaryGeneratorAction->get_extra("process");
00789 if (result) processName = *((std::string*)result);
00790 }
00791 m_oprocess.push_back(processName);
00792 }
00793 if(flag_ovolName){
00794 G4String volume = aTrack->GetLogicalVolumeAtVertex()->GetName();
00795 if (trackID==1){
00796 void *result = pPrimaryGeneratorAction->get_extra("volume");
00797 if (result) volume = *((std::string*)result);
00798 }
00799 m_ovolName.push_back(volume);
00800 }
00801 if (flag_ox||flag_oy||flag_oz||
00802 flag_local_ox||flag_local_oy||flag_local_oz){
00803 G4ThreeVector pos_3vec = aTrack->GetVertexPosition();
00804 double ox = pos_3vec.x()/unit_ox;
00805 double oy = pos_3vec.y()/unit_oy;
00806 double oz = pos_3vec.z()/unit_oz;
00807
00808 G4ThreeVector local_pos_3vec = touchable->GetHistory()->GetTopTransform().TransformPoint(pos_3vec);
00809 double local_ox = local_pos_3vec.x()/unit_local_ox;
00810 double local_oy = local_pos_3vec.y()/unit_local_oy;
00811 double local_oz = local_pos_3vec.z()/unit_local_oz;
00812
00813 if (trackID==1){
00814 void *result = pPrimaryGeneratorAction->get_extra("ox");
00815 if (result) ox = *((double*)result)*mm/unit_ox;
00816 if (result) local_ox = *((double*)result)*mm/unit_local_ox;
00817 result = pPrimaryGeneratorAction->get_extra("oy");
00818 if (result) oy = *((double*)result)*mm/unit_oy;
00819 if (result) local_oy = *((double*)result)*mm/unit_local_oy;
00820 result = pPrimaryGeneratorAction->get_extra("oz");
00821 if (result) oz = *((double*)result)*mm/unit_oz;
00822 if (result) local_oz = *((double*)result)*mm/unit_local_oz;
00823 }
00824 if(flag_ox) m_ox.push_back(ox);
00825 if(flag_local_ox) m_local_ox.push_back(local_ox);
00826 if(flag_oy) m_oy.push_back(oy);
00827 if(flag_local_oy) m_local_oy.push_back(local_oy);
00828 if(flag_oz) m_oz.push_back(oz);
00829 if(flag_local_oz) m_local_oz.push_back(local_oz);
00830 }
00831 if(flag_ot){
00832 double ot;
00833 ot = McTruthSvc::GetMcTruthSvc()->tid2time(trackID)/unit_ot;
00834 if (trackID==1){
00835 void *result = pPrimaryGeneratorAction->get_extra("ox");
00836 if (result) ot = *((double*)result)*ns/unit_ot;
00837 }
00838 m_ot.push_back(ot);
00839 }
00840 if (flag_opx||flag_opy||flag_opz){
00841 G4ThreeVector mom_dir = aTrack->GetVertexMomentumDirection();
00842 G4double Ekin = aTrack->GetVertexKineticEnergy();
00843 G4double mass = aTrack->GetDynamicParticle()->GetMass();
00844 G4double mom = sqrt((mass+Ekin)*(mass+Ekin)-mass*mass);
00845 double opx = mom*mom_dir.x()/unit_opx;
00846 double opy = mom*mom_dir.y()/unit_opy;
00847 double opz = mom*mom_dir.z()/unit_opz;
00848 if (trackID==1){
00849 void *result = pPrimaryGeneratorAction->get_extra("opx");
00850 if (result) opx = *((double*)result)*mm/unit_opx;
00851 result = pPrimaryGeneratorAction->get_extra("opy");
00852 if (result) opy = *((double*)result)*mm/unit_opy;
00853 result = pPrimaryGeneratorAction->get_extra("opz");
00854 if (result) opz = *((double*)result)*mm/unit_opz;
00855 }
00856 if(flag_opx) m_opx.push_back(opx);
00857 if(flag_opy) m_opy.push_back(opy);
00858 if(flag_opz) m_opz.push_back(opz);
00859 }
00860 nHits++;
00861 }
00862 else {
00863 G4double edepTemp = (*hitsCollection)[index]->GetEdep();
00864 (*hitsCollection)[index]->SetEdep(edepTemp + edepIoni);
00865 (*hitsCollection)[index]->SetPos(pointOut_pos);
00866 (*hitsCollection)[index]->SetGlobalT(pointOut_time);
00867 if (m_tid[index] == trackID){
00868 if(flag_Ox) m_Ox[index] = pointOut_pos.x()/unit_Ox;
00869 if(flag_local_Ox) m_local_Ox[index] = pointOut_local_pos.x()/unit_local_Ox;
00870 if(flag_Oy) m_Oy[index] = pointOut_pos.y()/unit_Oy;
00871 if(flag_local_Oy) m_local_Oy[index] = pointOut_local_pos.y()/unit_local_Oy;
00872 if(flag_Oz) m_Oz[index] = pointOut_pos.z()/unit_Oz;
00873 if(flag_local_Oz) m_local_Oz[index] = pointOut_local_pos.z()/unit_local_Oz;
00874 if(flag_Ot) m_Ot[index] = pointOut_time/unit_Ot;
00875 if(flag_Opx) m_Opx[index] = pointOut_mom.x()/unit_Opx;
00876 if(flag_Opy) m_Opy[index] = pointOut_mom.y()/unit_Opy;
00877 if(flag_Opz) m_Opz[index] = pointOut_mom.z()/unit_Opz;
00878 if(flag_stepL) m_stepL[index] += stepL/unit_stepL;
00879 if(flag_stop_time&&stopped) m_stop_time[index] = stop_time/unit_stop_time;
00880 if(flag_kill_time&&killed) m_kill_time[index] = kill_time/unit_kill_time;
00881 if(flag_stopped&&stopped) m_stopped[index] = stopped;
00882 if(flag_killed&&killed) m_killed[index] = killed;
00883 }
00884 if(flag_edep) m_edep[index] += edepIoni/unit_edep;
00885 if(flag_edepAll) m_edepAll[index] += edep/unit_edepAll;
00886 }
00887 return true;
00888 }
00889
00890
00891
00892 void MonitorSD::EndOfEvent(G4HCofThisEvent*){
00893 if (verboseLevel>0) {
00894
00895
00896
00897
00898
00899
00900
00901 }
00902 }