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