1 #ifndef ALITPCCALIBPULSER_H
2 #define ALITPCCALIBPULSER_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
6 /////////////////////////////////////////////////////////////////////////////////////////
8 // Implementation of the TPC pulser calibration //
10 /////////////////////////////////////////////////////////////////////////////////////////
15 class TTreeSRedirector;
21 class AliTPCRawStream;
22 class AliTPCRawStreamFast;
23 class AliTPCAltroMapping;
25 struct eventHeaderStruct;
27 class AliTPCCalibPulser : public TObject {
31 AliTPCCalibPulser(const AliTPCCalibPulser &sig);
32 virtual ~AliTPCCalibPulser();
36 AliTPCCalibPulser& operator = (const AliTPCCalibPulser &source);
38 Bool_t ProcessEventFast(AliTPCRawStreamFast *rawStreamFast);
39 Bool_t ProcessEventFast(AliRawReader *rawReader);
42 Bool_t ProcessEvent(AliTPCRawStream *rawStream);
43 Bool_t ProcessEvent(AliRawReader *rawReader);
44 Bool_t ProcessEvent(eventHeaderStruct *event);
46 Int_t Update(const Int_t isector, const Int_t iRow, const Int_t iPad,
47 const Int_t iTimeBin, const Float_t signal);
50 AliTPCAltroMapping **GetAltroMapping() { return fMapping; };
51 void SetAltroMapping(AliTPCAltroMapping **mapp) { fMapping = mapp; };
53 AliTPCCalROC* GetCalRocT0 (Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
54 AliTPCCalROC* GetCalRocQ (Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
55 AliTPCCalROC* GetCalRocRMS(Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
56 AliTPCCalROC* GetCalRocOutliers(Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
58 const TObjArray* GetCalPadT0() const { return &fCalRocArrayT0; } // get calibration object
59 const TObjArray* GetCalPadQ() const { return &fCalRocArrayQ; } // get calibration object
60 const TObjArray* GetCalPadRMS() const{ return &fCalRocArrayRMS;} // get calibration object
61 const TObjArray* GetCalPadOutliers() const { return &fCalRocArrayOutliers;} // get calibration object
63 TH2S* GetHistoQ (Int_t sector, Bool_t force=kFALSE); // get refernce histogram
64 TH2S* GetHistoT0 (Int_t sector, Bool_t force=kFALSE); // get refernce histogram
65 TH2S* GetHistoRMS(Int_t sector, Bool_t force=kFALSE); // get refernce histogram
67 Short_t GetDebugLevel() const { return fDebugLevel; }
69 void SetRangeTime (Int_t firstTimeBin, Int_t lastTimeBin) { fFirstTimeBin=firstTimeBin; fLastTimeBin=lastTimeBin; } //Set range in which the pulser signal is expected
71 void SetRangeRefQ (Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsQ = nBins; fXminQ = xMin; fXmaxQ = xMax; } //Set range for Q reference histograms
72 void SetRangeRefT0 (Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsT0 = nBins; fXminT0 = xMin; fXmaxT0 = xMax; } //Set range for T0 reference histograms
73 void SetRangeRefRMS(Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsRMS = nBins; fXminRMS = xMin; fXmaxRMS = xMax; } //Set range for T0 reference histograms
75 void SetOldRCUformat(Bool_t format=kTRUE){ fOldRCUformat = format; }
77 void SetDebugLevel(Short_t debug=1){ fDebugLevel = debug;}
79 void SetPedestalDatabase(AliTPCCalPad *pedestalTPC, AliTPCCalPad *padNoiseTPC) {fPedestalTPC = pedestalTPC; fPadNoiseTPC = padNoiseTPC;}
80 void SetOutliers(AliTPCCalPad *outliers) {fOutliers = outliers;}
82 Int_t GetFirstTimeBin() const { return fFirstTimeBin; }
83 Int_t GetLastTimeBin() const { return fLastTimeBin; }
85 void Merge(AliTPCCalibPulser *sig);
87 void DumpToFile(const Char_t *filename, const Char_t *dir="", Bool_t append=kFALSE);
90 TObjArray* TestBinning();
93 Int_t fFirstTimeBin; // First Time bin needed for analysis
94 Int_t fLastTimeBin; // Last Time bin needed for analysis
96 // reference histogram ranges
97 Int_t fNbinsT0; // Number of bins for T0 reference histogram
98 Float_t fXminT0; // xmin of T0 reference histogram
99 Float_t fXmaxT0; // xmax of T0 reference histogram
100 Int_t fNbinsQ; // Number of bins for T0 reference histogram
101 Float_t fXminQ; // xmin of T0 reference histogram
102 Float_t fXmaxQ; // xmax of T0 reference histogram
103 Int_t fNbinsRMS; // Number of bins for T0 reference histogram
104 Float_t fXminRMS; // xmin of T0 reference histogram
105 Float_t fXmaxRMS; // xmax of T0 reference histogram
107 Int_t fLastSector; //! Last sector processed
109 Bool_t fOldRCUformat; //! Should we use the old RCU format for data reading
111 AliTPCROC *fROC; //! ROC information
112 AliTPCAltroMapping **fMapping; //! Altro Mapping object
113 AliTPCParam *fParam; //! TPC information
115 AliTPCCalPad *fPedestalTPC; //! Pedestal Information
116 AliTPCCalPad *fPadNoiseTPC; //! Pad noise Information whole TPC
117 AliTPCCalPad *fOutliers; //! Outlier information. Those will not be used for calculating the T0
118 AliTPCCalROC *fPedestalROC; //! Pedestal Information for current ROC
119 AliTPCCalROC *fPadNoiseROC; //! Pad noise Information for current ROC
120 // Bool_t fBpedestal; //! are we running with pedestal substraction
123 TObjArray fCalRocArrayT0; // Array of AliTPCCalROC class for Time0 calibration
124 TObjArray fCalRocArrayQ; // Array of AliTPCCalROC class for Charge calibration
125 TObjArray fCalRocArrayRMS; // Array of AliTPCCalROC class for signal width calibration
126 TObjArray fCalRocArrayOutliers; // Array of AliTPCCalROC class for signal outliers
128 TObjArray fHistoQArray; // Calibration histograms for Charge distribution
129 TObjArray fHistoT0Array; // Calibration histograms for Time0 distribution
130 TObjArray fHistoRMSArray; // Calibration histograms for signal width distribution
132 TObjArray fPadTimesArrayEvent; //! Pad Times for the event, before mean Time0 corrections
133 TObjArray fPadQArrayEvent; //! Charge for the event, only needed for debugging streamer
134 TObjArray fPadRMSArrayEvent; //! Signal width for the event, only needed for debugging streamer
135 TObjArray fPadPedestalArrayEvent; //! Signal width for the event, only needed for debugging streamer
137 Int_t fCurrentChannel; //! current channel processed
138 Int_t fCurrentSector; //! current sector processed
139 Int_t fCurrentRow; //! current row processed
140 Float_t fMaxPadSignal; //! maximum bin of current pad
141 Int_t fMaxTimeBin; //! time bin with maximum value
142 TVectorF fPadSignal; //! signal of current Pad
143 Float_t fPadPedestal; //! Pedestal Value of current pad
144 Float_t fPadNoise; //! Noise Value of current pad
146 TVectorF fVTime0Offset; //! Time0 Offset from preprocessing for each sector;
147 TVectorF fVTime0OffsetCounter; //! Time0 Offset from preprocessing for each sector;
150 // Int_t fEvent; // Number of events processed
151 TTreeSRedirector *fDebugStreamer; //! debug streamer
153 Short_t fDebugLevel; // debug Level
156 void FindPedestal(Float_t part=.6);
157 void FindPulserSignal(TVectorD ¶m, Float_t &qSum);
159 TH2S* GetHisto(Int_t sector, TObjArray *arr,
160 Int_t nbinsY, Float_t ymin, Float_t ymax,
161 Char_t *type, Bool_t force);
164 AliTPCCalROC* GetCalRoc(Int_t sector, TObjArray* arr, Bool_t force) const;
166 TVectorF* GetPadTimesEvent(Int_t sector, Bool_t force=kFALSE);
175 TVectorF* GetPadInfoEvent(Int_t sector, TObjArray *arr, Bool_t force=kFALSE);
176 TVectorF* GetPadQEvent(Int_t sector, Bool_t force=kFALSE);
177 TVectorF* GetPadRMSEvent(Int_t sector, Bool_t force=kFALSE);
178 TVectorF* GetPadPedestalEvent(Int_t sector, Bool_t force=kFALSE);
181 ClassDef(AliTPCCalibPulser,1) //Implementation of the TPC pulser calibration