]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDSignalIndex.h
Add QA analysis classes
[u/mrichter/AliRoot.git] / TRD / AliTRDSignalIndex.h
1 #ifndef AliTRDSIGNALINDEX_H
2 #define AliTRDSIGNALINDEX_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$ */
8  
9 #include "TObject.h"
10
11 ////////////////////////////////////////////////////////////////////////////
12 //                                                                        //
13 //  General container for data from TRD detector segments                 //
14 //  Adapted from AliDigits, origin M.Ivanov                               //
15 //                                                                        //
16 //  Author:                                                               //
17 //    Mateusz Ploskon (ploskon@ikf.uni-frankfurt.de)                      //
18 //                                                                        //
19 ////////////////////////////////////////////////////////////////////////////
20
21 #include "TArrayI.h"
22
23 class AliTRDSignalIndex : public TObject
24 {
25
26  public:
27
28   AliTRDSignalIndex(); 
29   AliTRDSignalIndex(Int_t nrow, Int_t ncol,Int_t ntime);
30   AliTRDSignalIndex(const AliTRDSignalIndex &d);
31   virtual ~AliTRDSignalIndex();
32   AliTRDSignalIndex &operator=(const AliTRDSignalIndex &d); 
33
34   virtual void     Copy(TObject &d) const; 
35   virtual void     Allocate(Int_t nrow, Int_t ncol,Int_t ntime);
36
37   virtual void     Reset();
38   virtual void     ResetContentConditional(Int_t nrow, Int_t ncol,Int_t ntime);
39   virtual void     ResetContent();
40   virtual void     ResetCounters();
41   virtual void     ResetTbinCounter() { fPositionTbin  = 1; }
42
43   virtual void     AddIndexTBin(Int_t row, Int_t col, Int_t tbin);
44
45           // Get the next pad (row and column) and return kTRUE on success
46           Bool_t   NextRCIndex(Int_t &row, Int_t &col); 
47           // Get the next timebin of a pad (row and column) and return kTRUE on success
48           Bool_t   NextRCTbinIndex(Int_t &row, Int_t &col, Int_t &tbin); 
49           // Get the next active timebin and return kTRUE on success
50           Bool_t   NextTbinIndex(Int_t &tbin); 
51
52           Int_t    GetCurrentRow() const  { return (*fIndex)[fPositionRow];                 }
53           Int_t    GetCurrentCol() const  { return (*fIndex)[fPositionCol];                 }
54           Int_t    GetCurrentTbin() const { return (*fIndex)[fPositionCol + fPositionTbin]; }
55   
56           // Clear the array, actually destroy and recreate w/o allocating
57           void     ClearAll(); 
58           // Return kTRUE if array allocated and there is no need to call allocate
59           Bool_t   IsAllocated() const    { if (!fIndex)                return kFALSE; 
60                                             if (fIndex->GetSize() <= 0) return kFALSE; 
61                                             else                        return kTRUE;       }
62
63           void     SetSM(Int_t ix)        { fSM      =    ix; }
64           void     SetStack(Int_t ix)     { fStack   =    ix; }
65           void     SetChamber(Int_t ix)   { SetStack(ix);     }
66           void     SetLayer(Int_t ix)     { fLayer   =    ix; }
67           void     SetPlane(Int_t ix)     { SetLayer(ix);     }
68           void     SetDetNumber(Int_t ix) { fDet     =    ix; }
69   
70   virtual Int_t    GetDetNumber() const   { return fDet;      } // Get Det number
71   virtual Int_t    GetLayer() const       { return fLayer;    } // Layer = Plane = position of the chamber in TRD
72   virtual Int_t    GetPlane() const       { return fLayer;    } // Layer = Plane = position of the chamber in TRD
73   virtual Int_t    GetStack() const       { return fStack;    } // Stack = Chameber = position of the chamber in TRD
74   virtual Int_t    GetChamber() const     { return fStack;    } // Stack = Chameber = position of the chamber in TRD
75   virtual Int_t    GetSM() const          { return fSM;       } // Super module of the TRD
76           TArrayI *GetArray() const       { return fIndex;    } // Get the tarrayi pointer for god knows what reason
77
78   virtual Bool_t   HasEntry() const       { return fHasEntry; } // Return status if has an entry
79
80   virtual Int_t    GetNrow() const        { return fNrows;    } // Get Nrows
81   virtual Int_t    GetNcol() const        { return fNcols;    } // Get Ncols
82   virtual Int_t    GetNtime() const       { return fNtbins;   } // Get Ntbins
83
84  private:
85
86   Int_t     fDet;                //  Detector number
87   Int_t     fLayer;              //  Aka plane - position in the full TRD
88   Int_t     fStack;              //  Aka chamber - position in the full TRD
89   Int_t     fSM;                 //  Super module - position in the full TRD
90
91   TArrayI  *fIndex;              //! Monitor active pads and tbins
92
93   Int_t     fPositionRow;        //  Position in the index - jumps by 1 + 1 + fNtbins
94   Int_t     fPositionCol;        //  Position in the index - jumps by 1 + 1 + fNtbins
95   Int_t     fPositionTbin;       //  Position in the tbin - goes from 0 to fNtbins
96
97   Int_t     fLastRow;            //  To keep track what is the RC combination
98   Int_t     fLastCol;            //  To keep track what is the RC combination
99   Int_t     fLastTbin;           //  To keep track what is the Tbin - will catch if raw data bogus
100
101   Int_t     fNrows;              //  Number of rows in the chamber
102   Int_t     fNcols;              //  Number of cols in the chamber
103   Int_t     fNtbins;             //  Number of tbins in the chamber
104
105   Int_t     fMaxLimit;           //  Max number of things in the array  = nrow*ncol*ntime + nrow*ncol*2
106   Bool_t    fResetCounters;      //  Reset counter status
107   Bool_t    fHasEntry;           //  kTRUE flag if we have an entry 
108
109   ClassDef(AliTRDSignalIndex,2)  //  Data container for one TRD detector segment
110
111 };
112 #endif