First implementation of EMCAL trigger QA from Nicola Arbor
[u/mrichter/AliRoot.git] / TOF / CheckReadoutEfficiency.C
CommitLineData
dad2868f 1CheckReadoutEfficiency(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/ReadoutEfficiency");
9 CheckReadoutEfficiency(cdbe);
10
11}
12
13CheckReadoutEfficiency(const Char_t *fileName)
14{
15
16 TFile *file = TFile::Open(fileName);
17 AliCDBEntry *cdbe = (AliCDBEntry *)file->Get("AliCDBEntry");
18 CheckReadoutEfficiency(cdbe);
19}
20
21CheckReadoutEfficiency(AliCDBEntry *cdbe)
22{
23
24 if (!cdbe) {
25 printf("invalid CDB entry\n");
26 return;
27 }
28
29 TH1F *data = (TH1F *)cdbe->GetObject();
30
31 TH2F *hEfficiencyMap = new TH2F("hEfficiencyMap", "Readout efficiency map;sector;strip", 72, 0., 18., 91, 0., 91.);
4bb3ae29 32 TH1F *hEfficiencyFlag = new TH1F("hEfficiencyFlag", "Readout efficiency flag;index;flag", 157248, 0., 157248.);
dad2868f 33
34 AliTOFcalibHisto calib;
35 calib.LoadCalibHisto();
36 calib.LoadCalibStat(); /* temp */
37
38 Int_t sector, sectorStrip, padx, fea;
39 Float_t efficiency, hitmapx, hitmapy;
40 for (Int_t i = 0; i < data->GetNbinsX(); i++) {
41 efficiency = data->GetBinContent(i + 1);
42 sector = calib.GetCalibMap(AliTOFcalibHisto::kSector, i);
43 sectorStrip = calib.GetCalibMap(AliTOFcalibHisto::kSectorStrip, i);
44 padx = calib.GetCalibMap(AliTOFcalibHisto::kPadX, i);
45 fea = padx / 12;
46 hitmapx = sector + ((Double_t)(3 - fea) + 0.5) / 4.;
47 hitmapy = sectorStrip;
dad2868f 48 hEfficiencyMap->Fill(hitmapx, hitmapy, efficiency / 24.);
4bb3ae29 49 if (efficiency >= 0.95)
50 hEfficiencyFlag->SetBinContent(i + 1, 1);
dad2868f 51 }
52
8da43270 53 hEfficiencyMap->DrawCopy("colz");
dad2868f 54 TFile *fout = TFile::Open("CheckReadoutEfficiency.root", "RECREATE");
55 hEfficiencyMap->Write();
4bb3ae29 56 hEfficiencyFlag->Write();
dad2868f 57 fout->Close();
58
59}