Overlaps corrected, new shape of sectors
[u/mrichter/AliRoot.git] / ITS / ITSSDDQAChecker.C
1 void ITSSDDQAChecker(Char_t *filename){
2
3   //-------opens file & histo
4   TFile *fileinput = new TFile(filename,"read");
5   const Int_t nSDDmodules=260;
6   TH2F *ChargeMap;  
7   TH2F *CountsMap; 
8   TH1F *hModulePattern;
9   TH1F *hModuleSidePattern;
10   TH1F *mapProjX[2*nSDDmodules];      //260 dx e 260 sx  with A, T, Q
11   TH1F *mapProjY[2*nSDDmodules]; 
12   TProfile *mapProfX[2*nSDDmodules];
13   TProfile *mapProfY[2*nSDDmodules];
14
15
16   //-------creates module & side histo
17   hModulePattern = (TH1F*)fileinput->Get("hModulePattern");
18   hModuleSidePattern = (TH1F*)fileinput->Get("hModuleSidePattern");  
19   TCanvas *modCanvas = new TCanvas("modCanvas","modCanvas");
20   TCanvas *sideCanvas = new TCanvas("sideCanvas","sideCanvas");
21   modCanvas->cd();
22   hModulePattern->Draw();    
23   modCanvas->Update();
24   sideCanvas->cd();
25   hModuleSidePattern->Draw(); 
26   sideCanvas->Update();
27
28   //-------creates Projections & Profiles, one canvas each module
29   Char_t *takeChargeMap = new Char_t[50];
30   Char_t *takeCountsMap = new Char_t[50];  
31   Char_t canvname[100];  
32   Char_t canvtitle[100];
33  
34   TCanvas *moduleCanvas[nSDDmodules];
35   gStyle->SetPalette(1);  
36   Int_t nActiveModules = 0;
37   
38   for(Int_t imod=0; imod<nSDDmodules; imod++){   //nSDDmodules
39     if(hModulePattern->GetBinContent(imod+1)!=0){
40       nActiveModules++; 
41       cout<<imod<<" imod" <<endl;
42       sprintf(canvtitle,"canvas_module_%d",imod);
43       sprintf(canvname,"moduleCanvas[%d]",imod); 
44       moduleCanvas[imod]=new TCanvas(canvname,canvtitle);
45       moduleCanvas[imod]->Divide(2,6);
46       moduleCanvas[imod]->Update();
47       
48       for(Int_t isid=0;isid<2;isid++){
49         Int_t index=2*imod+isid;
50         if(hModuleSidePattern->GetBinContent(index+1)!=0){
51           //cout << "Module: " << imod << ", Side: " << isid << ", index: " << index << ", update canvases" << endl;
52           sprintf(takeChargeMap,"chargeMap%d",index);
53           ChargeMap= (TH2F*)fileinput->Get(takeChargeMap);
54           sprintf(takeCountsMap,"countsMap%d",index);
55           CountsMap= (TH2F*)fileinput->Get(takeCountsMap);
56
57           mapProjX[index] = ChargeMap->ProjectionX();
58           mapProjY[index] = ChargeMap->ProjectionY();
59           mapProjX[index]->GetXaxis()->SetTitle("Time Bin");
60           mapProjX[index]->GetYaxis()->SetTitle("Total Counts");
61           mapProjY[index]->GetXaxis()->SetTitle("Anode");
62           mapProjY[index]->GetYaxis()->SetTitle("Total Counts");
63         
64           mapProfX[index] = ChargeMap->ProfileX();
65           mapProfY[index] = ChargeMap->ProfileY();
66           mapProfX[index]->GetXaxis()->SetTitle("Time Bin");
67           mapProfX[index]->GetYaxis()->SetTitle("Average Counts");
68           mapProfY[index]->GetXaxis()->SetTitle("Anode");
69           mapProfY[index]->GetYaxis()->SetTitle("Average Counts");
70           
71           moduleCanvas[imod] ->cd(1+isid);
72           ChargeMap->Draw("colz"); 
73           moduleCanvas[imod] ->cd(3+isid);
74           CountsMap->Draw("colz");
75           moduleCanvas[imod] ->cd(5+isid);
76           mapProjX[index]->Draw(); 
77           moduleCanvas[imod] ->cd(7+isid);
78           mapProjY[index]->Draw(); 
79           moduleCanvas[imod] ->cd(9+isid);
80           mapProfX[index]->Draw(); 
81           moduleCanvas[imod] ->cd(11+isid);
82           mapProfY[index]->Draw(); 
83           moduleCanvas[imod]->Update();
84           }
85
86       } 
87       gSystem->Exec("sleep 0.5");
88     }
89   }     
90
91   cout << nActiveModules << " Modules containing Data" << endl;
92
93 }
94