]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCCalibRaw.h
Forgotten commit adding additional parameter
[u/mrichter/AliRoot.git] / TPC / AliTPCCalibRaw.h
1 #ifndef ALITPCCALIBALTROHEADERS_H
2 #define ALITPCCALIBALTROHEADERS_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 //                        TPC ALTRO Header analysis                                   //
9 //                                                                                    //
10 ////////////////////////////////////////////////////////////////////////////////////////
11
12 #include <TVectorF.h>
13 #include <TObjArray.h>
14 #include <THnSparse.h>
15
16 #include "AliTPCCalibRawBase.h"
17 #include "AliTPCCalPad.h"
18 #include "AliTPCROC.h"
19
20 class TH2C;
21
22 class AliTPCCalibRaw : public AliTPCCalibRawBase {
23 public:
24   AliTPCCalibRaw();
25   
26   virtual ~AliTPCCalibRaw();
27
28   
29   virtual Int_t Update(const Int_t isector, const Int_t iRow, const Int_t iPad,
30                        const Int_t iTimeBin, const Float_t signal);
31   virtual void UpdateDDL();
32   virtual void EndEvent();
33   virtual void ResetEvent();
34   virtual void Analyse();
35
36   UInt_t GetNFailL1Phase()                const  {return fNFailL1Phase;}
37   Int_t   GetPeakDetectionMinus() const {return fPeakDetMinus;}
38   Int_t   GetPeakDetectionPlus()  const {return fPeakDetPlus;}
39   
40   const TVectorF* GetALTROL1PhaseEvents() const {return &fArrALTROL1Phase;}
41
42   const TVectorF *GetALTROL1PhaseEventsRCU(Int_t rcu) const {return (TVectorF*)fArrALTROL1PhaseEvent.At(rcu);}
43   const TVectorF *GetALTROL1PhaseFailEventsRCU(Int_t rcu) const {return (TVectorF*)fArrALTROL1PhaseFailEvent.At(rcu);}
44
45   void  SetRangePeakDetection(Int_t minus, Int_t plus) { fPeakDetMinus=minus; fPeakDetPlus=plus;}
46   
47   TH2C *MakeHistL1RCUEvents(Int_t type=0);
48   TH2C *MakeHistL1RCUEventsIROC(Int_t type=0);
49   TH2C *MakeHistL1RCUEventsOROC(Int_t type=0);
50
51   const THnSparseI *GetHnDrift() const {return fHnDrift;}
52 //   AliTPCCalPad *CreateCalPadL1Mean();
53 //   AliTPCCalPad *CreateCalPadL1RMS();
54   
55 private:
56   Int_t   fPeakDetMinus;             //  Consecutive timebins on rising edge to be regarded as a signal
57   Int_t   fPeakDetPlus;              //  Consecutive timebins on falling edge to be regarded as a signal
58   UInt_t  fNFailL1Phase;             //Number of failures in L1 phase
59   UInt_t  fFirstTimeStamp;           //Time Stamp from first event
60   //binning dv hist
61   UInt_t  fNSecTime;                 //Number of seconds per bin in time
62   UInt_t  fNBinsTime;                //Number of bin in time
63   //processing information
64   Bool_t    fPadProcessed;           //! if last pead has already been filled for the current pad
65   Int_t     fCurrentChannel;         //! current channel processed
66   Int_t     fCurrentSector;          //! current sector processed
67   Int_t     fLastSector;             //! current sector processed
68   Int_t     fCurrentRow;             //! current row processed
69   Int_t     fCurrentPad;             //! current pad processed
70   Int_t     fLastTimeBinProc;        //! last time bin processed
71   Int_t     fPeakTimeBin;            //! time bin with local maximum
72   Int_t     fLastSignal;             //! last signal processed
73   Int_t     fNOkPlus;                //! number of processed time bins fullfilling peak criteria
74   Int_t     fNOkMinus;               //! number of processed time bins fullfilling peak criteria
75 //
76   //L1 phase stuff
77   TVectorF fArrCurrentPhaseDist;       //!Phase distribution of the current event
78   TVectorF fArrALTROL1Phase;           //Array of L1 phases on an event bases;
79   TObjArray fArrALTROL1PhaseEvent;     //L1 phase for each RCU and event
80   TObjArray fArrALTROL1PhaseFailEvent; //L1 failure for each RCU and event
81   //drift velocity stuff
82   enum {kHnBinsDV=3};
83   THnSparseI *fHnDrift;                //Histogram last time bin vs. ROC, Time
84   
85   TVectorF *MakeArrL1PhaseRCU(Int_t rcu, Bool_t force=kFALSE);
86   TVectorF *MakeArrL1PhaseFailRCU(Int_t rcu, Bool_t force=kFALSE);
87   
88   Bool_t IsEdgePad(Int_t sector, Int_t row, Int_t pad) const;
89   void CreateDVhist();
90   
91   AliTPCCalibRaw(AliTPCCalibRaw &calib);
92   AliTPCCalibRaw& operator = (const  AliTPCCalibRaw &source);
93
94   ClassDef(AliTPCCalibRaw,1) //  Analysis of the Altro header information
95 };
96
97 //----------------------
98 // Inline Functions
99 //----------------------
100 inline TVectorF *AliTPCCalibRaw::MakeArrL1PhaseRCU(Int_t rcu, Bool_t force)
101 {
102   TVectorF *arr=(TVectorF*)fArrALTROL1PhaseEvent.UncheckedAt(rcu);
103   if (!arr && force) {
104     arr=new TVectorF(1000);
105     fArrALTROL1PhaseEvent.AddAt(arr,rcu);
106   }
107   return arr;
108 }
109 //
110 inline TVectorF *AliTPCCalibRaw::MakeArrL1PhaseFailRCU(Int_t rcu, Bool_t force)
111 {
112   TVectorF *arr=(TVectorF*)fArrALTROL1PhaseFailEvent.UncheckedAt(rcu);
113   if (!arr && force) {
114     arr=new TVectorF(1000);
115     fArrALTROL1PhaseFailEvent.AddAt(arr,rcu);
116   }
117   return arr;
118 }
119 //_____________________________________________________________________
120 inline Bool_t AliTPCCalibRaw::IsEdgePad(Int_t sector, Int_t row, Int_t pad) const
121 {
122   //
123   // return true if pad is on the edge of a row
124   //
125   Int_t edge1   = 0;
126   if ( pad == edge1 ) return kTRUE;
127   Int_t edge2   = fROC->GetNPads(sector,row)-1;
128   if ( pad == edge2 ) return kTRUE;
129   
130   return kFALSE;
131 }
132
133
134 #endif