]>
Commit | Line | Data |
---|---|---|
1 | #ifndef ALITPCCALIBDBUTIL_H | |
2 | #define ALITPCCALIBDBUTIL_H | |
3 | ||
4 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
5 | * See cxx source for full Copyright notice */ | |
6 | ||
7 | /////////////////////////////////////////////////////////////////////////////// | |
8 | // // | |
9 | // Class providing the calculation of derived quantities (mean,rms,fits,...) // | |
10 | // of calibration entries // | |
11 | // // | |
12 | /////////////////////////////////////////////////////////////////////////////// | |
13 | ||
14 | #include <TObject.h> | |
15 | #include <TArrayI.h> | |
16 | #include <TVectorDfwd.h> | |
17 | #include <TVectorFfwd.h> | |
18 | #include <TMatrixDfwd.h> | |
19 | ||
20 | class TGraph; | |
21 | class TMap; | |
22 | class AliDCSSensorArray; | |
23 | class AliTPCcalibDB; | |
24 | class AliTPCCalPad; | |
25 | class AliTPCCalROC; | |
26 | class AliTPCmapper; | |
27 | class AliTPCCalibRaw; | |
28 | class AliCDBEntry; | |
29 | class AliDCSSensor; | |
30 | class AliDCSSensorArray; | |
31 | class AliTPCSensorTempArray; | |
32 | class AliTPCdataQA; | |
33 | class TGraphErrors; | |
34 | class TTreeSRedirector; | |
35 | class AliTPCCalROC; | |
36 | class AliSplineFit; | |
37 | ||
38 | class AliTPCcalibDButil : public TObject | |
39 | { | |
40 | public: | |
41 | AliTPCcalibDButil(); | |
42 | virtual ~AliTPCcalibDButil(); | |
43 | ||
44 | void UpdateFromCalibDB(); | |
45 | //data processing functions | |
46 | void ProcessCEdata(const char* fitFormula, TVectorD &fitResultsA, TVectorD &fitResultsC, | |
47 | Int_t &noutliersCE, Double_t & chi2A, Double_t &chi2C, AliTPCCalPad * const outCE=0); | |
48 | void ProcessCEgraphs(TVectorD &vecTEntries, TVectorD &vecTMean, TVectorD &vecTRMS, TVectorD &vecTMedian, | |
49 | TVectorD &vecQEntries, TVectorD &vecQMean, TVectorD &vecQRMS, TVectorD &vecQMedian, | |
50 | Float_t &driftTimeA, Float_t &driftTimeC ); | |
51 | void ProcessNoiseData(TVectorD &vNoiseMean, TVectorD &vNoiseMeanSenRegions, | |
52 | TVectorD &vNoiseRMS, TVectorD &vNoiseRMSSenRegions, | |
53 | Int_t &nonMaskedZero, Int_t &nNaN); | |
54 | void ProcessQAData(TVectorD &vQaOcc, TVectorD &vQaQtot, TVectorD &vQaQmax); | |
55 | void ProcessPulser(TVectorD &vMeanTime); | |
56 | void ProcessALTROConfig(Int_t &nMasked); | |
57 | void ProcessGoofie(TVectorD & vecEntries, TVectorD & vecMedian, TVectorD &vecMean, TVectorD &vecRMS); | |
58 | ||
59 | //processing functions using reference data | |
60 | void ProcessPedestalVariations(TVectorF &pedestalDeviations); | |
61 | void ProcessNoiseVariations(TVectorF &noiseDeviations); | |
62 | void ProcessPulserVariations(TVectorF &pulserQdeviations, Float_t &varQMean, Int_t &npadsOutOneTB, Int_t &npadsOffAdd); | |
63 | ||
64 | //getter preprocess information | |
65 | Int_t GetNPulserOutliers() const {return fNpulserOutliers;} | |
66 | Float_t GetMeanAltro(const AliTPCCalROC *roc, const Int_t row, const Int_t pad, AliTPCCalROC * const rocOut=0x0); | |
67 | AliTPCCalPad *GetPulserOutlierMap() const {return fPulserOutlier;} | |
68 | ||
69 | //getters ref data | |
70 | TMap *GetReferenceMap() const {return fRefMap;} | |
71 | Int_t GetReferenceRun(const char* type) const; | |
72 | const char* GetRefValidity() const {return fRefValidity.Data();} | |
73 | ||
74 | AliTPCCalPad* GetRefPadNoise() const {return fRefPadNoise;} | |
75 | AliTPCCalPad* GetRefPedestals() const {return fRefPedestals;} | |
76 | AliTPCCalPad* GetRefPedestalMasked() const {return fRefPedestalMasked;} | |
77 | AliTPCCalPad* GetRefPulserTmean() const {return fRefPulserTmean;} | |
78 | AliTPCCalPad* GetRefPulserTrms() const {return fRefPulserTrms;} | |
79 | AliTPCCalPad* GetRefPulserQmean() const {return fRefPulserQmean;} | |
80 | AliTPCCalPad* GetRefPulserOutlier() const {return fRefPulserOutlier;} | |
81 | AliTPCCalPad* GetRefPulserMasked() const {return fRefPulserMasked;} | |
82 | AliTPCCalPad* GetRefCETmean() const {return fRefCETmean;} | |
83 | AliTPCCalPad* GetRefCETrms() const {return fRefCETrms;} | |
84 | AliTPCCalPad* GetRefCEQmean() const {return fRefCEQmean;} | |
85 | AliTPCCalPad* GetRefCEMasked() const {return fRefCEMasked;} | |
86 | AliTPCCalPad* GetRefALTROFPED() const {return fRefALTROFPED;} | |
87 | AliTPCCalPad* GetRefALTROZsThr() const {return fRefALTROZsThr;} | |
88 | AliTPCCalPad* GetRefALTROAcqStart() const {return fRefALTROAcqStart;} | |
89 | AliTPCCalPad* GetRefALTROAcqStop() const {return fRefALTROAcqStop;} | |
90 | AliTPCCalPad* GetRefALTROMasked() const {return fRefALTROMasked;} | |
91 | ||
92 | ||
93 | //setters for pad by pad information | |
94 | void SetPulserData(AliTPCCalPad * const tmean, AliTPCCalPad * const trms=0x0, AliTPCCalPad * const qmean=0x0) | |
95 | {fPulserTmean=tmean; fPulserTrms=trms; fPulserQmean=qmean;} | |
96 | void SetCEData(AliTPCCalPad *const tmean, AliTPCCalPad *const trms=0x0, AliTPCCalPad *const qmean=0x0) | |
97 | {fCETmean=tmean; fCETrms=trms; fCEQmean=qmean;} | |
98 | void SetNoisePedestal(AliTPCCalPad *const noise, AliTPCCalPad *const pedestal=0x0) | |
99 | {fPadNoise=noise; fPedestals=pedestal;} | |
100 | void SetALTROData(AliTPCCalPad *const masked) | |
101 | {fALTROMasked=masked;} | |
102 | void SetGoofieArray(AliDCSSensorArray *const arr) {fGoofieArray=arr;} | |
103 | ||
104 | //setters for pad by pad information | |
105 | void SetRefFile(const char* filename); | |
106 | void SetReferenceRun(Int_t run=-1); | |
107 | void UpdateRefDataFromOCDB(); | |
108 | void SetRefPulserData(AliTPCCalPad *const tmean, AliTPCCalPad *const trms=0x0, AliTPCCalPad *const qmean=0x0) | |
109 | {fRefPulserTmean=tmean; fRefPulserTrms=trms; fRefPulserQmean=qmean;} | |
110 | void SetRefCEData(AliTPCCalPad *const tmean, AliTPCCalPad *const trms=0x0, AliTPCCalPad *const qmean=0x0) | |
111 | {fRefCETmean=tmean; fRefCETrms=trms; fRefCEQmean=qmean;} | |
112 | void SetRefNoisePedestal(AliTPCCalPad *const noise, AliTPCCalPad *const pedestal=0x0) | |
113 | {fRefPadNoise=noise; fRefPedestals=pedestal;} | |
114 | void SetRefALTROData(AliTPCCalPad *const masked) | |
115 | {fRefALTROMasked=masked;} | |
116 | ||
117 | //creation of derived pad by pad calibration data | |
118 | AliTPCCalPad *CreatePadTime0(Int_t model, Double_t &gyA, Double_t &gyC, Double_t &chi2A, Double_t &chi2C); | |
119 | // | |
120 | // create outlyer maps | |
121 | // | |
122 | AliTPCCalPad *CreateCEOutlyerMap(Int_t &noutliersCE, AliTPCCalPad * const ceOut=0, Float_t minSignal=10, Float_t cutTrmsMin=0.9, Float_t cutTrmsMax=1.2, Float_t cutMaxDistT=0.7); | |
123 | AliTPCCalPad *CreatePulserOutlyerMap(Int_t &noutliersPulser, AliTPCCalPad * const pulserOut=0, Float_t cutTime=3, Float_t cutnRMSQ=5, Float_t cutnRMSrms=5); | |
124 | // | |
125 | AliTPCCalPad *CreatePadTime0CE(TVectorD &fitResultsA, TVectorD&fitResultsC, Int_t &nOut, Double_t &chi2A, Double_t &chi2C, const char *dumpfile=0); | |
126 | // | |
127 | ||
128 | void UpdatePulserOutlierMap(); | |
129 | void UpdateRefPulserOutlierMap(); | |
130 | void PulserOutlierMap(AliTPCCalPad *pulOut, const AliTPCCalPad *pulT, const AliTPCCalPad *pulQ); | |
131 | ||
132 | const char* GetGUIRefTreeDefaultName(); | |
133 | ||
134 | Bool_t CreateGUIRefTree(const char* filename=""); | |
135 | // | |
136 | // graph tools | |
137 | // | |
138 | static Double_t GetLaserTime0(Int_t run, Int_t timeStamp, Int_t deltaT, Int_t side); | |
139 | static TGraph* FilterGraphMedian(TGraph * const graph, Float_t sigmaCut, Double_t &medianY); | |
140 | static TGraph* FilterGraphMedianAbs(TGraph * graph, Float_t cut, Double_t &medianY); | |
141 | static TGraphErrors* FilterGraphMedianErr(TGraphErrors * graph, Float_t sigmaCut,Double_t &medianY); | |
142 | // | |
143 | static void Sort(TGraph *graph); | |
144 | static void SmoothGraph(TGraph *graph, Double_t delta); | |
145 | static Int_t GetNearest(TGraph *graph, Double_t xref, Double_t &dx, Double_t &y); | |
146 | static Double_t EvalGraphConst(TGraph * const graph, Double_t xref); | |
147 | static Double_t EvalGraphConst(AliSplineFit *graph, Double_t xref); | |
148 | ||
149 | // | |
150 | // Filter sensors | |
151 | // | |
152 | static Float_t FilterSensor(AliDCSSensor * sensor, Double_t ymin, Double_t ymax, Double_t maxdy, Double_t sigmaCut); | |
153 | // | |
154 | // Filter AliRelAlignmentKalman - Alignment/Drift velocity | |
155 | // | |
156 | static TMatrixD* MakeStatRelKalman(TObjArray * const array, Float_t minFraction, Int_t minStat, Float_t maxvd); | |
157 | static TObjArray *SmoothRelKalman(TObjArray * const array,const TMatrixD & stat, Bool_t direction, Float_t sigmaCut); | |
158 | static TObjArray *SmoothRelKalman(TObjArray * const arrayP, TObjArray * const arrayM); | |
159 | static void FilterCE(Double_t deltaT=100, Double_t cutAbs=10, Double_t cutSigma=4., TTreeSRedirector * const pcstream=0); | |
160 | static void FilterTracks(Int_t run, Double_t cutSigma=20., TTreeSRedirector * const pcstream=0); | |
161 | static Float_t FilterTemperature(AliTPCSensorTempArray *tempArray, Double_t ymin=15, Double_t ymax=22, Double_t sigmaCut=5); | |
162 | ||
163 | static void FilterGoofie(AliDCSSensorArray * goofieArray, Double_t deltaT=2, Double_t cutSigma=4., Double_t minVdn=8.5, Double_t maxVdn=9.05, TTreeSRedirector * const pcstream=0); | |
164 | static Double_t GetTriggerOffsetTPC(Int_t run, Int_t timeStamp, Double_t deltaT=86400, Double_t deltaTLaser=3600, Int_t valType=0); | |
165 | static Double_t GetVDriftTPC(Double_t &dist, Int_t run, Int_t timeStamp, Double_t deltaT=86400, Double_t deltaTLaser=3600, Int_t valType=0); | |
166 | static Double_t GetVDriftTPCLaserTracks(Double_t &dist,Int_t run, Int_t timeStamp, Double_t deltaT=43200, Int_t side=2); | |
167 | static Double_t GetVDriftTPCLaserTracksOnline(Double_t &dist, Int_t /*run*/, Int_t timeStamp, Double_t deltaT=43200, Int_t side=2); | |
168 | static Double_t GetVDriftTPCCE(Double_t &dist, Int_t run, Int_t timeStamp, Double_t deltaT=43200, Int_t side=2); | |
169 | static Double_t GetVDriftTPCITS(Double_t &dist, Int_t run, Int_t timeStamp); | |
170 | static Double_t GetTime0TPCITS(Double_t &dist, Int_t run, Int_t timeStamp); | |
171 | Int_t MakeRunList(Int_t startRun, Int_t stopRun); // find the list of usable runs | |
172 | Int_t FindRunTPC(Int_t itime, Bool_t debug=kFALSE); | |
173 | ||
174 | AliTPCCalPad* GetRefCalPad(AliCDBEntry *entry, const char* objName); | |
175 | AliTPCCalPad* GetRefCalPad(AliCDBEntry *entry); | |
176 | AliTPCCalPad* GetAltroMasked(const char* cdbPath, const char* name); | |
177 | Bool_t HasRefChanged(const char *cdbPath); | |
178 | Int_t GetCurrentReferenceRun(const char* type) const; | |
179 | AliCDBEntry* GetRefEntry(const char* cdbPath); | |
180 | ||
181 | private: | |
182 | AliTPCcalibDB *fCalibDB; //pointer to calibDB object | |
183 | AliTPCCalPad *fPadNoise; //noise information | |
184 | AliTPCCalPad *fPedestals; //pedestal information | |
185 | AliTPCCalPad *fPulserTmean; //pulser mean time information | |
186 | AliTPCCalPad *fPulserTrms; //pulser rms time information | |
187 | AliTPCCalPad *fPulserQmean; //pulser mean q information | |
188 | AliTPCCalPad *fPulserOutlier; //pulser outlier map | |
189 | AliTPCCalPad *fCETmean; //central electrode mean time information | |
190 | AliTPCCalPad *fCETrms; //central electrode rms time information | |
191 | AliTPCCalPad *fCEQmean; //central electrode mean q information | |
192 | AliTPCCalPad *fALTROMasked; //ALTRO masked channels information | |
193 | // | |
194 | AliTPCCalibRaw *fCalibRaw; //raw calibration object | |
195 | // | |
196 | AliTPCdataQA *fDataQA; //data qa | |
197 | //reference data | |
198 | TMap *fRefMap; // latest map to reference information | |
199 | TMap *fCurrentRefMap; // reference data map of entries currently loaded | |
200 | TString fRefValidity; // validity range of reference data | |
201 | // | |
202 | AliTPCCalPad *fRefPadNoise; //Reference noise information | |
203 | AliTPCCalPad *fRefPedestals; //Reference pedestal information | |
204 | AliTPCCalPad *fRefPedestalMasked; //Reference masked channels in pedestal run | |
205 | AliTPCCalPad *fRefPulserTmean; //Reference pulser mean time information | |
206 | AliTPCCalPad *fRefPulserTrms; //Reference pulser rms time information | |
207 | AliTPCCalPad *fRefPulserQmean; //Reference pulser mean q information | |
208 | AliTPCCalPad *fRefPulserOutlier; //Reference pulser outlier map | |
209 | AliTPCCalPad *fRefPulserMasked; //Reference masked channels in pulser run | |
210 | AliTPCCalPad *fRefCETmean; //Reference central electrode mean time information | |
211 | AliTPCCalPad *fRefCETrms; //Reference central electrode rms time information | |
212 | AliTPCCalPad *fRefCEQmean; //Reference central electrode mean q information | |
213 | AliTPCCalPad *fRefCEMasked; //Reference masked channels in laser run | |
214 | AliTPCCalPad *fRefALTROFPED; //Reference fixed pedestal value | |
215 | AliTPCCalPad *fRefALTROZsThr; //Reference zero suppression threshol | |
216 | AliTPCCalPad *fRefALTROAcqStart; //Reference accquistion start time bin | |
217 | AliTPCCalPad *fRefALTROAcqStop; //Reference accquistion stop time bin | |
218 | AliTPCCalPad *fRefALTROMasked; //Reference ALTRO masked channels information | |
219 | // | |
220 | AliTPCCalibRaw *fRefCalibRaw; //Reference raw calibration object | |
221 | // | |
222 | AliTPCdataQA *fRefDataQA; //Reference data QA | |
223 | // | |
224 | AliDCSSensorArray* fGoofieArray; //Goofie Data | |
225 | // | |
226 | AliTPCmapper *fMapper; //TPC mapping handler | |
227 | Int_t fNpulserOutliers; //number of outliers from Pulser calibration | |
228 | ||
229 | Float_t fIrocTimeOffset; //timing offset between IROC and OROC in timebins | |
230 | Float_t fCETmaxLimitAbs; //maximum variation in CE data before pads will be treated as outliers | |
231 | Float_t fPulTmaxLimitAbs; //maximum variation of Pulser Signals (time) before pads will be treated as outliers | |
232 | Float_t fPulQmaxLimitAbs; //maximum variation of Pulser Signals (charge) before pads will be treated as outliers | |
233 | Float_t fPulQminLimit; //minimum charge value for Pulser Signals before pads will be treated as outliers | |
234 | ||
235 | // | |
236 | // helpers to get the run number for given time stamps | |
237 | // | |
238 | // filters | |
239 | ||
240 | TArrayI fRuns; // run list with OCDB info | |
241 | TArrayI fRunsStart; // start time for given run | |
242 | TArrayI fRunsStop; // stop time for given run | |
243 | ||
244 | AliTPCcalibDButil (const AliTPCcalibDButil& ); | |
245 | AliTPCcalibDButil& operator= (const AliTPCcalibDButil& ); | |
246 | ||
247 | ||
248 | static Double_t GetVDriftTPCLaserTracksCommon(Double_t &dist, Int_t timeStamp, Double_t deltaT, Int_t side, TObjArray * const array); | |
249 | ||
250 | ||
251 | ClassDef(AliTPCcalibDButil,0) | |
252 | }; | |
253 | ||
254 | ||
255 | #endif |