]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDchamberTimeBin.h
automatic histogram scaling for AODs now available
[u/mrichter/AliRoot.git] / TRD / AliTRDchamberTimeBin.h
1 #ifndef ALITRDCHAMBERTIMEBIN_H
2 #define ALITRDCHAMBERTIMEBIN_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: AliTRDchamberTimeBin.h 22646 2007-11-29 18:13:40Z cblume $ */
8
9 ////////////////////////////////////////////////////////////////////////////
10 //                                                                        //
11 //  A TRD layer in a single stack                                         //
12 //                                                                        //
13 ////////////////////////////////////////////////////////////////////////////
14
15 #ifndef ROOT_TObject
16 #include "TObject.h"
17 #endif
18
19 class AliTRDcluster;
20 class AliTRDReconstructor;
21
22 class AliTRDchamberTimeBin : public TObject
23 {
24 public:
25   enum AliTRDchamberTimeBinStatus {
26      kT0    = BIT(14) // is the T0 time bin
27     ,kOwner = BIT(15) // is owner of the clusters
28   };
29   enum{
30      kMaxClustersLayer = 150
31     ,kMaxRows = 16
32   };
33
34   AliTRDchamberTimeBin(Int_t plane=-1, Int_t stack=-1, Int_t sector=-1, Double_t z0=-1., Double_t zLength=-1.);
35   //AliTRDchamberTimeBin(const AliTRDpropagationLayer &layer, Double_t z0, Double_t zLength, UChar_t stackNr);
36   //AliTRDchamberTimeBin(const AliTRDpropagationLayer &layer);
37   AliTRDchamberTimeBin(const AliTRDchamberTimeBin &layer);
38   ~AliTRDchamberTimeBin();
39   operator       Int_t() const  { return fN; }
40   AliTRDchamberTimeBin&
41                  operator=(const AliTRDchamberTimeBin &myLayer);
42   AliTRDcluster* operator[](const Int_t i) const {
43     return ((i < fN) && (i >= 0)) ? fClusters[i] : NULL;
44   }
45
46   void           Bootstrap(const AliTRDReconstructor *rec, Int_t det);
47   void           BuildIndices(Int_t iter = 0);
48   void           BuildCond(AliTRDcluster * const cl, Double_t *cond, UChar_t Layer, Double_t theta=0., Double_t phi=0.);
49   void           Clear(const Option_t *opt = NULL);
50   AliTRDcluster* GetCluster(Int_t index) const {return index < fN && index >= 0 ? fClusters[index] : NULL;}
51   Int_t          GetGlobalIndex(Int_t index) const {return ((index < fN) && (index >= 0)) ? fIndex[index] : 0; }
52   void           GetClusters(const Double_t * const cond, Int_t *index, Int_t& ncl, Int_t BufferSize = kMaxClustersLayer);
53   AliTRDcluster* GetNearestCluster(Double_t *cond);
54   Double_t       GetX()                            const {
55   return fX;      }
56   Double_t       GetZ0()                           const { return fZ0;     }
57   Double_t       GetDZ0()                          const { return fZLength;}
58   Int_t          GetNClusters()                    const { return fN; }
59   Int_t          GetPlane()                        const { return fPlane;  }
60   Int_t          GetStack()                        const { return fStack;  }
61   Int_t          GetSector()                       const { return fSector; }
62   void           InsertCluster(AliTRDcluster *c, UInt_t index);
63
64   Bool_t         IsT0() const {return TestBit(kT0);}
65   Bool_t         IsOwner() const {return TestBit(kOwner);}
66
67   void           Print(Option_t *opt=NULL) const;
68   Int_t          SearchNearestCluster(Double_t y, Double_t z, Double_t Roady, Double_t Roadz) const;
69   void           SetRange(Float_t z0, Float_t zLength);
70   void           SetNRows(Int_t nRows){ fNRows = nRows; }
71   void           SetPlane(Int_t plane){ fPlane = plane; }
72   void           SetReconstructor(const AliTRDReconstructor *rec) {fkReconstructor = rec;}
73   void           SetStack(Int_t stack){ fStack = stack; }
74   void           SetSector(Int_t sector){ fSector = sector; }
75   void           SetOwner(Bool_t copy=kTRUE);
76   void           SetT0(Bool_t set=kTRUE) {SetBit(kT0, set);}
77   void           SetX(Double_t x) {fX = x;}
78 private:
79   void           Copy(TObject &o) const;
80   Int_t          Find(Float_t y) const;
81   Int_t          FindYPosition(Double_t y, UChar_t z, Int_t nClusters) const;
82   Int_t          FindNearestYCluster(Double_t y, UChar_t z) const;
83
84 private:
85   const AliTRDReconstructor *fkReconstructor; //!
86   Char_t        fPlane;               //! Plane number
87   Char_t        fStack;               //!  stack number in supermodule
88   Char_t        fSector;              //! Sector mumber
89   Char_t        fNRows;               //!  number of pad rows in the chamber
90   UChar_t       fPositions[kMaxRows]; //!  starting index of clusters in pad row 
91   Int_t         fN;                   //! number of clusters
92   AliTRDcluster *fClusters[kMaxClustersLayer];            //Array of pointers to clusters
93   UInt_t        fIndex[kMaxClustersLayer];                //!Array of cluster indexes
94   Double_t      fX;                   //!  radial position of tb
95   
96   // obsolete !!
97   Double_t      fZ0;                  //  starting position of the layer in Z direction
98   Double_t      fZLength;             //  length of the layer in Z direction
99   
100   ClassDef(AliTRDchamberTimeBin, 2)   //  tracking propagation layer for one time bin in chamber
101
102 };
103
104 #endif  // ALITRDCHAMBERTIMEBIN_H
105