1 #if !defined( __CINT__) || defined(__MAKECINT__)
6 #include <TProfile2D.h>
12 #include "AliTestShuttle.h"
13 #include "AliShuttleInterface.h"
14 #include "AliCDBManager.h"
15 #include "AliCDBStorage.h"
16 #include "AliCDBEntry.h"
19 #include "../TRD/AliTRDarrayF.h"
20 #include "../TRD/AliTRDCalibPadStatus.h"
21 #include "../TRD/Cal/AliTRDCalPadStatus.h"
22 #include "../TRD/Cal/AliTRDCalDet.h"
23 #include "../TRD/Cal/AliTRDCalPad.h"
24 #include "../TRD/Cal/AliTRDCalROC.h"
30 void AliTRDCheckPreprocessorold()
33 //gSystem->Load("libTestShuttle.so");
36 AliTestShuttle::SetMainCDB("local://TestCDB");
37 AliTestShuttle::SetMainRefStorage("local://TestReference");
38 printf("Test OCDB storage Uri: %s\n", AliShuttleInterface::GetMainCDB().Data());
39 printf("Test Reference storage Uri: %s\n", AliShuttleInterface::GetMainRefStorage().Data());
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);
50 //Check the reference data
51 //***************************
53 //Test reference data gain HLT
54 //***************************
55 Int_t ErrorRefDataGainHLT = 0;
56 AliCDBEntry* entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainRefStorage())->Get("TRD/HLTData/Gain", 8);
57 if(!entry) ErrorRefDataGainHLT = 1;
59 TH2I *histogainhlt = (TH2I *) entry->GetObject();
60 if(!histogainhlt) ErrorRefDataGainHLT = 2;
62 Int_t NbinsX = histogainhlt->GetNbinsY();
63 if(NbinsX != 540) ErrorRefDataGainHLT = 3;
64 TCanvas *cgainhlt = new TCanvas("cgainhlt","",50,50,600,800);
66 histogainhlt->Draw("LEGO");
71 //Test reference data vdriftt0 HLT
72 //***************************
73 Int_t ErrorRefDataVdriftT0HLT = 0;
74 if(entry) delete entry;
75 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainRefStorage())->Get("TRD/HLTData/VdriftT0", 8);
76 if(!entry) ErrorRefDataVdriftT0HLT = 1;
78 TProfile2D *histovdriftt0hlt = (TProfile2D *) entry->GetObject();
79 if(!histovdriftt0hlt) ErrorRefDataVdriftT0HLT = 2;
81 Int_t NbinsX = histovdriftt0hlt->GetNbinsY();
82 if(NbinsX != 540) ErrorRefDataVdriftT0HLT = 3;
83 TCanvas *cvdrifthlt = new TCanvas("cvdrifthlt","",50,50,600,800);
85 histovdriftt0hlt->Draw("LEGO");
90 //Test reference data PRF HLT
91 //***************************
92 Int_t ErrorRefDataPRFHLT = 0;
93 if(entry) delete entry;
94 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainRefStorage())->Get("TRD/HLTData/PRF", 8);
95 if(!entry) ErrorRefDataPRFHLT = 1;
97 TProfile2D *histoprfhlt = (TProfile2D *) entry->GetObject();
98 if(!histoprfhlt) ErrorRefDataPRFHLT = 2;
100 Int_t NbinsX = histoprfhlt->GetNbinsY();
101 if(NbinsX != 540) ErrorRefDataPRFHLT = 3;
102 TCanvas *cprfhlt = new TCanvas("cprfhlt","",50,50,600,800);
104 histoprfhlt->Draw("LEGO");
109 //Test reference data PadStatus DAQ
110 //***************************
111 Int_t ErrorRefDataPadStatus = 0;
115 for(Int_t k = 0; k < 18; k++){
117 TString padstatus("TRD/DAQData/PadStatus");
120 if(entry) delete entry;
121 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainRefStorage())->Get((const char*)padstatus, 8);
123 AliTRDCalibPadStatus *calpadstatus = (AliTRDCalibPadStatus *) entry->GetObject();
124 if(!calpadstatus) ErrorRefDataPadStatus = 2;
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);
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)
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));
148 TCanvas *cpadstatusm = new TCanvas((const char*)padstatus,(const char*)padstatus,50,50,600,800);
149 cpadstatusm->Divide(3,2);
151 ((TH2F *)calPad1.MakeHisto2DSmPl(k,0,&calDet,0,9.0,11.0,-1))->Draw("colz");
153 ((TH2F *)calPad1.MakeHisto2DSmPl(k,1,&calDet,0,9.0,11.0,-1))->Draw("colz");
155 ((TH2F *)calPad1.MakeHisto2DSmPl(k,2,&calDet,0,9.0,11.0,-1))->Draw("colz");
157 ((TH2F *)calPad1.MakeHisto2DSmPl(k,3,&calDet,0,9.0,11.0,-1))->Draw("colz");
159 ((TH2F *)calPad1.MakeHisto2DSmPl(k,4,&calDet,0,9.0,11.0,-1))->Draw("colz");
161 ((TH2F *)calPad1.MakeHisto2DSmPl(k,5,&calDet,0,9.0,11.0,-1))->Draw("colz");
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");
183 printf("there is %d with Padstatus reference entries\n",nbsm);
184 if(nbsm==0) ErrorRefDataPadStatus = 1;
187 //Test reference data vdriftt0 DAQ
188 //***************************
189 Int_t ErrorRefDataVdriftT0DAQ = 0;
190 if(entry) delete entry;
191 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainRefStorage())->Get("TRD/DAQData/VdriftT0", 8);
192 if(!entry) ErrorRefDataVdriftT0DAQ = 1;
194 TProfile2D *histovdriftt0daq = (TProfile2D *) entry->GetObject();
195 if(!histovdriftt0daq) ErrorRefDataVdriftT0DAQ = 2;
197 Int_t NbinsX = histovdriftt0daq->GetNbinsY();
198 if(NbinsX != 540) ErrorRefDataVdriftT0DAQ = 3;
199 TCanvas *cvdriftdaq = new TCanvas("cvdriftdaq","",50,50,600,800);
201 histovdriftt0daq->Draw("LEGO");
206 //Check the detector OCDB values
207 //********************************
213 AliTRDCalPad *calPad = 0x0;
214 Int_t ErrorGainPad = 0;
215 if(entry) delete entry;
216 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())->Get("TRD/Calib/LocalGainFactor", 8);
217 if(!entry) ErrorGainPad++;
219 calPad = (AliTRDCalPad *) entry->GetObject();
220 if(!calPad) ErrorGainPad++;
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++;
233 Int_t ErrorVdriftPad = 0;
234 if(entry) delete entry;
235 if(calPad) delete calPad;
236 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())->Get("TRD/Calib/LocalVdrift", 8);
237 if(!entry) ErrorVdriftPad++;
239 calPad = (AliTRDCalPad *) entry->GetObject();
240 if(!calPad) ErrorVdriftPad++;
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++;
253 Int_t ErrorT0Pad = 0;
254 if(entry) delete entry;
255 if(calPad) delete calPad;
256 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())->Get("TRD/Calib/LocalT0", 8);
257 if(!entry) ErrorT0Pad++;
259 calPad = (AliTRDCalPad *) entry->GetObject();
260 if(!calPad) ErrorT0Pad++;
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++;
274 Int_t ErrorPRFWidthPad = 0;
275 if(entry) delete entry;
276 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())->Get("TRD/Calib/PRFWidth", 8);
277 if(!entry) ErrorPRFWidthPad++;
279 AliTRDCalPad *calPadPrf = (AliTRDCalPad *) entry->GetObject();
280 if(!calPadPrf) ErrorPRFWidthPad++;
284 for(Int_t plane = 0; plane < 6; plane++){
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;
293 for(Int_t chamber = 0; chamber < 5; chamber++){
294 for(Int_t sector = 0; sector < 18; sector++){
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++;
303 TCanvas *cpadprf = new TCanvas("cpadprf","cpadprf",50,50,600,800);
305 ((TH1F *)calPadPrf->MakeHisto1D(0,0,0.45,0.59,-1))->Draw();
313 Int_t ErrorPadStatusPad = 0;
315 if(entry) delete entry;
316 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())->Get("TRD/Calib/PadStatus", 8);
317 if(!entry) ErrorPadStatusPad++;
319 AliTRDCalPadStatus *calPadStatus = (AliTRDCalPadStatus *) entry->GetObject();
320 if(!calPadStatus) ErrorPadStatusPad++;
322 for(Int_t k = 0; k < 18; k++){
324 TString padstatus("PadStatus");
327 TCanvas *cpadstatus = new TCanvas((const char*)padstatus,(const char*)padstatus,50,50,600,800);
328 cpadstatus->Divide(3,2);
330 ((TH2F *)calPadStatus->MakeHisto2DSmPl(k,0))->Draw("colz");
332 ((TH2F *)calPadStatus->MakeHisto2DSmPl(k,1))->Draw("colz");
334 ((TH2F *)calPadStatus->MakeHisto2DSmPl(k,2))->Draw("colz");
336 ((TH2F *)calPadStatus->MakeHisto2DSmPl(k,3))->Draw("colz");
338 ((TH2F *)calPadStatus->MakeHisto2DSmPl(k,4))->Draw("colz");
340 ((TH2F *)calPadStatus->MakeHisto2DSmPl(k,5))->Draw("colz");
345 //Test for detector values
346 //*************************
350 Int_t ErrorGainDetector = 0;
351 if(entry) delete entry;
352 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())->Get("TRD/Calib/ChamberGainFactor", 8);
353 if(!entry) ErrorGainDetector++;
355 AliTRDCalDet *objectg = (AliTRDCalDet *) entry->GetObject();
356 if(!objectg) ErrorGainDetector++;
358 for(Int_t det = 0; det < 540; det++){
359 if((objectg->GetValue(det)> 2.0) || (objectg->GetValue(det) < 0.0)) ErrorGainDetector++;
361 TCanvas *cdetgain = new TCanvas("cdetgain","",50,50,600,800);
363 ((TH1F *)objectg->MakeHisto1Distribution(0.0,2.0,-1))->Draw();
370 Int_t ErrorVdriftDetector = 0;
371 if(entry) delete entry;
372 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())->Get("TRD/Calib/ChamberVdrift", 8);
373 if(!entry) ErrorVdriftDetector++;
375 AliTRDCalDet *objectv = (AliTRDCalDet *) entry->GetObject();
376 if(!objectv) ErrorVdriftDetector++;
378 for(Int_t det = 0; det < 540; det++){
379 if((objectv->GetValue(det)> 2.5) || (objectv->GetValue(det) < 0.6)) ErrorVdriftDetector++;
381 TCanvas *cdetv = new TCanvas("cdetv","",50,50,600,800);
383 ((TH1F *)objectv->MakeHisto1Distribution(0.6,2.5,-1))->Draw();
390 Int_t ErrorT0Detector = 0;
391 if(entry) delete entry;
392 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())->Get("TRD/Calib/ChamberT0", 8);
393 if(!entry) ErrorT0Detector++;
395 AliTRDCalDet *objectt = (AliTRDCalDet *) entry->GetObject();
396 if(!objectt) ErrorT0Detector++;
398 for(Int_t det = 0; det < 540; det++){
399 if((objectt->GetValue(det)> 1.0) || (objectt->GetValue(det) < -1.0)) ErrorT0Detector++;
401 TCanvas *cdett = new TCanvas("cdett","",50,50,600,800);
403 ((TH1F *)objectt->MakeHisto1Distribution(-0.5,0.5,-1))->Draw();
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);
420 printf("For the chamber t0 there are %d strange values\n",ErrorT0Detector);
421 printf("For the prf width there are %d strange values\n",ErrorPRFWidthPad);
423 if(ErrorPadStatusPad > 0) printf("there is no calPadStatus object\n");
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");
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");
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");
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");
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");