RWGCF converted to native cmake
[u/mrichter/AliRoot.git] / TOF / CheckEnabledChannels.C
CommitLineData
c244e7e4 1CheckEnabledChannels(const Char_t *runlist)
2{
3
4 ifstream is(runlist);
5 Char_t buf[4096];
6 Int_t run[1024];
7 Int_t nrun = 0;
8 while(!is.eof()) {
9 is.getline(buf, 4096);
10 if (is.eof()) break;
11 run[nrun] = atoi(buf);
12 printf("added run number %d\n", run[nrun]);
13 nrun++;
14 }
15 printf("%d runs added\n", nrun);
16 is.close();
17
18 TH1F *hActive = new TH1F("hActive", "active channels;run;fraction", nrun, 0, nrun);
19 TH1F *hReadout = new TH1F("hReadout", "good readout;run;fraction", nrun, 0, nrun);
20 for (Int_t irun = 0; irun < nrun; irun++) {
21 hr = CheckEnabledChannels(run[irun], kTRUE);
22 ha = CheckEnabledChannels(run[irun], kFALSE);
23 hReadout->SetBinContent(irun + 1, hr->Integral());
24 hActive->SetBinContent(irun + 1, ha->Integral());
25 hReadout->GetXaxis()->SetBinLabel(irun + 1, Form("%d", run[irun]));
26 delete hr; delete ha;
27 }
28
29 hReadout->SetMarkerStyle(20);
30 hReadout->SetMarkerColor(4);
31 hActive->SetMarkerStyle(25);
32 hActive->SetMarkerColor(2);
33 hReadout->Sumw2();
34 hActive->Sumw2();
35 hReadout->Divide(hReadout, hActive, 1., 1., "B");
36 hActive->Scale(1. / 152928.);
37 hReadout->SetMinimum(0.);
38 hReadout->SetMaximum(1.);
39 hReadout->Draw("E");
40 hActive->Draw("E, same");
41 TLegend *l = gPad->BuildLegend();
42 l->SetFillStyle(0);
43
44}
45
46TH1F *
b96f0fec 47CheckEnabledChannels(Int_t run, Bool_t checkROEff = kTRUE, const Char_t *dbString = "raw://")
8da43270 48{
49
50 /* init */
51 AliCDBManager *cdb = AliCDBManager::Instance();
52 cdb->SetDefaultStorage(dbString);
53 cdb->SetRun(run);
54 AliTOFcalib calib;
55 calib.Init();
56
57 TH2F *hEnabledMap = new TH2F("hEnabledMap", "Enabled channel map;sector;strip", 72, 0., 18., 91, 0., 91.);
4bb3ae29 58 TH1F *hEnabledFlag = new TH1F("hEnabledFlag", "Enabled channel flag;index;flag", 157248, 0., 157248.);
8da43270 59
60 AliTOFcalibHisto calibhisto;
61 calibhisto.LoadCalibHisto();
62 calibhisto.LoadCalibStat(); /* temp */
63
64 Int_t sector, sectorStrip, padx, fea;
65 Float_t hitmapx, hitmapy;
66 /* loop over channels */
67 for (Int_t ich = 0; ich < 157248; ich++) {
b96f0fec 68 if (!calib.IsChannelEnabled(ich, checkROEff)) continue;
8da43270 69 sector = calibhisto.GetCalibMap(AliTOFcalibHisto::kSector, ich);
70 sectorStrip = calibhisto.GetCalibMap(AliTOFcalibHisto::kSectorStrip, ich);
71 padx = calibhisto.GetCalibMap(AliTOFcalibHisto::kPadX, ich);
72 fea = padx / 12;
73 hitmapx = sector + ((Double_t)(3 - fea) + 0.5) / 4.;
74 hitmapy = sectorStrip;
75 hEnabledMap->Fill(hitmapx, hitmapy);
4bb3ae29 76 hEnabledFlag->SetBinContent(ich + 1, 1);
8da43270 77 }
78
79 hEnabledMap->DrawCopy("colz");
c244e7e4 80 return hEnabledFlag;
8da43270 81
82}