]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDdigitsManager.h
NodeName array dimension enlarged
[u/mrichter/AliRoot.git] / TRD / AliTRDdigitsManager.h
1 #ifndef TRDdigitsManager_H
2 #define TRDdigitsManager_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 /* $Id: AliTRDdigitsManager.h,v */
8
9 /////////////////////////////////////////////////////////////
10 //  Manages the TRD digits                                 //
11 /////////////////////////////////////////////////////////////
12
13 #include "TObject.h"
14
15 #include "AliTRDsegmentArray.h"
16 #include "AliTRDdataArrayI.h"
17 #include "AliTRDdigit.h"
18
19 const Int_t  kNDict = 3;
20
21 class AliTRDdigitsManager : public TObject {
22
23  public:
24
25   AliTRDdigitsManager();
26   ~AliTRDdigitsManager();
27
28   virtual Bool_t              MakeBranch();
29   virtual Bool_t              ReadDigits();
30   virtual Bool_t              WriteDigits();
31
32   virtual void                SetRaw();
33
34   virtual Bool_t              IsRaw()                { return fIsRaw;         };
35   virtual AliTRDsegmentArray *GetDigits()            { return fDigits;        };
36   virtual AliTRDsegmentArray *GetDictionary(Int_t i) { return fDictionary[i]; };
37
38   inline  AliTRDdataArrayI   *GetDigits(Int_t det);
39   inline  AliTRDdataArrayI   *GetDictionary(Int_t det, Int_t i);
40   inline  AliTRDdigit        *GetDigit(Int_t row, Int_t col, Int_t time, Int_t det);
41   inline  Int_t               GetTrack(Int_t track, Int_t row, Int_t col, Int_t time, Int_t det);
42   inline  Int_t               GetTrack(Int_t track, AliTRDdigit *Digit);
43
44  protected:
45
46   AliTRDsegmentArray *fDigits;             //! Digits data Array
47   AliTRDsegmentArray *fDictionary[kNDict]; //! Track dictionary data array
48
49   Bool_t              fIsRaw;              //  Flag indicating raw digits
50
51   ClassDef(AliTRDdigitsManager,1)          //  Manages the TRD digits
52
53 };
54
55 //_____________________________________________________________________________
56 inline AliTRDdataArrayI *AliTRDdigitsManager::GetDigits(Int_t det) 
57 {
58   //
59   // Returns the digits array for one detector
60   //
61
62   return (AliTRDdataArrayI *) fDigits->At(det);
63
64 }
65
66
67 //_____________________________________________________________________________
68 inline AliTRDdataArrayI *AliTRDdigitsManager::GetDictionary(Int_t det, Int_t i) 
69 {
70   //
71   // Returns the dictionary for one detector
72   //
73
74   return (AliTRDdataArrayI *) fDictionary[i]->At(det);
75
76 }
77
78 //_____________________________________________________________________________
79 inline AliTRDdigit *AliTRDdigitsManager::GetDigit(Int_t row, Int_t col
80                                                 , Int_t time, Int_t det)
81 {
82   // 
83   // Creates a single digit object 
84   //
85
86   Int_t digits[5];
87
88   digits[0] = det;
89   digits[1] = row;
90   digits[2] = col;
91   digits[3] = time;
92   digits[4] = GetDigits(det)->GetData(row,col,time);
93   
94   return (new AliTRDdigit(fIsRaw,digits));
95
96 }
97
98 //_____________________________________________________________________________
99 inline Int_t AliTRDdigitsManager::GetTrack(Int_t track
100                                          , Int_t row, Int_t col, Int_t time
101                                          , Int_t det)
102 {
103   // 
104   // Returns the MC-track numbers from the dictionary.
105   //
106
107   if ((track < 0) || (track >= kNDict)) {
108     TObject::Error("GetTracks"
109                   ,"track %d out of bounds (size: %d, this: 0x%08x)"
110                   ,track,kNDict,this);
111     return -1;
112   }
113
114   // Array contains index+1 to allow data compression
115   return (GetDictionary(det,track)->GetData(row,col,time) - 1);
116
117 }
118
119 //_____________________________________________________________________________
120 inline Int_t AliTRDdigitsManager::GetTrack(Int_t track, AliTRDdigit *Digit)
121 {
122   // 
123   // Returns the MC-track numbers from the dictionary for a given digit
124   //
125
126   Int_t row  = Digit->GetRow();
127   Int_t col  = Digit->GetCol();
128   Int_t time = Digit->GetTime();
129   Int_t det  = Digit->GetDetector();
130
131   return GetTrack(track,row,col,time,det);
132
133 }
134
135 #endif