TVirtualMC.cxx

Go to the documentation of this file.
00001 // @(#)root/vmc:$Id: TVirtualMC.cxx 36585 2010-11-10 15:06:57Z ivana $
00002 // Authors: Ivana Hrivnacova, Rene Brun , Federico Carminati 13/04/2002
00003 
00004 /*************************************************************************
00005  * Copyright (C) 2006, Rene Brun and Fons Rademakers.                    *
00006  * Copyright (C) 2002, ALICE Experiment at CERN.                         *
00007  * All rights reserved.                                                  *
00008  *                                                                       *
00009  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00010  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00011  *************************************************************************/
00012 
00013 #include "TVirtualMC.h"
00014 
00015 //______________________________________________________________________________
00016 //   Virtual MC provides a virtual interface to Monte Carlo.
00017 //   It enables the user to build a virtual Monte Carlo application
00018 //   independent of any actual underlying Monte Carlo implementation itself.
00019 //
00020 //   A user will have to implement a class derived from the abstract
00021 //   Monte Carlo application class, and provide functions like
00022 //   ConstructGeometry(), BeginEvent(), FinishEvent(), ... .
00023 //   The concrete Monte Carlo (Geant3, Geant4) is selected at run time -
00024 //   when processing a ROOT macro where the concrete Monte Carlo is instantiated.
00025 //______________________________________________________________________________
00026 
00027 ClassImp(TVirtualMC)
00028 
00029 TVirtualMC* TVirtualMC::fgMC=0;
00030 TVirtualMC* gMC;
00031 
00032 //_____________________________________________________________________________
00033 TVirtualMC::TVirtualMC(const char *name, const char *title,
00034                        Bool_t /*isRootGeometrySupported*/)
00035   : TNamed(name,title),
00036     fStack(0),
00037     fDecayer(0),
00038     fRandom(0),
00039     fMagField(0)
00040 {
00041    //
00042    // Standard constructor
00043    //
00044    if(fgMC) {
00045       Warning("TVirtualMC","Cannot initialise twice MonteCarlo class");
00046    } else {
00047       fgMC=this;
00048       gMC=this;
00049 
00050       fApplication = TVirtualMCApplication::Instance();
00051 
00052       if (!fApplication) {
00053          Error("TVirtualMC", "No user MC application is defined.");
00054       }
00055 
00056       fRandom = gRandom;
00057    }
00058 }
00059 
00060 //_____________________________________________________________________________
00061 TVirtualMC::TVirtualMC()
00062   : TNamed(),
00063     fApplication(0),
00064     fStack(0),
00065     fDecayer(0),
00066     fRandom(0),
00067     fMagField(0)
00068 {
00069    //
00070    // Default constructor
00071    //
00072 }
00073 
00074 //_____________________________________________________________________________
00075 TVirtualMC::~TVirtualMC()
00076 {
00077    //
00078    // Destructor
00079    //
00080    fgMC=0;
00081    gMC=0;
00082 }
00083 
00084 //
00085 // methods
00086 //
00087 
00088 
00089 //_____________________________________________________________________________
00090 TVirtualMC *TVirtualMC::GetMC()
00091 {
00092    //static: return virtual MC object
00093    return fgMC;
00094 }
00095 
00096 //_____________________________________________________________________________
00097 void TVirtualMC::SetStack(TVirtualMCStack* stack)
00098 {
00099 //
00100 // Set particles stack.
00101 //
00102 
00103    fStack = stack;
00104 }
00105 
00106 //_____________________________________________________________________________
00107 void TVirtualMC::SetExternalDecayer(TVirtualMCDecayer* decayer)
00108 {
00109 //
00110 // Set external decayer.
00111 //
00112 
00113    fDecayer = decayer;
00114 }
00115 
00116 //_____________________________________________________________________________
00117 void TVirtualMC::SetRandom(TRandom* random)
00118 {
00119 //
00120 // Set random number generator.
00121 //
00122    gRandom = random;
00123    fRandom = random;
00124 }
00125 
00126 //_____________________________________________________________________________
00127 void TVirtualMC::SetMagField(TVirtualMagField* field)
00128 {
00129 //
00130 // Set magnetic field.
00131 //
00132    fMagField = field;
00133 }

Generated on Tue Jul 5 14:45:27 2011 for ROOT_528-00b_version by  doxygen 1.5.1