Ignore:
Timestamp:
Nov 5, 2010, 4:08:39 PM (14 years ago)
Author:
garnier
Message:

update ti head

Location:
trunk/examples/extended/electromagnetic/TestEm7/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/extended/electromagnetic/TestEm7/src/PhysListEmStandardNR.cc

    r1337 r1342  
    2424// ********************************************************************
    2525//
    26 // $Id: PhysListEmStandardNR.cc,v 1.4 2009/11/21 22:02:51 maire Exp $
    27 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     26// $Id: PhysListEmStandardNR.cc,v 1.5 2010/10/13 12:21:56 vnivanch Exp $
     27// GEANT4 tag $Name: examples-V09-03-09 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    122122
    123123      G4ionIonisation* ion = new G4ionIonisation();
    124       ion->ActivateNuclearStopping(false);
    125124      pmanager->AddProcess(ion, -1, 2, 2);
    126125
     
    136135
    137136      G4ionIonisation* ion = new G4ionIonisation();
    138       ion->ActivateNuclearStopping(false);
    139137      ion->SetStepFunction(0.1, um);
    140138      pmanager->AddProcess(ion, -1, 2, 2);
  • trunk/examples/extended/electromagnetic/TestEm7/src/RunAction.cc

    r1337 r1342  
    2424// ********************************************************************
    2525//
    26 // $Id: RunAction.cc,v 1.24 2008/08/22 18:30:27 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     26// $Id: RunAction.cc,v 1.25 2010/09/17 18:45:43 maire Exp $
     27// GEANT4 tag $Name: examples-V09-03-09 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3434#include "PhysicsList.hh"
    3535#include "StepMax.hh"
     36#include "HistoManager.hh"
    3637#include "PrimaryGeneratorAction.hh"
    3738
     
    4243
    4344#include "Randomize.hh"
    44 #include "Histo.hh"
    4545
    4646//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    4747
    4848RunAction::RunAction(DetectorConstruction* det, PhysicsList* phys,
    49                      PrimaryGeneratorAction* kin)
    50 :detector(det), physics(phys), kinematic(kin)
     49                     HistoManager* histo, PrimaryGeneratorAction* kin)
     50:detector(det), physics(phys),histoManager(histo), kinematic(kin)
    5151{
    5252  tallyEdep = new G4double[MaxTally];
    53   binLength = offsetX = 0.;
    54   histo = new Histo();
    55   histo->setFileName("testem7");
    56   histo->add1D("1","Edep (MeV/mm) along absorber (mm)", 100, 0, 100);
    57   histo->add1D("2","Edep (MeV/mm) along absorber zoomed (mm)", 100, 0, 100);
    58   histo->add1D("3","Projectile range (mm)", 100, 0, 100);
    5953}
    6054
     
    6458{
    6559  delete [] tallyEdep;
    66   delete histo; 
    67 }
    68 
    69 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    70 
    71 void RunAction::FillHisto(G4int ih, G4double x, G4double weight)
    72 {
    73   histo->fill(ih, x, weight);
    7460}
    7561
     
    9480
    9581  // define "1" histogram binning
    96   length  = detector->GetAbsorSizeX();
     82  // histogram "1" is defined by the length of the target
     83  // zoomed histograms are defined by UI command 
     84  G4double length  = detector->GetAbsorSizeX();
    9785  G4double stepMax = physics->GetStepMaxProcess()->GetMaxStep();
    98   const G4int nbmin = 100;
     86  G4int nbmin = 100;
    9987  G4int nbBins = (G4int)(0.5 + length/stepMax);
    10088  if (nbBins < nbmin) nbBins = nbmin;
    101   binLength = length/nbBins;
    102   offsetX   = 0.5*length;
    103    
    104   // histogram "1" is defined by the length of the target
    105   // zoomed histograms are defined by UI command
    106   histo->setHisto1D(0, nbBins, 0, length, mm);
     89  histoManager->SetHisto(1, nbBins, 0., length, "mm");
    10790 
    108   histo->book();
     91  histoManager->book();
    10992}
    11093
     
    147130  G4cout << " Mean number of primary steps = "<< nstep << G4endl;
    148131
    149   //compute energy deposition and NIEL
     132  //compute energy deposition and niel
    150133  //
    151134  edeptot /= NbofEvents;
     
    153136         << G4endl;
    154137  eniel /= NbofEvents;
    155   G4cout << " NIEL energy deposit = "<< G4BestUnit(eniel,"Energy")
     138  G4cout << " niel energy deposit = "<< G4BestUnit(eniel,"Energy")
    156139         << G4endl;
    157140     
     
    176159  }
    177160
    178   // normalize histogram
    179   G4double fac = (mm/MeV)/(NbofEvents *  binLength);
    180   for (G4int j=0; j<3; j++) {histo->scale(j, fac);}
     161  // normalize histograms
     162  for (G4int j=1; j<3; j++) { 
     163    G4double binWidth = histoManager->GetBinWidth(j);
     164    G4double fac = (mm/MeV)/(NbofEvents * binWidth);
     165    histoManager->Scale(j, fac);
     166  }
     167  histoManager->Scale(3, 1./NbofEvents);
    181168 
    182169  // save and clean histo
    183   histo->save();
     170  histoManager->save();
    184171 
    185172  // show Rndm status
  • trunk/examples/extended/electromagnetic/TestEm7/src/SteppingAction.cc

    r1337 r1342  
    2424// ********************************************************************
    2525//
    26 // $Id: SteppingAction.cc,v 1.14 2008/08/22 18:30:27 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     26// $Id: SteppingAction.cc,v 1.15 2010/09/17 18:45:43 maire Exp $
     27// GEANT4 tag $Name: examples-V09-03-09 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3232#include "SteppingAction.hh"
    3333#include "DetectorConstruction.hh"
     34#include "HistoManager.hh"
    3435#include "RunAction.hh"
    3536#include "G4SteppingManager.hh"
     
    3839//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    3940
    40 SteppingAction::SteppingAction(DetectorConstruction* det,RunAction* RuAct)
    41 :detector(det),runAction(RuAct)
     41SteppingAction::SteppingAction(DetectorConstruction* det, HistoManager* histo,
     42                                RunAction* RuAct)
     43:detector(det), histoManager(histo), runAction(RuAct)
    4244{ }
    4345
     
    4951//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    5052
    51 void SteppingAction::UserSteppingAction(const G4Step* aStep)
     53void SteppingAction::UserSteppingAction(const G4Step* step)
    5254{
    53   G4double edep = aStep->GetTotalEnergyDeposit();
     55  G4double edep = step->GetTotalEnergyDeposit();
    5456  if (edep <= 0.) return;
     57 
     58  G4double niel = step->GetNonIonizingEnergyDeposit();
    5559
    56   // G4cout << "edep= " << edep << "NIEL= " << aStep->GetNonIonizingEnergyDeposit()<<G4endl;
     60  runAction->FillEdep(edep, niel);
    5761
    58   runAction->FillEdep(edep,aStep->GetNonIonizingEnergyDeposit());
    59 
    60   if(aStep->GetTrack()->GetTrackID() == 1) runAction->AddPrimaryStep(); 
     62  if (step->GetTrack()->GetTrackID() == 1) runAction->AddPrimaryStep(); 
    6163 
    6264  //Bragg curve
    6365  //   
    64   G4StepPoint* prePoint  = aStep->GetPreStepPoint();
    65   G4StepPoint* postPoint = aStep->GetPostStepPoint();
     66  G4StepPoint* prePoint  = step->GetPreStepPoint();
     67  G4StepPoint* postPoint = step->GetPostStepPoint();
    6668   
    67   G4double x1 = prePoint->GetPosition().x(), x2 = postPoint->GetPosition().x(); 
    68   G4double x = runAction->GetOffsetX() + x1 + G4UniformRand()*(x2-x1);
    69   runAction->FillHisto(0, x/mm , edep);
    70   runAction->FillHisto(1, x/mm , edep);
     69  G4double x1 = prePoint->GetPosition().x();
     70  G4double x2 = postPoint->GetPosition().x(); 
     71  G4double x  = x1 + G4UniformRand()*(x2-x1) + 0.5*(detector->GetAbsorSizeX());
     72  histoManager->FillHisto(1, x, edep);
     73  histoManager->FillHisto(2, x, edep);
    7174
    7275  //fill tallies
  • trunk/examples/extended/electromagnetic/TestEm7/src/TrackingAction.cc

    r1337 r1342  
    2424// ********************************************************************
    2525//
    26 // $Id: TrackingAction.cc,v 1.5 2008/08/22 18:30:27 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     26// $Id: TrackingAction.cc,v 1.6 2010/09/17 18:45:43 maire Exp $
     27// GEANT4 tag $Name: examples-V09-03-09 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3232#include "TrackingAction.hh"
    3333
     34#include "DetectorConstruction.hh"
     35#include "HistoManager.hh"
    3436#include "RunAction.hh"
    3537
     
    3840//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    3941
    40 TrackingAction::TrackingAction(RunAction* run)
    41 :runAction(run)
     42TrackingAction::TrackingAction(DetectorConstruction* det, HistoManager* histo,
     43                               RunAction* run)
     44:detector(det), histoManager(histo), runAction(run)
    4245{ }
    4346
    4447//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    4548
    46 void TrackingAction::PostUserTrackingAction(const G4Track* aTrack)
     49void TrackingAction::PostUserTrackingAction(const G4Track* track)
    4750{
    4851  // extract Projected Range of primary particle
    49   if (aTrack->GetTrackID() == 1) {
    50     G4double x = aTrack->GetPosition().x() + runAction->GetOffsetX();
    51     if(x > runAction->GetLength()) x = runAction->GetLength();
    52     //G4cout << " range= " << x << " x= " << aTrack->GetPosition().x()
    53     //     << " ofset= " << runAction->GetOffsetX() << G4endl;
     52  if (track->GetTrackID() == 1) {
     53    G4double x = track->GetPosition().x() + 0.5*detector->GetAbsorSizeX();
    5454    if(x > 0.0) runAction->AddProjRange(x);
    55     runAction->FillHisto(2, x/mm, 1.0);
     55    histoManager->FillHisto(3, x);
    5656  } 
    5757}
Note: See TracChangeset for help on using the changeset viewer.