ROOT logo
ROOT » TEST » Event

class Event: public TObject


                       Event and Track classes


  The Event class is a naive/simple example of an event structure.
     public:
        char           fType[20];
        char          *fEventName;         //run+event number in character format
        Int_t          fNtrack;
        Int_t          fNseg;
        Int_t          fNvertex;
        UInt_t         fFlag;
        Double32_t     fTemperature;
        Int_t          fMeasures[10];
        Double32_t     fMatrix[4][4];
        Double32_t    *fClosestDistance; //[fNvertex] indexed array!
        EventHeader    fEvtHdr;
        TClonesArray  *fTracks;
        TRefArray     *fHighPt;            //array of High Pt tracks only
        TRefArray     *fMuons;             //array of Muon tracks only
        TRef           fLastTrack;         //pointer to last track
        TRef           fHistoWeb;          //EXEC:GetHistoWeb reference to an histogram in a TWebFile
        TH1F          *fH;
        TBits          fTriggerBits;       //Bits triggered by this event.

   The EventHeader class has 3 data members (integers):
     public:
        Int_t          fEvtNum;
        Int_t          fRun;
        Int_t          fDate;


   The Event data member fTracks is a pointer to a TClonesArray.
   It is an array of a variable number of tracks per event.
   Each element of the array is an object of class Track with the members:
     private:
        Float_t      fPx;           //X component of the momentum
        Float_t      fPy;           //Y component of the momentum
        Float_t      fPz;           //Z component of the momentum
        Float_t      fRandom;       //A random track quantity
        Float_t      fMass2;        //The mass square of this particle
        Float_t      fBx;           //X intercept at the vertex
        Float_t      fBy;           //Y intercept at the vertex
        Float_t      fMeanCharge;   //Mean charge deposition of all hits of this track
        Float_t      fXfirst;       //X coordinate of the first point
        Float_t      fXlast;        //X coordinate of the last point
        Float_t      fYfirst;       //Y coordinate of the first point
        Float_t      fYlast;        //Y coordinate of the last point
        Float_t      fZfirst;       //Z coordinate of the first point
        Float_t      fZlast;        //Z coordinate of the last point
        Double32_t   fCharge;       //Charge of this track
        Double32_t   fVertex[3];    //Track vertex position
        Int_t        fNpoint;       //Number of points for this track
        Short_t      fValid;        //Validity criterion
        Int_t        fNsp;          //Number of points for this track with a special value
        Double32_t  *fPointValue;   //[fNsp] a special quantity for some point.
        TBits        fTriggerBits;  //Bits triggered by this track.

   An example of a batch program to use the Event/Track classes is given
   in this directory: MainEvent.
   Look also in the same directory at the following macros:
     - eventa.C  an example how to read the tree
     - eventb.C  how to read events conditionally

   During the processing of the event (optionally) also a large number
   of histograms can be filled. The creation and handling of the
   histograms is taken care of by the HistogramManager class.

   Note:  This version of the class Event (see EventMT.h and EventMT.cxx
   for an alternative) uses static variables to improve performance (by
   reducing the number of memory allocations).  Consequently, only one
   instance of the class Event should be in use at a time (a 2nd instance
   would share the array of Tracks with the first instance).


Function Members (Methods)

public:
Event()
Event(const Event&)
virtual~Event()
voidTObject::AbstractMethod(const char* method) const
Track*AddTrack(Float_t random, Float_t ptmin = 1)
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
voidBuild(Int_t ev, Int_t arg5 = 600, Float_t ptmin = 1)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidClear(Option_t* option = "")
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTObject::Compare(const TObject* obj) const
virtual voidTObject::Copy(TObject& object) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
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 voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
Float_tGetClosestDistance(Int_t i)
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
UInt_tGetFlag() const
EventHeader*GetHeader()
TRefArray*GetHighPt() const
TH1F*GetHistogram() const
virtual const char*TObject::GetIconName() const
Track*GetLastTrack() const
Double32_tGetMatrix(UChar_t x, UChar_t y)
Int_tGetMeasure(UChar_t which)
TRefArray*GetMuons() const
virtual const char*TObject::GetName() const
Int_tGetNseg() const
Int_tGetNtrack() const
Int_tGetNvertex() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
Double32_tGetTemperature() const
virtual const char*TObject::GetTitle() const
TClonesArray*GetTracks() const
TBits&GetTriggerBits()
char*GetType()
virtual UInt_tTObject::GetUniqueID() const
TH1*GetWebHistogram() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTObject::Hash() const
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() constMENU
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_tTObject::IsSortable() const
Bool_tIsValid() const
Bool_tTObject::IsZombie() const
virtual voidTObject::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)
Event&operator=(const Event&)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTObject::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
static voidReset(Option_t* option = "")
voidTObject::ResetBit(UInt_t f)
voidResetHistogramPointer()
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(basic_ostream<char,char_traits<char> >& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
voidSetFlag(UInt_t f)
voidSetHeader(Int_t i, Int_t run, Int_t date, Float_t random)
voidSetMatrix(UChar_t x, UChar_t y, Double32_t what)
voidSetMeasure(UChar_t which, Int_t what)
voidSetNseg(Int_t n)
voidSetNtrack(Int_t n)
voidSetNvertex(Int_t n)
static voidTObject::SetObjectStat(Bool_t stat)
voidSetRandomVertex()
voidSetTemperature(Double32_t t)
voidSetType(char* type)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp)
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
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()

Data Members

private:
Double32_t*fClosestDistance[fNvertex][0,0,6]
char*fEventNamerun+event number in character format
EventHeaderfEvtHdr
UInt_tfFlag
TH1F*fH->
TRefArray*fHighPtarray of High Pt tracks only
Bool_tfIsValid
TReffLastTrackreference pointer to last track
Double32_tfMatrix[4][4]
Int_tfMeasures[10]
TRefArray*fMuonsarray of Muon tracks only
Int_tfNsegNumber of track segments
Int_tfNtrackNumber of tracks
Int_tfNvertex
Double32_tfTemperature
TClonesArray*fTracks->array with all tracks
TBitsfTriggerBitsBits triggered by this event.
charfType[20]event type
TReffWebHistogramEXEC:GetWebHistogram reference to an histogram in a TWebFile
static TH1F*fgHist
static TClonesArray*fgTracks

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

Event()
 Create an Event object.
 When the constructor is invoked for the first time, the class static
 variable fgTracks is 0 and the TClonesArray fgTracks is created.
~Event()
void Build(Int_t ev, Int_t arg5 = 600, Float_t ptmin = 1)
Track * AddTrack(Float_t random, Float_t ptmin = 1)
 Add a new track to the list of tracks for this event.
 To avoid calling the very time consuming operator new for each track,
 the standard but not well know C++ operator "new with placement"
 is called. If tracks[i] is 0, a new Track object will be created
 otherwise the previous Track[i] will be overwritten.
void Clear(Option_t* option = "")
void Reset(Option_t* option = "")
 Static function to reset all static objects for this event
   fgTracks->Delete(option);
void SetHeader(Int_t i, Int_t run, Int_t date, Float_t random)
void SetMeasure(UChar_t which, Int_t what)
void SetRandomVertex()
 This delete is to test the relocation of variable length array
TBits& GetTriggerBits()
{ return fTriggerBits; }
Event()
Bool_t IsValid() const
{ return fIsValid; }
void ResetHistogramPointer()
{fH=0;}
void SetNseg(Int_t n)
{ fNseg = n; }
void SetNtrack(Int_t n)
{ fNtrack = n; }
void SetNvertex(Int_t n)
void SetFlag(UInt_t f)
{ fFlag = f; }
void SetTemperature(Double32_t t)
{ fTemperature = t; }
void SetType(char* type)
{strcpy(fType,type);}
void SetMatrix(UChar_t x, UChar_t y, Double32_t what)
{ if (x<3&&y<3) fMatrix[x][y]=what;}
Float_t GetClosestDistance(Int_t i)
{return fClosestDistance[i];}
char * GetType()
{return fType;}
Int_t GetNtrack() const
{ return fNtrack; }
Int_t GetNseg() const
{ return fNseg; }
Int_t GetNvertex() const
{ return fNvertex; }
UInt_t GetFlag() const
{ return fFlag; }
Double32_t GetTemperature() const
{ return fTemperature; }
EventHeader * GetHeader()
{ return &fEvtHdr; }
TClonesArray * GetTracks() const
{return fTracks;}
TRefArray * GetHighPt() const
{return fHighPt;}
TRefArray * GetMuons() const
{return fMuons;}
Track * GetLastTrack() const
{return (Track*)fLastTrack.GetObject();}
TH1F * GetHistogram() const
{return fH;}
TH1 * GetWebHistogram() const
Int_t GetMeasure(UChar_t which)
{ return (which<10)?fMeasures[which]:0; }
Double32_t GetMatrix(UChar_t x, UChar_t y)
{ return (x<4&&y<4)?fMatrix[x][y]:0; }