Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 /// \file electromagnetic/TestEm2/src/RunActio 26 /// \file electromagnetic/TestEm2/src/RunAction.cc 27 /// \brief Implementation of the RunAction cla 27 /// \brief Implementation of the RunAction class 28 // 28 // 29 // << 29 // $Id$ >> 30 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oo 32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 33 33 #include "RunAction.hh" 34 #include "RunAction.hh" 34 35 35 #include "DetectorConstruction.hh" 36 #include "DetectorConstruction.hh" 36 #include "EmAcceptance.hh" << 37 #include "PrimaryGeneratorAction.hh" 37 #include "PrimaryGeneratorAction.hh" 38 #include "Run.hh" << 39 #include "RunActionMessenger.hh" 38 #include "RunActionMessenger.hh" >> 39 #include "EmAcceptance.hh" 40 40 41 #include "G4Run.hh" 41 #include "G4Run.hh" 42 #include "G4RunManager.hh" 42 #include "G4RunManager.hh" >> 43 #include "G4UnitsTable.hh" >> 44 43 #include "G4SystemOfUnits.hh" 45 #include "G4SystemOfUnits.hh" >> 46 #include <iomanip> >> 47 44 #include "Randomize.hh" 48 #include "Randomize.hh" 45 49 46 //....oooOO0OOooo........oooOO0OOooo........oo 50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 47 51 48 RunAction::RunAction(DetectorConstruction* det << 52 RunAction::RunAction(DetectorConstruction* det, PrimaryGeneratorAction* kin) >> 53 :fDet(det),fKin(kin) 49 { 54 { 50 fRunMessenger = new RunActionMessenger(this) 55 fRunMessenger = new RunActionMessenger(this); 51 << 56 52 // Create analysis manager << 57 f_nLbin = f_nRbin = MaxBin; 53 // The choice of analysis technology is done << 58 54 fAnalysisManager = G4AnalysisManager::Instan << 59 f_dEdL.resize(f_nLbin, 0.0); 55 fAnalysisManager->SetDefaultFileType("root") << 60 fSumELongit.resize(f_nLbin, 0.0); 56 << 61 fSumELongitCumul.resize(f_nLbin, 0.0); 57 // Set the default file name "testem2" << 62 fSumE2Longit.resize(f_nLbin, 0.0); 58 // which can be then redefine in a macro via << 63 fSumE2LongitCumul.resize(f_nLbin, 0.0); 59 fAnalysisManager->SetFileName("testem2"); << 64 >> 65 f_dEdR.resize(f_nRbin, 0.0); >> 66 fSumERadial.resize(f_nRbin, 0.0); >> 67 fSumERadialCumul.resize(f_nRbin, 0.0); >> 68 fSumE2Radial.resize(f_nRbin, 0.0); >> 69 fSumE2RadialCumul.resize(f_nRbin, 0.0); >> 70 >> 71 fEdeptrue = 1.; >> 72 fRmstrue = 1.; >> 73 fLimittrue = DBL_MAX; >> 74 >> 75 fChargedStep = 0.0; >> 76 fNeutralStep = 0.0; >> 77 >> 78 fVerbose = 0; 60 } 79 } 61 80 62 //....oooOO0OOooo........oooOO0OOooo........oo 81 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 63 82 64 RunAction::~RunAction() 83 RunAction::~RunAction() 65 { 84 { 66 delete fRunMessenger; 85 delete fRunMessenger; 67 } 86 } 68 87 69 //....oooOO0OOooo........oooOO0OOooo........oo 88 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 70 89 71 void RunAction::BookHisto() 90 void RunAction::BookHisto() 72 { 91 { 73 // Get analysis manager << 92 // Create analysis manager 74 fAnalysisManager = G4AnalysisManager::Instan << 93 // The choice of analysis technology is done via selection of a namespace 75 << 94 // >> 95 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance(); >> 96 76 // Open an output file 97 // Open an output file 77 fAnalysisManager->OpenFile(); << 98 // 78 fAnalysisManager->SetVerboseLevel(1); << 99 fHistoName[0] = "testem2"; >> 100 analysisManager->OpenFile(fHistoName[0]); >> 101 analysisManager->SetVerboseLevel(1); >> 102 G4String extension = analysisManager->GetFileType(); >> 103 fHistoName[1] = fHistoName[0] + "." + extension; 79 104 80 // Creating histograms 105 // Creating histograms 81 // 106 // 82 G4double Ekin = fKin->GetParticleGun()->GetP 107 G4double Ekin = fKin->GetParticleGun()->GetParticleEnergy(); 83 G4int nLbin = fDet->GetnLtot(); << 84 G4int nRbin = fDet->GetnRtot(); << 85 G4double dLradl = fDet->GetdLradl(); 108 G4double dLradl = fDet->GetdLradl(); 86 G4double dRradl = fDet->GetdRradl(); 109 G4double dRradl = fDet->GetdRradl(); >> 110 >> 111 analysisManager->SetFirstHistoId(1); >> 112 analysisManager->CreateH1( "1","total energy deposit(percent of Einc)", >> 113 110,0.,110.); >> 114 >> 115 analysisManager->CreateH1( "2","total charged tracklength (radl)", >> 116 110,0.,110.*Ekin/GeV); >> 117 >> 118 analysisManager->CreateH1( "3","total neutral tracklength (radl)", >> 119 110,0.,1100.*Ekin/GeV); >> 120 >> 121 analysisManager->CreateH1( "4","longit energy profile (% of E inc)", >> 122 f_nLbin,0.,f_nLbin*dLradl); >> 123 >> 124 analysisManager->CreateH1( "5","rms on longit Edep (% of E inc)", >> 125 f_nLbin,0.,f_nLbin*dLradl); >> 126 >> 127 G4double Zmin=0.5*dLradl, Zmax=Zmin+f_nLbin*dLradl; >> 128 analysisManager->CreateH1( "6","cumul longit energy dep (% of E inc)", >> 129 f_nLbin,Zmin,Zmax); >> 130 >> 131 analysisManager->CreateH1( "7","rms on cumul longit Edep (% of E inc)", >> 132 f_nLbin,Zmin,Zmax); >> 133 >> 134 analysisManager->CreateH1( "8","radial energy profile (% of E inc)", >> 135 f_nRbin,0.,f_nRbin*dRradl); >> 136 >> 137 analysisManager->CreateH1( "9","rms on radial Edep (% of E inc)", >> 138 f_nRbin,0.,f_nRbin*dRradl); >> 139 >> 140 G4double Rmin=0.5*dRradl, Rmax=Rmin+f_nRbin*dRradl; >> 141 analysisManager->CreateH1("10","cumul radial energy dep (% of E inc)", >> 142 f_nRbin,Rmin,Rmax); >> 143 >> 144 analysisManager->CreateH1("11","rms on cumul radial Edep (% of E inc)", >> 145 f_nRbin,Rmin,Rmax); >> 146 >> 147 G4cout << "\n----> Histogram file is opened in " << fHistoName[1] << G4endl; >> 148 } 87 149 88 fAnalysisManager->SetFirstHistoId(1); << 150 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 89 fAnalysisManager->CreateH1("h1", "total ener << 90 << 91 fAnalysisManager->CreateH1("h2", "total char << 92 << 93 fAnalysisManager->CreateH1("h3", "total neut << 94 << 95 fAnalysisManager->CreateH1("h4", "longit ene << 96 151 97 fAnalysisManager->CreateP1("p4", "longit ene << 152 void RunAction::CleanHisto() 98 0., 1000.); << 153 { >> 154 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance(); >> 155 >> 156 analysisManager->Write(); >> 157 analysisManager->CloseFile(); 99 158 100 fAnalysisManager->CreateH1("h5", "rms on lon << 159 delete G4AnalysisManager::Instance(); >> 160 } 101 161 102 G4double Zmin = 0.5 * dLradl, Zmax = Zmin + << 162 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 103 fAnalysisManager->CreateH1("h6", "cumul long << 104 163 105 fAnalysisManager->CreateH1("h7", "rms on cum << 164 void RunAction::BeginOfRunAction(const G4Run* aRun) >> 165 { >> 166 G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl; 106 167 107 fAnalysisManager->CreateH1("h8", "radial ene << 168 // save Rndm status >> 169 ////G4RunManager::GetRunManager()->SetRandomNumberStore(true); >> 170 CLHEP::HepRandom::showEngineStatus(); 108 171 109 fAnalysisManager->CreateP1("p8", "radial ene << 172 fChargedStep = 0.0; 110 0., 1000.); << 173 fNeutralStep = 0.0; 111 174 112 fAnalysisManager->CreateH1("h9", "rms on rad << 175 f_nLbin = fDet->GetnLtot(); >> 176 f_nRbin = fDet->GetnRtot(); 113 177 114 G4double Rmin = 0.5 * dRradl, Rmax = Rmin + << 178 //initialize arrays of cumulative energy deposition 115 fAnalysisManager->CreateH1("h10", "cumul rad << 179 // >> 180 for (G4int i=0; i<f_nLbin; i++) >> 181 fSumELongit[i]=fSumE2Longit[i]=fSumELongitCumul[i]=fSumE2LongitCumul[i]=0.; >> 182 >> 183 for (G4int j=0; j<f_nRbin; j++) >> 184 fSumERadial[j]=fSumE2Radial[j]=fSumERadialCumul[j]=fSumE2RadialCumul[j]=0.; 116 185 117 fAnalysisManager->CreateH1("h11", "rms on cu << 186 //initialize track length >> 187 fSumChargTrLength=fSum2ChargTrLength=fSumNeutrTrLength=fSum2NeutrTrLength=0.; 118 188 119 G4String fileName = fAnalysisManager->GetFil << 189 //histograms 120 G4String extension = fAnalysisManager->GetFi << 190 // 121 G4String fullFileName = fileName + "." + ext << 191 if (aRun->GetRunID() == 0) BookHisto(); 122 G4cout << "\n----> Histogram file is opened << 123 } 192 } 124 193 125 //....oooOO0OOooo........oooOO0OOooo........oo 194 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 126 195 127 G4Run* RunAction::GenerateRun() << 196 void RunAction::InitializePerEvent() 128 { 197 { 129 fRun = new Run(fDet, fKin); << 198 //initialize arrays of energy deposit per bin 130 fRun->SetVerbose(fVerbose); << 199 for (G4int i=0; i<f_nLbin; i++) 131 return fRun; << 200 { f_dEdL[i] = 0.; } >> 201 >> 202 for (G4int j=0; j<f_nRbin; j++) >> 203 { f_dEdR[j] = 0.; } >> 204 >> 205 //initialize tracklength >> 206 fChargTrLength = fNeutrTrLength = 0.; 132 } 207 } 133 208 134 //....oooOO0OOooo........oooOO0OOooo........oo 209 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 135 210 136 void RunAction::BeginOfRunAction(const G4Run*) << 211 void RunAction::FillPerEvent() 137 { 212 { 138 // show Rndm status << 213 //accumulate statistic 139 if (isMaster) G4Random::showEngineStatus(); << 214 // >> 215 G4double dLCumul = 0.; >> 216 for (G4int i=0; i<f_nLbin; i++) >> 217 { >> 218 fSumELongit[i] += f_dEdL[i]; >> 219 fSumE2Longit[i] += f_dEdL[i]*f_dEdL[i]; >> 220 dLCumul += f_dEdL[i]; >> 221 fSumELongitCumul[i] += dLCumul; >> 222 fSumE2LongitCumul[i] += dLCumul*dLCumul; >> 223 } >> 224 >> 225 G4double dRCumul = 0.; >> 226 for (G4int j=0; j<f_nRbin; j++) >> 227 { >> 228 fSumERadial[j] += f_dEdR[j]; >> 229 fSumE2Radial[j] += f_dEdR[j]*f_dEdR[j]; >> 230 dRCumul += f_dEdR[j]; >> 231 fSumERadialCumul[j] += dRCumul; >> 232 fSumE2RadialCumul[j] += dRCumul*dRCumul; >> 233 } >> 234 >> 235 fSumChargTrLength += fChargTrLength; >> 236 fSum2ChargTrLength += fChargTrLength*fChargTrLength; >> 237 fSumNeutrTrLength += fNeutrTrLength; >> 238 fSum2NeutrTrLength += fNeutrTrLength*fNeutrTrLength; 140 239 141 // histograms << 240 //fill histograms 142 // 241 // 143 BookHisto(); << 242 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance(); >> 243 >> 244 G4double Ekin=fKin->GetParticleGun()->GetParticleEnergy(); >> 245 G4double mass=fKin->GetParticleGun()->GetParticleDefinition()->GetPDGMass(); >> 246 G4double radl=fDet->GetMaterial()->GetRadlen(); >> 247 >> 248 analysisManager->FillH1(1, 100.*dLCumul/(Ekin+mass)); >> 249 analysisManager->FillH1(2, fChargTrLength/radl); >> 250 analysisManager->FillH1(3, fNeutrTrLength/radl); 144 } 251 } 145 252 146 //....oooOO0OOooo........oooOO0OOooo........oo 253 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 147 254 148 void RunAction::EndOfRunAction(const G4Run*) << 255 void RunAction::EndOfRunAction(const G4Run* aRun) 149 { 256 { 150 // compute and print statistic << 257 //compute and print statistic >> 258 // >> 259 G4int NbOfEvents = aRun->GetNumberOfEvent(); >> 260 G4double kinEnergy = fKin->GetParticleGun()->GetParticleEnergy(); >> 261 assert(NbOfEvents*kinEnergy > 0); >> 262 >> 263 fChargedStep /= G4double(NbOfEvents); >> 264 fNeutralStep /= G4double(NbOfEvents); >> 265 >> 266 G4double mass=fKin->GetParticleGun()->GetParticleDefinition()->GetPDGMass(); >> 267 G4double norme = 100./(NbOfEvents*(kinEnergy+mass)); >> 268 >> 269 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance(); >> 270 >> 271 //longitudinal >> 272 // >> 273 G4double dLradl = fDet->GetdLradl(); >> 274 >> 275 MyVector MeanELongit(f_nLbin), rmsELongit(f_nLbin); >> 276 MyVector MeanELongitCumul(f_nLbin), rmsELongitCumul(f_nLbin); >> 277 >> 278 G4int i; >> 279 for (i=0; i<f_nLbin; i++) >> 280 { >> 281 MeanELongit[i] = norme*fSumELongit[i]; >> 282 rmsELongit[i] = norme*std::sqrt(std::fabs(NbOfEvents*fSumE2Longit[i] >> 283 - fSumELongit[i]*fSumELongit[i])); >> 284 >> 285 MeanELongitCumul[i] = norme*fSumELongitCumul[i]; >> 286 rmsELongitCumul[i] = norme*std::sqrt(std::fabs(NbOfEvents*fSumE2LongitCumul[i] >> 287 - fSumELongitCumul[i]*fSumELongitCumul[i])); >> 288 >> 289 G4double bin = (i+0.5)*dLradl; >> 290 analysisManager->FillH1(4, bin,MeanELongit[i]/dLradl); >> 291 analysisManager->FillH1(5, bin, rmsELongit[i]/dLradl); >> 292 bin = (i+1)*dLradl; >> 293 analysisManager->FillH1(6, bin,MeanELongitCumul[i]); >> 294 analysisManager->FillH1(7, bin, rmsELongitCumul[i]); >> 295 } >> 296 >> 297 //radial >> 298 // >> 299 G4double dRradl = fDet->GetdRradl(); >> 300 >> 301 MyVector MeanERadial(f_nRbin), rmsERadial(f_nRbin); >> 302 MyVector MeanERadialCumul(f_nRbin), rmsERadialCumul(f_nRbin); >> 303 >> 304 for (i=0; i<f_nRbin; i++) >> 305 { >> 306 MeanERadial[i] = norme*fSumERadial[i]; >> 307 rmsERadial[i] = norme*std::sqrt(std::fabs(NbOfEvents*fSumE2Radial[i] >> 308 - fSumERadial[i]*fSumERadial[i])); >> 309 >> 310 MeanERadialCumul[i] = norme*fSumERadialCumul[i]; >> 311 rmsERadialCumul[i] = norme*std::sqrt(std::fabs(NbOfEvents*fSumE2RadialCumul[i] >> 312 - fSumERadialCumul[i]*fSumERadialCumul[i])); >> 313 >> 314 >> 315 G4double bin = (i+0.5)*dRradl; >> 316 analysisManager->FillH1(8, bin,MeanERadial[i]/dRradl); >> 317 analysisManager->FillH1(9, bin, rmsERadial[i]/dRradl); >> 318 bin = (i+1)*dRradl; >> 319 analysisManager->FillH1(10, bin,MeanERadialCumul[i]); >> 320 analysisManager->FillH1(11, bin, rmsERadialCumul[i]); >> 321 } >> 322 >> 323 //find Moliere confinement >> 324 // >> 325 const G4double EMoliere = 90.; >> 326 G4double iMoliere = 0.; >> 327 if ((MeanERadialCumul[0] <= EMoliere) && >> 328 (MeanERadialCumul[f_nRbin-1] >= EMoliere)) { >> 329 G4int imin = 0; >> 330 while( (imin < f_nRbin-1) && (MeanERadialCumul[imin] < EMoliere) ) imin++; >> 331 G4double ratio = (EMoliere - MeanERadialCumul[imin]) / >> 332 (MeanERadialCumul[imin+1] - MeanERadialCumul[imin]); >> 333 iMoliere = 1. + imin + ratio; >> 334 } >> 335 >> 336 //track length 151 // 337 // 152 if (isMaster) fRun->EndOfRun(fEdeptrue, fRms << 338 norme = 1./(NbOfEvents*(fDet->GetMaterial()->GetRadlen())); >> 339 G4double MeanChargTrLength = norme*fSumChargTrLength; >> 340 G4double rmsChargTrLength = >> 341 norme*std::sqrt(std::fabs(NbOfEvents*fSum2ChargTrLength >> 342 - fSumChargTrLength*fSumChargTrLength)); >> 343 >> 344 G4double MeanNeutrTrLength = norme*fSumNeutrTrLength; >> 345 G4double rmsNeutrTrLength = >> 346 norme*std::sqrt(std::fabs(NbOfEvents*fSum2NeutrTrLength >> 347 - fSumNeutrTrLength*fSumNeutrTrLength)); 153 348 >> 349 //print >> 350 // >> 351 >> 352 std::ios::fmtflags mode = G4cout.flags(); >> 353 G4cout.setf(std::ios::fixed,std::ios::floatfield); >> 354 G4int prec = G4cout.precision(2); >> 355 >> 356 if (fVerbose) { >> 357 >> 358 G4cout << " LOGITUDINAL PROFILE " >> 359 << " CUMULATIVE LOGITUDINAL PROFILE" << G4endl << G4endl; >> 360 >> 361 G4cout << " bin " << " Mean rms " >> 362 << " bin " << " Mean rms \n" << G4endl; >> 363 >> 364 for (i=0; i<f_nLbin; i++) >> 365 { >> 366 G4double inf=i*dLradl, sup=inf+dLradl; >> 367 >> 368 G4cout << std::setw(8) << inf << "->" >> 369 << std::setw(5) << sup << " radl: " >> 370 << std::setw(7) << MeanELongit[i] << "% " >> 371 << std::setw(9) << rmsELongit[i] << "% " >> 372 << " 0->" << std::setw(5) << sup << " radl: " >> 373 << std::setw(7) << MeanELongitCumul[i] << "% " >> 374 << std::setw(7) << rmsELongitCumul[i] << "% " >> 375 <<G4endl; >> 376 } >> 377 >> 378 G4cout << G4endl << G4endl << G4endl; >> 379 >> 380 G4cout << " RADIAL PROFILE " >> 381 << " CUMULATIVE RADIAL PROFILE" << G4endl << G4endl; >> 382 >> 383 G4cout << " bin " << " Mean rms " >> 384 << " bin " << " Mean rms \n" << G4endl; >> 385 >> 386 for (i=0; i<f_nRbin; i++) >> 387 { >> 388 G4double inf=i*dRradl, sup=inf+dRradl; >> 389 >> 390 G4cout << std::setw(8) << inf << "->" >> 391 << std::setw(5) << sup << " radl: " >> 392 << std::setw(7) << MeanERadial[i] << "% " >> 393 << std::setw(9) << rmsERadial[i] << "% " >> 394 << " 0->" << std::setw(5) << sup << " radl: " >> 395 << std::setw(7) << MeanERadialCumul[i] << "% " >> 396 << std::setw(7) << rmsERadialCumul[i] << "% " >> 397 <<G4endl; >> 398 } >> 399 } >> 400 >> 401 G4cout << "\n SUMMARY \n" << G4endl; >> 402 >> 403 G4cout << "\n" >> 404 << " Mean number of charged steps: " << fChargedStep << G4endl; >> 405 G4cout << " Mean number of neutral steps: " << fNeutralStep >> 406 << "\n" << G4endl; >> 407 >> 408 G4cout << " energy deposit : " >> 409 << std::setw(7) << MeanELongitCumul[f_nLbin-1] << " % E0 +- " >> 410 << std::setw(7) << rmsELongitCumul[f_nLbin-1] << " % E0" << G4endl; >> 411 G4cout << " charged traklen: " >> 412 << std::setw(7) << MeanChargTrLength << " radl +- " >> 413 << std::setw(7) << rmsChargTrLength << " radl" << G4endl; >> 414 G4cout << " neutral traklen: " >> 415 << std::setw(7) << MeanNeutrTrLength << " radl +- " >> 416 << std::setw(7) << rmsNeutrTrLength << " radl" << G4endl; >> 417 >> 418 if (iMoliere > 0. ) { >> 419 G4double RMoliere1 = iMoliere*fDet->GetdRradl(); >> 420 G4double RMoliere2 = iMoliere*fDet->GetdRlength(); >> 421 G4cout << "\n " << EMoliere << " % confinement: radius = " >> 422 << RMoliere1 << " radl (" >> 423 << G4BestUnit( RMoliere2, "Length") << ")" << "\n" << G4endl; >> 424 } >> 425 >> 426 G4cout.setf(mode,std::ios::floatfield); >> 427 G4cout.precision(prec); >> 428 >> 429 // save histos and close AnalysisFactory >> 430 CleanHisto(); >> 431 154 // show Rndm status 432 // show Rndm status 155 if (isMaster) G4Random::showEngineStatus(); << 433 CLHEP::HepRandom::showEngineStatus(); 156 434 157 // save histos and close analysis << 435 // Acceptance 158 fAnalysisManager->Write(); << 436 if(fLimittrue < DBL_MAX) { 159 fAnalysisManager->CloseFile(); << 437 EmAcceptance acc; 160 fAnalysisManager->Clear(); << 438 acc.BeginOfAcceptance("Total Energy in Absorber",NbOfEvents); >> 439 G4double e = MeanELongitCumul[f_nLbin-1]/100.; >> 440 G4double r = rmsELongitCumul[f_nLbin-1]/100.; >> 441 acc.EmAcceptanceGauss("Edep",NbOfEvents,e,fEdeptrue,fRmstrue,fLimittrue); >> 442 acc.EmAcceptanceGauss("Erms",NbOfEvents,r,fRmstrue,fRmstrue,2.0*fLimittrue); >> 443 acc.EndOfAcceptance(); >> 444 } 161 } 445 } 162 446 163 //....oooOO0OOooo........oooOO0OOooo........oo 447 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 164 448 165 void RunAction::SetEdepAndRMS(G4ThreeVector Va 449 void RunAction::SetEdepAndRMS(G4ThreeVector Value) 166 { 450 { 167 fEdeptrue = Value(0); 451 fEdeptrue = Value(0); 168 fRmstrue = Value(1); << 452 fRmstrue = Value(1); 169 fLimittrue = Value(2); << 453 fLimittrue= Value(2); 170 } << 171 //....oooOO0OOooo........oooOO0OOooo........oo << 172 << 173 void RunAction::SetVerbose(G4int val) << 174 { << 175 fVerbose = val; << 176 if (fRun) fRun->SetVerbose(val); << 177 } 454 } 178 455 179 //....oooOO0OOooo........oooOO0OOooo........oo 456 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 180 457