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/AliTRDCalSm.h"
24 #include "../TRD/Cal/AliTRDCalPad.h"
25 #include "../TRD/Cal/AliTRDCalROC.h"
31 void AliTRDCheckPreprocessor()
34 //gSystem->Load("libTestShuttle.so");
37 AliTestShuttle::SetMainCDB("local://TestCDB_New");
38 AliTestShuttle::SetMainRefStorage("local://TestReference_New");
39 printf("Test OCDB storage Uri: %s\n", AliShuttleInterface::GetMainCDB().Data());
40 printf("Test Reference storage Uri: %s\n", AliShuttleInterface::GetMainRefStorage().Data());
43 //************************
44 gStyle->SetPalette(1);
45 gStyle->SetOptStat(1111);
46 gStyle->SetPadBorderMode(0);
47 gStyle->SetCanvasColor(10);
48 gStyle->SetPadLeftMargin(0.13);
49 gStyle->SetPadRightMargin(0.13);
51 //Check the reference data
52 //***************************
54 //Test reference data gain HLT
55 //***************************
56 Int_t ErrorRefDataGainHLT = 0;
57 AliCDBEntry* entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainRefStorage())->Get("TRD/HLTData/Gain", 9);
58 if(!entry) ErrorRefDataGainHLT = 1;
60 TH2I *histogainhlt = (TH2I *) entry->GetObject();
61 if(!histogainhlt) ErrorRefDataGainHLT = 2;
63 Int_t NbinsX = histogainhlt->GetNbinsY();
64 if(NbinsX != 540) ErrorRefDataGainHLT = 3;
65 TCanvas *cgainhlt = new TCanvas("cgainhlt","",50,50,600,800);
67 histogainhlt->Draw("LEGO");
72 //Test reference data vdriftt0 HLT
73 //***************************
74 Int_t ErrorRefDataVdriftT0HLT = 0;
75 if(entry) delete entry;
76 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainRefStorage())->Get("TRD/HLTData/VdriftT0", 9);
77 if(!entry) ErrorRefDataVdriftT0HLT = 1;
79 TProfile2D *histovdriftt0hlt = (TProfile2D *) entry->GetObject();
80 if(!histovdriftt0hlt) ErrorRefDataVdriftT0HLT = 2;
82 Int_t NbinsX = histovdriftt0hlt->GetNbinsY();
83 if(NbinsX != 540) ErrorRefDataVdriftT0HLT = 3;
84 TCanvas *cvdrifthlt = new TCanvas("cvdrifthlt","",50,50,600,800);
86 histovdriftt0hlt->Draw("LEGO");
91 //Test reference data PRF HLT
92 //***************************
93 Int_t ErrorRefDataPRFHLT = 0;
94 if(entry) delete entry;
95 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainRefStorage())->Get("TRD/HLTData/PRF", 9);
96 if(!entry) ErrorRefDataPRFHLT = 1;
98 TProfile2D *histoprfhlt = (TProfile2D *) entry->GetObject();
99 if(!histoprfhlt) ErrorRefDataPRFHLT = 2;
101 Int_t NbinsX = histoprfhlt->GetNbinsY();
102 if(NbinsX != 540) ErrorRefDataPRFHLT = 3;
103 TCanvas *cprfhlt = new TCanvas("cprfhlt","",50,50,600,800);
105 histoprfhlt->Draw("LEGO");
110 //Test reference data PadStatus DAQ
111 //***************************
112 Int_t ErrorRefDataPadStatus = 0;
113 if(entry) delete entry;
114 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainRefStorage())->Get("TRD/DAQData/PadStatus", 9);
115 if(!entry) ErrorRefDataPadStatus = 1;
117 AliTRDCalibPadStatus *calpadstatus = (AliTRDCalibPadStatus *) entry->GetObject();
118 if(!calpadstatus) ErrorRefDataPadStatus = 2;
120 //Make the AliTRDCalDet correspondant
121 AliTRDCalDet *calDet = new AliTRDCalDet("dummy","dummy for mean");
122 for(Int_t k = 0; k < 540; k++){
123 calDet->SetValue(k,10.0);
126 //Make the AliTRDCalPad correspondant
127 AliTRDCalPad *calPad1 = new AliTRDCalPad("meanpad","dummy for mean");
128 AliTRDCalPad *calPad2 = new AliTRDCalPad("squarespad","dummy for squares");
129 AliTRDCalROC *calROC1 = 0x0;
130 AliTRDCalROC *calROC2 = 0x0;
131 for (Int_t det=0; det<AliTRDgeometry::kNdet; ++det)
133 AliTRDCalROC *calROC11 = calPad1->GetCalROC(det);
134 AliTRDCalROC *calROC22 = calPad2->GetCalROC(det);
135 calROC1 = calpadstatus->GetCalRocMean(det,kTRUE);
136 calROC2 = calpadstatus->GetCalRocRMS(det,kTRUE);
137 for(Int_t k = 0; k < calROC22->GetNchannels(); k++){
138 calROC11->SetValue(k,calROC1->GetValue(k));
139 calROC22->SetValue(k,calROC2->GetValue(k));
142 TCanvas *cpadstatusm = new TCanvas("cpadstatusm","cpadstatusm",50,50,600,800);
143 cpadstatusm->Divide(3,2);
145 ((TH2F *)calPad1->MakeHisto2DSmPl(1,0,calDet,0,9.0,11.0,-1))->Draw("colz");
147 ((TH2F *)calPad1->MakeHisto2DSmPl(1,1,calDet,0,9.0,11.0,-1))->Draw("colz");
149 ((TH2F *)calPad1->MakeHisto2DSmPl(1,2,calDet,0,9.0,11.0,-1))->Draw("colz");
151 ((TH2F *)calPad1->MakeHisto2DSmPl(1,3,calDet,0,9.0,11.0,-1))->Draw("colz");
153 ((TH2F *)calPad1->MakeHisto2DSmPl(1,4,calDet,0,9.0,11.0,-1))->Draw("colz");
155 ((TH2F *)calPad1->MakeHisto2DSmPl(1,5,calDet,0,9.0,11.0,-1))->Draw("colz");
157 TCanvas *cpadstatusrms = new TCanvas("cpadstatusrrms","cpadstatusrms",50,50,600,800);
158 cpadstatusrms->Divide(3,2);
159 cpadstatusrms->cd(1);
160 ((TH2F *)calPad2->MakeHisto2DSmPl(1,0,calDet,0,0.2,2.0,-1))->Draw("colz");
161 cpadstatusrms->cd(2);
162 ((TH2F *)calPad2->MakeHisto2DSmPl(1,1,calDet,0,0.2,2.0,-1))->Draw("colz");
163 cpadstatusrms->cd(3);
164 ((TH2F *)calPad2->MakeHisto2DSmPl(1,2,calDet,0,0.2,2.0,-1))->Draw("colz");
165 cpadstatusrms->cd(4);
166 ((TH2F *)calPad2->MakeHisto2DSmPl(1,3,calDet,0,0.2,2.0,-1))->Draw("colz");
167 cpadstatusrms->cd(5);
168 ((TH2F *)calPad2->MakeHisto2DSmPl(1,4,calDet,0,0.2,2.0,-1))->Draw("colz");
169 cpadstatusrms->cd(6);
170 ((TH2F *)calPad2->MakeHisto2DSmPl(1,5,calDet,0,0.2,2.0,-1))->Draw("colz");
174 //Test reference data vdriftt0 DAQ
175 //***************************
176 Int_t ErrorRefDataVdriftT0DAQ = 0;
177 if(entry) delete entry;
178 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainRefStorage())->Get("TRD/DAQData/VdriftT0", 9);
179 if(!entry) ErrorRefDataVdriftT0DAQ = 1;
181 TProfile2D *histovdriftt0daq = (TProfile2D *) entry->GetObject();
182 if(!histovdriftt0daq) ErrorRefDataVdriftT0DAQ = 2;
184 Int_t NbinsX = histovdriftt0daq->GetNbinsY();
185 if(NbinsX != 540) ErrorRefDataVdriftT0DAQ = 3;
186 TCanvas *cvdriftdaq = new TCanvas("cvdriftdaq","",50,50,600,800);
188 histovdriftt0daq->Draw("LEGO");
193 //Check the detector OCDB values
194 //********************************
200 AliTRDCalPad *calPad = 0x0;
201 Int_t ErrorGainPad = 0;
202 if(entry) delete entry;
203 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())->Get("TRD/Calib/LocalGainFactor", 9);
204 if(!entry) ErrorGainPad++;
206 calPad = (AliTRDCalPad *) entry->GetObject();
207 if(!calPad) ErrorGainPad++;
209 for(Int_t det = 0; det < 540; det++){
210 AliTRDCalROC *calROC = calPad->GetCalROC(det);
211 for(Int_t channel =0; channel < calROC->GetNchannels(); channel++){
212 if(calROC->GetValue(channel) != 1.0) ErrorGainPad++;
220 Int_t ErrorVdriftPad = 0;
221 if(entry) delete entry;
222 if(calPad) delete calPad;
223 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())->Get("TRD/Calib/LocalVdrift", 9);
224 if(!entry) ErrorVdriftPad++;
226 calPad = (AliTRDCalPad *) entry->GetObject();
227 if(!calPad) ErrorVdriftPad++;
229 for(Int_t det = 0; det < 540; det++){
230 AliTRDCalROC *calROC = calPad->GetCalROC(det);
231 for(Int_t channel =0; channel < calROC->GetNchannels(); channel++){
232 if(calROC->GetValue(channel) != 1.0) ErrorVdriftPad++;
240 Int_t ErrorT0Pad = 0;
241 if(entry) delete entry;
242 if(calPad) delete calPad;
243 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())->Get("TRD/Calib/LocalT0", 9);
244 if(!entry) ErrorT0Pad++;
246 calPad = (AliTRDCalPad *) entry->GetObject();
247 if(!calPad) ErrorT0Pad++;
249 for(Int_t det = 0; det < 540; det++){
250 AliTRDCalROC *calROC = calPad->GetCalROC(det);
251 for(Int_t channel =0; channel < calROC->GetNchannels(); channel++){
252 if(calROC->GetValue(channel) != 0.0) ErrorT0Pad++;
261 Int_t ErrorPRFWidthPad = 0;
262 if(entry) delete entry;
263 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())->Get("TRD/Calib/PRFWidth", 9);
264 if(!entry) ErrorPRFWidthPad++;
266 AliTRDCalPad *calPadPrf = (AliTRDCalPad *) entry->GetObject();
267 if(!calPadPrf) ErrorPRFWidthPad++;
271 for(Int_t plane = 0; plane < 6; plane++){
273 if(plane == 0) value = 0.515;
274 if(plane == 1) value = 0.502;
275 if(plane == 2) value = 0.491;
276 if(plane == 3) value = 0.481;
277 if(plane == 4) value = 0.471;
278 if(plane == 5) value = 0.463;
280 for(Int_t chamber = 0; chamber < 5; chamber++){
281 for(Int_t sector = 0; sector < 18; sector++){
283 AliTRDCalROC *calROC = calPadPrf->GetCalROC(plane,chamber,sector);
284 for(Int_t channel =0; channel < calROC->GetNchannels(); channel++){
285 if((calROC->GetValue(channel) > 1.25*value) || (calROC->GetValue(channel) < 0.8*value)) ErrorPRFWidthPad++;
290 TCanvas *cpadprf = new TCanvas("cpadprf","cpadprf",50,50,600,800);
292 ((TH1F *)calPadPrf->MakeHisto1D(0,0,0.45,0.58,-1))->Draw();
300 Int_t ErrorPadStatusPad = 0;
301 if(entry) delete entry;
302 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())->Get("TRD/Calib/PadStatus", 9);
303 if(!entry) ErrorPadStatusPad++;
305 AliTRDCalPadStatus *calPadStatus = (AliTRDCalPadStatus *) entry->GetObject();
306 if(!calPadStatus) ErrorPadStatusPad++;
308 TCanvas *cpadstatus = new TCanvas("cpadstatus","cpadstatus",50,50,600,800);
309 cpadstatus->Divide(3,2);
311 ((TH2F *)calPadStatus->MakeHisto2DSmPl(1,0))->Draw("colz");
313 ((TH2F *)calPadStatus->MakeHisto2DSmPl(1,1))->Draw("colz");
315 ((TH2F *)calPadStatus->MakeHisto2DSmPl(1,2))->Draw("colz");
317 ((TH2F *)calPadStatus->MakeHisto2DSmPl(1,3))->Draw("colz");
319 ((TH2F *)calPadStatus->MakeHisto2DSmPl(1,4))->Draw("colz");
321 ((TH2F *)calPadStatus->MakeHisto2DSmPl(1,5))->Draw("colz");
325 //Test for detector values
326 //*************************
330 Int_t ErrorGainDetector = 0;
331 if(entry) delete entry;
332 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())->Get("TRD/Calib/ChamberGainFactor", 9);
333 if(!entry) ErrorGainDetector++;
335 AliTRDCalDet *objectg = (AliTRDCalDet *) entry->GetObject();
336 if(!objectg) ErrorGainDetector++;
338 for(Int_t det = 0; det < 540; det++){
339 if((objectg->GetValue(det)> 2.0) || (objectg->GetValue(det) < 0.0)) ErrorGainDetector++;
341 TCanvas *cdetgain = new TCanvas("cdetgain","",50,50,600,800);
343 ((TH1F *)objectg->MakeHisto1Distribution(0.0,2.0,-1))->Draw();
350 Int_t ErrorVdriftDetector = 0;
351 if(entry) delete entry;
352 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())->Get("TRD/Calib/ChamberVdrift", 9);
353 if(!entry) ErrorVdriftDetector++;
355 AliTRDCalDet *objectv = (AliTRDCalDet *) entry->GetObject();
356 if(!objectv) ErrorVdriftDetector++;
358 for(Int_t det = 0; det < 540; det++){
359 if((objectv->GetValue(det)> 2.5) || (objectv->GetValue(det) < 0.6)) ErrorVdriftDetector++;
361 TCanvas *cdetv = new TCanvas("cdetv","",50,50,600,800);
363 ((TH1F *)objectv->MakeHisto1Distribution(0.6,2.5,-1))->Draw();
370 Int_t ErrorT0Detector = 0;
371 if(entry) delete entry;
372 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())->Get("TRD/Calib/ChamberT0", 9);
373 if(!entry) ErrorT0Detector++;
375 AliTRDCalDet *objectt = (AliTRDCalDet *) entry->GetObject();
376 if(!objectt) ErrorT0Detector++;
378 for(Int_t det = 0; det < 540; det++){
379 if((objectt->GetValue(det)> 1.0) || (objectt->GetValue(det) < -1.0)) ErrorT0Detector++;
381 TCanvas *cdett = new TCanvas("cdett","",50,50,600,800);
383 ((TH1F *)objectt->MakeHisto1Distribution(-0.5,0.5,-1))->Draw();
389 //Time Monitoring Gain
390 //********************
392 Int_t ErrorGainMonitoring = 0;
393 if(entry) delete entry;
394 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())->Get("TRD/Calib/SmGainFactor", 9);
395 if(!entry) ErrorGainMonitoring++;
397 AliTRDCalSm *smg = (AliTRDCalSm *) entry->GetObject();
398 if(!smg) ErrorGainMonitoring++;
400 if(smg->GetEntries() != 2) ErrorGainMonitoring++;
401 TH1F * distributiong = new TH1F("gaintime","gaintime",200,16,64);
402 for(Int_t sm = 0; sm < 18; sm++){
403 distributiong->Fill(smg->GetValue(sm,0));
405 TCanvas *cgaintime = new TCanvas("cgaintime","",50,50,600,800);
407 distributiong->Draw();
412 //Time Monitoring Vdrift
413 //********************
415 Int_t ErrorVdriftMonitoring = 0;
416 if(entry) delete entry;
417 entry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())->Get("TRD/Calib/SmVdriftFactor", 9);
418 if(!entry) ErrorVdriftMonitoring++;
420 AliTRDCalSm *smv = (AliTRDCalSm *) entry->GetObject();
421 if(!smv) ErrorVdriftMonitoring++;
423 if(smv->GetEntries() != 2) ErrorVdriftMonitoring++;
424 TH1F * distributionv = new TH1F("vdrifttime","vdrifttime",200,1.0,2.0);
425 for(Int_t sm = 0; sm < 18; sm++){
426 distributionv->Fill(smv->GetValue(sm,0));
428 TCanvas *cvdrifttime = new TCanvas("cvdrifttime","",50,50,600,800);
430 distributionv->Draw();
442 printf("For the local gain factor there are %d strange values\n",ErrorGainPad);
443 printf("For the local vdrift there are %d strange values\n",ErrorVdriftPad);
444 printf("For the local t0 there are %d strange values\n",ErrorT0Pad);
445 printf("For the chamber gain factor there are %d strange values\n",ErrorGainDetector);
446 printf("For the chamber vdrift there are %d strange values\n",ErrorVdriftDetector);
447 printf("For the chamber t0 there are %d strange values\n",ErrorT0Detector);
448 printf("For the prf width there are %d strange values\n",ErrorPRFWidthPad);
450 if(ErrorGainMonitoring > 0) printf("there is more than one value in time for the gain time dependence\n");
451 if(ErrorVdriftMonitoring > 0) printf("there is more than one value in time for the gain time dependence\n");
453 if(ErrorPadStatusPad > 0) printf("there is no calPadStatus object\n");
461 if(ErrorRefDataGainHLT == 1) printf("There is no reference data entry for the gain HLT!\n");
462 if(ErrorRefDataGainHLT == 2) printf("There is no reference data histogram for the gain HLT!\n");
463 if(ErrorRefDataGainHLT == 3) printf("The reference data histogram has not the good number of Xbins for the gain HLT!\n");
466 if(ErrorRefDataVdriftT0HLT == 1) printf("There is no reference data entry for the vdriftt0 HLT!\n");
467 if(ErrorRefDataVdriftT0HLT == 2) printf("There is no reference data histogram for the vdriftt0 HLT!\n");
468 if(ErrorRefDataVdriftT0HLT == 3) printf("The reference data profile has not the good number of Xbins for the gain HLT!\n");
471 if(ErrorRefDataPRFHLT == 1) printf("There is no reference data entry for the prf HLT!\n");
472 if(ErrorRefDataPRFHLT == 2) printf("There is no reference data profile for the prf HLT!\n");
473 if(ErrorRefDataPRFHLT == 3) printf("The reference data profile has not the good number of Xbins for the prf HLT!\n");
477 if(ErrorRefDataVdriftT0DAQ == 1) printf("There is no reference data entry for the vdriftt0 DAQ!\n");
478 if(ErrorRefDataVdriftT0DAQ == 2) printf("There is no reference data histogram for the vdriftt0 DAQ!\n");
479 if(ErrorRefDataVdriftT0DAQ == 3) printf("The reference data profile has not the good number of Xbins for the gain DAQ!\n");
484 if(ErrorRefDataPadStatus == 1) printf("There is no reference data entry for the pad status DAQ!\n");
485 if(ErrorRefDataPadStatus == 2) printf("There is no reference data object for pad status DAQ!\n");