]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDarrayADC.h
adapted to new version of FitRobust
[u/mrichter/AliRoot.git] / TRD / AliTRDarrayADC.h
CommitLineData
8c25d014 1#ifndef ALITRDARRAYADC_H
2#define ALITRDARRAYADC_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/* $Id: AliTRDarrayADC.h 23387 2008-01-17 17:25:16Z cblume $ */
7
8///////////////////////////////////////////////
9// //
10// Container class for ADC values //
11// //
12///////////////////////////////////////////////
13
14#include <TObject.h>
15
534529cb 16class AliTRDSignalIndex;
8c25d014 17class AliTRDarrayADC: public TObject
18{
19 public:
20
48e0d7f1 21 enum {
22 kDataInvalid = 14
23 };
24
8c25d014 25 AliTRDarrayADC();
26 AliTRDarrayADC(Int_t nrow, Int_t ncol, Int_t ntime);
27 AliTRDarrayADC(const AliTRDarrayADC &b);
28 ~AliTRDarrayADC();
29 AliTRDarrayADC &operator=(const AliTRDarrayADC &b);
30
31 void Allocate(Int_t nrow, Int_t ncol, Int_t ntime);
32 void SetNdet(Int_t ndet) {fNdet=ndet;};
33 Int_t GetNdet() const {return fNdet;};
34 void SetDataByAdcCol(Int_t nrow, Int_t ncol, Int_t ntime, Short_t value)
615f0826 35 {fADC[(nrow*fNumberOfChannels+ncol)*fNtime+ntime]=value;}
8c25d014 36 Bool_t HasData() const {return fNtime ? 1 : 0;};
37 Short_t GetDataByAdcCol(Int_t nrow, Int_t ncol, Int_t ntime) const
38 {return fADC[(nrow*fNumberOfChannels+ncol)*fNtime+ntime];};
39 inline void GetData(Int_t r, Int_t c, Int_t t, Int_t n, Short_t *vals) const;
40 Short_t GetDataBits(Int_t nrow, Int_t ncol, Int_t ntime) const;
41 UChar_t GetPadStatus(Int_t nrow, Int_t ncol, Int_t ntime) const;
42 void SetPadStatus(Int_t nrow, Int_t ncol, Int_t ntime, UChar_t status);
43 Bool_t IsPadCorrupted(Int_t nrow, Int_t ncol, Int_t ntime);
44 void Compress();
45 void Expand();
46 Int_t GetNtime() const {return fNtime;};
47 Int_t GetNrow() const {return fNrow;};
48 Int_t GetNcol() const {return fNcol;};
49 Int_t GetDim() const {return fNAdim;};
50 void DeleteNegatives();
51 void Reset();
534529cb 52 void ConditionalReset(AliTRDSignalIndex* idx);
1ab4da8c 53 inline Short_t* GetDataAddress(Int_t nrow, Int_t ncol, Int_t ntime = 0) const;
615f0826 54 inline Short_t GetData(Int_t nrow, Int_t ncol, Int_t ntime) const;
55 inline void SetData(Int_t nrow, Int_t ncol, Int_t ntime, Short_t value);
8c25d014 56 static void CreateLut();
8c25d014 57
48e0d7f1 58 Bool_t IsValid() { return !TestBit(kDataInvalid); }
59 void SetDataInvalid() { SetBit(kDataInvalid); }
60 void SetDataValid() { ResetBit(kDataInvalid); }
61
8c25d014 62 protected:
63
64 Int_t fNdet; //ID number of the chamber
65 Int_t fNrow; //Number of rows
66 Int_t fNcol; //Number of columns(pads)
67 Int_t fNumberOfChannels; // Number of MCM channels per row
68 Int_t fNtime; //Number of time bins
69 Int_t fNAdim; //Dimension of the ADC array
8c25d014 70 Short_t* fADC; //[fNAdim] //Pointer to adc values
71 static Short_t *fgLutPadNumbering; // [fNcol] Look Up Table
72
73 ClassDef(AliTRDarrayADC,4) //ADC container class
74
75};
76
615f0826 77//________________________________________________________________________________
1ab4da8c 78Short_t* AliTRDarrayADC::GetDataAddress(Int_t nrow, Int_t ncol, Int_t ntime) const
79{
80 //
81 // Get the address of the given pad
82 //
83
84 Int_t corrcolumn = fgLutPadNumbering[ncol];
85
86 return &fADC[(nrow*fNumberOfChannels+corrcolumn)*fNtime+ntime];
87
88}
89//________________________________________________________________________________
615f0826 90Short_t AliTRDarrayADC::GetData(Int_t nrow, Int_t ncol, Int_t ntime) const
91{
92 //
93 // Get the data using the pad numbering.
94 // To access data using the mcm scheme use instead
95 // the method GetDataByAdcCol
96 //
97
98 Int_t corrcolumn = fgLutPadNumbering[ncol];
99
100 return fADC[(nrow*fNumberOfChannels+corrcolumn)*fNtime+ntime];
101
102}
103//________________________________________________________________________________
104void AliTRDarrayADC::SetData(Int_t nrow, Int_t ncol, Int_t ntime, Short_t value)
105{
106 //
107 // Set the data using the pad numbering.
108 // To write data using the mcm scheme use instead
109 // the method SetDataByAdcCol
110 //
111
112 Int_t colnumb = fgLutPadNumbering[ncol];
113
114 fADC[(nrow*fNumberOfChannels+colnumb)*fNtime+ntime] = value;
115
116}
117
118void AliTRDarrayADC::GetData(Int_t r, Int_t c, Int_t t, Int_t n, Short_t *vals) const
8c25d014 119{
120 Int_t colNum = fgLutPadNumbering[c];
121 for(Int_t ic=n, idx = (r*fNumberOfChannels+colNum)*fNtime+t; ic--; idx+=fNtime) vals[ic] = fADC[idx];
122 }
123
124#endif
125