Changed class inheritance: from TObject to TTask
[u/mrichter/AliRoot.git] / TOF / CheckCalibStatus.C
CommitLineData
3c4375b2 1CheckCalibStatus(Int_t run)
2{
3
4 TGrid::Connect("alien");
5 AliCDBManager *cdb = AliCDBManager::Instance();
6 cdb->SetDefaultStorage("raw://");
7 cdb->SetRun(run);
8 AliCDBEntry *cdbe = cdb->Get("TOF/Calib/Status");
9 CheckCalibStatus(cdbe);
10
11}
12
fceb731d 13CheckCalibStatus(const Char_t *fileName)
14{
15
16 TFile *file = TFile::Open(fileName);
17 AliCDBEntry *cdbe = (AliCDBEntry *)file->Get("AliCDBEntry");
3c4375b2 18 CheckCalibStatus(cdbe);
19}
20
21CheckCalibStatus(AliCDBEntry *cdbe)
22{
23
24 if (!cdbe) {
25 printf("invalid CDB entry\n");
26 return;
27 }
28
fceb731d 29 AliTOFChannelOnlineStatusArray *array = (AliTOFChannelOnlineStatusArray *)cdbe->GetObject();
30
7c9539dd 31 TH1F *hStatus = new TH1F("hStatus", "Channel status;index;status", array->GetSize(), 0., array->GetSize(););
b8006075 32 TH1F *hChEnabled = new TH1F("hChEnabled", "Channel enabled;index;enabled", array->GetSize(), 0., array->GetSize(););
cf7d7743 33 TH1F *hChNoisy = new TH1F("hChNoisy", "Channel noise flag;index;noise flag", array->GetSize(), 0., array->GetSize(););
7c9539dd 34 TH2F *hNoiseMap = new TH2F("hNoiseMap", "Noise map;sector;strip", 72, 0., 18., 91, 0., 91.);
35 TH2F *hEnableMap = new TH2F("hEnableMap", "Enable map;sector;strip", 72, 0., 18., 91, 0., 91.);
6ae79bb5 36 TH2F *hStatusMap = new TH2F("hStatusMap", "Status map;sector;strip", 72, 0., 18., 91, 0., 91.);
7c9539dd 37
38 AliTOFcalibHisto calib;
39 calib.LoadCalibHisto();
b8006075 40 calib.LoadCalibStat(); /* temp */
7c9539dd 41
42 Int_t sector, sectorStrip, padx, fea;
43 Float_t hitmapx, hitmapy;
44 for (Int_t i = 0; i < array->GetSize(); i++) {
45 hStatus->SetBinContent(i + 1, array->GetStatus(i));
46 sector = calib.GetCalibMap(AliTOFcalibHisto::kSector, i);
47 sectorStrip = calib.GetCalibMap(AliTOFcalibHisto::kSectorStrip, i);
48 padx = calib.GetCalibMap(AliTOFcalibHisto::kPadX, i);
49 fea = padx / 12;
50 hitmapx = sector + ((Double_t)(3 - fea) + 0.5) / 4.;
51 hitmapy = sectorStrip;
6ae79bb5 52
53 if (array->GetHWStatus(i) == AliTOFChannelOnlineStatusArray::kTOFHWOk)
54 hEnableMap->Fill(hitmapx, hitmapy);
55 if (calib.GetCalibStat(AliTOFcalibHisto::kStripStat, i) == 1)
56 hStatusMap->Fill(hitmapx, hitmapy);
cf7d7743 57 if (array->GetNoiseStatus(i) == AliTOFChannelOnlineStatusArray::kTOFNoiseBad) {
58 hChNoisy->SetBinContent(i + 1, 1);
59 hNoiseMap->Fill(hitmapx, hitmapy);
60 }
6ae79bb5 61
b8006075 62 if (array->GetHWStatus(i) == AliTOFChannelOnlineStatusArray::kTOFHWOk &&
63 array->GetNoiseStatus(i) != AliTOFChannelOnlineStatusArray::kTOFNoiseBad &&
64 calib.GetCalibStat(AliTOFcalibHisto::kStripStat, i) == 1) {
65 hChEnabled->SetBinContent(i + 1, 1);
66 }
67
7c9539dd 68 }
69
70 TFile *fout = TFile::Open("CheckCalibStatus.root", "RECREATE");
71 hStatus->Write();
cf7d7743 72 hChNoisy->Write();
b8006075 73 hChEnabled->Write();
7c9539dd 74 hNoiseMap->Write();
75 hEnableMap->Write();
6ae79bb5 76 hStatusMap->Write();
7c9539dd 77 fout->Close();
fceb731d 78
79}