]>
Commit | Line | Data |
---|---|---|
12f69174 | 1 | /* |
2 | // Make a summary information of calibration. | |
3 | // Store results in the summary trees | |
4 | // OCDB configuration | |
5 | ||
6 | gSystem->AddIncludePath("-I$ALICE_ROOT/TPC"); | |
7 | .L $ALICE_ROOT/TPC/AliTPCcalibSummary.cxx+ | |
8 | ||
9 | AliTPCcalibSummary calib; | |
10 | calib.Procces("run.list",run0,run1); | |
11 | ||
12 | ||
13 | */ | |
14 | ||
15 | #include <TROOT.h> | |
16 | #include <iostream> | |
17 | #include <fstream> | |
18 | #include <stdio.h> | |
19 | #include <AliCDBManager.h> | |
20 | #include <AliCDBEntry.h> | |
21 | #include <AliLog.h> | |
22 | #include <AliMagF.h> | |
23 | #include "AliTPCcalibDB.h" | |
24 | #include "AliTPCcalibDButil.h" | |
25 | #include "AliTPCAltroMapping.h" | |
26 | #include "AliTPCExB.h" | |
27 | #include "AliTPCCalROC.h" | |
28 | #include "AliTPCCalPad.h" | |
29 | #include "AliTPCSensorTempArray.h" | |
30 | #include "AliGRPObject.h" | |
31 | #include "AliTPCTransform.h" | |
32 | #include "TFile.h" | |
33 | #include "TKey.h" | |
34 | #include "TObjArray.h" | |
35 | #include "TObjString.h" | |
36 | #include "TString.h" | |
37 | #include "AliTPCCalPad.h" | |
38 | #include "AliTPCROC.h" | |
39 | #include "AliTPCParam.h" | |
40 | #include "AliTPCCalibPulser.h" | |
41 | #include "AliTPCCalibPedestal.h" | |
42 | #include "AliTPCCalibCE.h" | |
43 | #include "AliTPCExBFirst.h" | |
44 | #include "TTreeStream.h" | |
45 | #include "AliTPCTempMap.h" | |
46 | #include "TVectorD.h" | |
47 | #include "TMatrixD.h" | |
48 | #include "AliTPCCalibRaw.h" | |
49 | #include "AliSplineFit.h" | |
50 | #include "TGraphErrors.h" | |
51 | #include <AliCTPTimeParams.h> | |
52 | #include <AliTPCcalibSummary.h> | |
53 | // | |
54 | // | |
55 | // | |
56 | AliTPCcalibSummary::AliTPCcalibSummary(): | |
57 | TNamed(), | |
58 | fCalibDB(0), | |
59 | fDButil(0), | |
60 | fPcstream(0) | |
61 | { | |
62 | // | |
63 | // default constructor | |
64 | // OCDB have to be setupe before - not part of class | |
65 | // usualy ConfigOCDB.C macro used | |
66 | // | |
67 | fPcstream = new TTreeSRedirector("dcsTime.root"); | |
68 | fCalibDB = AliTPCcalibDB::Instance(); | |
69 | fDButil= new AliTPCcalibDButil; | |
70 | } | |
71 | ||
72 | AliTPCcalibSummary::~AliTPCcalibSummary(){ | |
73 | // | |
74 | // destructor - close streamer | |
75 | // | |
76 | delete fPcstream; | |
77 | } | |
78 | ||
79 | void AliTPCcalibSummary::Process(const char * runList, Int_t first, Int_t last){ | |
80 | // | |
81 | // runList - listOfRuns to process | |
82 | // first - first run to process | |
83 | // last - last to process | |
84 | // | |
85 | // | |
86 | // make list of runs | |
87 | // | |
88 | ||
89 | ifstream inputFile; | |
90 | inputFile.open("run.list"); | |
91 | Int_t irun=0; | |
92 | TArrayI runArray(100000); | |
93 | Int_t indexes[100000]; | |
94 | Int_t nruns=0; | |
95 | printf("Runs to process:\n"); | |
96 | if (!inputFile.is_open()) { | |
97 | printf("Problem to open file %s\n",runList); | |
98 | } | |
99 | while( inputFile.good() ) { | |
100 | inputFile >> irun; | |
101 | printf("Run \t%d\n",irun); | |
102 | if (irun<first) continue; // process only subset of list | |
103 | if (last>0 && irun>last) continue; // process only subset of list | |
104 | runArray[nruns]=irun; | |
105 | nruns++; | |
106 | } | |
107 | ||
108 | ||
109 | TMath::Sort(nruns, runArray.fArray, indexes,kFALSE); | |
110 | Int_t startTime = 0; | |
111 | Int_t endTime = 0; | |
112 | for (Int_t run=0; run<nruns; run++){ | |
113 | irun=runArray[indexes[run]]; | |
114 | printf("Processing run %d ...\n",irun); | |
115 | fCalibDB->SetRun(irun); | |
116 | fDButil->UpdateFromCalibDB(); | |
117 | fDButil->SetReferenceRun(irun); | |
118 | fDButil->UpdateRefDataFromOCDB(); | |
119 | // | |
120 | AliDCSSensorArray *arrHV=fCalibDB->GetVoltageSensors(irun); | |
121 | if (!arrHV) continue; | |
122 | for (Int_t isenHV=0; isenHV<arrHV->NumSensors(); ++isenHV){ | |
123 | AliDCSSensor *senHV=arrHV->GetSensorNum(isenHV); | |
124 | if (!senHV) { | |
125 | printf("Not interesting OCDB info\n"); | |
126 | continue; | |
127 | } | |
128 | startTime=senHV->GetStartTime(); | |
129 | endTime =senHV->GetEndTime(); | |
130 | if (startTime>0&&endTime>0) break; | |
131 | } | |
132 | AliDCSSensorArray* goofieArray = fCalibDB->GetGoofieSensors(irun); | |
133 | if (goofieArray) fDButil->FilterGoofie(goofieArray,0.5,4.,6.85,7.05,fPcstream); | |
134 | // don't filter goofie for the moment | |
135 | ProcessRun(irun, startTime,endTime); | |
136 | } | |
137 | } | |
138 | ||
139 | ||
140 | void AliTPCcalibSummary::ProcessRun(Int_t irun, Int_t startTime, Int_t endTime){ | |
141 | // | |
142 | // Process run irun | |
143 | // | |
144 | fCalibDB->SetRun(irun); | |
145 | fDButil->UpdateFromCalibDB(); | |
146 | fDButil->SetReferenceRun(irun); | |
147 | fDButil->UpdateRefDataFromOCDB(); | |
148 | // | |
149 | AliSplineFit *fitVdrift=0x0; | |
150 | Int_t startTimeGRP=0, stopTimeGRP=0; | |
151 | if (fCalibDB->GetGRP(irun)){ | |
152 | startTimeGRP = AliTPCcalibDB::GetGRP(irun)->GetTimeStart(); | |
153 | stopTimeGRP = AliTPCcalibDB::GetGRP(irun)->GetTimeEnd(); | |
154 | } | |
155 | if (startTime==0){ | |
156 | startTime=startTimeGRP; | |
157 | endTime=stopTimeGRP; | |
158 | } | |
159 | AliTPCSensorTempArray * tempArray = fCalibDB->GetTemperatureSensor(irun); | |
160 | AliTPCTempMap * tempMap = new AliTPCTempMap(tempArray); | |
161 | AliDCSSensorArray* goofieArray = fCalibDB->GetGoofieSensors(irun); | |
162 | // | |
163 | Int_t dtime = TMath::Max((endTime-startTime)/20,10*60); | |
164 | // | |
165 | //Goofie statistical data | |
166 | // | |
167 | TVectorD vecEntries, vecMean, vecMedian,vecRMS; | |
168 | fDButil->ProcessGoofie(vecEntries ,vecMedian, vecMean, vecRMS); | |
169 | // | |
170 | //CE data processing - see ProcessCEdata function for description of the results | |
171 | // | |
172 | TVectorD fitResultsA, fitResultsC; | |
173 | Int_t nmaskedCE; | |
174 | Double_t chi2ACE=0,chi2CCE=0; | |
175 | // fDButil->ProcessCEdata("(sector<36)++gx++gy++lx++lx**2",fitResultsA,fitResultsC,nmaskedCE); | |
176 | fDButil->ProcessCEdata("(sector<36)++gx++gy++(lx-134)++(sector<36)*(lx-134)++(ly/lx)^2",fitResultsA,fitResultsC,nmaskedCE,chi2ACE,chi2CCE); | |
177 | ||
178 | TVectorD fitCEResultsA(7), fitCEResultsC(7); | |
179 | Int_t noutCE; | |
180 | Double_t chi2CEA=0,chi2CEC=0; | |
181 | AliTPCCalPad *time0 = fDButil->CreatePadTime0CE(fitCEResultsA, fitCEResultsC, noutCE, chi2CEA, chi2CEC); | |
182 | delete time0; | |
183 | // | |
184 | // | |
185 | TVectorD vecTEntries, vecTMean, vecTRMS, vecTMedian, vecQEntries, vecQMean, vecQRMS, vecQMedian; | |
186 | Float_t driftTimeA, driftTimeC; | |
187 | fDButil->ProcessCEgraphs(vecTEntries, vecTMean, vecTRMS, vecTMedian, | |
188 | vecQEntries, vecQMean, vecQRMS, vecQMedian, | |
189 | driftTimeA, driftTimeC ); | |
190 | // | |
191 | // | |
192 | // | |
193 | //drift velocity using tracks | |
194 | // | |
195 | // fitVdrift=fCalibDB->GetVdriftSplineFit("ALISPLINEFIT_MEAN_VDRIFT_COSMICS_ALL",irun); | |
196 | fitVdrift=fCalibDB->CreateVdriftSplineFit("TGRAPHERRORS_MEAN_VDRIFT_COSMICS_ALL",irun); | |
197 | //noise data Processing - see ProcessNoiseData function for description of the results | |
198 | TVectorD vNoiseMean, vNoiseMeanSenRegions, vNoiseRMS, vNoiseRMSSenRegions; | |
199 | Int_t nonMaskedZero=0, nNaN=0; | |
200 | fDButil->ProcessNoiseData(vNoiseMean, vNoiseMeanSenRegions, vNoiseRMS, vNoiseRMSSenRegions, nonMaskedZero, nNaN); | |
201 | // | |
202 | // comparisons | |
203 | // | |
204 | TVectorF pedestalDeviations; | |
205 | TVectorF noiseDeviations; | |
206 | TVectorF pulserQdeviations; | |
207 | Float_t varQMean; | |
208 | Int_t npadsOutOneTB; | |
209 | Int_t npadsOffAdd; | |
210 | fDButil->ProcessPedestalVariations(pedestalDeviations); | |
211 | fDButil->ProcessNoiseVariations(noiseDeviations); | |
212 | fDButil->ProcessPulserVariations(pulserQdeviations,varQMean,npadsOutOneTB,npadsOffAdd); | |
213 | // | |
214 | //L3 data | |
215 | // | |
216 | Float_t bz=AliTPCcalibDB::GetBz(irun); | |
217 | Char_t l3pol=AliTPCcalibDB::GetL3Polarity(irun); | |
218 | // | |
219 | //calibration Pulser data processing | |
220 | // | |
221 | Int_t nOffChannels=0; | |
222 | TVectorD vTimePulser; | |
223 | nOffChannels=fDButil->GetNPulserOutliers(); | |
224 | fDButil->ProcessPulser(vTimePulser); | |
225 | // | |
226 | //ALTRO data | |
227 | // | |
228 | Int_t nMasked=0; | |
229 | fDButil->ProcessALTROConfig(nMasked); | |
230 | // | |
231 | //Calib RAW data | |
232 | // | |
233 | Int_t nFailL1=-1; | |
234 | if (fCalibDB->GetCalibRaw()) nFailL1=fCalibDB->GetCalibRaw()->GetNFailL1Phase(); | |
235 | // | |
236 | //production information | |
237 | // | |
238 | Int_t nalien=0,nRawAlien=0,nlocal=0,nRawLocal=0; | |
239 | //run type | |
240 | TObjString runType(AliTPCcalibDB::GetRunType(irun).Data()); | |
241 | // | |
242 | // | |
243 | // | |
244 | ||
245 | for (Int_t itime=startTime; itime<endTime; itime+=dtime){ | |
246 | // | |
247 | TTimeStamp tstamp(itime); | |
248 | Float_t valuePressure = fCalibDB->GetPressure(tstamp,irun,0); | |
249 | Float_t valuePressure2 = fCalibDB->GetPressure(tstamp,irun,1); | |
250 | Double_t ptrelative0 = AliTPCcalibDB::GetPTRelative((UInt_t)itime,irun,0); | |
251 | Double_t ptrelative1 = AliTPCcalibDB::GetPTRelative((UInt_t)itime,irun,1); | |
252 | //temperature fits | |
253 | TLinearFitter * fitter = 0; | |
254 | TVectorD vecTemp[10]; | |
255 | for (Int_t itype=0; itype<5; itype++) | |
256 | for (Int_t iside=0; iside<2; iside++){ | |
257 | fitter= tempMap->GetLinearFitter(itype,iside,tstamp); | |
258 | if (!fitter) continue; | |
259 | fitter->Eval(); | |
260 | fitter->GetParameters(vecTemp[itype+iside*5]); | |
261 | delete fitter; | |
262 | } | |
263 | // | |
264 | //measured skirt temperatures | |
265 | // | |
266 | TVectorD vecSkirtTempA(18); | |
267 | TVectorD vecSkirtTempC(18); | |
268 | Int_t nsenTemp=tempArray->NumSensors(); | |
269 | for (Int_t isenTemp=0;isenTemp<nsenTemp;++isenTemp){ | |
270 | AliTPCSensorTemp *senTemp=(AliTPCSensorTemp*)tempArray->GetSensorNum(isenTemp); | |
271 | if (senTemp->GetType()!=3) continue; | |
272 | if (TMath::Sqrt(senTemp->GetX()*senTemp->GetX()+senTemp->GetY()*senTemp->GetY())<100) continue; //only skirt, outer FC vessel | |
273 | Double_t val=senTemp->GetValue(tstamp); | |
274 | if (senTemp->GetSide()==0) | |
275 | vecSkirtTempA[senTemp->GetSector()]=val; | |
276 | else | |
277 | vecSkirtTempC[senTemp->GetSector()]=val; | |
278 | } | |
279 | // | |
280 | //goofie data | |
281 | // | |
282 | TVectorD vecGoofie; | |
283 | if (goofieArray){ | |
284 | vecGoofie.ResizeTo(goofieArray->NumSensors()); | |
285 | for (Int_t isensor=0; isensor<goofieArray->NumSensors();isensor++){ | |
286 | AliDCSSensor *gsensor = goofieArray->GetSensor(isensor); | |
287 | if (gsensor){ | |
288 | vecGoofie[isensor] = gsensor->GetValue(tstamp); | |
289 | } | |
290 | } | |
291 | } else { | |
292 | vecGoofie.ResizeTo(19); | |
293 | } | |
294 | // | |
295 | TVectorD voltagesIROC(36); | |
296 | TVectorD voltagesOROC(36); | |
297 | for(Int_t j=1; j<36; j++) voltagesIROC[j-1] = fCalibDB->GetChamberHighVoltage(irun, j,itime); | |
298 | for(Int_t j=36; j<72; j++) voltagesOROC[j-36] = fCalibDB->GetChamberHighVoltage(irun, j,itime); | |
299 | Double_t voltIROC = TMath::Median(36, voltagesIROC.GetMatrixArray()); | |
300 | Double_t voltOROC = TMath::Median(36, voltagesOROC.GetMatrixArray()); | |
301 | // | |
302 | Float_t coverIA=AliTPCcalibDB::GetCoverVoltage(irun,0,itime); | |
303 | Float_t coverIC=AliTPCcalibDB::GetCoverVoltage(irun,18,itime); | |
304 | Float_t coverOA=AliTPCcalibDB::GetCoverVoltage(irun,36,itime); | |
305 | Float_t coverOC=AliTPCcalibDB::GetCoverVoltage(irun,54,itime); | |
306 | Float_t skirtA=AliTPCcalibDB::GetSkirtVoltage(irun,0,itime); | |
307 | Float_t skirtC=AliTPCcalibDB::GetSkirtVoltage(irun,18,itime); | |
308 | Float_t ggOffA=AliTPCcalibDB::GetGGoffsetVoltage(irun,0,itime); | |
309 | Float_t ggOffC=AliTPCcalibDB::GetGGoffsetVoltage(irun,18,itime); | |
310 | //drift velocity | |
311 | Float_t dvCorr=-5; | |
312 | if (fitVdrift) dvCorr=fitVdrift->Eval(itime); | |
313 | ||
314 | //tempMap->GetLinearFitter(0,0,itime); | |
315 | (*fPcstream)<<"dcs"<< | |
316 | "run="<<irun<< | |
317 | "time="<<itime<< | |
318 | "startTimeGRP="<<startTimeGRP<< | |
319 | "stopTimeGRP="<<stopTimeGRP<< | |
320 | //run type | |
321 | "runType.="<<&runType<< | |
322 | // voltage setting | |
323 | "VIROC.="<<&voltagesIROC<< | |
324 | "VOROC.="<<&voltagesOROC<< | |
325 | "medianVIROC="<<voltIROC<< | |
326 | "medianVOROC="<<voltOROC<< | |
327 | "coverIA=" << coverIA << | |
328 | "coverIC=" << coverIC << | |
329 | "coverOA=" << coverOA << | |
330 | "coverOC=" << coverOC << | |
331 | "skirtA=" << skirtA << | |
332 | "skirtC=" << skirtC << | |
333 | "ggOffA=" << ggOffA << | |
334 | "ggOffC=" << ggOffC << | |
335 | // | |
336 | "ptrel0="<<ptrelative0<< // deltaTP/TP - A side | |
337 | "ptrel1="<<ptrelative1<< // deltaTP/TPC - C side | |
338 | "goofie.="<<&vecGoofie<< | |
339 | "goofieE.="<<&vecEntries<< | |
340 | "goofieMean.="<<&vecMean<< | |
341 | "goofieMedian.="<<&vecMedian<< | |
342 | "goofieRMS.="<<&vecRMS<< | |
343 | // | |
344 | "press="<<valuePressure<< | |
345 | "press2="<<valuePressure2<< | |
346 | "temp00.="<<&vecTemp[0]<< | |
347 | "temp10.="<<&vecTemp[1]<< | |
348 | "temp20.="<<&vecTemp[2]<< | |
349 | "temp30.="<<&vecTemp[3]<< | |
350 | "temp40.="<<&vecTemp[4]<< | |
351 | "temp01.="<<&vecTemp[5]<< | |
352 | "temp11.="<<&vecTemp[6]<< | |
353 | "temp21.="<<&vecTemp[7]<< | |
354 | "temp31.="<<&vecTemp[8]<< | |
355 | "temp41.="<<&vecTemp[9]<< | |
356 | "tempSkirtA.="<<&vecSkirtTempA<< | |
357 | "tempSkirtC.="<<&vecSkirtTempC; | |
358 | ||
359 | ProcessDrift(irun, itime); | |
360 | ProcessDriftCE(irun,itime); | |
361 | ProcessDriftAll(irun,itime); | |
362 | ProcessKryptonTime(irun,itime); | |
363 | ProcessCTP(irun,itime); | |
364 | ProcessAlign(irun,itime); | |
365 | ProcessGain(irun,itime); | |
366 | ||
367 | ||
368 | (*fPcstream)<<"dcs"<< | |
369 | //noise data | |
370 | "meanNoise.="<<&vNoiseMean<< | |
371 | "meanNoiseSen.="<<&vNoiseMeanSenRegions<< | |
372 | "rmsNoise.="<<&vNoiseRMS<< | |
373 | "rmsNoiseSen.="<<&vNoiseRMSSenRegions<< | |
374 | "zeroNoise="<<nonMaskedZero<< | |
375 | "nNaN="<<nNaN<< | |
376 | //pulser data | |
377 | "timePulser.=" << &vTimePulser << | |
378 | "nOffPulser="<<nOffChannels<< | |
379 | //altro data | |
380 | "nMasked="<<nMasked<< | |
381 | //ce data -Jens version | |
382 | "CEfitA.="<<&fitResultsA<< | |
383 | "CEfitC.="<<&fitResultsC<< | |
384 | "nmaskedCE="<<nmaskedCE<< | |
385 | "chi2ACE="<<chi2ACE<< | |
386 | "chi2CCE="<<chi2CCE<< | |
387 | //ce data new - MI version | |
388 | "CEfitAMI.="<<&fitCEResultsA<< | |
389 | "CEfitCMI.="<<&fitCEResultsC<< | |
390 | "chi2CEA="<<chi2CEA<< | |
391 | "chi2CEC="<<chi2CEC<< | |
392 | // | |
393 | //ce graph data | |
394 | "CEgrTEntries.="<<&vecTEntries<< | |
395 | "CEgrTMean.="<<&vecTMean<< | |
396 | "CEgrTRMS.="<<&vecTRMS<< | |
397 | "CEgrTMedian.="<<&vecTMedian<< | |
398 | "CEgrQEntries.="<<&vecQEntries<< | |
399 | "CEgrQMean.="<<&vecQMean<< | |
400 | "CEgrQRMS.="<<&vecQRMS<< | |
401 | "CEgrQMedian.="<<&vecQMedian<< | |
402 | "CEgrDriftA="<<driftTimeA<< | |
403 | "CEgrDriftC="<<driftTimeC<< | |
404 | //calib raw data | |
405 | "nFailL1="<<nFailL1<< | |
406 | // b field | |
407 | "Bz="<< bz << | |
408 | "L3polarity="<<l3pol<< | |
409 | // production information | |
410 | "nalien="<<nalien<< | |
411 | "nRawAlien="<<nRawAlien<< | |
412 | "nlocal="<<nlocal<< | |
413 | "nRawLocal="<<nRawLocal<< | |
414 | //comparisons with ref data | |
415 | "pedestalDeviations.="<<&pedestalDeviations<< | |
416 | "noiseDeviations.="<<&noiseDeviations<< | |
417 | "pulserQdeviations.="<<&pulserQdeviations<< | |
418 | // "pulserVarQMean="<<varQMean<< | |
419 | "pulserNpadsOutOneTB="<<npadsOutOneTB<< | |
420 | "pulserNpadsOffAdd="<<npadsOffAdd<< | |
421 | "driftCorrCosmAll="<<dvCorr<< | |
422 | "\n"; | |
423 | }//end run loop | |
424 | } | |
425 | ||
426 | ||
427 | ||
428 | ||
429 | ||
430 | ||
431 | void AliTPCcalibSummary::ProcessDrift(Int_t run, Int_t timeStamp){ | |
432 | // | |
433 | // dump drift calibration data to the tree | |
434 | // | |
435 | TObjArray *array =fCalibDB->GetTimeVdriftSplineRun(run); | |
436 | TGraphErrors *laserA[3]={0,0,0}; | |
437 | TGraphErrors *laserC[3]={0,0,0}; | |
438 | TGraphErrors *cosmicAll=0; | |
439 | static Double_t vlaserA[3]={0,0,0}; | |
440 | static Double_t vlaserC[3]={0,0,0}; | |
441 | static Double_t vcosmicAll=0; | |
442 | static Double_t vdrift1=0; | |
443 | vdrift1=fCalibDB->GetVDriftCorrectionTime(timeStamp,run,0,1); | |
444 | ||
445 | if (array){ | |
446 | laserA[0]=(TGraphErrors*)array->FindObject("GRAPH_MEAN_DELAY_LASER_ALL_A"); | |
447 | laserA[1]=(TGraphErrors*)array->FindObject("GRAPH_MEAN_DRIFT_LASER_ALL_A"); | |
448 | laserA[2]=(TGraphErrors*)array->FindObject("GRAPH_MEAN_GLOBALYGRADIENT_LASER_ALL_A"); | |
449 | laserC[0]=(TGraphErrors*)array->FindObject("GRAPH_MEAN_DELAY_LASER_ALL_C"); | |
450 | laserC[1]=(TGraphErrors*)array->FindObject("GRAPH_MEAN_DRIFT_LASER_ALL_C"); | |
451 | laserC[2]=(TGraphErrors*)array->FindObject("GRAPH_MEAN_GLOBALYGRADIENT_LASER_ALL_C"); | |
452 | cosmicAll =(TGraphErrors*)array->FindObject("TGRAPHERRORS_MEAN_VDRIFT_COSMICS_ALL"); | |
453 | } | |
454 | if (laserA[0]) vlaserA[0]= AliTPCcalibDButil::EvalGraphConst(laserA[0],timeStamp); | |
455 | if (laserA[1]) vlaserA[1]= AliTPCcalibDButil::EvalGraphConst(laserA[1],timeStamp); | |
456 | if (laserA[2]) vlaserA[2]= AliTPCcalibDButil::EvalGraphConst(laserA[2],timeStamp); | |
457 | if (laserC[0]) vlaserC[0]= AliTPCcalibDButil::EvalGraphConst(laserC[0],timeStamp); | |
458 | if (laserC[1]) vlaserC[1]= AliTPCcalibDButil::EvalGraphConst(laserC[1],timeStamp); | |
459 | if (laserC[2]) vlaserC[2]= AliTPCcalibDButil::EvalGraphConst(laserC[2],timeStamp); | |
460 | if (cosmicAll) vcosmicAll= AliTPCcalibDButil::EvalGraphConst(cosmicAll,timeStamp); | |
461 | (*fPcstream)<<"dcs"<< | |
462 | "vlaserA0="<<vlaserA[0]<< | |
463 | "vlaserA1="<<vlaserA[1]<< | |
464 | "vlaserA2="<<vlaserA[2]<< | |
465 | "vlaserC0="<<vlaserC[0]<< | |
466 | "vlaserC1="<<vlaserC[1]<< | |
467 | "vlaserC2="<<vlaserC[2]<< | |
468 | "vcosmicAll="<<vcosmicAll<< | |
469 | "vdrift1="<<vdrift1; | |
470 | ||
471 | // | |
472 | // define distance to measurement | |
473 | // | |
474 | static Double_t dlaserA=0; | |
475 | static Double_t dlaserC=0; | |
476 | static Double_t dcosmic=0; | |
477 | static Double_t slaserA=0; | |
478 | static Double_t slaserC=0; | |
479 | static Double_t scosmic=0; | |
480 | static Double_t vclaserA[3]={0,0,0}; | |
481 | static Double_t vclaserC[3]={0,0,0}; | |
482 | static Double_t vccosmicAll=0; | |
483 | for (Int_t i=0;i<3;i++){ | |
484 | if (laserA[i]) AliTPCcalibDButil::GetNearest(laserA[i],timeStamp,dlaserA,vclaserA[i]); | |
485 | if (laserC[i]) AliTPCcalibDButil::GetNearest(laserC[i],timeStamp,dlaserC,vclaserC[i]); | |
486 | } | |
487 | if (cosmicAll) AliTPCcalibDButil::GetNearest(cosmicAll,timeStamp,dcosmic,vccosmicAll); | |
488 | (*fPcstream)<<"dcs"<< | |
489 | "vclaserA0="<<vclaserA[0]<< | |
490 | "vclaserA1="<<vclaserA[1]<< | |
491 | "vclaserA2="<<vclaserA[2]<< | |
492 | "vclaserC0="<<vclaserC[0]<< | |
493 | "vclaserC1="<<vclaserC[1]<< | |
494 | "vclaserC2="<<vclaserC[2]<< | |
495 | "vccosmicAll="<<vccosmicAll<< | |
496 | "dlaserA="<<dlaserA<< | |
497 | "dlaserC="<<dlaserC<< | |
498 | "dcosmic="<<dcosmic<< | |
499 | "slaserA="<<slaserA<< | |
500 | "slaserC="<<slaserC<< | |
501 | "scosmic="<<scosmic; | |
502 | } | |
503 | ||
504 | void AliTPCcalibSummary::ProcessDriftCE(Int_t run,Int_t timeStamp){ | |
505 | // | |
506 | // dump drift calibration data CE | |
507 | // | |
508 | TObjArray *arrT=fCalibDB->GetCErocTtime(); | |
509 | AliTPCParam *param=fCalibDB->GetParameters(); | |
510 | static TVectorD tdriftCE(74); | |
511 | static TVectorD tndriftCE(74); | |
512 | static TVectorD vdriftCE(74); | |
513 | static TVectorD tcdriftCE(74); | |
514 | static TVectorD tddriftCE(74); | |
515 | static Double_t ltime0A; | |
516 | static Double_t ltime0C; | |
517 | // | |
518 | // | |
519 | // | |
520 | ltime0A = fDButil->GetLaserTime0(run,timeStamp,36000,0); | |
521 | ltime0C = fDButil->GetLaserTime0(run,timeStamp,36000,1); | |
522 | // | |
523 | for (Int_t i=0; i<arrT->GetEntries();i++){ | |
524 | tdriftCE[i]=0; | |
525 | vdriftCE[i]=0; | |
526 | TGraph *graph = (TGraph*)arrT->At(i); | |
527 | if (!graph) continue; | |
528 | tdriftCE[i]=AliTPCcalibDButil::EvalGraphConst(graph,timeStamp); | |
529 | Double_t deltaT,gry; | |
530 | AliTPCcalibDButil::GetNearest(graph,timeStamp,deltaT,gry); | |
531 | tndriftCE[i]=graph->GetN(); | |
532 | tcdriftCE[i]=gry; | |
533 | tddriftCE[i]=deltaT; | |
534 | if (i%36<18){ | |
535 | vdriftCE[i] =(param->GetZLength(i)/(tdriftCE[i]*param->GetTSample()*(1.-ltime0A)-param->GetL1Delay()))/param->GetDriftV(); | |
536 | }else{ | |
537 | vdriftCE[i] =(param->GetZLength(i)/(tdriftCE[i]*param->GetTSample()*(1.-ltime0A)-param->GetL1Delay()))/param->GetDriftV(); | |
538 | } | |
539 | } | |
540 | // export values | |
541 | (*fPcstream)<<"dcs"<< | |
542 | "tdriftCE.="<<&tdriftCE<< // arrival time | |
543 | "vdriftCE.="<<&vdriftCE<< // derived drift velocity per chamber | |
544 | "tndriftCE.="<<&tndriftCE<< // number of points (chambers) | |
545 | "tcdriftCE.="<<&tcdriftCE<< // constant evaluation - nearest point used | |
546 | "tddriftCE.="<<&tddriftCE<< // distance to closest measuement | |
547 | "ltime0A="<<ltime0A<< // laser offset expected in reconstruction | |
548 | "ltime0C="<<ltime0C; // laser offset expected in reconstruction | |
549 | } | |
550 | ||
551 | ||
552 | void AliTPCcalibSummary::ProcessDriftAll(Int_t run,Int_t timeStamp){ | |
553 | // | |
554 | // dump drift calibration data all calibrations form DB util | |
555 | // test of utils | |
556 | static Double_t vdriftCEA=0, vdriftCEC=0, vdriftCEM=0; | |
557 | static Double_t vdriftLTA=0, vdriftLTC=0, vdriftLTM=0; | |
558 | static Double_t vdriftITS=0; | |
559 | static Double_t vdriftP=0; | |
560 | static Double_t dcea=0, dcec=0, dcem=0, dla=0,dlc=0,dlm=0,dp=0; | |
561 | static Double_t dits=0; | |
562 | static Double_t ltime0A; | |
563 | static Double_t ltime0C; | |
564 | static Double_t ctime0; | |
565 | static Double_t vdrift1=0; | |
566 | vdrift1= fCalibDB->GetVDriftCorrectionTime(timeStamp,run,0,1); | |
567 | vdriftP = fDButil->GetVDriftTPC(dp, run, timeStamp, 86400, 3600,0); | |
568 | ctime0 = AliTPCcalibDButil::GetTriggerOffsetTPC(run,timeStamp, 36000, 3600,0); | |
569 | // | |
570 | vdriftCEA= fDButil->GetVDriftTPCCE(dcea,run,timeStamp,36000,0); | |
571 | vdriftCEC= fDButil->GetVDriftTPCCE(dcec,run,timeStamp,36000,1); | |
572 | vdriftCEM= fDButil->GetVDriftTPCCE(dcem,run,timeStamp,36000,2); | |
573 | // | |
574 | vdriftLTA= fDButil->GetVDriftTPCLaserTracks(dla,run,timeStamp,36000,0); | |
575 | vdriftLTC= fDButil->GetVDriftTPCLaserTracks(dlc,run,timeStamp,36000,1); | |
576 | vdriftLTM= fDButil->GetVDriftTPCLaserTracks(dlm,run,timeStamp,36000,2); | |
577 | // | |
578 | vdriftITS= fDButil->GetVDriftTPCITS(dits, run,timeStamp); | |
579 | // | |
580 | ltime0A = fDButil->GetLaserTime0(run,timeStamp,36000,0); | |
581 | ltime0C = fDButil->GetLaserTime0(run,timeStamp,36000,1); | |
582 | ||
583 | (*fPcstream)<<"dcs"<< | |
584 | // | |
585 | "vdriftCEA="<<vdriftCEA<< // drift velocity CE | |
586 | "vdriftCEC="<<vdriftCEC<< | |
587 | "vdriftCEM="<<vdriftCEM<< | |
588 | "dcea="<<dcea<< | |
589 | "dcec="<<dcec<< | |
590 | "dcem="<<dcem<< | |
591 | "vdriftLTA="<<vdriftLTA<< // drift velocity laser tracks | |
592 | "vdriftLTC="<<vdriftLTC<< | |
593 | "vdriftLTM="<<vdriftLTM<< | |
594 | "dla="<<dla<< | |
595 | "dlc="<<dlc<< | |
596 | "dlm="<<dlm<< | |
597 | // | |
598 | // | |
599 | "vdriftITS="<<vdriftITS<< | |
600 | "dits="<<dits<< | |
601 | "ctime0="<<ctime0<< | |
602 | "vdriftP="<<vdriftP<< // drift velocity comsic | |
603 | "dp="<<dp<< | |
604 | "vdrift1="<<vdrift1; // combined drift velocity | |
605 | ||
606 | } | |
607 | ||
608 | ||
609 | ||
610 | void AliTPCcalibSummary::ProcessKryptonTime(Int_t run, Int_t timeStamp){ | |
611 | // | |
612 | // Dumping krypton calibration results | |
613 | // | |
614 | static TObjArray * krArray=0; | |
615 | if (!krArray) { | |
616 | AliCDBEntry* entry = AliCDBManager::Instance()->Get("TPC/Calib/TimeGainKrypton", run); | |
617 | if (entry){ | |
618 | krArray = (TObjArray*)entry->GetObject(); | |
619 | } | |
620 | } | |
621 | static TVectorD krMean(74); | |
622 | static TVectorD krErr(74); | |
623 | static TVectorD krDist(74); | |
624 | TGraphErrors *gr=0; | |
625 | Double_t deltaT=0,gry=0; | |
626 | if (krArray){ | |
627 | for (Int_t isec=0; isec<72; isec++){ | |
628 | krMean[isec]=0; | |
629 | krDist[isec]=0; | |
630 | krErr[isec]=0; | |
631 | gr=(TGraphErrors*)krArray->At(isec); | |
632 | if (gr) { | |
633 | krMean[isec]=gr->Eval(timeStamp); | |
634 | AliTPCcalibDButil::GetNearest(gr, timeStamp,deltaT,gry); | |
635 | krDist[isec]=deltaT; | |
636 | } | |
637 | if (72+isec<krArray->GetEntries()) { | |
638 | gr=(TGraphErrors*)krArray->At(72+isec); | |
639 | if (gr) krErr[isec]=gr->Eval(timeStamp); | |
640 | } | |
641 | } | |
642 | krMean[72]= TMath::Median(36,krMean.GetMatrixArray()); | |
643 | krMean[73]= TMath::Median(36,&(krMean.GetMatrixArray()[36])); | |
644 | krErr[72]= TMath::Median(36,krErr.GetMatrixArray()); | |
645 | krErr[73]= TMath::Median(36,&(krErr.GetMatrixArray()[36])); | |
646 | } | |
647 | (*fPcstream)<<"dcs"<< | |
648 | "krMean.="<<&krMean<< | |
649 | "krErr.="<<&krErr<< | |
650 | "krDist.="<<&krDist; | |
651 | } | |
652 | ||
653 | void AliTPCcalibSummary::ProcessCTP(Int_t irun, Int_t timeStamp){ | |
654 | // | |
655 | // | |
656 | // | |
657 | static TClonesArray *pcarray = new TClonesArray("AliCTPInputTimeParams",1); | |
658 | static AliCTPTimeParams *ctpParams =0; | |
659 | ctpParams = fCalibDB->GetCTPTimeParams(); // | |
660 | const TObjArray *arr = ctpParams->GetInputTimeParams(); | |
661 | pcarray->ExpandCreateFast(TMath::Max(arr->GetEntries(),1)); | |
662 | for (Int_t i=0; i<arr->GetEntries(); i++){ | |
663 | new ((*pcarray)[i]) AliCTPInputTimeParams(*((AliCTPInputTimeParams*)arr->At(i))); | |
664 | } | |
665 | (*fPcstream)<<"ctp"<< | |
666 | "run="<<irun<< | |
667 | "time="<<timeStamp<< | |
668 | "ctpP.="<<ctpParams<< | |
669 | "ctpArr="<<pcarray<< | |
670 | "\n"; | |
671 | (*fPcstream)<<"dcs"<< | |
672 | "ctpP.="<<ctpParams<< | |
673 | "ctpArr="<<pcarray; | |
674 | } | |
675 | ||
676 | void AliTPCcalibSummary::ProcessGain(Int_t irun, Int_t timeStamp){ | |
677 | // | |
678 | // Dump gain related information to the tree | |
679 | // | |
680 | static Float_t gainCosmic = 0; | |
681 | static Float_t gainMIP = 0; | |
682 | TObjArray * gainSplines = fCalibDB->GetTimeGainSplinesRun(irun); | |
683 | if (gainSplines) { | |
684 | TGraphErrors * graphMIP = (TGraphErrors *) gainSplines->FindObject("TGRAPHERRORS_MEAN_GAIN_BEAM_ALL"); | |
685 | TGraphErrors * graphCosmic = (TGraphErrors *) gainSplines->FindObject("TGRAPHERRORS_MEAN_GAIN_COSMIC_ALL"); | |
686 | if (graphMIP) gainMIP = AliTPCcalibDButil::EvalGraphConst(graphMIP,timeStamp); | |
687 | if (graphCosmic) gainCosmic = AliTPCcalibDButil::EvalGraphConst(graphCosmic,timeStamp); | |
688 | } | |
689 | // time dependence of gain | |
690 | (*fPcstream)<<"dcs"<< | |
691 | "gainMIP="<<gainMIP<< | |
692 | "gainCosmic="<<gainCosmic; | |
693 | } | |
694 | ||
695 | ||
696 | void AliTPCcalibSummary::ProcessAlign(Int_t run, Int_t timeStamp){ | |
697 | // | |
698 | // Proccess alignment | |
699 | // | |
700 | TString grnames[12]={"ALIGN_ITS", "ALIGN_ITSP", "ALIGN_ITSM", "ALIGN_ITSB", | |
701 | "ALIGN_TRD", "ALIGN_TRDP", "ALIGN_TRDM","ALIGN_TRDB", | |
702 | "ALIGN_TOF", "ALIGN_TOFP", "ALIGN_TOFM","ALIGN_TOFB"}; | |
703 | TString grpar[9]={"DELTAPSI", "DELTATHETA", "DELTAPHI", | |
704 | "DELTAX", "DELTAY", "DELTAZ", | |
705 | "DRIFTVD", "T0", "VDGY"}; | |
706 | static Double_t values[12*9]; | |
707 | static Double_t errs[12*9]; | |
708 | ||
709 | TObjArray *array =fCalibDB->GetTimeVdriftSplineRun(run); | |
710 | TGraphErrors *gr=0; | |
711 | for (Int_t idet=0; idet<12; idet++){ | |
712 | for (Int_t ipar=0; ipar<9; ipar++){ | |
713 | TString grName=grnames[idet]; | |
714 | grName+="_TPC_"; | |
715 | grName+=grpar[ipar]; | |
716 | if (array){ | |
717 | gr = (TGraphErrors*)array->FindObject(grName.Data()); | |
718 | } | |
719 | values[9*idet+ipar]=0; | |
720 | errs[9*idet+ipar]=0; | |
721 | if (gr) values[9*idet+ipar]=gr->Eval(timeStamp); | |
722 | (*fPcstream)<<"dcs"<< | |
723 | Form("%s=",grName.Data())<<values[9*idet+ipar]; | |
724 | (*fPcstream)<<"align"<< | |
725 | Form("%s=",grName.Data())<<values[9*idet+ipar]; | |
726 | } | |
727 | } | |
728 | (*fPcstream)<<"align"<< | |
729 | "time="<<timeStamp<< | |
730 | "run="<<run<< | |
731 | "\n"; | |
732 | } | |
733 | ||
734 | ||
735 |