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

update ti head

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/extended/electromagnetic/TestEm16/src/SteppingAction.cc

    r1337 r1342  
    2424// ********************************************************************
    2525//
    26 // $Id: SteppingAction.cc,v 1.5 2007/01/18 09:07:20 hbu Exp $
    27 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     26// $Id: SteppingAction.cc,v 1.6 2010/10/13 13:50:22 vnivanch Exp $
     27// GEANT4 tag $Name: examples-V09-03-09 $
    2828//
    2929//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    3737#include "G4UnitsTable.hh"
    3838#include "HistoManager.hh"
     39#include "G4EmProcessSubType.hh"
    3940
    4041//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
     
    5354void SteppingAction::UserSteppingAction(const G4Step* aStep)
    5455{
    55  const G4VProcess* process = aStep->GetPostStepPoint()->GetProcessDefinedStep();
    56  if (process == 0) return;
    57  G4String processName = process->GetProcessName();
    58  static G4int iCalled=0;
    59  const  G4int nprint=0; // set to 10 to get debug print for first 10 calls
     56  const G4VProcess* process = aStep->GetPostStepPoint()->GetProcessDefinedStep();
     57  if (process == 0) { return; }
    6058
    61  if (processName == "SynRad")
    62  {
    63    iCalled++;
    64    G4StepPoint* PrePoint = aStep->GetPreStepPoint();
    65    G4TrackVector* secondary = fpSteppingManager->GetSecondary();
     59  static G4int iCalled=0;
     60  const  G4int nprint=0; // set to 10 to get debug print for first 10 calls
    6661
    67    //(*secondary)[lp-1]  points to the last photon generated
    68    //   
    69    size_t lp=(*secondary).size();
    70    if (lp)
    71    {
    72      G4double  Egamma =  (*secondary)[lp-1]->GetTotalEnergy();
    73      runAction->n_gam_sync++;
    74      runAction->e_gam_sync += Egamma;
    75      runAction->e_gam_sync2 += Egamma*Egamma;
    76      if (Egamma > runAction->e_gam_sync_max) runAction->e_gam_sync_max = Egamma;
    77      runAction->lam_gam_sync += aStep->GetStepLength();
    78      if (iCalled<nprint)
    79      {
    80        G4double      Eelec  = PrePoint->GetTotalEnergy();
    81        G4ThreeVector Pelec  = PrePoint->GetMomentum();
    82        G4ThreeVector PGamma = (*secondary)[lp-1]->GetMomentum();
    83        G4bool IsGamma =
    84             ((*secondary)[lp-1]->GetDefinition() == G4Gamma::GammaDefinition());
     62  if (fSynchrotronRadiation == process->GetProcessSubType())
     63    {
     64      ++iCalled;
     65      const G4StepPoint* PrePoint = aStep->GetPreStepPoint();
     66      const G4TrackVector* secondary = fpSteppingManager->GetSecondary();
     67
     68      //(*secondary)[lp-1]  points to the last photon generated
     69      //   
     70      size_t lp=(*secondary).size();
     71      if (lp)
     72        {
     73          G4double  Egamma =  (*secondary)[lp-1]->GetTotalEnergy();
     74          runAction->n_gam_sync++;
     75          runAction->e_gam_sync += Egamma;
     76          runAction->e_gam_sync2 += Egamma*Egamma;
     77          if (Egamma > runAction->e_gam_sync_max)
     78            {
     79              runAction->e_gam_sync_max = Egamma;
     80            }
     81          runAction->lam_gam_sync += aStep->GetStepLength();
     82          if (iCalled<nprint)
     83            {
     84              G4double      Eelec  = PrePoint->GetTotalEnergy();
     85              G4ThreeVector Pelec  = PrePoint->GetMomentum();
     86              G4ThreeVector PGamma = (*secondary)[lp-1]->GetMomentum();
     87              G4bool IsGamma =
     88                ((*secondary)[lp-1]->GetDefinition() == G4Gamma::Gamma());
    8589           
    86        G4cout << "UserSteppingAction processName=" << process->GetProcessName()
    87          << " Step Length=" << std::setw(6)
    88                             << G4BestUnit(aStep->GetStepLength(),"Length")
    89          << " Eelec=" << G4BestUnit(Eelec,"Energy")
    90          << " Pelec=" << G4BestUnit(Pelec,"Energy")
    91          << " IsGamma=" << IsGamma
    92          << " Egamma=" << G4BestUnit(Egamma,"Energy")
    93          << " PGamma=" << G4BestUnit(PGamma,"Energy")
    94          << " #secondaries lp=" << lp
    95          << '\n';
    96          }
    97      histoManager->FillHisto(1,Egamma);
    98      histoManager->FillHisto(2,Egamma,Egamma/keV); // power spectrum : gamma weighted with its energy
    99      histoManager->FillHisto(3,aStep->GetStepLength());
    100    }
    101  }
     90              G4cout << "UserSteppingAction processName=" << process->GetProcessName()
     91                     << " Step Length=" << std::setw(6)
     92                     << G4BestUnit(aStep->GetStepLength(),"Length")
     93                     << " Eelec=" << G4BestUnit(Eelec,"Energy")
     94                     << " Pelec=" << G4BestUnit(Pelec,"Energy")
     95                     << " IsGamma=" << IsGamma
     96                     << " Egamma=" << G4BestUnit(Egamma,"Energy")
     97                     << " PGamma=" << G4BestUnit(PGamma,"Energy")
     98                     << " #secondaries lp=" << lp
     99                     << '\n';
     100            }
     101          histoManager->FillHisto(1,Egamma);
    102102
     103          // power spectrum : gamma weighted with its energy
     104          histoManager->FillHisto(2,Egamma,Egamma/keV);
     105
     106          histoManager->FillHisto(3,aStep->GetStepLength());
     107        }
     108    }
    103109}
    104110
Note: See TracChangeset for help on using the changeset viewer.