library: libEG
#include "TGenerator.h"


class description - header file - source file
viewCVS header - viewCVS source

class TGenerator: public TNamed

Inheritance Inherited Members Includes Libraries
Class Charts

Function Members (Methods)

Display options:
Show inherited
Show non-public
TGenerator(const char* name, const char* title = "Generator class")
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidBrowse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTNamed::Clear(Option_t* option = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual voidTNamed::Copy(TObject& named) const
virtual voidTObject::Delete(Option_t* option = "")
virtual Int_tDistancetoPrimitive(Int_t px, Int_t py)
virtual voidDraw(Option_t* option = "")
virtual voidTObject::DrawClass() const
virtual TObject*TObject::DrawClone(Option_t* option = "") const
virtual voidTObject::Dump() const
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidTNamed::FillBuffer(char*& buffer)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
virtual voidGenerateEvent()
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
virtual TObjArray*GetListOfParticles() const
virtual const char*TNamed::GetName() const
Int_tGetNumberOfParticles() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
virtual Double_tGetParameter(const char*) const
virtual TParticle*GetParticle(Int_t i) const
virtual TObjArray*GetPrimaries(Option_t* option = "")
Float_tGetPtCut() const
virtual const char*TNamed::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() const
virtual TObjArray*ImportParticles(Option_t* option = "")
virtual Int_tImportParticles(TClonesArray* particles, Option_t* option = "")
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() const
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTNamed::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTNamed::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
virtual voidPaint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTNamed::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") const
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTObject::SetDrawOption(Option_t* option = "")
static voidTObject::SetDtorOnly(void* obj)
virtual voidTNamed::SetName(const char* name)
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidSetParameter(const char*, Double_t)
virtual voidSetPtCut(Float_t ptcut = 0)
virtual voidTNamed::SetTitle(const char* title = "")
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidSetViewRadius(Float_t rbox = 1000)
virtual voidSetViewRange(Float_t xmin = -10000, Float_t ymin = -10000, Float_t zmin = -10000, Float_t xmax = 10000, Float_t ymax = 10000, Float_t zmax = 10000)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual voidShowNeutrons(Bool_t show = 1)
virtual Int_tTNamed::Sizeof() const
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = "0", Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = "0", Int_t option = 0, Int_t bufsize = 0) const
TGenerator(const TGenerator& tg)
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
TGenerator&operator=(const TGenerator& tg)

Data Members

enum TObject::EStatusBits { kCanDelete
enum TObject::[unnamed] { kIsOnHeap
Float_tfPtCut!Pt cut. Do not show primaries below
Bool_tfShowNeutrons!display neutrons if true
TObjArray*fParticles->static container of the primary particles
TStringTNamed::fNameobject identifier
TStringTNamed::fTitleobject title

Class Description

 Is an base class, that defines the interface of ROOT to various   	
 event generators. Every event generator should inherit from       	
 TGenerator or its subclasses.                                        
 Derived class can overload the member  function GenerateEvent        
 to do the actual event generation (e.g., call PYEVNT or similar).    
 The derived class should overload the member function                
 ImportParticles (both types) to read the internal storage of the     
 generated event into either the internal TObjArray or the passed     
 TClonesArray of TParticles.                                          
 If the generator code stores event data in the /HEPEVT/ common block 
 Then the default implementation of ImportParticles should suffice.   
 The common block /HEPEVT/ is structed like                           
   /* C */                                                            
   typedef struct {                                                   
      Int_t    nevhep;           // Event number                      
      Int_t    nhep;             // # of particles                    
      Int_t    isthep[4000];     // Status flag of i'th particle      
      Int_t    idhep[4000];      // PDG # of particle                 
      Int_t    jmohep[4000][2];  // 1st & 2nd mother particle #	      
      Int_t    jdahep[4000][2];  // 1st & 2nd daughter particle #     
      Double_t phep[4000][5];    // 4-momentum and 1 word             
      Double_t vhep[4000][4];    // 4-position of production          
   } HEPEVT_DEF;                                                      
   C Fortran                                                          
       +    JMOHEP(2,4000),JDAHEP(2,4000),PHEP(5,4000),VHEP(4,4000)   
         DOUBLE PRECISION PHEP,VHEP                                   
 The generic member functions SetParameter and GetParameter can be    
 overloaded to set and get parameters of the event generator.         
 Note, if the derived class interfaces a (set of) Fortran common      
 blocks (like TPythia, TVenus does), one better make the derived      
 class a singleton.  That is, something like                          
     class MyGenerator : public TGenerator                            
       static MyGenerator* Instance()                                 
         if (!fgInstance) fgInstance = new MyGenerator;               
         return fgInstance;                                           
       void  GenerateEvent() { ... }                                  
       void  ImportParticles(TClonesArray* a, Option_t opt="") {...}  
       Int_t ImportParticles(Option_t opt="") { ... }                 
       Int_t    SetParameter(const char* name, Double_t val) { ... }  
       Double_t GetParameter(const char* name) { ... }                
       virtual ~MyGenerator() { ... }                                 
       MyGenerator() { ... }                                          
       MyGenerator(const MyGenerator& o) { ... }                      
       MyGenerator& operator=(const MyGenerator& o) { ... }           
       static MyGenerator* fgInstance;                                
 Having multiple objects accessing the same common blocks is not      
 concrete TGenerator classes can be loaded in scripts and subseqent-  
 ly used in compiled code:                                            
     // MyRun.h                                                       
     class MyRun : public TObject                                     
       static MyRun* Instance() { ... }                               
       void SetGenerator(TGenerator* g) { fGenerator = g; }           
       void Run(Int_t n, Option_t* option="")                         
         TFile*        file = TFile::Open("file.root","RECREATE");    
         TTree*        tree = new TTree("T","T");                     
         TClonesArray* p    = new TClonesArray("TParticles");         
         tree->Branch("particles", &p);                               
         for (Int_t event = 0; event < n; event++) {                  
       TGenerator* fGenerator;                                        
     // Config.C                                                      
     void Config()                                                    
        MyRun* run = MyRun::Instance();                               
     // main.cxx                                                      
     main(int argc, char** argv)                                      
       TApplication app("", 0, 0);                                    
       gSystem->ProcessLine(".x Config.C");                           
       return 0;                                                      
 This is especially useful for example with TVirtualMC or similar.    

TGenerator(const char *name,const char *title)
  Event generator default constructor

  Event generator default destructor

void GenerateEvent()
 must be implemented in concrete class (see eg TPythia6)
TObjArray* ImportParticles(Option_t *option)
  It reads the /HEPEVT/ common block which has been filled by the
  GenerateEvent method. If the event generator does not use the
  HEPEVT common block, This routine has to be overloaded by the

  The default action is to store only the stable particles (ISTHEP =
  1) This can be demanded explicitly by setting the option = "Final"
  If the option = "All", all the particles are stored.

Int_t ImportParticles(TClonesArray *particles, Option_t *option)
  It reads the /HEPEVT/ common block which has been filled by the
  GenerateEvent method. If the event generator does not use the
  HEPEVT common block, This routine has to be overloaded by the

  The function loops on the generated particles and store them in
  the TClonesArray pointed by the argument particles.  The default
  action is to store only the stable particles (ISTHEP = 1) This can
  be demanded explicitly by setting the option = "Final" If the
  option = "All", all the particles are stored.

void Browse(TBrowser *)
browse generator
Int_t DistancetoPrimitive(Int_t px, Int_t py)
*-*-*-*-*-*-*-*Compute distance from point px,py to objects in event*-*-*-*
*-*            =====================================================
void Draw(Option_t *option)
  Insert one event in the pad list

void ExecuteEvent(Int_t event, Int_t px, Int_t py)
*-*-*-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-*
*-*                  =========================================
TParticle * GetParticle(Int_t i)
  Returns pointer to primary number i;

void Paint(Option_t *)
  Paint one event

void SetPtCut(Float_t ptcut)
  Set Pt threshold below which primaries are not drawn

void SetViewRadius(Float_t rbox)
  Set lower and upper values of the view range

void SetViewRange(Float_t xmin, Float_t ymin, Float_t zmin, Float_t xmax, Float_t ymax, Float_t zmax)
  Set lower and upper values of the view range

void ShowNeutrons(Bool_t show)
  Set flag to display or not neutrons

TGenerator(const TGenerator& tg)
{ }
TGenerator& operator=(const TGenerator& tg)
{ }
Double_t GetParameter(const char* /*name*/)
{ return 0.; }
Int_t GetNumberOfParticles()
{return fParticles->GetLast()+1;}
TObjArray * GetListOfParticles()
{return fParticles;}
TObjArray * GetPrimaries(Option_t *option="")
{return ImportParticles(option);}
Float_t GetPtCut()
{return fPtCut;}
void SetParameter(const char* /*name*/,Double_t /*val*/)

Author: Ola Nordmann 21/09/95
Last update: root/eg:$Name: $:$Id: TGenerator.cxx,v 1.13 2006/08/24 16:31:21 rdm Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *

ROOT page - Class index - Class Hierarchy - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.