Line data Source code
1 : /*
2 : // Make a summary information of calibration.
3 : // Store results in the summary trees
4 : // OCDB configuration
5 :
6 : Example usage:
7 :
8 : gSystem->Load("libANALYSIS");
9 : gSystem->Load("libTPCcalib");
10 :
11 : Int_t irun=119037;
12 : gROOT->LoadMacro("$ALICE_ROOT/TPC/scripts/OCDBscan/ConfigOCDB.C");
13 : ConfigOCDB(irun)
14 :
15 : AliTPCcalibSummary *calibSummary = new AliTPCcalibSummary;
16 : calibSummary->ProcessRun(irun);
17 : delete calibSummary;
18 :
19 : */
20 :
21 : #include <TROOT.h>
22 : #include <iostream>
23 : #include <fstream>
24 : #include <stdio.h>
25 : #include <AliCDBManager.h>
26 : #include <AliCDBEntry.h>
27 : #include <AliLog.h>
28 : #include <AliMagF.h>
29 : #include "AliTPCcalibDB.h"
30 : #include "AliTPCcalibDButil.h"
31 : #include "AliTPCAltroMapping.h"
32 : #include "AliTPCExB.h"
33 : #include "AliTPCCalROC.h"
34 : #include "AliTPCCalPad.h"
35 : #include "AliTPCSensorTempArray.h"
36 : #include "AliGRPObject.h"
37 : #include "AliTPCTransform.h"
38 : #include "TFile.h"
39 : #include "TKey.h"
40 : #include "TObjArray.h"
41 : #include "TObjString.h"
42 : #include "TString.h"
43 : #include "AliTPCCalPad.h"
44 : #include "AliTPCROC.h"
45 : #include "AliTPCParam.h"
46 : #include "AliTPCCalibPulser.h"
47 : #include "AliTPCCalibPedestal.h"
48 : #include "AliTPCCalibCE.h"
49 : #include "AliTPCExBFirst.h"
50 : #include "TTreeStream.h"
51 : #include "AliTPCTempMap.h"
52 : #include "TVectorD.h"
53 : #include "TMatrixD.h"
54 : #include "AliTPCCalibRaw.h"
55 : #include "AliSplineFit.h"
56 : #include "TGraphErrors.h"
57 : #include <AliCTPTimeParams.h>
58 : #include <AliTPCcalibSummary.h>
59 : #include <TStatToolkit.h>
60 : #include <TCut.h>
61 : #include "AliTPCCalibGlobalMisalignment.h"
62 : #include "AliTPCExBTwist.h"
63 : #include "AliTPCComposedCorrection.h"
64 : #include "AliLHCData.h"
65 :
66 : //
67 : //
68 : //
69 : AliTPCcalibSummary::AliTPCcalibSummary():
70 0 : TNamed(),
71 0 : fCalibDB(0),
72 0 : fDButil(0),
73 0 : fPcstream(0)
74 0 : {
75 : //
76 : // default constructor
77 : // OCDB have to be setupe before - not part of class
78 : // usualy ConfigOCDB.C macro used
79 : //
80 0 : fPcstream = new TTreeSRedirector("dcsTime.root");
81 0 : fCalibDB = AliTPCcalibDB::Instance();
82 0 : fDButil= new AliTPCcalibDButil;
83 0 : }
84 :
85 0 : AliTPCcalibSummary::~AliTPCcalibSummary(){
86 : //
87 : // destructor - close streamer
88 : //
89 0 : delete fPcstream;
90 0 : }
91 :
92 : void AliTPCcalibSummary::Process(const char * runList, Int_t first, Int_t last){
93 : //
94 : // runList - listOfRuns to process
95 : // first - first run to process
96 : // last - last to process
97 : //
98 : //
99 : // make list of runs
100 : //
101 :
102 0 : ifstream inputFile;
103 0 : inputFile.open("run.list");
104 0 : Int_t irun=0;
105 0 : TArrayI runArray(100000);
106 0 : Int_t indexes[100000];
107 : Int_t nruns=0;
108 0 : printf("Runs to process:\n");
109 0 : if (!inputFile.is_open()) {
110 0 : printf("Problem to open file %s\n",runList);
111 : }
112 0 : while( inputFile.good() ) {
113 0 : inputFile >> irun;
114 0 : printf("Run \t%d\n",irun);
115 0 : if (irun<first) continue; // process only subset of list
116 0 : if (last>0 && irun>last) continue; // process only subset of list
117 0 : runArray[nruns]=irun;
118 0 : nruns++;
119 : }
120 :
121 :
122 0 : TMath::Sort(nruns, runArray.fArray, indexes,kFALSE);
123 : Int_t startTime = 0;
124 : Int_t endTime = 0;
125 0 : for (Int_t run=0; run<nruns; run++){
126 0 : irun=runArray[indexes[run]];
127 0 : printf("Processing run %d ...\n",irun);
128 0 : fCalibDB->SetRun(irun);
129 0 : fDButil->UpdateFromCalibDB();
130 0 : fDButil->SetReferenceRun(irun);
131 0 : fDButil->UpdateRefDataFromOCDB();
132 0 : fCalibDB->CreateGUITree("calPads.root");
133 0 : fDButil->CreateGUIRefTree("calPadsRef.root");
134 : //
135 0 : AliDCSSensorArray *arrHV=fCalibDB->GetVoltageSensors(irun);
136 0 : if (!arrHV) continue;
137 0 : for (Int_t isenHV=0; isenHV<arrHV->NumSensors(); ++isenHV){
138 0 : AliDCSSensor *senHV=arrHV->GetSensorNum(isenHV);
139 0 : if (!senHV) {
140 0 : printf("Not interesting OCDB info\n");
141 0 : continue;
142 : }
143 0 : startTime=senHV->GetStartTime();
144 0 : endTime =senHV->GetEndTime();
145 0 : if (startTime>0&&endTime>0) break;
146 0 : }
147 0 : AliDCSSensorArray* goofieArray = fCalibDB->GetGoofieSensors(irun);
148 0 : if (goofieArray) fDButil->FilterGoofie(goofieArray,0.5,4.,4,10,fPcstream);
149 : // don't filter goofie for the moment
150 0 : ProcessRun(irun, startTime,endTime);
151 0 : }
152 0 : }
153 :
154 :
155 : void AliTPCcalibSummary::ProcessRun(Int_t irun, Int_t startTime, Int_t endTime){
156 : //
157 : // Process run irun
158 : //
159 0 : fCalibDB->SetRun(irun);
160 0 : fDButil->UpdateFromCalibDB();
161 0 : fDButil->SetReferenceRun(irun);
162 0 : fDButil->UpdateRefDataFromOCDB();
163 0 : fCalibDB->CreateGUITree("calPads.root");
164 0 : fDButil->CreateGUIRefTree("calPadsRef.root");
165 :
166 : //
167 : AliSplineFit *fitVdrift=0x0;
168 0 : Int_t startTimeGRP=0, stopTimeGRP=0;
169 0 : if (fCalibDB->GetGRP(irun)){
170 0 : startTimeGRP = AliTPCcalibDB::GetGRP(irun)->GetTimeStart();
171 0 : stopTimeGRP = AliTPCcalibDB::GetGRP(irun)->GetTimeEnd();
172 0 : }
173 0 : if (startTime==0){
174 0 : startTime=startTimeGRP;
175 0 : endTime=stopTimeGRP;
176 0 : }
177 0 : AliTPCSensorTempArray * tempArray = fCalibDB->GetTemperatureSensor(irun);
178 0 : AliTPCTempMap * tempMap = new AliTPCTempMap(tempArray);
179 0 : AliDCSSensorArray* goofieArray = fCalibDB->GetGoofieSensors(irun);
180 : //
181 0 : Int_t dtime = TMath::Max((endTime-startTime)/20,10);
182 : //
183 : //Goofie statistical data
184 : //
185 0 : TVectorD vecEntries, vecMean, vecMedian,vecRMS;
186 0 : fDButil->ProcessGoofie(vecEntries ,vecMedian, vecMean, vecRMS);
187 : //
188 : //CE data processing - see ProcessCEdata function for description of the results
189 : //
190 0 : TVectorD fitResultsA, fitResultsC;
191 0 : Int_t nmaskedCE;
192 0 : Double_t chi2ACE=0,chi2CCE=0;
193 : // fDButil->ProcessCEdata("(sector<36)++gx++gy++lx++lx**2",fitResultsA,fitResultsC,nmaskedCE);
194 0 : fDButil->ProcessCEdata("(sector<36)++gx++gy++(lx-134)++(sector<36)*(lx-134)++(ly/lx)^2",fitResultsA,fitResultsC,nmaskedCE,chi2ACE,chi2CCE);
195 :
196 0 : TVectorD fitCEResultsA(7), fitCEResultsC(7);
197 0 : Int_t noutCE;
198 0 : Double_t chi2CEA=0,chi2CEC=0;
199 0 : AliTPCCalPad *time0 = fDButil->CreatePadTime0CE(fitCEResultsA, fitCEResultsC, noutCE, chi2CEA, chi2CEC);
200 0 : delete time0;
201 : //
202 : //
203 0 : TVectorD vecTEntries, vecTMean, vecTRMS, vecTMedian, vecQEntries, vecQMean, vecQRMS, vecQMedian;
204 0 : Float_t driftTimeA, driftTimeC;
205 0 : fDButil->ProcessCEgraphs(vecTEntries, vecTMean, vecTRMS, vecTMedian,
206 : vecQEntries, vecQMean, vecQRMS, vecQMedian,
207 : driftTimeA, driftTimeC );
208 : //
209 : //
210 : //
211 : //drift velocity using tracks
212 : //
213 : // fitVdrift=fCalibDB->GetVdriftSplineFit("ALISPLINEFIT_MEAN_VDRIFT_COSMICS_ALL",irun);
214 0 : fitVdrift=fCalibDB->CreateVdriftSplineFit("TGRAPHERRORS_MEAN_VDRIFT_COSMICS_ALL",irun);
215 : //noise data Processing - see ProcessNoiseData function for description of the results
216 0 : TVectorD vNoiseMean, vNoiseMeanSenRegions, vNoiseRMS, vNoiseRMSSenRegions;
217 0 : Int_t nonMaskedZero=0, nNaN=0;
218 0 : fDButil->ProcessNoiseData(vNoiseMean, vNoiseMeanSenRegions, vNoiseRMS, vNoiseRMSSenRegions, nonMaskedZero, nNaN);
219 : //
220 : // comparisons
221 : //
222 0 : TVectorF pedestalDeviations;
223 0 : TVectorF noiseDeviations;
224 0 : TVectorF pulserQdeviations;
225 0 : Float_t varQMean;
226 0 : Int_t npadsOutOneTB;
227 0 : Int_t npadsOffAdd;
228 0 : fDButil->ProcessPedestalVariations(pedestalDeviations);
229 0 : fDButil->ProcessNoiseVariations(noiseDeviations);
230 0 : fDButil->ProcessPulserVariations(pulserQdeviations,varQMean,npadsOutOneTB,npadsOffAdd);
231 : //
232 : //L3 data
233 : //
234 0 : Float_t bz=AliTPCcalibDB::GetBz(irun);
235 0 : Char_t l3pol=AliTPCcalibDB::GetL3Polarity(irun);
236 : //
237 : //QA data processing
238 : //
239 0 : TVectorD vQaOcc;
240 0 : TVectorD vQaQtot;
241 0 : TVectorD vQaQmax;
242 0 : fDButil->ProcessQAData(vQaOcc, vQaQtot, vQaQmax);
243 : //
244 : //calibration Pulser data processing
245 : //
246 0 : Int_t nOffChannels=0;
247 0 : TVectorD vTimePulser;
248 0 : nOffChannels=fDButil->GetNPulserOutliers();
249 0 : fDButil->ProcessPulser(vTimePulser);
250 : //
251 : //ALTRO data
252 : //
253 0 : Int_t nMasked=0;
254 0 : fDButil->ProcessALTROConfig(nMasked);
255 : //
256 : //Calib RAW data
257 : //
258 0 : Int_t nFailL1=-1;
259 0 : if (fCalibDB->GetCalibRaw()) nFailL1=fCalibDB->GetCalibRaw()->GetNFailL1Phase();
260 : //
261 : //production information
262 : //
263 0 : Int_t nalien=0,nRawAlien=0,nlocal=0,nRawLocal=0;
264 : //run type
265 0 : TObjString runType(AliTPCcalibDB::GetRunType(irun).Data());
266 : // ===| LHC data |===========================================================
267 : //
268 : //
269 0 : TVectorF vecMeanLHCBckgAlice(AliLHCData::kNBGs);
270 0 : GetAverageLHCData(vecMeanLHCBckgAlice);
271 : //
272 : //
273 : //
274 :
275 0 : for (Int_t itime=startTime; itime<endTime; itime+=dtime){
276 : //
277 0 : TTimeStamp tstamp(itime);
278 0 : Float_t valuePressure = fCalibDB->GetPressure(tstamp,irun,0);
279 0 : Float_t valuePressure2 = fCalibDB->GetPressure(tstamp,irun,1);
280 0 : Double_t ptrelative0 = AliTPCcalibDB::GetPTRelative((UInt_t)itime,irun,0);
281 0 : Double_t ptrelative1 = AliTPCcalibDB::GetPTRelative((UInt_t)itime,irun,1);
282 : //temperature fits
283 : TLinearFitter * fitter = 0;
284 0 : TVectorD vecTemp[10];
285 0 : for (Int_t itype=0; itype<5; itype++)
286 0 : for (Int_t iside=0; iside<2; iside++){
287 0 : fitter= tempMap->GetLinearFitter(itype,iside,tstamp);
288 0 : if (!fitter) continue;
289 0 : fitter->Eval();
290 0 : fitter->GetParameters(vecTemp[itype+iside*5]);
291 0 : delete fitter;
292 : }
293 : //
294 : //measured skirt temperatures
295 : //
296 0 : TVectorD vecSkirtTempA(18);
297 0 : TVectorD vecSkirtTempC(18);
298 0 : Int_t nsenTemp=tempArray->NumSensors();
299 0 : for (Int_t isenTemp=0;isenTemp<nsenTemp;++isenTemp){
300 0 : AliTPCSensorTemp *senTemp=(AliTPCSensorTemp*)tempArray->GetSensorNum(isenTemp);
301 0 : if (senTemp->GetType()!=3) continue;
302 0 : if (TMath::Sqrt(senTemp->GetX()*senTemp->GetX()+senTemp->GetY()*senTemp->GetY())<100) continue; //only skirt, outer FC vessel
303 0 : Double_t val=senTemp->GetValue(tstamp);
304 0 : if (senTemp->GetSide()==0)
305 0 : vecSkirtTempA[senTemp->GetSector()]=val;
306 : else
307 0 : vecSkirtTempC[senTemp->GetSector()]=val;
308 0 : }
309 : //
310 : //goofie data
311 : //
312 0 : TVectorD vecGoofie;
313 0 : if (goofieArray){
314 0 : vecGoofie.ResizeTo(goofieArray->NumSensors());
315 0 : for (Int_t isensor=0; isensor<goofieArray->NumSensors();isensor++){
316 0 : AliDCSSensor *gsensor = goofieArray->GetSensor(isensor);
317 0 : if (gsensor){
318 0 : vecGoofie[isensor] = gsensor->GetValue(tstamp);
319 0 : }
320 : }
321 0 : } else {
322 0 : vecGoofie.ResizeTo(19);
323 : }
324 : //
325 0 : static TVectorF voltagesIROC(36);
326 0 : static TVectorF voltagesIROCMedian(36);
327 0 : static TVectorF voltagesIROCNominal(36);
328 0 : static TVectorF voltagesIROCCurrentNominal(36);
329 0 : static TVectorF voltagesIROCStatus(36);
330 0 : static TVectorF voltagesIROCGoodFraction(36);
331 0 : static TVectorF gainCorrIROCHVandPT(36);
332 : //
333 0 : static TVectorF voltagesOROC(36);
334 0 : static TVectorF voltagesOROCMedian(36);
335 0 : static TVectorF voltagesOROCNominal(36);
336 0 : static TVectorF voltagesOROCCurrentNominal(36);
337 0 : static TVectorF voltagesOROCStatus(36);
338 0 : static TVectorF voltagesOROCGoodFraction(36);
339 0 : static TVectorF gainCorrOROCHVandPT(36);
340 :
341 0 : for(Int_t j=0; j<36; j++){
342 0 : voltagesIROC[j] = fCalibDB->GetChamberHighVoltage(irun, j,itime);
343 0 : voltagesIROCMedian[j] = fCalibDB->GetChamberHighVoltageMedian(j);
344 0 : voltagesIROCNominal[j] = fCalibDB->GetParameters()->GetNominalVoltage(j);
345 0 : voltagesIROCCurrentNominal[j] = fCalibDB->GetChamberCurrentNominalHighVoltage(j);
346 0 : voltagesIROCStatus[j] = fCalibDB->GetChamberHVStatus(j);
347 0 : voltagesIROCGoodFraction[j] = fCalibDB->GetChamberGoodHighVoltageFraction(j);
348 0 : gainCorrIROCHVandPT[j] = fCalibDB->GetGainCorrectionHVandPT(itime, irun, j, 5, 1);
349 : }
350 :
351 0 : for(Int_t j=36; j<72; j++) {
352 0 : voltagesOROC[j-36] = fCalibDB->GetChamberHighVoltage(irun, j,itime);
353 0 : voltagesOROCMedian[j-36] = fCalibDB->GetChamberHighVoltageMedian(j);
354 0 : voltagesOROCNominal[j-36] = fCalibDB->GetParameters()->GetNominalVoltage(j);
355 0 : voltagesOROCCurrentNominal[j-36] = fCalibDB->GetChamberCurrentNominalHighVoltage(j);
356 0 : voltagesOROCStatus[j-36] = fCalibDB->GetChamberHVStatus(j);
357 0 : voltagesOROCGoodFraction[j-36] = fCalibDB->GetChamberGoodHighVoltageFraction(j);
358 0 : gainCorrOROCHVandPT[j-36] = fCalibDB->GetGainCorrectionHVandPT(itime, irun, j, 5, 1);
359 : }
360 :
361 0 : Double_t voltIROC = TMath::Median(36, voltagesIROC.GetMatrixArray());
362 0 : Double_t voltOROC = TMath::Median(36, voltagesOROC.GetMatrixArray());
363 : //
364 0 : Float_t coverIA=AliTPCcalibDB::GetCoverVoltage(irun,0,itime);
365 0 : Float_t coverIC=AliTPCcalibDB::GetCoverVoltage(irun,18,itime);
366 0 : Float_t coverOA=AliTPCcalibDB::GetCoverVoltage(irun,36,itime);
367 0 : Float_t coverOC=AliTPCcalibDB::GetCoverVoltage(irun,54,itime);
368 0 : Float_t skirtA=AliTPCcalibDB::GetSkirtVoltage(irun,0,itime);
369 0 : Float_t skirtC=AliTPCcalibDB::GetSkirtVoltage(irun,18,itime);
370 0 : Float_t ggOffA=AliTPCcalibDB::GetGGoffsetVoltage(irun,0,itime);
371 0 : Float_t ggOffC=AliTPCcalibDB::GetGGoffsetVoltage(irun,18,itime);
372 : //drift velocity
373 0 : Float_t dvCorr=-5;
374 0 : if (fitVdrift) dvCorr=fitVdrift->Eval(itime);
375 : //data taking active
376 0 : Bool_t dataTakingActive=fCalibDB->IsDataTakingActive((time_t)itime);
377 :
378 : //tempMap->GetLinearFitter(0,0,itime);
379 : // parameter description is as follows: // <name>;<unit>;<group>;<array type/array info>
380 : // <name> should also include the unit; e.g. IROC anode voltage (V))
381 : // where group is e.g.
382 : // o HV: for High Voltage information
383 : // o Environment: for environmental information (temperature; pressure)
384 : // o Pulser: Calibartion pulser information
385 : // o CE: Central electrode inforamtion
386 : // o Noise Pedestals: Noise and Pedestal information
387 : // o ALTRO: ALTRO configuration information
388 : //
389 : // <array type> describes the information stored in the elements of a TVectorT<> variable
390 : // this can e.g. be
391 : // o Sector: The array has 36 entries; one per sector (A00-A17 and C00 to C17)
392 : // o Sector-A: The array has 18 entries; one per sector on the A-Side (A00-A17)
393 : // o Sector-C: The array has 18 entries; one per sector on the C-Side (C00-C17)
394 : // o ROC: The array has 72 entries; one per ROC (IA00-IA17, IC00-IC17, OA00-OA17, OC00-OC17)
395 : // o Parameters from a fit: in this case the description per parameter should be given
396 0 : (*fPcstream)<<"dcs"<<
397 0 : "run="<<irun<< // Run number
398 0 : "time="<<itime<< // Time stamp of calibration entry
399 0 : "startTimeGRP="<<startTimeGRP<< // Start time of run from GRP
400 0 : "stopTimeGRP="<<stopTimeGRP<< // Stop time of run from GRP
401 0 : "dataTakingActive="<<dataTakingActive<< // If data taking is active
402 : //run type
403 0 : "runType.="<<&runType<< // Run Type; e.g. PHYSICS; LASER; COSMIC; PEDESTAL; PULSER
404 : // voltage setting
405 0 : "VIROC.=" << &voltagesIROC << // IROC anode voltage [calib interval] (V);HV;Sector
406 0 : "VIROCMedian.=" << &voltagesIROCMedian << // IROC anode voltage [Median of run] (V);HV;Sector
407 0 : "VIROCNominal.=" << &voltagesIROCNominal << // IROC anode voltage [global nominal] (V);HV;Sector
408 0 : "VIROCCurrentNominal.=" << &voltagesIROCCurrentNominal << // IROC anode voltage [current nominal] (V);HV;Sector
409 0 : "VIROCGoodHVFraction.=" << &voltagesIROCGoodFraction << // IROC anode voltage [fraction of good settings];-;HV;Sector
410 0 : "VIROCStatus.=" << &voltagesIROCStatus << // IROC HV status;-;HV;Sector
411 0 : "gainCorrIROCHVandPT.=" << &gainCorrIROCHVandPT << // IROC gain correction factor using HV, P and T
412 : //
413 0 : "VOROC.=" << &voltagesOROC << // OROC anode voltage [calib interval] (V);HV;Sector
414 0 : "VOROCMedian.=" << &voltagesOROCMedian << // OROC anode voltage [Median of run] (V);HV;Sector
415 0 : "VOROCNominal.=" << &voltagesOROCNominal << // OROC anode voltage [global nominal] (V);HV;Sector
416 0 : "VOROCCurrentNominal.=" << &voltagesOROCCurrentNominal << // OROC anode voltage [current nominal] (V);HV;Sector
417 0 : "VOROCGoodHVFraction.=" << &voltagesOROCGoodFraction << // OROC anode voltage [fraction of good settings];-;HV;Sector
418 0 : "VOROCStatus.=" << &voltagesOROCStatus << // OROC HV status;-;HV;Sector
419 0 : "gainCorrOROCHVandPT.=" << &gainCorrOROCHVandPT << // OROC gain correction factor using HV, P and T
420 : //
421 0 : "medianVIROC=" << voltIROC << // IROC anode voltage [median of all IROCs] (V);HV
422 0 : "medianVOROC=" << voltOROC << // OROC anode voltage [median of all OROCs] (V);HV
423 0 : "coverIA=" << coverIA << // Cover voltage IROC A-Side (V);HV
424 0 : "coverIC=" << coverIC << // Cover voltage IROC C-Side (V);HV
425 0 : "coverOA=" << coverOA << // Cover voltage OROC A-Side (V);HV
426 0 : "coverOC=" << coverOC << // Cover voltage OROC C-Side (V);HV
427 0 : "skirtA=" << skirtA << // Skirt voltage IROC A-Side (V);HV
428 0 : "skirtC=" << skirtC << // Skirt voltage IROC C-Side (V);HV
429 0 : "ggOffA=" << ggOffA << // Gating grid offset voltage A-Side (V);HV
430 0 : "ggOffC=" << ggOffC << // Gating grid offset voltage C-Side (V);HV
431 : //
432 0 : "ptrel0="<<ptrelative0<< // deltaTP/TP - A side
433 0 : "ptrel1="<<ptrelative1<< // deltaTP/TPC - C side
434 0 : "goofie.="<<&vecGoofie<<
435 0 : "goofieE.="<<&vecEntries<<
436 0 : "goofieMean.="<<&vecMean<<
437 0 : "goofieMedian.="<<&vecMedian<<
438 0 : "goofieRMS.="<<&vecRMS<<
439 : //
440 0 : "press="<<valuePressure<<
441 0 : "press2="<<valuePressure2<<
442 0 : "temp00.="<<&vecTemp[0]<< // T-Fit ROC A-Side;Environment;Mean Temp (#circC);dT/dgx (K/cm);dT/dgy (K/cm)
443 0 : "temp10.="<<&vecTemp[1]<< // T-Fit OFC A-Side;Environment;Mean Temp (#circC);dT/dz (K/cm);dT/d#phi (K/rad)
444 0 : "temp20.="<<&vecTemp[2]<< // T-Fit IFC+TS A-Side;Environment;Mean Temp (#circC);dT/dz (K/cm);dT/d#phi (K/rad)
445 0 : "temp30.="<<&vecTemp[3]<< // T-Fit Skirt A-Side;Environment;Mean Temp (#circC);dT/dgx (K/cm);dT/dgy (K/cm)
446 0 : "temp40.="<<&vecTemp[4]<< // T-Fit IFC A-Side;Environment;Mean Temp (#circC);dT/dz (K/cm);dT/d#phi (K/rad)
447 0 : "temp01.="<<&vecTemp[5]<< // T-Fit ROC C-Side;Environment;Mean Temp (#circC);dT/dgx (K/cm);dT/dgy (K/cm)
448 0 : "temp11.="<<&vecTemp[6]<< // T-Fit OFC C-Side;Environment;Mean Temp (#circC);dT/dz (K/cm);dT/d#phi (K/rad)
449 0 : "temp21.="<<&vecTemp[7]<< // T-Fit IFC+TS C-Side;Environment;Mean Temp (#circC);dT/dz (K/cm);dT/d#phi (K/rad)
450 0 : "temp31.="<<&vecTemp[8]<< // T-Fit Skirt C-Side;Environment;Mean Temp (#circC);dT/dgx (K/cm);dT/dgy (K/cm)
451 0 : "temp41.="<<&vecTemp[9]<< // T-Fit IFC C-Side;Environment;Mean Temp (#circC);dT/dz (K/cm);dT/d#phi (K/rad)
452 : //
453 0 : "tempSkirtA.="<<&vecSkirtTempA<< // T Skirt A-Side;Environment;Sector-A
454 0 : "tempSkirtC.="<<&vecSkirtTempC; // T Skirt C-Side;Environment;Sector-C
455 :
456 0 : ProcessDrift(irun, itime);
457 0 : ProcessDriftCE(irun,itime);
458 0 : ProcessDriftAll(irun,itime);
459 : // ProcessKryptonTime(irun,itime);
460 0 : ProcessCTP(irun,itime);
461 0 : ProcessAlign(irun,itime);
462 0 : ProcessGain(irun,itime);
463 : //ProcessDriftCERef();
464 : //ProcessPulserRef();
465 : //ProcessCurrent(irun,itime);
466 0 : ProcessLHCData(irun, itime);
467 :
468 :
469 0 : (*fPcstream)<<"dcs"<<
470 : //noise data
471 0 : "meanNoise.=" << &vNoiseMean << // Mean Noise;Noise Pedestals;All Pads;IROCs;OROCs small pads;OROCs large pads
472 0 : "meanNoiseSen.=" << &vNoiseMeanSenRegions << // Mean Noise in sensitive regions;Noise Pedestals;All Pads;IROCs;OROCs small pads;OROCs large pads
473 0 : "rmsNoise.=" << &vNoiseRMS << // RMS Noise;Noise Pedestals;All Pads;IROCs;OROCs small pads;OROCs large pads
474 0 : "rmsNoiseSen.=" << &vNoiseRMSSenRegions << // RMS Noise in sensitive regions;Noise Pedestals;All Pads;IROCs;OROCs small pads;OROCs large pads
475 0 : "zeroNoise=" << nonMaskedZero << // Pads with zero noise;Noise Pedestals
476 0 : "nNaN=" << nNaN << // Pads with NaN noise;Noise Pedestals
477 : //QA data
478 0 : "occQA.=" << &vQaOcc <<
479 0 : "qQA.=" << &vQaQtot <<
480 0 : "qmaxQA.=" << &vQaQmax <<
481 : //pulser data
482 0 : "timePulser.=" << &vTimePulser <<
483 0 : "nOffPulser="<<nOffChannels<<
484 : //altro data
485 0 : "nMasked="<< nMasked << // Number of masked pads;ALTRO
486 : //
487 : //ce data -Jens version
488 : //
489 0 : "CEfitA.=" << &fitResultsA << // CE-Fit A-Side;CE;Offset (timebins);IROC/OROC Offset (timebins);dt/dgx (timebins/cm);dt/dgy (timebins/cm);dt/dlx common (timebins/cm);dt/dlx IROCs (timebins/cm)
490 0 : "CEfitC.=" << &fitResultsC << // CE Fit C-Side;CE;Offset (timebins);IROC/OROC Offset (timebins);dt/dgx (timebins/cm);dt/dgy (timebins/cm);dt/dlx common (timebins/cm);dt/dlx IROCs (timebins/cm)
491 0 : "nmaskedCE=" << nmaskedCE << // CE Number of outliers;CE
492 0 : "chi2ACE=" << chi2ACE << // CE-Fit Chi^{2} A-Side;CE
493 0 : "chi2CCE=" << chi2CCE << // CE-Fit Chi^{2} C-Side;CE
494 : //
495 : //ce data new - MI version
496 : //
497 0 : "CEfitAMI.=" << &fitCEResultsA<< // CE-Fit A-Side [MI];CE;Offset (timebins);IROC/OROC Offset (timebins);dt/dgx (timebins/cm);dt/dgy (timebins/cm);dt/dlx common (timebins/cm);dt/dlx IROCs (timebins/cm)
498 0 : "CEfitCMI.=" << &fitCEResultsC<< // CE-Fit C-Side [MI];CE;Offset (timebins);IROC/OROC Offset (timebins);dt/dgx (timebins/cm);dt/dgy (timebins/cm);dt/dlx common (timebins/cm);dt/dlx IROCs (timebins/cm)
499 0 : "chi2CEA=" << chi2CEA << // CE-Fit Chi^{2} A-Side [MI];CE
500 0 : "chi2CEC=" << chi2CEC << // CE-Fit Chi^{2} C-Side [MI];CE
501 : //
502 : //ce graph data
503 : //
504 0 : "CEgrTEntries.=" << &vecTEntries << // CE-graph drift time - entries;CE;ROC
505 0 : "CEgrTMean.=" << &vecTMean << // CE-graph mean drift time;CE;ROC
506 0 : "CEgrTRMS.=" << &vecTRMS << // CE-graph RMS of drift time;CE;ROC
507 0 : "CEgrTMedian.=" << &vecTMedian << // CE-graph median drift time;CE;ROC
508 0 : "CEgrQEntries.=" << &vecQEntries << // CE-graph charge - entries;CE;ROC
509 0 : "CEgrQMean.=" << &vecQMean << // CE-graph mean charge;CE;ROC
510 0 : "CEgrQRMS.=" << &vecQRMS << // CE-graph RMS charge;CE;ROC
511 0 : "CEgrQMedian.=" << &vecQMedian << // CE-graph median charge;CE;ROC
512 0 : "CEgrDriftA=" << driftTimeA << // CE median drift time A-Side;CE
513 0 : "CEgrDriftC=" << driftTimeC << // CE median drift time C-Side;CE
514 : //
515 : //calib raw data
516 : //
517 0 : "nFailL1=" << nFailL1 << // RCU synchonisation failures;ALTRO
518 : // b field
519 0 : "Bz=" << bz << // Magnetic Field (T);Environment
520 0 : "L3polarity=" << l3pol << // L3 polarity;Environment
521 : // production information
522 0 : "nalien=" << nalien << // obsolete
523 0 : "nRawAlien=" << nRawAlien << // obsolete
524 0 : "nlocal=" << nlocal << // obsolete
525 0 : "nRawLocal=" <<nRawLocal << // obsolete
526 : //
527 : // comparisons with ref data
528 : //
529 0 : "pedestalDeviations.=" << &pedestalDeviations << // Pedestal variation to ref (fraction);Noise Pedestals;>#pm 0.5 ADC;>#pm 1 ADC;>#pm 1.5 ADC;>#pm 2.0 ADC
530 0 : "noiseDeviations.=" << &noiseDeviations << // Noise var to ref (fraction);Noise Pedestals;>5%;>10%;>15%;>20%
531 0 : "pulserQdeviations.=" << &pulserQdeviations << // Pulser-Q var to ref (fraction);Pulser;>0.5%;>1%;>5%;>10%
532 : // "pulserVarQMean="<<varQMean<<
533 0 : "pulserNpadsOutOneTB=" << npadsOutOneTB << // Number of pads with Pulser time var >#pm 1 tb to ROC mean;Pulser
534 0 : "pulserNpadsOffAdd=" << npadsOffAdd << // Number of pads without signal but signal in ref;Pulser
535 0 : "driftCorrCosmAll=" << dvCorr <<
536 : //
537 : // LHCData
538 : //
539 0 : "meanBckgAlice.=" << &vecMeanLHCBckgAlice <<
540 : "\n";
541 0 : }//end run loop
542 0 : }
543 :
544 :
545 :
546 :
547 :
548 :
549 : void AliTPCcalibSummary::ProcessDrift(Int_t run, Int_t timeStamp){
550 : //
551 : // dump drift calibration data to the tree
552 : //
553 0 : TObjArray *array =fCalibDB->GetTimeVdriftSplineRun(run);
554 0 : TGraphErrors *laserA[3]={0,0,0};
555 0 : TGraphErrors *laserC[3]={0,0,0};
556 : TGraphErrors *cosmicAll=0;
557 : static Double_t vlaserA[3]={0,0,0};
558 : static Double_t vlaserC[3]={0,0,0};
559 : static Double_t vcosmicAll=0;
560 : static Double_t vdrift1=0; // TODO: repeated below, obsolete?
561 0 : vdrift1=fCalibDB->GetVDriftCorrectionTime(timeStamp,run,0,1); // TODO: repeated below, obsolete?
562 :
563 0 : if (array){
564 0 : laserA[0]=(TGraphErrors*)array->FindObject("GRAPH_MEAN_DELAY_LASER_ALL_A");
565 0 : laserA[1]=(TGraphErrors*)array->FindObject("GRAPH_MEAN_DRIFT_LASER_ALL_A");
566 0 : laserA[2]=(TGraphErrors*)array->FindObject("GRAPH_MEAN_GLOBALYGRADIENT_LASER_ALL_A");
567 0 : laserC[0]=(TGraphErrors*)array->FindObject("GRAPH_MEAN_DELAY_LASER_ALL_C");
568 0 : laserC[1]=(TGraphErrors*)array->FindObject("GRAPH_MEAN_DRIFT_LASER_ALL_C");
569 0 : laserC[2]=(TGraphErrors*)array->FindObject("GRAPH_MEAN_GLOBALYGRADIENT_LASER_ALL_C");
570 0 : cosmicAll =(TGraphErrors*)array->FindObject("TGRAPHERRORS_MEAN_VDRIFT_COSMICS_ALL");
571 0 : }
572 :
573 : //
574 : // TODO: the information stored in vlaserXX, vcosmicAll and vclaserXX,vccosmicAll
575 : // seem to be redundant information do we need to keep vlaserXX vcosmicAll
576 : //
577 0 : if (laserA[0]) vlaserA[0]= AliTPCcalibDButil::EvalGraphConst(laserA[0],timeStamp);
578 0 : if (laserA[1]) vlaserA[1]= AliTPCcalibDButil::EvalGraphConst(laserA[1],timeStamp);
579 0 : if (laserA[2]) vlaserA[2]= AliTPCcalibDButil::EvalGraphConst(laserA[2],timeStamp);
580 0 : if (laserC[0]) vlaserC[0]= AliTPCcalibDButil::EvalGraphConst(laserC[0],timeStamp);
581 0 : if (laserC[1]) vlaserC[1]= AliTPCcalibDButil::EvalGraphConst(laserC[1],timeStamp);
582 0 : if (laserC[2]) vlaserC[2]= AliTPCcalibDButil::EvalGraphConst(laserC[2],timeStamp);
583 0 : if (cosmicAll) vcosmicAll= AliTPCcalibDButil::EvalGraphConst(cosmicAll,timeStamp);
584 0 : (*fPcstream)<<"dcs"<<
585 0 : "vlaserA0=" << vlaserA[0] << // Laser offset A-Side;Drift //TODO: Obsolete
586 0 : "vlaserA1=" << vlaserA[1] << // Laser drift correction A-Side;Drift //TODO: Obsolete
587 0 : "vlaserA2=" << vlaserA[2] << // Laser gy correction A-Side;Drift //TODO: Obsolete
588 0 : "vlaserC0=" << vlaserC[0] << // Laser offset C-Side;Drift //TODO: Obsolete
589 0 : "vlaserC1=" << vlaserC[1] << // Laser drift correction C-Side;Drift //TODO: Obsolete
590 0 : "vlaserC2=" << vlaserC[2] << // Laser gy correction C-Side;Drift //TODO: Obsolete
591 0 : "vcosmicAll=" << vcosmicAll << // Cosmic drift corrrection;Drift //TODO: Obsolete
592 : //
593 0 : "vdrift1=" << vdrift1; // Combined drift correction ;Drift // TODO: repeated below, obsolete?
594 :
595 : //
596 : // define distance to measurement
597 : //
598 : static Double_t dlaserA=0;
599 : static Double_t dlaserC=0;
600 : static Double_t dcosmic=0;
601 : static Double_t slaserA=0; //TODO: Obsolete?
602 : static Double_t slaserC=0; //TODO: Obsolete?
603 : static Double_t scosmic=0; //TODO: Obsolete?
604 : static Double_t vclaserA[3]={0,0,0};
605 : static Double_t vclaserC[3]={0,0,0};
606 : static Double_t vccosmicAll=0;
607 0 : for (Int_t i=0;i<3;i++){
608 0 : if (laserA[i]) AliTPCcalibDButil::GetNearest(laserA[i],timeStamp,dlaserA,vclaserA[i]);
609 0 : if (laserC[i]) AliTPCcalibDButil::GetNearest(laserC[i],timeStamp,dlaserC,vclaserC[i]);
610 : }
611 0 : if (cosmicAll) AliTPCcalibDButil::GetNearest(cosmicAll,timeStamp,dcosmic,vccosmicAll);
612 0 : (*fPcstream)<<"dcs"<<
613 0 : "vclaserA0=" << vclaserA[0]<< // Laser offset A-Side;Drift
614 0 : "vclaserA1=" << vclaserA[1]<< // Laser drift correction A-Side;Drift
615 0 : "vclaserA2=" << vclaserA[2]<< // Laser gy correction A-Side;Drift
616 0 : "vclaserC0=" << vclaserC[0]<< // Laser offset A-Side;Drift
617 0 : "vclaserC1=" << vclaserC[1]<< // Laser drift correction A-Side;Drift
618 0 : "vclaserC2=" << vclaserC[2]<< // Laser gy correction A-Side;Drift
619 0 : "vccosmicAll=" << vccosmicAll<< // Cosmic drift corrrection;Drift
620 0 : "dlaserA=" << dlaserA << // Distance to laser measurement A-Side;Drift
621 0 : "dlaserC=" << dlaserC << // Distance to laser measurement C-Side;Drift
622 0 : "dcosmic=" << dcosmic << // Distance to cosmics measurement A-Side;Drift
623 0 : "slaserA=" << slaserA << //TODO: Obsolete?
624 0 : "slaserC=" << slaserC << //TODO: Obsolete?
625 0 : "scosmic=" << scosmic; //TODO: Obsolete?
626 :
627 : static TGeoMatrix * matrixAlign=0;
628 : static Double_t twistX=0;
629 : static Double_t twistY=0;
630 0 : if (matrixAlign==0){
631 0 : AliTPCComposedCorrection * corr = (AliTPCComposedCorrection *)array->FindObject("FitCorrectionTime");
632 0 : if (!corr) {
633 0 : matrixAlign=new TGeoHMatrix;
634 :
635 0 : }
636 0 : if (corr){
637 0 : AliTPCCalibGlobalMisalignment *align = (AliTPCCalibGlobalMisalignment*)corr->GetCorrections()->FindObject("FitAlignTime");
638 0 : AliTPCExBTwist *twist = (AliTPCExBTwist*)corr->GetCorrections()->FindObject("FitExBTwistTime");
639 0 : if (twist){
640 0 : twistX=twist->GetXTwist();
641 0 : twistY=twist->GetYTwist();
642 : //delete twist;
643 0 : }
644 0 : if (align && align->GetAlignGlobal()){
645 0 : matrixAlign = (TGeoMatrix*) (align->GetAlignGlobal()->Clone());
646 : //delete align;
647 0 : }
648 0 : }
649 0 : }
650 0 : (*fPcstream)<<"dcs"<<
651 0 : "alignTime.="<<matrixAlign<<
652 0 : "twistX="<<twistX<<
653 0 : "twistY="<<twistY;
654 0 : }
655 :
656 : void AliTPCcalibSummary::ProcessDriftCE(Int_t run,Int_t timeStamp){
657 : //
658 : // dump drift calibration data CE
659 : //
660 0 : TObjArray *arrT=fCalibDB->GetCErocTtime();
661 0 : AliTPCParam *param=fCalibDB->GetParameters();
662 0 : static TVectorD tdriftCE(74);
663 0 : static TVectorD tndriftCE(74);
664 0 : static TVectorD vdriftCE(74);
665 0 : static TVectorD tcdriftCE(74);
666 0 : static TVectorD tddriftCE(74);
667 : static Double_t ltime0A=0.;
668 : static Double_t ltime0C=0.;
669 : //
670 : //
671 : //
672 0 : ltime0A = fDButil->GetLaserTime0(run,timeStamp,36000,0);
673 0 : ltime0C = fDButil->GetLaserTime0(run,timeStamp,36000,1);
674 : //
675 : // TODO: are the values tdriftCE and tcdriftCE redundant and need both be kept?
676 0 : for (Int_t i=0; i<arrT->GetEntries();i++){
677 0 : tdriftCE[i]=0;
678 0 : vdriftCE[i]=0;
679 0 : TGraph *graph = (TGraph*)arrT->At(i);
680 0 : if (!graph) continue;
681 0 : tdriftCE[i]=AliTPCcalibDButil::EvalGraphConst(graph,timeStamp);
682 0 : Double_t deltaT,gry;
683 0 : AliTPCcalibDButil::GetNearest(graph,timeStamp,deltaT,gry);
684 0 : tndriftCE[i]=graph->GetN();
685 0 : tcdriftCE[i]=gry;
686 0 : tddriftCE[i]=deltaT;
687 : // TODO: use tdriftCE or tndriftCE
688 : if (i%36<18){
689 0 : vdriftCE[i] =(param->GetZLength(i)/(tdriftCE[i]*param->GetTSample()*(1.-ltime0A)-param->GetL1Delay()))/param->GetDriftV();
690 : }else{
691 : vdriftCE[i] =(param->GetZLength(i)/(tdriftCE[i]*param->GetTSample()*(1.-ltime0A)-param->GetL1Delay()))/param->GetDriftV();
692 : }
693 0 : }
694 : // export values
695 0 : (*fPcstream)<<"dcs"<<
696 0 : "tdriftCE.=" << &tdriftCE << // CE arrival time;CE;Sector // TODO: obsolete, redundant?
697 0 : "vdriftCE.=" << &vdriftCE << // CE derived drift velocity;CE;Sector
698 0 : "tndriftCE.=" << &tndriftCE << // CE number of points;CE;Sector
699 0 : "tcdriftCE.=" << &tcdriftCE << // CE arrival time - nearest point;CE;Sector
700 0 : "tddriftCE.=" << &tddriftCE << // CE distance to closest measuement;CE;Sector
701 0 : "ltime0A=" << ltime0A << // CE laser offset A-Side;CE
702 0 : "ltime0C=" << ltime0C ; // CE laser offset C-Side;CE
703 0 : }
704 :
705 :
706 : void AliTPCcalibSummary::ProcessDriftAll(Int_t run,Int_t timeStamp){
707 : //
708 : // dump drift calibration data all calibrations form DB util
709 : // test of utils
710 : static Double_t vdriftCEA=0, vdriftCEC=0, vdriftCEM=0;
711 : static Double_t vdriftLTA=0, vdriftLTC=0, vdriftLTM=0;
712 : static Double_t vdriftLTAon=0, vdriftLTCon=0, vdriftLTMon=0;
713 : static Double_t vdriftITS=0;
714 : static Double_t vdriftP=0;
715 : static Double_t dcea=0, dcec=0, dcem=0, dla=0,dlc=0,dlm=0, dlaon=0,dlcon=0,dlmon=0, dp=0;
716 : static Double_t dits=0;
717 : static Double_t ltime0A=0.;
718 : static Double_t ltime0C=0.;
719 : static Double_t ctime0=0.;
720 : static Double_t vdrift1=0;
721 0 : vdrift1= fCalibDB->GetVDriftCorrectionTime(timeStamp,run,0,1);
722 0 : vdriftP = fDButil->GetVDriftTPC(dp, run, timeStamp, 86400, 3600,0);
723 0 : ctime0 = AliTPCcalibDButil::GetTriggerOffsetTPC(run,timeStamp, 36000, 3600,0);
724 : //
725 0 : vdriftCEA= fDButil->GetVDriftTPCCE(dcea,run,timeStamp,36000,0);
726 0 : vdriftCEC= fDButil->GetVDriftTPCCE(dcec,run,timeStamp,36000,1);
727 0 : vdriftCEM= fDButil->GetVDriftTPCCE(dcem,run,timeStamp,36000,2);
728 : //
729 0 : vdriftLTA= fDButil->GetVDriftTPCLaserTracks(dla,run,timeStamp,36000,0);
730 0 : vdriftLTC= fDButil->GetVDriftTPCLaserTracks(dlc,run,timeStamp,36000,1);
731 0 : vdriftLTM= fDButil->GetVDriftTPCLaserTracks(dlm,run,timeStamp,36000,2);
732 : //
733 0 : vdriftLTAon= fDButil->GetVDriftTPCLaserTracksOnline(dlaon,run,timeStamp,36000,0);
734 0 : vdriftLTCon= fDButil->GetVDriftTPCLaserTracksOnline(dlcon,run,timeStamp,36000,1);
735 0 : vdriftLTMon= fDButil->GetVDriftTPCLaserTracksOnline(dlmon,run,timeStamp,36000,2);
736 : //
737 0 : vdriftITS= fDButil->GetVDriftTPCITS(dits, run,timeStamp);
738 : //
739 0 : ltime0A = fDButil->GetLaserTime0(run,timeStamp,36000,0); // TODO: not used, needed?
740 0 : ltime0C = fDButil->GetLaserTime0(run,timeStamp,36000,1); // TODO: not used, needed?
741 :
742 0 : (*fPcstream)<<"dcs"<<
743 : //
744 0 : "vdriftCEA=" << vdriftCEA << // CE drift correction A-Side;Drift
745 0 : "vdriftCEC=" << vdriftCEC << // CE drift correction C-Side;Drift
746 0 : "vdriftCEM=" << vdriftCEM << // CE drift correction Mean;Drift
747 0 : "dcea=" << dcea << // CE distance to closest measurement A-Side;Drift
748 0 : "dcec=" << dcec << // CE distance to closest measurement C-Side;Drift
749 0 : "dcem=" << dcem << // CE distance to closest measurement Mean;Drift
750 0 : "vdriftLTA=" << vdriftLTA << // Offline Laser track vdrift correction A-Side;Drift
751 0 : "vdriftLTC=" << vdriftLTC << // Offline Laser track vdrift correction C-Side;Drift
752 0 : "vdriftLTM=" << vdriftLTM << // Offline Laser track vdrift correction Mean;Drift
753 0 : "dla=" << dla << // Offline Laser track distance to closest measurement A-Side;Drift
754 0 : "dlc=" << dlc << // Offline Laser track distance to closest measurement C-Side;Drift
755 0 : "dlm=" << dlm << // Offline Laser track distance to closest measurement Mean;Drift
756 0 : "vdriftLTAon=" << vdriftLTAon << // Online Laser track vdrift correction A-Side;Drift
757 0 : "vdriftLTCon=" << vdriftLTCon << // Online Laser track vdrift correction C-Side;Drift
758 0 : "vdriftLTMon=" << vdriftLTMon << // Online Laser track vdrift correction Mean;Drift
759 0 : "dlaOn=" << dlaon << // Online Laser track distance to closest measurement A-Side;Drift
760 0 : "dlcOn=" << dlcon << // Online Laser track distance to closest measurement C-Side;Drift
761 0 : "dlmOn=" << dlmon << // Online Laser track distance to closest measurement Mean;Drift
762 : //
763 : //
764 0 : "vdriftITS=" << vdriftITS << // TPC-ITS vdrift correction;Drift
765 0 : "dits=" << dits << // TPC-ITS vdrift correction distance to closest measurement;Drift
766 0 : "ctime0=" << ctime0 << // Trigger offset correction;Drift
767 0 : "vdriftP=" << vdriftP << // Cosmics vdrift correction;Drift
768 0 : "dp=" << dp << // Cosmics vdrift correction distance to closest measurement;Drift
769 0 : "vdrift1=" << vdrift1 ; // combined drift velocity;Drift
770 :
771 0 : }
772 :
773 :
774 :
775 : void AliTPCcalibSummary::ProcessKryptonTime(Int_t run, Int_t timeStamp){
776 : //
777 : // Dumping krypton calibration results
778 : //
779 : static TObjArray * krArray=0;
780 0 : if (!krArray) {
781 0 : AliCDBEntry* entry = AliCDBManager::Instance()->Get("TPC/Calib/TimeGainKrypton", run);
782 0 : if (entry){
783 0 : krArray = (TObjArray*)entry->GetObject();
784 0 : }
785 0 : }
786 0 : static TVectorD krMean(74);
787 0 : static TVectorD krErr(74);
788 0 : static TVectorD krDist(74);
789 : TGraphErrors *gr=0;
790 0 : Double_t deltaT=0,gry=0;
791 0 : if (krArray){
792 0 : for (Int_t isec=0; isec<72; isec++){
793 0 : krMean[isec]=0;
794 0 : krDist[isec]=0;
795 0 : krErr[isec]=0;
796 0 : gr=(TGraphErrors*)krArray->At(isec);
797 0 : if (gr) {
798 0 : krMean[isec]=AliTPCcalibDButil::EvalGraphConst(gr,timeStamp);
799 0 : AliTPCcalibDButil::GetNearest(gr, timeStamp,deltaT,gry);
800 0 : krDist[isec]=deltaT;
801 0 : }
802 0 : if (72+isec<krArray->GetEntries()) {
803 0 : gr=(TGraphErrors*)krArray->At(72+isec);
804 0 : if (gr) krErr[isec]=AliTPCcalibDButil::EvalGraphConst(gr,timeStamp);
805 : }
806 : }
807 0 : krMean[72]= TMath::Median(36,krMean.GetMatrixArray());
808 0 : krMean[73]= TMath::Median(36,&(krMean.GetMatrixArray()[36]));
809 0 : krErr[72]= TMath::Median(36,krErr.GetMatrixArray());
810 0 : krErr[73]= TMath::Median(36,&(krErr.GetMatrixArray()[36]));
811 0 : }
812 0 : (*fPcstream)<<"dcs"<<
813 0 : "krMean.="<<&krMean<<
814 0 : "krErr.="<<&krErr<<
815 0 : "krDist.="<<&krDist;
816 0 : }
817 :
818 : void AliTPCcalibSummary::ProcessCTP(Int_t irun, Int_t timeStamp){
819 : //
820 : //
821 : //
822 0 : static TClonesArray *pcarray = new TClonesArray("AliCTPInputTimeParams",1);
823 : static AliCTPTimeParams *ctpParams =0;
824 0 : ctpParams = fCalibDB->GetCTPTimeParams(); //
825 0 : const TObjArray *arr = ctpParams->GetInputTimeParams();
826 0 : pcarray->ExpandCreateFast(TMath::Max(arr->GetEntries(),1));
827 0 : for (Int_t i=0; i<arr->GetEntries(); i++){
828 0 : new ((*pcarray)[i]) AliCTPInputTimeParams(*((AliCTPInputTimeParams*)arr->At(i)));
829 : }
830 0 : (*fPcstream)<<"ctp"<<
831 0 : "run="<<irun<<
832 0 : "time="<<timeStamp<<
833 0 : "ctpP.="<<ctpParams<<
834 0 : "ctpArr="<<pcarray<<
835 : "\n";
836 0 : (*fPcstream)<<"dcs"<<
837 0 : "ctpP.="<<ctpParams<<
838 0 : "ctpArr="<<pcarray;
839 0 : }
840 :
841 : void AliTPCcalibSummary::ProcessGain(Int_t irun, Int_t timeStamp){
842 : //
843 : // Dump gain related information to the tree
844 : //
845 : static Float_t gainCosmic = 0;
846 : static Float_t gainMIP = 0;
847 : static Float_t attachMIP = 0;
848 : static Double_t dMIP=0;
849 0 : Double_t dummy=0;
850 0 : static TVectorD vGainGraphIROC(36);
851 0 : static TVectorD vGainGraphOROCmed(36);
852 0 : static TVectorD vGainGraphOROClong(36);
853 0 : static TVectorD vGainGraphIROCErr(36);
854 0 : static TVectorD vGainGraphOROCmedErr(36);
855 0 : static TVectorD vGainGraphOROClongErr(36);
856 : //
857 0 : static TVectorD vGainQMaxGraphRegion(3);
858 0 : static TVectorD vGainQTotGraphRegion(3);
859 : //
860 0 : static TGraphErrors ggrPadEqualMax(36);
861 0 : static TGraphErrors ggrPadEqualTot(36);
862 : //
863 0 : static TGraphErrors ggrDipAngleMaxShort;
864 0 : static TGraphErrors ggrDipAngleMaxMedium;
865 0 : static TGraphErrors ggrDipAngleMaxLong;
866 0 : static TGraphErrors ggrDipAngleMaxAbsolute;
867 : //
868 0 : static TGraphErrors ggrDipAngleTotShort;
869 0 : static TGraphErrors ggrDipAngleTotMedium;
870 0 : static TGraphErrors ggrDipAngleTotLong;
871 0 : static TGraphErrors ggrDipAngleTotAbsolute;
872 : //
873 0 : static TGraphErrors ggrMultiplicityTot;
874 0 : static TGraphErrors ggrMultiplicityMax;
875 : //
876 0 : static TVectorD vFitDipAngleParMaxShort(3);
877 0 : static TVectorD vFitDipAngleParMaxMedium(3);
878 0 : static TVectorD vFitDipAngleParMaxLong(3);
879 0 : static TVectorD vFitDipAngleParMaxAbsolute(3);
880 : //
881 0 : static TVectorD vFitDipAngleParTotShort(3);
882 0 : static TVectorD vFitDipAngleParTotMedium(3);
883 0 : static TVectorD vFitDipAngleParTotLong(3);
884 0 : static TVectorD vFitDipAngleParTotAbsolute(3);
885 : static Int_t gainMIPTime0=0;
886 : static Int_t gainMIPTime1=0;
887 :
888 0 : vGainGraphIROC.Zero();
889 0 : vGainGraphOROCmed.Zero();
890 0 : vGainGraphOROClong.Zero();
891 0 : vGainGraphIROCErr.Zero();
892 0 : vGainGraphOROCmedErr.Zero();
893 0 : vGainGraphOROClongErr.Zero();
894 0 : vGainQMaxGraphRegion.Zero();
895 0 : vGainQTotGraphRegion.Zero();
896 0 : TGraphErrors grDummy;
897 0 : TObjArray * gainSplines = fCalibDB->GetTimeGainSplinesRun(irun);
898 0 : if (gainSplines) {
899 0 : TGraphErrors * graphMIP = (TGraphErrors *) gainSplines->FindObject("TGRAPHERRORS_MEAN_GAIN_BEAM_ALL");
900 0 : TGraphErrors * graphCosmic = (TGraphErrors *) gainSplines->FindObject("TGRAPHERRORS_MEAN_GAIN_COSMIC_ALL");
901 0 : TGraphErrors * graphAttach = (TGraphErrors *) gainSplines->FindObject("TGRAPHERRORS_MEAN_ATTACHMENT_BEAM_ALL");
902 : //
903 0 : TGraphErrors * grPadEqualQMax = (TGraphErrors * ) gainSplines->FindObject("TGRAPHERRORS_MEANQMAX_PADREGIONGAIN_BEAM_ALL");
904 0 : TGraphErrors * grPadEqualQTot = (TGraphErrors * ) gainSplines->FindObject("TGRAPHERRORS_MEANQTOT_PADREGIONGAIN_BEAM_ALL");
905 : //
906 0 : TGraphErrors * graphGainIROC = (TGraphErrors *) gainSplines->FindObject("TGRAPHERRORS_MEAN_CHAMBERGAIN_SHORT_BEAM_ALL");
907 0 : TGraphErrors * graphGainOROCMedium = (TGraphErrors *) gainSplines->FindObject("TGRAPHERRORS_MEAN_CHAMBERGAIN_MEDIUM_BEAM_ALL");
908 0 : TGraphErrors * graphGainOROCLong = (TGraphErrors *) gainSplines->FindObject("TGRAPHERRORS_MEAN_CHAMBERGAIN_LONG_BEAM_ALL");
909 : //
910 : //
911 0 : TF1* funDipAngleMax[4]={0x0,0x0,0x0,0x0};
912 0 : TF1* funDipAngleTot[4]={0x0,0x0,0x0,0x0};
913 0 : TGraphErrors* grDipAngleMax[4]={0x0,0x0,0x0,0x0};
914 0 : TGraphErrors* grDipAngleTot[4]={0x0,0x0,0x0,0x0};
915 0 : const char* names[4]={"SHORT","MEDIUM","LONG","ABSOLUTE"};
916 0 : for (Int_t iPadRegion=0; iPadRegion<4; ++iPadRegion) {
917 0 : funDipAngleMax[iPadRegion]=(TF1*) gainSplines->FindObject(Form("TF1_QMAX_DIPANGLE_%s_BEAM_ALL",names[iPadRegion]));
918 0 : funDipAngleTot[iPadRegion]=(TF1*) gainSplines->FindObject(Form("TF1_QTOT_DIPANGLE_%s_BEAM_ALL",names[iPadRegion]));
919 0 : grDipAngleMax[iPadRegion]= (TGraphErrors*) gainSplines->FindObject(Form("TGRAPHERRORS_QMAX_DIPANGLE_%s_BEAM_ALL",names[iPadRegion]));
920 0 : grDipAngleTot[iPadRegion]= (TGraphErrors*) gainSplines->FindObject(Form("TGRAPHERRORS_QTOT_DIPANGLE_%s_BEAM_ALL",names[iPadRegion]));
921 : }
922 : //
923 0 : for(Int_t iPar=0; iPar < 3; iPar++) {
924 0 : if (funDipAngleMax[0]) vFitDipAngleParMaxShort(iPar) = funDipAngleMax[0]->GetParameter(iPar);
925 0 : if (funDipAngleMax[1]) vFitDipAngleParMaxMedium(iPar) = funDipAngleMax[1]->GetParameter(iPar);
926 0 : if (funDipAngleMax[2]) vFitDipAngleParMaxLong(iPar) = funDipAngleMax[2]->GetParameter(iPar);
927 0 : if (funDipAngleMax[3]) vFitDipAngleParMaxAbsolute(iPar) = funDipAngleMax[3]->GetParameter(iPar);
928 : //
929 0 : if (funDipAngleTot[0]) vFitDipAngleParTotShort(iPar) = funDipAngleTot[0]->GetParameter(iPar);
930 0 : if (funDipAngleTot[1]) vFitDipAngleParTotMedium(iPar) = funDipAngleTot[1]->GetParameter(iPar);
931 0 : if (funDipAngleTot[2]) vFitDipAngleParTotLong(iPar) = funDipAngleTot[2]->GetParameter(iPar);
932 0 : if (funDipAngleTot[3]) vFitDipAngleParTotAbsolute(iPar) = funDipAngleTot[3]->GetParameter(iPar);
933 : }
934 : //
935 0 : if (grDipAngleMax[0]) ggrDipAngleMaxShort = * grDipAngleMax[0];
936 0 : if (grDipAngleMax[1]) ggrDipAngleMaxMedium = * grDipAngleMax[1];
937 0 : if (grDipAngleMax[2]) ggrDipAngleMaxLong = * grDipAngleMax[2];
938 0 : if (grDipAngleMax[3]) ggrDipAngleMaxAbsolute = * grDipAngleMax[3];
939 : //
940 0 : if (grDipAngleTot[0]) ggrDipAngleTotShort = * grDipAngleTot[0];
941 0 : if (grDipAngleTot[1]) ggrDipAngleTotMedium = * grDipAngleTot[1];
942 0 : if (grDipAngleTot[2]) ggrDipAngleTotLong = * grDipAngleTot[2];
943 0 : if (grDipAngleTot[3]) ggrDipAngleTotAbsolute = * grDipAngleTot[3];
944 : //
945 : //
946 0 : TGraphErrors *grPadEqualMax = (TGraphErrors * ) gainSplines->FindObject("TGRAPHERRORS_MEANQMAX_PADREGIONGAIN_BEAM_ALL");
947 0 : TGraphErrors *grPadEqualTot = (TGraphErrors * ) gainSplines->FindObject("TGRAPHERRORS_MEANQTOT_PADREGIONGAIN_BEAM_ALL");
948 0 : if (grPadEqualMax) ggrPadEqualMax = *grPadEqualMax;
949 0 : if (grPadEqualTot) ggrPadEqualTot = *grPadEqualTot;
950 : //
951 0 : TGraphErrors * grMultiplicityTot = (TGraphErrors *) gainSplines->FindObject("TGRAPHERRORS_MEANQTOT_MULTIPLICITYDEPENDENCE_BEAM_ALL");
952 0 : TGraphErrors * grMultiplicityMax = (TGraphErrors *) gainSplines->FindObject("TGRAPHERRORS_MEANQMAX_MULTIPLICITYDEPENDENCE_BEAM_ALL");
953 0 : if (grMultiplicityTot) ggrMultiplicityTot = *grMultiplicityTot;
954 0 : if (grMultiplicityMax) ggrMultiplicityTot = *grMultiplicityMax;
955 :
956 0 : if (graphGainIROC && graphGainOROCMedium && graphGainOROCLong) {
957 0 : Double_t x=0,y=0;
958 0 : for (Int_t i=0; i<36; ++i){
959 0 : graphGainIROC->GetPoint(i,x,y);
960 0 : vGainGraphIROC(i)=y;
961 0 : graphGainOROCMedium->GetPoint(i,x,y);
962 0 : vGainGraphOROCmed(i)=y;
963 0 : graphGainOROCLong->GetPoint(i,x,y);
964 0 : vGainGraphOROClong(i)=y;
965 : //errors
966 0 : vGainGraphIROCErr(i) = graphGainIROC->GetEY()[i];
967 0 : vGainGraphOROCmedErr(i) = graphGainOROCMedium->GetEY()[i];
968 0 : vGainGraphOROClongErr(i) = graphGainOROCLong->GetEY()[i];
969 : }
970 0 : for (Int_t i=0; i<3; ++i){
971 0 : vGainQMaxGraphRegion[i]=grPadEqualQMax->GetY()[i];
972 0 : vGainQTotGraphRegion[i]=grPadEqualQTot->GetY()[i];
973 : }
974 0 : }
975 :
976 0 : if (graphMIP) {
977 0 : gainMIP = AliTPCcalibDButil::EvalGraphConst(graphMIP,timeStamp);
978 0 : gainMIPTime0=graphMIP->GetX()[0];
979 0 : gainMIPTime1=graphMIP->GetX()[graphMIP->GetN()-1];
980 0 : }
981 0 : if (graphCosmic) gainCosmic = AliTPCcalibDButil::EvalGraphConst(graphCosmic,timeStamp);
982 0 : if (graphAttach) attachMIP = AliTPCcalibDButil::EvalGraphConst(graphAttach,timeStamp);
983 0 : if (graphMIP) AliTPCcalibDButil::GetNearest(graphMIP, timeStamp, dMIP,dummy);
984 0 : }
985 :
986 : // time dependence of gain
987 0 : (*fPcstream)<<"dcs"<<
988 0 : "grPadEqualMax.=" << &ggrPadEqualMax <<
989 0 : "grPadEqualTot.=" << &ggrPadEqualTot <<
990 0 : "rocGainIROC.=" << &vGainGraphIROC <<
991 0 : "rocGainOROCMedium.=" << &vGainGraphOROCmed <<
992 0 : "rocGainOROCLong.=" << &vGainGraphOROClong <<
993 0 : "rocGainErrIROC.=" << &vGainGraphIROCErr <<
994 0 : "rocGainErrOROCMedium.=" << &vGainGraphOROCmedErr <<
995 0 : "rocGainErrOROCLong.=" << &vGainGraphOROClongErr <<
996 0 : "vGainQMaxGraphRegion.=" << &vGainQMaxGraphRegion <<
997 0 : "vGainQTotGraphRegion.=" << &vGainQTotGraphRegion <<
998 : //
999 0 : "vFitDipAngleParMaxShort.=" << &vFitDipAngleParMaxShort <<
1000 0 : "vFitDipAngleParMaxMedium.=" << &vFitDipAngleParMaxMedium <<
1001 0 : "vFitDipAngleParMaxLong.=" << &vFitDipAngleParMaxLong <<
1002 0 : "vFitDipAngleParMaxAbsolute.="<< &vFitDipAngleParMaxAbsolute <<
1003 : //
1004 0 : "vFitDipAngleParTotShort.=" << &vFitDipAngleParTotShort <<
1005 0 : "vFitDipAngleParTotMedium.=" << &vFitDipAngleParTotMedium <<
1006 0 : "vFitDipAngleParTotLong.=" << &vFitDipAngleParTotLong <<
1007 0 : "vFitDipAngleParTotAbsolute.="<< &vFitDipAngleParTotAbsolute <<
1008 : //
1009 0 : "grDipAngleMaxShort.=" << &ggrDipAngleMaxShort <<
1010 0 : "grDipAngleMaxMedium.=" << &ggrDipAngleMaxMedium <<
1011 0 : "grDipAngleMaxLong.=" << &ggrDipAngleMaxLong <<
1012 0 : "grDipAngleMaxAbsolute.=" << &ggrDipAngleMaxAbsolute <<
1013 : //
1014 0 : "grDipAngleTotShort.=" << &ggrDipAngleTotShort <<
1015 0 : "grDipAngleTotMedium.=" << &ggrDipAngleTotMedium <<
1016 0 : "grDipAngleTotLong.=" << &ggrDipAngleTotLong <<
1017 0 : "grDipAngleTotAbsolute.=" << &ggrDipAngleTotAbsolute <<
1018 : //
1019 0 : "grMultiplicityTot.=" << &ggrMultiplicityTot <<
1020 0 : "grMultiplicityMax.=" << &ggrMultiplicityMax <<
1021 : //
1022 0 : "gainMIP=" << gainMIP << // gain normalization parameter
1023 0 : "gainMIPTime0=" << gainMIPTime0 << // first bin for time calibration
1024 0 : "gainMIPTime1=" << gainMIPTime1 << // last bin for gain calibration
1025 0 : "attachMIP=" << attachMIP <<
1026 0 : "dMIP=" << dMIP <<
1027 0 : "gainCosmic=" << gainCosmic ;
1028 0 : }
1029 :
1030 :
1031 : void AliTPCcalibSummary::ProcessAlign(Int_t run, Int_t timeStamp){
1032 : //
1033 : // Proccess alignment
1034 : //
1035 0 : TString grnames[12]={"ALIGN_ITS", "ALIGN_ITSP", "ALIGN_ITSM", "ALIGN_ITSB",
1036 0 : "ALIGN_TRD", "ALIGN_TRDP", "ALIGN_TRDM","ALIGN_TRDB",
1037 0 : "ALIGN_TOF", "ALIGN_TOFP", "ALIGN_TOFM","ALIGN_TOFB"};
1038 0 : TString grpar[9]={"DELTAPSI", "DELTATHETA", "DELTAPHI",
1039 0 : "DELTAX", "DELTAY", "DELTAZ",
1040 0 : "DRIFTVD", "T0", "VDGY"};
1041 : static Double_t values[12*9];
1042 : static Double_t errs[12*9];
1043 :
1044 0 : TObjArray *array =fCalibDB->GetTimeVdriftSplineRun(run);
1045 : TGraphErrors *gr=0;
1046 0 : for (Int_t idet=0; idet<12; idet++){
1047 0 : for (Int_t ipar=0; ipar<9; ipar++){
1048 0 : TString grName=grnames[idet];
1049 0 : grName+="_TPC_";
1050 0 : grName+=grpar[ipar];
1051 0 : if (array){
1052 0 : gr = (TGraphErrors*)array->FindObject(grName.Data());
1053 0 : }
1054 0 : values[9*idet+ipar]=0;
1055 0 : errs[9*idet+ipar]=0;
1056 0 : if (gr) values[9*idet+ipar]=AliTPCcalibDButil::EvalGraphConst(gr,timeStamp);
1057 0 : (*fPcstream)<<"dcs"<<
1058 0 : Form("%s=",grName.Data())<<values[9*idet+ipar];
1059 0 : (*fPcstream)<<"align"<<
1060 0 : Form("%s=",grName.Data())<<values[9*idet+ipar];
1061 0 : }
1062 : }
1063 0 : (*fPcstream)<<"align"<<
1064 0 : "time="<<timeStamp<<
1065 0 : "run="<<run<<
1066 : "\n";
1067 0 : }
1068 :
1069 :
1070 : void AliTPCcalibSummary::ProcessDriftCERef(){
1071 : //
1072 : // Get fit of residuals if CE in respect with reference
1073 : // data
1074 : //
1075 0 : static TVectorD sec(72);
1076 0 : static TVectorD vec0(72);
1077 0 : static TVectorD vecLy(72);
1078 0 : static TVectorD vecLx(72);
1079 0 : static TVectorD vecChi2(72);
1080 0 : static TVectorD vecN(72);
1081 : //
1082 0 : static TVectorD vecA0(72);
1083 0 : static TVectorD vecALy(72);
1084 0 : static TVectorD vecALx(72);
1085 0 : static TVectorD vecAChi2(72);
1086 : //
1087 0 : static TVectorD vecASide(4);
1088 0 : static TVectorD vecCSide(4);
1089 : static Bool_t isCalc=kFALSE;
1090 :
1091 0 : TFile f("calPads.root");
1092 0 : TFile fref("calPadsRef.root");
1093 0 : TTree * tree = (TTree*)f.Get("calPads");
1094 0 : TTree * treeRef = (TTree*)fref.Get("calPads");
1095 0 : tree->AddFriend(treeRef,"R");
1096 0 : tree->SetAlias("inCE","((CEQmean.fElements>35)&&abs(CETmean.fElements)<1.5&&abs(CETrms.fElements/1.2-1)<0.2)"); // outlyerTrms
1097 0 : tree->SetAlias("inCER","((R.CEQmean.fElements>35)&&abs(R.CETmean.fElements)<1.5&&abs(R.CETrms.fElements/1.2-1)<0.2)"); // outlyerTrms
1098 : //
1099 0 : if (!isCalc){
1100 : // make fits only once
1101 0 : Double_t chi2=0;
1102 0 : Int_t npoints=0;
1103 0 : TVectorD param;
1104 0 : TMatrixD covar;
1105 0 : tree->SetAlias("dt","CETmean.fElements-R.CETmean.fElements");
1106 0 : TCut cutAll ="inCE&&inCER&&abs(CETmean.fElements-R.CETmean.fElements)<0.5";
1107 0 : TString fstringG=""; // global part
1108 0 : fstringG+="ly.fElements++";
1109 0 : fstringG+="(lx.fElements-134.)++";
1110 0 : for (Int_t isec=0; isec<72; isec++){
1111 0 : TStatToolkit::FitPlane(tree,"0.264*dt", fstringG.Data(),Form("sector==%d",isec)+cutAll, chi2,npoints,param,covar,-1,0, 10000000, kFALSE);
1112 0 : if (npoints<3) continue;
1113 0 : printf("Sector=%d\n",isec);
1114 0 : vec0[isec]=param[0];
1115 0 : vecLy[isec]=param[1];
1116 0 : vecLx[isec]=param[2];
1117 0 : sec[isec]=isec;
1118 0 : vecN[isec]=npoints;
1119 0 : vecChi2[isec]=TMath::Sqrt(chi2/npoints);
1120 :
1121 0 : TStatToolkit::FitPlane(tree,"0.264*CETmean.fElements", fstringG.Data(),Form("sector==%d",isec)+cutAll, chi2,npoints,param,covar,-1,0, 10000000, kFALSE);
1122 0 : if (npoints<3) continue;
1123 0 : printf("Sector=%d\n",isec);
1124 0 : vecA0[isec]=param[0];
1125 0 : vecALy[isec]=param[1];
1126 0 : vecALx[isec]=param[2];
1127 0 : vecAChi2[isec]=TMath::Sqrt(chi2/npoints);
1128 0 : }
1129 0 : isCalc=kTRUE;
1130 : //
1131 0 : TString fstringRef=""; // global fit
1132 0 : fstringRef+="gx.fElements++";
1133 0 : fstringRef+="gy.fElements++";
1134 0 : fstringRef+="lx.fElements++";
1135 0 : TStatToolkit::FitPlane(tree,"0.264*dt", fstringG.Data(),"(sector%36)<18"+cutAll, chi2,npoints,vecASide,covar,-1,0, 10000000, kFALSE);
1136 0 : TStatToolkit::FitPlane(tree,"0.264*dt", fstringG.Data(),"(sector%36)>=18"+cutAll, chi2,npoints,vecCSide,covar,-1,0, 10000000, kFALSE);
1137 :
1138 0 : }
1139 0 : (*fPcstream)<<"dcs"<< // CE information
1140 0 : "CETSector.=" << &sec << // sector numbers
1141 0 : "CETRefA.=" << &vecASide << // diff to reference A side
1142 0 : "CETRefC.=" << &vecCSide << // diff to reference C side
1143 : // // fit in respect to reference data
1144 0 : "CETRef0.=" << &vec0 << // offset change
1145 0 : "CETRefY.=" << &vecLy << // slope y change - rad
1146 0 : "CETRefX.=" << &vecLx << // slope x change - rad
1147 0 : "CETRefChi2.=" << &vecChi2 << // chi2 (rms in cm)
1148 0 : "CETRefN.=" << &vecN << //number of accepted points
1149 : // // fit in respect per mean per side
1150 0 : "CET0.=" << &vecA0 << // offset change
1151 0 : "CETY.=" << &vecALy << // slope y change - rad
1152 0 : "CETX.=" << &vecALx << // slope x change - rad
1153 0 : "CETChi2.=" << &vecAChi2 ; // chi2 (rms in cm)
1154 0 : }
1155 :
1156 : void AliTPCcalibSummary::ProcessPulserRef(){
1157 : //
1158 : // Get fit of residuals if Pulser in respect with reference
1159 : // data
1160 : //
1161 0 : static TVectorD sec(72);
1162 0 : static TVectorD vec0(72);
1163 0 : static TVectorD vecLy(72);
1164 0 : static TVectorD vecLx(72);
1165 0 : static TVectorD vecChi2(72);
1166 0 : static TVectorD vecN(72);
1167 : //
1168 0 : static TVectorD vecA0(72);
1169 0 : static TVectorD vecALy(72);
1170 0 : static TVectorD vecALx(72);
1171 0 : static TVectorD vecAChi2(72);
1172 : static Bool_t isCalc=kFALSE;
1173 :
1174 0 : TFile f("calPads.root");
1175 0 : TFile fref("calPadsRef.root");
1176 0 : TTree * tree = (TTree*)f.Get("calPads");
1177 0 : TTree * treeRef = (TTree*)fref.Get("calPads");
1178 0 : tree->AddFriend(treeRef,"R");
1179 :
1180 0 : tree->SetAlias("inPulser","(abs(PulserTmean.fElements-PulserTmean_Median)<1.5&&abs(PulserTrms.fElements-PulserTrms_Median)<0.2)"); // outlyerTrms
1181 0 : tree->SetAlias("inPulserR","(abs(R.PulserTmean.fElements-R.PulserTmean_Median)<1.5&&abs(R.PulserTrms.fElements-R.PulserTrms_Median)<0.2)"); // outlyerTrms
1182 : //
1183 0 : if (!isCalc){
1184 : // make fits only once
1185 0 : Double_t chi2=0;
1186 0 : Int_t npoints=0;
1187 0 : TVectorD param;
1188 0 : TMatrixD covar;
1189 0 : tree->SetAlias("dt","PulserTmean.fElements-R.PulserTmean.fElements");
1190 0 : TCut cutAll ="inPulser&&inPulserR";
1191 0 : TString fstringG=""; // global part
1192 0 : fstringG+="ly.fElements++";
1193 0 : fstringG+="(lx.fElements-134.)++";
1194 0 : for (Int_t isec=0; isec<72; isec++){
1195 0 : TStatToolkit::FitPlane(tree,"dt", fstringG.Data(),Form("sector==%d",isec)+cutAll, chi2,npoints,param,covar,-1,0, 10000000, kFALSE);
1196 0 : if (npoints<3) continue;
1197 0 : printf("Setor=%d\n",isec);
1198 0 : vec0[isec]=param[0];
1199 0 : vecLy[isec]=param[1];
1200 0 : vecLx[isec]=param[2];
1201 0 : sec[isec]=isec;
1202 0 : vecN[isec]=npoints;
1203 :
1204 0 : TStatToolkit::FitPlane(tree,"PulserTmean.fElements", fstringG.Data(),Form("sector==%d",isec)+cutAll, chi2,npoints,param,covar,-1,0, 10000000, kFALSE);
1205 0 : if (npoints<3) continue;
1206 0 : printf("Setor=%d\n",isec);
1207 0 : vecA0[isec]=param[0];
1208 0 : vecALy[isec]=param[1];
1209 0 : vecALx[isec]=param[2];
1210 0 : vecAChi2[isec]=TMath::Sqrt(chi2/npoints);
1211 0 : }
1212 :
1213 0 : isCalc=kTRUE;
1214 0 : }
1215 0 : (*fPcstream)<<"dcs"<< // Pulser information
1216 0 : "PulserTSector.=" << &sec << // sector numbers
1217 : // // fit in respect to reference
1218 0 : "PulserTRef0.=" << &vec0 << // offset change
1219 0 : "PulserTRefY.=" << &vecLy << // slope y change - rad
1220 0 : "PulserTRefX.=" << &vecLx << // slope x change - rad
1221 0 : "PulserTRefChi2.=" << &vecChi2 << // chi2 (rms in cm)
1222 0 : "PulserTRefN.=" << &vecN << //number of accepted points
1223 : // // fit in respect per mean per side
1224 0 : "PulserT0.=" << &vecA0 << // offset change
1225 0 : "PulserTY.=" << &vecALy << // slope y change - rad
1226 0 : "PulserTX.=" << &vecALx << // slope x change - rad
1227 0 : "PulserTChi2.=" << &vecAChi2 ; // chi2 (rms in cm)
1228 0 : }
1229 :
1230 : void AliTPCcalibSummary::ProcessCurrent(Int_t irun, Int_t itime){
1231 : //
1232 : // Dump current
1233 : //
1234 : //variables to export
1235 : //
1236 0 : static TObjArray *currentArray=new TObjArray(72); // current graphs
1237 0 : static TObjArray *currentArray2=new TObjArray(72); // current graphs to export
1238 : //
1239 0 : static TVectorD currentIROC(36); // current snapshots
1240 0 : static TVectorD currentOROC(36);
1241 0 : static TVectorF sector(72); //
1242 : static Double_t medcurIROC = 0;
1243 : static Double_t medcurOROC = 0;
1244 : //
1245 0 : static TVectorF minROC(72); // current mean +-5 minutes
1246 0 : static TVectorF maxROC(72);
1247 0 : static TVectorF meanROC(72);
1248 0 : static TVectorF medianROC(72);
1249 : static Double_t meanIIROC=0;
1250 : static Double_t meanIOROC=0;
1251 : static Double_t medianIIROC=0;
1252 : static Double_t medianIOROC=0;
1253 : //
1254 0 : AliDCSSensorArray* voltageArray = AliTPCcalibDB::Instance()->GetVoltageSensors(irun);
1255 : //
1256 0 : for(Int_t j=1; j<36; j++) currentIROC[j-1] = fCalibDB->GetChamberHighVoltage(irun, j,itime,-1,kTRUE);
1257 0 : for(Int_t j=36; j<72; j++) currentOROC[j-36] = fCalibDB->GetChamberHighVoltage(irun, j,itime,-1,kTRUE);
1258 0 : medcurIROC = TMath::Median(36, currentIROC.GetMatrixArray());
1259 0 : medcurOROC = TMath::Median(36, currentOROC.GetMatrixArray());
1260 :
1261 :
1262 0 : if (currentArray->At(0)==0){
1263 0 : for (Int_t isec=0; isec<72; isec++){
1264 0 : TString sensorName="";
1265 0 : const char* sideName=(isec%36<18) ? "A":"C";
1266 0 : if (isec<36){
1267 : //IROC
1268 0 : sensorName=Form("TPC_ANODE_I_%s%02d_IMEAS",sideName,isec%18);
1269 : }else{
1270 : //OROC
1271 0 : sensorName=Form("TPC_ANODE_O_%s%02d_0_IMEAS",sideName,isec%18);
1272 : }
1273 :
1274 : AliDCSSensor *sensor = 0;
1275 0 : if (voltageArray) sensor= voltageArray->GetSensor(sensorName);
1276 : TGraph *gr=0;
1277 0 : if (!sensor) gr=new TGraph(1);
1278 : else{
1279 0 : if (!sensor->GetGraph()) gr=new TGraph(1);
1280 : else{
1281 0 : gr=sensor->GetGraph();
1282 0 : Double_t startTime=sensor->GetStartTime();
1283 0 : Double_t * time = new Double_t[gr->GetN()];
1284 0 : for (Int_t ip=0; ip<gr->GetN(); ip++){ time[ip]= (gr->GetX()[ip]*3600.)+startTime;}
1285 0 : gr=new TGraph(gr->GetN(), time, gr->GetY());
1286 0 : delete [] time;
1287 : }
1288 : }
1289 0 : gr->Sort();
1290 0 : currentArray->AddAt(gr, isec);
1291 0 : currentArray->AddAt(gr->Clone(), isec);
1292 0 : }
1293 0 : }
1294 :
1295 :
1296 0 : for (Int_t isec=0; isec<72; isec++){
1297 0 : sector[isec]=isec;
1298 0 : TGraph * gr = (TGraph*)currentArray->At(isec);
1299 0 : TGraph * graph2 = (TGraph*)currentArray2->At(isec);
1300 0 : Int_t firstBin= TMath::BinarySearch(gr->GetN(), gr->GetX(), itime-300.)-2;
1301 0 : Int_t lastBin= TMath::BinarySearch(gr->GetN(), gr->GetX(), itime+300.)+2;
1302 0 : if (firstBin<0) firstBin=0;
1303 0 : if (lastBin>=gr->GetN()) lastBin=gr->GetN()-1;
1304 : //
1305 0 : if (firstBin<lastBin){
1306 : //
1307 0 : minROC[isec]=TMath::MinElement(lastBin-firstBin, &(gr->GetY()[firstBin]));
1308 0 : maxROC[isec]=TMath::MaxElement(lastBin-firstBin, &(gr->GetY()[firstBin]));
1309 0 : meanROC[isec]=TMath::Mean(lastBin-firstBin, &(gr->GetY()[firstBin]));
1310 0 : medianROC[isec]=TMath::Median(lastBin-firstBin, &(gr->GetY()[firstBin]));
1311 0 : graph2 = new TGraph(lastBin-firstBin, &(gr->GetX()[firstBin]), &(gr->GetY()[firstBin]));
1312 0 : delete currentArray2->At(isec);
1313 0 : currentArray2->AddAt(graph2,isec);
1314 0 : }
1315 0 : (*fPcstream)<<"dcs"<< // current information
1316 0 : Form("current%d.=",isec)<<graph2;
1317 : }
1318 0 : meanIIROC=TMath::Mean(36, &(meanROC.GetMatrixArray()[0]));
1319 0 : meanIOROC=TMath::Mean(36, &(meanROC.GetMatrixArray()[36]));
1320 0 : medianIIROC=TMath::Median(36, &(meanROC.GetMatrixArray()[0]));
1321 0 : medianIOROC=TMath::Median(36, &(meanROC.GetMatrixArray()[36]));
1322 : //
1323 0 : (*fPcstream)<<"dcs"<< // current information
1324 0 : "isec.=" << §or << // sector number
1325 0 : "IIROC.=" << ¤tIROC << // current sample at given moment
1326 0 : "IOROC.=" << ¤tOROC << // current sample at given moment
1327 0 : "medianIIROC=" << medcurIROC << // median at given moment
1328 0 : "medianIOROC=" << medcurOROC << // median at given moment
1329 : //
1330 0 : "minIROC.=" << &minROC << // minimum in +-5 min
1331 0 : "maxIROC.=" << &maxROC << // maximum in +-5 min
1332 0 : "meanIROC.=" << &meanROC << // mean in +-5 min
1333 0 : "medianIROC.=" << &medianROC << // median in +-5 min
1334 0 : "meanIIROC5=" << meanIIROC << // mean current in IROC +-5 minutes
1335 0 : "meanIOROC5=" << meanIOROC << // mean current in OROC
1336 0 : "medianIIROC5=" << medianIIROC << // median current in IROC
1337 0 : "medianIOROC5=" << medianIOROC ; // medianan current in OROC
1338 :
1339 :
1340 0 : (*fPcstream)<<"current"<< // current information
1341 0 : "time=" << itime <<
1342 0 : "isec.=" << §or << // sector number
1343 0 : "IIROC.=" << ¤tIROC << // current sample at given moment
1344 0 : "IOROC.=" << ¤tOROC << // current sample at given moment
1345 0 : "medianIIROC=" << medcurIROC << // median at given moment
1346 0 : "medianIOROC=" << medcurOROC << // median at given moment
1347 : //
1348 0 : "minIROC.=" << &minROC << // minimum in +-5 min
1349 0 : "maxIROC.=" << &maxROC << // maximum in +-5 min
1350 0 : "meanIROC.=" << &meanROC << // mean in +-5 min
1351 0 : "medianIROC.=" << &medianROC << // median in +-5 min
1352 0 : "meanIIROC5=" << meanIIROC << // mean current in IROC +-5 minutes
1353 0 : "meanIOROC5=" << meanIOROC << // mean current in OROC
1354 0 : "medianIIROC5=" << medianIIROC << // median current in IROC
1355 0 : "medianIOROC5=" << medianIOROC << // medianan current in OROC
1356 : "\n";
1357 :
1358 0 : }
1359 :
1360 : void AliTPCcalibSummary::ProcessLHCData(Int_t irun, Int_t itime)
1361 : {
1362 : // itime
1363 0 : static TVectorF vecLHCBckgAlice(AliLHCData::kNBGs);
1364 :
1365 : // ---| fill data if lhcData object exists |---
1366 0 : const AliLHCData *lhcData=GetLHCdata();
1367 :
1368 0 : for (Int_t i=0; i<Int_t(AliLHCData::kNBGs); ++i) {
1369 0 : vecLHCBckgAlice[i]=lhcData?lhcData->GetBckgAlice(i,Double_t(itime)):-1.f;
1370 : }
1371 :
1372 0 : (*fPcstream)<<"dcs"<< // current information
1373 0 : "bckgAlice.=" << &vecLHCBckgAlice;
1374 :
1375 0 : }
1376 :
1377 : void AliTPCcalibSummary::AddMetadataRawQA(TTree * treeRawQATPC){
1378 : //
1379 : // Make Aliases and description for Raw QA trending
1380 : //
1381 0 : treeRawQATPC->SetAlias("isIROC","(Iteration$<36)");
1382 0 : treeRawQATPC->SetAlias("isOROC","(Iteration$>=36)");
1383 0 : treeRawQATPC->SetAlias("occOK0","(occQA.fElements>0)");
1384 0 : treeRawQATPC->SetAlias("occIROC","Sum$(occQA.fElements*(isIROC*occOK0))/Sum$(isIROC*occOK0)");
1385 0 : treeRawQATPC->SetAlias("occOROC","Sum$(occQA.fElements*(isOROC*occOK0))/Sum$(isOROC*occOK0)");
1386 :
1387 0 : TStatToolkit::AddMetadata(treeRawQATPC,"occIROC.AxisTitle","Occupancy IROC ");
1388 0 : TStatToolkit::AddMetadata(treeRawQATPC,"occIROC.Title","Sum$(occQA.fElements*(isIROC*occOK0))/Sum$(isIROC*occOK0)");
1389 0 : TStatToolkit::AddMetadata(treeRawQATPC,"occIROC.Legend","IROC occ.");
1390 0 : TStatToolkit::AddMetadata(treeRawQATPC,"occIROC.Comment","Digits occupancy in IROC #(A>thr)/#All as obtained in AMORE QA");
1391 0 : TStatToolkit::AddMetadata(treeRawQATPC,"occOROC.AxisTitle","Occupancy IROC ");
1392 0 : TStatToolkit::AddMetadata(treeRawQATPC,"occOROC.Title","Sum$(occQA.fElements*(isOROC*occOK0))/Sum$(isOROC*occOK0)");
1393 0 : TStatToolkit::AddMetadata(treeRawQATPC,"occOROC.Legend","OROC occ.");
1394 0 : TStatToolkit::AddMetadata(treeRawQATPC,"occOROC.Comment","Digits occupanncy in OROC #(A>thr)/#All as obtained in AMORE QA");
1395 0 : }
1396 :
1397 : void AliTPCcalibSummary::AddMetadataGain(TTree * treeRawQATPC){
1398 : //
1399 : // Define aliases and valriable description for some important gain calibration parameters
1400 : //
1401 0 : treeRawQATPC->SetAlias("gainDefined","gainMIP!=0&&abs(dits)<1800");
1402 0 : TStatToolkit::AddMetadata(treeRawQATPC,"gainMIP.AxisTitle","gain conversion (50/MIP)");
1403 0 : TStatToolkit::AddMetadata(treeRawQATPC,"gainMIP.Title","gainMIP");
1404 0 : TStatToolkit::AddMetadata(treeRawQATPC,"gainMIP.Legend","gain(t)");
1405 0 : TStatToolkit::AddMetadata(treeRawQATPC,"gainMIP.Comment","Gain normalization coeficient used for time dependenta gain calibation. Last correction to move combined dEdx for MIP to channel 50");
1406 :
1407 0 : }
1408 :
1409 :
1410 : void AliTPCcalibSummary::AddMetadata(TTree * tree){
1411 : //
1412 : // add metadata for automatic documentiation
1413 : //
1414 0 : AddMetadataRawQA(tree);
1415 0 : AddMetadataGain(tree);
1416 :
1417 0 : }
1418 :
1419 : AliLHCData* AliTPCcalibSummary::GetLHCdata()
1420 : {
1421 : static AliCDBEntry *cdbLHCData=0x0;
1422 : static AliLHCData *lhcData=0x0;
1423 :
1424 0 : AliCDBManager *man=AliCDBManager::Instance();
1425 :
1426 : // ===| get LHCData OCDB object |============================================
1427 :
1428 : // ===| check if we already have the latest object |=========================
1429 0 : const Int_t currentRun=man->GetRun();
1430 0 : if (cdbLHCData && cdbLHCData->GetId().GetAliCDBRunRange().Comprises(AliCDBRunRange(currentRun, currentRun))) {
1431 0 : return lhcData;
1432 : }
1433 :
1434 : // ---| if not, load the object |---------------------------------------------
1435 0 : cdbLHCData=man->Get("GRP/GRP/LHCData");
1436 :
1437 0 : if (!cdbLHCData) {
1438 0 : AliError("Could not get LHCData");
1439 0 : return lhcData;
1440 : }
1441 :
1442 0 : lhcData=static_cast<AliLHCData*>(cdbLHCData->GetObject());
1443 0 : return lhcData;
1444 0 : }
1445 :
1446 : void AliTPCcalibSummary::GetAverageLHCData(TVectorF &valsBckgAlice)
1447 : {
1448 : // average Alice background
1449 0 : const AliLHCData *lhcData=GetLHCdata();
1450 0 : valsBckgAlice.ResizeTo(AliLHCData::kNBGs);
1451 :
1452 : // ===| reset to -1 |---
1453 0 : for (Int_t i=0; i<Int_t(AliLHCData::kNBGs); ++i) {
1454 0 : valsBckgAlice[i]=-1.f;
1455 : }
1456 :
1457 : // ===| exit if lhcData does not exist |===
1458 0 : if (!lhcData) {
1459 0 : return;
1460 : }
1461 :
1462 : // ===| build simple average per background estimator |===
1463 0 : for (Int_t ibckg=0; ibckg<Int_t(AliLHCData::kNBGs); ++ibckg) {
1464 0 : const Int_t nValues=lhcData->GetNBckgAlice(ibckg);
1465 0 : if (nValues<=0) { continue; }
1466 : Double_t sum=0.;
1467 0 : for (Int_t ivalue=0; ivalue<nValues; ++ivalue ) {
1468 0 : sum+=lhcData->GetBckgAlice(ibckg,ivalue)->GetValue();
1469 : }
1470 0 : sum/=Double_t(nValues);
1471 0 : valsBckgAlice[ibckg]=sum;
1472 0 : }
1473 :
1474 0 : }
1475 :
1476 : // TCanvas * DrawCEDiff(TTree * tree){
1477 :
1478 : // TCanvas *canvasIO = new TCanvas("canvasCEIO","canvasCEIO");
1479 : // canvasIO->Divide(6,6);
1480 : // for (Int_t isec=0; isec<36; isec++){
1481 : // canvasIO->cd(isec+1);
1482 : // dcs->Draw(Form("CET0.fElements[%d]-CET0.fElements[%d]",isec+36,isec),Form("abs(CETRef0.fElements[%d])<0.3",isec),"");
1483 : // printf("%d\t%f\t%f\n",isec,dcs->GetHistogram()->GetMean(),dcs->GetHistogram()->GetRMS());
1484 : // }
1485 :
1486 : // }
|