]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RICH/EsdQa.C
Modified for CAF
[u/mrichter/AliRoot.git] / RICH / EsdQa.C
index 8e70ecf19cf869716563a4266609f55a14ffa911..24a941fe51f8129cf13382bac876b566b5a84fc0 100644 (file)
@@ -1,35 +1,20 @@
-// The class definition in esdAna.h has been generated automatically
-// by the ROOT utility TTree::MakeSelector(). This class is derived
-// from the ROOT class TSelector. For more information on the TSelector
-// framework see $ROOTSYS/README/README.SELECTOR or the ROOT User Manual.
-
 // The following methods are defined in this file:
-//    Begin():        called everytime a loop on the tree starts,
-//                    a convenient place to create your histograms.
-//    SlaveBegin():   called after Begin(), when on PROOF called only on the
-//                    slave servers.
-//    Process():      called for each event, in this function you decide what
-//                    to read and fill your histograms.
-//    SlaveTerminate: called at the end of the loop on the tree, when on PROOF
-//                    called only on the slave servers.
-//    Terminate():    called at the end of the loop on the tree,
-//                    a convenient place to draw/fit your histograms.
-//
-// To use this file, try the following session on your Tree T:
-//
-// Root > T->Process("esdAna.C")
-// Root > T->Process("esdAna.C","some options")
-// Root > T->Process("esdAna.C+")
-//
-
-#include "EsdQa.h"
-#include <AliESD.h>
-#include <TCanvas.h>
+//    Begin():        called everytime a loop on the tree starts, a convenient place to create your histograms.
+//    SlaveBegin():   called after Begin(), when on PROOF called only on the slave servers.
+//    Process():      called for each event, in this function you decide what to read and fill your histograms.
+//    SlaveTerminate: called at the end of the loop on the tree, when on PROOF called only on the slave servers.
+//    Terminate():    called at the end of the loop on the tree, a convenient place to draw/fit your histograms.
+
+#include "EsdQa.h"    //class header
+#include <TCanvas.h>  //Terminate()
+#include <TChain.h>
+#include <TF1.h>
+#include <TBenchmark.h>
 #include <TH2F.h>
-#include <TGrid.h>
-#include <TAlienCollection.h>
-#include <TMath.h>
-
+#include <fstream>    //caf()      
+#include <TProof.h>   //caf()
+#include <TDSet.h>    //caf()
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void EsdQa::Begin(TTree *)
 {
    // The Begin() function is called at the start of the query.
@@ -39,7 +24,7 @@ void EsdQa::Begin(TTree *)
    TString option = GetOption();
 
 }
-
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void EsdQa::SlaveBegin(TTree *tree)
 {
    // The SlaveBegin() function is called after the Begin() function.
@@ -51,19 +36,18 @@ void EsdQa::SlaveBegin(TTree *tree)
    TString option = GetOption();
 
    // create histograms on each slave server
-   fCkovMomH = new TH2F("CkovMomH", "Ckov angel,[rad];P [GeV]", 150, 0,15, 100 , 0, 1); 
-   fsigma2   = new TH1F("sigma2","#sigma_{#theta_C}^2",2000,1e9,2e10);
-   fX        = new TH1F("X","mipX[cm]",260,0,130);
-   fY        = new TH1F("Y","mipY[cm]",252,0,126);
-   fdist     = new TH2F("dist","dist mip-track[cm]",150,0,15,100,0,10);
-
-   fProbH[0] = new TH1F("pidE" ,"pid of e"  ,100,0,1);
-   fProbH[1] = new TH1F("pidMu","pid of #mu",100,0,1);
-   fProbH[2] = new TH1F("pidPi","pid of #pi",100,0,1);
-   fProbH[3] = new TH1F("pidK" ,"pid of K"  ,100,0,1);
-   fProbH[4] = new TH1F("pidP" ,"pid of p"  ,100,0,1);
+   fCkovP    = new TH2F("CkovP" , "#theta_{c}, [rad];P, [GeV]", 150,   0,  7  ,100, 0, 1); 
+   fSigP     = new TH2F("SigP"  ,"#sigma_{#theta_c}"          , 150,   0,  7  ,100, 0, 1e20);
+   fMipXY    = new TH2F("MipXY" ,"mip position"               , 260,   0,130  ,252,0,126); 
+   fDifXY    = new TH2F("DifXY" ,"diff"                       , 260, -10, 10  ,252,-10,10); 
+
+   fProb[0] = new TH1F("PidE" ,"PID: e yellow #mu magenta"  ,100,0,1); fProb[0]->SetLineColor(kYellow);
+   fProb[1] = new TH1F("PidMu","pid of #mu"                 ,100,0,1); fProb[1]->SetLineColor(kMagenta);
+   fProb[2] = new TH1F("PidPi","PID: #pi red K green p blue",100,0,1); fProb[2]->SetLineColor(kRed);
+   fProb[3] = new TH1F("PidK" ,"pid of K"                   ,100,0,1); fProb[3]->SetLineColor(kGreen);
+   fProb[4] = new TH1F("PidP" ,"pid of p"                   ,100,0,1); fProb[4]->SetLineColor(kBlue);
 }
-
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void EsdQa::Init(TTree *tree)
 {
    // The Init() function is called when the selector needs to initialize
@@ -78,7 +62,7 @@ void EsdQa::Init(TTree *tree)
    fChain = tree ;
    fChain->SetBranchAddress("ESD", &fEsd) ;
 }
-
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Bool_t EsdQa::Notify()
 {
    // The Notify() function is called when a new file is opened. This
@@ -92,7 +76,7 @@ Bool_t EsdQa::Notify()
 
    return kTRUE;
 }
-
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Bool_t EsdQa::Process(Long64_t entry)
 {
    // The Process() function is called for each entry in the tree (or possibly
@@ -118,26 +102,20 @@ Bool_t EsdQa::Process(Long64_t entry)
   for(Int_t iTrk=0;iTrk<fEsd->GetNumberOfTracks();iTrk++){
      AliESDtrack *pTrk=fEsd->GetTrack(iTrk);
      
-     Float_t dx, dy;
-     pTrk->GetRICHdxdy(dx,dy);
-     Float_t r;
-         if(dx<0 && dy<0) r=999.;
-        else r = TMath::Sqrt(dx*dx+dy*dy);
-     fdist->Fill(pTrk->GetP(),r);
      if(pTrk->GetRICHsignal()<0) continue;
-     fCkovMomH->Fill(pTrk->GetP(),pTrk->GetRICHsignal()) ; 
-     Double_t pid[5];
-     pTrk->GetRICHpid(pid);
-     fProbH[0]->Fill(pid[0]);    fProbH[1]->Fill(pid[1]);    fProbH[2]->Fill(pid[2]);    fProbH[3]->Fill(pid[3]);    fProbH[4]->Fill(pid[4]);
-     fsigma2->Fill(pTrk->GetRICHchi2());
-     Float_t xmip, ymip; 
-     pTrk->GetRICHmipXY(xmip,ymip);
-     fX->Fill(xmip); fY->Fill(ymip);
-    } 
+     
+     fCkovP->Fill(pTrk->GetP(),pTrk->GetRICHsignal()) ; 
+     fSigP ->Fill(pTrk->GetP(),TMath::Sqrt(pTrk->GetRICHchi2()));
+     
+     Float_t xm,ym;  pTrk->GetRICHmipXY(xm,ym);  fMipXY->Fill(xm,ym);
+     Float_t xd,yd;  pTrk->GetRICHdxdy(xd,yd);   fDifXY->Fill(xd,yd);
+     
+     Double_t pid[5];  pTrk->GetRICHpid(pid); for(Int_t i =0;i<5;i++) fProb[i]->Fill(pid[i]);
+  }//tracks loop 
      
   return kTRUE;
-}
-
+}//Process()
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void EsdQa::SlaveTerminate()
 {
   // The SlaveTerminate() function is called after all entries or objects
@@ -146,66 +124,75 @@ void EsdQa::SlaveTerminate()
   
   // Add the histograms to the output on each slave server
   
-  fOutput->Add(fCkovMomH) ;
-  fOutput->Add(fsigma2) ; 
-  fOutput->Add(fX) ;
-  fOutput->Add(fY) ;
-  fOutput->Add(fdist) ;
-  fOutput->Add(fProbH[0]);  fOutput->Add(fProbH[1]);
-  fOutput->Add(fProbH[2]);  fOutput->Add(fProbH[3]);
-  fOutput->Add(fProbH[4]);
-}
-
+  fOutput->Add(fCkovP);
+  fOutput->Add(fSigP); 
+  fOutput->Add(fMipXY);
+  fOutput->Add(fDifXY);
+  
+  for(Int_t i=0;i<5;i++) fOutput->Add(fProb[i]);
+}//SlaveTerminate()
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void EsdQa::Terminate()
 {
    // The Terminate() function is the last function to be called during
    // a query. It always runs on the client, it can be used to present
    // the results graphically or save the results to file.
   
-  fCkovMomH = dynamic_cast<TH2F*>(fOutput->FindObject("CkovMomH")) ;
-  fsigma2 = dynamic_cast<TH1F*>(fOutput->FindObject("sigma2")) ; 
-  fX = dynamic_cast<TH1F*>(fOutput->FindObject("X")) ;
-  fY = dynamic_cast<TH1F*>(fOutput->FindObject("Y")) ;
-  fdist = dynamic_cast<TH2F*>(fOutput->FindObject("dist")) ;
-  fProbH[0] = dynamic_cast<TH1F*>(fOutput->FindObject("pidE")) ;
-  fProbH[1] = dynamic_cast<TH1F*>(fOutput->FindObject("pidMu")) ;
-  fProbH[2] = dynamic_cast<TH1F*>(fOutput->FindObject("pidPi")) ;
-  fProbH[3] = dynamic_cast<TH1F*>(fOutput->FindObject("pidK")) ;
-  fProbH[4] = dynamic_cast<TH1F*>(fOutput->FindObject("pidP")) ;
-
-
-  TFile * file = TFile::Open("esdAnaM.root", "RECREATE");
-  fCkovMomH->Write() ; 
-  fX->Write();
-  fY->Write();
-  fdist->Write();
-  for(Int_t i=0;i<5;i++) fProbH[i] -> Write();
-  fsigma2->Write();
-//  fHistNeutralMul->Write() ; 
-  file->Close() ;
-  delete file ;
-  if (!gROOT->IsBatch()) {
-    TCanvas *c1 = new TCanvas("c1","Annalisa's best trial");c1->SetFillColor(10); c1->SetHighLightColor(10);
-    fCkovMomH->DrawCopy() ;
-   }
+  fCkovP   = dynamic_cast<TH2F*>(fOutput->FindObject("CkovP")) ;
+  fSigP    = dynamic_cast<TH2F*>(fOutput->FindObject("SigP")) ; 
+  fMipXY   = dynamic_cast<TH2F*>(fOutput->FindObject("MipXY")) ;
+  fDifXY   = dynamic_cast<TH2F*>(fOutput->FindObject("DifXY")) ;
+  
+  fProb[0] = dynamic_cast<TH1F*>(fOutput->FindObject("PidE")) ;
+  fProb[1] = dynamic_cast<TH1F*>(fOutput->FindObject("PidMu")) ;
+  fProb[2] = dynamic_cast<TH1F*>(fOutput->FindObject("PidPi")) ;
+  fProb[3] = dynamic_cast<TH1F*>(fOutput->FindObject("PidK")) ;
+  fProb[4] = dynamic_cast<TH1F*>(fOutput->FindObject("PidP")) ;
+
+  Float_t n=1.292; //mean freon ref idx 
+  TF1 *pPi=new TF1("RiPiTheo","acos(sqrt(x*x+[0]*[0])/(x*[1]))",1.2,7); pPi->SetLineWidth(1); pPi->SetParameter(1,n); 
+  AliPID ppp;                 pPi->SetLineColor(kRed);   pPi->SetParameter(0,AliPID::ParticleMass(AliPID::kPion));    //mass
+  TF1 *pK=(TF1*)pPi->Clone(); pK ->SetLineColor(kGreen); pK ->SetParameter(0,AliPID::ParticleMass(AliPID::kKaon)); 
+  TF1 *pP=(TF1*)pPi->Clone(); pP ->SetLineColor(kBlue);  pP ->SetParameter(0,AliPID::ParticleMass(AliPID::kProton)); 
+
+  TCanvas *pC=new TCanvas("c1","ESD QA");pC->SetFillColor(10); pC->SetHighLightColor(10); pC->Divide(3,2);
+  pC->cd(1); fCkovP->Draw(); pPi->Draw("same"); pK->Draw("same"); pP->Draw("same");   pC->cd(2); fMipXY->Draw();   pC->cd(3); fProb[0]->Draw(); fProb[1]->Draw("same"); 
+  pC->cd(4); fSigP ->Draw();                                                          pC->cd(5); fDifXY->Draw();   pC->cd(6); fProb[2]->Draw(); fProb[3]->Draw("same"); fProb[4]->Draw("same"); 
+  
 }
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
-
-void run()
+void loc()
 {
-  TGrid::Connect("alien://",0,0,"t");
-  TAlienCollection *pAlienColl = new TAlienCollection("newIIcento.xml") ;
+  TChain* pChain =new TChain("esdTree");
+  pChain->Add("AliESDs.root");
 
-  TChain* pChain = new TChain("esdTree");
+  pChain->Process("EsdQa.C+"); 
+}
 
-  pAlienColl->Reset() ;
-  while (pAlienColl->Next()) {
-    char esdFile[255] ;
-    sprintf(esdFile, "%s", pAlienColl->GetTURL("")) ;
-    Printf("Adding alien file %s", esdFile);
-    pChain->Add(esdFile) ;
-  }
+void caf()
+{
+  gBenchmark->Start("PRooF exec");
+  TChain* pChain =new TChain("esdTree");
+  
+  ifstream list; list.open("list.txt");
 
-  EsdQa *pSel =new EsdQa;
-  pChain->Process(pSel);       
+  TString file;
+  while(list.good()) {
+    list>>file;
+    if (!file.Contains("root")) continue; //it's wrong file name
+    pChain->Add(file.Data());
+  }
+  list.close();
+  
+  pChain->GetListOfFiles()->Print();
+  
+  TVirtualProof *pProof=TProof::Open("kir@lxb6046.cern.ch");   
+  pProof->UploadPackage("ESD.par");
+  pProof->EnablePackage("ESD");
+  
+  pChain->MakeTDSet()->Process("EsdQa.C+");
+  
+  gBenchmark->Show("PRooF exec");
 }
+