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

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