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

update ti head

Location:
trunk/examples/extended/medical/GammaTherapy/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/extended/medical/GammaTherapy/src/Histo.cc

    r807 r1342  
    2424// ********************************************************************
    2525//
     26// $Id: Histo.cc,v 1.10 2010/10/26 12:05:14 vnivanch Exp $
     27// GEANT4 tag $Name: examples-V09-03-09 $
     28//
    2629//---------------------------------------------------------------------------
    2730//
     
    3841
    3942#include "Histo.hh"
     43#include "G4Gamma.hh"
     44#include "G4Electron.hh"
     45#include "G4Positron.hh"
     46#include "G4Neutron.hh"
    4047#include <iomanip>
    4148
     
    6572  verbose   = 1;
    6673  histName  = G4String("histo");
    67   histType  = G4String("hbook");
     74  histType  = G4String("root");
    6875  nHisto    = 10;
    6976  nHisto1   = 10;
     
    7683  absorberR = 200.*mm;
    7784  scoreZ    = 100.*mm;
     85
     86  gamma    = G4Gamma::Gamma();
     87  electron = G4Electron::Electron();
     88  positron = G4Positron::Positron();
     89  neutron  = G4Neutron::Neutron();
    7890
    7991#ifdef G4ANALYSIS_USE
     
    206218    }
    207219    tree->close();
     220    delete tree;
     221    tree = 0;
    208222    G4cout << "Tree is closed" << G4endl;
    209223  }
     
    256270
    257271  // Creating a tree mapped to a new hbook file.
    258   G4String tt = "hbook";
    259   G4String nn = histName + ".hbook";
    260   if(histType == "root") {
    261     tt = "root";
    262     nn = histName + ".root";
    263   } else if(histType == "xml" || histType == "XML"
    264             || histType == "aida" || histType == "AIDA") {
     272  G4String tt = histType;
     273  G4String nn = histName + "." + histType;
     274  if(histType == "xml" || histType == "XML" || histType == "aida" ||
     275     histType == "AIDA") {
    265276    tt = "xml";
    266277    nn = histName + ".aida";
    267278  }
    268279
    269   tree = tf->create(nn,tt,false,true, "--noErrors uncompress");
     280  tree = tf->create(nn,tt,false,true, "");
    270281  if(tree) {
    271282    G4cout << "Tree store : " << tree->storeName() << G4endl;
     
    317328  // If using Anaphe HBOOK implementation, there is a limitation on the
    318329  // length of the variable names in a ntuple
    319   if(nTuple)
     330  if(nTuple) {
    320331     ntup = tpf->create( "100", "Dose deposite","float r, z, e" );
    321 
     332  }
    322333  delete hf;
    323334  delete tpf;
     
    330341{
    331342  G4double e = elec->GetKineticEnergy()/MeV;
    332   if(e > 0.0) n_elec++;
     343  if(e > 0.0) { ++n_elec; }
    333344}
    334345
     
    338349{
    339350  G4double e = ph->GetKineticEnergy()/MeV;
    340   if(e > 0.0) n_gam++;
     351  if(e > 0.0) { ++n_gam; }
    341352}
    342353
     
    346357{
    347358  G4double e = ph->GetKineticEnergy()/MeV;
    348   if(e > 0.0) n_gam_tar++;
     359  if(e > 0.0) { ++n_gam_tar; }
    349360#ifdef G4ANALYSIS_USE
    350361  if(tree) histo[5]->fill(e,1.0);
     
    357368{
    358369  G4double e = ph->GetKineticEnergy()/MeV;
    359   if(e > 0.0) n_gam_ph++;
     370  if(e > 0.0) { ++n_gam_ph; }
    360371}
    361372
     
    365376{
    366377  G4double e = ph->GetKineticEnergy()/MeV;
    367   if(e > 0.0) n_e_tar++;
     378  if(e > 0.0) { ++n_e_tar; }
    368379#ifdef G4ANALYSIS_USE
    369380  if(tree) histo[8]->fill(e,1.0);
     
    376387{
    377388  G4double e = ph->GetKineticEnergy()/MeV;
    378   if(e > 0.0) n_e_ph++;
     389  if(e > 0.0) { ++n_e_ph; }
    379390#ifdef G4ANALYSIS_USE
    380391  if(tree) histo[7]->fill(e,1.0);
     
    389400
    390401  ResetTrackLength();
    391   G4ParticleDefinition* particle = aTrack->GetDefinition();
    392   G4String name = particle->GetParticleName();
     402  const G4ParticleDefinition* particle = aTrack->GetParticleDefinition();
    393403  G4int pid = aTrack->GetParentID();
    394404  G4double kinE = aTrack->GetKineticEnergy();
     
    416426
    417427    // delta-electron
    418   } else if (0 < pid && "e-" == name) {
     428  } else if (0 < pid && particle == electron) {
    419429    if(1 < verbose) {
    420430      G4cout << "TrackingAction: Secondary electron " << G4endl;
    421431    }
    422432    AddDeltaElectron(dp);
    423     if(pv == phantom)                       AddPhantomElectron(dp);
    424     else if(pv == target1 || pv == target2) AddTargetElectron(dp);
    425 
    426   } else if (0 < pid && "e+" == name) {
     433    if(pv == phantom)                       { AddPhantomElectron(dp); }
     434    else if(pv == target1 || pv == target2) { AddTargetElectron(dp); }
     435
     436  } else if (0 < pid && particle == positron) {
    427437    if(1 < verbose) {
    428438      G4cout << "TrackingAction: Secondary positron " << G4endl;
     
    430440    AddPositron(dp);
    431441
    432   } else if (0 < pid && "gamma" == name) {
     442  } else if (0 < pid && particle == gamma) {
    433443    if(1 < verbose) {
    434444      G4cout << "TrackingAction: Secondary gamma; parentID= " << pid
     
    436446    }
    437447    AddPhoton(dp);
    438     if(pv == phantom)                       AddPhantomPhoton(dp);
    439     else if(pv == target1 || pv == target2) AddTargetPhoton(dp);
    440 
    441   } else if (0 < pid && "neutron" == name) {
     448    if(pv == phantom)                       { AddPhantomPhoton(dp); }
     449    else if(pv == target1 || pv == target2) { AddTargetPhoton(dp); }
     450
     451  } else if (0 < pid && particle == neutron) {
    442452    n_neutron++;
    443453    if(1 < verbose) {
     
    455465  sumR += e;
    456466  G4int bin = (G4int)(e/stepE);
    457   if(bin >= nBinsE) bin = nBinsE-1;
     467  if(bin >= nBinsE) { bin = nBinsE-1; }
    458468  gammaE[bin] += e;
    459469  G4int bin1 = (G4int)(r/stepR);
    460   if(bin1 >= nBinsR) bin1 = nBinsR-1;
     470  if(bin1 >= nBinsR) { bin1 = nBinsR-1; }
    461471#ifdef G4ANALYSIS_USE
    462472  if(tree) {
  • trunk/examples/extended/medical/GammaTherapy/src/TrackingAction.cc

    r807 r1342  
    5656TrackingAction::TrackingAction():
    5757  theHisto(Histo::GetPointer())
    58 {;}
     58{}
    5959
    6060//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    6161
    6262TrackingAction::~TrackingAction()
    63 {;}
     63{}
    6464
    6565//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    6868{
    6969  theHisto->ScoreNewTrack(aTrack);
    70   G4int pid = aTrack->GetParentID();
    71   const G4String name = aTrack->GetDefinition()->GetParticleName();
    7270
    7371  if(1 < theHisto->GetVerbose() &&
    74     (theHisto->GetMaxEnergy() < aTrack->GetKineticEnergy() && pid > 0))
    75   {
    76     G4cout << "Track #"
    77            << aTrack->GetTrackID() << " of " << name
    78            << " Emax(MeV)= " << theHisto->GetMaxEnergy()/MeV
    79            << " Ekin(MeV)= " << aTrack->GetKineticEnergy()/MeV
    80            << " ## EventID= "
    81            << (G4EventManager::GetEventManager())->GetConstCurrentEvent()
    82               ->GetEventID()
    83            << G4endl;
    84   }
     72     theHisto->GetMaxEnergy() < aTrack->GetKineticEnergy() &&
     73     aTrack->GetParentID() > 0)
     74    {
     75      G4cout << "Track #"
     76             << aTrack->GetTrackID() << " of "
     77             << aTrack->GetParticleDefinition()->GetParticleName()
     78             << " Emax(MeV)= " << theHisto->GetMaxEnergy()/MeV
     79             << " Ekin(MeV)= " << aTrack->GetKineticEnergy()/MeV
     80             << " ## EventID= "
     81             << (G4EventManager::GetEventManager())->GetConstCurrentEvent()->GetEventID()
     82             << G4endl;
     83    }
    8584
    8685}
Note: See TracChangeset for help on using the changeset viewer.