]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PHOS/macros/Pedestals/PedestalsDiff.C
Raw data analysys for pedestal runs
[u/mrichter/AliRoot.git] / PHOS / macros / Pedestals / PedestalsDiff.C
CommitLineData
e8f49998 1PedestalsDiff(const Int_t runNum1=0, const Int_t runNum2=0)
2{
3 // This macro read two root files with pedestal histograms produced
4 // by Pedestals.C and compare them channel-by-channel. Difference of
5 // the mean pedestals is filled into histograms
6 //-
7 // Arguments: runNum1, runNum2 are the run numbers which define the
8 // filenames of the pedestal histogram
9 //-
10 // Yuri Kharlov. 15.03.2011
11
12 TString pedhisto1 = Form("ped%d.root",runNum1);
13 TString pedhisto2 = Form("ped%d.root",runNum2);
14 TFile *f1 = new TFile(pedhisto1,"readonly");
15 TFile *f2 = new TFile(pedhisto2,"readonly");
16
17 TH2F *h1m2 = (TH2F*)f1->Get("hPedHiMeanm2");
18 TH2F *h2m2 = (TH2F*)f2->Get("hPedHiMeanm2");
19 TH2F *h1m3 = (TH2F*)f1->Get("hPedHiMeanm3");
20 TH2F *h2m3 = (TH2F*)f2->Get("hPedHiMeanm3");
21 TH2F *h1m4 = (TH2F*)f1->Get("hPedHiMeanm4");
22 TH2F *h2m4 = (TH2F*)f2->Get("hPedHiMeanm4");
23 h2m2->Add(h1m2,-1.);
24 h2m3->Add(h1m3,-1.);
25 h2m4->Add(h1m4,-1.);
26
27 TString nameM2 =Form("Pedestal difference in runs %d and %2, module 2",runNum1,runNum2);
28 h2m2->SetTitle(nameM2);
29 TString nameM3 =Form("Pedestal difference in runs %d and %2, module 3",runNum1,runNum2);
30 h2m3->SetTitle(nameM3);
31 TString nameM4 =Form("Pedestal difference in runs %d and %2, module 4",runNum1,runNum2);
32 h2m4->SetTitle(nameM4);
33
34 h2m2->SetXTitle("x, cells");
35 h2m3->SetXTitle("x, cells");
36 h2m4->SetXTitle("x, cells");
37 h2m2->SetYTitle("z, cells");
38 h2m3->SetYTitle("z, cells");
39 h2m4->SetYTitle("z, cells");
40
41 h2m2->SetAxisRange(-5.,5.,"Z");
42 h2m3->SetAxisRange(-5.,5.,"Z");
43 h2m4->SetAxisRange(-5.,5.,"Z");
44
45 h2m2->SetStats(0);
46 h2m3->SetStats(0);
47 h2m4->SetStats(0);
48
49 h2m2->SetTitleOffset(1.0,"X");
50 h2m3->SetTitleOffset(1.0,"X");
51 h2m4->SetTitleOffset(1.0,"X");
52
53 TString nameDPm2 = Form("#Delta ped (runs %d and %d) in module 2",runNum1,runNum2);
54 TH1F *hDPm2 = new TH1F("hDPm2",nameDPm2,100.,-5.,5.);
55 TString nameDPm3 = Form("#Delta ped (runs %d and %d) in module 3",runNum1,runNum2);
56 TH1F *hDPm3 = new TH1F("hDPm3",nameDPm3,100.,-5.,5.);
57 TString nameDPm4 = Form("#Delta ped (runs %d and %d) in module 4",runNum1,runNum2);
58 TH1F *hDPm4 = new TH1F("hDPm4",nameDPm4,100.,-5.,5.);
59 hDPm2->Sumw2();
60 hDPm3->Sumw2();
61 hDPm4->Sumw2();
62
63 for (Int_t ix=0; ix<64; ix++) {
64 for (Int_t iz=0; iz<56; iz++) {
65 Float_t dPedm2 = h2m2->GetBinContent(ix+1,iz+1);
66 Float_t dPedm3 = h2m3->GetBinContent(ix+1,iz+1);
67 Float_t dPedm4 = h2m4->GetBinContent(ix+1,iz+1);
68 hDPm2->Fill(dPedm2);
69 hDPm3->Fill(dPedm3);
70 hDPm4->Fill(dPedm4);
71 if (TMath::Abs(dPedm2) > 1.)
72 printf("Bad channel: m=%d, x=%2d, z=%2d, dPed=%.1f\n",2,ix,iz,dPedm2);
73 if (TMath::Abs(dPedm3) > 1.)
74 printf("Bad channel: m=%d, x=%2d, z=%2d, dPed=%.1f\n",3,ix,iz,dPedm3);
75 if (TMath::Abs(dPedm4) > 1.)
76 printf("Bad channel: m=%d, x=%2d, z=%2d, dPed=%.1f\n",4,ix,iz,dPedm4);
77 }
78 }
79
80 TCanvas *c2 = new TCanvas("m2","m2",0,0,600,400);
81 h2m2->Draw("colz");
82 TCanvas *c3 = new TCanvas("m3","m3",0,0,600,400);
83 h2m3->Draw("colz");
84 TCanvas *c4 = new TCanvas("m4","m4",0,0,600,400);
85 h2m4->Draw("colz");
86
87 gStyle->SetOptStat(1110);
88 TCanvas *c5 = new TCanvas("d","d",0,0,1000,400);
89 c5->Divide(3,1);
90 c5->cd(1);
91 gPad->SetLogy();
92 hDPm2->Draw("hist");
93 c5->cd(2);
94 gPad->SetLogy();
95 hDPm3->Draw("hist");
96 c5->cd(3);
97 gPad->SetLogy();
98 hDPm4->Draw("hist");
99}