MuEnergyLoss Class Reference

#include <MuEnergyLoss.h>

List of all members.

Public Member Functions

 MuEnergyLoss ()
 MuEnergyLoss (const Material &material, const ModelSelector &model_selector)
 ~MuEnergyLoss ()
double dE_dx (double E, Process::Process_t process)

Private Attributes

map< int, EnergyLossProcess * > * fComputer
CachefCache

Detailed Description

________________________________________________________________________________________

Id
MuEnergyLoss.cxx,v 1.3 2007/02/09 17:39:29 rhatcher Exp

________________________________________________________________________________________

Id
MuEnergyLoss.h,v 1.2 2004/01/05 16:11:13 costas Exp

Definition at line 46 of file MuEnergyLoss.h.


Constructor & Destructor Documentation

MuEnergyLoss::MuEnergyLoss (  ) 

Definition at line 34 of file MuEnergyLoss.cxx.

00035 {
00036 
00037 }

MuEnergyLoss::MuEnergyLoss ( const Material material,
const ModelSelector model_selector 
)

Definition at line 39 of file MuEnergyLoss.cxx.

References Model::eBetheBloch, Model::eBezrukovBugaev, Process::eBremsstrahlung, Process::eIonization, Model::eKokoulinPetrukhin, Process::eNuclearInteraction, Process::ePairProduction, Model::ePetrukhinShestakov, fCache, and fComputer.

00040 {
00041   cout << model_selector;
00042   
00043   EnergyLossProcess * ion, * brem, * epair, * pnucl;
00044   ion = brem = epair = pnucl = 0;
00045 
00046   switch( model_selector.GetModel(Process::eIonization) ) {
00047     case (Model::eBetheBloch) :
00048                 ion = new Ionization<BetheBlochModel>(material);
00049                 break;
00050     default:
00051                 cerr << "Null Ionization model" << endl;
00052                 ion = new Ionization<NullModel>; 
00053   }  
00054   switch( model_selector.GetModel(Process::eBremsstrahlung) ) {
00055     case (Model::ePetrukhinShestakov) :
00056                 brem = new Bremsstrahlung<PetrukhinShestakovModel>(material);
00057                 break;
00058     default:
00059                 cerr << "Null Bremsstrahlung model" << endl;
00060                 brem = new Bremsstrahlung<NullModel>;
00061   }
00062   switch( model_selector.GetModel(Process::ePairProduction) ) {
00063     case (Model::eKokoulinPetrukhin) :
00064                 epair = new DirectElectronPairProduction<KokoulinPetrukhinModel>(material);
00065                 break;
00066     default:
00067                 cerr << "Null Direct e+e- pair production model" << endl;
00068                 brem = new Bremsstrahlung<NullModel>;
00069   }
00070   switch( model_selector.GetModel(Process::eNuclearInteraction) ) {
00071     case (Model::eBezrukovBugaev) :
00072                 pnucl = new NuclearInteraction<BezrukovBugaevModel>(material);
00073                 break;
00074     default:
00075                 cerr << "Null Direct photo-nuclear interaction model" << endl;
00076                 brem = new NuclearInteraction<NullModel>;
00077   }
00078                 
00079   fComputer = new map<int, EnergyLossProcess *>;
00080 
00081   typedef map<int, EnergyLossProcess *>::value_type comp_pair;
00082   
00083   fComputer->insert(comp_pair( (int) Process::eIonization,         ion)   );
00084   fComputer->insert(comp_pair( (int) Process::eBremsstrahlung,     brem)  );
00085   fComputer->insert(comp_pair( (int) Process::ePairProduction,     epair) );
00086   fComputer->insert(comp_pair( (int) Process::eNuclearInteraction, pnucl) );
00087 
00088   fCache = new Cache;
00089 }

MuEnergyLoss::~MuEnergyLoss (  ) 

Definition at line 91 of file MuEnergyLoss.cxx.

References Process::eBremsstrahlung, Process::eIonization, Process::eNuclearInteraction, Process::ePairProduction, fCache, and fComputer.

00092 {
00093   if(fCache)  delete fCache;
00094 
00095   if(fComputer) {
00096        delete ( fComputer->find( (int) Process::eIonization         )->second );
00097        delete ( fComputer->find( (int) Process::eBremsstrahlung     )->second );
00098        delete ( fComputer->find( (int) Process::ePairProduction     )->second );
00099        delete ( fComputer->find( (int) Process::eNuclearInteraction )->second );
00100        fComputer->clear();
00101        delete fComputer;
00102   }
00103 }


Member Function Documentation

double MuEnergyLoss::dE_dx ( double  E,
Process::Process_t  process 
)

Definition at line 105 of file MuEnergyLoss.cxx.

References Cache::AddToCache(), fCache, fComputer, Cache::Retrieve(), and Munits::second.

Referenced by CDSimpleMC::dE_dxIterative(), CDAnalysis::dE_dxIterative(), and CDSimpleMC::RunMC().

00106 {
00107    double dE_dx = 0;
00108    
00109    //-- check if this value was already cached -- if yes, return cached value
00110    if( fCache->Retrieve(process, E, dE_dx) ) return dE_dx;
00111    
00112    else {
00113       //-- the value is not cached, do the calculation now
00114       dE_dx = (fComputer->find( (int) process) )->second->dE_dx(E);
00115 
00116       //-- cache the value
00117       fCache->AddToCache( process, E, dE_dx );
00118 
00119       // return
00120       return dE_dx;
00121    }
00122    return 0;
00123 }


Member Data Documentation

Definition at line 58 of file MuEnergyLoss.h.

Referenced by dE_dx(), MuEnergyLoss(), and ~MuEnergyLoss().

Definition at line 57 of file MuEnergyLoss.h.

Referenced by dE_dx(), MuEnergyLoss(), and ~MuEnergyLoss().


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1