cc6d2ddceb69c2649ba354ce6fbacfea4424e27f
[u/mrichter/AliRoot.git] / TRD / AliTRDtrigger.h
1 #ifndef ALITRDTRIGGER_H
2 #define ALITRDTRIGGER_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 ///////////////////////////////////////////////////////////////////////////////
7 //                                                                           //
8 //  TRD trigger class                                                        //
9 //                                                                           //
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #include <TNamed.h>
13 #include <TObjArray.h>
14 #include <TClonesArray.h>
15
16 #include "AliTRDgtuTrack.h"
17
18 class TTree;
19
20 class AliTRDdigitsManager;
21 class AliTRDdataArrayI;
22
23 class AliRunLoader;
24 class AliRawReader;
25
26 class AliTRDmcmTracklet;
27 class AliTRDmcm;
28 class AliTRDmodule;
29 class AliTRDtrigParam;
30
31 class AliTRDtrigger : public TNamed {
32
33  public:  
34
35   enum { kNMCM = 16, kMaxTrackletsPerMCM = 4, kMcmCol = 21 };
36
37   AliTRDtrigger();
38   AliTRDtrigger(const Text_t* name, const Text_t* title);
39   AliTRDtrigger(const AliTRDtrigger &p);   
40   virtual ~AliTRDtrigger();
41
42   AliTRDtrigger &operator=(const AliTRDtrigger &p); 
43   virtual void Copy(TObject &p) const;
44
45   void Init();
46
47   void   SetRunLoader(AliRunLoader *rl) { fRunLoader = rl; };
48   Bool_t Open(const Char_t *name, Int_t nEvent = 0);
49   Bool_t ReadDigits();
50   Bool_t ReadDigits(AliRawReader* rawReader);
51   Bool_t MakeTracklets(Bool_t makeTracks = kFALSE);
52   Bool_t WriteTracklets(Int_t det);
53   Bool_t ReadTracklets(AliRunLoader *rl);
54
55   void   AddTracklet(Int_t det, Int_t row, Int_t seed, Int_t n);
56   TObjArray *Tracklets() { 
57     if(!fTracklets) fTracklets = new TObjArray(400); return fTracklets; 
58   };
59   void   ResetTracklets() { if(fTracklets) fTracklets->Delete(); };
60   void   SetMCMcoordinates(Int_t imcm);
61   void   SetParameter(AliTRDtrigParam *trigp) { fTrigParam = trigp; };
62   AliTRDtrigParam *GetParameter() const { return fTrigParam; };
63
64   void   MakeTracks(Int_t det);
65
66   AliTRDgtuTrack *GetTrack(Int_t i) const {
67     return (AliTRDgtuTrack *)fTracks.UncheckedAt(i);
68   }
69   void AddTrack(const AliTRDgtuTrack *t, Int_t det) {
70     AliTRDgtuTrack * track = new(fTracks[fTracks.GetEntriesFast()]) AliTRDgtuTrack(*t);
71     track->SetDetector(det);
72   }
73   Int_t GetNumberOfTracks() const {return fTracks.GetEntriesFast();}
74
75   Int_t GetNPrimary() const { return fNPrimary; };
76
77  protected:
78
79   AliTRDtrigParam       *fTrigParam;                   //! Trigger class parameters
80   AliRunLoader          *fRunLoader;                   //! Run Loader
81   AliTRDdigitsManager   *fDigitsManager;               //! TRD digits manager
82   TTree                 *fTrackletTree;                //! Tree with tracklets
83   TObjArray             *fTracklets;                   //! Array of tracklets
84
85   Int_t                  fNROB;                        //! Number of ROBs in the current chamber
86   AliTRDmcm             *fMCM;                         //! Current MCM
87   AliTRDmcmTracklet     *fTrk;                         //! Current tracklet
88   AliTRDmodule          *fModule;                      //! Current module
89   AliTRDgtuTrack        *fGTUtrk;                      //! Current GTU track
90
91   Int_t                  fNtracklets;                  //! Tracklets counter
92
93   AliTRDdataArrayI *fDigits;                           //! Array with digits
94   AliTRDdataArrayI *fTrack0;                           //! Track dictionary 0
95   AliTRDdataArrayI *fTrack1;                           //! Track dictionary 1
96   AliTRDdataArrayI *fTrack2;                           //! Track dictionary 2
97
98   Int_t fNPrimary;                                     //! Number of primary tracks
99
100   TClonesArray           fTracks;                      //! Array of GTU tracks
101
102   ClassDef(AliTRDtrigger,2)                            //  TRD trigger class
103
104 };
105
106 #endif