- update on AOD analysis
authorlmilano <lmilano@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 5 Jun 2012 07:26:14 +0000 (07:26 +0000)
committerlmilano <lmilano@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 5 Jun 2012 07:26:14 +0000 (07:26 +0000)
PWGLF/SPECTRA/PiKaPr/TestAOD/AliAnalysisTaskSpectraAOD.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraAODEventCuts.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraAODEventCuts.h
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraAODHistoManager.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraAODPID.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraAODTrackCuts.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraAODTrackCuts.h
PWGLF/SPECTRA/PiKaPr/TestAOD/MainAnalysis.C
PWGLF/SPECTRA/PiKaPr/TestAOD/QAPlots.C [new file with mode: 0644]
PWGLF/SPECTRA/PiKaPr/TestAOD/runAODProof.C
PWGLF/SPECTRA/PiKaPr/TestAOD/runGrid.C

index 0cbb408..3d3505d 100644 (file)
@@ -179,9 +179,9 @@ void AliAnalysisTaskSpectraAOD::UserExec(Option_t *)
          codemoth = TMath::Abs(moth->GetPdgCode());\r
          mfl = Int_t (codemoth/ TMath::Power(10, Int_t(TMath::Log10(codemoth))));\r
        }\r
-       // Int_t uniqueID = partMC->GetUniqueID();\r
-       // cout<<"uniqueID: "<<partMC->GetUniqueID()<<"       "<<kPDecay<<endl;\r
-       // cout<<"status: "<<partMC->GetStatus()<<"       "<<kPDecay<<endl;\r
+       //Int_t uniqueID = partMC->GetUniqueID();\r
+       cout<<"uniqueID: "<<partMC->GetUniqueID()<<"       "<<kPDecay<<endl;\r
+       cout<<"status: "<<partMC->GetStatus()<<"       "<<kPDecay<<endl;\r
        // if(uniqueID == kPDecay)Printf("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");\r
        if(mfl==3) isSecondaryWeak     = kTRUE; // add if(partMC->GetStatus() & kPDecay)? FIXME\r
        else       isSecondaryMaterial = kTRUE;\r
index 2521e5b..3b4dea6 100644 (file)
@@ -41,7 +41,7 @@ using namespace std;
 
 ClassImp(AliSpectraAODEventCuts)
 
-AliSpectraAODEventCuts::AliSpectraAODEventCuts(const char *name) : TNamed(name, "AOD Event Cuts"), fAOD(0), fIsSelected(0), fCentralityCutMin(0), fCentralityCutMax(0), fHistoCuts(0)
+AliSpectraAODEventCuts::AliSpectraAODEventCuts(const char *name) : TNamed(name, "AOD Event Cuts"), fAOD(0), fIsSelected(0), fCentralityCutMin(0), fCentralityCutMax(0), fHistoCuts(0),fHistoVtxBefSel(0),fHistoVtxAftSel(0),fHistoEtaBefSel(0),fHistoEtaAftSel(0),fHistoNChAftSel(0)
 {
   // Constructor
   fHistoCuts = new TH1I("fEventCuts", "Event Cuts", kNVtxCuts, -0.5, kNVtxCuts - 0.5);
@@ -49,6 +49,7 @@ AliSpectraAODEventCuts::AliSpectraAODEventCuts(const char *name) : TNamed(name,
   fHistoVtxAftSel = new TH1F("fHistoVtxAftSel", "Vtx distr after event selection",500,-15,15);
   fHistoEtaBefSel = new TH1F("fHistoEtaBefSel", "Eta distr before event selection",500,-2,2);
   fHistoEtaAftSel = new TH1F("fHistoEtaAftSel", "Eta distr after event selection",500,-2,2);
+  fHistoNChAftSel = new TH1F("fHistoNChAftSel", "NCh distr after event selection",3000,-0.5,2999.5);
   fCentralityCutMin = 0.0;      // default value of centrality cut minimum, 0 ~ no cut
   fCentralityCutMax = 10000.0;  // default value of centrality cut maximum,  ~ no cut
 
@@ -69,12 +70,17 @@ Bool_t AliSpectraAODEventCuts::IsSelected(AliAODEvent * aod,AliSpectraAODTrackCu
     fHistoCuts->Fill(kAcceptedEvents);
     if(vertex)fHistoVtxAftSel->Fill(vertex->GetZ());
   }
+  Int_t Nch=0;
   for (Int_t iTracks = 0; iTracks < fAOD->GetNumberOfTracks(); iTracks++) {
     AliAODTrack* track = fAOD->GetTrack(iTracks);
     if (!fTrackCuts->IsSelected(track)) continue;
     fHistoEtaBefSel->Fill(track->Eta());
-    if(fIsSelected) fHistoEtaAftSel->Fill(track->Eta());
+    if(fIsSelected){
+      fHistoEtaAftSel->Fill(track->Eta());
+      Nch++;
+    }
   }
+  if(fIsSelected)fHistoNChAftSel->Fill(Nch);
   return fIsSelected;
 }
 
@@ -135,11 +141,12 @@ Long64_t AliSpectraAODEventCuts::Merge(TCollection* list)
   TObject* obj;
 
   // collections of all histograms
-  TList collections;//FIXME we should only 1 collection
+  TList collections;//FIXME we should use only 1 collection
   TList collections_histoVtxBefSel;
   TList collections_histoVtxAftSel;
   TList collections_histoEtaBefSel;
   TList collections_histoEtaAftSel;
+  TList collections_histoNChAftSel;
 
   Int_t count = 0;
 
@@ -158,6 +165,8 @@ Long64_t AliSpectraAODEventCuts::Merge(TCollection* list)
     collections_histoEtaBefSel.Add(histo_histoEtaBefSel);
     TH1F * histo_histoEtaAftSel = entry->GetHistoEtaAftSel();      
     collections_histoEtaAftSel.Add(histo_histoEtaAftSel);
+    TH1F * histo_histoNChAftSel = entry->GetHistoNChAftSel();      
+    collections_histoNChAftSel.Add(histo_histoNChAftSel);
     count++;
   }
   
@@ -166,6 +175,7 @@ Long64_t AliSpectraAODEventCuts::Merge(TCollection* list)
   fHistoVtxAftSel->Merge(&collections_histoVtxAftSel);
   fHistoEtaBefSel->Merge(&collections_histoEtaBefSel);
   fHistoEtaAftSel->Merge(&collections_histoEtaAftSel);
+  fHistoNChAftSel->Merge(&collections_histoNChAftSel);
   
   delete iter;
 
index 6a6373b..292d8f4 100644 (file)
@@ -24,7 +24,7 @@ class AliSpectraAODEventCuts : public TNamed
   enum {  kProcessedEvents = 0,kAcceptedEvents, kVtxRange, kVtxCentral, kVtxNoEvent, kNVtxCuts};
 
   // Constructors
- AliSpectraAODEventCuts() : TNamed(), fAOD(0), fIsSelected(0), fCentralityCutMin(0), fCentralityCutMax(0), fHistoCuts(0),fHistoVtxBefSel(0),fHistoVtxAftSel(0),fHistoEtaBefSel(0),fHistoEtaAftSel(0) {}
+ AliSpectraAODEventCuts() : TNamed(), fAOD(0), fIsSelected(0), fCentralityCutMin(0), fCentralityCutMax(0), fHistoCuts(0),fHistoVtxBefSel(0),fHistoVtxAftSel(0),fHistoEtaBefSel(0),fHistoEtaAftSel(0),fHistoNChAftSel(0) {}
   AliSpectraAODEventCuts(const char *name);
   virtual  ~AliSpectraAODEventCuts() {}
 
@@ -41,6 +41,7 @@ class AliSpectraAODEventCuts : public TNamed
   TH1F * GetHistoVtxAftSel()         {  return fHistoVtxAftSel; }
   TH1F * GetHistoEtaBefSel()         {  return fHistoEtaBefSel; }
   TH1F * GetHistoEtaAftSel()         {  return fHistoEtaAftSel; }
+  TH1F * GetHistoNChAftSel()         {  return fHistoNChAftSel; }
   Float_t  GetCentralityMin()  const {  return fCentralityCutMin; }
   Float_t  GetCentralityMax()  const {  return fCentralityCutMax; }
   void   PrintCuts();
@@ -62,6 +63,7 @@ class AliSpectraAODEventCuts : public TNamed
   TH1F            *fHistoVtxAftSel;        // Vtx distr after event selection
   TH1F            *fHistoEtaBefSel;        // Eta distr before event selection
   TH1F            *fHistoEtaAftSel;        // Eta distr after event selection
+  TH1F            *fHistoNChAftSel;        // NCh distr after event selection
   AliSpectraAODEventCuts(const AliSpectraAODEventCuts&);
   AliSpectraAODEventCuts& operator=(const AliSpectraAODEventCuts&);
   
index 902af82..92c6ebb 100644 (file)
@@ -296,12 +296,12 @@ TH1* AliSpectraAODHistoManager::GetHistogram1D(UInt_t histoType, UInt_t particle
   if (baseId < 0)
     AliFatal(Form("Wrong histogram type %d", histoType));
 
-  cout << "T[" << histoType << "] ID["<< baseId <<"] P["<<particleType<<"] C[" << charge 
-       << " --> ["<< baseId + particleType + 3*(charge) <<"] = " ;
+  //cout << "T[" << histoType << "] ID["<< baseId <<"] P["<<particleType<<"] C[" << charge 
+  //     << " --> ["<< baseId + particleType + 3*(charge) <<"] = " ;
 
   baseId = baseId + particleType + 3*(charge);
 
-  cout <<  GetHistogram(baseId)->GetName() << endl;
+  //cout <<  GetHistogram(baseId)->GetName() << endl;
 
   return GetHistogram(baseId);
 }
index 5139d3f..5bb19cd 100644 (file)
@@ -133,9 +133,9 @@ Int_t AliSpectraAODPID::GetParticleSpecie(AliAODTrack      * trk, AliSpectraAODT
   }
          
   // --- combined
-  Double_t nsigmaTPCTOFkProton = TMath::Sqrt(nsigmaTPCkProton*nsigmaTPCkProton+nsigmaTOFkProton*nsigmaTOFkProton);
-  Double_t nsigmaTPCTOFkKaon   = TMath::Sqrt(nsigmaTPCkKaon*nsigmaTPCkKaon+nsigmaTOFkKaon*nsigmaTOFkKaon);
-  Double_t nsigmaTPCTOFkPion   = TMath::Sqrt(nsigmaTPCkPion*nsigmaTPCkPion+nsigmaTOFkPion*nsigmaTOFkPion);
+  Double_t nsigmaTPCTOFkProton = TMath::Sqrt((nsigmaTPCkProton*nsigmaTPCkProton+nsigmaTOFkProton*nsigmaTOFkProton)/2.);
+  Double_t nsigmaTPCTOFkKaon   = TMath::Sqrt((nsigmaTPCkKaon*nsigmaTPCkKaon+nsigmaTOFkKaon*nsigmaTOFkKaon)/2.);
+  Double_t nsigmaTPCTOFkPion   = TMath::Sqrt((nsigmaTPCkPion*nsigmaTPCkPion+nsigmaTOFkPion*nsigmaTOFkPion)/2.);
 
 
   // select the nsigma to be used for the actual PID
index 083b071..9373416 100644 (file)
@@ -27,6 +27,7 @@
 #include "AliAnalysisTask.h"
 #include "AliAnalysisManager.h"
 #include "AliAODTrack.h"
+#include "AliExternalTrackParam.h"
 #include "AliAODMCParticle.h"
 #include "AliAODEvent.h"
 #include "AliAODInputHandler.h"
@@ -42,7 +43,7 @@ ClassImp(AliSpectraAODTrackCuts)
 
 
 AliSpectraAODTrackCuts::AliSpectraAODTrackCuts(const char *name) : TNamed(name, "AOD Track Cuts"), fIsSelected(0), fTrackBits(0), fEtaCut(0), fDCACut(0), fPCut(0), fPtCut(0), fYCut(0),
-  fPtCutTOFMatching(0),fQvecCutMin(0),fQvecCutMax(0), fHistoCuts(0), fHistoNSelectedPos(0), fHistoNSelectedNeg(0), fHistoNMatchedPos(0), fHistoNMatchedNeg(0), fTrack(0)
+  fPtCutTOFMatching(0),fQvecCutMin(0),fQvecCutMax(0), fHistoCuts(0), fHistoNSelectedPos(0), fHistoNSelectedNeg(0), fHistoNMatchedPos(0), fHistoNMatchedNeg(0), fHistoEtaPhiHighPt(0), fTrack(0)
   
 {
   // Constructor
@@ -60,6 +61,9 @@ AliSpectraAODTrackCuts::AliSpectraAODTrackCuts(const char *name) : TNamed(name,
   fHistoNMatchedPos->GetXaxis()->SetTitle("P_{T} (GeV / c)");
   fHistoNMatchedNeg=new TH1F("fHistoNMatchedNeg","fHistoNMatchedNeg",nbinsTempl,templBins);
   fHistoNMatchedNeg->GetXaxis()->SetTitle("P_{T} (GeV / c)");
+  fHistoEtaPhiHighPt=new TH2F("fHistoEtaPhiHighPt","fHistoEtaPhiHighPt",200,-1,1,400,0,7);
+  fHistoEtaPhiHighPt->SetXTitle("eta");
+  fHistoEtaPhiHighPt->SetYTitle("phi");
   
   fEtaCut = 100000.0; // default value of eta cut ~ no cut
   fDCACut = 100000.0; // default value of dca cut ~ no cut
@@ -107,7 +111,7 @@ Bool_t AliSpectraAODTrackCuts::IsSelected(AliAODTrack * track)
     return kFALSE;
   }
   fHistoCuts->Fill(kAccepted);
-  Printf("-------- %d,%d",kTOFMatching,kAccepted);
+  //Printf("-------- %d,%d",kTOFMatching,kAccepted);
   return kTRUE;
 }
 //_________________________________________________________
@@ -182,6 +186,15 @@ Bool_t AliSpectraAODTrackCuts::CheckTOFMatching()
     fHistoCuts->Fill(kTOFMatching);
     if(fTrack->Charge()>0)fHistoNMatchedPos->Fill(fTrack->Pt());
     else fHistoNMatchedNeg->Fill(fTrack->Pt());
+    if(fTrack->Pt()>1.5){
+      //fHistoEtaPhiHighPt->Fill(fTrack->GetOuterParam()->Eta(),fTrack->GetOuterParam()->Phi());
+      //Printf("AliExternalTrackParam * extpar=(AliExternalTrackParam*)fTrack->GetOuterParam();");
+      //AliExternalTrackParam * extpar=(AliExternalTrackParam*)fTrack->GetOuterParam();
+      fHistoEtaPhiHighPt->Fill(fTrack->Eta(),fTrack->Phi());
+      //Printf("fHistoEtaPhiHighPt->Fill(extpar->Eta(),extpar->Phi());");
+      //fHistoEtaPhiHighPt->Fill(extpar->Eta(),extpar->Phi());
+      //delete extpar;
+    }
     return kTRUE;
   }
 }
@@ -228,6 +241,7 @@ Long64_t AliSpectraAODTrackCuts::Merge(TCollection* list)
   TList collections_histoNSelectedNeg;
   TList collections_histoNMatchedPos;
   TList collections_histoNMatchedNeg;
+  TList collections_histoEtaPhiHighPt;
 
   Int_t count = 0;
 
@@ -246,6 +260,8 @@ Long64_t AliSpectraAODTrackCuts::Merge(TCollection* list)
     collections_histoNMatchedPos.Add(histoNMatchedPos);
     TH1F * histoNMatchedNeg = entry->GetHistoNMatchedNeg();      
     collections_histoNMatchedNeg.Add(histoNMatchedNeg);
+    TH2F * histoEtaPhiHighPt = entry->GetHistoEtaPhiHighPt();      
+    collections_histoEtaPhiHighPt.Add(histoEtaPhiHighPt);
     count++;
   }
   
@@ -254,6 +270,7 @@ Long64_t AliSpectraAODTrackCuts::Merge(TCollection* list)
   fHistoNSelectedNeg->Merge(&collections_histoNSelectedNeg);
   fHistoNMatchedPos->Merge(&collections_histoNMatchedPos);
   fHistoNMatchedNeg->Merge(&collections_histoNMatchedNeg);
+  fHistoEtaPhiHighPt->Merge(&collections_histoEtaPhiHighPt);
   
   delete iter;
 
index 16353ea..77f3e49 100644 (file)
@@ -39,7 +39,7 @@ class AliSpectraAODTrackCuts : public TNamed
   enum { kTrkBit = 0, kTrkEta, kTrkDCA, kTrkP, kTrkPt,kTrkPtTOF,kTOFMatching,kTrTOFout,kTrTIME,kTrTOFpid,kAccepted,kNTrkCuts};
   
   
- AliSpectraAODTrackCuts() : TNamed(), fIsSelected(0), fTrackBits(0), fEtaCut(0), fPCut(0), fPtCut(0), fPtCutTOFMatching(0), fQvecCutMin(0), fQvecCutMax(0), fHistoCuts(0), fHistoNSelectedPos(0), fHistoNSelectedNeg(0), fHistoNMatchedPos(0), fHistoNMatchedNeg(0), fTrack(0) {}
+ AliSpectraAODTrackCuts() : TNamed(), fIsSelected(0), fTrackBits(0), fEtaCut(0), fPCut(0), fPtCut(0), fPtCutTOFMatching(0), fQvecCutMin(0), fQvecCutMax(0), fHistoCuts(0), fHistoNSelectedPos(0), fHistoNSelectedNeg(0), fHistoNMatchedPos(0), fHistoNMatchedNeg(0), fHistoEtaPhiHighPt(0), fTrack(0) {}
   
   AliSpectraAODTrackCuts(const char *name);
   virtual  ~AliSpectraAODTrackCuts() {} // To be implemented
@@ -62,6 +62,7 @@ class AliSpectraAODTrackCuts : public TNamed
    TH1F * GetHistoNSelectedNeg()      { return fHistoNSelectedNeg; }
    TH1F * GetHistoNMatchedPos()      { return fHistoNMatchedPos; }
    TH1F * GetHistoNMatchedNeg()      { return fHistoNMatchedNeg; }
+   TH2F * GetHistoEtaPhiHighPt()      { return fHistoEtaPhiHighPt; }
    void SetEta(Float_t eta)   { fEtaCut = eta; }
    void SetDCA(Float_t dca)   { fDCACut = dca; }
    void SetP(Float_t p)       { fPCut = p; }
@@ -99,6 +100,7 @@ class AliSpectraAODTrackCuts : public TNamed
    TH1F             *fHistoNSelectedNeg;       // Selected negative tracks
    TH1F             *fHistoNMatchedPos;       // Matched positive tracks
    TH1F             *fHistoNMatchedNeg;       // Matched negative tracks
+   TH2F             *fHistoEtaPhiHighPt;       // EtaPhi distr at high pt (>1.5 GeV/c)
    AliAODTrack      *fTrack;           //! Track pointer
    
    AliSpectraAODTrackCuts(const AliSpectraAODTrackCuts&);
index 9c6b492..8d6333b 100644 (file)
@@ -45,8 +45,11 @@ void MainAnalysis()  {
   mass[1]   = TDatabasePDG::Instance()->GetParticle("K+")->Mass();
   mass[2] = TDatabasePDG::Instance()->GetParticle("proton")->Mass();
   
+  //TString fold="3SigmaPID_AOD048-049_FilterBit6";
+  //TString fold="3SigmaPID_AOD048-049_FilterBit5";
+  TString fold="3SigmaPID_AOD048-049_FilterBit5";
+  //TString fold="3SigmaPID_AOD048-049_FilterBit5_test";
   //TString fold="3SigmaPID_AOD086-090_FilterBit10";
-  TString fold="5SigmaPID_AOD046_FilterBit6";
   Int_t ibinToCompare=-1;
   
   TString sname="Cent0to5_QVec0.0to100.0";ibinToCompare=0;
@@ -76,8 +79,8 @@ void MainAnalysis()  {
   ecuts_data->PrintCuts();
   tcuts_data->PrintCuts();
   
-  //QAPlots(hman_data,hman_mc);
-
+  QAPlots(hman_data,hman_mc,ecuts_data,ecuts_mc,tcuts_data,tcuts_mc);
+  return;
   //efficiencies
   Printf("\n\n-> Calculating MC Correction Factors");
   TH1F *CorrFact[6];
@@ -89,9 +92,10 @@ void MainAnalysis()  {
       //BE CAREFUL! depending on the efficiency you choose, you must change the DCA correction (data or data/mc)
       
       TString hname=Form("hHistPtRecSigma%s%s",Particle[ipart].Data(),Sign[icharge].Data()); //MC correction for Prim+Cont+Eff
-      //TString hname=Form("hHistPtRecTrue%s%s",Particle[ipart].Data(),Sign[icharge].Data());//MC correction for Prim+Eff
-      //TString hname=Form("hHistPtRecSigmaPrimary%s%s",Particle[ipart].Data(),Sign[icharge].Data());UseMCDCACorrection=kFALSE; //MC correction for Cont+Eff
-      //TString hname=Form("hHistPtRecTruePrimary%s%s",Particle[ipart].Data(),Sign[icharge].Data());UseMCDCACorrection=kFALSE; // Pure MC efficiency for Prim. BE CAREFUL WITH MUONS!!!
+      //TString hname=Form("hHistPtRecTrue%s%s",Particle[ipart].Data(),Sign[icharge].Data());//MC correction for Prim+Eff if (idRec == idGen)
+      //TString hname=Form("hHistPtRecSigmaPrimary%s%s",Particle[ipart].Data(),Sign[icharge].Data());UseMCDCACorrection=kFALSE; //MC correction for Cont+Eff. filled with idRec
+      //TString hname=Form("hHistPtRecPrimary%s%s",Particle[ipart].Data(),Sign[icharge].Data());UseMCDCACorrection=kFALSE; //MC correction for Cont+Eff. filled with idGen
+      //TString hname=Form("hHistPtRecTruePrimary%s%s",Particle[ipart].Data(),Sign[icharge].Data());UseMCDCACorrection=kFALSE; // Pure MC efficiency for Prim. BE CAREFUL WITH MUONS!!! (idRec == idGen)
       Printf("Getting %s",hname.Data());
       CorrFact[index]=(TH1F*)((TH1F*) hman_mc->GetPtHistogram1D(hname.Data(),-1,-1))->Clone();
       CorrFact[index]->SetName(Form("CorrFact_%s%s",Particle[ipart].Data(),Sign[icharge].Data()));
@@ -140,7 +144,9 @@ void MainAnalysis()  {
     }
   } 
   
-  //Put Bin Content = 0
+
+  
+  //Put Bin Content = 0 for bin below the the range
   for(Int_t icharge=0;icharge<2;icharge++){
     for(Int_t ipart=0;ipart<3;ipart++){
       Int_t index=ipart+3*icharge;
@@ -152,8 +158,9 @@ void MainAnalysis()  {
       }
     }
   }
   //DCA Correction with the "right" DCA sample
-  DCACorrection(Spectra,hman_data,hman_mc,UseMCDCACorrection);
+  //DCACorrection(Spectra,hman_data,hman_mc,UseMCDCACorrection);
   
   //DCA Correction forcing loose DCA
   // TString fold_LooseDCA="5SigmaPID_AOD046_FilterBit5";
@@ -165,10 +172,6 @@ void MainAnalysis()  {
   // AliSpectraAODHistoManager* hman_data_LooseDCA = (AliSpectraAODHistoManager*) _data_LooseDCA->Get("SpectraHistos");
   // DCACorrection(Spectra,hman_data_LooseDCA,hman_mc_LooseDCA,UseMCDCACorrection);
   
-  
-  
-  
-  
   //GFCorrection
   GFCorrection(Spectra,tcuts_data);
   
@@ -184,6 +187,64 @@ void MainAnalysis()  {
     }
   }
   
+
+  //Matching efficiency in data and Monte Carlo
+  TCanvas *cMatchingEff=new TCanvas("MatchingEff","MatchingEff",700,500);
+  TH1F *hMatcEffPos_data=(TH1F*)tcuts_data->GetHistoNMatchedPos();
+  hMatcEffPos_data->Divide((TH1F*)tcuts_data->GetHistoNSelectedPos());
+  hMatcEffPos_data->SetTitle("Matching Eff Pos - data");
+  TH1F *hMatcEffNeg_data=(TH1F*)tcuts_data->GetHistoNMatchedNeg();
+  hMatcEffNeg_data->Divide((TH1F*)tcuts_data->GetHistoNSelectedNeg());
+  hMatcEffNeg_data->SetTitle("Matching Eff Neg - data");
+  hMatcEffNeg_data->SetLineColor(2);
+  TH1F *hMatcEffPos_mc=(TH1F*)tcuts_mc->GetHistoNMatchedPos();
+  hMatcEffPos_mc->Divide((TH1F*)tcuts_mc->GetHistoNSelectedPos());
+  hMatcEffPos_mc->SetTitle("Matching Eff Pos - mc");
+  hMatcEffPos_mc->SetLineStyle(2);
+  TH1F *hMatcEffNeg_mc=(TH1F*)tcuts_mc->GetHistoNMatchedNeg();
+  hMatcEffNeg_mc->Divide((TH1F*)tcuts_mc->GetHistoNSelectedNeg());
+  hMatcEffNeg_mc->SetTitle("Matching Eff Neg - mc");
+  hMatcEffNeg_mc->SetLineColor(2);
+  hMatcEffNeg_mc->SetLineStyle(2);
+  cMatchingEff->Divide(1,2);
+  cMatchingEff->cd(1);
+  gPad->SetGridy();
+  gPad->SetGridx();
+  hMatcEffPos_data->DrawClone("lhist");
+  hMatcEffNeg_data->DrawClone("lhistsame");
+  hMatcEffPos_mc->DrawClone("lhistsame");
+  hMatcEffNeg_mc->DrawClone("lhistsame");
+  gPad->BuildLegend();
+  hMatcEffPos_data->Divide(hMatcEffPos_mc);
+  hMatcEffNeg_data->Divide(hMatcEffNeg_mc);
+  cMatchingEff->cd(2);
+  gPad->SetGridy();
+  gPad->SetGridx();
+  hMatcEffPos_data->DrawClone("lhist");
+  hMatcEffNeg_data->DrawClone("lhistsame");
+  TF1 *pol0MatchPos_data=new TF1("pol0MatchPos_data","pol0",2.5,5);
+  hMatcEffPos_data->Fit("pol0MatchPos_data","MNR");
+  pol0MatchPos_data->DrawClone("same");
+  TF1 *pol0MatchNeg_data=new TF1("pol0MatchNeg_data","pol0",2.5,5);
+  hMatcEffNeg_data->Fit("pol0MatchNeg_data","MNR");
+  pol0MatchNeg_data->SetLineColor(2);
+  pol0MatchNeg_data->DrawClone("same");
+  Float_t ScalingMatchingPos=pol0MatchPos_data->GetParameter(0);
+  Float_t ScalingMatchingNeg=pol0MatchNeg_data->GetParameter(0);
+  
+  //Correction spectra for matching efficiency
+  //For the moment I'm using the inclusive correction
+  for(Int_t ipart=0;ipart<3;ipart++){
+    for(Int_t ibin=1;ibin<Spectra[ipart]->GetNbinsX();ibin++){
+      Float_t ptspectra=Spectra[ipart]->GetBinCenter(ibin);
+      if(ptspectra<tcuts_data->GetPtTOFMatching())continue;
+      //Spectra[ipart]->SetBinContent(ibin,( Spectra[ipart]->GetBinContent(ibin)/hMatcEffPos_data->GetBinContent(hMatcEffPos_data->FindBin(ptspectra))));
+      //Spectra[ipart+3]->SetBinContent(ibin,( Spectra[ipart+3]->GetBinContent(ibin)/hMatcEffNeg_data->GetBinContent(hMatcEffNeg_data->FindBin(ptspectra))));
+      Spectra[ipart]->SetBinContent(ibin,( Spectra[ipart]->GetBinContent(ibin)/ScalingMatchingPos));
+      Spectra[ipart+3]->SetBinContent(ibin,( Spectra[ipart+3]->GetBinContent(ibin)/ScalingMatchingNeg));
+    }
+  }
+  
   //Drawing Final Spectra
   TCanvas *cspectra=new TCanvas("cspectra","cspectra",700,500);
   gPad->SetGridy();
@@ -227,10 +288,13 @@ void MainAnalysis()  {
        CratioComb->cd(ipart+1);
        gPad->SetGridy();
        gPad->SetGridx();
+       for(Int_t ibin=1;ibin<hcomb->GetNbinsX();ibin++)hcomb->SetBinError(ibin,0);
+
        if(icharge==0)htmp->DrawClone();
        else htmp->DrawClone("same");
-       hcomb->DrawClone("same");
-       htmp->Divide(hcomb);
+       MCTruth[index]->DrawClone("same");
+       hcomb->DrawClone("same");
+       htmp->Divide(hcomb);
        htmp->SetMaximum(1.3);
        htmp->SetMinimum(0.7);
        CratioComb->cd(ipart+4);
@@ -245,6 +309,15 @@ void MainAnalysis()  {
   //comparison with charged hadron
   Printf("\n\n-> ChargedHadron comparison");
   TH1F *hChHad_data=(TH1F*)((TH1F*)hman_data->GetPtHistogram1D("hHistPtRec",-1,-1))->Clone();
+  TH1F* hMatchCorrectionAllCh=(TH1F*)hMatcEffPos_data->Clone("hMatchCorrectionAllCh");
+  hMatchCorrectionAllCh->Add(hMatcEffNeg_data); //correction for Matching efficiency!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+  hMatchCorrectionAllCh->Scale(0.5);
+  for(Int_t ibin=1;ibin<hChHad_data->GetNbinsX();ibin++){
+    Float_t ptch=hChHad_data->GetBinCenter(ibin);
+    if(ptch<tcuts_data->GetPtTOFMatching())continue;
+    //hChHad_data->SetBinContent(ibin,(hChHad_data->GetBinContent(ibin)/hMatchCorrectionAllCh->GetBinContent(hMatchCorrectionAllCh->FindBin(ptch))));
+    hChHad_data->SetBinContent(ibin,2*(hChHad_data->GetBinContent(ibin)/(ScalingMatchingPos+ScalingMatchingNeg)));
+  }
   //fraction of sec in MC
   TH1F *hPrimRec_mc=(TH1F*)((TH1F*)hman_mc->GetPtHistogram1D("hHistPtRecPrimary",-1,-1))->Clone();
   TH1F *hAllRec_mc=(TH1F*)((TH1F*)hman_mc->GetPtHistogram1D("hHistPtRec",-1,-1))->Clone();
@@ -252,7 +325,7 @@ void MainAnalysis()  {
     Double_t en_data=hChHad_data->GetBinContent(ibin);
     Double_t en_mc=hAllRec_mc->GetBinContent(ibin);
     Double_t prim_mc=hPrimRec_mc->GetBinContent(ibin);
-    if(en_mc!=0)hChHad_data->SetBinContent(ibin,en_data-(en_data*(en_mc-prim_mc)*1.1/en_mc));
+    if(en_mc!=0)hChHad_data->SetBinContent(ibin,en_data-(en_data*(en_mc-prim_mc)*1.2/en_mc));
     //Printf("Before: %.0f After: %.0f  fraction: %.1f",en_data,hChHad_data->GetBinContent(ibin),hChHad_data->GetBinContent(ibin)/en_data);
   }
   hPrimRec_mc->Divide(hAllRec_mc);
@@ -395,50 +468,6 @@ void MainAnalysis()  {
   hsum->SetMinimum(.8);
   hsum->DrawClone("");
   
-  return;
-  // //Comparison of efficiency with TPCTOF ESD analysis
-  // Printf("\n\n-> Calculating Efficiency to be compared with ESD analysis");
-  // TH1F *EffTRUEPions;
-  // TH1F *EffSIGMAPions;
-  // TCanvas *cEffESD=new TCanvas("cEffESD","cEffESD",700,500);
-  // cEffESD->Divide(1,2);
-  // Int_t icharge=1;
-  // Int_t ipart=0;
-  // //using MC truth
-  // TString hname=Form("hHistPtRecTruePrimary%s%s",Particle[ipart].Data(),Sign[icharge].Data());
-  // Printf("Getting %s",hname.Data());
-  // EffTRUEPions=(TH1F*)((TH1F*) hman_mc->GetPtHistogram1D(hname.Data(),-1,-1))->Clone();
-  // EffTRUEPions->SetName(Form("Eff TRUE_%s%s",Particle[ipart].Data(),Sign[icharge].Data()));
-  // EffTRUEPions->SetTitle(Form("Eff TRUE %s%s",Particle[ipart].Data(),Sign[icharge].Data()));
-  // EffTRUEPions->SetMarkerStyle(Marker[icharge]);
-  // EffTRUEPions->SetMarkerColor(Color[ipart]);
-  // EffTRUEPions->SetLineColor(Color[ipart]);
-  // hname=Form("hHistPtGenTruePrimary%s%s",Particle[ipart].Data(),Sign[icharge].Data());
-  // Printf("... and divide it by %s",hname.Data());
-  // EffTRUEPions->Divide(EffTRUEPions,(TH1F*)((TH1F*)hman_mc->GetPtHistogram1D(hname.Data(),1,1))->Clone(),1,1,"B");//binomial error
-  // //using NSigma
-  // hname=Form("hHistPtRecSigmaPrimary%s%s",Particle[ipart].Data(),Sign[icharge].Data());
-  // Printf("Getting %s",hname.Data());
-  // EffSIGMAPions=(TH1F*)((TH1F*) hman_mc->GetPtHistogram1D(hname.Data(),-1,-1))->Clone();
-  // EffSIGMAPions->SetName(Form("Eff SIGMA_%s%s",Particle[ipart].Data(),Sign[icharge].Data()));
-  // EffSIGMAPions->SetTitle(Form("Eff SIGMA %s%s",Particle[ipart].Data(),Sign[icharge].Data()));
-  // EffSIGMAPions->SetMarkerStyle(Marker[icharge]);
-  // EffSIGMAPions->SetMarkerColor(Color[ipart+1]);
-  // EffSIGMAPions->SetLineColor(Color[ipart+1]);
-  // hname=Form("hHistPtGenTruePrimary%s%s",Particle[ipart].Data(),Sign[icharge].Data());
-  // Printf("... and divide it by %s",hname.Data());
-  // EffSIGMAPions->Divide(EffSIGMAPions,(TH1F*)((TH1F*)hman_mc->GetPtHistogram1D(hname.Data(),1,1))->Clone(),1,1,"B");//binomial error
-  // cEffESD->cd(1);
-  // EffTRUEPions->DrawClone("lhist");
-  // EffSIGMAPions->DrawClone("lhistsame");
-  // hEffESD->DrawClone("lhistsame");
-  // gPad->BuildLegend();
-  // cEffESD->cd(2);
-  // TH1F *hRatioTRUE=AliPWGHistoTools::MyDivideHistosDifferentBins(EffTRUEPions,hEffESD);
-  // hRatioTRUE->DrawClone("lhist");
-  // TH1F *hRatioSIGMA=AliPWGHistoTools::MyDivideHistosDifferentBins(EffSIGMAPions,hEffESD);
-  // hRatioSIGMA->DrawClone("lhistsame");
-  // return;
   
 }
 
@@ -473,7 +502,7 @@ void DCACorrection(TH1F **Spectra, AliSpectraAODHistoManager* hman_data, AliSpec
          TH1F *hmc1=(TH1F*) ((TH1F*)hman_mc->GetDCAHistogram1D(Form("hHistPtRecSigmaPrimary%s%s",Particle[ipart].Data(),Sign[icharge].Data()),lowedge,lowedge+binwidth))->Clone();
          TH1F *hmc2=(TH1F*) ((TH1F*)hman_mc->GetDCAHistogram1D(Form("hHistPtRecSigmaSecondaryWeakDecay%s%s",Particle[ipart].Data(),Sign[icharge].Data()),lowedge,lowedge+binwidth))->Clone();
          TH1F *hmc3=(TH1F*) ((TH1F*)hman_mc->GetDCAHistogram1D(Form("hHistPtRecSigmaSecondaryMaterial%s%s",Particle[ipart].Data(),Sign[icharge].Data()),lowedge,lowedge+binwidth))->Clone();
-         //Double_t minentries=200;
+         Double_t minentries=1;
          //if(hToFit->GetEntries()<=minentries || hmc1->GetEntries()<=minentries || hmc2->GetEntries()<=minentries || hmc3->GetEntries()<=minentries)continue;
          hmc1->Rebin(nrebin);
          hmc2->Rebin(nrebin);
@@ -714,22 +743,22 @@ void GFCorrection(TH1F **Spectra,AliSpectraAODTrackCuts* tcuts_data){
        }
       }
       }else{
-       gGFCorrectionProtonPlus->SetPoint(binK,Spectra[1]->GetBinCenter(binK),0);
-       gGFCorrectionProtonMinus->SetPoint(binK,Spectra[4]->GetBinCenter(binK),0);
-       Float_t FlukaCorrpPosTracking=fGFpPosTracking->Eval(Spectra[1]->GetBinCenter(binK));
-       Float_t FlukaCorrpNegTracking=fGFpNegTracking->Eval(Spectra[1]->GetBinCenter(binK));
-       Printf("TPC/TOF Geant/Fluka Tracking: pt:%f  Pos:%f  Neg:%f",Spectra[1]->GetBinCenter(binK),FlukaCorrpPosTracking,FlukaCorrpNegTracking);
-       Spectra[1]->SetBinContent(binK,Spectra[1]->GetBinContent(binK)*FlukaCorrpPosTracking);
-       Spectra[4]->SetBinContent(binK,Spectra[4]->GetBinContent(binK)*FlukaCorrpNegTracking);
-       Spectra[1]->SetBinError(binK,Spectra[1]->GetBinError(binK)*FlukaCorrpPosTracking);
-       Spectra[4]->SetBinError(binK,Spectra[4]->GetBinError(binK)*FlukaCorrpNegTracking);
-       Float_t FlukaCorrpPosMatching=fGFpPosMatching->Eval(Spectra[1]->GetBinCenter(binK));
-       Float_t FlukaCorrpNegMatching=fGFpNegMatching->Eval(Spectra[1]->GetBinCenter(binK));
-       Printf("TPC/TOF Geant/Fluka Matching: pt:%f  Pos:%f  Neg:%f",Spectra[1]->GetBinCenter(binK),FlukaCorrpPosMatching,FlukaCorrpNegMatching);
-       Spectra[1]->SetBinContent(binK,Spectra[1]->GetBinContent(binK)*FlukaCorrpPosMatching);
-       Spectra[4]->SetBinContent(binK,Spectra[4]->GetBinContent(binK)*FlukaCorrpNegMatching);
-       Spectra[1]->SetBinError(binK,Spectra[1]->GetBinError(binK)*FlukaCorrpPosMatching);
-       Spectra[4]->SetBinError(binK,Spectra[4]->GetBinError(binK)*FlukaCorrpNegMatching);
+       gGFCorrectionProtonPlus->SetPoint(ibin,Spectra[2]->GetBinCenter(ibin),0);
+       gGFCorrectionProtonMinus->SetPoint(ibin,Spectra[5]->GetBinCenter(ibin),0);
+       Float_t FlukaCorrpPosTracking=fGFpPosTracking->Eval(Spectra[2]->GetBinCenter(ibin));
+       Float_t FlukaCorrpNegTracking=fGFpNegTracking->Eval(Spectra[2]->GetBinCenter(ibin));
+       Printf("TPC/TOF Geant/Fluka Tracking: pt:%f  Pos:%f  Neg:%f",Spectra[2]->GetBinCenter(ibin),FlukaCorrpPosTracking,FlukaCorrpNegTracking);
+       Spectra[2]->SetBinContent(ibin,Spectra[2]->GetBinContent(ibin)*FlukaCorrpPosTracking);
+       Spectra[5]->SetBinContent(ibin,Spectra[5]->GetBinContent(ibin)*FlukaCorrpNegTracking);
+       Spectra[2]->SetBinError(ibin,Spectra[2]->GetBinError(ibin)*FlukaCorrpPosTracking);
+       Spectra[5]->SetBinError(ibin,Spectra[5]->GetBinError(ibin)*FlukaCorrpNegTracking);
+       Float_t FlukaCorrpPosMatching=fGFpPosMatching->Eval(Spectra[2]->GetBinCenter(ibin));
+       Float_t FlukaCorrpNegMatching=fGFpNegMatching->Eval(Spectra[2]->GetBinCenter(ibin));
+       Printf("TPC/TOF Geant/Fluka Matching: pt:%f  Pos:%f  Neg:%f",Spectra[2]->GetBinCenter(ibin),FlukaCorrpPosMatching,FlukaCorrpNegMatching);
+       Spectra[2]->SetBinContent(ibin,Spectra[2]->GetBinContent(ibin)*FlukaCorrpPosMatching);
+       Spectra[5]->SetBinContent(ibin,Spectra[5]->GetBinContent(ibin)*FlukaCorrpNegMatching);
+       Spectra[2]->SetBinError(ibin,Spectra[2]->GetBinError(ibin)*FlukaCorrpPosMatching);
+       Spectra[5]->SetBinError(ibin,Spectra[5]->GetBinError(ibin)*FlukaCorrpNegMatching);
       }
     }//end loop on bins        
   }
diff --git a/PWGLF/SPECTRA/PiKaPr/TestAOD/QAPlots.C b/PWGLF/SPECTRA/PiKaPr/TestAOD/QAPlots.C
new file mode 100644 (file)
index 0000000..85d8f8e
--- /dev/null
@@ -0,0 +1,522 @@
+gROOT->LoadMacro("~/works/AOD/AliSpectraAODTrackCuts.cxx+g");
+gROOT->LoadMacro("~/works/AOD/AliSpectraAODEventCuts.cxx+g");
+gROOT->LoadMacro("~/works/AOD/AliSpectraAODHistoManager.cxx+g");
+gROOT->LoadMacro("~/works/AOD/AliSpectraAODPID.cxx+g");
+gROOT->LoadMacro("~/works/AOD/AliAnalysisTaskSpectraAOD.cxx+g");
+
+void QAPlots( AliSpectraAODHistoManager* hman_data, AliSpectraAODHistoManager* hman_mc,
+             AliSpectraAODEventCuts* ecuts_data, AliSpectraAODEventCuts* ecuts_mc,
+             AliSpectraAODTrackCuts* tcuts_data, AliSpectraAODTrackCuts* tcuts_mc){
+   
+  //vtx distr in data and MC before and after event selection
+  TCanvas *cVtx=new TCanvas("Vtxdistr","Vtxdistr",700,500);
+  TH1F *hVtxBef_data=ecuts_data->GetHistoVtxBefSel();
+  hVtxBef_data->Scale(1./ecuts_data->NumberOfProcessedEvents());
+  hVtxBef_data->SetTitle(Form("%s - data",hVtxBef_data->GetTitle()));
+  TH1F *hVtxBef_mc=ecuts_mc->GetHistoVtxBefSel();
+  hVtxBef_mc->Scale(1./ecuts_mc->NumberOfProcessedEvents());
+  hVtxBef_mc->SetTitle(Form("%s - mc",hVtxBef_mc->GetTitle()));
+  hVtxBef_mc->SetLineColor(2);
+  cVtx->Divide(1,2);
+  cVtx->cd(1);
+  gPad->SetGridy();
+  gPad->SetGridx();
+  hVtxBef_data->DrawClone("lhist");
+  hVtxBef_mc->DrawClone("lhistsame");
+  gPad->BuildLegend();
+  TH1F *hVtxAft_data=ecuts_data->GetHistoVtxAftSel();
+  hVtxAft_data->Scale(1./ecuts_data->NumberOfEvents());
+  hVtxAft_data->SetTitle(Form("%s - data",hVtxAft_data->GetTitle()));
+  TH1F *hVtxAft_mc=ecuts_mc->GetHistoVtxAftSel();
+  hVtxAft_mc->Scale(1./ecuts_mc->NumberOfEvents());
+  hVtxAft_mc->SetTitle(Form("%s - mc",hVtxAft_mc->GetTitle()));
+  hVtxAft_mc->SetLineColor(2);
+  cVtx->cd(2);
+  gPad->SetGridy();
+  gPad->SetGridx();
+  hVtxAft_data->DrawClone("lhist");
+  hVtxAft_mc->DrawClone("lhistsame");
+  gPad->BuildLegend();
+  
+  //eta distr in data and MC before and after event selection
+  TCanvas *cEta=new TCanvas("Etadistr","Etadistr",700,500);
+  TH1F *hEtaBef_data=ecuts_data->GetHistoEtaBefSel();
+  hEtaBef_data->Scale(1./ecuts_data->NumberOfProcessedEvents());
+  hEtaBef_data->SetTitle(Form("%s - data",hEtaBef_data->GetTitle()));
+  TH1F *hEtaBef_mc=ecuts_mc->GetHistoEtaBefSel();
+  hEtaBef_mc->Scale(1./ecuts_mc->NumberOfProcessedEvents());
+  hEtaBef_mc->SetTitle(Form("%s - mc",hEtaBef_mc->GetTitle()));
+  hEtaBef_mc->SetLineColor(2);
+  cEta->Divide(1,2);
+  cEta->cd(1);
+  gPad->SetGridy();
+  gPad->SetGridx();
+  hEtaBef_data->DrawClone("lhist");
+  hEtaBef_mc->DrawClone("lhistsame");
+  gPad->BuildLegend();
+  TH1F *hEtaAft_data=ecuts_data->GetHistoEtaAftSel();
+  hEtaAft_data->Scale(1./ecuts_data->NumberOfEvents());
+  hEtaAft_data->SetTitle(Form("%s - data",hEtaAft_data->GetTitle()));
+  TH1F *hEtaAft_mc=ecuts_mc->GetHistoEtaAftSel();
+  hEtaAft_mc->Scale(1./ecuts_mc->NumberOfEvents());
+  hEtaAft_mc->SetTitle(Form("%s - mc",hEtaAft_mc->GetTitle()));
+  hEtaAft_mc->SetLineColor(2);
+  cEta->cd(2);
+  gPad->SetGridy();
+  gPad->SetGridx();
+  hEtaAft_data->DrawClone("lhist");
+  hEtaAft_mc->DrawClone("lhistsame");
+  gPad->BuildLegend();
+
+  //Nch distr in data and MC before and after event selection
+  TCanvas *cNCh=new TCanvas("NChdistr","NChdistr",700,500);
+  gPad->SetGridy();
+  gPad->SetGridx();
+  TH1F *hNChAft_data=ecuts_data->GetHistoNChAftSel();
+  hNChAft_data->Scale(1./hNChAft_data->GetEntries());
+  hNChAft_data->SetTitle(Form("%s - data",hNChAft_data->GetTitle()));
+  TH1F *hNChAft_mc=ecuts_mc->GetHistoNChAftSel();
+  hNChAft_mc->Scale(1./hNChAft_mc->GetEntries());
+  hNChAft_mc->SetTitle(Form("%s - mc",hNChAft_mc->GetTitle()));
+  hNChAft_mc->SetLineColor(2);
+  hNChAft_data->DrawClone("lhist");
+  hNChAft_mc->DrawClone("lhistsame");
+  gPad->BuildLegend();
+
+  //Eta Phi at high Pt in data and Monte Carlo
+  TCanvas *cEtaPhi=new TCanvas("EtaPhi","EtaPhi",700,500);
+  cEtaPhi->Divide(2,1);
+  TH2F *hEtaPhi_data=tcuts_data->GetHistoEtaPhiHighPt()->Clone("hEtaPhi_data");
+  hEtaPhi_data->Rebin2D(4);
+  hEtaPhi_data->Scale(1./hEtaPhi_data->GetEntries());
+  cEtaPhi->cd(1);
+  gPad->SetGridy();
+  gPad->SetGridx();
+  hEtaPhi_data->DrawClone("colz");
+  TH2F *hEtaPhi_mc=tcuts_mc->GetHistoEtaPhiHighPt()->Clone("hEtaPhi_mc");
+  hEtaPhi_mc->Rebin2D(4);
+  hEtaPhi_mc->Scale(1./hEtaPhi_mc->GetEntries());
+  cEtaPhi->cd(2);
+  gPad->SetGridy();
+  gPad->SetGridx();
+  hEtaPhi_mc->DrawClone("colz");
+  TCanvas *cRatioEtaPhi=new TCanvas("RatioEtaPhi","RatioEtaPhi",700,500);
+  gPad->SetGridy();
+  gPad->SetGridx();
+  hEtaPhi_data->Divide(hEtaPhi_mc);
+  hEtaPhi_data->SetMaximum(2);
+  hEtaPhi_data->SetMinimum(-0.00000001);
+  hEtaPhi_data->DrawClone("colz");
+
+  //Track selection in data and Monte Carlo
+  TCanvas *cTrackCuts=new TCanvas("TrackCuts","TrackCuts",700,500);
+  cTrackCuts->Divide(1,2);
+  TH1F *hTrCuts_data=new TH1F("hTrCuts_data","hTrCuts_data",11,0,11);
+  for(Int_t ibin=1;ibin<=tcuts_data->GetHistoCuts()->GetNbinsX();ibin++){
+    hTrCuts_data->SetBinContent(ibin,tcuts_data->GetHistoCuts()->GetBinContent(ibin)/tcuts_data->GetHistoCuts()->GetBinContent(6));
+    hTrCuts_data->GetXaxis()->SetBinLabel(ibin,tcuts_data->GetHistoCuts()->GetXaxis()->GetBinLabel(ibin));
+  }
+  TH1F *hTrCuts_mc=new TH1F("hTrCuts_mc","hTrCuts_mc",11,0,11);
+  for(Int_t ibin=1;ibin<=tcuts_mc->GetHistoCuts()->GetNbinsX();ibin++){
+    hTrCuts_mc->SetBinContent(ibin,tcuts_mc->GetHistoCuts()->GetBinContent(ibin)/tcuts_mc->GetHistoCuts()->GetBinContent(6));
+    hTrCuts_mc->GetXaxis()->SetBinLabel(ibin,tcuts_mc->GetHistoCuts()->GetXaxis()->GetBinLabel(ibin));
+  }
+  hTrCuts_mc->SetLineColor(2);
+  cTrackCuts->cd(1);
+  gPad->SetGridy();
+  gPad->SetGridx();
+  hTrCuts_data->SetMinimum(0);
+  hTrCuts_data->DrawClone();
+  hTrCuts_mc->DrawClone("same");
+  gPad->BuildLegend();
+  cTrackCuts->cd(2);
+  gPad->SetGridy();
+  gPad->SetGridx();
+  hTrCuts_data->Divide(hTrCuts_mc);
+  hTrCuts_data->SetTitle("DATA/MC");
+  hTrCuts_data->DrawClone();
+  gPad->BuildLegend();
+
+
+  //dedx in data and MC
+  TCanvas *cPIDSig=new TCanvas("cPIDSig","cPIDSig",700,500);
+  cPIDSig->Divide(2,2);
+  cPIDSig->cd(1);
+  TH2F *PIDSig_data = (TH2F*)((TH2F*)hman_data->GetPIDHistogram("hHistPIDTPC"))->Clone();
+  PIDSig_data->SetYTitle("TPC signal");
+  gPad->SetLogz();
+  gPad->SetGridy();
+  gPad->SetGridx();
+  PIDSig_data->DrawClone("colz");
+  cPIDSig->cd(2);
+  TH2F *PIDSig_mc = (TH2F*)((TH2F*)hman_mc->GetPIDHistogram("hHistPIDTPC"))->Clone();
+  PIDSig_mc->SetYTitle("TPC signal");
+  gPad->SetLogz();
+  gPad->SetGridy();
+  gPad->SetGridx();
+  PIDSig_mc->DrawClone("colz");
+  cPIDSig->cd(3);
+  TH2F *PIDSig_data = (TH2F*)((TH2F*)hman_data->GetPIDHistogram("hHistPIDTOF"))->Clone();
+  PIDSig_data->SetYTitle("TOF signal");
+  gPad->SetLogz();
+  gPad->SetGridy();
+  gPad->SetGridx();
+  PIDSig_data->DrawClone("colz");
+  cPIDSig->cd(4);
+  TH2F *PIDSig_mc = (TH2F*)((TH2F*)hman_mc->GetPIDHistogram("hHistPIDTOF"))->Clone();
+  PIDSig_mc->SetYTitle("TOF signal/100");
+  gPad->SetLogz();
+  gPad->SetGridy();
+  gPad->SetGridx();
+  PIDSig_mc->DrawClone("colz");
+
+  //dedx projection in data and MC
+  Double_t Proj1[2]={0.6,0.7};
+  Double_t Proj2[2]={1.1,1.2};
+  TCanvas *cPIDSigProjection=new TCanvas("cPIDSigProjection","cPIDSigProjection",700,500);
+  cPIDSigProjection->Divide(2,2);
+  //TPC
+  TH2F *PIDSig_data = (TH2F*)((TH2F*)hman_data->GetPIDHistogram("hHistPIDTPC"))->Clone();
+  TH1F *PIDSig_data_Proj1=(TH1F*)PIDSig_data->ProjectionY(Form("TPC, data [%.1f,%.1f]",Proj1[0],Proj1[1]),
+                                                         PIDSig_data->GetXaxis()->FindBin(Proj1[0]),PIDSig_data->GetXaxis()->FindBin(Proj1[1]));
+  TH1F *PIDSig_data_Proj2=(TH1F*)PIDSig_data->ProjectionY(Form("TPC, data [%.1f,%.1f]",Proj2[0],Proj2[1]),
+                                                         PIDSig_data->GetXaxis()->FindBin(Proj2[0]),PIDSig_data->GetXaxis()->FindBin(Proj2[1]));
+  PIDSig_data_Proj1->SetTitle(Form("TPC, data [%.1f,%.1f]",Proj1[0],Proj1[1]));
+  PIDSig_data_Proj2->SetTitle(Form("TPC, data [%.1f,%.1f]",Proj2[0],Proj2[1]));
+  TH2F *PIDSig_mc = (TH2F*)((TH2F*)hman_mc->GetPIDHistogram("hHistPIDTPC"))->Clone();
+  TH1F *PIDSig_mc_Proj1=(TH1F*)PIDSig_mc->ProjectionY(Form("TPC, mc [%.1f,%.1f]",Proj1[0],Proj1[1]),
+                                                     PIDSig_mc->GetXaxis()->FindBin(Proj1[0]),PIDSig_mc->GetXaxis()->FindBin(Proj1[1]));
+  TH1F *PIDSig_mc_Proj2=(TH1F*)PIDSig_mc->ProjectionY(Form("TPC, mc [%.1f,%.1f]",Proj2[0],Proj2[1]),
+                                                     PIDSig_mc->GetXaxis()->FindBin(Proj2[0]),PIDSig_mc->GetXaxis()->FindBin(Proj2[1]));
+  PIDSig_mc_Proj1->SetTitle(Form("TPC, mc [%.1f,%.1f]",Proj1[0],Proj1[1]));
+  PIDSig_mc_Proj2->SetTitle(Form("TPC, mc [%.1f,%.1f]",Proj2[0],Proj2[1]));
+  PIDSig_mc_Proj1->SetLineColor(2);
+  PIDSig_mc_Proj2->SetLineColor(2);
+  cPIDSigProjection->cd(1);
+  gPad->SetGridy();
+  gPad->SetLogy();
+  gPad->SetGridx();
+  PIDSig_data_Proj1->DrawNormalized("lhist");
+  PIDSig_mc_Proj1->DrawNormalized("lhistsame");
+  gPad->BuildLegend();
+  cPIDSigProjection->cd(2);
+  gPad->SetLogy();
+  gPad->SetGridy();
+  gPad->SetGridx();
+  PIDSig_data_Proj2->DrawNormalized("lhist");
+  PIDSig_mc_Proj2->DrawNormalized("lhistsame");
+  gPad->BuildLegend();
+  //TOF
+  TH2F *PIDSig_data = (TH2F*)((TH2F*)hman_data->GetPIDHistogram("hHistPIDTOF"))->Clone();
+  TH1F *PIDSig_data_Proj1=(TH1F*)PIDSig_data->ProjectionY(Form("TOF, data [%.1f,%.1f]",Proj1[0],Proj1[1]),
+                                                         PIDSig_data->GetXaxis()->FindBin(Proj1[0]),PIDSig_data->GetXaxis()->FindBin(Proj1[1]));
+  TH1F *PIDSig_data_Proj2=(TH1F*)PIDSig_data->ProjectionY(Form("TOF, data [%.1f,%.1f]",Proj2[0],Proj2[1]),
+                                                         PIDSig_data->GetXaxis()->FindBin(Proj2[0]),PIDSig_data->GetXaxis()->FindBin(Proj2[1]));
+  PIDSig_data_Proj1->SetTitle(Form("TOF, data [%.1f,%.1f]",Proj1[0],Proj1[1]));
+  PIDSig_data_Proj2->SetTitle(Form("TOF, data [%.1f,%.1f]",Proj2[0],Proj2[1]));
+  TH2F *PIDSig_mc = (TH2F*)((TH2F*)hman_mc->GetPIDHistogram("hHistPIDTOF"))->Clone();
+  TH1F *PIDSig_mc_Proj1=(TH1F*)PIDSig_mc->ProjectionY(Form("TOF, mc [%.1f,%.1f]",Proj1[0],Proj1[1]),
+                                                     PIDSig_mc->GetXaxis()->FindBin(Proj1[0]),PIDSig_mc->GetXaxis()->FindBin(Proj1[1]));
+  TH1F *PIDSig_mc_Proj2=(TH1F*)PIDSig_mc->ProjectionY(Form("TOF, mc [%.1f,%.1f]",Proj2[0],Proj2[1]),
+                                                     PIDSig_mc->GetXaxis()->FindBin(Proj2[0]),PIDSig_mc->GetXaxis()->FindBin(Proj2[1]));
+  PIDSig_mc_Proj1->SetTitle(Form("TOF, mc [%.1f,%.1f]",Proj1[0],Proj1[1]));
+  PIDSig_mc_Proj2->SetTitle(Form("TOF, mc [%.1f,%.1f]",Proj2[0],Proj2[1]));
+  PIDSig_mc_Proj1->SetLineColor(2);
+  PIDSig_mc_Proj2->SetLineColor(2);
+  cPIDSigProjection->cd(3);
+  gPad->SetLogy();
+  gPad->SetGridy();
+  gPad->SetGridx();
+  PIDSig_data_Proj1->DrawNormalized("lhist");
+  PIDSig_mc_Proj1->DrawNormalized("lhistsame");
+  gPad->BuildLegend();
+  cPIDSigProjection->cd(4);
+  gPad->SetLogy();
+  gPad->SetGridy();
+  gPad->SetGridx();
+  PIDSig_data_Proj2->DrawNormalized("lhist");
+  PIDSig_mc_Proj2->DrawNormalized("lhistsame");
+  gPad->BuildLegend();
+  
+  //nsig in data and MC
+  for(Int_t ipart=0;ipart<3;ipart++){
+    TCanvas *cnsig=new TCanvas(Form("cnsig%s",Particle[ipart].Data()),Form("cnsig%s",Particle[ipart].Data()),700,500);
+    cnsig->Divide(2,3);
+    cnsig->cd(1);
+    TH2F *nsig_data = (TH2F*)((TH2F*)hman_data->GetNSigHistogram(Form("hHistNSig%sPtTPC",Particle[ipart].Data())))->Clone();
+    nsig_data->GetYaxis()->SetRangeUser(-5,5);
+    nsig_data->Scale(1/nsig_data->GetMaximum());
+    nsig_data->SetXTitle("Pt (GeV/c)");
+    gPad->SetLogz();
+    gPad->SetGridy();
+    gPad->SetGridx();
+    nsig_data->DrawClone("colz");
+    cnsig->cd(2);
+    TH2F *nsig_mc = (TH2F*)((TH2F*)hman_mc->GetNSigHistogram(Form("hHistNSig%sPtTPC",Particle[ipart].Data())))->Clone();
+    nsig_mc->GetYaxis()->SetRangeUser(-5,5);
+    nsig_mc->Scale(1/nsig_mc->GetMaximum());
+    nsig_mc->SetXTitle("Pt (GeV/c)");
+    gPad->SetLogz();
+    gPad->SetGridy();
+    gPad->SetGridx();
+    nsig_mc->DrawClone("colz");
+    cnsig->cd(3);
+    TH2F *nsig_data = (TH2F*)((TH2F*)hman_data->GetNSigHistogram(Form("hHistNSig%sPtTOF",Particle[ipart].Data())))->Clone();
+    nsig_data->GetYaxis()->SetRangeUser(-5,5);
+    nsig_data->Scale(1/nsig_data->GetMaximum());
+    nsig_data->SetXTitle("Pt (GeV/c)");
+    gPad->SetLogz();
+    gPad->SetGridy();
+    gPad->SetGridx();
+    nsig_data->DrawClone("colz");
+    cnsig->cd(4);
+    TH2F *nsig_mc = (TH2F*)((TH2F*)hman_mc->GetNSigHistogram(Form("hHistNSig%sPtTOF",Particle[ipart].Data())))->Clone();
+    nsig_mc->GetYaxis()->SetRangeUser(-5,5);
+    nsig_mc->Scale(1/nsig_mc->GetMaximum());
+    nsig_mc->SetXTitle("Pt (GeV/c)");
+    gPad->SetLogz();
+    gPad->SetGridy();
+    gPad->SetGridx();
+    nsig_mc->DrawClone("colz");
+    cnsig->cd(5);
+    TH2F *nsig_data = (TH2F*)((TH2F*)hman_data->GetNSigHistogram(Form("hHistNSig%sPtTPCTOF",Particle[ipart].Data())))->Clone();
+    nsig_data->GetYaxis()->SetRangeUser(0,5);
+    nsig_data->Scale(1/nsig_data->GetMaximum());
+    nsig_data->SetXTitle("Pt (GeV/c)");
+    gPad->SetLogz();
+    gPad->SetGridy();
+    gPad->SetGridx();
+    nsig_data->DrawClone("colz");
+    cnsig->cd(6);
+    TH2F *nsig_mc = (TH2F*)((TH2F*)hman_mc->GetNSigHistogram(Form("hHistNSig%sPtTPCTOF",Particle[ipart].Data())))->Clone();
+    nsig_mc->GetYaxis()->SetRangeUser(0,5);
+    nsig_mc->Scale(1/nsig_mc->GetMaximum());
+    nsig_mc->SetXTitle("Pt (GeV/c)");
+    gPad->SetLogz();
+    gPad->SetGridy();
+    gPad->SetGridx();
+    nsig_mc->DrawClone("colz");
+  }
+  
+  //NSigma projection in data and MC
+  Double_t Proj1[2]={0.4,0.5};
+  Double_t Proj2[2]={1.1,1.2};
+  TCanvas *cnsigProjection=new TCanvas("cnsigProjection","cnsigProjection",700,500);
+  cnsigProjection->Divide(2,3);
+  //TPC
+  for(Int_t ipart=0;ipart<3;ipart++){
+    TH2F *nsig_data = (TH2F*)((TH2F*)hman_data->GetNSigHistogram(Form("hHistNSig%sPtTPC",Particle[ipart].Data())))->Clone();
+    TH1F *nsig_data_Proj1=(TH1F*)nsig_data->ProjectionY(Form("TPC NsigProjectionv %s, data [%.1f,%.1f]",Particle[ipart].Data(),Proj1[0],Proj1[1]),
+                                                       nsig_data->GetXaxis()->FindBin(Proj1[0]),nsig_data->GetXaxis()->FindBin(Proj1[1]));
+    TH1F *nsig_data_Proj2=(TH1F*)nsig_data->ProjectionY(Form("TPC NsigProjection %s, data [%.1f,%.1f]",Particle[ipart].Data(),Proj2[0],Proj2[1]),
+                                                       nsig_data->GetXaxis()->FindBin(Proj2[0]),nsig_data->GetXaxis()->FindBin(Proj2[1]));
+    nsig_data_Proj1->SetTitle(Form("TPC NsigProjection %s, data [%.1f,%.1f]",Particle[ipart].Data(),Proj1[0],Proj1[1]));
+    nsig_data_Proj2->SetTitle(Form("TPC NsigProjection %s, data [%.1f,%.1f]",Particle[ipart].Data(),Proj2[0],Proj2[1]));
+    TH2F *nsig_mc = (TH2F*)((TH2F*)hman_mc->GetNSigHistogram(Form("hHistNSig%sPtTPC",Particle[ipart].Data())))->Clone();
+    TH1F *nsig_mc_Proj1=(TH1F*)nsig_mc->ProjectionY(Form("TPC NsigProjection %s, mc [%.1f,%.1f]",Particle[ipart].Data(),Proj1[0],Proj1[1]),
+                                                   nsig_mc->GetXaxis()->FindBin(Proj1[0]),nsig_mc->GetXaxis()->FindBin(Proj1[1]));
+    TH1F *nsig_mc_Proj2=(TH1F*)nsig_mc->ProjectionY(Form("TPC NsigProjection %s, mc [%.1f,%.1f]",Particle[ipart].Data(),Proj2[0],Proj2[1]),
+                                                   nsig_mc->GetXaxis()->FindBin(Proj2[0]),nsig_mc->GetXaxis()->FindBin(Proj2[1]));
+    nsig_mc_Proj1->SetTitle(Form("TPC NsigProjection %s, mc [%.1f,%.1f]",Particle[ipart].Data(),Proj1[0],Proj1[1]));
+    nsig_mc_Proj2->SetTitle(Form("TPC NsigProjection %s, mc [%.1f,%.1f]",Particle[ipart].Data(),Proj2[0],Proj2[1]));
+    nsig_mc_Proj1->SetLineColor(2);
+    nsig_mc_Proj2->SetLineColor(2);
+    cnsigProjection->cd(2*ipart+1);
+    gPad->SetLogy();
+    gPad->SetGridy();
+    gPad->SetGridx();
+    nsig_data_Proj1->DrawNormalized("lhist");
+    nsig_mc_Proj1->DrawNormalized("lhistsame");
+    gPad->BuildLegend();
+    cnsigProjection->cd(2*ipart+2);
+    gPad->SetLogy();
+    gPad->SetGridy();
+    gPad->SetGridx();
+    nsig_data_Proj2->DrawNormalized("lhist");
+    nsig_mc_Proj2->DrawNormalized("lhistsame");
+    gPad->BuildLegend();
+  }
+  return;
+
+  //Muon over Pion Ratio
+  Printf("\n\n-> Muon Over Pion");
+  TCanvas *cMu=new TCanvas("cMu","cMu");
+  TH1F *hMuOverPi[2];
+  TH1F *hMuOverPi_bis[2];
+  for(Int_t icharge=0;icharge<2;icharge++){
+    TString hname=Form("hHistPtRecTruePrimaryMuon%s",Sign[icharge].Data());
+    hMuOverPi[icharge]=(TH1F*)((TH1F*) hman_mc->GetPtHistogram1D(hname.Data(),-1,-1))->Clone();
+    hname=Form("hHistPtRecTruePrimaryPion%s",Sign[icharge].Data());
+    hMuOverPi[icharge]->Divide((TH1F*)((TH1F*) hman_mc->GetPtHistogram1D(hname.Data(),-1,-1))->Clone());
+    hname=Form("hHistPtRecTrueMuon%s",Sign[icharge].Data());
+    hMuOverPi_bis[icharge]=(TH1F*)((TH1F*) hman_mc->GetPtHistogram1D(hname.Data(),-1,-1))->Clone();
+    hname=Form("hHistPtRecTruePrimaryPion%s",Sign[icharge].Data());
+    hMuOverPi_bis[icharge]->Divide((TH1F*)((TH1F*) hman_mc->GetPtHistogram1D(hname.Data(),-1,-1))->Clone());
+    hMuOverPi_bis[icharge]->SetMarkerColor(2);
+    hMuOverPi_bis[icharge]->SetLineColor(2);
+    if(icharge==0)hMuOverPi_bis[icharge]->DrawClone();
+    else hMuOverPi_bis[icharge]->DrawClone("same");
+    hMuOverPi[icharge]->DrawClone("same");
+  }
+  
+  //Contamination
+  Printf("\n\n-> Contamination from MC");
+  TH1F *Cont[6];
+  TCanvas *ccont=new TCanvas("ccont","ccont",700,500);
+  for(Int_t icharge=0;icharge<2;icharge++){
+    for(Int_t ipart=0;ipart<3;ipart++){
+      Int_t index=ipart+3*icharge;
+      TString hname=Form("hHistPtRecTrue%s%s",Particle[ipart].Data(),Sign[icharge].Data());
+      Printf("Getting %s",hname.Data());
+      Cont[index] =(TH1F*)((TH1F*) hman_mc->GetPtHistogram1D(hname.Data(),-1,-1))->Clone();
+      Cont[index]->SetName(Form("Cont_%s%s",Particle[ipart].Data(),Sign[icharge].Data()));
+      Cont[index]->SetTitle(Form("RecTrue/RecSigma %s%s",Particle[ipart].Data(),Sign[icharge].Data()));
+      Cont[index]->SetMarkerStyle(Marker[index]);
+      Cont[index]->SetMarkerColor(Color[ipart]);
+      Cont[index]->SetLineColor(Color[ipart]);
+      hname=Form("hHistPtRecSigma%s%s",Particle[ipart].Data(),Sign[icharge].Data());
+      Printf("... and divide it by %s",hname.Data());
+      Cont[index]->Divide((TH1F*) hman_mc->GetPtHistogram1D(hname.Data(),-1,-1));
+      if(index==0)Cont[index]->DrawClone();
+      else Cont[index]->DrawClone("same");
+      //Spectra[index]->Multiply(Cont[index]);
+    }
+  } 
+  gPad->BuildLegend();
+
+
+  //Raw yield
+  TH1F *hRaw_data_allCh=(TH1F*)((TH1F*) hman_data->GetPtHistogram1D("hHistPtRec",-1,-1))->Clone();
+  hRaw_data_allCh->Scale(1./ecuts_data->NumberOfEvents(),"width");
+  TH1F *hRaw_mc_allCh=(TH1F*)((TH1F*) hman_mc->GetPtHistogram1D("hHistPtRec",-1,-1))->Clone();
+  hRaw_mc_allCh->Scale(1./ecuts_mc->NumberOfEvents(),"width");
+      
+  TCanvas *cRaw=new TCanvas("cRaw","cRaw",700,500);
+  cRaw->Divide(2,2);
+  cRaw->cd(1);
+  gPad->SetLogy();
+  gPad->SetGridy();
+  gPad->SetGridx();
+  hRaw_data_allCh->DrawClone();
+  hRaw_mc_allCh->DrawClone("lhistsame");
+  cRaw->cd(2);
+  gPad->SetLogy();
+  gPad->SetGridy();
+  gPad->SetGridx();
+  hRaw_data_allCh->DrawClone();
+  hRaw_mc_allCh->DrawClone("lhistsame"); 
+  hRaw_data_allCh->Divide(hRaw_mc_allCh);
+  hRaw_data_allCh->SetLineStyle(2);
+  cRaw->cd(3);
+  gPad->SetGridy();
+  gPad->SetGridx();
+  hRaw_data_allCh->DrawClone("lhist");
+  cRaw->cd(4);
+  gPad->SetGridy();
+  gPad->SetGridx();
+  hRaw_data_allCh->DrawClone("lhist");
+  TH1F *hRaw_data[6];
+  TH1F *hRaw_mc[6];
+  for(Int_t icharge=0;icharge<2;icharge++){
+    for(Int_t ipart=0;ipart<3;ipart++){
+      Int_t index=ipart+3*icharge;
+      TString hname=Form("hHistPtRecSigma%s%s",Particle[ipart].Data(),Sign[icharge].Data()); //MC correction for Prim+Cont+Eff
+      hRaw_data[index]=(TH1F*)((TH1F*) hman_data->GetPtHistogram1D(hname.Data(),-1,-1))->Clone();
+      hRaw_data[index]->SetMarkerStyle(Marker[index]);
+      hRaw_data[index]->SetMarkerColor(Color[ipart]);
+      hRaw_data[index]->SetLineColor(Color[ipart]);
+      hRaw_data[index]->Scale(1./ecuts_data->NumberOfEvents(),"width");
+      hRaw_mc[index]=(TH1F*)((TH1F*) hman_mc->GetPtHistogram1D(hname.Data(),-1,-1))->Clone();
+      hRaw_mc[index]->SetMarkerStyle(Marker[index]);
+      hRaw_mc[index]->SetMarkerColor(Color[ipart]);
+      hRaw_mc[index]->SetLineColor(Color[ipart]);
+      hRaw_mc[index]->Scale(1./ecuts_mc->NumberOfEvents(),"width");
+      for(Int_t ibin=0;ibin<hRaw_data[index]->GetNbinsX();ibin++){
+       if(hRaw_data[index]->GetBinCenter(ibin)<Range[ipart]){
+         hRaw_data[index]->SetBinContent(ibin,0);
+         hRaw_data[index]->SetBinError(ibin,0);
+         hRaw_mc[index]->SetBinContent(ibin,0);
+         hRaw_mc[index]->SetBinError(ibin,0);
+       }
+      }
+      cRaw->cd(icharge+1);
+      hRaw_data[index]->DrawClone("same");
+      hRaw_mc[index]->DrawClone("lhistsame");
+      hRaw_data[index]->Divide(hRaw_mc[index]);
+      cRaw->cd(icharge+3);
+      hRaw_data[index]->DrawClone("lhistsame");
+    }
+  } 
+  
+
+  
+  //PID Efficiency //TO BE IMPLEMENTED, need to add TrueSigma in the Task
+  // Printf("\n\n-> PID efficiency from MC");
+  // TH1F *PIDEff[6];
+  // TCanvas *ccont=new TCanvas("ccont","ccont",700,500);
+  // for(Int_t icharge=0;icharge<2;icharge++){
+  //   for(Int_t ipart=0;ipart<3;ipart++){
+  //     Int_t index=ipart+3*icharge;
+  //     TString hname=Form("hHistPtRecTrue%s%s",Particle[ipart].Data(),Sign[icharge].Data());
+  //     Printf("Getting %s",hname.Data());
+  //     PIDEff[index] =(TH1F*)((TH1F*) hman_mc->GetPtHistogram1D(hname.Data(),-1,-1))->Clone();
+  //     PIDEff[index]->SetName(Form("PIDEff_%s%s",Particle[ipart].Data(),Sign[icharge].Data()));
+  //     PIDEff[index]->SetTitle(Form("RecTrue/RecSigma %s%s",Particle[ipart].Data(),Sign[icharge].Data()));
+  //     PIDEff[index]->SetMarkerStyle(Marker[index]);
+  //     PIDEff[index]->SetMarkerColor(Color[ipart]);
+  //     PIDEff[index]->SetLineColor(Color[ipart]);
+  //     hname=Form("hHistPtRecSigma%s%s",Particle[ipart].Data(),Sign[icharge].Data());
+  //     Printf("... and divide it by %s",hname.Data());
+  //     PIDEff[index]->Divide((TH1F*) hman_mc->GetPtHistogram1D(hname.Data(),-1,-1));
+  //     if(index==0)PIDEff[index]->DrawClone();
+  //     else PIDEff[index]->DrawClone("same");
+  //     //Spectra[index]->Multiply(PIDEff[index]);
+  //   }
+  // } 
+  // gPad->BuildLegend();
+
+  //qvec in data and MC
+  // for (Int_t icharge=0;icharge<2;icharge++){
+  //   TCanvas *cqvec=new TCanvas(Form("cqvec%s",Charge[icharge].Data()),Form("cqvec%s",Charge[icharge].Data()),700,500);
+  //   cqvec->Divide(2,1);
+  //   cqvec->cd(1);
+  //   TString hname=Form("hHistqVec%s",Charge[icharge].Data());
+  //   TH2F *qvec_data = (TH2F*)((TH2F*)hman_data->GetqVecHistogram(hname.Data()))->Clone();
+  //   gPad->SetLogz();
+  //   gPad->SetGridy();
+  //   gPad->SetGridx();
+  //   qvec_data->DrawClone("colz");
+  //   cqvec->cd(2);
+  //   TH2F *qvec_mc = (TH2F*)((TH2F*)hman_mc->GetqVecHistogram(hname.Data()))->Clone();
+  //   gPad->SetLogz();
+  //   gPad->SetGridy();
+  //   gPad->SetGridx();
+  //   qvec_mc->DrawClone("colz");
+    
+  //   TCanvas *cProjqvec=new TCanvas(Form("cProjqvec%s",Charge[icharge].Data()),Form("cProjqvec%s",Charge[icharge].Data()),700,500);
+  //   cProjqvec->Divide(3,2);
+  //   for(Int_t iproj=0;iproj<3;iproj++){
+  //     TH1F *proj_data=(TH1F*)qvec_data->ProjectionX("data",qvec_data->GetYaxis()->FindBin(projl[iproj]),qvec_data->GetYaxis()->FindBin(proju[iproj]));
+  //     if(proj_data->GetEntries()==0)continue;
+  //     proj_data->Scale(1/proj_data->GetEntries());
+  //     proj_data->SetTitle(Form("data q%s [%.0f,%.0f]",Charge[icharge].Data(),projl[iproj],proju[iproj]));
+  //     TH1F *proj_mc=(TH1F*)qvec_mc->ProjectionX("mc",qvec_mc->GetYaxis()->FindBin(projl[iproj]),qvec_mc->GetYaxis()->FindBin(proju[iproj]));
+  //     proj_mc->Scale(1/proj_mc->GetEntries());
+  //     proj_mc->SetTitle(Form("mc q%s [%.0f,%.0f]",Charge[icharge].Data(),projl[iproj],proju[iproj]));
+  //     proj_mc->SetLineColor(2);
+  //     cProjqvec->cd(iproj+1);
+  //     gPad->SetGridy();
+  //     gPad->SetGridx();
+  //     proj_data->DrawClone();
+  //     proj_mc->DrawClone("same");
+  //     gPad->BuildLegend();
+  //     proj_data->Divide(proj_mc);
+  //     cProjqvec->cd(iproj+4);
+  //     proj_data->DrawClone();
+  //   }
+  // }
+  
+  
+  
+} 
index 2e891bd..de6b333 100644 (file)
@@ -1,4 +1,4 @@
-void runAODProof(Int_t c=4, const char * proofMode = "full")
+void runAODProof(Int_t c=1, const char * proofMode = "full")
 { //1 data AOD049
   //2 MC AOD048
   //3 data AOD086
@@ -8,147 +8,150 @@ void runAODProof(Int_t c=4, const char * proofMode = "full")
   
   gSystem->Load("libTree.so");
   gSystem->Load("libGeom.so");
-   gSystem->Load("libVMC.so");
-   gSystem->Load("libPhysics.so");
-   gSystem->Load("libSTEERBase.so");
-   gSystem->Load("libESD.so");
-   gSystem->Load("libAOD.so");
-   gSystem->Load("libANALYSIS.so");
-   gSystem->Load("libOADB.so");
-   gSystem->Load("libANALYSISalice.so");
-   gSystem->AddIncludePath("-I$ALICE_ROOT/include");
+  gSystem->Load("libVMC.so");
+  gSystem->Load("libPhysics.so");
+  gSystem->Load("libSTEERBase.so");
+  gSystem->Load("libESD.so");
+  gSystem->Load("libAOD.so");
+  gSystem->Load("libANALYSIS.so");
+  gSystem->Load("libOADB.so");
+  gSystem->Load("libANALYSISalice.so");
+  gSystem->AddIncludePath("-I$ALICE_ROOT/include");
 
-   AliAnalysisAlien * handler = new AliAnalysisAlien("test");
-   handler->SetOverwriteMode();
-   handler->SetRunMode(proofMode);
-   handler->SetProofReset(0);
-   //handler->SetROOTVersion("v5-33-02a");
-   //handler->SetAliROOTVersion("v5-03-11-AN");
-   handler->SetAliROOTVersion("v5-04-25-AN");
+  AliAnalysisAlien * handler = new AliAnalysisAlien("test");
+  handler->SetOverwriteMode();
+  handler->SetRunMode(proofMode);
+  handler->SetProofReset(0);
+  //handler->SetROOTVersion("v5-33-02a");
+  //handler->SetAliROOTVersion("v5-03-11-AN");
+  handler->SetAliROOTVersion("v5-04-25-AN");
    
-   handler->SetNproofWorkers(54);
-   //handler->SetNproofWorkersPerSlave(4);
-   handler->SetProofCluster(Form("%s@alice-caf.cern.ch", gSystem->Getenv("CAFUSER")));
-   //handler->SetProofCluster(Form("%s@skaf.saske.sk",gSystem->Getenv("CAFUSER")));
-   // Set handler for Real DATA:
-   if (c == 1){
-     //handler->SetProofDataSet("/alice/data/LHC10h_000138653_p2_AOD049#aodTree");
-     handler->SetProofDataSet("/alice/data/LHC10h_000138653_p2_AOD049#aodTree|/alice/data/LHC10h_000138662_p2_AOD049#aodTree|/alice/data/LHC10h_000138666_p2_AOD049#aodTree|/alice/data/LHC10h_000138795_p2_AOD049#aodTree|/alice/data/LHC10h_000139107_p2_AOD049#aodTree|/alice/data/LHC10h_000139110_p2_AOD049#aodTree");
-   }
-   if (c == 2){
-     handler->SetProofDataSet("/alice/sim/LHC11a10a_000138653_AOD048#aodTree|/alice/sim/LHC11a10a_000138662_AOD048#aodTree|/alice/sim/LHC11a10a_000138666_AOD048#aodTree|/alice/sim/LHC11a10a_000138795_AOD048#aodTree|/alice/sim/LHC11a10a_000139107_AOD048#aodTree|/alice/sim/LHC11a10a_000139110_AOD048#aodTree");      
-   }
-   if (c == 3){
-     //handler->SetProofDataSet("/default/lmilano/LHC10h_000138653_AOD086_p2#aodTree");      
-     handler->SetProofDataSet("/default/lmilano/LHC10h_000138653_AOD086_p2#aodTree|/default/lmilano/LHC10h_000138662_AOD086_p2#aodTree|/default/lmilano/LHC10h_000138666_AOD086_p2#aodTree|/default/lmilano/LHC10h_000139107_AOD086_p2#aodTree");      
-   }
-   if (c == 4){
-     handler->SetProofDataSet("/default/lmilano/LHC11a10a_bis_138653_AOD090#aodTree|/default/lmilano/LHC11a10a_bis_138662_AOD090#aodTree|/default/lmilano/LHC11a10a_bis_138666_AOD090#aodTree|/default/lmilano/LHC11a10a_bis_139107_AOD090#aodTree");      
-   }
+  handler->SetNproofWorkers(54);
+  //handler->SetNproofWorkersPerSlave(4);
+  handler->SetProofCluster(Form("%s@alice-caf.cern.ch", gSystem->Getenv("CAFUSER")));
+  //handler->SetProofCluster(Form("%s@skaf.saske.sk",gSystem->Getenv("CAFUSER")));
+  // Set handler for Real DATA:
+  if (c == 1){
+    //handler->SetProofDataSet("/alice/data/LHC10h_000138653_p2_AOD049#aodTree");
+    //handler->SetProofDataSet("/alice/data/LHC10h_000138653_p2_AOD049#aodTree|/alice/data/LHC10h_000138662_p2_AOD049#aodTree|/alice/data/LHC10h_000138666_p2_AOD049#aodTree|/alice/data/LHC10h_000138795_p2_AOD049#aodTree|/alice/data/LHC10h_000139107_p2_AOD049#aodTree|/alice/data/LHC10h_000139110_p2_AOD049#aodTree");
+    handler->SetProofDataSet("/default/lmilano/LHC10h_000138653_AOD049_p2#aodTree|/default/lmilano/LHC10h_000138662_AOD049_p2#aodTree|/default/lmilano/LHC10h_000138666_AOD049_p2#aodTree|/default/lmilano/LHC10h_000138730_AOD049_p2#aodTree|/default/lmilano/LHC10h_000138732_AOD049_p2#aodTree|/default/lmilano/LHC10h_000139507_AOD049_p2#aodTree|/default/lmilano/LHC10h_000139465_AOD049_p2#aodTree|/default/lmilano/LHC10h_000139437_AOD049_p2#aodTree|/default/lmilano/LHC10h_000139107_AOD049_p2#aodTree|/default/lmilano/LHC10h_000139510_AOD049_p2#aodTree");
+  }
+  if (c == 2){
+    //handler->SetProofDataSet("/alice/sim/LHC11a10a_000138653_AOD048#aodTree|/alice/sim/LHC11a10a_000138662_AOD048#aodTree|/alice/sim/LHC11a10a_000138666_AOD048#aodTree|/alice/sim/LHC11a10a_000138795_AOD048#aodTree|/alice/sim/LHC11a10a_000139107_AOD048#aodTree|/alice/sim/LHC11a10a_000139110_AOD048#aodTree");      
+  handler->SetProofDataSet("/default/lmilano/LHC11a10a_138653_AOD048#aodTree|/default/lmilano/LHC11a10a_138662_AOD048#aodTree|/default/lmilano/LHC11a10a_138666_AOD048#aodTree|/default/lmilano/LHC11a10a_138730_AOD048#aodTree|/default/lmilano/LHC11a10a_138732_AOD048#aodTree|/default/lmilano/LHC11a10a_139507_AOD048#aodTree|/default/lmilano/LHC11a10a_139465_AOD048#aodTree|/default/lmilano/LHC11a10a_139437_AOD048#aodTree|/default/lmilano/LHC11a10a_139107_AOD048#aodTree|/default/lmilano/LHC11a10a_139510_AOD048#aodTree");      
+  }
+  if (c == 3){
+    handler->SetProofDataSet("/default/lmilano/LHC10h_000138653_AOD086_p2#aodTree|/default/lmilano/LHC10h_000138662_AOD086_p2#aodTree|/default/lmilano/LHC10h_000138666_AOD086_p2#aodTree|/default/lmilano/LHC10h_000139107_AOD086_p2#aodTree|/default/lmilano/LHC10h_000138275_AOD086_p2#aodTree");      
+    //    handler->SetProofDataSet("/default/lmilano/LHC10h_000138275_AOD086_p2#aodTree");      
+  }
+  if (c == 4){
+    handler->SetProofDataSet("/default/lmilano/LHC11a10a_bis_138653_AOD090#aodTree|/default/lmilano/LHC11a10a_bis_138662_AOD090#aodTree|/default/lmilano/LHC11a10a_bis_138666_AOD090#aodTree|/default/lmilano/LHC11a10a_bis_139107_AOD090#aodTree|/default/lmilano/LHC11a10a_bis_138653_AOD090#aodTree");      
+    // handler->SetProofDataSet("/default/lmilano/LHC11a10a_bis_138653_AOD090#aodTree");      
+  }
    
-   gROOT->LoadMacro("AliSpectraAODTrackCuts.cxx+g");
-   gROOT->LoadMacro("AliSpectraAODEventCuts.cxx+g");
-   gROOT->LoadMacro("AliSpectraAODHistoManager.cxx+g");
-   gROOT->LoadMacro("AliSpectraAODPID.cxx+g");
-   gROOT->LoadMacro("AliAnalysisTaskSpectraAOD.cxx+g");
+  gROOT->LoadMacro("AliSpectraAODTrackCuts.cxx+g");
+  gROOT->LoadMacro("AliSpectraAODEventCuts.cxx+g");
+  gROOT->LoadMacro("AliSpectraAODHistoManager.cxx+g");
+  gROOT->LoadMacro("AliSpectraAODPID.cxx+g");
+  gROOT->LoadMacro("AliAnalysisTaskSpectraAOD.cxx+g");
 
-   handler->SetAliRootMode("default");
-   handler->SetAdditionalLibs("AliSpectraAODHistoManager.cxx AliSpectraAODHistoManager.h AliSpectraAODPID.cxx AliSpectraAODPID.h AliSpectraAODTrackCuts.cxx AliSpectraAODTrackCuts.h AliSpectraAODEventCuts.cxx AliSpectraAODEventCuts.h AliAnalysisTaskSpectraAOD.cxx AliAnalysisTaskSpectraAOD.h");
-   handler->SetAnalysisSource("Histograms.h HistogramNames.h AliSpectraAODHistoManager.cxx+ AliSpectraAODTrackCuts.cxx+ AliSpectraAODEventCuts.cxx+ AliSpectraAODPID.cxx+ AliAnalysisTaskSpectraAOD.cxx+");
-   //   handler->SetFileForTestMode("filelist.txt"); // list of local files for testing
-   //  handler->SetAliRootMode("");
-   handler->SetClearPackages();
+  handler->SetAliRootMode("default");
+  handler->SetAdditionalLibs("AliSpectraAODHistoManager.cxx AliSpectraAODHistoManager.h AliSpectraAODPID.cxx AliSpectraAODPID.h AliSpectraAODTrackCuts.cxx AliSpectraAODTrackCuts.h AliSpectraAODEventCuts.cxx AliSpectraAODEventCuts.h AliAnalysisTaskSpectraAOD.cxx AliAnalysisTaskSpectraAOD.h");
+  handler->SetAnalysisSource("Histograms.h HistogramNames.h AliSpectraAODHistoManager.cxx+ AliSpectraAODTrackCuts.cxx+ AliSpectraAODEventCuts.cxx+ AliSpectraAODPID.cxx+ AliAnalysisTaskSpectraAOD.cxx+");
+  //   handler->SetFileForTestMode("filelist.txt"); // list of local files for testing
+  //  handler->SetAliRootMode("");
+  handler->SetClearPackages();
    
-   AliAnalysisManager *mgr = new AliAnalysisManager("testAnalysis");
-   mgr->SetGridHandler(handler);
-   AliAODInputHandler* aodH = new AliAODInputHandler();
-   mgr->SetInputEventHandler(aodH);
+  AliAnalysisManager *mgr = new AliAnalysisManager("testAnalysis");
+  mgr->SetGridHandler(handler);
+  AliAODInputHandler* aodH = new AliAODInputHandler();
+  mgr->SetInputEventHandler(aodH);
    
-   // Add PID task
-   gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
-   Bool_t isMC = kFALSE;
-   if (c == 2 || c == 4) isMC = kTRUE;   
-   AliAnalysisTask * taskPID = AddTaskPIDResponse(isMC);
-   mgr->AddTask(taskPID);
+  // Add PID task
+  gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
+  Bool_t isMC = kFALSE;
+  if (c == 2 || c == 4) isMC = kTRUE;   
+  AliAnalysisTask * taskPID = AddTaskPIDResponse(isMC);
+  mgr->AddTask(taskPID);
    
-   //LOOP OVER SELECTION
-   Double_t CentCutMin[4]={0,0,20,20};
-   Double_t CentCutMax[4]={100,5,40,40};
-   Double_t QvecCutMin[4]={0,0,0,3};
-   Double_t QvecCutMax[4]={100,100,2,100};
-   // Double_t CentCutMin[4]={5,10,20,30};
-   // Double_t CentCutMax[4]={10,20,30,40};
-   // Double_t QvecCutMin[4]={0,0,0,0};
-   // Double_t QvecCutMax[4]={100,100,100,100};
-   using namespace AliSpectraNameSpace;
-   AliSpectraAODPID *pid = new AliSpectraAODPID(kNSigmaTPCTOF); 
-   pid->SetNSigmaCut(3.);
+  //LOOP OVER SELECTION
+  Double_t CentCutMin[4]={0,0,20,20};
+  Double_t CentCutMax[4]={100,5,40,40};
+  Double_t QvecCutMin[4]={0,0,0,3};
+  Double_t QvecCutMax[4]={100,100,2,100};
+  // Double_t CentCutMin[4]={5,10,20,30};
+  // Double_t CentCutMax[4]={10,20,30,40};
+  // Double_t QvecCutMin[4]={0,0,0,0};
+  // Double_t QvecCutMax[4]={100,100,100,100};
+  using namespace AliSpectraNameSpace;
+  AliSpectraAODPID *pid = new AliSpectraAODPID(kNSigmaTPCTOF); 
+  pid->SetNSigmaCut(3.);
    
-   for(Int_t iCut=1;iCut<2;iCut++){
-     AliAnalysisTaskSpectraAOD *task = new AliAnalysisTaskSpectraAOD("TaskAODExercise");
-     mgr->AddTask(task);
-     //physics selection
-     task->SelectCollisionCandidates();     
-     // set pid object
-     task->SetPID(pid);
-     // Set the cuts
-     AliSpectraAODEventCuts * vcuts = new AliSpectraAODEventCuts("Event Cuts");
-     AliSpectraAODTrackCuts  * tcuts = new AliSpectraAODTrackCuts("Track Cuts");
-     //if(c==1 || c==2)tcuts->SetTrackType(5); //AOD 046 & 047. Standard Cut with loose DCA
-     if(c==1 || c==2)tcuts->SetTrackType(6); //AOD 046 & 047. Standard Cut with tight DCA
-     if(c==3 || c==4)tcuts->SetTrackType(10); //AOD 086 & 090. Standard Raa cut
-     //if(c==3 || c==4)tcuts->SetTrackType(8); //AOD 086 & 090. TPC only
-     //if(c==3 || c==4)tcuts->SetTrackType(2); //AOD 086 & 090. ITS strong
-     tcuts->SetEta(.8);
-     //tcuts->SetDCA(.1);
-     tcuts->SetPt(5);
-     tcuts->SetY(.5);
-     tcuts->SetPtTOFMatching(.6);   
-     tcuts->SetQvecMin(QvecCutMin[iCut]);   
-     tcuts->SetQvecMax(QvecCutMax[iCut]);    
-     vcuts->SetCentralityCutMax(CentCutMax[iCut]);  
-     vcuts->SetCentralityCutMin(CentCutMin[iCut]);
-     task->SetEventCuts(vcuts);
-     task->SetTrackCuts(tcuts);
-     vcuts->PrintCuts();
-     tcuts->PrintCuts();
+  for(Int_t iCut=1;iCut<2;iCut++){
+    AliAnalysisTaskSpectraAOD *task = new AliAnalysisTaskSpectraAOD("TaskAODExercise");
+    mgr->AddTask(task);
+    //physics selection
+    task->SelectCollisionCandidates();     
+    // set pid object
+    task->SetPID(pid);
+    // Set the cuts
+    AliSpectraAODEventCuts * vcuts = new AliSpectraAODEventCuts("Event Cuts");
+    AliSpectraAODTrackCuts  * tcuts = new AliSpectraAODTrackCuts("Track Cuts");
+    if(c==1 || c==2)tcuts->SetTrackType(5); //AOD 046 & 047. Standard Cut with loose DCA
+    //if(c==1 || c==2)tcuts->SetTrackType(6); //AOD 046 & 047. Standard Cut with tight DCA
+    if(c==3 || c==4)tcuts->SetTrackType(10); //AOD 086 & 090. Standard Raa cut
+    //if(c==3 || c==4)tcuts->SetTrackType(8); //AOD 086 & 090. TPC only
+    //if(c==3 || c==4)tcuts->SetTrackType(2); //AOD 086 & 090. ITS strong
+    tcuts->SetEta(.8);
+    //tcuts->SetDCA(.1);
+    tcuts->SetPt(5);
+    tcuts->SetY(.5);
+    tcuts->SetPtTOFMatching(.6);   
+    tcuts->SetQvecMin(QvecCutMin[iCut]);   
+    tcuts->SetQvecMax(QvecCutMax[iCut]);    
+    vcuts->SetCentralityCutMax(CentCutMax[iCut]);  
+    vcuts->SetCentralityCutMin(CentCutMin[iCut]);
+    task->SetEventCuts(vcuts);
+    task->SetTrackCuts(tcuts);
+    vcuts->PrintCuts();
+    tcuts->PrintCuts();
      
-     // check for MC or real data
-     if (c == 2 || c == 4)
-       {
-        task->SetIsMC(kTRUE);
-        AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
-        AliAnalysisDataContainer *coutputpt1 = mgr->CreateContainer(Form("chistpt%d",iCut), AliSpectraAODHistoManager::Class(),  AliAnalysisManager::kOutputContainer, 
-                                                                    Form("Pt.AOD.1._MC_Cent%.0fto%.0f_QVec%.1fto%.1f.root",CentCutMin[iCut],CentCutMax[iCut],QvecCutMin[iCut],QvecCutMax[iCut]));
-        AliAnalysisDataContainer *coutputpt2 = mgr->CreateContainer(Form("cvcutpt%d",iCut), AliSpectraAODEventCuts::Class(),    AliAnalysisManager::kOutputContainer, 
-                                                                    Form("Pt.AOD.1._MC_Cent%.0fto%.0f_QVec%.1fto%.1f.root",CentCutMin[iCut],CentCutMax[iCut],QvecCutMin[iCut],QvecCutMax[iCut]));
-        AliAnalysisDataContainer *coutputpt3 = mgr->CreateContainer(Form("ctcutpt%d",iCut), AliSpectraAODTrackCuts::Class(),     AliAnalysisManager::kOutputContainer, 
-                                                                    Form("Pt.AOD.1._MC_Cent%.0fto%.0f_QVec%.1fto%.1f.root",CentCutMin[iCut],CentCutMax[iCut],QvecCutMin[iCut],QvecCutMax[iCut]));
-        AliAnalysisDataContainer *coutputpt4 = mgr->CreateContainer(Form("cpidpt%d",iCut),  AliSpectraAODPID::Class(),     AliAnalysisManager::kOutputContainer, 
-                                                                    Form("Pt.AOD.1._MC_Cent%.0fto%.0f_QVec%.1fto%.1f.root",CentCutMin[iCut],CentCutMax[iCut],QvecCutMin[iCut],QvecCutMax[iCut]));
-       }
-     if (c == 1 || c==3)
-       {
-        AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
-        AliAnalysisDataContainer *coutputpt1 = mgr->CreateContainer(Form("chistpt%d",iCut), AliSpectraAODHistoManager::Class(),  AliAnalysisManager::kOutputContainer, 
-                                                                    Form("Pt.AOD.1._data_ptcut_Cent%.0fto%.0f_QVec%.1fto%.1f.root",CentCutMin[iCut],CentCutMax[iCut],QvecCutMin[iCut],QvecCutMax[iCut]));
-        AliAnalysisDataContainer *coutputpt2 = mgr->CreateContainer(Form("cvcutpt%d",iCut), AliSpectraAODEventCuts::Class(),    AliAnalysisManager::kOutputContainer, 
-                                                                    Form("Pt.AOD.1._data_ptcut_Cent%.0fto%.0f_QVec%.1fto%.1f.root",CentCutMin[iCut],CentCutMax[iCut],QvecCutMin[iCut],QvecCutMax[iCut]));
-        AliAnalysisDataContainer *coutputpt3 = mgr->CreateContainer(Form("ctcutpt%d",iCut), AliSpectraAODTrackCuts::Class(),     AliAnalysisManager::kOutputContainer, 
-                                                                    Form("Pt.AOD.1._data_ptcut_Cent%.0fto%.0f_QVec%.1fto%.1f.root",CentCutMin[iCut],CentCutMax[iCut],QvecCutMin[iCut],QvecCutMax[iCut]));
-        AliAnalysisDataContainer *coutputpt4 = mgr->CreateContainer(Form("cpidpt%d",iCut),  AliSpectraAODPID::Class(),     AliAnalysisManager::kOutputContainer, 
-                                                                    Form("Pt.AOD.1._data_ptcut_Cent%.0fto%.0f_QVec%.1fto%.1f.root",CentCutMin[iCut],CentCutMax[iCut],QvecCutMin[iCut],QvecCutMax[iCut]));
+    // check for MC or real data
+    if (c == 2 || c == 4)
+      {
+       task->SetIsMC(kTRUE);
+       AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
+       AliAnalysisDataContainer *coutputpt1 = mgr->CreateContainer(Form("chistpt%d",iCut), AliSpectraAODHistoManager::Class(),  AliAnalysisManager::kOutputContainer, 
+                                                                   Form("Pt.AOD.1._MC_Cent%.0fto%.0f_QVec%.1fto%.1f.root",CentCutMin[iCut],CentCutMax[iCut],QvecCutMin[iCut],QvecCutMax[iCut]));
+       AliAnalysisDataContainer *coutputpt2 = mgr->CreateContainer(Form("cvcutpt%d",iCut), AliSpectraAODEventCuts::Class(),    AliAnalysisManager::kOutputContainer, 
+                                                                   Form("Pt.AOD.1._MC_Cent%.0fto%.0f_QVec%.1fto%.1f.root",CentCutMin[iCut],CentCutMax[iCut],QvecCutMin[iCut],QvecCutMax[iCut]));
+       AliAnalysisDataContainer *coutputpt3 = mgr->CreateContainer(Form("ctcutpt%d",iCut), AliSpectraAODTrackCuts::Class(),     AliAnalysisManager::kOutputContainer, 
+                                                                   Form("Pt.AOD.1._MC_Cent%.0fto%.0f_QVec%.1fto%.1f.root",CentCutMin[iCut],CentCutMax[iCut],QvecCutMin[iCut],QvecCutMax[iCut]));
+       AliAnalysisDataContainer *coutputpt4 = mgr->CreateContainer(Form("cpidpt%d",iCut),  AliSpectraAODPID::Class(),     AliAnalysisManager::kOutputContainer, 
+                                                                   Form("Pt.AOD.1._MC_Cent%.0fto%.0f_QVec%.1fto%.1f.root",CentCutMin[iCut],CentCutMax[iCut],QvecCutMin[iCut],QvecCutMax[iCut]));
+      }
+    if (c == 1 || c==3)
+      {
+       AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
+       AliAnalysisDataContainer *coutputpt1 = mgr->CreateContainer(Form("chistpt%d",iCut), AliSpectraAODHistoManager::Class(),  AliAnalysisManager::kOutputContainer, 
+                                                                   Form("Pt.AOD.1._data_ptcut_Cent%.0fto%.0f_QVec%.1fto%.1f.root",CentCutMin[iCut],CentCutMax[iCut],QvecCutMin[iCut],QvecCutMax[iCut]));
+       AliAnalysisDataContainer *coutputpt2 = mgr->CreateContainer(Form("cvcutpt%d",iCut), AliSpectraAODEventCuts::Class(),    AliAnalysisManager::kOutputContainer, 
+                                                                   Form("Pt.AOD.1._data_ptcut_Cent%.0fto%.0f_QVec%.1fto%.1f.root",CentCutMin[iCut],CentCutMax[iCut],QvecCutMin[iCut],QvecCutMax[iCut]));
+       AliAnalysisDataContainer *coutputpt3 = mgr->CreateContainer(Form("ctcutpt%d",iCut), AliSpectraAODTrackCuts::Class(),     AliAnalysisManager::kOutputContainer, 
+                                                                   Form("Pt.AOD.1._data_ptcut_Cent%.0fto%.0f_QVec%.1fto%.1f.root",CentCutMin[iCut],CentCutMax[iCut],QvecCutMin[iCut],QvecCutMax[iCut]));
+       AliAnalysisDataContainer *coutputpt4 = mgr->CreateContainer(Form("cpidpt%d",iCut),  AliSpectraAODPID::Class(),     AliAnalysisManager::kOutputContainer, 
+                                                                   Form("Pt.AOD.1._data_ptcut_Cent%.0fto%.0f_QVec%.1fto%.1f.root",CentCutMin[iCut],CentCutMax[iCut],QvecCutMin[iCut],QvecCutMax[iCut]));
         
-       }
-     mgr->ConnectInput(task, 0, cinput);
-     mgr->ConnectOutput(task, 1, coutputpt1);
-     mgr->ConnectOutput(task, 2, coutputpt2);
-     mgr->ConnectOutput(task, 3, coutputpt3);
-     mgr->ConnectOutput(task, 4, coutputpt4);
-   }
-   mgr->SetDebugLevel(2);
+      }
+    mgr->ConnectInput(task, 0, cinput);
+    mgr->ConnectOutput(task, 1, coutputpt1);
+    mgr->ConnectOutput(task, 2, coutputpt2);
+    mgr->ConnectOutput(task, 3, coutputpt3);
+    mgr->ConnectOutput(task, 4, coutputpt4);
+  }
+  mgr->SetDebugLevel(2);
    
-   if (!mgr->InitAnalysis()) return;
-   mgr->PrintStatus();
-   mgr->StartAnalysis("proof");
+  if (!mgr->InitAnalysis()) return;
+  mgr->PrintStatus();
+  mgr->StartAnalysis("proof");
 }
index 58982a1..8f8f58a 100644 (file)
@@ -1,15 +1,17 @@
 class  AliAnalysisManager;
 class  AliAnalysisAlien;
 
-void runGrid(TString mode="test",Int_t mc=0,Int_t sub=1,Int_t hi=1,TString fname="AODAnalysis_28May2012/AOD086-090Filter10") 
+void runGrid(TString mode="test",Int_t mc=1,Int_t sub=0,Int_t hi=1,TString fname="AODAnalysis_1June2012") 
 {
+  //0 is AOD048-049 in this case you can choos FilterBit5 (loose DCA) or 6 (tight DCA)!!!!!!!!!
+  //1 is AOD086-090
   AliLog::SetGlobalDebugLevel(100);
   // Load common libraries
   gEnv->SetValue("XSec.GSI.DelegProxy", "2");
   
   gSystem->Load("libTree.so");
-  gSystem->Load("libGeom.so");
-  gSystem->Load("libVMC.so");
+  //gSystem->Load("libGeom.so");
+  //gSystem->Load("libVMC.so");
   gSystem->Load("libPhysics.so");
   gSystem->Load("libSTEERBase.so");
   gSystem->Load("libESD.so");
@@ -19,11 +21,16 @@ void runGrid(TString mode="test",Int_t mc=0,Int_t sub=1,Int_t hi=1,TString fname
   gSystem->Load("libANALYSISalice.so");
   gSystem->AddIncludePath("-I$ALICE_ROOT/include");
 
-  // gROOT->LoadMacro("AliSpectraAODTrackCuts.cxx+g");
-  // gROOT->LoadMacro("AliSpectraAODEventCuts.cxx+g");
-  // gROOT->LoadMacro("AliSpectraAODHistoManager.cxx+g");
-  // gROOT->LoadMacro("AliSpectraAODPID.cxx+g");
-  // gROOT->LoadMacro("AliAnalysisTaskSpectraAOD.cxx+g");
+  // gROOT->LoadMacro("$ALICE_ROOT/SPECTRA/PiKaPr/TestAOD/AliSpectraAODTrackCuts.cxx+g");
+  // gROOT->LoadMacro("$ALICE_ROOT/SPECTRA/PiKaPr/TestAOD/AliSpectraAODEventCuts.cxx+g");
+  // gROOT->LoadMacro("$ALICE_ROOT/SPECTRA/PiKaPr/TestAOD/AliSpectraAODHistoManager.cxx+g");
+  // gROOT->LoadMacro("$ALICE_ROOT/SPECTRA/PiKaPr/TestAOD/AliSpectraAODPID.cxx+g");
+  // gROOT->LoadMacro("$ALICE_ROOT/SPECTRA/PiKaPr/TestAOD/AliAnalysisTaskSpectraAOD.cxx+g");
+  gROOT->LoadMacro("AliSpectraAODTrackCuts.cxx+g");
+  gROOT->LoadMacro("AliSpectraAODEventCuts.cxx+g");
+  gROOT->LoadMacro("AliSpectraAODHistoManager.cxx+g");
+  gROOT->LoadMacro("AliSpectraAODPID.cxx+g");
+  gROOT->LoadMacro("AliAnalysisTaskSpectraAOD.cxx+g");
   // Use AliRoot includes to compile our task
   // Create and configure the alien handler plugin
   
@@ -50,7 +57,7 @@ void runGrid(TString mode="test",Int_t mc=0,Int_t sub=1,Int_t hi=1,TString fname
   //setting the analysis
   Int_t iCut=0;
   //Double_t CentCut[2]={0,100};
-  Double_t CentCut[2]={0,5};
+  Double_t CentCut[2]={0,100};
   Double_t qVecCut[2]={0,100};
    
   //PID object
@@ -67,8 +74,8 @@ void runGrid(TString mode="test",Int_t mc=0,Int_t sub=1,Int_t hi=1,TString fname
   AliSpectraAODEventCuts * vcuts = new AliSpectraAODEventCuts("Event Cuts");
   AliSpectraAODTrackCuts  * tcuts = new AliSpectraAODTrackCuts("Track Cuts");
   if(sub==0){
-    //tcuts->SetTrackType(5); //AOD 046 & 047. Standard Cuts with loose DCA
-    tcuts->SetTrackType(6); //AOD 046 & 047. Standard Cuts with tight DCA
+    tcuts->SetTrackType(5); //AOD 046 & 047. Standard Cuts with loose DCA
+    //tcuts->SetTrackType(6); //AOD 046 & 047. Standard Cuts with tight DCA
   }
   if(sub==1)tcuts->SetTrackType(10); //AOD 086 & 090. Standard Raa cuts
   
@@ -107,7 +114,7 @@ void runGrid(TString mode="test",Int_t mc=0,Int_t sub=1,Int_t hi=1,TString fname
                                                                Form("Pt.AOD.1._data_ptcut_Cent%.0fto%.0f_QVec%.1fto%.1f.root",CentCut[0],CentCut[1],qVecCut[0],qVecCut[1]));
     AliAnalysisDataContainer *coutputpt3 = mgr->CreateContainer(Form("ctcutpt%d",iCut), AliSpectraAODTrackCuts::Class(),     AliAnalysisManager::kOutputContainer, 
                                                                Form("Pt.AOD.1._data_ptcut_Cent%.0fto%.0f_QVec%.1fto%.1f.root",CentCut[0],CentCut[1],qVecCut[0],qVecCut[1]));
-    AliAnalysisDataContainer *coutputpt4 = mgr->CreateContainer(Form("cpidpt%d",iCut), AliSpectraAODTrackCuts::Class(),     AliAnalysisManager::kOutputContainer, 
+    AliAnalysisDataContainer *coutputpt4 = mgr->CreateContainer(Form("cpidpt%d",iCut), AliSpectraAODPID::Class(),     AliAnalysisManager::kOutputContainer, 
                                                                Form("Pt.AOD.1._data_ptcut_Cent%.0fto%.0f_QVec%.1fto%.1f.root",CentCut[0],CentCut[1],qVecCut[0],qVecCut[1]));
   }
   mgr->ConnectInput(task, 0, cinput);
@@ -131,6 +138,9 @@ AliAnalysisGrid* CreateAlienHandler(TString mode="test",Int_t mc=0,Int_t sub=0,T
   
   
   AliAnalysisAlien *plugin = new AliAnalysisAlien();
+  plugin->AddIncludePath("-I. -I$ROOTSYS/include -I$ALICE_ROOT/include -I$ALICE_ROOT/TOF");
+  plugin->SetAdditionalLibs("Histograms.h HistogramNames.h AliSpectraAODHistoManager.cxx AliSpectraAODHistoManager.h AliSpectraAODTrackCuts.cxx AliSpectraAODTrackCuts.h AliSpectraAODEventCuts.cxx AliSpectraAODEventCuts.h AliSpectraAODPID.cxx AliSpectraAODPID.h AliAnalysisTaskSpectraAOD.cxx AliAnalysisTaskSpectraAOD.h");
+  plugin->SetAnalysisSource("Histograms.h HistogramNames.h AliSpectraAODHistoManager.cxx AliSpectraAODTrackCuts.cxx AliSpectraAODEventCuts.cxx AliSpectraAODPID.cxx AliAnalysisTaskSpectraAOD.cxx");
   plugin->SetOverwriteMode();
   plugin->SetExecutableCommand("aliroot -q -b");  
   plugin->SetRunMode(mode.Data());
@@ -150,7 +160,7 @@ AliAnalysisGrid* CreateAlienHandler(TString mode="test",Int_t mc=0,Int_t sub=0,T
       plugin->SetExecutable(Form("TaskAOD046PbPbMC%d.sh",sub));
       plugin->SetJDLName(Form("TaskAOD046PbPbMC%d.jdl",sub));
       //plugin->SetSplitMaxInputFileNumber(500);
-      plugin->SetGridWorkingDir(Form("%s/mc%d/",fname.Data(),sub));
+      plugin->SetGridWorkingDir(Form("%s/AOD048-049Filter5/mc%d/",fname.Data(),sub));
     }  
   else
     {
@@ -161,7 +171,7 @@ AliAnalysisGrid* CreateAlienHandler(TString mode="test",Int_t mc=0,Int_t sub=0,T
       plugin->SetExecutable(Form("TaskAOD046PbPbdata%d.sh",sub));
       plugin->SetJDLName(Form("TaskAOD046PbPbdata%d.jdl",sub));
       //plugin->SetSplitMaxInputFileNumber(500);
-      plugin->SetGridWorkingDir(Form("%s/data%d/",fname.Data(),sub));
+      plugin->SetGridWorkingDir(Form("%s/AOD048-049Filter5/data%d/",fname.Data(),sub));
     }  
   FILE* listruns=fopen("RunListGrid-AOD046.txt","r");
   }
@@ -175,7 +185,7 @@ AliAnalysisGrid* CreateAlienHandler(TString mode="test",Int_t mc=0,Int_t sub=0,T
        plugin->SetExecutable(Form("TaskAOD086PbPbMC%d.sh",sub));
        plugin->SetJDLName(Form("TaskAOD086PbPbMC%d.jdl",sub));
        //plugin->SetSplitMaxInputFileNumber(500);
-       plugin->SetGridWorkingDir(Form("%s/mc%d/",fname.Data(),sub));
+       plugin->SetGridWorkingDir(Form("%s/AOD086-090Filter10/mc%d/",fname.Data(),sub));
       }  
     else
       {
@@ -186,8 +196,8 @@ AliAnalysisGrid* CreateAlienHandler(TString mode="test",Int_t mc=0,Int_t sub=0,T
        plugin->SetExecutable(Form("TaskAOD086PbPbdata%d.sh",sub));
        plugin->SetJDLName(Form("TaskAOD086PbPbdata%d.jdl",sub));
        //plugin->SetSplitMaxInputFileNumber(500);
-       plugin->SetGridWorkingDir(Form("%s/data%d/",fname.Data(),sub));
-      }  
+       plugin->SetGridWorkingDir(Form("%s/AOD086-090Filter10/data%d/",fname.Data(),sub));
+          }  
     FILE* listruns=fopen("RunListGrid-AOD086.txt","r");
   }
   Int_t irun;
@@ -199,9 +209,6 @@ AliAnalysisGrid* CreateAlienHandler(TString mode="test",Int_t mc=0,Int_t sub=0,T
   //plugin->SetGridOutputDir("/alice/cern.ch/user/l/lmilano/AODAnalysis/AOD086TrackBit10/mc1/output/000/Stage_1"); // In this case will be $HOME/work/output
   plugin->SetGridOutputDir("output"); // In this case will be $HOME/work/output
   plugin->SetNrunsPerMaster(60); // 
-  plugin->AddIncludePath("-I. -I$ROOTSYS/include -I$ALICE_ROOT/include -I$ALICE_ROOT/TOF");
-  plugin->SetAdditionalLibs("Histograms.h HistogramNames.h AliSpectraAODHistoManager.cxx AliSpectraAODHistoManager.h AliSpectraAODTrackCuts.cxx AliSpectraAODTrackCuts.h AliSpectraAODEventCuts.cxx AliSpectraAODEventCuts.h AliSpectraAODPID.cxx AliSpectraAODPID.h AliAnalysisTaskSpectraAOD.cxx AliAnalysisTaskSpectraAOD.h");
-  plugin->SetAnalysisSource("Histograms.h+ HistogramNames.h+ AliSpectraAODHistoManager.cxx+ AliSpectraAODTrackCuts.cxx+ AliSpectraAODEventCuts.cxx+ AliSpectraAODPID.cxx+ AliAnalysisTaskSpectraAOD.cxx+");
   
 
   // Declare the output file names separated by blancs.