Reduced memory consumption (Bogdan)
[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 class AliTRDgeometry;
23 class AliTRDcalibDB;
24 class AliTRDCommonParam;
25
26 class AliRunLoader;
27 class AliRawReader;
28
29 class AliTRDmcmTracklet;
30 class AliTRDmcm;
31 class AliTRDmodule;
32 class AliTRDtrigParam;
33
34 class AliTRDtrigger : public TNamed {
35
36  public:  
37
38   enum { kNMCM = 16, kMaxTrackletsPerMCM = 4, kMcmCol = 21 };
39
40   AliTRDtrigger();
41   AliTRDtrigger(const Text_t* name, const Text_t* title);
42   AliTRDtrigger(const AliTRDtrigger &p);   
43   virtual ~AliTRDtrigger();
44
45   AliTRDtrigger &operator=(const AliTRDtrigger &p); 
46   virtual void Copy(TObject &p) const;
47
48   void Init();
49
50   void   SetRunLoader(AliRunLoader *rl) { fRunLoader = rl; };
51   Bool_t Open(const Char_t *name, Int_t nEvent = 0);
52   Bool_t ReadDigits();
53   Bool_t ReadDigits(AliRawReader* rawReader);
54   Bool_t MakeTracklets(Bool_t makeTracks = kFALSE);
55   Bool_t WriteTracklets(Int_t det);
56   Bool_t ReadTracklets(AliRunLoader *rl);
57
58   void   AddTracklet(Int_t det, Int_t row, Int_t seed, Int_t n);
59   Bool_t TestTracklet(Int_t det, Int_t row, Int_t seed, Int_t n);
60   TObjArray *Tracklets() { 
61     if(!fTracklets) fTracklets = new TObjArray(400); return fTracklets; 
62   };
63   void   ResetTracklets() { if(fTracklets) fTracklets->Delete(); };
64   void   SetMCMcoordinates(Int_t imcm);
65   void   SetParameter(AliTRDtrigParam *trigp) { fTrigParam = trigp; };
66   AliTRDtrigParam *GetParameter() const { return fTrigParam; };
67
68   void   MakeTracks(Int_t det);
69
70   AliTRDgtuTrack *GetTrack(Int_t i) const {
71     return (AliTRDgtuTrack *)fTracks.UncheckedAt(i);
72   }
73   void AddTrack(const AliTRDgtuTrack *t, Int_t det) {
74     AliTRDgtuTrack * track = new(fTracks[fTracks.GetEntriesFast()]) AliTRDgtuTrack(*t);
75     track->SetDetector(det);
76   }
77   Int_t GetNumberOfTracks() const {return fTracks.GetEntriesFast();}
78
79   Int_t GetNPrimary() const { return fNPrimary; };
80
81  protected:
82
83   Float_t                fField;                       //! Magnetic field
84   AliTRDgeometry        *fGeo;                         //! TRD geometry
85   AliTRDcalibDB         *fCalib;                       //! Calibration DB
86   AliTRDCommonParam     *fCParam;                      //! Common parameters
87
88   AliTRDtrigParam       *fTrigParam;                   //! Trigger class parameters
89   AliRunLoader          *fRunLoader;                   //! Run Loader
90   AliTRDdigitsManager   *fDigitsManager;               //! TRD digits manager
91   TTree                 *fTrackletTree;                //! Tree with tracklets
92   TObjArray             *fTracklets;                   //! Array of tracklets
93
94   Int_t                  fNROB;                        //! Number of ROBs in the current chamber
95   AliTRDmcm             *fMCM;                         //! Current MCM
96   AliTRDmcmTracklet     *fTrk;                         //! Current tracklet
97   AliTRDmcmTracklet     *fTrkTest;                     //! Test tracklet
98   AliTRDmodule          *fModule;                      //! Current module
99   AliTRDgtuTrack        *fGTUtrk;                      //! Current GTU track
100
101   Int_t                  fNtracklets;                  //! Tracklets counter
102
103   AliTRDdataArrayI *fDigits;                           //! Array with digits
104   AliTRDdataArrayI *fTrack0;                           //! Track dictionary 0
105   AliTRDdataArrayI *fTrack1;                           //! Track dictionary 1
106   AliTRDdataArrayI *fTrack2;                           //! Track dictionary 2
107
108   Int_t fNPrimary;                                     //! Number of primary tracks
109
110   TClonesArray           fTracks;                      //! Array of GTU tracks
111
112   ClassDef(AliTRDtrigger,2)                            //  TRD trigger class
113
114 };
115
116 #endif