]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Updates from Yaxian
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 2 Nov 2010 13:19:44 +0000 (13:19 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 2 Nov 2010 13:19:44 +0000 (13:19 +0000)
PWG4/PartCorrDep/AliAnaChargedParticles.cxx
PWG4/PartCorrDep/AliAnaParticleHadronCorrelation.cxx
PWG4/PartCorrDep/AliAnaParticleHadronCorrelation.h
PWG4/PartCorrDep/AliAnaPhoton.cxx
PWG4/PartCorrDep/AliAnaPhoton.h
PWG4/PartCorrDep/AliAnaPi0.cxx
PWG4/macros/AddTaskPartCorr.C
PWG4/macros/AddTaskPartCorrM.C
PWG4/macros/ana.C
PWG4/macros/anaM.C

index 32e65d94d43b5817b9206e5782a2c7e7cb3d1d45..7d50dde6a1843c7e44f5a52942082e835c414e4d 100755 (executable)
@@ -264,7 +264,7 @@ void  AliAnaChargedParticles::MakeAnalysisFillAOD()
   //Do analysis and fill aods
   if(!GetAODCTS() || GetAODCTS()->GetEntriesFast() == 0) return ;
   Int_t ntracks = GetAODCTS()->GetEntriesFast();
-  
+  Double_t vert[3] = {0,0,0}; //vertex ;
   //Some prints
   if(GetDebug() > 0)
     printf("AliAnaChargedParticles::MakeAnalysisFillAOD() - In CTS aod entries %d\n", ntracks);
@@ -272,7 +272,6 @@ void  AliAnaChargedParticles::MakeAnalysisFillAOD()
   //Fill AODParticle with CTS aods
   TVector3 p3;
   Int_t evtIndex = 0;
-  Double_t vert[3]={0,0,0};
   for(Int_t i = 0; i < ntracks; i++){
     
     AliAODTrack * track =  (AliAODTrack*) (GetAODCTS()->At(i));
@@ -292,8 +291,7 @@ void  AliAnaChargedParticles::MakeAnalysisFillAOD()
         evtIndex = GetMixedEvent()->EventIndex(track->GetID()) ;
       }        
       GetVertex(vert,evtIndex); 
-      if(TMath::Abs(vert[2])> GetZvertexCut()) continue;
-      
+      if(TMath::Abs(vert[2])> GetZvertexCut()) return;      
       AliAODPWG4Particle tr = AliAODPWG4Particle(mom[0],mom[1],mom[2],0);
       tr.SetDetector("CTS");
       tr.SetLabel(track->GetLabel());
@@ -317,14 +315,15 @@ void  AliAnaChargedParticles::MakeAnalysisFillHistograms()
   
   //Loop on stored AODParticles
   Int_t naod = GetOutputAODBranch()->GetEntriesFast();
-  if(naod!=0)fhNtracks->Fill(GetAODCTS()->GetEntriesFast()) ;
   Double_t v[3] = {0,0,0}; //vertex ;
   GetReader()->GetVertex(v);
   fhVertex->Fill(v[0],v[1],v[2]);
+  if(TMath::Abs(v[2]) >GetZvertexCut()) return ;
+  fhNtracks->Fill(GetReader()->GetTrackMultiplicity()) ;
   if(GetDebug() > 0) printf("AliAnaChargedParticles::MakeAnalysisFillHistograms() - aod branch entries %d\n", naod);
   for(Int_t iaod = 0; iaod < naod ; iaod++){
     AliAODPWG4Particle* tr =  (AliAODPWG4Particle*) (GetOutputAODBranch()->At(iaod));
-    
+        
     fhPt->Fill(tr->Pt());
     fhPhi->Fill(tr->Pt(), tr->Phi());
     fhEta->Fill(tr->Pt(), tr->Eta());
index 0d7c5ae406df4699c5350d2fd56b48ca8daa6fa3..224052a571257df94b90f828c29151a44d68c238 100755 (executable)
@@ -60,7 +60,7 @@ ClassImp(AliAnaParticleHadronCorrelation)
     fPi0AODBranchName(""),fNeutralCorr(0), fPi0Trigger(0),
    // fMultiBin(0),fNZvertBin(0),fNrpBin(0),fZvtxCut(0.),
    // fUseSelectEvent(kFALSE), 
-    fhNclustersNtracks(0), fhVertex(0),
+   // fhNclustersNtracks(0), //fhVertex(0),
     fhPtLeading(0),fhPhiLeading(0),fhEtaLeading(0), 
     fhDeltaPhiDeltaEtaCharged(0),
     fhPhiCharged(0), fhEtaCharged(0), 
@@ -75,7 +75,8 @@ ClassImp(AliAnaParticleHadronCorrelation)
     fhDeltaPhiUeLeftCharged(0),fhDeltaPhiUeRightCharged(0),
     fhPtImbalanceUeLeftCharged(0),fhPtImbalanceUeRightCharged(0),
     fhPtHbpUeLeftCharged(0),fhPtHbpUeRightCharged(0), 
-    fhPoutTrig(0), fhPtTrigCharged(0),
+    fhPoutPtTrigPtAssoc(0), fhUePoutPtTrigPtAssoc(0),
+    fhPtTrigCharged(0),
     fhTrigDeltaPhiDeltaEtaCharged(0x0), fhTrigCorr(0x0),fhTrigUeCorr(0x0),
     fhDeltaPhiDeltaEtaNeutral(0), 
     fhPhiNeutral(0), fhEtaNeutral(0), 
@@ -118,15 +119,10 @@ TList *  AliAnaParticleHadronCorrelation::GetCreateOutputObjects()
   Float_t etamin = GetHistoEtaMin();   
 
   
-  fhNclustersNtracks  = new TH2F ("Multiplicity","Neutral cluster and charged track multiplicity",1000, 0., 1000.,1000, 0., 1000.); 
-  fhNclustersNtracks->SetYTitle("# of tracks");
-  fhNclustersNtracks->SetXTitle("# of clusters");
-  
-  fhVertex  = new TH3D ("Vertex","vertex position", 100,-50.,50., 100,-50.,50., 100,-50.,50.); 
-  fhVertex->SetXTitle("X");
-  fhVertex->SetYTitle("Y");
-  fhVertex->SetZTitle("Z");
-  
+//  fhNclustersNtracks  = new TH2F ("Multiplicity","Neutral cluster and charged track multiplicity",1000, 0., 1000.,1000, 0., 1000.); 
+//  fhNclustersNtracks->SetYTitle("# of tracks");
+//  fhNclustersNtracks->SetXTitle("# of clusters");
+
   fhPtLeading  = new TH1F ("hPtLeading","p_T distribution of leading particles", nptbins,ptmin,ptmax); 
   fhPtLeading->SetXTitle("p_{T}^{trig} (GeV/c)");
   
@@ -135,8 +131,7 @@ TList *  AliAnaParticleHadronCorrelation::GetCreateOutputObjects()
   
   fhEtaLeading  = new TH2F ("hEtaLeading","#eta distribution of leading",nptbins,ptmin,ptmax, netabins,etamin,etamax); 
   fhEtaLeading->SetYTitle("#eta ");  
-  outputContainer->Add(fhNclustersNtracks);
-  outputContainer->Add(fhVertex);  
+ // outputContainer->Add(fhNclustersNtracks);
   outputContainer->Add(fhPtLeading);
   outputContainer->Add(fhPhiLeading);
   outputContainer->Add(fhEtaLeading);
@@ -221,11 +216,19 @@ TList *  AliAnaParticleHadronCorrelation::GetCreateOutputObjects()
     fhPtHbpUeCharged->SetYTitle("ln(1/x_{E})");
     fhPtHbpUeCharged->SetXTitle("p_{T trigger}");
     
-    fhPoutTrig  = 
-    new TH2F("PoutTrigPt","Pout with charged hadrons",
-             nptbins,ptmin,ptmax,nptbins,ptmin,ptmax); 
-    fhPoutTrig->SetYTitle("p_{out} (GeV/c)");
-    fhPoutTrig->SetXTitle("p_{T trigger} (GeV/c)");    
+    fhPoutPtTrigPtAssoc  = 
+    new TH3D("PoutPtTrigPtAssoc","Pout with charged hadrons",
+             nptbins,ptmin,ptmax,nptbins,ptmin,ptmax,2*nptbins,-ptmax,ptmax); 
+    fhPoutPtTrigPtAssoc->SetZTitle("p_{out} (GeV/c)");
+    fhPoutPtTrigPtAssoc->SetYTitle("p_{T associated} (GeV/c)");  
+    fhPoutPtTrigPtAssoc->SetXTitle("p_{T trigger} (GeV/c)"); 
+    
+    fhUePoutPtTrigPtAssoc  = 
+    new TH3D("UePoutPtTrigPtAssoc"," UE Pout with charged hadrons",
+             nptbins,ptmin,ptmax,nptbins,ptmin,ptmax,2*nptbins,-ptmax,ptmax); 
+    fhUePoutPtTrigPtAssoc->SetZTitle("p_{out} (GeV/c)");
+    fhUePoutPtTrigPtAssoc->SetYTitle("p_{T associated} (GeV/c)");  
+    fhUePoutPtTrigPtAssoc->SetXTitle("p_{T trigger} (GeV/c)"); 
     
     fhPtTrigCharged  = 
     new TH2F("PtTrigCharged","trgger and charged tracks pt distribution",
@@ -246,7 +249,8 @@ TList *  AliAnaParticleHadronCorrelation::GetCreateOutputObjects()
     outputContainer->Add(fhPtImbalanceUeCharged) ;
     outputContainer->Add(fhPtHbpCharged) ;
     outputContainer->Add(fhPtHbpUeCharged) ;
-    outputContainer->Add(fhPoutTrig) ;
+    outputContainer->Add(fhPoutPtTrigPtAssoc) ;
+    outputContainer->Add(fhUePoutPtTrigPtAssoc) ;
     outputContainer->Add(fhPtTrigCharged) ;
     
     if(DoEventSelect()){ 
@@ -277,12 +281,11 @@ TList *  AliAnaParticleHadronCorrelation::GetCreateOutputObjects()
     }
    
     if(fPi0Trigger){
-      fhPtPi0DecayRatio  = new TH3D
+      fhPtPi0DecayRatio  = new TH2F
       ("hPtPi0DecayRatio","p_T of #pi^{0} and the ratio of pt for two decay", 
-       nptbins,ptmin,ptmax, 100,0.,2.,100,0., 2.); 
+       nptbins,ptmin,ptmax, 100,0.,2.); 
       fhPtPi0DecayRatio->SetXTitle("p_{T}^{#pi^{0}} (GeV/c)");
-      fhPtPi0DecayRatio->SetYTitle("p_{T}^{Decay1}/p_{T}^{#pi^{0}}");
-      fhPtPi0DecayRatio->SetZTitle("p_{T}^{Decay2}/p_{T}^{#pi^{0}}");
+      fhPtPi0DecayRatio->SetYTitle("p_{T}^{Decay}/p_{T}^{#pi^{0}}");
       
       fhDeltaPhiDecayCharged  = new TH2F
       ("DeltaPhiDecayCharged","#phi_{Decay} - #phi_{h^{#pm}} vs p_{T Decay}",
@@ -620,6 +623,7 @@ void  AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD()
   Double_t ptTrig    = 0.;
   Int_t    trigIndex = -1;
   Int_t naod = GetInputAODBranch()->GetEntriesFast();
+  //fhNclustersNtracks->Fill(naod, GetAODCTS()->GetEntriesFast());
   for(Int_t iaod = 0; iaod < naod ; iaod++){
     AliAODPWG4ParticleCorrelation* particle =  (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(iaod));
     //find the leading particles with highest momentum
@@ -669,8 +673,7 @@ void  AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms()
   
   //Loop on stored AOD particles, find leading
   Int_t naod = GetInputAODBranch()->GetEntriesFast();
-  if(naod!=0)fhNclustersNtracks->Fill(naod, GetAODCTS()->GetEntriesFast());
-  if(naod!=0)fhVertex->Fill(v[0],v[1],v[2]);
+ // if(naod!=0)fhVertex->Fill(v[0],v[1],v[2]);
   Double_t ptTrig = 0.;
   Int_t trigIndex = -1 ;
   for(Int_t iaod = 0; iaod < naod ; iaod++){    //loop on input trigger AOD file 
@@ -690,7 +693,7 @@ void  AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms()
       else continue;
       
       if (TMath::Abs(GetVertex(evt)[2]) > GetZvertexCut()) 
-        continue ;
+        return ;
     }
 
     //check if the particle is isolated or if we want to take the isolation into account
@@ -702,7 +705,6 @@ void  AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms()
                  trigIndex = iaod ;
     }
   }//finish searching for leading trigger particle
-       
   if(trigIndex!=-1){ //using trigger partilce to do correlations
     AliAODPWG4ParticleCorrelation* particle =  (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(trigIndex));
          
@@ -731,18 +733,12 @@ void  AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms()
     fhEtaLeading->Fill(particle->Pt(), particle->Eta());
     
     //Make correlation with charged hadrons
-    TObjArray * reftracks   = particle->GetObjArray(GetAODObjArrayName()+"Tracks");
-    if(reftracks){
-      if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() - Leading %d, In Track Refs  entries %d\n", trigIndex, reftracks->GetEntriesFast());
-      if(reftracks->GetEntriesFast() > 0) MakeChargedCorrelation(particle, reftracks,kTRUE);
-    }
+    if(GetReader()->IsCTSSwitchedOn() )
+      MakeChargedCorrelation(particle, GetAODCTS(),kTRUE);
     
-    //Make correlation with neutral pions
-    TObjArray * refpi0   = particle->GetObjArray(GetAODObjArrayName()+"Pi0s");
-    if(refpi0 && fNeutralCorr){
-      if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() - Leading %d, In Pi0 Refs entries %d\n",trigIndex, refpi0->GetEntriesFast());      
-      MakeNeutralCorrelation(particle, refpi0, kTRUE);
-    }
+    TObjArray * pi0list = (TObjArray*) GetAODBranch(fPi0AODBranchName); //For the future, foresee more possible pi0 lists
+    if(fNeutralCorr && pi0list && pi0list->GetEntriesFast() > 0)
+      MakeNeutralCorrelation(particle, pi0list,kTRUE);
     
   }//Aod branch loop
   
@@ -824,23 +820,26 @@ void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Particle
           pxDecay1  = photonMom.Px();
           pyDecay1  = photonMom.Py();
           phiDecay1 = photonMom.Phi();
+          if(ptTrig && bFillHisto) fhPtPi0DecayRatio->Fill(ptTrig, ptDecay1/ptTrig);
         }
         if(photon->GetID()==indexPhoton2) {
           ptDecay2  = photonMom.Pt();
           pxDecay2  = photonMom.Px();
           pyDecay2  = photonMom.Py();
           phiDecay2 = photonMom.Phi();
+          if(ptTrig && bFillHisto) fhPtPi0DecayRatio->Fill(ptTrig, ptDecay2/ptTrig);
         } 
         if(GetDebug() > 1)printf("Photon1 = %f, Photon2 = %f \n", ptDecay1, ptDecay2);
       } //cluster loop        
     } //index of decay photons found
-    if(ptTrig && bFillHisto) fhPtPi0DecayRatio->Fill(ptTrig, ptDecay1/ptTrig, ptDecay2/ptTrig);
+    
   } //make decay-hadron correlation
   
   //Track loop, select tracks with good pt, phi and fill AODs or histograms
   //Int_t currentIndex = -1 ; 
   for(Int_t ipr = 0;ipr < pl->GetEntriesFast() ; ipr ++ ){
     AliAODTrack * track = (AliAODTrack *) (pl->At(ipr)) ;
+
     //check if inside the vertex cut
     //printf("charge = %d\n", track->Charge());
     Int_t evtIndex2 = 0 ; 
@@ -850,17 +849,11 @@ void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Particle
         continue ; 
       //vertex cut
       if (TMath::Abs(GetVertex(evtIndex2)[2]) > GetZvertexCut()) 
-         continue ;
+         return ;
       //      if(currentIndex == evtIndex2) // tracks from different event 
       //        continue ;
       //      currentIndex = evtIndex2 ;
     }
-    if(track->GetID()==aodParticle->GetTrackLabel(0)) 
-      continue ;
-    
-    if(track->Pt()==ptTrig && track->Phi()==phiTrig && track->Eta()==etaTrig) 
-    continue ;
     Double_t mom[3] = {track->Px(),track->Py(),track->Pz()};
     p3.SetXYZ(mom[0],mom[1],mom[2]);
     pt   = p3.Pt();
@@ -869,6 +862,18 @@ void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Particle
     eta  = p3.Eta();
     phi  = p3.Phi() ;
     if(phi < 0) phi+=TMath::TwoPi();
+
+    //Select only hadrons in pt range
+    if(pt < GetMinPt() || pt > GetMaxPt()) continue ;
+    //remove trigger itself for correlation when use charged triggers    
+    if(track->GetID()==aodParticle->GetTrackLabel(0) && pt==ptTrig && phi==phiTrig && eta==etaTrig) 
+      continue ;    
+    if(IsFiducialCutOn()){
+      Bool_t in = GetFiducialCut()->IsInFiducialCut(mom,"CTS") ;
+      if(! in ) continue ;
+    }    
+    //jumped out this event if near side associated partile pt larger than trigger
+    if(pt > ptTrig && TMath::Abs(phi-phiTrig)<TMath::PiOver2())  break ;
     rat   = pt/ptTrig ;
     xE    = -(px*pxTrig+py*pyTrig)/(ptTrig*ptTrig);
     if(xE <0.)xE =-xE;
@@ -876,7 +881,7 @@ void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Particle
     // printf("rat = %f, xE = %f, cosi =%f \n", rat, xE, cosi);
     // printf("phi = %f \n", phi);
     
-    if(fPi0Trigger){
+     if(fPi0Trigger){
       if(indexPhoton1!=-1 && indexPhoton2!=-1){
         if(ptDecay1) ratDecay1 = pt/ptDecay1 ;
         if(ptDecay2) ratDecay2 = pt/ptDecay2 ; 
@@ -888,19 +893,13 @@ void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Particle
         if(deltaphiDecay2>3*TMath::PiOver2()) deltaphiDecay2-=TMath::TwoPi();    
       }
     } //do decay-hadron correlation    
-    
-    if(IsFiducialCutOn()){
-      Bool_t in = GetFiducialCut()->IsInFiducialCut(mom,"CTS") ;
-      if(! in ) continue ;
-    }    
-    
-    //Select only hadrons in pt range
-    if(pt < GetMinPt() || pt > GetMaxPt()) continue ;
-    
+            
     //Selection within angular range
     deltaphi = phiTrig-phi;
     if(deltaphi< -TMath::PiOver2()) deltaphi+=TMath::TwoPi();
     if(deltaphi>3*TMath::PiOver2()) deltaphi-=TMath::TwoPi();
+
+    Double_t pout = pt*TMath::Sin(deltaphi) ;
     
     if(GetDebug() > 2)
       printf("AliAnaParticleHadronCorrelation::MakeChargedCorrelation() - Charged hadron: pt %f, phi %f, phi trigger %f. Cuts:  delta phi  %2.2f < %2.2f < %2.2f, pT min %2.2f \n",
@@ -926,8 +925,7 @@ void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Particle
         fhDeltaPhiChargedPt->Fill(pt,deltaphi);
         fhPtImbalanceCharged->Fill(ptTrig,xE); 
         fhPtHbpCharged->Fill(ptTrig,cosi);
-        Double_t pout = pt*TMath::Sin(deltaphi) ;
-        fhPoutTrig->Fill(ptTrig, pout) ;
+        fhPoutPtTrigPtAssoc->Fill(ptTrig, pt, pout) ;
         fhPtTrigCharged->Fill(ptTrig, pt) ;
         if(track->Charge()>0) fhPtImbalancePosCharged->Fill(ptTrig,xE) ;
         else fhPtImbalanceNegCharged->Fill(ptTrig,xE) ;
@@ -939,8 +937,9 @@ void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Particle
           }
         } //multiplicity events selection
       } //delta phi cut for correlation
-      else {
+      else { //UE study
         fhDeltaPhiUeChargedPt->Fill(pt,deltaphi);
+        fhUePoutPtTrigPtAssoc->Fill(ptTrig, pt, pout) ;
         fhPtImbalanceUeCharged->Fill(ptTrig,xE);
         fhPtHbpUeCharged->Fill(ptTrig,cosi);
         if(DoEventSelect()){
@@ -950,7 +949,7 @@ void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Particle
           }
         } //multiplicity events selection
         
-      }
+      } //UE study
       
       if(fPi0Trigger){
         if(indexPhoton1!=-1 && indexPhoton2!=-1){
@@ -980,7 +979,7 @@ void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Particle
         }
       } //several UE calculation
       
-    }
+    } //Fill histogram 
     else{
       nrefs++;
       if(nrefs==1){
@@ -1309,7 +1308,9 @@ void  AliAnaParticleHadronCorrelation::MakeNeutralCorrelation(AliAODPWG4Particle
     px  = pi0->Px();
     py  = pi0->Py();    
     if(pt < GetMinPt() || pt > GetMaxPt()) continue ;
-    
+    //jumped out this event if near side associated partile pt larger than trigger
+    if(pt > ptTrig && TMath::Abs(phi-phiTrig)<TMath::PiOver2())  break ;
+
     //Selection within angular range
     phi = pi0->Phi();
     //Float_t deltaphi = TMath::Abs(phiTrig-phi);
index c2a2f497926562c2384b050d33b8ff93950f258d..45561b90198d9b57eeec8a2d13ce4f17fbe04c61 100755 (executable)
@@ -16,6 +16,8 @@
 // 4. Make decay photon-hadron correlations where decay contribute pi0 mass (2010/09/09)
 // 5. fill the pout to extract kt at the end, also to study charge asymmetry(2010/10/06) 
 // 6. Add the possibality for event selection analysis based on vertex and multiplicity bins (10/10/2010)
+// 7. change the way of delta phi cut for UE study due to memory issue (reduce histograms)
+
 // --- ROOT system ---
 class TH3D;
 
@@ -41,7 +43,7 @@ class AliAnaParticleHadronCorrelation : public AliAnaPartCorrBaseClass {
   Double_t GetDeltaPhiMinCut() const {return fDeltaPhiMinCut ; }
   void SetDeltaPhiCutRange(Double_t phimin, Double_t phimax)
   {fDeltaPhiMaxCut =phimax;  fDeltaPhiMinCut =phimin;}
-
   Double_t GetUeDeltaPhiMaxCut() const {return fUeDeltaPhiMaxCut ; }
   Double_t GetUeDeltaPhiMinCut() const {return fUeDeltaPhiMinCut ; }
   void SetUeDeltaPhiCutRange(Double_t uephimin, Double_t uephimax)
@@ -63,20 +65,6 @@ class AliAnaParticleHadronCorrelation : public AliAnaPartCorrBaseClass {
   Bool_t OnlyIsolated() const {return fSelectIsolated ; }
   void SelectIsolated(Bool_t select) {fSelectIsolated = select ; }
 
-//  //Setters for parameters of event buffers
-//  void SetMultiBin(Int_t n=1) {fMultiBin=n ;} //number of bins in Multiplicity 
-//  void SetNRPBin(Int_t n=1)    {fNrpBin=n ;}    //number of bins in reaction plain  
-//  //Setters for event selection
-//  void SetZvertexCut(Float_t zcut=40.){fZvtxCut=zcut ;} //cut on vertex position
-//  Int_t GetMultiBin() const {return fMultiBin ;} //number of bins in Multiplicity 
-//  Int_t GetNRPBin()    const {return fNrpBin=n ;}    //number of bins in reaction plain  
-//  //Getters for event selection
-//  Float_t GetZvertexCut() const {return fZvtxCut ;} //cut on vertex position  
-//  void SwitchOnEventSelection()    {fUseSelectEvent = kTRUE ; }
-//  void SwitchOffEventSelection()   {fUseSelectEvent = kFALSE ; } s
-//  // Do correlation analysis with different event buffers
-//  Bool_t IsEventSelect() const {return fUseSelectEvent ; }
-  
   void InitParameters();
   
   void Print(const Option_t * opt) const;
@@ -105,16 +93,9 @@ class AliAnaParticleHadronCorrelation : public AliAnaPartCorrBaseClass {
   TString    fPi0AODBranchName;     // Name of AOD branch with pi0, not trigger
   Bool_t     fNeutralCorr ;          // switch the analysis with neutral particles
   Bool_t     fPi0Trigger ;          // switch the analysis with decay photon from pi0 trigger
-//  Int_t      fMultiBin ;       // Number of bins in event container for multiplicity
-//  Int_t      fNZvertBin ;      // Number of bins in event container for vertex position
-//  Int_t      fNrpBin ;           // Number of bins in event container for reaction plain
-//  Float_t    fZvtxCut ;          // Cut on vertex position  
-//  Bool_t     fUseSelectEvent ; // Select events based on multiplicity and vertex cuts
-  
   
   //Histograms
-  TH2F * fhNclustersNtracks; //charge and cluster multiplicity distribution
-  TH3D * fhVertex; //vertex position
+//  TH2F * fhNclustersNtracks; //charge and cluster multiplicity distribution
   //leading particles 
   TH1F * fhPtLeading;         //! pT distribution of leading particles
   TH2F * fhPhiLeading;        //! phi distribution vs pT of leading particles
@@ -145,7 +126,8 @@ class AliAnaParticleHadronCorrelation : public AliAnaPartCorrBaseClass {
   TH2F * fhPtHbpUeRightCharged  ;      //! Trigger particle -underlying charged hadron momentim HBP histogram  
 
   //for pout and kt extraction
-  TH2F * fhPoutTrig  ; // Pout =associated pt*sin(delta phi) distribution vs trigger pt
+  TH3D * fhPoutPtTrigPtAssoc  ; // Pout =associated pt*sin(delta phi) distribution vs trigger pt vs associated pt
+  TH3D * fhUePoutPtTrigPtAssoc  ; // UE Pout =associated pt*sin(delta phi) distribution vs trigger pt vs associated pt
   TH2F * fhPtTrigCharged ; //trigger and correlated particl pt, to be used for mean value for kt       
   
   //if different multiplicity analysis asked
@@ -176,7 +158,7 @@ class AliAnaParticleHadronCorrelation : public AliAnaPartCorrBaseClass {
   TH2F * fhPtHbpUeRightNeutral  ;      //! Trigger particle -underlying neutral hadron momentim HBP histogram 
   
   //for decay photon trigger correlation
-  TH3D * fhPtPi0DecayRatio ;          //! for pi0 pt and ratio of decay photon pt
+  TH2F * fhPtPi0DecayRatio ;          //! for pi0 pt and ratio of decay photon pt
   TH2F * fhDeltaPhiDecayCharged  ;   //! Difference of charged particle phi and decay trigger
   TH2F * fhPtImbalanceDecayCharged ; //! Trigger particle (decay from pi0)-charged hadron momentim imbalance histogram    
   TH2F * fhDeltaPhiDecayNeutral  ;   //! Difference of neutral particle phi and decay trigger
index 2f6049e6e66c7011151d6d1aa75df79def203964..d865051dc51083346c34db95ce6c60c65c8d8c41 100755 (executable)
@@ -26,6 +26,7 @@
   
 // --- ROOT system --- 
 #include <TH2F.h>
+#include <TH3D.h>
 #include <TClonesArray.h>
 #include <TObjString.h>
 //#include <Riostream.h>
@@ -51,6 +52,7 @@ ClassImp(AliAnaPhoton)
     fMinDist(0.),fMinDist2(0.),fMinDist3(0.),fRejectTrackMatch(0),
     fCheckConversion(kFALSE),fAddConvertedPairsToAOD(kFALSE), fMassCut(0),
     fTimeCutMin(-1), fTimeCutMax(9999999), fNCellsCut(0),
+    fhVertex(0), fhNtraNclu(0),
     fhPtPhoton(0),fhPhiPhoton(0),fhEtaPhoton(0),
     //MC
     fhDeltaE(0), fhDeltaPt(0),fhRatioE(0), fhRatioPt(0),fh2E(0),fh2Pt(0),
@@ -128,6 +130,17 @@ TList *  AliAnaPhoton::GetCreateOutputObjects()
   Float_t etamin = GetHistoEtaMin();   
   
   //Histograms of highest Photon identified in Event
+  fhVertex  = new TH3D ("Vertex","vertex position", 100,-50.,50., 100,-50.,50., 100,-50.,50.); 
+  fhVertex->SetXTitle("X");
+  fhVertex->SetYTitle("Y");
+  fhVertex->SetZTitle("Z");
+  outputContainer->Add(fhVertex);
+  
+  fhNtraNclu  = new TH2F ("hNtracksNcluster","# of tracks vs # of clusters", 500,0,500, 500,0,500); 
+  fhNtraNclu->SetXTitle("# of tracks");
+  fhNtraNclu->SetYTitle("# of clusters");
+  outputContainer->Add(fhNtraNclu);
+  
   fhPtPhoton  = new TH1F("hPtPhoton","Number of #gamma over calorimeter",nptbins,ptmin,ptmax); 
   fhPtPhoton->SetYTitle("N");
   fhPtPhoton->SetXTitle("p_{T #gamma}(GeV/c)");
@@ -396,7 +409,7 @@ void  AliAnaPhoton::MakeAnalysisFillAOD()
     if (GetMixedEvent()) {
       evtIndex=GetMixedEvent()->EventIndexForCaloCluster(calo->GetID()) ; 
       //Get the vertex and check it is not too large in z
-      if(TMath::Abs(GetVertex(evtIndex)[2])> GetZvertexCut()) continue ;  
+      if(TMath::Abs(GetVertex(evtIndex)[2])> GetZvertexCut()) return ;  
     }
 
     //Cluster selection, not charged, with photon id and in fiducial cut
@@ -630,7 +643,12 @@ void  AliAnaPhoton::MakeAnalysisFillHistograms()
        }// is data and MC
        
        //Loop on stored AOD photons
+  Double_t v[3] = {0,0,0}; //vertex ;
+  GetReader()->GetVertex(v);
+  fhVertex->Fill(v[0],v[1],v[2]);  
+  if(TMath::Abs(v[2]) > GetZvertexCut()) return ;  
        Int_t naod = GetOutputAODBranch()->GetEntriesFast();
+  fhNtraNclu->Fill(GetReader()->GetTrackMultiplicity(), naod);
        if(GetDebug() > 0) printf("AliAnaPhoton::MakeAnalysisFillHistograms() - aod branch entries %d\n", naod);
        
        for(Int_t iaod = 0; iaod < naod ; iaod++){
index 19d88f4b62a4b7bd1e6c16a40a0c6175c2f30bd5..3aa41422e40135492906d6d3ff22316c391a37c5 100755 (executable)
@@ -16,6 +16,7 @@
 // --- ROOT system ---
 class TH2F ;
 class TH1F;
+class TH3D;
 class TString ;
 class TObjString;
 
@@ -96,7 +97,9 @@ class AliAnaPhoton : public AliAnaPartCorrBaseClass {
   Double_t fTimeCutMax  ;    // Remove clusters/cells with time larger than this value, in ns
   Int_t fNCellsCut ;     // Accept for the analysis clusters with more than fNCellsCut cells
        
-  //Histograms  
+  //Histograms 
+  TH3D * fhVertex; //! vertex distribution
+  TH2F * fhNtraNclu; //! track multiplicity distribution vs cluster multiplicity
   TH1F * fhPtPhoton   ; //! Number of identified photon vs transerse momentum 
   TH2F * fhPhiPhoton  ; //! Azimuthal angle of identified  photon vs transerse momentum 
   TH2F * fhEtaPhoton  ; //! Pseudorapidity of identified  photon vs transerse momentum 
index bfcad99268fbec0460a21c35e00707d7e74e8961..781d31aa373c68d12be791219cedce283b047e34 100755 (executable)
@@ -604,6 +604,7 @@ void AliAnaPi0::MakeAnalysisFillHistograms()
       return ; 
     if ( evtIndex1 == -2 )
       continue ; 
+    if(TMath::Abs(vert[2]) > GetZvertexCut()) continue ;   //vertex cut
     if (evtIndex1 != currentEvtIndex) {
       //Get Reaction Plan position and calculate RP bin
       //does not exist in ESD yet????
@@ -921,25 +922,26 @@ void AliAnaPi0::Terminate(TList* outputList)
   hIMAllPt->Draw();
 
   cIM->cd(2) ; 
-  TH3F * hRe1Pt5 = (TH3F*)fhRe1[0]->Clone(Form("IMPt5_%s",fCalorimeter.Data()));
-  hRe1Pt5->GetXaxis()->SetRangeUser(0,5);
-  TH1D * hIMPt5 = (TH1D*) hRe1Pt5->Project3D(Form("IMPt5_%s_pz",fCalorimeter.Data()));
+  TH1D * hIMPt5 = (TH1D*) fhRe1[0]->ProjectionZ(Form("IMPt0-5_%s",fCalorimeter.Data()),0, fhRe1[0]->GetXaxis()->FindBin(5.),0, -1, "");
+//  hRe1Pt5->GetXaxis()->SetRangeUser(0,5);
+//  TH1D * hIMPt5 = (TH1D*) hRe1Pt5->Project3D(Form("IMPt5_%s_pz",fCalorimeter.Data()));
   hIMPt5->SetLineColor(2);  
   hIMPt5->SetTitle("0 < p_{T, #gamma#gamma} < 5 GeV/c");
   hIMPt5->Draw();
   
   cIM->cd(3) ; 
-  TH3F * hRe1Pt10 =  (TH3F*)fhRe1[0]->Clone(Form("IMPt10_%s",fCalorimeter.Data()));
-  hRe1Pt10->GetXaxis()->SetRangeUser(5,10);
-  TH1D * hIMPt10 = (TH1D*) hRe1Pt10->Project3D(Form("IMPt10_%s_pz",fCalorimeter.Data()));
+  TH1D * hIMPt10 =  (TH1D*) fhRe1[0]->ProjectionZ(Form("IMPt5-10_%s",fCalorimeter.Data()), fhRe1[0]->GetXaxis()->FindBin(5.),fhRe1[0]->GetXaxis()->FindBin(10.),0, -1,"");
+//  hRe1Pt10->GetXaxis()->SetRangeUser(5,10);
+//  TH1D * hIMPt10 = (TH1D*) hRe1Pt10->Project3D(Form("IMPt10_%s_pz",fCalorimeter.Data()));
   hIMPt10->SetLineColor(2);  
   hIMPt10->SetTitle("5 < p_{T, #gamma#gamma} < 10 GeV/c");
   hIMPt10->Draw();
   
   cIM->cd(4) ; 
-  TH3F * hRe1Pt20 =  (TH3F*)fhRe1[0]->Clone(Form("IMPt20_%s",fCalorimeter.Data()));
-  hRe1Pt20->GetXaxis()->SetRangeUser(10,20);
-  TH1D * hIMPt20 = (TH1D*) hRe1Pt20->Project3D(Form("IMPt20_%s_pz",fCalorimeter.Data()));
+  TH1D * hIMPt20 =  (TH1D*) fhRe1[0]->ProjectionZ(Form("IMPt10-20_%s",fCalorimeter.Data()), fhRe1[0]->GetXaxis()->FindBin(10.),fhRe1[0]->GetXaxis()->FindBin(20.),0, -1,"");
+ // TH3F * hRe1Pt20 =  (TH3F*)fhRe1[0]->Clone(Form("IMPt20_%s",fCalorimeter.Data()));
+//  hRe1Pt20->GetXaxis()->SetRangeUser(10,20);
+//  TH1D * hIMPt20 = (TH1D*) hRe1Pt20->Project3D(Form("IMPt20_%s_pz",fCalorimeter.Data()));
   hIMPt20->SetLineColor(2);  
   hIMPt20->SetTitle("10 < p_{T, #gamma#gamma} < 20 GeV/c");
   hIMPt20->Draw();
@@ -961,25 +963,28 @@ void AliAnaPi0::Terminate(TList* outputList)
   hPt->Draw();
 
   cPt->cd(2) ; 
-  TH3F * hRe1IM1 = (TH3F*)fhRe1[0]->Clone(Form("Pt1_%s",fCalorimeter.Data()));
-  hRe1IM1->GetZaxis()->SetRangeUser(0.05,0.21);
-  TH1D * hPtIM1 = (TH1D*) hRe1IM1->Project3D("x");
+  TH1D * hPtIM1 = (TH1D*)fhRe1[0]->ProjectionX(Form("Pt1_%s",fCalorimeter.Data()), fhRe1[0]->GetZaxis()->FindBin(0.05),fhRe1[0]->GetZaxis()->FindBin(0.21),0, -1,""); 
+//  TH3F * hRe1IM1 = (TH3F*)fhRe1[0]->Clone(Form("Pt1_%s",fCalorimeter.Data()));
+//  hRe1IM1->GetZaxis()->SetRangeUser(0.05,0.21);
+//  TH1D * hPtIM1 = (TH1D*) hRe1IM1->Project3D("x");
   hPtIM1->SetLineColor(2);  
   hPtIM1->SetTitle("0.05 < M_{#gamma#gamma} < 0.21 GeV/c^{2}");
   hPtIM1->Draw();
   
   cPt->cd(3) ; 
-  TH3F * hRe1IM2 = (TH3F*)fhRe1[0]->Clone(Form("Pt2_%s",fCalorimeter.Data()));
-  hRe1IM2->GetZaxis()->SetRangeUser(0.09,0.17);
-  TH1D * hPtIM2 = (TH1D*) hRe1IM2->Project3D("x");
+  TH1D * hPtIM2 = (TH1D*)fhRe1[0]->ProjectionX(Form("Pt2_%s",fCalorimeter.Data()), fhRe1[0]->GetZaxis()->FindBin(0.09),fhRe1[0]->GetZaxis()->FindBin(0.17),0, -1,""); 
+//  TH3F * hRe1IM2 = (TH3F*)fhRe1[0]->Clone(Form("Pt2_%s",fCalorimeter.Data()));
+//  hRe1IM2->GetZaxis()->SetRangeUser(0.09,0.17);
+//  TH1D * hPtIM2 = (TH1D*) hRe1IM2->Project3D("x");
   hPtIM2->SetLineColor(2);  
   hPtIM2->SetTitle("0.09 < M_{#gamma#gamma} < 0.17 GeV/c^{2}");
   hPtIM2->Draw();
 
   cPt->cd(4) ; 
-  TH3F * hRe1IM3 = (TH3F*)fhRe1[0]->Clone(Form("Pt3_%s",fCalorimeter.Data()));
-  hRe1IM3->GetZaxis()->SetRangeUser(0.11,0.15);
-  TH1D * hPtIM3 = (TH1D*) hRe1IM1->Project3D("x");
+  TH1D * hPtIM3 = (TH1D*)fhRe1[0]->ProjectionX(Form("Pt3_%s",fCalorimeter.Data()), fhRe1[0]->GetZaxis()->FindBin(0.11),fhRe1[0]->GetZaxis()->FindBin(0.15),0, -1,""); 
+//  TH3F * hRe1IM3 = (TH3F*)fhRe1[0]->Clone(Form("Pt3_%s",fCalorimeter.Data()));
+//  hRe1IM3->GetZaxis()->SetRangeUser(0.11,0.15);
+//  TH1D * hPtIM3 = (TH1D*) hRe1IM1->Project3D("x");
   hPtIM3->SetLineColor(2);  
   hPtIM3->SetTitle("0.11 < M_{#gamma#gamma} < 0.15 GeV/c^{2}");
   hPtIM3->Draw();
index ffb41b7277d9bd02b46b0b12e7de68898f04c1e4..7d771fe7837e4a44a48813aafa830a1d83ac8ea2 100644 (file)
@@ -1,4 +1,4 @@
-AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calorimeter, Bool_t kPrintSettings = kFALSE,Bool_t kSimulation = kFALSE, Bool_t outputAOD=kFALSE, Bool_t oldAOD=kFALSE)
+AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString inputDataType, TString calorimeter, Bool_t kPrintSettings = kFALSE,Bool_t kSimulation = kFALSE, Bool_t outputAOD=kFALSE, Bool_t oldAOD=kFALSE)
 {
   // Creates a PartCorr task, configures it and adds it to the analysis manager.
   
@@ -9,24 +9,11 @@ AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calori
     ::Error("AddTaskPartCorr", "No analysis manager to connect to.");
     return NULL;
   }  
-  
-  // Check the analysis type using the event handlers connected to the analysis manager.
-  //==============================================================================
-  if (!mgr->GetInputEventHandler()) {
-    ::Error("AddTaskPartCorr", "This task requires an input event handler");
-    return NULL;
-  }
-  TString inputDataType = "AOD";
-  if(!data.Contains("delta"))
-    inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
-  //cout<<"DATA TYPE :: "<<inputDataType<<endl;
-  // inputDataType: data managed by the input handler
-  // data: can be same as one managed by input handler, or the output AOD created by the filter. By default use AOD
-  
   Bool_t kUseKinematics = kFALSE; 
   if(kSimulation) { 
     kUseKinematics = (mgr->GetMCtruthEventHandler())?kTRUE:kFALSE; 
-    if (!kUseKinematics && data=="AOD" && inputDataType != "ESD") kUseKinematics = kTRUE; //AOD primary should be available ... 
+    if (!kUseKinematics && inputDataType == "AOD") kUseKinematics = kTRUE; //AOD primary should be available ... 
   } 
   
   cout<<"********* ACCESS KINE? "<<kUseKinematics<<endl;
@@ -35,10 +22,10 @@ AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calori
   //===========================================================================
   
   // *** Reader ***
-  AliCaloTrackReader * reader = ;
-  if(data.Contains("AOD")) reader = new AliCaloTrackAODReader();
-  else if(data=="ESD") reader = new AliCaloTrackESDReader();
-  else if(data=="MC" && inputDataType == "ESD") reader = new AliCaloTrackMCReader();
+  AliCaloTrackReader * reader =0x0 ;
+  if(inputDataType.Contains("AOD")) reader = new AliCaloTrackAODReader();
+  else if(inputDataType=="ESD") reader = new AliCaloTrackESDReader();
+  else if(inputDataType=="MC" && inputDataType == "ESD") reader = new AliCaloTrackMCReader();
   reader->SetDebug(-1);//10 for lots of messages
   reader->SwitchOnCTS();
   //reader->SetDeltaAODFileName("");
@@ -52,8 +39,8 @@ AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calori
     reader->SwitchOnPHOS();
   }
   
-  // for case data="deltaAOD", no need to fill the EMCAL/PHOS cluster lists
-  if(data.Contains("delta")){
+  // for case inputDataType="deltaAOD", no need to fill the EMCAL/PHOS cluster lists
+  if(inputDataType.Contains("delta")){
     reader->SwitchOffEMCAL();
     reader->SwitchOffPHOS();
     reader->SwitchOffEMCALCells(); 
@@ -72,9 +59,9 @@ AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calori
   }
   
   //Min particle pT
-  reader->SetEMCALPtMin(0.1); 
-  reader->SetPHOSPtMin(0.);
-  reader->SetCTSPtMin(0.);
+  reader->SetEMCALPtMin(0.3); 
+  reader->SetPHOSPtMin(0.3);
+  reader->SetCTSPtMin(0.1);
   if(outputAOD)  reader->SwitchOnWriteDeltaAOD()  ;
   if(oldAOD) reader->SwitchOnOldAODs();
   if(kPrintSettings) reader->Print("");
@@ -127,6 +114,11 @@ AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calori
   
   AliAnaPhoton *anaphoton = new AliAnaPhoton();
   anaphoton->SetDebug(-1); //10 for lots of messages
+  //settings for different multiplicity analysis
+  anaphoton->SwitchOffEventSelection() ;
+  anaphoton->SetZvertexCut(10.);
+  anaphoton->SetMultiplicity(80, 120);
+
   if(calorimeter == "PHOS"){
     anaphoton->SetNCellCut(0);// At least 2 cells
     anaphoton->SetMinPt(0.);
@@ -153,7 +145,7 @@ AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calori
     fidCut1stYear->SetSimplePHOSFiducialCut(0.12,260.,320.);
   }
   
-  if(!data.Contains("delta")) {
+  if(!inputDataType.Contains("delta")) {
     anaphoton->SetOutputAODName(Form("Photons%s",calorimeter.Data()));
     anaphoton->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
   }
@@ -182,15 +174,15 @@ AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calori
     fidCut1stYear->DoPHOSFiducialCut(kTRUE) ;
     fidCut1stYear->SetSimpleEMCALFiducialCut(0.7,80.,120.);
     fidCut1stYear->SetSimplePHOSFiducialCut(0.12,260.,320.);
-  }  
-       
+  }    
   anapi0->SetNPID(1); //Available from tag AliRoot::v4-18-15-AN
   //settings for pp collision
   anapi0->SwitchOnOwnMix();
+  anapi0->SwitchOnEventSelection() ;
   anapi0->SetNCentrBin(1);
-  anapi0->SetNZvertBin(1);
-  anapi0->SetNRPBin(1);
-  anapi0->SetNMaxEvMix(10);
+  anapi0->SetZvertexCut(10.);
+  anapi0->SetMultiplicity(80, 120);
+  anapi0->SetMultiBin(1);  
   if(kUseKinematics)anapi0->SwitchOnDataMC() ;//Access MC stack and fill more histograms
   else anapi0->SwitchOffDataMC() ;
   if(calorimeter=="PHOS") anapi0->SetNumberOfModules(3); //PHOS first year
@@ -207,12 +199,16 @@ AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calori
   //---------------------------  
   
   AliAnaPi0EbE *anapi0ebe = new AliAnaPi0EbE();
+  anapi0ebe->SwitchOffEventSelection() ;
+  anapi0ebe->SetZvertexCut(10.);
+  anapi0ebe->SetMultiplicity(80, 120);
+  anapi0ebe->SetMultiBin(1);  
   anapi0ebe->SetDebug(-1);//10 for lots of messages
   anapi0ebe->SetAnalysisType(AliAnaPi0EbE::kIMCalo);
   anapi0ebe->SetMinPt(0);
   anapi0ebe->SetCalorimeter(calorimeter);
   anapi0ebe->SetInputAODName(Form("Photons%s",calorimeter.Data()));
-  if(!data.Contains("delta")) {
+  if(!inputDataType.Contains("delta")) {
     anapi0ebe->SetOutputAODName(Form("Pi0s%s",calorimeter.Data()));
     anapi0ebe->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
   }
@@ -301,9 +297,11 @@ AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calori
   //Do isolation cut
   AliIsolationCut * ic =  anaisol->GetIsolationCut();  
   ic->SetConeSize(0.4);
-  ic->SetPtThreshold(0.2);
+  ic->SetPtThreshold(0.7);
+  ic->SetPtFraction(0.1);
+  ic->SetSumPtThreshold(1.0) ;
   ic->SetParticleTypeInCone(AliIsolationCut::kOnlyCharged);
-  ic->SetICMethod(AliIsolationCut::kPtThresIC);
+  ic->SetICMethod(AliIsolationCut::kSumPtFracIC);
   if(kPrintSettings) ic->Print("");
   
   //Do or not do isolation with previously produced AODs.
@@ -333,8 +331,11 @@ AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calori
   //Do isolation cut
   AliIsolationCut * ic2 =  anaisolpi0->GetIsolationCut();      
   ic2->SetConeSize(0.4);
-  ic2->SetPtThreshold(0.2);
-  ic2->SetICMethod(AliIsolationCut::kPtThresIC);
+  ic2->SetPtThreshold(0.7);
+  ic2->SetPtFraction(0.1);
+  ic2->SetSumPtThreshold(1.0) ;
+  ic2->SetICMethod(AliIsolationCut::kSumPtFracIC);
+  ic2->SetParticleTypeInCone(AliIsolationCut::kOnlyCharged);
   if(kPrintSettings) ic2->Print("");
   //Do or not do isolation with previously produced AODs.
   //No effect if use of SwitchOnSeveralIsolation()
@@ -375,7 +376,21 @@ AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calori
   anacorrhadron->SetAODObjArrayName("PhotonHadronCorr"); 
   anacorrhadron->SetDebug(-1);
   anacorrhadron->SwitchOffCaloPID();
-  anacorrhadron->SwitchOffFiducialCut();
+  if(kSimulation){
+    anacorrhadron->SwitchOnFiducialCut();
+    AliFiducialCut * fidCut1stYear = anacorrhadron->GetFiducialCut();
+    fidCut1stYear->DoEMCALFiducialCut(kTRUE) ;
+    fidCut1stYear->DoPHOSFiducialCut(kTRUE) ;
+    fidCut1stYear->SetSimpleEMCALFiducialCut(0.7,80.,120.);
+    fidCut1stYear->SetSimplePHOSFiducialCut(0.12,260.,320.);
+    fidCut1stYear->DoCTSFiducialCut(kTRUE) ;
+    fidCut1stYear->SetSimpleCTSFiducialCut(0.8,0.,360.);    
+  }
+  anacorrhadron->SwitchOnDecayCorr();
+  anacorrhadron->SetMultiBin(1);
+  anacorrhadron->SetZvertexCut(10.);
+  anacorrhadron->SwitchOffNeutralCorr();
+  anacorrhadron->SwitchOffEventSelection();
   anacorrhadron->SetPtCutRange(0.1,100);
   anacorrhadron->SetDeltaPhiCutRange(1.5,4.5);
   anacorrhadron->SwitchOnSeveralUECalculation();
@@ -401,7 +416,21 @@ AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calori
   anacorrisohadron->SetAODObjArrayName("IsoPhotonHadronCorr"); 
   anacorrisohadron->SetDebug(-1);
   anacorrisohadron->SwitchOffCaloPID();
-  anacorrisohadron->SwitchOffFiducialCut();
+    if(kSimulation){
+    anacorrisohadron->SwitchOnFiducialCut();
+    AliFiducialCut * fidCut1stYear = anacorrisohadron->GetFiducialCut();
+    fidCut1stYear->DoEMCALFiducialCut(kTRUE) ;
+    fidCut1stYear->DoPHOSFiducialCut(kTRUE) ;
+    fidCut1stYear->SetSimpleEMCALFiducialCut(0.7,80.,120.);
+    fidCut1stYear->SetSimplePHOSFiducialCut(0.12,260.,320.);
+    fidCut1stYear->DoCTSFiducialCut(kTRUE) ;
+    fidCut1stYear->SetSimpleCTSFiducialCut(0.8,0.,360.);    
+  }
+  anacorrisohadron->SwitchOnDecayCorr();
+  anacorrisohadron->SetMultiBin(1);
+  anacorrisohadron->SetZvertexCut(10.);
+  anacorrisohadron->SwitchOffNeutralCorr();
+  anacorrisohadron->SwitchOffEventSelection();
   anacorrisohadron->SetPtCutRange(0.1,100);
   anacorrisohadron->SetDeltaPhiCutRange(1.5,4.5);
   anacorrisohadron->SwitchOnSeveralUECalculation();
@@ -428,7 +457,21 @@ AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calori
   anacorrhadronpi0->SetAODObjArrayName("Pi0HadronCorr"); 
   anacorrhadronpi0->SetDebug(-1);
   anacorrhadronpi0->SwitchOffCaloPID();
-  anacorrhadronpi0->SwitchOffFiducialCut();
+  if(kSimulation){
+    anacorrhadronpi0->SwitchOnFiducialCut();
+    AliFiducialCut * fidCut1stYear = anacorrhadronpi0->GetFiducialCut();
+    fidCut1stYear->DoEMCALFiducialCut(kTRUE) ;
+    fidCut1stYear->DoPHOSFiducialCut(kTRUE) ;
+    fidCut1stYear->SetSimpleEMCALFiducialCut(0.7,80.,120.);
+    fidCut1stYear->SetSimplePHOSFiducialCut(0.12,260.,320.);
+    fidCut1stYear->DoCTSFiducialCut(kTRUE) ;
+    fidCut1stYear->SetSimpleCTSFiducialCut(0.8,0.,360.);    
+  }
+  anacorrhadronpi0->SwitchOnDecayCorr();
+  anacorrhadronpi0->SetMultiBin(1);
+  anacorrhadronpi0->SetZvertexCut(10.);
+  anacorrhadronpi0->SwitchOffNeutralCorr();
+  anacorrhadronpi0->SwitchOffEventSelection();
   anacorrhadronpi0->SetPtCutRange(0.1,100);
   anacorrhadronpi0->SetDeltaPhiCutRange(1.5,4.5);
   anacorrhadronpi0->SelectIsolated(kFALSE); // do correlation with non isolated pi0
@@ -454,7 +497,21 @@ AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calori
   anacorrhadronisopi0->SetAODObjArrayName("IsoPi0HadronCorr"); 
   anacorrhadronisopi0->SetDebug(-1);
   anacorrhadronisopi0->SwitchOffCaloPID();
-  anacorrhadronisopi0->SwitchOffFiducialCut();
+    if(kSimulation){
+    anacorrhadronisopi0->SwitchOnFiducialCut();
+    AliFiducialCut * fidCut1stYear = anacorrhadronisopi0->GetFiducialCut();
+    fidCut1stYear->DoEMCALFiducialCut(kTRUE) ;
+    fidCut1stYear->DoPHOSFiducialCut(kTRUE) ;
+    fidCut1stYear->SetSimpleEMCALFiducialCut(0.7,80.,120.);
+    fidCut1stYear->SetSimplePHOSFiducialCut(0.12,260.,320.);
+    fidCut1stYear->DoCTSFiducialCut(kTRUE) ;
+    fidCut1stYear->SetSimpleCTSFiducialCut(0.8,0.,360.);    
+  }
+  anacorrhadronisopi0->SwitchOnDecayCorr();
+  anacorrhadronisopi0->SetMultiBin(1);
+  anacorrhadronisopi0->SetZvertexCut(10.);
+  anacorrhadronisopi0->SwitchOffNeutralCorr();
+  anacorrhadronisopi0->SwitchOffEventSelection();
   anacorrhadronisopi0->SetPtCutRange(0.1,100);
   anacorrhadronisopi0->SetDeltaPhiCutRange(1.5,4.5);
   anacorrhadronisopi0->SelectIsolated(kTRUE); // do correlation with isolated pi0
@@ -496,7 +553,7 @@ AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calori
   maker->AddAnalysis(anacorrhadronisopi0,n);
   maker->SetAnaDebug(-1)  ;
   maker->SwitchOnHistogramsMaker()  ;
-  if(data.Contains("delta")) maker->SwitchOffAODsMaker()  ;
+  if(inputDataType.Contains("delta")) maker->SwitchOffAODsMaker()  ;
   else                       maker->SwitchOnAODsMaker()  ;
        
   if(kPrintSettings) maker->Print("");
@@ -512,7 +569,7 @@ AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calori
   //task->SetDebugLevel(-1);
   task->SelectCollisionCandidates();
   task->SetAnalysisMaker(maker);
-  //if(!kSimulation)task->SelectCollisionCandidates(); //AliPhysicsSelection has to be attached before.
+  if(inputDataType=="ESD" && !kSimulation) task->SelectCollisionCandidates(); //AliPhysicsSelection has to be attached before.
   mgr->AddTask(task);
   
   //Create containers
@@ -537,7 +594,7 @@ AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calori
   //==============================================================================
   mgr->ConnectInput  (task, 0, mgr->GetCommonInputContainer());
   // AOD output slot will be used in a different way in future
-  if(!data.Contains("delta")   && outputAOD) mgr->ConnectOutput (task, 0, mgr->GetCommonOutputContainer());
+  if(!inputDataType.Contains("delta")   && outputAOD) mgr->ConnectOutput (task, 0, mgr->GetCommonOutputContainer());
   mgr->ConnectOutput (task, 1, cout_pc);
   mgr->ConnectOutput (task, 2, cout_cuts);
   
index dcbaf8f2b1502be529053794264e7b44310e0189..9cb7c5883f5e3b5cc3688dd5f995a0c95502243f 100644 (file)
@@ -1,4 +1,4 @@
-AliAnalysisTaskParticleCorrelationM *AddTaskPartCorrM(TString data, TString calorimeter, Bool_t kPrintSettings = kFALSE,Bool_t kSimulation = kFALSE,Bool_t outputAOD=kFALSE, Bool_t oldAOD=kFALSE)
+AliAnalysisTaskParticleCorrelationM *AddTaskPartCorrM(TString data, TString calorimeter, Bool_t kPrintSettings = kFALSE)
 {
   // Creates a PartCorr task, configures it and adds it to the analysis manager.
   
@@ -9,43 +9,25 @@ AliAnalysisTaskParticleCorrelationM *AddTaskPartCorrM(TString data, TString calo
     ::Error("AddTaskPartCorr", "No analysis manager to connect to.");
     return NULL;
   }  
-  
-  // Check the analysis type using the event handlers connected to the analysis manager.
-  //==============================================================================
-  if (!mgr->GetInputEventHandler()) {
-    ::Error("AddTaskPartCorr", "This task requires an input event handler");
-    return NULL;
-  }
-  TString inputDataType = "AOD";
-  if(!data.Contains("delta"))
-    inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
-  //cout<<"DATA TYPE :: "<<inputDataType<<endl;
-  // inputDataType: data managed by the input handler
-  // data: can be same as one managed by input handler, or the output AOD created by the filter. By default use AOD
-  
   Bool_t kUseKinematics = kFALSE; 
-  if(kSimulation) { 
-    kUseKinematics = (mgr->GetMCtruthEventHandler())?kTRUE:kFALSE; 
-    if (!kUseKinematics && data=="AOD" && inputDataType != "ESD") kUseKinematics = kTRUE; //AOD primary should be available ... 
-  } 
-  
+  kUseKinematics = (mgr->GetMCtruthEventHandler())?kTRUE:kFALSE;    
+       
   cout<<"********* ACCESS KINE? "<<kUseKinematics<<endl;
   
   // Configure analysis
   //===========================================================================
   
-  // *** Reader ***
-  AliCaloTrackReader * reader = ;
+  //Reader
+  AliCaloTrackReader * reader = 0x0;
   if(data.Contains("AOD")) reader = new AliCaloTrackAODReader();
   else if(data=="ESD") reader = new AliCaloTrackESDReader();
-  else if(data=="MC" && inputDataType == "ESD") reader = new AliCaloTrackMCReader();
+  else if(data=="MC" || (kUseKinematics && data == "ESD")) reader = new AliCaloTrackMCReader();
   reader->SetDebug(-1);//10 for lots of messages
   reader->SwitchOnCTS();
-  //reader->SetDeltaAODFileName("");
-  //if(!kSimulation) reader->SetFiredTriggerClassName("CINT1B-ABCE-NOPF-ALL");
+  
   if(calorimeter == "EMCAL") {
     reader->SwitchOnEMCALCells();  
-    reader->SwitchOnEMCAL();
+    reader->SwitchOnEMCAL(); 
   }
   if(calorimeter == "PHOS") { 
     reader->SwitchOnPHOSCells();  
@@ -59,324 +41,425 @@ AliAnalysisTaskParticleCorrelationM *AddTaskPartCorrM(TString data, TString calo
     reader->SwitchOffEMCALCells(); 
     reader->SwitchOffPHOSCells(); 
   }
-  
+       
   if(kUseKinematics){
-    if(inputDataType == "ESD"){
+    if(data == "ESD"){
       reader->SwitchOnStack();          
       reader->SwitchOffAODMCParticles(); 
     }
-    else if(inputDataType == "AOD"){
+    else if(data == "AOD"){
       reader->SwitchOffStack();          
       reader->SwitchOnAODMCParticles(); 
     }
   }
   
   //Min particle pT
-  reader->SetEMCALPtMin(0.1); 
-  reader->SetPHOSPtMin(0.);
-  reader->SetCTSPtMin(0.);
-  if(outputAOD)  reader->SwitchOnWriteDeltaAOD()  ;
-  if(oldAOD) reader->SwitchOnOldAODs();
+  reader->SetEMCALPtMin(0.5); 
+  reader->SetPHOSPtMin(0.5);
+  reader->SetCTSPtMin(0.1);
+  reader->SwitchOffWriteDeltaAOD()  ;
   if(kPrintSettings) reader->Print("");
   
-  // *** Calorimeters Utils    ***
-  AliCalorimeterUtils *cu = new AliCalorimeterUtils;
-  // Remove clusters close to borders, at least max energy cell is 1 cell away 
-  cu->SetNumberOfCellsFromEMCALBorder(1);
-  cu->SetNumberOfCellsFromPHOSBorder(2);
-  cu->SwitchOnNoFiducialBorderInEMCALEta0();
-  
-  // Remove EMCAL hottest channels for first LHC10 periods     
-  cu->SwitchOnBadChannelsRemoval();
-  // SM0
-  cu->SetEMCALChannelStatus(0,3,13);  cu->SetEMCALChannelStatus(0,44,1); cu->SetEMCALChannelStatus(0,3,13); 
-  cu->SetEMCALChannelStatus(0,20,7);  cu->SetEMCALChannelStatus(0,38,2);   
-  // SM1
-  cu->SetEMCALChannelStatus(1,4,7);   cu->SetEMCALChannelStatus(1,4,13);  cu->SetEMCALChannelStatus(1,9,20); 
-  cu->SetEMCALChannelStatus(1,14,15); cu->SetEMCALChannelStatus(1,23,16); cu->SetEMCALChannelStatus(1,32,23); 
-  cu->SetEMCALChannelStatus(1,37,5);  cu->SetEMCALChannelStatus(1,40,1);  cu->SetEMCALChannelStatus(1,40,2);
-  cu->SetEMCALChannelStatus(1,40,5);  cu->SetEMCALChannelStatus(1,41,0);  cu->SetEMCALChannelStatus(1,41,1);
-  cu->SetEMCALChannelStatus(1,41,2);  cu->SetEMCALChannelStatus(1,41,4);
-  // SM2       
-  cu->SetEMCALChannelStatus(2,14,15); cu->SetEMCALChannelStatus(2,18,16); cu->SetEMCALChannelStatus(2,18,17); 
-  cu->SetEMCALChannelStatus(2,18,18); cu->SetEMCALChannelStatus(2,18,20); cu->SetEMCALChannelStatus(2,18,21); 
-  cu->SetEMCALChannelStatus(2,18,23); cu->SetEMCALChannelStatus(2,19,16); cu->SetEMCALChannelStatus(2,19,17); 
-  cu->SetEMCALChannelStatus(2,19,19); cu->SetEMCALChannelStatus(2,19,20); cu->SetEMCALChannelStatus(2,19,21); 
-  cu->SetEMCALChannelStatus(2,19,22);
-  //SM3
-  cu->SetEMCALChannelStatus(3,4,7);
-  
-  
-  //Recalibration
-  //cu->SwitchOnRecalibration();
-  //TFile * f = new TFile("RecalibrationFactors.root","read");
-  //cu->SetEMCALChannelRecalibrationFactors(0,(TH2F*)f->Get("EMCALRecalFactors_SM0"));
-  //cu->SetEMCALChannelRecalibrationFactors(1,(TH2F*)f->Get("EMCALRecalFactors_SM1"));
-  //cu->SetEMCALChannelRecalibrationFactors(2,(TH2F*)f->Get("EMCALRecalFactors_SM2"));
-  //cu->SetEMCALChannelRecalibrationFactors(3,(TH2F*)f->Get("EMCALRecalFactors_SM3"));
-  //f->Close();        
-  
-  cu->SetDebug(-1);
-  if(kPrintSettings) cu->Print("");
-  
-  
   // ##### Analysis algorithm settings ####
-  
+  AliCaloPID * pid = new AliCaloPID();
+  pid->SetDispersionCut(1.5);
+  pid->SetTOFCut(5.e-9);
+  pid->SetDebug(-1);
+  if(kPrintSettings) pid->Print("");
+  //Fiducial cut  
+//  AliFiducialCut * fidCut1stYear = new AliFiducialCut();
+//  fidCut1stYear->DoCTSFiducialCut(kTRUE) ;
+//  fidCut1stYear->SetSimpleCTSFiducialCut(0.8,0.,360.);
+//  fidCut1stYear->DoEMCALFiducialCut(kTRUE) ;
+//  fidCut1stYear->DoPHOSFiducialCut(kTRUE) ;
+//  fidCut1stYear->SetSimpleEMCALFiducialCut(0.7,80.,120.);
+//  fidCut1stYear->SetSimplePHOSFiducialCut(0.12,260.,300.);
   // -------------------------------------------------
-  // --- Photon/Pi0/Omega/Electron Analysis ---
+  // --- Isolation Cut ---
   // -------------------------------------------------
+  AliIsolationCut * ic = new AliIsolationCut();
+  ic->SetConeSize(0.4);
+  //ic->SetPtThreshold(0.7);
+  ic->SetPtFraction(0.1);
+  ic->SetPtThreshold(0.7) ;
+  ic->SetSumPtThreshold(1.0) ;
+  //choose different method for IC:
+  //kPtThresIC, kSumPtIC, kPtFracIC, kSumPtFracIC
+  //  ic->SetICMethod(AliIsolationCut::kPtThresIC);
+  ic->SetICMethod(AliIsolationCut::kSumPtFracIC);
+  //particle in cone: kNeutralAndCharged=0, kOnlyNeutral=1, kOnlyCharged=2
+  ic->SetParticleTypeInCone(AliIsolationCut::kOnlyCharged);
+  if(kPrintSettings) ic->Print("");
   
-  AliAnaPhoton *anaphoton = new AliAnaPhoton();
-  anaphoton->SetDebug(-1); //10 for lots of messages
-  if(calorimeter == "PHOS"){
-    anaphoton->SetNCellCut(1);// At least 2 cells
-    anaphoton->SetMinPt(0.2);
-    anaphoton->SetMinDistanceToBadChannel(2, 4, 5);
-  }
-  else {//EMCAL
-    //anaphoton->SetNCellCut(0);// At least 2 cells
-    anaphoton->SetMinPt(0.1); // no effect minium EMCAL cut.
-    if(kUseKinematics) anaphoton->SetTimeCut(525,725);// Time window of [550-750] ns
-    anaphoton->SetMinDistanceToBadChannel(6, 12, 18);
-  }
-  anaphoton->SetCalorimeter(calorimeter);
-  if(kUseKinematics) anaphoton->SwitchOnDataMC() ;//Access MC stack and fill more histograms
-  else  anaphoton->SwitchOffDataMC() ;
-  anaphoton->SwitchOffCaloPID();
-  anaphoton->SwitchOffFiducialCut();
-  if(kSimulation){
+  //analysis with calorimeter triggers  
+  if(calorimeter=="PHOS" || calorimeter=="EMCAL") {  
+    AliCalorimeterUtils * cu = new AliCalorimeterUtils();
+    cu->SwitchOnBadChannelsRemoval();
+    
+    cu->SetNumberOfCellsFromEMCALBorder(1) ; //nEMCAL);
+    cu->SetNumberOfCellsFromPHOSBorder(2) ; //nPHOS);
+   // cu->SwitchOnNoFiducialBorderInEMCALEta0();
+    cu->SetPHOSChannelStatus(1,48, 8); //PHOS new hot channel
+    
+    // // Remove EMCAL hottest channels from Gustavo list
+    // SM0
+    cu->SetEMCALChannelStatus(0,3,13);  cu->SetEMCALChannelStatus(0,44,1); cu->SetEMCALChannelStatus(0,3,13); //warm
+    cu->SetEMCALChannelStatus(0,20,7);  cu->SetEMCALChannelStatus(0,38,2);   //hot
+    // SM1 warm channels
+    cu->SetEMCALChannelStatus(1,4,7);   cu->SetEMCALChannelStatus(1,4,13);  cu->SetEMCALChannelStatus(1,9,20); 
+    cu->SetEMCALChannelStatus(1,14,15); cu->SetEMCALChannelStatus(1,23,16); cu->SetEMCALChannelStatus(1,32,23);
+    cu->SetEMCALChannelStatus(1,37,5);  cu->SetEMCALChannelStatus(1,40,1);  cu->SetEMCALChannelStatus(1,40,2);
+    cu->SetEMCALChannelStatus(1,40,5);  cu->SetEMCALChannelStatus(1,41,0);  cu->SetEMCALChannelStatus(1,41,1);
+    cu->SetEMCALChannelStatus(1,41,2);  cu->SetEMCALChannelStatus(1,41,4);
+    // SM2
+    cu->SetEMCALChannelStatus(2,14,15); cu->SetEMCALChannelStatus(2,18,16); cu->SetEMCALChannelStatus(2,18,17); 
+    cu->SetEMCALChannelStatus(2,18,18); cu->SetEMCALChannelStatus(2,18,20); cu->SetEMCALChannelStatus(2,18,21); 
+    cu->SetEMCALChannelStatus(2,18,23); cu->SetEMCALChannelStatus(2,19,16); cu->SetEMCALChannelStatus(2,19,17); 
+    cu->SetEMCALChannelStatus(2,19,19); cu->SetEMCALChannelStatus(2,19,20); cu->SetEMCALChannelStatus(2,19,21); 
+    cu->SetEMCALChannelStatus(2,19,22);
+    //SM3
+    cu->SetEMCALChannelStatus(3,4,7);
+    
+    // -----------------------------------
+    // --- Photon and Pi0  Analysis ---
+    // -----------------------------------
+    
+    AliAnaPhoton *anaphoton = new AliAnaPhoton();
+    anaphoton->SetDebug(-1); //10 for lots of messages
+    anaphoton->SetMinPt(1.0);
+    anaphoton->SetCaloPID(pid);
+    anaphoton->SetCalorimeter(calorimeter);
+    if(kUseKinematics) anaphoton->SwitchOnDataMC() ;//Access MC stack and fill more histograms
+    else  anaphoton->SwitchOffDataMC() ;
+    anaphoton->SwitchOffCaloPID();
+    anaphoton->SwitchOffCaloPIDRecalculation(); //recommended for EMCAL
     anaphoton->SwitchOnFiducialCut();
-       AliFiducialCut * fidCut1stYear = anaphoton->GetFidutialCut();
-       fidCut1stYear->DoCTSFiducialCut(kFALSE) ;
-       fidCut1stYear->DoEMCALFiducialCut(kTRUE) ;
-       fidCut1stYear->DoPHOSFiducialCut(kTRUE) ;
-       fidCut1stYear->SetSimpleEMCALFiducialCut(0.7,80.,120.);
-       fidCut1stYear->SetSimplePHOSFiducialCut(0.12,260.,320.);
-  }
-  
-  if(!data.Contains("delta")) {
-    anaphoton->SetOutputAODName(Form("Photons%s",calorimeter.Data()));
-    anaphoton->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
-  }
-  else anaphoton->SetInputAODName(Form("Photons%s",calorimeter.Data()));
-  anaphoton->AddToHistogramsName("AnaPhotonCorr_");
-  //Set Histograms bins and ranges
-  anaphoton->SetHistoPtRangeAndNBins(0, 50, 200) ;
-  //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
-  //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
-  if(kPrintSettings) anaphoton->Print("");
-  // -----------------------------------
-  // --- Pi0 Invariant Mass Analysis ---
-  // -----------------------------------
-  
-  AliAnaPi0 *anapi0 = new AliAnaPi0();
-  anapi0->SetDebug(-1);//10 for lots of messages
-  anapi0->SetInputAODName(Form("Photons%s",calorimeter.Data()));
-  anapi0->SetCalorimeter(calorimeter);
-  if(kSimulation){
+    AliFiducialCut * fidCut1stYear = anaphoton->GetFiducialCut();
+    fidCut1stYear->DoEMCALFiducialCut(kTRUE) ;
+    fidCut1stYear->DoPHOSFiducialCut(kTRUE) ;
+    fidCut1stYear->SetSimpleEMCALFiducialCut(0.7,80.,120.);
+    fidCut1stYear->SetSimplePHOSFiducialCut(0.12,260.,320.);
+    anaphoton->SwitchOnTrackMatchRejection();
+    //settings for different multiplicity analysis
+    anaphoton->SwitchOffEventSelection() ;
+    anaphoton->SetZvertexCut(10.);
+    anaphoton->SetMultiplicity(80, 120);
+    
+    if(calorimeter == "EMCAL"){
+      anaphoton->SetNCellCut(1);
+      if(!kUseKinematics) anaphoton->SetTimeCut(525, 725);
+      anaphoton->SetMinDistanceToBadChannel(4, 5, 10);
+    }
+    else{
+      anaphoton->SetMinDistanceToBadChannel(2, 4, 5);
+      anaphoton->SetNCellCut(2);
+    }
+    if(!data.Contains("delta")) {
+      anaphoton->SetOutputAODName(Form("Triggers%s",calorimeter.Data()));
+      anaphoton->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
+    }
+    else anaphoton->SetOutputAODName(Form("Triggers%s",calorimeter.Data()));
+    anaphoton->AddToHistogramsName("AnaPhoton_");
+    //Set Histograms bins and ranges
+    anaphoton->SetHistoPtRangeAndNBins(0, 50, 100) ;
+    //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
+    //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
+    
+    if(kPrintSettings) anaphoton->Print("");
+    AliAnaPi0 *anapi0 = new AliAnaPi0();
+    anapi0->SetDebug(-1);//10 for lots of messages
+    anapi0->SetInputAODName(Form("Triggers%s",calorimeter.Data()));
+    anapi0->AddToHistogramsName("AnaPi0_");
+    anapi0->SetCaloPID(pid);
+    anapi0->SetCalorimeter(calorimeter);
     anapi0->SwitchOnFiducialCut();
     AliFiducialCut * fidCut1stYear = anapi0->GetFiducialCut();
-    fidCut1stYear->DoCTSFiducialCut(kFALSE) ;
     fidCut1stYear->DoEMCALFiducialCut(kTRUE) ;
     fidCut1stYear->DoPHOSFiducialCut(kTRUE) ;
     fidCut1stYear->SetSimpleEMCALFiducialCut(0.7,80.,120.);
     fidCut1stYear->SetSimplePHOSFiducialCut(0.12,260.,320.);
-  }  
-       
-  anapi0->SetNPID(1); //Available from tag AliRoot::v4-18-15-AN
-  //settings for pp collision
-  anapi0->SetNCentrBin(1);
-  anapi0->SetNZvertBin(1);
-  anapi0->SetNRPBin(1);
-  anapi0->SetNMaxEvMix(10);
-  anapi0->SwitchOffDataMC() ;//Access MC stack and fill more histograms
-  if(calorimeter=="PHOS") anapi0->SetNumberOfModules(3); //PHOS first year
-  else  anapi0->SetNumberOfModules(4); //EMCAL first year
-  anapi0->SetHistoPtRangeAndNBins(0, 50, 200) ;
-  //anapi0->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
-  //anapi0->SetHistoEtaRangeAndNBins(-0.8, 0.8, 200) ;
-  anapi0->SetHistoMassRangeAndNBins(0., 0.6, 200) ;
-  anapi0->SetHistoAsymmetryRangeAndNBins(0., 1. , 10) ;
-  if(kPrintSettings) anapi0->Print("");
-       
-  //---------------------------  
-  //Pi0, event by event
-  //---------------------------  
-
-               
-  AliAnaPi0EbE *anapi0ebe = new AliAnaPi0EbE();
-  anapi0ebe->SetDebug(-1);//10 for lots of messages
-  anapi0ebe->SetAnalysisType(AliAnaPi0EbE::kIMCalo);
-  anapi0ebe->SetMinPt(0);
-  anapi0ebe->SetCalorimeter(calorimeter);
-  anapi0ebe->SetInputAODName(Form("Photons%s",calorimeter.Data()));
-  if(!data.Contains("delta")) {
-    anapi0ebe->SetOutputAODName(Form("Pi0s%s",calorimeter.Data()));
-    anapi0ebe->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
+    anapi0->SetNPID(1); 
+    //settings for different multiplicity analysis
+    anapi0->SwitchOnEventSelection() ;
+    anapi0->SetNCentrBin(1);
+    anapi0->SetZvertexCut(10.);
+    anapi0->SetMultiplicity(80, 120);
+    anapi0->SetMultiBin(1);  
+    anapi0->SwitchOffDataMC() ;//Access MC stack and fill more histograms
+    if(calorimeter=="PHOS") anapi0->SetNumberOfModules(3); //PHOS first year
+    else if(calorimeter=="EMCAL") anapi0->SetNumberOfModules(4); //EMCAL first year
+    anapi0->SetHistoPtRangeAndNBins(0, 50, 100) ;
+    //anapi0->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
+    //anapi0->SetHistoEtaRangeAndNBins(-0.8, 0.8, 200) ;
+    anapi0->SetHistoMassRangeAndNBins(0., 1.0, 100) ;
+    anapi0->SetHistoAsymmetryRangeAndNBins(0., 1. , 10) ;
+    if(kPrintSettings) anapi0->Print("");
+    
+    // -------------------------------------------------
+    // --- Pi0 EbE Analysis ---
+    // -------------------------------------------------
+    
+    AliNeutralMesonSelection *nms = new AliNeutralMesonSelection();
+    nms->SetInvMassCutRange(0.05, 0.16)     ;
+    nms->SwitchOffAngleSelection() ;
+    nms->KeepNeutralMesonSelectionHistos(kTRUE);
+    //Set Histrograms bins and ranges
+    nms->SetHistoERangeAndNBins(0, 50, 100) ;
+    nms->SetHistoPtRangeAndNBins(0, 50, 100) ;
+    //      nms->SetHistoAngleRangeAndNBins(0, 0.3, 100) ;
+    //      nsm->SetHistoIMRangeAndNBins(0, 0.4, 100) ;  
+    
+    AliAnaPi0EbE *anapi0ebe = new AliAnaPi0EbE();
+    anapi0ebe->SetDebug(-1);//10 for lots of messages
+    anapi0ebe->SetAnalysisType(AliAnaPi0EbE::kIMCalo);
+    anapi0ebe->SetMinPt(0.5);
+    anapi0ebe->SetCalorimeter(calorimeter);
+    anapi0ebe->SetInputAODName(Form("Triggers%s",calorimeter.Data()));
+    if(!data.Contains("delta")) {
+      anapi0ebe->SetOutputAODName(Form("Pi0s%s",calorimeter.Data()));
+      anapi0ebe->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
+    }
+    else  anapi0ebe->SetOutputAODName(Form("Pi0s%s",calorimeter.Data()));
+    
+    if(kUseKinematics) anapi0ebe->SwitchOnDataMC() ;//Access MC stack and fill more histograms
+    else  anapi0ebe->SwitchOffDataMC() ;       
+    anapi0ebe->SwitchOffEventSelection() ;
+    anapi0ebe->SetZvertexCut(10.);
+    anapi0ebe->SetMultiplicity(80, 120);
+    anapi0ebe->SetMultiBin(1);  
+    anapi0ebe->SetNeutralMesonSelection(nms);
+    //Set Histrograms bins and ranges
+    anapi0ebe->SetHistoPtRangeAndNBins(0, 50, 100) ;
+    //      anapi0->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
+    //      anapi0->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
+    if(kPrintSettings) anapi0ebe->Print("");
+    
+    // ### Pi0 Correlation with hadrons, not isolated
+    AliAnaParticleHadronCorrelation *anacorrhadronpi0 = new AliAnaParticleHadronCorrelation();
+    anacorrhadronpi0->SetInputAODName(Form("Pi0s%s",calorimeter.Data()));
+    anacorrhadronpi0->AddToHistogramsName("AnaHadronCorrPi0_");
+    anacorrhadronpi0->SetDebug(-1);
+    anacorrhadronpi0->SwitchOffCaloPID();
+    anacorrhadronpi0->SwitchOnFiducialCut();
+    AliFiducialCut * fidCut1stYear = anacorrhadronpi0->GetFiducialCut();
+    fidCut1stYear->DoEMCALFiducialCut(kTRUE) ;
+    fidCut1stYear->DoPHOSFiducialCut(kTRUE) ;
+    fidCut1stYear->SetSimpleEMCALFiducialCut(0.7,80.,120.);
+    fidCut1stYear->SetSimplePHOSFiducialCut(0.12,260.,320.);
+    fidCut1stYear->DoCTSFiducialCut(kTRUE) ;
+    fidCut1stYear->SetSimpleCTSFiducialCut(0.8,0.,360.);    
+    anacorrhadronpi0->SwitchOnDecayCorr();
+    anacorrhadronpi0->SetPtCutRange(0.5,50);
+    anacorrhadronpi0->SetDeltaPhiCutRange(1.5,4.5);
+    anacorrhadronpi0->SelectIsolated(kFALSE); // do correlation with non isolated pi0
+    anacorrhadronpi0->SetMultiplicity(80, 100);
+    anacorrhadronpi0->SetMultiBin(1);
+    anacorrhadronpi0->SetZvertexCut(10.);
+    anacorrhadronpi0->SwitchOffNeutralCorr();
+    anacorrhadronpi0->SwitchOffEventSelection();
+    anacorrhadronpi0->SwitchOnSeveralUECalculation();
+    anacorrhadronpi0->SetUeDeltaPhiCutRange(TMath::Pi()/3, 2*TMath::Pi()/3);
+    if(kUseKinematics) anacorrhadronpi0->SwitchOnDataMC() ;//Access MC stack and fill more histograms
+    else  anacorrhadronpi0->SwitchOffDataMC() ;
+    //if(calorimeter=="PHOS"){
+    // //Correlate with particles in EMCAL
+    // anacorrhadronpi0->SwitchOnCaloPID();
+    // anacorrhadronpi0->SwitchOnCaloPIDRecalculation(); //recommended for EMCAL
+    //}
+    //Set Histograms bins and ranges
+    anacorrhadronpi0->SetHistoPtRangeAndNBins(0, 50, 100) ;
+    //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
+    //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
+    if(kPrintSettings) anacorrhadronpi0->Print("");
+    
+    AliAnaParticleIsolation *anaisolpi0 = new AliAnaParticleIsolation();
+    anaisolpi0->SetDebug(-1);
+    anaisolpi0->SetMinPt(2.);
+    anaisolpi0->SetZvertexCut(10.);
+    anaisolpi0->SetInputAODName(Form("Pi0s%s",calorimeter.Data()));
+    anaisolpi0->AddToHistogramsName("AnaIsolPi0_");
+    anaisolpi0->SetCalorimeter(calorimeter);
+    if(kUseKinematics) anaisolpi0->SwitchOnDataMC() ;//Access MC stack and fill more histograms
+    else  anaisolpi0->SwitchOffDataMC() ;
+    //Select clusters with no pair, if both clusters with pi0 mass
+    anaisolpi0->SwitchOffInvariantMass();
+    //anaisol->SetNeutralMesonSelection(nms);
+    //Do isolation cut
+    anaisolpi0->SetIsolationCut(ic);   
+    //Do or not do isolation with previously produced AODs.
+    //No effect if use of SwitchOnSeveralIsolation()
+    anaisolpi0->SwitchOffReIsolation();
+    //Multiple IC
+    anaisolpi0->SwitchOffSeveralIsolation() ;
+    //Set Histograms bins and ranges
+    anaisolpi0->SetHistoPtRangeAndNBins(0, 50, 100) ;
+    //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
+    //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
+    if(kPrintSettings) anaisol->Print("");
+    
+    // ### Pi0 Correlation with hadrons, isolated
+    AliAnaParticleHadronCorrelation *anacorrhadronisopi0 = new AliAnaParticleHadronCorrelation();
+    anacorrhadronisopi0->SetInputAODName(Form("Pi0s%s",calorimeter.Data()));
+    anacorrhadronisopi0->AddToHistogramsName("AnaHadronCorrIsoPi0_");
+    anacorrhadronisopi0->SetDebug(-1);
+    anacorrhadronisopi0->SwitchOffCaloPID();
+    anacorrhadronisopi0->SwitchOnFiducialCut();
+    AliFiducialCut * fidCut1stYear = anacorrhadronisopi0->GetFiducialCut();
+    fidCut1stYear->DoEMCALFiducialCut(kTRUE) ;
+    fidCut1stYear->DoPHOSFiducialCut(kTRUE) ;
+    fidCut1stYear->SetSimpleEMCALFiducialCut(0.7,80.,120.);
+    fidCut1stYear->SetSimplePHOSFiducialCut(0.12,260.,320.);
+    fidCut1stYear->DoCTSFiducialCut(kTRUE) ;
+    fidCut1stYear->SetSimpleCTSFiducialCut(0.8,0.,360.);    
+    anacorrhadronisopi0->SwitchOnDecayCorr();
+    anacorrhadronisopi0->SetPtCutRange(0.5,50);
+    anacorrhadronisopi0->SetDeltaPhiCutRange(1.5,4.5);
+    anacorrhadronisopi0->SelectIsolated(kTRUE); // do correlation with isolated pi0
+    anacorrhadronisopi0->SetMultiplicity(80, 100);
+    anacorrhadronisopi0->SetMultiBin(1);
+    anacorrhadronisopi0->SetZvertexCut(10.);
+    anacorrhadronisopi0->SwitchOffNeutralCorr();
+    anacorrhadronisopi0->SwitchOffEventSelection();  
+    anacorrhadronisopi0->SwitchOnSeveralUECalculation();
+    anacorrhadronisopi0->SetUeDeltaPhiCutRange(TMath::Pi()/3, 2*TMath::Pi()/3);
+    if(kUseKinematics) anacorrhadronisopi0->SwitchOnDataMC() ;//Access MC stack and fill more histograms
+    else  anacorrhadronisopi0->SwitchOffDataMC() ;
+    //if(calorimeter=="PHOS"){
+    // //Correlate with particles in EMCAL
+    // anacorrhadronpi0->SwitchOnCaloPID();
+    // anacorrhadronpi0->SwitchOnCaloPIDRecalculation(); //recommended for EMCAL
+    //}
+    //Set Histograms bins and ranges
+    anacorrhadronisopi0->SetHistoPtRangeAndNBins(0, 50, 100) ;
+    //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
+    //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
+    if(kPrintSettings) anacorrhadronisopi0->Print("");
+    
+  } //analysis in calorimeter
+  else {
+    //---charge particle trigger---------------------
+    //------------------------------------------------
+    
+    AliAnaChargedParticles *anacharge = new AliAnaChargedParticles();
+    anacharge->SetDebug(-1); //10 for lots of messages
+    anacharge->SetMinPt(1.0);
+    // anacharge->SetCaloPID(pid);
+    anacharge->SetZvertexCut(10.);
+    if(kUseKinematics) anacharge->SwitchOnDataMC() ;//Access MC stack and fill more histograms
+    else  anacharge->SwitchOffDataMC() ;
+    anacharge->SwitchOffCaloPID();
+    anacharge->SwitchOffCaloPIDRecalculation(); //recommended for EMCAL
+    anacharge->SwitchOnFiducialCut();
+    AliFiducialCut * fidCut1stYear = anacharge->GetFiducialCut();
+    fidCut1stYear->DoCTSFiducialCut(kTRUE) ;
+    fidCut1stYear->SetSimpleCTSFiducialCut(0.8,0.,360.);       
+    if(!data.Contains("delta")) {
+      anacharge->SetOutputAODName(Form("Triggers%s",calorimeter.Data()));
+      anacharge->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
+    }
+    else anacharge->SetOutputAODName(Form("Triggers%s",calorimeter.Data()));
+    anacharge->AddToHistogramsName("AnaCharge_");
+    //Set Histograms bins and ranges
+    anacharge->SetHistoPtRangeAndNBins(0, 50, 100) ;
+    //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
+    //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
+    
+    if(kPrintSettings) anacharge->Print("");    
   }
-  else  anapi0ebe->SetInputAODName(Form("Pi0s%s",calorimeter.Data()));
   
-  if(kUseKinematics) anapi0ebe->SwitchOnDataMC() ;//Access MC stack and fill more histograms
-  else  anapi0ebe->SwitchOffDataMC() ; 
+  // -------------------------------------------------
+  // ---  Correlation Analysis with non-isolated triggers ---
+  // -------------------------------------------------
+  // ### Correlation with hadrons
+  AliAnaParticleHadronCorrelation *anacorrhadron = new AliAnaParticleHadronCorrelation();
+  anacorrhadron->SetInputAODName(Form("Triggers%s",calorimeter.Data()));
+  anacorrhadron->AddToHistogramsName("AnaHadronCorrTrig_");
+  anacorrhadron->SetDebug(-1);
+  anacorrhadron->SwitchOnCaloPID();
+  anacorrhadron->SwitchOnFiducialCut();
+  AliFiducialCut * fidCut1stYear = anacorrhadron->GetFiducialCut();
+  fidCut1stYear->DoEMCALFiducialCut(kTRUE) ;
+  fidCut1stYear->DoPHOSFiducialCut(kTRUE) ;
+  fidCut1stYear->SetSimpleEMCALFiducialCut(0.7,80.,120.);
+  fidCut1stYear->SetSimplePHOSFiducialCut(0.12,260.,320.);
+  fidCut1stYear->DoCTSFiducialCut(kTRUE) ;
+  fidCut1stYear->SetSimpleCTSFiducialCut(0.8,0.,360.);    
+  anacorrhadron->SetPtCutRange(0.5,50);
+  anacorrhadron->SetDeltaPhiCutRange(1.5,4.5);
+  anacorrhadron->SetMultiplicity(80, 120);
+  anacorrhadron->SetMultiBin(1);
+  anacorrhadron->SetZvertexCut(10.);
+  anacorrhadron->SwitchOffNeutralCorr();
+  anacorrhadron->SwitchOffEventSelection();
+  anacorrhadron->SwitchOnSeveralUECalculation();
+  anacorrhadron->SetUeDeltaPhiCutRange(TMath::Pi()/3, 2*TMath::Pi()/3);
+  anacorrhadron->SelectIsolated(kFALSE); // do correlation with isolated photons
+  if(kUseKinematics) anacorrhadron->SwitchOnDataMC() ;//Access MC stack and fill more histograms
+  else  anacorrhadron->SwitchOffDataMC() ;
+  //if(calorimeter=="PHOS"){
+  //Correlate with particles in EMCAL
+  //anacorrhadron->SwitchOnCaloPID();
+  //anacorrhadron->SwitchOnCaloPIDRecalculation(); //recommended for EMCAL
+  //}
+  //Set Histograms bins and ranges
+  anacorrhadron->SetHistoPtRangeAndNBins(0, 50, 100) ;
+  //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
+  //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
+  if(kPrintSettings) anacorrhadron->Print("");
+  
+  
   
-  AliNeutralMesonSelection *nms = anapi0ebe->GetNeutralMesonSelection();
-  nms->SetInvMassCutRange(0.05, 0.2)     ;
-  nms->KeepNeutralMesonSelectionHistos(kTRUE);
-  //Set Histrograms bins and ranges
-  nms->SetHistoERangeAndNBins(0, 50, 200) ;
-  //      nms->SetHistoPtRangeAndNBins(0, 50, 100) ;
-  //      nms->SetHistoAngleRangeAndNBins(0, 0.3, 100) ;
-  //      nsm->SetHistoIMRangeAndNBins(0, 0.4, 100) ;  
-  //Set Histrograms bins and ranges
-  anapi0ebe->SetHistoPtRangeAndNBins(0, 50, 200) ;
-  //      anapi0->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
-  //      anapi0->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
-  if(kPrintSettings) anapi0ebe->Print("");
-       
-  //-------------------------------------
-  //*** analysis the omega->pi0+gamma ***
-  //------------------------------------
-  AliAnaOmegaToPi0Gamma *anaomegaToPi0Gamma = new AliAnaOmegaToPi0Gamma();
-  anaomegaToPi0Gamma->SetDebug(-1);//10 for lots of messages
-  anaomegaToPi0Gamma->SetInputAODName(Form("Pi0s%s",calorimeter.Data()));
-  anaomegaToPi0Gamma->SetInputAODPhotonName(Form("Photons%s",calorimeter.Data()));
-  anaomegaToPi0Gamma->SetNPID(1);
-  anaomegaToPi0Gamma->SetNVtxZ(1);
-  anaomegaToPi0Gamma->SetNEventsMixed(4);
-  if(calorimeter=="PHOS")
-       anaomegaToPi0Gamma->SetPi0MassPeakWidthCut(0.008); // PHOS
-  else if(calorimeter=="EMCAL")
-       anaomegaToPi0Gamma->SetPi0MassPeakWidthCut(0.012); // EMCAL 
-  anaomegaToPi0Gamma->SetHistoPtRangeAndNBins(0, 20, 100) ;
-  anaomegaToPi0Gamma->SetHistoMassRangeAndNBins(0, 1, 100) ;
-  anaomegaToPi0Gamma->SetPi0OverOmegaPtCut(0.8);
-  anaomegaToPi0Gamma->SetGammaOverOmegaPtCut(0.2);
-  if(kUseKinematics) anaomegaToPi0Gamma->SwitchOnDataMC() ;//Access MC stack and fill more histograms
-  else anaomegaToPi0Gamma->SwitchOffDataMC() ;//Access MC stack and fill more histograms
-  anaomegaToPi0Gamma->AddToHistogramsName(Form("AnaOmegaToPi0Gamma%s_",calorimeter.Data()));
-  if(kPrintSettings)   anaomegaToPi0Gamma->Print("");
-       
-  //==================================
   // ### Isolation analysis ###        
-  //=================================
-  //Photon
   AliAnaParticleIsolation *anaisol = new AliAnaParticleIsolation();
   anaisol->SetDebug(-1);
-  anaisol->SetMinPt(0);
-  anaisol->SetInputAODName(Form("Photons%s",calorimeter.Data()));
-  anaisol->SetAODObjArrayName("ICPhoton"); 
+  anaisol->SetMinPt(2.0);
+  anaisol->SetZvertexCut(10.);
+  anaisol->SetInputAODName(Form("Triggers%s",calorimeter.Data()));
+  anaisol->AddToHistogramsName("AnaIsolTrig_");
   anaisol->SetCalorimeter(calorimeter);
   if(kUseKinematics) anaisol->SwitchOnDataMC() ;//Access MC stack and fill more histograms
   else  anaisol->SwitchOffDataMC() ;
   //Select clusters with no pair, if both clusters with pi0 mass
   anaisol->SwitchOffInvariantMass();
+  //anaisol->SetNeutralMesonSelection(nms);
   //Do isolation cut
-  AliIsolationCut * ic =  anaisol->GetIsolationCut();  
-  ic->SetConeSize(0.4);
-  ic->SetPtThreshold(0.2);
-  ic->SetParticleTypeInCone(AliIsolationCut::kOnlyCharged);
-  ic->SetICMethod(AliIsolationCut::kPtThresIC);
-  if(kPrintSettings) ic->Print("");
-  
+  anaisol->SetIsolationCut(ic);        
   //Do or not do isolation with previously produced AODs.
   //No effect if use of SwitchOnSeveralIsolation()
   anaisol->SwitchOffReIsolation();
   //Multiple IC
   anaisol->SwitchOffSeveralIsolation() ;
   //Set Histograms bins and ranges
-  anaisol->SetHistoPtRangeAndNBins(0, 50, 200) ;
+  anaisol->SetHistoPtRangeAndNBins(0, 50, 100) ;
   //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
   //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
-  anaisol->AddToHistogramsName("AnaIsolPhoton_");
-  if(kPrintSettings) anaisol->Print("");
   
-  //Pi0
-  AliAnaParticleIsolation *anaisolpi0 = new AliAnaParticleIsolation();
-  anaisolpi0->SetDebug(-1);
-  anaisolpi0->SetMinPt(0);
-  anaisolpi0->SetInputAODName(Form("Pi0s%s",calorimeter.Data()));
-  anaisolpi0->AddToHistogramsName("AnaIsolPi0_");
-  anaisolpi0->SetAODObjArrayName("ICPi0"); 
-  anaisolpi0->SetCalorimeter(calorimeter);
-  if(kUseKinematics) anaisolpi0->SwitchOnDataMC() ;//Access MC stack and fill more histograms
-  else  anaisolpi0->SwitchOffDataMC() ;
-  //Select clusters with no pair, if both clusters with pi0 mass
-  anaisolpi0->SwitchOffInvariantMass();
-  //Do isolation cut
-  AliIsolationCut * ic2 =  anaisolpi0->GetIsolationCut();      
-  ic2->SetConeSize(0.4);
-  ic2->SetPtThreshold(0.2);
-  ic2->SetICMethod(AliIsolationCut::kPtThresIC);
-  if(kPrintSettings) ic2->Print("");
-  //Do or not do isolation with previously produced AODs.
-  //No effect if use of SwitchOnSeveralIsolation()
-  anaisolpi0->SwitchOffReIsolation();
-  //Multiple IC
-  anaisolpi0->SwitchOffSeveralIsolation() ;
-  //Set Histograms bins and ranges
-  anaisolpi0->SetHistoPtRangeAndNBins(0, 50, 200) ;
-  //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
-  //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
-  if(kPrintSettings) anaisolpi0->Print("");
-       
-  //===========================
-  //Correlation analysis
-  //===========================
-       
-  // ### Correlation with Jet Finder AOD output
-  AliAnaParticleJetFinderCorrelation *anacorrjet = new AliAnaParticleJetFinderCorrelation();
-  anacorrjet->SetInputAODName(Form("Photons%s",calorimeter.Data()));
-  anacorrjet->SwitchOffFiducialCut();
-  anacorrjet->SetDebug(-1);
-  anacorrjet->SetConeSize(1);  
-  anacorrjet->SelectIsolated(kTRUE); // do correlation with isolated photons
-  anacorrjet->SetPtThresholdInCone(0.2);
-  anacorrjet->SetDeltaPhiCutRange(0.5,5.5);//Mostly Open Cuts 
-  anacorrjet->SetRatioCutRange(0.01,3); //Mostly Open Cuts
-  anacorrjet->UseJetRefTracks(kFALSE); //Not working now
-  //Set Histograms bins and ranges
-  anacorrjet->SetHistoPtRangeAndNBins(0, 50, 200) ;
-  //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
-  //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
-  if(kPrintSettings) anacorrjet->Print("");
-  
-  // ### Correlation with hadrons
-  AliAnaParticleHadronCorrelation *anacorrhadron = new AliAnaParticleHadronCorrelation();
-  anacorrhadron->SetInputAODName(Form("Photons%s",calorimeter.Data()));
-  anacorrhadron->AddToHistogramsName("AnaHadronCorrPhoton_");
-  anacorrhadron->SetAODObjArrayName("PhotonHadronCorr"); 
-  anacorrhadron->SetDebug(-1);
-  anacorrhadron->SwitchOffCaloPID();
-  anacorrhadron->SwitchOffFiducialCut();
-  anacorrhadron->SetPtCutRange(0.1,100);
-  anacorrhadron->SetDeltaPhiCutRange(1.5,4.5);
-  anacorrhadron->SwitchOnSeveralUECalculation();
-  anacorrhadron->SetUeDeltaPhiCutRange(TMath::Pi()/3, 2*TMath::Pi()/3);
-  anacorrhadron->SelectIsolated(kFALSE); // do correlation with isolated photons
-  if(kUseKinematics) anacorrhadron->SwitchOnDataMC() ;//Access MC stack and fill more histograms
-  else  anacorrhadron->SwitchOffDataMC() ;
-  //if(calorimeter=="PHOS"){
-  //Correlate with particles in EMCAL
-  //anacorrhadron->SwitchOnCaloPID();
-  //anacorrhadron->SwitchOnCaloPIDRecalculation(); //recommended for EMCAL
-  //}
-  //Set Histograms bins and ranges
-  anacorrhadron->SetHistoPtRangeAndNBins(0, 50, 200) ;
-  //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
-  //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
-  if(kPrintSettings) anacorrhadron->Print("");
+  if(kPrintSettings) anaisol->Print("");
   
+  // -------------------------------------------------
+  // ---  Correlation Analysis with isolated triggers ---
+  // -------------------------------------------------
   // ### Correlation with hadrons
   AliAnaParticleHadronCorrelation *anacorrisohadron = new AliAnaParticleHadronCorrelation();
-  anacorrisohadron->SetInputAODName(Form("Photons%s",calorimeter.Data()));
-  anacorrisohadron->AddToHistogramsName("AnaHadronCorrIsoPhoton_");
-  anacorrisohadron->SetAODObjArrayName("IsoPhotonHadronCorr"); 
+  anacorrisohadron->SetInputAODName(Form("Triggers%s",calorimeter.Data()));
+  anacorrisohadron->AddToHistogramsName("AnaHadronCorrIsoTrig_");
   anacorrisohadron->SetDebug(-1);
   anacorrisohadron->SwitchOffCaloPID();
-  anacorrisohadron->SwitchOffFiducialCut();
-  anacorrisohadron->SetPtCutRange(0.1,100);
+  anacorrisohadron->SwitchOnFiducialCut();
+  AliFiducialCut * fidCut1stYear = anacorrisohadron->GetFiducialCut();
+  fidCut1stYear->DoEMCALFiducialCut(kTRUE) ;
+  fidCut1stYear->DoPHOSFiducialCut(kTRUE) ;
+  fidCut1stYear->SetSimpleEMCALFiducialCut(0.7,80.,120.);
+  fidCut1stYear->SetSimplePHOSFiducialCut(0.12,260.,320.);
+  fidCut1stYear->DoCTSFiducialCut(kTRUE) ;
+  fidCut1stYear->SetSimpleCTSFiducialCut(0.8,0.,360.);    
+  anacorrisohadron->SetPtCutRange(0.5,50);
   anacorrisohadron->SetDeltaPhiCutRange(1.5,4.5);
+  anacorrisohadron->SetMultiplicity(80, 100);
+  anacorrisohadron->SetMultiBin(1);
+  anacorrisohadron->SetZvertexCut(10.);
+  anacorrisohadron->SwitchOffNeutralCorr();
+  anacorrisohadron->SwitchOffEventSelection();
   anacorrisohadron->SwitchOnSeveralUECalculation();
   anacorrisohadron->SetUeDeltaPhiCutRange(TMath::Pi()/3, 2*TMath::Pi()/3);
   anacorrisohadron->SelectIsolated(kTRUE); // do correlation with isolated photons
@@ -388,86 +471,33 @@ AliAnalysisTaskParticleCorrelationM *AddTaskPartCorrM(TString data, TString calo
   //anacorrhadron->SwitchOnCaloPIDRecalculation(); //recommended for EMCAL
   //}
   //Set Histograms bins and ranges
-  anacorrisohadron->SetHistoPtRangeAndNBins(0, 50, 200) ;
+  anacorrisohadron->SetHistoPtRangeAndNBins(0, 50, 100) ;
   //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
   //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
   if(kPrintSettings) anacorrisohadron->Print("");
   
-  
-  // ### Pi0 Correlation with hadrons, not isolated
-  AliAnaParticleHadronCorrelation *anacorrhadronpi0 = new AliAnaParticleHadronCorrelation();
-  anacorrhadronpi0->SetInputAODName(Form("Pi0s%s",calorimeter.Data()));
-  anacorrhadronpi0->AddToHistogramsName("AnaHadronCorrPi0_");
-  anacorrhadronpi0->SetAODObjArrayName("Pi0HadronCorr"); 
-  anacorrhadronpi0->SetDebug(-1);
-  anacorrhadronpi0->SwitchOffCaloPID();
-  anacorrhadronpi0->SwitchOffFiducialCut();
-  anacorrhadronpi0->SetPtCutRange(0.1,100);
-  anacorrhadronpi0->SetDeltaPhiCutRange(1.5,4.5);
-  anacorrhadronpi0->SelectIsolated(kFALSE); // do correlation with non isolated pi0
-  anacorrhadronpi0->SwitchOnSeveralUECalculation();
-  anacorrhadronpi0->SetUeDeltaPhiCutRange(TMath::Pi()/3, 2*TMath::Pi()/3);
-  if(kUseKinematics) anacorrhadronpi0->SwitchOnDataMC() ;//Access MC stack and fill more histograms
-  else  anacorrhadronpi0->SwitchOffDataMC() ;
-  //if(calorimeter=="PHOS"){
-  //   //Correlate with particles in EMCAL
-  //   anacorrhadronpi0->SwitchOnCaloPID();
-  //   anacorrhadronpi0->SwitchOnCaloPIDRecalculation(); //recommended for EMCAL
-  //}
-  //Set Histograms bins and ranges
-  anacorrhadronpi0->SetHistoPtRangeAndNBins(0, 50, 200) ;
-  //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
-  //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
-  if(kPrintSettings) anacorrhadronpi0->Print("");
-  
-  // ### Pi0 Correlation with hadrons, isolated
-  AliAnaParticleHadronCorrelation *anacorrhadronisopi0 = new AliAnaParticleHadronCorrelation();
-  anacorrhadronisopi0->SetInputAODName(Form("Pi0s%s",calorimeter.Data()));
-  anacorrhadronisopi0->AddToHistogramsName("AnaHadronCorrIsoPi0_");
-  anacorrhadronisopi0->SetAODObjArrayName("IsoPi0HadronCorr"); 
-  anacorrhadronisopi0->SetDebug(-1);
-  anacorrhadronisopi0->SwitchOffCaloPID();
-  anacorrhadronisopi0->SwitchOffFiducialCut();
-  anacorrhadronisopi0->SetPtCutRange(0.1,100);
-  anacorrhadronisopi0->SetDeltaPhiCutRange(1.5,4.5);
-  anacorrhadronisopi0->SelectIsolated(kTRUE); // do correlation with isolated pi0
-  anacorrhadronisopi0->SwitchOnSeveralUECalculation();
-  anacorrhadronisopi0->SetUeDeltaPhiCutRange(TMath::Pi()/3, 2*TMath::Pi()/3);
-  if(kUseKinematics) anacorrhadronisopi0->SwitchOnDataMC() ;//Access MC stack and fill more histograms
-  else  anacorrhadronisopi0->SwitchOffDataMC() ;
-  //if(calorimeter=="PHOS"){
-  //   //Correlate with particles in EMCAL
-  //   anacorrhadronpi0->SwitchOnCaloPID();
-  //   anacorrhadronpi0->SwitchOnCaloPIDRecalculation(); //recommended for EMCAL
-  //}
-  //Set Histograms bins and ranges
-  anacorrhadronisopi0->SetHistoPtRangeAndNBins(0, 50, 200) ;
-  //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
-  //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
-  if(kPrintSettings) anacorrhadronisopi0->Print("");
-  
-  
   // #### Configure Maker ####
   AliAnaPartCorrMaker * maker = new AliAnaPartCorrMaker();
   maker->SetReader(reader);//pointer to reader
-  maker->SetCaloUtils(cu); //pointer to calorimeter utils
   Int_t n = 0;//Analysis number, order is important
-
   // Particle selection analysis
-  maker->AddAnalysis(anaphoton,n++);
-  maker->AddAnalysis(anapi0,n++);
-  maker->AddAnalysis(anapi0ebe,n++);
-  maker->AddAnalysis(anaomegaToPi0Gamma,n++);  
-  // Isolation analysis
-  maker->AddAnalysis(anaisol,n++);
-  maker->AddAnalysis(anaisolpi0,n++);
+  if(calorimeter=="PHOS" || calorimeter=="EMCAL") {   
+    maker->SetCaloUtils(cu);  //pointer to calorimeter utils
+    maker->AddAnalysis(anaphoton,n++);
+    maker->AddAnalysis(anapi0,n++);
+    maker->AddAnalysis(anapi0ebe,n++);
+    maker->AddAnalysis(anacorrhadronpi0,n++);
+    maker->AddAnalysis(anaisolpi0,n++);
+    maker->AddAnalysis(anacorrhadronisopi0,n++);
+  }
+   if(calorimeter=="CTS") 
+     maker->AddAnalysis(anacharge,n++);
   // Correlation analysis
-  maker->AddAnalysis(anacorrjet,n++);
   maker->AddAnalysis(anacorrhadron,n++);
-  maker->AddAnalysis(anacorrhadronpi0,n++);
-  maker->AddAnalysis(anacorrisohadron,n++);
-  maker->AddAnalysis(anacorrhadronisopi0,n);
-
+  // Isolation analysis
+  maker->AddAnalysis(anaisol,n++);
+  // Correlation analysis with isolated triggers
+  maker->AddAnalysis(anacorrisohadron,n);
   maker->SetAnaDebug(-1)  ;
   maker->SwitchOnHistogramsMaker()  ;
   if(data.Contains("delta")) maker->SwitchOffAODsMaker()  ;
@@ -481,40 +511,41 @@ AliAnalysisTaskParticleCorrelationM *AddTaskPartCorrM(TString data, TString calo
   
   // Create task
   //===========================================================================
-  AliAnalysisTaskParticleCorrelationM * task = new AliAnalysisTaskParticleCorrelationM (Form("PartCorr%s",calorimeter.Data()));
+ // AliAnalysisTaskParticleCorrelationM * task = new AliAnalysisTaskParticleCorrelationM(Form("PartCorr%s",calorimeter.Data()));
+  AliAnalysisTaskParticleCorrelationM * task = new AliAnalysisTaskParticleCorrelationM("PartCorr");
   task->SetConfigFileName(""); //Don't configure the analysis via configuration file.
   //task->SetDebugLevel(-1);
-  //task->SelectCollisionCandidates();
   task->SetAnalysisMaker(maker);
   //if(!kSimulation)task->SelectCollisionCandidates(); //AliPhysicsSelection has to be attached before.
   mgr->AddTask(task);
   
-  //Create containers
-  char name[128];
-  sprintf(name,"PartCorr_%s",calorimeter.Data());
-  cout<<"Name of task "<<name<<endl;
+//  char name[128];
+//  sprintf(name,"PartCorr_%s",calorimeter.Data());
+//  cout<<"Name of task "<<name<<endl;
   //AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(Form(name),TList::Class(),
   //                                      AliAnalysisManager::kOutputContainer, Form("PartCorr_%s.root",calorimeter.Data()));
   
   TString outputfile = AliAnalysisManager::GetCommonFileName(); 
+  outputfile.ReplaceAll(".root","") ;
+  outputfile.Append("M.root") ;  
   //  AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(Form("PartCorr_%s",calorimeter.Data()),  TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:PartCorr_%s",outputfile.Data(),calorimeter.Data()));
-  AliAnalysisDataContainer *cout_pc   = mgr->CreateContainer(calorimeter.Data(), TList::Class(), 
-                                                                                                                        AliAnalysisManager::kOutputContainer, 
-                                                                                                                        Form("%s:PartCorr",outputfile.Data()));
-       
-  AliAnalysisDataContainer *cout_cuts = mgr->CreateContainer(Form("%sCuts",calorimeter.Data()), TList::Class(), 
-                                                                                                                        AliAnalysisManager::kParamContainer, 
-                                                                                                                        Form("%s:PartCorrCuts",outputfile.Data()));
-       
+  AliAnalysisDataContainer *cout_pc   = mgr->CreateContainer(calorimeter.Data(), TList::Class(),
+                                                             AliAnalysisManager::kOutputContainer,
+                                                             Form("%s:PartCorr",outputfile.Data()));
+  
+  AliAnalysisDataContainer *cout_cuts = mgr->CreateContainer(Form("%sCuts",calorimeter.Data()), TList::Class(),
+                                                             AliAnalysisManager::kParamContainer,
+                                                             Form("%s:PartCorrCuts",outputfile.Data()));
   // Create ONLY the output containers for the data produced by the task.
   // Get and connect other common input/output containers via the manager as below
   //==============================================================================
   mgr->ConnectInput  (task, 0, mgr->GetCommonInputContainer());
   // AOD output slot will be used in a different way in future
-  if(!data.Contains("delta") && outputAOD) mgr->ConnectOutput (task, 0, mgr->GetCommonOutputContainer());
+ //if(!data.Contains("delta")) mgr->ConnectOutput (task, 0, mgr->GetCommonOutputContainer());
+ // mgr->ConnectOutput (task, 0, mgr->GetCommonOutputContainer());
   mgr->ConnectOutput (task, 1, cout_pc);
-  mgr->ConnectOutput (task, 2, cout_cuts);
-
+  mgr->ConnectOutput (task, 2, cout_cuts);  
+  
   return task;
 }
 
index 8849e1b7c6d7768341286449419d470fda1bcd50..a6b4106853a437f815f596874e688466d3323eb6 100644 (file)
 //  Author : Gustavo Conesa Balbastre (INFN-LNF)
 //
 //-------------------------------------------------
-enum anaModes {mLocal, mLocalCAF,mPROOF,mGRID};
-//mLocal: Analyze locally files in your computer
-//mLocalCAF: Analyze locally CAF files
-//mPROOF: Analyze CAF files with PROOF
+enum anaModes {mLocal=0, mGRID=3};
+//mLocal    = 0: Analyze locally files in your computer
+//mGRID     = 3: Analyze files on GRID
 
 //---------------------------------------------------------------------------
 //Settings to read locally several files, only for "mLocal" mode
@@ -39,7 +38,8 @@ const char * kXSFileName = "pyxsec.root";
 const Bool_t kMC = kFALSE; //With real data kMC = kFALSE
 const TString kInputData = "ESD"; //ESD, AOD, MC, deltaAOD
 const Bool_t  outAOD = kFALSE; //Some tasks doesnt need it.
-TString kTreeName = "esdTree";
+TString kTreeName;
+const Bool_t kUsePAR = kFALSE; //set to kFALSE for libraries
 const Int_t kFilter = kFALSE; //Use ESD filter
 
 void ana(Int_t mode=mLocal)
@@ -51,9 +51,9 @@ void ana(Int_t mode=mLocal)
   // Look at the method below, 
   // change whatever you need for your analysis case
   // ------------------------------------------------------------------
-  LoadLibraries(mode) ;
+  LoadLibraries() ;
   // TGeoManager::Import("geometry.root") ; //need file "geometry.root" in local dir!!!!
-
+  
   //-------------------------------------------------------------------------------------------------
   //Create chain from ESD and from cross sections files, look below for options.
   //-------------------------------------------------------------------------------------------------
@@ -65,6 +65,8 @@ void ana(Int_t mode=mLocal)
     break;
   }
   
+  if(kFilter) outAOD = kTRUE;
+  
   TChain *chain       = new TChain(kTreeName) ;
   TChain * chainxs = new TChain("Xsection") ;
   CreateChain(mode, chain, chainxs);  
@@ -86,7 +88,7 @@ void ana(Int_t mode=mLocal)
       mcHandler->SetReadTR(kFALSE);//Do not search TrackRef file
       mgr->SetMCtruthEventHandler(mcHandler);
       if( kInputData == "MC") {
-       cout<<"INPUT EVENT HANDLER"<<endl;
+       cout<<"MC INPUT EVENT HANDLER"<<endl;
        mgr->SetInputEventHandler(NULL);
       }
     }
@@ -132,41 +134,50 @@ void ana(Int_t mode=mLocal)
        
        gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
        AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection();
+       
        if(kFilter){
+
+         // Set of cuts
+         //for standard global track cuts
+         AliESDtrackCuts* esdTrackCutsGlobal =  AliESDtrackCuts::GetStandardITSTPCTrackCuts2009(kTRUE);
+         esdTrackCutsGlobal->SetName("StandardFromAliESDTrackCuts");
+         
+         //for TPC tracks only
+         //    AliESDtrackCuts* esdTrackCutsTPC =  AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
+         //      esdTrackCutsTPC->SetRequireTPCRefit(kTRUE); 
+         //      esdTrackCutsTPC->SetMinNClustersTPC(70);
+         
+         AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter");
+         trackFilter->AddCuts(esdTrackCutsGlobal); 
+         //trackFilter->AddCuts(esdTrackCutsTPC); 
+         
          gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskESDFilter.C");
          AliAnalysisTaskESDfilter *taskesdfilter = AddTaskESDFilter(kFALSE);
+         esdfilter->SetTrackFilter(trackFilter);
+         kInputData = "AOD" ;
+         kTreeName = "aodTree" ;
        }
       }
     }
     
     gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskPartCorr.C");
-    TString data = kInputData;
-    if(kFilter && kInputData=="ESD" && outAOD) data = "AOD";
-    //data="MC";
-    AliAnalysisTaskParticleCorrelation *taskEMCAL = AddTaskPartCorr(data,"EMCAL", kFALSE,kFALSE, kFALSE);      
+   
+    AliAnalysisTaskParticleCorrelation *taskEMCAL = AddTaskPartCorr(kInputData,"EMCAL", kFALSE,kFALSE, kFALSE);        
     //mgr->ProfileTask("PartCorrEMCAL");
     
-    //AliAnalysisTaskParticleCorrelation *taskPHOS  = AddTaskPartCorr(data,"PHOS", kFALSE,kFALSE,kFALSE);
+    //AliAnalysisTaskParticleCorrelation *taskPHOS  = AddTaskPartCorr(kInputData,"PHOS", kFALSE,kFALSE,kFALSE);
     //mgr->ProfileTask("PartCorrPHOS");
     
-    //gROOT->LoadMacro("AddTaskCalorimeterQA.C");
-    gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/QA/AddTaskCalorimeterQA.C");
-    AliAnalysisTaskParticleCorrelation *taskQA = AddTaskCalorimeterQA(kInputData,kFALSE,kFALSE);
+    //gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/QA/AddTaskCalorimeterQA.C");
+    //AliAnalysisTaskParticleCorrelation *taskQA = AddTaskCalorimeterQA(kInputData,kFALSE,kFALSE);
     //mgr->ProfileTask("CalorimeterPerformance");      
     
     //-----------------------
     // Run the analysis
     //-----------------------    
-    TString smode = "";
-    if (mode==mLocal || mode == mLocalCAF) 
-      smode = "local";
-    else if (mode==mPROOF) 
-      smode = "proof";
-    else if (mode==mGRID) 
-      smode = "local";
     mgr->InitAnalysis();
     mgr->PrintStatus();
-    mgr->StartAnalysis(smode.Data(),chain);
+    mgr->StartAnalysis("local",chain);
 
     cout <<" Analysis ended sucessfully "<< endl ;
     
@@ -177,7 +188,7 @@ void ana(Int_t mode=mLocal)
   
 }
 
-void  LoadLibraries(const anaModes mode) {
+void  LoadLibraries() {
   
   //--------------------------------------
   // Load the needed libraries most of them already loaded by aliroot
@@ -188,10 +199,22 @@ void  LoadLibraries(const anaModes mode) {
   gSystem->Load("libXMLIO.so");
   gSystem->Load("libMatrix.so");
   gSystem->Load("libPhysics.so");
-  //----------------------------------------------------------
-  // >>>>>>>>>>> Local mode <<<<<<<<<<<<<< 
-  //----------------------------------------------------------
-  if (mode==mLocal || mode == mLocalCAF || mode == mGRID) {
+
+  if(kUsePAR){
+    //--------------------------------------------------------
+    //If you want to use root and par files from aliroot
+    //--------------------------------------------------------  
+    SetupPar("STEERBase");
+    SetupPar("ESD");
+    SetupPar("AOD");
+    SetupPar("ANALYSIS");
+    SetupPar("ANALYSISalice");
+    SetupPar("PHOSUtils");
+    SetupPar("EMCALUtils");
+    SetupPar("PWG4PartCorrBase");
+    SetupPar("PWG4PartCorrDep");
+  }
+  else{
     //--------------------------------------------------------
     // If you want to use already compiled libraries 
     // in the aliroot distribution
@@ -210,70 +233,7 @@ void  LoadLibraries(const anaModes mode) {
       gSystem->Load("libPWG3base.so");
       gSystem->Load("libPWG3muon.so");
     }
-
-    //--------------------------------------------------------
-    //If you want to use root and par files from aliroot
-    //--------------------------------------------------------  
-    /*
-     SetupPar("STEERBase");
-     SetupPar("ESD");
-     SetupPar("AOD");
-     SetupPar("ANALYSIS");
-     SetupPar("ANALYSISalice");
-     //If your analysis needs PHOS geometry uncomment following lines
-     SetupPar("PHOSUtils");
-     SetupPar("EMCALUtils");
-     //Create Geometry
-     SetupPar("PWG4PartCorrBase");
-     SetupPar("PWG4PartCorrDep");
-     if(kFilter){
-     gSystem->Load("libCORRFW.so");
-     gSystem->Load("libPWG3base.so");
-     gSystem->Load("libPWG3muon.so");
-    }
-    */
   }
-
-  //---------------------------------------------------------
-  // <<<<<<<<<< PROOF mode >>>>>>>>>>>>
-  //---------------------------------------------------------
-  else if (mode==mPROOF) {
-    //
-    // Connect to proof
-    // Put appropriate username here
-    // TProof::Reset("proof://mgheata@lxb6046.cern.ch"); 
-    TProof::Open("proof://mgheata@lxb6046.cern.ch");
-    
-    //    gProof->ClearPackages();
-    //    gProof->ClearPackage("ESD");
-    //    gProof->ClearPackage("AOD");
-    //    gProof->ClearPackage("ANALYSIS");   
-    //    gProof->ClearPackage("PWG4PartCorrBase");
-    //    gProof->ClearPackage("PWG4PartCorrDep");
-    
-    // Enable the STEERBase Package
-    gProof->UploadPackage("STEERBase.par");
-    gProof->EnablePackage("STEERBase");
-    // Enable the ESD Package
-    gProof->UploadPackage("ESD.par");
-    gProof->EnablePackage("ESD");
-    // Enable the AOD Package
-    gProof->UploadPackage("AOD.par");
-    gProof->EnablePackage("AOD");
-    // Enable the Analysis Package
-    gProof->UploadPackage("ANALYSIS.par");
-    gProof->EnablePackage("ANALYSIS");
-       // Enable the PHOS geometry Package
-    //gProof->UploadPackage("PHOSUtils.par");
-    //gProof->EnablePackage("PHOSUtils");
-    // Enable PartCorr analysis
-    gProof->UploadPackage("PWG4PartCorrBase.par");
-    gProof->EnablePackage("PWG4PartCorrBase");
-    gProof->UploadPackage("PWG4PartCorrDep.par");
-    gProof->EnablePackage("PWG4PartCorrDep");    
-    gProof->ShowEnabledPackages();
-  }  
-  
 }
 
 void SetupPar(char* pararchivename)
@@ -284,14 +244,14 @@ void SetupPar(char* pararchivename)
  
   TString cdir(Form("%s", gSystem->WorkingDirectory() )) ; 
   TString parpar(Form("%s.par", pararchivename)) ; 
-  if ( gSystem->AccessPathName(parpar.Data()) ) {
-    gSystem->ChangeDirectory(gSystem->Getenv("ALICE_ROOT")) ;
-    TString processline(Form(".! make %s", parpar.Data())) ; 
-    gROOT->ProcessLine(processline.Data()) ;
-    gSystem->ChangeDirectory(cdir) ; 
-    processline = Form(".! mv $ALICE_ROOT/%s .", parpar.Data()) ;
-    gROOT->ProcessLine(processline.Data()) ;
-  } 
+//  if ( gSystem->AccessPathName(parpar.Data()) ) {
+//    gSystem->ChangeDirectory(gSystem->Getenv("ALICE_ROOT")) ;
+//     TString processline(Form(".! make %s", parpar.Data())) ; 
+//     gROOT->ProcessLine(processline.Data()) ;
+//     gSystem->ChangeDirectory(cdir) ; 
+//     processline = Form(".! mv $ALICE_ROOT/%s .", parpar.Data()) ;
+//     gROOT->ProcessLine(processline.Data()) ;
+//   } 
   if ( gSystem->AccessPathName(pararchivename) ) {  
     TString processline = Form(".! tar xvzf %s",parpar.Data()) ;
     gROOT->ProcessLine(processline.Data());
@@ -331,20 +291,10 @@ void CreateChain(const anaModes mode, TChain * chain, TChain * chainxs){
   //Fills chain with data
   TString ocwd = gSystem->WorkingDirectory();
   
-  //-----------------------------------------------------------
-  //Analysis of CAF data locally and with PROOF
-  //-----------------------------------------------------------
-  if(mode ==mPROOF || mode ==mLocalCAF){
-    // Chain from CAF
-    gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C");
-    // The second parameter is the number of input files in the chain
-    chain = CreateESDChain("ESD12001.txt", 5);  
-  }
-  
   //---------------------------------------
   //Local files analysis
   //---------------------------------------
-  else if(mode == mLocal){    
+  if(mode == mLocal){    
     //If you want to add several ESD files sitting in a common directory INDIR
     //Specify as environmental variables the directory (INDIR), the number of files 
     //to analyze (NFILES) and the pattern name of the directories with files (PATTERN)
index d4fecb669adba4a1c6f47391c96d0e0f6c3bed5b..d2f626f2d12739b875b37b1bedc7d4e939b7a0ca 100644 (file)
@@ -1,57 +1,45 @@
 /* $Id$ */
-//--------------------------------------------------
-// Example macro to do analysis with the 
-// analysis classes in PWG4PartCorr
-// Can be executed with Root and AliRoot
-//
-// Pay attention to the options and definitions
-// set in the lines below
-//
-//  Author : Gustavo Conesa Balbastre (INFN-LNF)
-//
 //-------------------------------------------------
-enum anaModes {mLocal, mLocalCAF,mPROOF,mGRID};
-//mLocal: Analyze locally files in your computer
-//mLocalCAF: Analyze locally CAF files
-//mPROOF: Analyze CAF files with PROOF
+enum anaModes {mLocal, mGRID};
+//mLocal    = 0: Analyze locally files in your computer
+//mGRID     = 3: Analyze files on GRID
 
 //---------------------------------------------------------------------------
 //Settings to read locally several files, only for "mLocal" mode
 //The different values are default, they can be set with environmental 
-//variables: INDIR, PATTERN, NFILES, respectivelly
-//char * kInDir = "/Users/Gustavo/Work/mixed/data"; 
-char * kPattern = ""; // Data are in files kInDir/kPattern+i 
+//variables: INDIR, PATTERN, NFILES, respectively
+char * kInDir = "/Users/ymao/group/ana/7TeV/corr";
+char * kPattern = ""; // Data are in files kInDir/kPattern+i
 Int_t kFile = 1; // Number of files
 //---------------------------------------------------------------------------
 //Collection file for grid analysis
 char * kXML = "collection.xml";
-//---------------------------------------------------------------------------
-//Scale histograms from file. Change to kTRUE when xsection file exists
-//Put name of file containing xsection 
-//Put number of events per ESD file
-//This is an specific case for normalization of Pythia files.
-const Bool_t kGetXSectionFromFileAndScale = kFALSE ;
-const char * kXSFileName = "pyxsec.root";
+
 //---------------------------------------------------------------------------
 
 const Bool_t kMC = kFALSE; //With real data kMC = kFALSE
-const TString kInputData = "AOD"; //ESD, AOD, MC
+TString kInputData = "ESD";//ESD, AOD, MC
 TString kTreeName ;
+const TString calorimeter = "EMCAL" ;
+const Bool_t kUsePAR = kFALSE; //set to kFALSE for libraries
+//const Bool_t kUsePAR = kTRUE; //set to kFALSE for libraries
+const Bool_t kDoESDFilter = kFALSE;  //filter the tracks from the esd
+
+Int_t mode = mGRID;
 
-void anaM(Int_t mode=mLocal)
+void anaM()
 {
   // Main
-
   //--------------------------------------------------------------------
   // Load analysis libraries
   // Look at the method below, 
   // change whatever you need for your analysis case
   // ------------------------------------------------------------------
-  LoadLibraries(mode) ;
+  LoadLibraries() ;
   
   //-------------------------------------------------------------------------------------------------
   //Create chain from ESD and from cross sections files, look below for options.
-  //-------------------------------------------------------------------------------------------------
+  //------------------------------------------------------------------------------------------------- 
   if(kInputData == "ESD") kTreeName = "esdTree" ;
   else if(kInputData == "AOD") kTreeName = "aodTree" ;
   else if (kInputData == "MC") kTreeName = "TE" ;
@@ -59,12 +47,13 @@ void anaM(Int_t mode=mLocal)
     cout<<"Wrong  data type "<<kInputData<<endl;
     break;
   }
-
-  TChain *chain       = new TChain(kTreeName) ;
-  TChain * chainxs = new TChain("Xsection") ;
-  CreateChain(mode, chain, chainxs);  
-
-  if(chain){
+  
+  TChain * chain   = new TChain(kTreeName) ;
+  
+       CreateChain(mode, chain);//, chainxs);  
+  cout<<"Chain created"<<endl;
+  
+  if( chain ){
     AliLog::SetGlobalLogLevel(AliLog::kError);//Minimum prints on screen
     
     //--------------------------------------
@@ -72,24 +61,23 @@ void anaM(Int_t mode=mLocal)
     //-------------------------------------
     AliAnalysisManager *mgr  = new AliAnalysisManager("Manager", "Manager");
     // MC handler
-    if((kMC || kInputData == "MC") && kInputData!="AOD"){
+    if( (kMC && (kInputData == "ESD")) || kInputData == "MC"){
       AliMCEventHandler* mcHandler = new AliMCEventHandler();
       mcHandler->SetReadTR(kFALSE);//Do not search TrackRef file
       mgr->SetMCtruthEventHandler(mcHandler);
-         if( kInputData == "MC") mgr->SetInputEventHandler(NULL);
+      if( kInputData == "MC") mgr->SetInputEventHandler(NULL);
     }
-
-    // AOD output handler
-//      AliAODHandler* aodoutHandler   = new AliAODHandler();
-//     aodoutHandler->SetOutputFileName("aod.root");
-//     ////aodoutHandler->SetCreateNonStandardAOD();
-//     mgr->SetOutputEventHandler(aodoutHandler);
+    
+//    // AOD output handler
+//    AliAODHandler* aodoutHandler   = new AliAODHandler();
+//    aodoutHandler->SetOutputFileName("AliAOD.root");
+//    mgr->SetOutputEventHandler(aodoutHandler);
     
     //input
     Int_t maxiterations = 1;
     AliEventPoolLoop* pool = new AliEventPoolLoop(maxiterations);
     pool->SetChain(chain);
-    Int_t eventsInPool = 2;
+    Int_t eventsInPool = 10;
     AliMultiEventInputHandler *inpHandler = NULL ; 
     if(kInputData == "ESD"){
       // ESD handler
@@ -104,59 +92,53 @@ void anaM(Int_t mode=mLocal)
     cout<<"Input handler "<<mgr->GetInputEventHandler()<<endl;
     mgr->SetEventPool(pool);
     inpHandler->SetEventPool(pool);
-
-      //mgr->SetDebugLevel(10); // For debugging, do not uncomment if you want no messages.
-
+    
+    //mgr->SetDebugLevel(-1); // For debugging, do not uncomment if you want no messages.
+    
+    // select triigger events for physics run
+    
+//    if(!kMC){
+//      gROOT->LoadMacro("AddTaskPhysicsSelection.C");
+//      AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection();
+//      mgr->AddTask(physSelTask);    
+//    }
+    
     //-------------------------------------------------------------------------
     //Define task, put here any other task that you want to use.
     //-------------------------------------------------------------------------
-    //    AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
-    // AliAnalysisDataContainer *coutput1 = mgr->GetCommonOutputContainer();
-
-    //gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskESDFilter.C");
-    //AliAnalysisTaskESDfilter *taskesdfilter = AddTaskESDFilter(kTRUE);
-
+    
+    //correlation analysis
     gROOT->LoadMacro("AddTaskPartCorrM.C");
-   
-    AliAnalysisTaskParticleCorrelationM *taskEMCAL = AddTaskPartCorrM(kInputData,"EMCAL", kFALSE,kFALSE,kFALSE,kTRUE); 
-    mgr->AddTask(taskEMCAL);
-    AliAnalysisTaskParticleCorrelationM *taskPHOS  = AddTaskPartCorrM(kInputData,"PHOS", kFALSE, kFALSE);
-    mgr->AddTask(taskPHOS);
-
-    //gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskCalorimeterQA.C");
-    //gROOT->LoadMacro("AddTaskCalorimeterQA.C");
-    //AliAnalysisTaskParticleCorrelation *taskQA = AddTaskCalorimeterQA(kInputData,kFALSE,kTRUE);
-
-    //gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskomega3pi.C");
-    //AliAnalysisTaskOmegaPi0PiPi * taskomega = AddTaskomega3pi();
-    //mgr->AddTask(taskomega);
-
+    
+    AliAnalysisTaskParticleCorrelationM *taskEMCAL = AddTaskPartCorrM(kInputData,"EMCAL",kFALSE);
 
+    mgr->AddTask(taskEMCAL);
+    
+    AliAnalysisTaskParticleCorrelationM *taskPHOS  = AddTaskPartCorrM(kInputData,"PHOS", kFALSE);
 
-    //-----------------------
+    mgr->AddTask(taskPHOS);
+    
+    //gROOT->LoadMacro("AddTaskChargeCorr.C");
+    AliAnalysisTaskParticleCorrelationM *taskCharge  = AddTaskPartCorrM(kInputData, "CTS",kFALSE);
+//    if(!kMC)
+//      taskCharge->SelectCollisionCandidates();
+    mgr->AddTask(taskCharge);
+    
+     //-----------------------
     // Run the analysis
     //-----------------------    
-    TString smode = "";
-    if (mode==mLocal || mode == mLocalCAF) 
-      smode = "mix";
-    else if (mode==mPROOF) 
-      smode = "proof";
-    else if (mode==mGRID) 
-      smode = "mix";
-    
+    //mgr->ResetAnalysis();
     mgr->InitAnalysis();
     mgr->PrintStatus();
-    mgr->StartAnalysis(smode.Data(),chain,1000);
-
-cout <<" Analysis ended sucessfully "<< endl ;
-
+    mgr->StartAnalysis("mix",chain);
+    
+    cout <<" Analysis ended sucessfully "<< endl ;
   }
   else cout << "Chain was not produced ! "<<endl;
   
 }
 
-void  LoadLibraries(const anaModes mode) {
-  
+void  LoadLibraries() {
   //--------------------------------------
   // Load the needed libraries most of them already loaded by aliroot
   //--------------------------------------
@@ -164,97 +146,36 @@ void  LoadLibraries(const anaModes mode) {
   gSystem->Load("libGeom.so");
   gSystem->Load("libVMC.so");
   gSystem->Load("libXMLIO.so");
-  gSystem->Load("libMatrix.so");
-  gSystem->Load("libPhysics.so");
-
-  //----------------------------------------------------------
-  // >>>>>>>>>>> Local mode <<<<<<<<<<<<<< 
-  //----------------------------------------------------------
-  if (mode==mLocal || mode == mLocalCAF || mode == mGRID) {
+  if(kUsePAR){
+    //--------------------------------------------------------
+    //If you want to use root and par files from aliroot
+    //--------------------------------------------------------  
+    SetupPar("STEERBase");
+    SetupPar("ESD");
+    SetupPar("AOD");
+    SetupPar("ANALYSIS");
+    SetupPar("ANALYSISalice");
+    SetupPar("PHOSUtils");
+    SetupPar("EMCALUtils");
+    
+    SetupPar("PWG4PartCorrBase");
+    SetupPar("PWG4PartCorrDep");
+  }
+  else{
     //--------------------------------------------------------
     // If you want to use already compiled libraries 
     // in the aliroot distribution
     //--------------------------------------------------------
-    //gSystem->Load("/Users/Gustavo/Work/analysis/STEERBase/libSTEERBase.so");
-    //gSystem->Load("/Users/Gustavo/Work/analysis/ESD/libESD.so");
-    //gSystem->Load("/Users/Gustavo/Work/analysis/AOD/libAOD.so");
-    //gSystem->Load("/Users/Gustavo/Work/analysis/ANALYSIS/libANALYSIS.so");
-    //gSystem->Load("/Users/Gustavo/Work/analysis/ANALYSISalice/libANALYSISalice.so");
-    //gSystem->Load("libPHOSUtils");
-    //gSystem->Load("/Users/Gustavo/Work/analysis/PWG4PartCorrBase/libPWG4PartCorrBase.so");
-    //gSystem->Load("/Users/Gustavo/Work/analysis/PWG4PartCorrDep/libPWG4PartCorrDep.so");
-       
-    gSystem->Load("libSTEERBase.so");
-    gSystem->Load("libESD.so");
-    gSystem->Load("libAOD.so");
-    gSystem->Load("libANALYSIS.so");
-    gSystem->Load("libANALYSISalice.so");
-    gSystem->Load("libPHOSUtils");
-    gSystem->Load("libEMCALUtils");
-    gSystem->Load("libPWG4PartCorrBase.so");
-    gSystem->Load("libPWG4PartCorrDep.so");
-//     gSystem->Load("libPWG4omega3pi.so");
-//     gSystem->Load("libCORRFW.so");
-//     gSystem->Load("libPWG3base.so");
-//     gSystem->Load("libPWG3muon.so");
-    //--------------------------------------------------------
-    //If you want to use root and par files from aliroot
-    //--------------------------------------------------------  
-//     SetupPar("STEERBase");
-//     SetupPar("ESD");
-//     SetupPar("AOD");
-//     SetupPar("ANALYSIS");
-//     SetupPar("ANALYSISalice");
-//     //If your analysis needs PHOS geometry uncomment following lines
-//     SetupPar("PHOSUtils");
-//     SetupPar("EMCALUtils");
-//     //      //Create Geometry
-//     //    TGeoManager::Import("geometry.root") ; //need file "geometry.root" in local dir!!!!
-//     SetupPar("PWG4PartCorrBase");
-//     SetupPar("PWG4PartCorrDep");
-//     //SetupPar("PWG4omega3pi");
+    gSystem->Load("libSTEERBase");
+    gSystem->Load("libESD");
+    gSystem->Load("libAOD");
+    gSystem->Load("libANALYSIS");
+    gSystem->Load("libANALYSISalice");
+         gSystem->Load("libPHOSUtils");
+         gSystem->Load("libEMCALUtils");
+    gSystem->Load("libPWG4PartCorrBase");
+    gSystem->Load("libPWG4PartCorrDep");
   }
-
-  //---------------------------------------------------------
-  // <<<<<<<<<< PROOF mode >>>>>>>>>>>>
-  //---------------------------------------------------------
-  else if (mode==mPROOF) {
-    //
-    // Connect to proof
-    // Put appropriate username here
-    // TProof::Reset("proof://mgheata@lxb6046.cern.ch"); 
-    TProof::Open("proof://mgheata@lxb6046.cern.ch");
-    
-    //    gProof->ClearPackages();
-    //    gProof->ClearPackage("ESD");
-    //    gProof->ClearPackage("AOD");
-    //    gProof->ClearPackage("ANALYSIS");   
-    //    gProof->ClearPackage("PWG4PartCorrBase");
-    //    gProof->ClearPackage("PWG4PartCorrDep");
-    
-    // Enable the STEERBase Package
-    gProof->UploadPackage("STEERBase.par");
-    gProof->EnablePackage("STEERBase");
-    // Enable the ESD Package
-    gProof->UploadPackage("ESD.par");
-    gProof->EnablePackage("ESD");
-    // Enable the AOD Package
-    gProof->UploadPackage("AOD.par");
-    gProof->EnablePackage("AOD");
-    // Enable the Analysis Package
-    gProof->UploadPackage("ANALYSIS.par");
-    gProof->EnablePackage("ANALYSIS");
-    // Enable the PHOS geometry Package
-    //gProof->UploadPackage("PHOSUtils.par");
-    //gProof->EnablePackage("PHOSUtils");
-    // Enable PartCorr analysis
-    gProof->UploadPackage("PWG4PartCorrBase.par");
-    gProof->EnablePackage("PWG4PartCorrBase");
-    gProof->UploadPackage("PWG4PartCorrDep.par");
-    gProof->EnablePackage("PWG4PartCorrDep");    
-    gProof->ShowEnabledPackages();
-  }  
   
 }
 
@@ -263,17 +184,9 @@ void SetupPar(char* pararchivename)
   //Load par files, create analysis libraries
   //For testing, if par file already decompressed and modified
   //classes then do not decompress.
+  
   TString cdir(Form("%s", gSystem->WorkingDirectory() )) ; 
   TString parpar(Form("%s.par", pararchivename)) ; 
-  if ( gSystem->AccessPathName(parpar.Data()) ) {
-    gSystem->ChangeDirectory(gSystem->Getenv("ALICE_ROOT")) ;
-    TString processline(Form(".! make %s", parpar.Data())) ; 
-    gROOT->ProcessLine(processline.Data()) ;
-    gSystem->ChangeDirectory(cdir) ; 
-    processline = Form(".! mv $ALICE_ROOT/%s .", parpar.Data()) ;
-    gROOT->ProcessLine(processline.Data()) ;
-  } 
   if ( gSystem->AccessPathName(pararchivename) ) {  
     TString processline = Form(".! tar xvzf %s",parpar.Data()) ;
     gROOT->ProcessLine(processline.Data());
@@ -309,126 +222,56 @@ void SetupPar(char* pararchivename)
 
 
 
-void CreateChain(const anaModes mode, TChain * chain, TChain * chainxs){
+void CreateChain(const anaModes mode, TChain * chain){//, TChain * chainxs){
   //Fills chain with data
-  TString ocwd = gSystem->WorkingDirectory();
   
-  //-----------------------------------------------------------
-  //Analysis of CAF data locally and with PROOF
-  //-----------------------------------------------------------
-  if(mode ==mPROOF || mode ==mLocalCAF){
-    // Chain from CAF
-    gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C");
-    // The second parameter is the number of input files in the chain
-    chain = CreateESDChain("ESD12001.txt", 5);  
-  }
+  TString datafileName="";
+  if(kInputData == "ESD") datafileName = "AliESDs.root" ;
+  else if(kInputData == "AOD") datafileName = "AliAOD.root" ;
+  else if(kInputData == "MC")  datafileName = "galice.root" ;
+  
+  TString ocwd = gSystem->WorkingDirectory();
   
   //---------------------------------------
   //Local files analysis
   //---------------------------------------
-  else if(mode == mLocal){    
+  if(mode == mLocal){
     //If you want to add several ESD files sitting in a common directory INDIR
     //Specify as environmental variables the directory (INDIR), the number of files 
     //to analyze (NFILES) and the pattern name of the directories with files (PATTERN)
-
-    if(gSystem->Getenv("INDIR"))  
-      kInDir = gSystem->Getenv("INDIR") ; 
-    else cout<<"INDIR not set, use default: "<<kInDir<<endl;   
     
-    if(gSystem->Getenv("PATTERN"))   
-      kPattern = gSystem->Getenv("PATTERN") ; 
-    else  cout<<"PATTERN not set, use default: "<<kPattern<<endl;
+    cout<<"INDIR : "<<kInDir<<endl;
+    cout<<"NFILES : "<<kFile<<endl;
+    cout<<"PATTERN: " <<kPattern<<endl;
     
-    if(gSystem->Getenv("NFILES"))
-      kFile = atoi(gSystem->Getenv("NFILES")) ;
-    else cout<<"NFILES not set, use default: "<<kFile<<endl;
     
-    //Check if env variables are set and are correct
-    if ( kInDir  && kFile) {
-      printf("Get %d files from directory %s\n",kFile,kInDir);
-      if ( ! gSystem->cd(kInDir) ) {//check if ESDs directory exist
-       printf("%s does not exist\n", kInDir) ;
-       return ;
-      }
-
-      //if(gSystem->Getenv("XSFILE"))  
-      //kXSFileName = gSystem->Getenv("XSFILE") ; 
-      //else cout<<" XS file name not set, use default: "<<kXSFileName<<endl;  
-      char * kGener = gSystem->Getenv("GENER");
-      if(kGener) {
-       cout<<"GENER "<<kGener<<endl;
-       if(!strcmp(kGener,"PYTHIA")) kXSFileName = "pyxsec.root";
-       else if(!strcmp(kGener,"HERWIG")) kXSFileName = "hexsec.root";
-       else cout<<" UNKNOWN GENER, use default: "<<kXSFileName<<endl;
-      }
-      else cout<<" GENER not set, use default xs file name: "<<kXSFileName<<endl;
-
-      cout<<"INDIR   : "<<kInDir<<endl;
-      cout<<"NFILES  : "<<kFile<<endl;
-      cout<<"PATTERN : " <<kPattern<<endl;
-      cout<<"XSFILE  : "<<kXSFileName<<endl;
-
-      TString datafile="";
-      if(kInputData == "ESD") datafile = "AliESDs.root" ;
-      else if(kInputData == "AOD") datafile = "AliAOD.root" ;
-      else if(kInputData == "MC")  datafile = "galice.root" ;
-      
-      //Loop on ESD files, add them to chain
-      Int_t event =0;
-      Int_t skipped=0 ; 
-      char file[120] ;
-      char filexs[120] ;
-      
-      for (event = 0 ; event < kFile ; event++) {
-       sprintf(file, "%s/%s%d/%s", kInDir,kPattern,event,datafile.Data()) ; 
-       sprintf(filexs, "%s/%s%d/%s", kInDir,kPattern,event,kXSFileName) ; 
-       TFile * fESD = 0 ; 
-       //Check if file exists and add it, if not skip it
-       if ( fESD = TFile::Open(file)) {
-         if ( fESD->Get(kTreeName) ) { 
-           printf("++++ Adding %s\n", file) ;
-           chain->AddFile(file);
-           chainxs->Add(filexs) ; 
-         }
-       }
-       else { 
-         printf("---- Skipping %s\n", file) ;
-         skipped++ ;
-       }
+    //Loop on ESD files, add them to chain
+    TString FileName ;      
+    for (Int_t iFile = 0 ; iFile < kFile ; iFile++) {
+      FileName = Form("%s/%s%d/%s", kInDir,kPattern,iFile,datafileName.Data()) ; 
+      //cout << "FileName: " << FileName <<endl ;
+      TFile * dataFile = 0 ; 
+      //Check if file exists and add it, if not skip it
+      if ( dataFile = TFile::Open(FileName.Data())) {
+        if ( dataFile->Get(kTreeName) ) { 
+          Int_t nEventsPerFile = ((TTree*) dataFile->Get(kTreeName)) ->GetEntries();
+          printf(" ++++ Adding %s, with %d events \n", FileName.Data(), nEventsPerFile) ;
+          chain->AddFile(FileName);
+        }
       }
-      printf("number of entries # %lld, skipped %d\n", chain->GetEntries(), skipped*100) ;     
-    }
-    else {
-      TString input = "AliESDs.root" ;
-      cout<<">>>>>> No list added, take a single file <<<<<<<<< "<<input<<endl;
-      chain->AddFile(input);
-    }
-    
+    }    
+    printf("number of entries # %lld \n", chain->GetEntries()) ;       
   }// local files analysis
   
   //------------------------------
   //GRID xml files
   //-----------------------------
   else if(mode == mGRID){
-    //Get colection file. It is specified by the environmental
-    //variable XML
-
-    if(gSystem->Getenv("XML") )
-      kXML = gSystem->Getenv("XML");
-    else
-      sprintf(kXML, "collection.xml") ; 
-    
-    if (!TFile::Open(kXML)) {
-      printf("No collection file with name -- %s -- was found\n",kXML);
-      return ;
-    }
-    else cout<<"XML file "<<kXML<<endl;
-
     //Load necessary libraries and connect to the GRID
     gSystem->Load("libNetx.so") ; 
     gSystem->Load("libRAliEn.so"); 
     TGrid::Connect("alien://") ;
-
+    
     //Feed Grid with collection file
     //TGridCollection * collection =  (TGridCollection*)gROOT->ProcessLine(Form("TAlienCollection::Open(\"%s\", 0)", kXML));
     TGridCollection * collection = (TGridCollection*) TAlienCollection::Open(kXML);
@@ -437,61 +280,17 @@ void CreateChain(const anaModes mode, TChain * chain, TChain * chainxs){
       return kFALSE ; 
     }
     TGridResult* result = collection->GetGridResult("",0 ,0);
-   
+    
     // Makes the ESD chain 
     printf("*** Getting the Chain       ***\n");
+    Int_t nEventsPerFile = 0;
     for (Int_t index = 0; index < result->GetEntries(); index++) {
       TString alienURL = result->GetKey(index, "turl") ; 
       cout << "================== " << alienURL << endl ; 
       chain->Add(alienURL) ; 
-      alienURL.ReplaceAll("AliESDs.root",kXSFileName);
-      chainxs->Add(alienURL) ; 
+      
     }
   }// xml analysis
   
   gSystem->ChangeDirectory(ocwd.Data());
 }
-
-//________________________________________________
-void GetAverageXsection(TTree * tree, Double_t & xs, Float_t & ntr)
-{
-  // Read the PYTHIA statistics from the file pyxsec.root created by
-  // the function WriteXsection():
-  // integrated cross section (xsection) and
-  // the  number of Pyevent() calls (ntrials)
-  // and calculate the weight per one event xsection/ntrials
-  // The spectrum calculated by a user should be
-  // multiplied by this weight, something like this:
-  // TH1F *userSpectrum ... // book and fill the spectrum
-  // userSpectrum->Scale(weight)
-  //
-  // Yuri Kharlov 19 June 2007
-  // Gustavo Conesa 15 April 2008
-  Double_t xsection = 0;
-  UInt_t    ntrials = 0;
-  xs = 0;
-  ntr = 0;
-  
-  Int_t nfiles =  tree->GetEntries()  ;
-  if (tree && nfiles > 0) {
-    tree->SetBranchAddress("xsection",&xsection);
-    tree->SetBranchAddress("ntrials",&ntrials);
-    for(Int_t i = 0; i < nfiles; i++){
-      tree->GetEntry(i);
-      xs += xsection ;
-      ntr += ntrials ;
-      cout << "xsection " <<xsection<<" ntrials "<<ntrials<<endl; 
-    }
-    
-    xs =   xs /  nfiles;
-    ntr =  ntr / nfiles;
-    cout << "-----------------------------------------------------------------"<<endl;
-    cout << "Average of "<< nfiles<<" files: xsection " <<xs<<" ntrials "<<ntr<<endl; 
-    cout << "-----------------------------------------------------------------"<<endl;
-  } 
-  else cout << " >>>> Empty tree !!!! <<<<< "<<endl;
-  
-}
-
-
-