]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/Macros/AliTRDCheckPreprocessor.C
A few mods in the GRP preprocessor (to get some greens finally)
[u/mrichter/AliRoot.git] / TRD / Macros / AliTRDCheckPreprocessor.C
CommitLineData
3a0f6479 1#if !defined( __CINT__) || defined(__MAKECINT__)
2
3
4#include <Riostream.h>
5#include <TSystem.h>
6#include <TProfile2D.h>
7#include <TCanvas.h>
8#include <TH1F.h>
9#include <TH2I.h>
10#include <TStyle.h>
11
12#include "AliTestShuttle.h"
13#include "AliShuttleInterface.h"
14#include "AliCDBManager.h"
15#include "AliCDBStorage.h"
16#include "AliCDBEntry.h"
17
18
19#include "../TRD/AliTRDarrayF.h"
20#include "../TRD/AliTRDCalibPadStatus.h"
21#include "../TRD/Cal/AliTRDCalPadStatus.h"
22#include "../TRD/Cal/AliTRDCalDet.h"
3a0f6479 23#include "../TRD/Cal/AliTRDCalPad.h"
24#include "../TRD/Cal/AliTRDCalROC.h"
25
26
27#endif
28
29
a637a2ff 30void AliTRDCheckPreprocessorold()
9dc84c78 31{
32 // load library
3a0f6479 33 //gSystem->Load("libTestShuttle.so");
34
9dc84c78 35
a637a2ff 36 AliTestShuttle::SetMainCDB("local://TestCDB");
37 AliTestShuttle::SetMainRefStorage("local://TestReference");
3a0f6479 38 printf("Test OCDB storage Uri: %s\n", AliShuttleInterface::GetMainCDB().Data());
39 printf("Test Reference storage Uri: %s\n", AliShuttleInterface::GetMainRefStorage().Data());
9dc84c78 40
3a0f6479 41 //Style
42 //************************
43 gStyle->SetPalette(1);
44 gStyle->SetOptStat(1111);
45 gStyle->SetPadBorderMode(0);
46 gStyle->SetCanvasColor(10);
47 gStyle->SetPadLeftMargin(0.13);
48 gStyle->SetPadRightMargin(0.13);
9dc84c78 49
50 //Check the reference data
51 //***************************
52
3a0f6479 53 //Test reference data gain HLT
9dc84c78 54 //***************************
3a0f6479 55 Int_t ErrorRefDataGainHLT = 0;
6ace5fe2 56 AliCDBEntry* entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainRefStorage())->Get("TRD/HLTData/Gain", 8);
3a0f6479 57 if(!entry) ErrorRefDataGainHLT = 1;
9dc84c78 58 else{
3a0f6479 59 TH2I *histogainhlt = (TH2I *) entry->GetObject();
60 if(!histogainhlt) ErrorRefDataGainHLT = 2;
9dc84c78 61 else{
3a0f6479 62 Int_t NbinsX = histogainhlt->GetNbinsY();
63 if(NbinsX != 540) ErrorRefDataGainHLT = 3;
64 TCanvas *cgainhlt = new TCanvas("cgainhlt","",50,50,600,800);
65 cgainhlt->cd();
66 histogainhlt->Draw("LEGO");
9dc84c78 67 }
68 }
69
70
3a0f6479 71 //Test reference data vdriftt0 HLT
9dc84c78 72 //***************************
3a0f6479 73 Int_t ErrorRefDataVdriftT0HLT = 0;
74 if(entry) delete entry;
6ace5fe2 75 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainRefStorage())->Get("TRD/HLTData/VdriftT0", 8);
3a0f6479 76 if(!entry) ErrorRefDataVdriftT0HLT = 1;
9dc84c78 77 else{
3a0f6479 78 TProfile2D *histovdriftt0hlt = (TProfile2D *) entry->GetObject();
79 if(!histovdriftt0hlt) ErrorRefDataVdriftT0HLT = 2;
9dc84c78 80 else{
3a0f6479 81 Int_t NbinsX = histovdriftt0hlt->GetNbinsY();
82 if(NbinsX != 540) ErrorRefDataVdriftT0HLT = 3;
83 TCanvas *cvdrifthlt = new TCanvas("cvdrifthlt","",50,50,600,800);
84 cvdrifthlt->cd();
85 histovdriftt0hlt->Draw("LEGO");
9dc84c78 86 }
87 }
88
89
3a0f6479 90 //Test reference data PRF HLT
9dc84c78 91 //***************************
3a0f6479 92 Int_t ErrorRefDataPRFHLT = 0;
93 if(entry) delete entry;
6ace5fe2 94 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainRefStorage())->Get("TRD/HLTData/PRF", 8);
3a0f6479 95 if(!entry) ErrorRefDataPRFHLT = 1;
9dc84c78 96 else{
3a0f6479 97 TProfile2D *histoprfhlt = (TProfile2D *) entry->GetObject();
98 if(!histoprfhlt) ErrorRefDataPRFHLT = 2;
9dc84c78 99 else{
3a0f6479 100 Int_t NbinsX = histoprfhlt->GetNbinsY();
101 if(NbinsX != 540) ErrorRefDataPRFHLT = 3;
102 TCanvas *cprfhlt = new TCanvas("cprfhlt","",50,50,600,800);
103 cprfhlt->cd();
104 histoprfhlt->Draw("LEGO");
9dc84c78 105 }
106 }
107
108
3a0f6479 109 //Test reference data PadStatus DAQ
110 //***************************
111 Int_t ErrorRefDataPadStatus = 0;
3a0f6479 112
6ace5fe2 113 Int_t nbsm = 0;
114
115 for(Int_t k = 0; k < 18; k++){
116
117 TString padstatus("TRD/DAQData/PadStatus");
118 padstatus += k;
119
120 if(entry) delete entry;
121 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainRefStorage())->Get((const char*)padstatus, 8);
122 if(entry){
123 AliTRDCalibPadStatus *calpadstatus = (AliTRDCalibPadStatus *) entry->GetObject();
124 if(!calpadstatus) ErrorRefDataPadStatus = 2;
125 else{
126 //Make the AliTRDCalDet correspondant
127 AliTRDCalDet calDet = AliTRDCalDet("dummy","dummy for mean");
128 for(Int_t l = 0; l < 540; l++){
129 calDet.SetValue(l,10.0);
130 }
131
132 //Make the AliTRDCalPad correspondant
133 AliTRDCalPad calPad1 = AliTRDCalPad("meanpad","dummy for mean");
134 AliTRDCalPad calPad2 = AliTRDCalPad("squarespad","dummy for squares");
135 AliTRDCalROC *calROC1 = 0x0;
136 AliTRDCalROC *calROC2 = 0x0;
137 for (Int_t det=0; det<AliTRDgeometry::kNdet; ++det)
138 {
139 AliTRDCalROC *calROC11 = calPad1.GetCalROC(det);
140 AliTRDCalROC *calROC22 = calPad2.GetCalROC(det);
141 calROC1 = calpadstatus->GetCalRocMean(det,kTRUE);
142 calROC2 = calpadstatus->GetCalRocRMS(det,kTRUE);
143 for(Int_t k = 0; k < calROC22->GetNchannels(); k++){
144 calROC11->SetValue(k,calROC1->GetValue(k));
145 calROC22->SetValue(k,calROC2->GetValue(k));
146 }
147 }
148 TCanvas *cpadstatusm = new TCanvas((const char*)padstatus,(const char*)padstatus,50,50,600,800);
149 cpadstatusm->Divide(3,2);
150 cpadstatusm->cd(1);
151 ((TH2F *)calPad1.MakeHisto2DSmPl(k,0,&calDet,0,9.0,11.0,-1))->Draw("colz");
152 cpadstatusm->cd(2);
153 ((TH2F *)calPad1.MakeHisto2DSmPl(k,1,&calDet,0,9.0,11.0,-1))->Draw("colz");
154 cpadstatusm->cd(3);
155 ((TH2F *)calPad1.MakeHisto2DSmPl(k,2,&calDet,0,9.0,11.0,-1))->Draw("colz");
156 cpadstatusm->cd(4);
157 ((TH2F *)calPad1.MakeHisto2DSmPl(k,3,&calDet,0,9.0,11.0,-1))->Draw("colz");
158 cpadstatusm->cd(5);
159 ((TH2F *)calPad1.MakeHisto2DSmPl(k,4,&calDet,0,9.0,11.0,-1))->Draw("colz");
160 cpadstatusm->cd(6);
161 ((TH2F *)calPad1.MakeHisto2DSmPl(k,5,&calDet,0,9.0,11.0,-1))->Draw("colz");
162
163 padstatus += 1982;
164
165 TCanvas *cpadstatusrms = new TCanvas((const char*)padstatus,(const char*)padstatus,50,50,600,800);
166 cpadstatusrms->Divide(3,2);
167 cpadstatusrms->cd(1);
168 ((TH2F *)calPad2.MakeHisto2DSmPl(k,0,&calDet,0,0.2,2.0,-1))->Draw("colz");
169 cpadstatusrms->cd(2);
170 ((TH2F *)calPad2.MakeHisto2DSmPl(k,1,&calDet,0,0.2,2.0,-1))->Draw("colz");
171 cpadstatusrms->cd(3);
172 ((TH2F *)calPad2.MakeHisto2DSmPl(k,2,&calDet,0,0.2,2.0,-1))->Draw("colz");
173 cpadstatusrms->cd(4);
174 ((TH2F *)calPad2.MakeHisto2DSmPl(k,3,&calDet,0,0.2,2.0,-1))->Draw("colz");
175 cpadstatusrms->cd(5);
176 ((TH2F *)calPad2.MakeHisto2DSmPl(k,4,&calDet,0,0.2,2.0,-1))->Draw("colz");
177 cpadstatusrms->cd(6);
178 ((TH2F *)calPad2.MakeHisto2DSmPl(k,5,&calDet,0,0.2,2.0,-1))->Draw("colz");
179 nbsm++;
3a0f6479 180 }
181 }
3a0f6479 182 }
6ace5fe2 183 printf("there is %d with Padstatus reference entries\n",nbsm);
184 if(nbsm==0) ErrorRefDataPadStatus = 1;
185
3a0f6479 186
187 //Test reference data vdriftt0 DAQ
188 //***************************
189 Int_t ErrorRefDataVdriftT0DAQ = 0;
190 if(entry) delete entry;
6ace5fe2 191 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainRefStorage())->Get("TRD/DAQData/VdriftT0", 8);
3a0f6479 192 if(!entry) ErrorRefDataVdriftT0DAQ = 1;
193 else{
194 TProfile2D *histovdriftt0daq = (TProfile2D *) entry->GetObject();
195 if(!histovdriftt0daq) ErrorRefDataVdriftT0DAQ = 2;
196 else{
197 Int_t NbinsX = histovdriftt0daq->GetNbinsY();
198 if(NbinsX != 540) ErrorRefDataVdriftT0DAQ = 3;
199 TCanvas *cvdriftdaq = new TCanvas("cvdriftdaq","",50,50,600,800);
200 cvdriftdaq->cd();
201 histovdriftt0daq->Draw("LEGO");
202 }
203 }
204
205
9dc84c78 206 //Check the detector OCDB values
207 //********************************
208
209 //Test for pads
210 //******************
211 //Gain
212 //*****
3a0f6479 213 AliTRDCalPad *calPad = 0x0;
9dc84c78 214 Int_t ErrorGainPad = 0;
3a0f6479 215 if(entry) delete entry;
6ace5fe2 216 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())->Get("TRD/Calib/LocalGainFactor", 8);
3a0f6479 217 if(!entry) ErrorGainPad++;
218 else{
219 calPad = (AliTRDCalPad *) entry->GetObject();
220 if(!calPad) ErrorGainPad++;
221 else{
222 for(Int_t det = 0; det < 540; det++){
223 AliTRDCalROC *calROC = calPad->GetCalROC(det);
224 for(Int_t channel =0; channel < calROC->GetNchannels(); channel++){
225 if(calROC->GetValue(channel) != 1.0) ErrorGainPad++;
226 }//channel loop
227 }//det loop
228 }
229 }
9dc84c78 230
231 //Vdrift
232 //*****
233 Int_t ErrorVdriftPad = 0;
3a0f6479 234 if(entry) delete entry;
235 if(calPad) delete calPad;
6ace5fe2 236 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())->Get("TRD/Calib/LocalVdrift", 8);
3a0f6479 237 if(!entry) ErrorVdriftPad++;
238 else{
239 calPad = (AliTRDCalPad *) entry->GetObject();
240 if(!calPad) ErrorVdriftPad++;
241 else{
242 for(Int_t det = 0; det < 540; det++){
243 AliTRDCalROC *calROC = calPad->GetCalROC(det);
244 for(Int_t channel =0; channel < calROC->GetNchannels(); channel++){
245 if(calROC->GetValue(channel) != 1.0) ErrorVdriftPad++;
246 }//channel loop
247 }//det loop
248 }
249 }
250
251 //T0
252 //*****
253 Int_t ErrorT0Pad = 0;
254 if(entry) delete entry;
255 if(calPad) delete calPad;
6ace5fe2 256 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())->Get("TRD/Calib/LocalT0", 8);
3a0f6479 257 if(!entry) ErrorT0Pad++;
258 else{
259 calPad = (AliTRDCalPad *) entry->GetObject();
260 if(!calPad) ErrorT0Pad++;
261 else{
262 for(Int_t det = 0; det < 540; det++){
263 AliTRDCalROC *calROC = calPad->GetCalROC(det);
264 for(Int_t channel =0; channel < calROC->GetNchannels(); channel++){
265 if(calROC->GetValue(channel) != 0.0) ErrorT0Pad++;
266 }//channel loop
267 }//det loop
268 }
269 }
9dc84c78 270
9dc84c78 271
9dc84c78 272 //PRFWidth
273 //********
274 Int_t ErrorPRFWidthPad = 0;
3a0f6479 275 if(entry) delete entry;
6ace5fe2 276 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())->Get("TRD/Calib/PRFWidth", 8);
3a0f6479 277 if(!entry) ErrorPRFWidthPad++;
278 else{
279 AliTRDCalPad *calPadPrf = (AliTRDCalPad *) entry->GetObject();
280 if(!calPadPrf) ErrorPRFWidthPad++;
281 else{
282 Float_t value = 0.0;
283
284 for(Int_t plane = 0; plane < 6; plane++){
285
286 if(plane == 0) value = 0.515;
287 if(plane == 1) value = 0.502;
288 if(plane == 2) value = 0.491;
289 if(plane == 3) value = 0.481;
290 if(plane == 4) value = 0.471;
291 if(plane == 5) value = 0.463;
292
293 for(Int_t chamber = 0; chamber < 5; chamber++){
294 for(Int_t sector = 0; sector < 18; sector++){
295
296 AliTRDCalROC *calROC = calPadPrf->GetCalROC(plane,chamber,sector);
297 for(Int_t channel =0; channel < calROC->GetNchannels(); channel++){
298 if((calROC->GetValue(channel) > 1.25*value) || (calROC->GetValue(channel) < 0.8*value)) ErrorPRFWidthPad++;
299 }//channel loop
300 }//sector loop
301 }//chamber loop
302 }//plane loop
303 TCanvas *cpadprf = new TCanvas("cpadprf","cpadprf",50,50,600,800);
304 cpadprf->cd();
a637a2ff 305 ((TH1F *)calPadPrf->MakeHisto1D(0,0,0.45,0.59,-1))->Draw();
3a0f6479 306 }
307 }
308
9dc84c78 309
3a0f6479 310
311 //Padstatus
312 //********
313 Int_t ErrorPadStatusPad = 0;
6ace5fe2 314
3a0f6479 315 if(entry) delete entry;
6ace5fe2 316 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())->Get("TRD/Calib/PadStatus", 8);
3a0f6479 317 if(!entry) ErrorPadStatusPad++;
318 else{
319 AliTRDCalPadStatus *calPadStatus = (AliTRDCalPadStatus *) entry->GetObject();
320 if(!calPadStatus) ErrorPadStatusPad++;
321 else{
6ace5fe2 322 for(Int_t k = 0; k < 18; k++){
323
324 TString padstatus("PadStatus");
325 padstatus += k;
326
327 TCanvas *cpadstatus = new TCanvas((const char*)padstatus,(const char*)padstatus,50,50,600,800);
328 cpadstatus->Divide(3,2);
329 cpadstatus->cd(1);
330 ((TH2F *)calPadStatus->MakeHisto2DSmPl(k,0))->Draw("colz");
331 cpadstatus->cd(2);
332 ((TH2F *)calPadStatus->MakeHisto2DSmPl(k,1))->Draw("colz");
333 cpadstatus->cd(3);
334 ((TH2F *)calPadStatus->MakeHisto2DSmPl(k,2))->Draw("colz");
335 cpadstatus->cd(4);
336 ((TH2F *)calPadStatus->MakeHisto2DSmPl(k,3))->Draw("colz");
337 cpadstatus->cd(5);
338 ((TH2F *)calPadStatus->MakeHisto2DSmPl(k,4))->Draw("colz");
339 cpadstatus->cd(6);
340 ((TH2F *)calPadStatus->MakeHisto2DSmPl(k,5))->Draw("colz");
341 }
3a0f6479 342 }
343 }
9dc84c78 344
345 //Test for detector values
346 //*************************
347
348 //Gain
349 //******
350 Int_t ErrorGainDetector = 0;
3a0f6479 351 if(entry) delete entry;
6ace5fe2 352 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())->Get("TRD/Calib/ChamberGainFactor", 8);
3a0f6479 353 if(!entry) ErrorGainDetector++;
354 else{
355 AliTRDCalDet *objectg = (AliTRDCalDet *) entry->GetObject();
356 if(!objectg) ErrorGainDetector++;
357 else{
358 for(Int_t det = 0; det < 540; det++){
359 if((objectg->GetValue(det)> 2.0) || (objectg->GetValue(det) < 0.0)) ErrorGainDetector++;
360 }
361 TCanvas *cdetgain = new TCanvas("cdetgain","",50,50,600,800);
362 cdetgain->cd();
363 ((TH1F *)objectg->MakeHisto1Distribution(0.0,2.0,-1))->Draw();
364 }
9dc84c78 365 }
3a0f6479 366
9dc84c78 367
368 //Vdrift
369 //******
370 Int_t ErrorVdriftDetector = 0;
3a0f6479 371 if(entry) delete entry;
6ace5fe2 372 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())->Get("TRD/Calib/ChamberVdrift", 8);
3a0f6479 373 if(!entry) ErrorVdriftDetector++;
374 else{
375 AliTRDCalDet *objectv = (AliTRDCalDet *) entry->GetObject();
376 if(!objectv) ErrorVdriftDetector++;
377 else{
378 for(Int_t det = 0; det < 540; det++){
379 if((objectv->GetValue(det)> 2.5) || (objectv->GetValue(det) < 0.6)) ErrorVdriftDetector++;
380 }
381 TCanvas *cdetv = new TCanvas("cdetv","",50,50,600,800);
382 cdetv->cd();
383 ((TH1F *)objectv->MakeHisto1Distribution(0.6,2.5,-1))->Draw();
384 }
385 }
386
387
388 //T0
389 //******
390 Int_t ErrorT0Detector = 0;
391 if(entry) delete entry;
6ace5fe2 392 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())->Get("TRD/Calib/ChamberT0", 8);
3a0f6479 393 if(!entry) ErrorT0Detector++;
394 else{
395 AliTRDCalDet *objectt = (AliTRDCalDet *) entry->GetObject();
396 if(!objectt) ErrorT0Detector++;
397 else{
398 for(Int_t det = 0; det < 540; det++){
399 if((objectt->GetValue(det)> 1.0) || (objectt->GetValue(det) < -1.0)) ErrorT0Detector++;
400 }
401 TCanvas *cdett = new TCanvas("cdett","",50,50,600,800);
402 cdett->cd();
403 ((TH1F *)objectt->MakeHisto1Distribution(-0.5,0.5,-1))->Draw();
404 }
9dc84c78 405 }
406
407
408
9dc84c78 409 //Bilan
410 //**************
411
412 //OCDB values
413 //************
414
415 printf("For the local gain factor there are %d strange values\n",ErrorGainPad);
416 printf("For the local vdrift there are %d strange values\n",ErrorVdriftPad);
417 printf("For the local t0 there are %d strange values\n",ErrorT0Pad);
418 printf("For the chamber gain factor there are %d strange values\n",ErrorGainDetector);
419 printf("For the chamber vdrift there are %d strange values\n",ErrorVdriftDetector);
3a0f6479 420 printf("For the chamber t0 there are %d strange values\n",ErrorT0Detector);
9dc84c78 421 printf("For the prf width there are %d strange values\n",ErrorPRFWidthPad);
a637a2ff 422
3a0f6479 423 if(ErrorPadStatusPad > 0) printf("there is no calPadStatus object\n");
9dc84c78 424
425
426 //Reference data
427 //****************
3a0f6479 428
429 //gain HLT
9dc84c78 430
3a0f6479 431 if(ErrorRefDataGainHLT == 1) printf("There is no reference data entry for the gain HLT!\n");
432 if(ErrorRefDataGainHLT == 2) printf("There is no reference data histogram for the gain HLT!\n");
433 if(ErrorRefDataGainHLT == 3) printf("The reference data histogram has not the good number of Xbins for the gain HLT!\n");
434 // vdrift HLT
435
436 if(ErrorRefDataVdriftT0HLT == 1) printf("There is no reference data entry for the vdriftt0 HLT!\n");
437 if(ErrorRefDataVdriftT0HLT == 2) printf("There is no reference data histogram for the vdriftt0 HLT!\n");
438 if(ErrorRefDataVdriftT0HLT == 3) printf("The reference data profile has not the good number of Xbins for the gain HLT!\n");
9dc84c78 439
3a0f6479 440 // prf HLT
441 if(ErrorRefDataPRFHLT == 1) printf("There is no reference data entry for the prf HLT!\n");
442 if(ErrorRefDataPRFHLT == 2) printf("There is no reference data profile for the prf HLT!\n");
443 if(ErrorRefDataPRFHLT == 3) printf("The reference data profile has not the good number of Xbins for the prf HLT!\n");
9dc84c78 444
3a0f6479 445 // vdrift DAQ
446
447 if(ErrorRefDataVdriftT0DAQ == 1) printf("There is no reference data entry for the vdriftt0 DAQ!\n");
448 if(ErrorRefDataVdriftT0DAQ == 2) printf("There is no reference data histogram for the vdriftt0 DAQ!\n");
449 if(ErrorRefDataVdriftT0DAQ == 3) printf("The reference data profile has not the good number of Xbins for the gain DAQ!\n");
450
451
452 // PadStatus DAQ
453
454 if(ErrorRefDataPadStatus == 1) printf("There is no reference data entry for the pad status DAQ!\n");
455 if(ErrorRefDataPadStatus == 2) printf("There is no reference data object for pad status DAQ!\n");
9dc84c78 456
457
458}