TOF readout efficiency measurements added to TOF reconstruction (both data and MC...
[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.);
32
33 AliTOFcalibHisto calib;
34 calib.LoadCalibHisto();
35 calib.LoadCalibStat(); /* temp */
36
37 Int_t sector, sectorStrip, padx, fea;
38 Float_t efficiency, hitmapx, hitmapy;
39 for (Int_t i = 0; i < data->GetNbinsX(); i++) {
40 efficiency = data->GetBinContent(i + 1);
41 sector = calib.GetCalibMap(AliTOFcalibHisto::kSector, i);
42 sectorStrip = calib.GetCalibMap(AliTOFcalibHisto::kSectorStrip, i);
43 padx = calib.GetCalibMap(AliTOFcalibHisto::kPadX, i);
44 fea = padx / 12;
45 hitmapx = sector + ((Double_t)(3 - fea) + 0.5) / 4.;
46 hitmapy = sectorStrip;
47
48 hEfficiencyMap->Fill(hitmapx, hitmapy, efficiency / 24.);
49 }
50
51 TFile *fout = TFile::Open("CheckReadoutEfficiency.root", "RECREATE");
52 hEfficiencyMap->Write();
53 fout->Close();
54
55}