5 #include <TClonesArray.h>
10 #include <AliHMPIDHit.h>
11 #include <AliHMPIDCluster.h>
12 #include <AliHMPIDDigit.h>
13 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
14 TObjArray *CreateContainer(const char *classname,TTree *pTree)
16 TObjArray *pOA=new TObjArray(7); pOA->SetOwner();
17 for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){
18 TClonesArray *pCA=new TClonesArray(classname);
20 pTree->SetBranchAddress(Form("HMPID%i",iCh),&pCA);
24 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
25 TH1F *hHitQdc; TH2F *hHitMap[7];
26 void Hits(Int_t mode,TTree *pTree=0x0)
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);
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());
47 TCanvas *c1=new TCanvas("HitCan","Hits",1280,800); c1->Divide(3,3);
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);
53 gStyle->SetPalette(1);
54 hHitMap[iCh]->Draw("colz");
56 c1->cd(3); gPad->SetLogy(); hHitQdc->SetFillColor(5);hHitQdc->Draw();
60 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
61 TH1F *hCluEvt,*hCluChi2,*hCluFlg,*hCluSize;
62 void Clus(Int_t mode, TTree *pTree=0x0)
66 hCluEvt=new TH1F("CluPerEvt","# clusters per event",21,-0.5,20.5);
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);
73 TObjArray *pLst=CreateContainer("AliHMPIDCluster",pTree); pTree->GetEntry(0);
74 for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){//chambers loop
75 TClonesArray *pClus=(TClonesArray *)pLst->UncheckedAt(iCh);
76 hCluEvt->Fill(pClus->GetEntriesFast());
77 for(Int_t iClu=0;iClu<pClus->GetEntriesFast();iClu++){//clusters loop
78 AliHMPIDCluster *pClu=(AliHMPIDCluster*)pClus->UncheckedAt(iClu);
79 hCluFlg->Fill(pClu->Status()); hCluChi2->Fill(pClu->Chi2()); hCluSize->Fill(pClu->Size());
85 TCanvas *c1=new TCanvas("CluComCan","Clusters in common",1280,800); c1->Divide(3,3);
86 c1->cd(1); hCluEvt->SetFillColor(5); hCluEvt->Draw();
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();
93 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
94 TH1F *hDigPcEvt,*hDigQ, *hDigChEvt;
95 void Digs(Int_t mode, TTree *pTree=0x0)
99 hDigPcEvt=new TH1F("hDigPcEvt","PC occupancy per event",156,-1,77);
100 hDigChEvt=new TH1F("hDigChEvt","Chamber occupancy per event",32,-1,7);
101 hDigQ =new TH1F("Q ","Q ",3000,0,3000);
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());
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();
124 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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;
131 if(fh==0 && fd==0 && fc==0){Printf("Nothing to do!"); return;}
132 if(fh) Hits(1); if(fc) Clus(1); if(fd) Digs(1);//book
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));
138 Hits(2,th); Clus(2,tc); Digs(2,td);//fill
139 if(th==0 && td==0 && tc==0) break;
141 Printf("Event %i processed",iEvt);
145 if(fd) Digs(3);//plot