EventMT.h

Go to the documentation of this file.
00001 #ifndef ROOT_Event
00002 #define ROOT_Event
00003 
00004 //////////////////////////////////////////////////////////////////////////
00005 //                                                                      //
00006 // Event                                                                //
00007 //                                                                      //
00008 // Description of the event and track parameters                        //
00009 // This version of the Event class is a simplified version suitable for //
00010 // use in a multi-threads environment as all Event objects are          //
00011 // independent from each other.                                         //
00012 //                                                                      //
00013 //////////////////////////////////////////////////////////////////////////
00014 
00015 #include "TObject.h"
00016 #include "TClonesArray.h"
00017 #include "TRefArray.h"
00018 #include "TRef.h"
00019 #include "TH1.h"
00020 #include "TBits.h"
00021 #include "TMath.h"
00022 
00023 
00024 class TDirectory;
00025 
00026 class Track : public TObject {
00027 
00028 private:
00029    Float_t      fPx;           //X component of the momentum
00030    Float_t      fPy;           //Y component of the momentum
00031    Float_t      fPz;           //Z component of the momentum
00032    Float_t      fRandom;       //A random track quantity
00033    Float16_t    fMass2;        //[0,0,8] The mass square of this particle
00034    Float16_t    fBx;           //[0,0,10] X intercept at the vertex
00035    Float16_t    fBy;           //[0,0,10] Y intercept at the vertex
00036    Float_t      fMeanCharge;   //Mean charge deposition of all hits of this track
00037    Float16_t    fXfirst;       //X coordinate of the first point
00038    Float16_t    fXlast;        //X coordinate of the last point
00039    Float16_t    fYfirst;       //Y coordinate of the first point
00040    Float16_t    fYlast;        //Y coordinate of the last point
00041    Float16_t    fZfirst;       //Z coordinate of the first point
00042    Float16_t    fZlast;        //Z coordinate of the last point
00043    Double32_t   fCharge;       //[-1,1,2] Charge of this track
00044    Double32_t   fVertex[3];    //[-30,30,16] Track vertex position
00045    Int_t        fNpoint;       //Number of points for this track
00046    Short_t      fValid;        //Validity criterion
00047    Int_t        fNsp;          //Number of points for this track with a special value
00048    Double32_t*  fPointValue;   //[fNsp][0,3] a special quantity for some point.
00049    TBits        fTriggerBits;  //Bits triggered by this track.
00050 
00051 public:
00052    Track() { fPointValue = 0; }
00053    Track(const Track& orig);
00054    Track(Float_t random);
00055    virtual ~Track() {Clear();}
00056    void          Clear(Option_t *option="");
00057    Float_t       GetPx() const { return fPx; }
00058    Float_t       GetPy() const { return fPy; }
00059    Float_t       GetPz() const { return fPz; }
00060    Float_t       GetPt() const { return TMath::Sqrt(fPx*fPx + fPy*fPy); }
00061    Float_t       GetRandom() const { return fRandom; }
00062    Float_t       GetBx() const { return fBx; }
00063    Float_t       GetBy() const { return fBy; }
00064    Float_t       GetMass2() const { return fMass2; }
00065    Float_t       GetMeanCharge() const { return fMeanCharge; }
00066    Float_t       GetXfirst() const { return fXfirst; }
00067    Float_t       GetXlast()  const { return fXlast; }
00068    Float_t       GetYfirst() const { return fYfirst; }
00069    Float_t       GetYlast()  const { return fYlast; }
00070    Float_t       GetZfirst() const { return fZfirst; }
00071    Float_t       GetZlast()  const { return fZlast; }
00072    Double32_t    GetCharge() const { return fCharge; }
00073    Double32_t    GetVertex(Int_t i=0) {return (i<3)?fVertex[i]:0;}
00074    Int_t         GetNpoint() const { return fNpoint; }
00075    TBits&        GetTriggerBits() { return fTriggerBits; }
00076    Short_t       GetValid()  const { return fValid; }
00077    virtual void  SetValid(Int_t valid=1) { fValid = valid; }
00078    Int_t         GetN() const { return fNsp; }
00079    Double32_t    GetPointValue(Int_t i=0) const { return (i<fNsp)?fPointValue[i]:0; }
00080 
00081    ClassDef(Track,2)  //A track segment
00082 };
00083 
00084 class EventHeader {
00085 
00086 private:
00087    Int_t   fEvtNum;
00088    Int_t   fRun;
00089    Int_t   fDate;
00090 
00091 public:
00092    EventHeader() : fEvtNum(0), fRun(0), fDate(0) { }
00093    virtual ~EventHeader() { }
00094    void   Set(Int_t i, Int_t r, Int_t d) { fEvtNum = i; fRun = r; fDate = d; }
00095    Int_t  GetEvtNum() const { return fEvtNum; }
00096    Int_t  GetRun() const { return fRun; }
00097    Int_t  GetDate() const { return fDate; }
00098 
00099    ClassDef(EventHeader,1)  //Event Header
00100 };
00101 
00102 
00103 class Event : public TObject {
00104 
00105 private:
00106    char           fType[20];          //event type
00107    char          *fEventName;         //run+event number in character format
00108    Int_t          fNtrack;            //Number of tracks
00109    Int_t          fNseg;              //Number of track segments
00110    Int_t          fNvertex;
00111    UInt_t         fFlag;
00112    Double32_t     fTemperature;       
00113    Int_t          fMeasures[10];
00114    Double32_t     fMatrix[4][4];
00115    Double32_t    *fClosestDistance;   //[fNvertex][0,0,6]
00116    EventHeader    fEvtHdr;
00117    TClonesArray  *fTracks;            //->array with all tracks
00118    TRefArray     *fHighPt;            //array of High Pt tracks only
00119    TRefArray     *fMuons;             //array of Muon tracks only
00120    TRef           fLastTrack;         //reference pointer to last track
00121    TRef           fWebHistogram;      //EXEC:GetWebHistogram reference to an histogram in a TWebFile
00122    TH1F          *fH;                 //->
00123    TBits          fTriggerBits;       //Bits triggered by this event.
00124    Bool_t         fIsValid;           //
00125 
00126 public:
00127    Event();
00128    virtual ~Event();
00129    void          Build(Int_t ev, Int_t arg5=600, Float_t ptmin=1);
00130    void          Clear(Option_t *option ="");
00131    Bool_t        IsValid() const { return fIsValid; }
00132    void          ResetHistogramPointer() {fH=0;}
00133    void          SetNseg(Int_t n) { fNseg = n; }
00134    void          SetNtrack(Int_t n) { fNtrack = n; }
00135    void          SetNvertex(Int_t n) { fNvertex = n; SetRandomVertex(); }
00136    void          SetFlag(UInt_t f) { fFlag = f; }
00137    void          SetTemperature(Double32_t t) { fTemperature = t; }
00138    void          SetType(char *type) {strcpy(fType,type);}
00139    void          SetHeader(Int_t i, Int_t run, Int_t date, Float_t random);
00140    Track        *AddTrack(Float_t random, Float_t ptmin=1);
00141    void          SetMeasure(UChar_t which, Int_t what);
00142    void          SetMatrix(UChar_t x, UChar_t y, Double32_t what) { if (x<3&&y<3) fMatrix[x][y]=what;}
00143    void          SetRandomVertex();
00144 
00145    Float_t       GetClosestDistance(Int_t i) {return fClosestDistance[i];}
00146    char         *GetType() {return fType;}
00147    Int_t         GetNtrack() const { return fNtrack; }
00148    Int_t         GetNseg() const { return fNseg; }
00149    Int_t         GetNvertex() const { return fNvertex; }
00150    UInt_t        GetFlag() const { return fFlag; }
00151    Double32_t    GetTemperature() const { return fTemperature; }
00152    EventHeader  *GetHeader() { return &fEvtHdr; }
00153    TClonesArray *GetTracks() const {return fTracks;}
00154    TRefArray    *GetHighPt() const {return fHighPt;}
00155    TRefArray    *GetMuons()  const {return fMuons;}
00156    Track        *GetLastTrack() const {return (Track*)fLastTrack.GetObject();}
00157    TH1F         *GetHistogram() const {return fH;}
00158    TH1          *GetWebHistogram()  const {return (TH1*)fWebHistogram.GetObject();}
00159    Int_t         GetMeasure(UChar_t which) { return (which<10)?fMeasures[which]:0; }
00160    Double32_t    GetMatrix(UChar_t x, UChar_t y) { return (x<4&&y<4)?fMatrix[x][y]:0; }
00161    TBits&        GetTriggerBits() { return fTriggerBits; }
00162 
00163    ClassDef(Event,1)  //Event structure
00164 };
00165 
00166 
00167 class HistogramManager {
00168 
00169 private:
00170    TH1F  *fNtrack;
00171    TH1F  *fNseg;
00172    TH1F  *fTemperature;
00173    TH1F  *fPx;
00174    TH1F  *fPy;
00175    TH1F  *fPz;
00176    TH1F  *fRandom;
00177    TH1F  *fMass2;
00178    TH1F  *fBx;
00179    TH1F  *fBy;
00180    TH1F  *fMeanCharge;
00181    TH1F  *fXfirst;
00182    TH1F  *fXlast;
00183    TH1F  *fYfirst;
00184    TH1F  *fYlast;
00185    TH1F  *fZfirst;
00186    TH1F  *fZlast;
00187    TH1F  *fCharge;
00188    TH1F  *fNpoint;
00189    TH1F  *fValid;
00190 
00191 public:
00192    HistogramManager(TDirectory *dir);
00193    virtual ~HistogramManager();
00194 
00195    void Hfill(Event *event);
00196 
00197    ClassDef(HistogramManager,1)  //Manages all histograms
00198 };
00199 
00200 #endif

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