remove warnings
[u/mrichter/AliRoot.git] / HMPID / Hqa.C
CommitLineData
96390f65 1#include <TSystem.h>
2#include <TFile.h>
e4290ede 3#include <TStyle.h>
96390f65 4#include <TTree.h>
5#include <TClonesArray.h>
6#include <TObjArray.h>
7#include <TH2F.h>
8#include <TCanvas.h>
9
10#include <AliHMPIDHit.h>
11#include <AliHMPIDCluster.h>
9234c352 12#include <AliHMPIDDigit.h>
96390f65 13//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
14TObjArray *CreateContainer(const char *classname,TTree *pTree)
15{
16 TObjArray *pOA=new TObjArray(7); pOA->SetOwner();
ae5a42aa 17 for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){
96390f65 18 TClonesArray *pCA=new TClonesArray(classname);
19 pOA->AddAt(pCA,iCh);
20 pTree->SetBranchAddress(Form("HMPID%i",iCh),&pCA);
21 }
96390f65 22 return pOA;
23}
24//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
59d9d4b3 25TH1F *hHitQdc; TH2F *hHitMap[7];
26void Hits(Int_t mode,TTree *pTree=0x0)
27{
28 switch(mode){
29 case 1:
30 hHitQdc=new TH1F("HitQdc","Hit Qdc all chamber;QDC",500,0,4000);
31 for(Int_t iCh=0;iCh<7;iCh++) hHitMap[iCh]=new TH2F(Form("HitMap%i",iCh),Form("Ch%i;x_{Hit};y_{Hit}",iCh),160,0,160,160,0,160);
e4290ede 32 break;
59d9d4b3 33 case 2:
34 if(pTree==0) return;
35 TClonesArray *pHits=new TClonesArray("AliHMPIDHit"); pTree->SetBranchAddress("HMPID",&pHits);
36 for(Int_t iEnt=0;iEnt<pTree->GetEntriesFast();iEnt++){//entries loop
37 pTree->GetEntry(iEnt);
38 for(Int_t iHit=0;iHit<pHits->GetEntriesFast();iHit++){//hits loop
39 AliHMPIDHit *pHit = (AliHMPIDHit*)pHits->UncheckedAt(iHit);
40 hHitMap[pHit->Ch()]->Fill(pHit->LorsX(),pHit->LorsY());
41 hHitQdc->Fill(pHit->Q());
42 }//hits loop
43 }//entries loop
44 delete pHits;
e4290ede 45 break;
59d9d4b3 46 case 3:
47 TCanvas *c1=new TCanvas("HitCan","Hits",1280,800); c1->Divide(3,3);
48
49 for(Int_t iCh=0;iCh<7;iCh++){
50 if(iCh==6) c1->cd(1); if(iCh==5) c1->cd(2);
51 if(iCh==4) c1->cd(4); if(iCh==3) c1->cd(5); if(iCh==2) c1->cd(6);
52 if(iCh==1) c1->cd(8); if(iCh==0) c1->cd(9);
e4290ede 53 gStyle->SetPalette(1);
54 hHitMap[iCh]->Draw("colz");
59d9d4b3 55 }
e4290ede 56 c1->cd(3); gPad->SetLogy(); hHitQdc->SetFillColor(5);hHitQdc->Draw();
57 break;
59d9d4b3 58 }
59}//Hits()
60//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
96390f65 61TH1F *hCluEvt,*hCluChi2,*hCluFlg,*hCluSize;
96390f65 62void Clus(Int_t mode, TTree *pTree=0x0)
63{
64 switch(mode){
65 case 1:
e4290ede 66 hCluEvt=new TH1F("CluPerEvt","# clusters per event",21,-0.5,20.5);
96390f65 67 hCluChi2 =new TH1F("CluChi2" ,"Chi2 " ,1000,0,100);
68 hCluFlg =new TH1F("CluFlg" ,"Cluster flag" ,14,-1.5,12.5); hCluFlg->SetFillColor(5);
69 hCluSize =new TH1F("CluSize" ,"Raw cluster size ",100,0,100);
e4290ede 70 break;
96390f65 71 case 2:
72 if(pTree==0) return;
59d9d4b3 73 TObjArray *pLst=CreateContainer("AliHMPIDCluster",pTree); pTree->GetEntry(0);
ae5a42aa 74 for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){//chambers loop
96390f65 75 TClonesArray *pClus=(TClonesArray *)pLst->UncheckedAt(iCh);
96390f65 76 hCluEvt->Fill(pClus->GetEntriesFast());
77 for(Int_t iClu=0;iClu<pClus->GetEntriesFast();iClu++){//clusters loop
78 AliHMPIDCluster *pClu=(AliHMPIDCluster*)pClus->UncheckedAt(iClu);
59d9d4b3 79 hCluFlg->Fill(pClu->Status()); hCluChi2->Fill(pClu->Chi2()); hCluSize->Fill(pClu->Size());
96390f65 80 }
81 }
82 delete pLst;
e4290ede 83 break;
96390f65 84 case 3:
85 TCanvas *c1=new TCanvas("CluComCan","Clusters in common",1280,800); c1->Divide(3,3);
1c850da7 86 c1->cd(1); hCluEvt->SetFillColor(5); hCluEvt->Draw();
e4290ede 87 c1->cd(2); hCluChi2->SetFillColor(5); hCluChi2->Draw();
88 c1->cd(3); hCluFlg->SetFillColor(5); hCluFlg->Draw();
89 c1->cd(4); hCluSize->SetFillColor(5); hCluSize->Draw();
90 break;
96390f65 91 }//switch
92}//Clus()
9234c352 93//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
94TH1F *hDigPcEvt,*hDigQ, *hDigChEvt;
95void Digs(Int_t mode, TTree *pTree=0x0)
96{
97 switch(mode){
98 case 1:
e4290ede 99 hDigPcEvt=new TH1F("hDigPcEvt","PC occupancy per event",156,-1,77);
100 hDigChEvt=new TH1F("hDigChEvt","Chamber occupancy per event",32,-1,7);
9234c352 101 hDigQ =new TH1F("Q ","Q ",3000,0,3000);
e4290ede 102 break;
9234c352 103 case 2:
104 if(pTree==0) return;
105 TObjArray *pLst=CreateContainer("AliHMPIDDigit",pTree); pTree->GetEntry(0);
106 for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){//chambers loop
107 TClonesArray *pDigs=(TClonesArray *)pLst->UncheckedAt(iCh);
108 hDigChEvt->Fill(iCh,pDigs->GetEntriesFast()/(48.*80.*6.));
109 for(Int_t iDig=0;iDig<pDigs->GetEntriesFast();iDig++){//digits loop
110 AliHMPIDDigit *pDig=(AliHMPIDDigit*)pDigs->UncheckedAt(iDig);
111 hDigPcEvt->Fill(10.*iCh+pDig->Pc(),1./(48.*80.));
112 hDigQ->Fill(pDig->Q());
113 }
114 }
115 delete pLst;
e4290ede 116 break;
9234c352 117 case 3:
118 TCanvas *c1=new TCanvas("DigQa","Digit Check",1280,800); c1->Divide(2,2);
119 c1->cd(1); hDigPcEvt->Draw(); c1->cd(2); hDigQ->Draw(); c1->cd(3); hDigChEvt->Draw();
e4290ede 120 break;
9234c352 121 }//switch
122}//Dig()
123
96390f65 124//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00f49991 125void Hqa()
126{
96390f65 127
128 TFile *fh=0; if(gSystem->IsFileInIncludePath("HMPID.Hits.root")) fh=TFile::Open("HMPID.Hits.root" ,"read");if(fh->IsZombie()) fh=0;
129 TFile *fd=0; if(gSystem->IsFileInIncludePath("HMPID.Digits.root")) fd=TFile::Open("HMPID.Digits.root" ,"read");if(fd->IsZombie()) fd=0;
130 TFile *fc=0; if(gSystem->IsFileInIncludePath("HMPID.RecPoints.root")) fc=TFile::Open("HMPID.RecPoints.root","read");if(fc->IsZombie()) fc=0;
96390f65 131 if(fh==0 && fd==0 && fc==0){Printf("Nothing to do!"); return;}
9234c352 132 if(fh) Hits(1); if(fc) Clus(1); if(fd) Digs(1);//book
96390f65 133 Int_t iEvt=0;
134 while(1){
135 TTree *th=0; if(fh) th=(TTree*)fh->Get(Form("Event%i/TreeH",iEvt));
136 TTree *td=0; if(fd) td=(TTree*)fd->Get(Form("Event%i/TreeD",iEvt));
137 TTree *tc=0; if(fc) tc=(TTree*)fc->Get(Form("Event%i/TreeR",iEvt));
9234c352 138 Hits(2,th); Clus(2,tc); Digs(2,td);//fill
96390f65 139 if(th==0 && td==0 && tc==0) break;
140 iEvt++;
141 Printf("Event %i processed",iEvt);
142 }
e4290ede 143 if(fh) Hits(3);
144 if(fc) Clus(3);
145 if(fd) Digs(3);//plot
96390f65 146}
147