- Timestamp:
- Sep 30, 2010, 2:47:17 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/extended/exoticphysics/monopole/src/RunAction.cc
r1230 r1337 24 24 // ******************************************************************** 25 25 // 26 // $Id: RunAction.cc,v 1. 2 2008/06/11 14:34:19vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-0 3-cand-01 $26 // $Id: RunAction.cc,v 1.4 2010/06/04 19:03:36 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-04-beta-01 $ 28 28 // 29 29 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... … … 50 50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 51 51 52 RunAction::RunAction(DetectorConstruction* det, PrimaryGeneratorAction* kin):detector(det), kinematic(kin), af(0), tree(0) 52 RunAction::RunAction(DetectorConstruction* det, PrimaryGeneratorAction* kin) 53 :detector(det), kinematic(kin), af(0), tree(0) 53 54 { 54 verboseLevel = 0;55 verboseLevel = 1; 55 56 binLength = offsetX = 0.; 56 57 histo[0] = 0; … … 60 61 // Creating the analysis factory 61 62 af = AIDA_createAnalysisFactory(); 62 ftype = "hbook";63 ftype = "root"; 63 64 fname = "monopole"; 64 65 #endif … … 68 69 } 69 70 70 71 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 71 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 72 72 73 RunAction::~RunAction() 73 74 { … … 77 78 } 78 79 79 80 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 80 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 81 81 82 void RunAction::bookHisto() 82 83 { 83 84 G4double length = detector->GetAbsorSizeX(); 84 if(!binLength) binLength = 5 * mm; 85 if(binLength > detector->GetMaxStepSize()) binLength = detector->GetMaxStepSize(); 85 if(!binLength) { binLength = 5 * mm; } 86 if(binLength > detector->GetMaxStepSize()) { 87 binLength = detector->GetMaxStepSize(); 88 } 86 89 offsetX = 0.5 * length; 87 90 88 91 #ifdef G4ANALYSIS_USE 89 if(GetVerbose() > 0) G4cout << "\n----> Histogram Tree opened" << G4endl;90 91 G4int nbBins = ( int)(0.5 + length / binLength);92 if(GetVerbose() > 0) { G4cout << "\n----> Histogram Tree opened" << G4endl; } 93 94 G4int nbBins = (G4int)(0.5 + length / binLength); 92 95 93 96 // Create the tree factory … … 120 123 } 121 124 122 123 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 125 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 126 124 127 void RunAction::saveHisto() 125 128 { … … 133 136 } 134 137 135 136 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 138 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 139 137 140 void RunAction::SetBinSize(G4double size) 138 141 { … … 180 183 G4Material* material = detector->GetAbsorMaterial(); 181 184 G4double density = material->GetDensity(); 182 183 G4String particle = kinematic->GetParticleGun()->GetParticleDefinition()->GetParticleName(); 185 const G4ParticleDefinition* part = 186 kinematic->GetParticleGun()->GetParticleDefinition(); 187 G4String particle = part->GetParticleName(); 184 188 G4double energy = kinematic->GetParticleGun()->GetParticleEnergy(); 185 189 … … 209 213 calc.SetVerbose(0); 210 214 G4int i; 211 for(i = 0; i < 100; i++) {215 for(i = 0; i < 100; ++i) { 212 216 ekin[i] = std::pow(10., 0.1*G4double(i)) * keV; 213 217 dedxproton[i] = calc.ComputeElectronicDEDX(ekin[i], "proton", material->GetName()); … … 215 219 } 216 220 217 if(GetVerbose() > 1){221 if(GetVerbose() > 0){ 218 222 G4cout << "### Stopping Powers" << G4endl; 219 223 for(i=0; i<100; i++) { … … 223 227 } 224 228 }; 225 229 G4cout << "### End of stopping power table" << G4endl; 226 230 #ifdef G4ANALYSIS_USE 227 231 // normalize histogram … … 234 238 }; 235 239 236 237 for(i=0; i<100; i++) { 240 for(i=0; i<100; ++i) { 238 241 G4double e = std::log10(ekin[i] / MeV) + 0.05; 239 242 histo[1]->fill(e, dedxproton[i]);
Note: See TracChangeset
for help on using the changeset viewer.