Merge branch 'master' of https://git.cern.ch/reps/AliRoot
authorjbook <jbook>
Mon, 13 Jan 2014 13:54:56 +0000 (14:54 +0100)
committerjbook <jbook@cern.ch>
Mon, 13 Jan 2014 13:54:56 +0000 (14:54 +0100)
99 files changed:
ANALYSIS/AliAnalysisTaskPIDResponse.h
ANALYSIS/TenderSupplies/AliTOFTenderSupply.cxx
ANALYSIS/TenderSupplies/AliTOFTenderSupply.h
DPMJET/dpmjet3.0-5.f
DPMJET/dpmjet3.0-5F.f
EVE/CMakelibEveBase.pkg
EVE/CMakelibEveDet.pkg
EVE/CMakelibEveHLT.pkg
ITS/AliITSQASDDChecker.cxx
PWG/EMCAL/AliEmcalAodTrackFilterTask.cxx
PWG/EMCAL/AliEmcalEsdTrackFilterTask.cxx
PWG/EMCAL/AliEmcalPicoTrackMaker.cxx
PWG/EMCAL/AliEmcalSetupTask.cxx
PWG/EMCAL/data/2010.dat
PWG/EMCAL/data/2011.dat
PWG/EMCAL/data/2012.dat
PWG/EMCAL/data/2013.dat
PWG/muon/AliAnalysisMuMuCutCombination.cxx
PWG/muondep/AliAnalysisMuMu.cxx
PWG/muondep/AliAnalysisMuMuFnorm.cxx
PWG/muondep/AliAnalysisMuMuResult.cxx
PWGCF/Correlations/DPhi/AliDptDptInMC.cxx
PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoModelCorrFctnDEtaDPhi.cxx
PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoShareQualityPairCut.cxx
PWGCF/FEMTOSCOPY/Chaoticity/AliChaoticity.cxx
PWGCF/FEMTOSCOPY/Chaoticity/AliChaoticity.h
PWGCF/FEMTOSCOPY/macros/Train/KchKch_purity_test/AddTaskFemtoKchHBT0010.C
PWGCF/FEMTOSCOPY/macros/Train/KchKch_purity_test/AddTaskFemtoKchHBT1090.C
PWGCF/FEMTOSCOPY/macros/Train/KchKch_purity_test/PbPb2011/0010/ConfigFemtoAnalysis.C
PWGCF/FLOW/macros/AddTaskFlowCentralityPIDSP.C
PWGCF/FLOW/macros/AddTaskPidVZEROSP.C
PWGCF/FLOW/macros/AddTaskPidVZEROSP_2.C
PWGHF/CMakelibPWGHFcorrelationHF.pkg
PWGHF/CMakelibPWGHFhfe.pkg
PWGHF/PWGHFhfeLinkDef.h
PWGHF/correlationHF/AliAnalysisTaskSEmcCorr.cxx [new file with mode: 0644]
PWGHF/correlationHF/AliAnalysisTaskSEmcCorr.h [new file with mode: 0644]
PWGHF/correlationHF/macros/AddTaskSEmcCorr.C [new file with mode: 0755]
PWGHF/hfe/AliAnalysisTaskFlowITSTPCTOFQCSP.cxx [new file with mode: 0755]
PWGHF/hfe/AliAnalysisTaskFlowITSTPCTOFQCSP.h [new file with mode: 0755]
PWGHF/hfe/AliAnalysisTaskFlowTPCTOFQCSP.cxx [deleted file]
PWGHF/hfe/AliAnalysisTaskFlowTPCTOFQCSP.h [deleted file]
PWGHF/hfe/macros/AddTaskFlowITSTPCTOFQCSP.C [moved from PWGHF/hfe/macros/AddTaskFlowTPCTOFQCSP.C with 62% similarity, mode: 0755]
PWGJE/AliAnalysisTaskFragmentationFunction.cxx
PWGJE/AliAnalysisTaskFragmentationFunction.h
PWGJE/AliAnalysisTaskJetCorePP.cxx
PWGJE/AliAnalysisTaskJetCorePP.h
PWGJE/AliFragmentationFunctionCorrections.cxx
PWGJE/AliFragmentationFunctionCorrections.h
PWGJE/CMakelibPWGJEEMCALJetTasks.pkg
PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskChargedJetsPA.cxx
PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskEmcalDiJetBase.h
PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskHJetDphi.cxx [new file with mode: 0644]
PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskHJetDphi.h [new file with mode: 0644]
PWGJE/EMCALJetTasks/macros/AddTaskEmcalDiJetResponse.C
PWGJE/EMCALJetTasks/macros/AddTaskHJetDphi.C [new file with mode: 0644]
PWGJE/PWGJEEMCALJetTasksLinkDef.h
PWGJE/UserTasks/AliAnalysisTaskIDFragmentationFunction.cxx
PWGJE/UserTasks/AliAnalysisTaskPID.cxx
PWGJE/UserTasks/AliAnalysisTaskPID.h
PWGJE/macros/AddTaskJetCorePP.C
PWGLF/FORWARD/analysis2/AliForwardMCFlowTaskQC.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliAnalysisTaskSpectraAllChAOD.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliAnalysisTaskSpectraAllChAOD.h
PWGPP/AliTaskCDBconnect.cxx
PWGPP/AliTaskCDBconnect.h
PWGPP/CMakelibPWGPP.pkg
PWGPP/CMakelibPWGPPMUONdep.pkg
PWGPP/CMakelibPWGPPMUONlite.pkg
PWGPP/CMakelibPWGPPpid.pkg
PWGPP/ITS/AliMeanVertexPreprocessorOffline.h
PWGPP/pid/doeffAllSpecies.C
PWGPP/pid/doeffKa.C
PWGPP/pid/doeffPi.C
PWGPP/pid/doeffPr.C
STARLIGHT/starlight/TStarLight/TStarLight.h
STEER/AOD/AliAODExtension.cxx
STEER/CreateAODfromESD.C
STEER/STEERBase/AliPIDResponse.cxx
test/PbPbbench/aod.C
test/PbPbbench/recraw/aod.C
test/genkine/sim/aod.C
test/gun/aod.C
test/gun/recraw/aod.C
test/merge/backgr/Config.C
test/merge/backgr/aod.C [new file with mode: 0644]
test/merge/backgr/sim.C
test/merge/runtest.sh
test/merge/signal/Config.C
test/merge/signal/aod.C [new file with mode: 0644]
test/merge/signal/sim.C
test/pileup/Config.C
test/pileup/aod.C
test/pileup/check.C
test/pileup/runtest.sh
test/pileup/sim.C
test/ppbench/aod.C
test/ppbench/recraw/aod.C
test/pploadlibs/aod.C

index 7684c0a..1edac67 100644 (file)
@@ -43,6 +43,7 @@ public:
   void SetOADBPath(const char* path) {fOADBPath=path;}
   const char* GetOADBPath() const { return fOADBPath.Data(); }
   void SetTuneOnData(Bool_t flag,Int_t recopass){fIsTunedOnData=flag;fRecoPassTuned=recopass;};
+  Bool_t GetTunedOnData() const { return fIsTunedOnData; };
   void SetTuneOnDataMask(Int_t mask){fTunedOnDataMask=mask;};
   
   void SetUseTPCEtaCorrection(Bool_t useTPCEtaCorrection) { fUseTPCEtaCorrection = useTPCEtaCorrection; };
index 6cfd8a3..2fc716a 100644 (file)
@@ -48,6 +48,8 @@
 
 #include <AliT0CalibSeasonTimeShift.h>
 
+#include <AliMultiplicity.h>
+
 #include "AliTOFTenderSupply.h"
 
 ClassImp(AliTOFTenderSupply)
@@ -69,6 +71,7 @@ AliTOFTenderSupply::AliTOFTenderSupply() :
   fRecoPass(0),
   fUserRecoPass(0),
   fForceCorrectTRDBug(kFALSE),
+  fT0Simulate(kFALSE),
   fTOFPIDParams(0x0),
   fTOFCalib(0x0),
   fTOFT0maker(0x0),
@@ -111,6 +114,7 @@ AliTOFTenderSupply::AliTOFTenderSupply(const char *name, const AliTender *tender
   fRecoPass(0),
   fUserRecoPass(0),
   fForceCorrectTRDBug(kFALSE),
+  fT0Simulate(kFALSE),
   fTOFPIDParams(0x0),
   fTOFCalib(0x0),
   fTOFT0maker(0x0),
@@ -166,39 +170,60 @@ void AliTOFTenderSupply::Init()
       fTenderNoAction = kTRUE;
     }
     else if (run>=114737&&run<=117223) {      //period="LHC10B";
-      if (fRecoPass == 2) {fCorrectExpTimes=kTRUE; fCorrectTRDBug=kFALSE;}
-      else if (fRecoPass == 3) {fCorrectExpTimes=kFALSE; fCorrectTRDBug=kTRUE;}
-      fLHC10dPatch=kFALSE;
-      fT0IntercalibrationShift = 0;
-      fT0DetectorAdjust=kFALSE;   // it was kTRUE
-      if (fIsMC) fT0DetectorAdjust=kTRUE;   // this will add smearing because LHC10b doesn't have start_time simulated
+      if (!fIsMC) {
+       if (fRecoPass == 2) {
+         fCorrectExpTimes=kTRUE; 
+         fCorrectTRDBug=kFALSE;}
+       else if (fRecoPass == 3) {
+         fCorrectExpTimes=kFALSE;
+         fCorrectTRDBug=kTRUE;
+       }
+       fLHC10dPatch=kFALSE;
+       fT0IntercalibrationShift = 0;
+       fT0DetectorAdjust=kFALSE;  // previously was true (we acted as a T0 tender)
+      } else if (fIsMC) {
+       fT0DetectorAdjust=kFALSE;
+       fT0Simulate=kTRUE;
+       fCorrectExpTimes=kTRUE;
+      }
     }
     else if (run>=118503&&run<=121040) { //period="LHC10C";
-      if (fRecoPass == 2) {fCorrectExpTimes=kTRUE; fCorrectTRDBug=kFALSE;}
-      else if (fRecoPass == 3) {fCorrectExpTimes=kFALSE; fCorrectTRDBug=kTRUE;}
-      fLHC10dPatch=kFALSE;
-      fT0IntercalibrationShift = 0;
-      fT0DetectorAdjust=kFALSE;
-      if (fIsMC) fT0DetectorAdjust=kTRUE;   // this will add smearing because LHC10b doesn't have start_time simulated
+      if (!fIsMC) {
+       if (fRecoPass == 2) {fCorrectExpTimes=kTRUE; fCorrectTRDBug=kFALSE;}
+       else if (fRecoPass == 3) {fCorrectExpTimes=kFALSE; fCorrectTRDBug=kTRUE;}
+       fLHC10dPatch=kFALSE;
+       fT0IntercalibrationShift = 0;
+       fT0DetectorAdjust=kFALSE;  // previously was true (we acted as a T0 tender)
+      } else if (fIsMC) {
+       fT0DetectorAdjust=kFALSE;
+       fT0Simulate=kTRUE;       
+       fCorrectExpTimes=kTRUE;
+      }
     }
     else if (run>=122195&&run<=126437) { //period="LHC10D";
       if (!fIsMC) {
         fCorrectExpTimes=kFALSE;
         fLHC10dPatch=kTRUE;
-      } else {
+       fT0DetectorAdjust=kFALSE;  // previously was true (we acted as a T0 tender)
+       fT0IntercalibrationShift = 0;
+      } else if (fIsMC) {
         fCorrectExpTimes=kTRUE;    // for old MC the expected times bug was there
         fLHC10dPatch=kFALSE;       // but not the fake geometry
+       fT0DetectorAdjust=kFALSE;
+       fT0Simulate=kTRUE;
       }
-      fT0IntercalibrationShift = 0;
-      fT0DetectorAdjust=kFALSE;     // it was kTRUE
-      if (fIsMC) fT0DetectorAdjust=kTRUE;
     }
     else if (run>=127719&&run<=130850) { //period="LHC10E";
-      fCorrectExpTimes=kFALSE;
-      fLHC10dPatch=kFALSE;
-      fT0IntercalibrationShift = 30.;
-      fT0DetectorAdjust=kFALSE;      // it was kTRUE
-      if (fIsMC) fT0DetectorAdjust=kTRUE;
+      if (!fIsMC) {
+       fCorrectExpTimes=kFALSE;
+       fLHC10dPatch=kFALSE;
+       fT0DetectorAdjust=kFALSE;            // previously was true (we acted as a T0 tender)
+       fT0IntercalibrationShift = 0.;       // this was 30 before, but it is now handled via TOFPIDResponse inside OADB
+      } else if (fIsMC) {
+       fCorrectExpTimes=kTRUE;    // this is not fully correct for newer productions like LHC11b2 but we live with this
+       fT0DetectorAdjust=kFALSE;
+       fT0Simulate=kTRUE;
+      }
     }
     else if (run>=133004&&run<=135029) { //period="LHC10F";
       fTenderNoAction=kTRUE;
@@ -210,7 +235,7 @@ void AliTOFTenderSupply::Init()
       fCorrectExpTimes=kFALSE;
       fLHC10dPatch=kFALSE;                
       fT0IntercalibrationShift = 0.;
-      fT0DetectorAdjust=kFALSE;      // it was kTRUE
+      fT0DetectorAdjust=kFALSE;          // it was kTRUE
     }
     else if (run>=139699) {              //period="LHC11A";
       fTenderNoAction=kTRUE;
@@ -262,9 +287,10 @@ void AliTOFTenderSupply::Init()
   AliInfo(Form("|    Correct TRD Bug                :  %d               |",fCorrectTRDBug));
   AliInfo(Form("|    LHC10d patch                   :  %d               |",fLHC10dPatch));
   AliInfo(Form("|    TOF resolution for TOFT0 maker :  %5.2f (ps)     |",fTOFPIDParams->GetTOFresolution()));
-  AliInfo(Form("|    MC flag                        :  %d               |",fIsMC));
+  AliInfo(Form("|    MC flag (start time added)     :  %d               |",fIsMC));
   AliInfo(Form("|    T0 detector offsets applied    :  %d               |",fT0DetectorAdjust));
-  //  AliInfo(Form("|    TOF/T0 intercalibration shift   :  %5.2f (ps)     |",fT0IntercalibrationShift));
+  AliInfo(Form("|    T0 signal re-sampled           :  %d               |",fT0Simulate));
+  AliInfo(Form("|    TOF/T0 intercalibration shift   :  %5.2f (ps)     |",fT0IntercalibrationShift));
   AliInfo("|******************************************************|");
 
 
@@ -340,13 +366,14 @@ void AliTOFTenderSupply::ProcessEvent()
     if (event->GetT0TOF(1) == 0) event->SetT0TOF(1, 99999.);
     if (event->GetT0TOF(2) == 0) event->SetT0TOF(2, 99999.);
 
-    if (fT0DetectorAdjust) {
-      if(!fIsMC){   // data: apply shifts to align around Zero
+    if ( (fT0DetectorAdjust) && !(fIsMC) ) {  // DATA: apply shifts to align around T0: this is like a T0 tender!!
        event->SetT0TOF(0,event->GetT0TOF(0) - fT0shift[0]);
        event->SetT0TOF(1,event->GetT0TOF(1) - fT0shift[1]);
        event->SetT0TOF(2,event->GetT0TOF(2) - fT0shift[2]);
-      } else {
-      // MC: add smearing for realistic T0A and T0C resolution
+    }
+    if (fIsMC) {
+      if (fT0DetectorAdjust)  { // MC case 1: add an additional contribution to resolution
+       // MC: add smearing for realistic T0A and T0C resolution
        Double_t defResolutionT0A = 33.;   // in future we will get this from ESDrun data structure or via OCDB
        Double_t defResolutionT0C = 30.;   // for the moment we don't trust them
        if ( (fgT0Aresolution > defResolutionT0A) && (event->GetT0TOF(1)<90000.) ) { // add smearing only if signal is there
@@ -364,12 +391,32 @@ void AliTOFTenderSupply::ProcessEvent()
          event->SetT0TOF(0,smearedT0AC); 
        }
        if (fDebugLevel > 1) Printf(" TofTender: T0 time (postSmear) %f %f %f",event->GetT0TOF(0),event->GetT0TOF(1),event->GetT0TOF(2));
-       // add finally the timeZero offset also to the T0 detector information
-       event->SetT0TOF(0,event->GetT0TOF(0) + startTime);
-       event->SetT0TOF(1,event->GetT0TOF(1) + startTime);
-       event->SetT0TOF(2,event->GetT0TOF(2) + startTime);  
-       if (fDebugLevel > 1) Printf(" TofTender: T0 time (postStart) %f %f %f",event->GetT0TOF(0),event->GetT0TOF(1),event->GetT0TOF(2));
+      } 
+      else if (fT0Simulate) {  // MC case 2: we completely simulate signal in T0 based on multiplicity in ITS and vtx position
+       event->SetT0TOF(0, 9999999.); // we wipe-out whatever is there
+       event->SetT0TOF(1, 99999.);
+        event->SetT0TOF(2, 99999.);
+       if (fDebugLevel > 1) Printf(" TofTender: T0 time (after wipe-out) %f %f %f",event->GetT0TOF(0),event->GetT0TOF(1),event->GetT0TOF(2));
+       AliESDVertex *fvtx = (AliESDVertex*)event->GetPrimaryVertex();
+       Double_t zvtx = fvtx->GetZ();
+       Double_t tracklets[2] = {0.,0.};
+       GetTrackletsForT0(event,&tracklets[0],&tracklets[1]);
+       if (fDebugLevel > 1) Printf(" TofTender: T0 simul (z vtx tracklets A/C) %f %f %f",zvtx,tracklets[0],tracklets[1]);
+       for (Int_t side = 0; side < 2; side ++) {    // side 0 = T0A - side 1 = T0C
+         Double_t signal = SampleT0Signal(side,zvtx,tracklets[side]);  // if not fired we return 99999.
+         event->SetT0TOF(side+1,signal);            // but for the T0 structure we need to add 1...
+       }
+       if ( (event->GetT0TOF(1) < 1000.) && (event->GetT0TOF(2) < 1000.) ) { // both signals are there
+         Double_t meanT0AC=(event->GetT0TOF(1)+event->GetT0TOF(2))/2.;
+         event->SetT0TOF(0,meanT0AC); 
+       }
+       if (fDebugLevel > 1) Printf(" TofTender: T0 simul (AC A C) %f %f %f",event->GetT0TOF(0),event->GetT0TOF(1),event->GetT0TOF(2));
       }
+      // add the startTime offset also to the T0 detector information
+      event->SetT0TOF(0,event->GetT0TOF(0) + startTime);
+      event->SetT0TOF(1,event->GetT0TOF(1) + startTime);
+      event->SetT0TOF(2,event->GetT0TOF(2) + startTime);  
+      if (fDebugLevel > 1) Printf(" TofTender: T0 time (postStart AC A C) %f %f %f",event->GetT0TOF(0),event->GetT0TOF(1),event->GetT0TOF(2));
     }
     // after shifts adjust (data) or smearing+offset (MC) we 'clean' to default if signals not there 
     if(event->GetT0TOF(0) > 900000) event->SetT0TOF(0, 999999.);
@@ -1219,3 +1266,63 @@ void AliTOFTenderSupply::LoadTOFPIDParams(Int_t runNumber)
     fTOFPIDParams->SetStartTimeMethod(AliESDpid::kTOF_T0);
   }  
 }
+
+
+//__________________________________________________________________________
+Double_t AliTOFTenderSupply::SampleT0Signal(Int_t side, Double_t zvertex, Double_t tracklets) const
+{
+  Double_t p = 0.;
+  Double_t signal = 99999.;
+  if (TMath::Abs(zvertex) > 10.) return signal;
+  Double_t resolution[2] = {75.,65.};
+  if (side == 0) {
+    if (zvertex >= 5. && zvertex <= 10.) {
+//      p = 0.84 - exp(-1.03 - 0.31*tracklets);
+        p = 0.88 - exp(-1.1 - 0.32*tracklets);
+    }
+    else if (zvertex >=-10. && zvertex <5.) {
+//      p = 0.82 - exp(-0.81 - 0.25*tracklets);
+        p = 0.77 - exp(-0.88 - 0.25*tracklets);    
+   }
+  } else if (side == 1) {
+    if (zvertex >= -10. && zvertex < -5.) {
+      p = 0.99 - exp(-0.74 - 0.34*tracklets);
+    }
+    else if (zvertex >=-5. && zvertex <10.) {
+      p = 0.96 - exp(-0.51 - 0.27*tracklets);
+    }
+  } else {
+    return signal;
+  }
+  Double_t pu = gRandom->Rndm();
+  if (fDebugLevel > 1) {
+    printf(" TofTender: T0 simul [side %d zvt %f track %f] %f [pu: %f]",side,zvertex,tracklets,p,pu);
+    if (pu<p) printf(" --> signal will be generated: ");
+    else printf(" --> signal wil not be generated: ");
+  }
+  if (pu < p) signal = gRandom->Gaus(0.,resolution[side]);
+  if (fDebugLevel >1) Printf(" %f ",signal);
+  return signal;
+}
+
+void AliTOFTenderSupply::GetTrackletsForT0(AliESDEvent* event, Double_t *trkA, Double_t *trkC) const
+{
+  Double_t minetaA = 0.7;
+  Double_t maxetaA = 1.4;
+  Double_t minetaC = -1.4;
+  Double_t maxetaC = -0.7; 
+  AliMultiplicity *alimult = (AliMultiplicity *)event->GetMultiplicity(); 
+  Int_t nTr=alimult->GetNumberOfTracklets();
+  if (fDebugLevel > 1) Printf(" TofTender: T0 simul number of tracklets %d",nTr);
+  Int_t nTrackletsA=0, nTrackletsC=0;
+  for(Int_t iTr=0; iTr<nTr; iTr++){
+    Double_t eta=alimult->GetEta(iTr);
+    if(eta>minetaA && eta<maxetaA) nTrackletsA++;
+    if(eta>minetaC && eta<maxetaC) nTrackletsC++;
+    if (fDebugLevel > 1) Printf(" TofTender: T0 simul [tracklet # %d] ETA: %f %d %d",nTr,eta,nTrackletsA,nTrackletsC);
+  }
+  *trkA=(Double_t)nTrackletsA;
+  *trkC=(Double_t)nTrackletsC;
+}
+
+
index 89847d9..d136dd8 100644 (file)
@@ -68,21 +68,27 @@ public:
   Int_t GetOCDBVersion(Int_t runNumber);
   void LoadTOFPIDParams(Int_t runNumber);
 
+  /* to invent a T0 signal... */
+  Double_t SampleT0Signal(Int_t side, Double_t zvertex, Double_t tracklets) const;
+  void GetTrackletsForT0(AliESDEvent *event, Double_t *trkA, Double_t *trkC) const;
+
 private:
   AliESDpid          *fESDpid;         //! ESD pid object
 
   
   Bool_t fTenderNoAction;    // flag for periods when tender action is not requested/not supported
-  Bool_t fIsMC;              // flag for MC data
+  Bool_t fIsMC;              // flag for MC data: adds start Time
   Bool_t fCorrectExpTimes;   // flag to apply Expected Time correction 
   Bool_t fCorrectTRDBug;     // flag to fix wrong dE/dx inside TRD
   Bool_t fLHC10dPatch;       // flag to apply special patch for LHC10d (reconstructed with wrong geometry)
-  Bool_t fT0DetectorAdjust;  // flag to apply offsets to T0 data (works only on some periods)
+  Bool_t fT0DetectorAdjust;  // DATA: flag to apply offsets to T0 data (LHC10b, c, d, e)
+                             // MC: add smearing to simulated data (LHC10b,c,d,e)
   Int_t  fDebugLevel;        // debug purposes 0= no output, 1 Info, 2 lot of info....
   Bool_t fAutomaticSettings; // enable/disable automatic (per run) settings
   Int_t  fRecoPass;          // reconstruction pass: the tender applies different recipes depending on the pass
   Int_t  fUserRecoPass;      // when reco pass is selected by user
   Bool_t fForceCorrectTRDBug; // force TRD bug correction (for some bad MC production...)
+  Bool_t fT0Simulate;        // ignore existing T0 data (if any) and simulate them
 
 
   // variables for TOF calibrations and timeZero setup
@@ -111,7 +117,7 @@ private:
   AliTOFTenderSupply(const AliTOFTenderSupply&c);
   AliTOFTenderSupply& operator= (const AliTOFTenderSupply&c);
 
-  ClassDef(AliTOFTenderSupply, 11);
+  ClassDef(AliTOFTenderSupply, 12);
 };
 
 
index f876d4c..440c85d 100644 (file)
@@ -17928,37 +17928,38 @@ C     EPOT(2,8) = PFERMN(2)**2/(2.0D0*AAM(8)) + EBINDN(2)
 
 * correction of projectile 4-momentum for effective target pot.
 * and Coulomb-energy (in case of hadron-nucleus interaction only)
-      IF ((IP.EQ.1).AND.(IT.GT.1).AND.LFERMI) THEN
-         EPNI = EPN
+*      IF ((IP.EQ.1).AND.(IT.GT.1).AND.LFERMI) THEN
+*         EPNI = EPN
 *   Coulomb-energy:
 *     positively charged hadron - check energy for Coloumb pot.
-         IF (IICH(IJPROJ).EQ.1) THEN
-            THRESH = ETACOU(2)+AAM(IJPROJ)
-            IF (EPNI.LE.THRESH) THEN
-               WRITE(LOUT,1000)
- 1000          FORMAT(/,1X,'KKINC:  WARNING!  projectile energy',
-     &                ' below Coulomb threshold - event rejected',/)
-               ISTHKK(1) = 1
-               RETURN
-            ENDIF
+*         IF (IICH(IJPROJ).EQ.1) THEN
+*            THRESH = ETACOU(2)+AAM(IJPROJ)
+*            IF (EPNI.LE.THRESH) THEN
+*               WRITE(LOUT,1000)
+* 1000          FORMAT(/,1X,'KKINC:  WARNING!  projectile energy',
+*     &                ' below Coulomb threshold - event rejected',/)
+*               ISTHKK(1) = 1
+*               RETURN
+*            ENDIF
 *     negatively charged hadron - increase energy by Coulomb energy
-         ELSEIF (IICH(IJPROJ).EQ.-1) THEN
-            EPNI = EPNI+ETACOU(2)
-         ENDIF
-         IF ((IJPROJ.EQ.1).OR.(IJPROJ.EQ.8)) THEN
+*         ELSEIF (IICH(IJPROJ).EQ.-1) THEN
+*            EPNI = EPNI+ETACOU(2)
+*         ENDIF
+*         IF ((IJPROJ.EQ.1).OR.(IJPROJ.EQ.8)) THEN
 *   Effective target potential
 *sr 6.6. binding energy only (to avoid negative exc. energies)
 C           EPNI = EPNI+EPOT(2,IJPROJ)
-            EBIPOT = EBINDP(2)
-            IF ((IJPROJ.NE.1).AND.(ABS(EPOT(2,IJPROJ)).GT.5.0D-3))
-     &         EBIPOT = EBINDN(2)
-            EPNI = EPNI+ABS(EBIPOT)
+*            EBIPOT = EBINDP(2)
+*            IF ((IJPROJ.NE.1).AND.(ABS(EPOT(2,IJPROJ)).GT.5.0D-3))
+*     &         EBIPOT = EBINDN(2)
+*            EPNI = EPNI+ABS(EBIPOT)
 * re-initialization of DTLTRA
-            DUM1 = ZERO
-            DUM2 = ZERO
-            CALL DT_LTINI(IJPROJ,IJTARG,EPNI,DUM1,DUM2,0)
-         ENDIF
-      ENDIF
+*            DUM1 = ZERO
+*            DUM2 = ZERO
+*
+*            CALL DT_LTINI(IJPROJ,IJTARG,EPNI,DUM1,DUM2,0)
+*         ENDIF
+*      ENDIF
 
 * projectile in n-n cms
       IF ((IP.LE.1).AND.(IT.GT.1)) THEN
index 9061bf8..863d66b 100644 (file)
@@ -3750,8 +3750,8 @@ C #include "dtu_dtevtp.inc"
 
 * Glauber formalism: collision properties
       COMMON /DTGLCP/ RPROJ,RTARG,BIMPAC,
-     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC
-
+     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC,
+     &                NCP,NCT
 * flags for diffractive interactions (DTUNUC 1.x)
       COMMON /DTFLG3/ ISINGD,IDOUBD,IFLAGD,IDIFF
 
@@ -5873,7 +5873,8 @@ C           ENDIF
 
 * Glauber formalism: collision properties
       COMMON /DTGLCP/ RPROJ,RTARG,BIMPAC,
-     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC
+     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC,
+     &                NCP,NCT
 
 * flavors of partons (DTUNUC 1.x)
       COMMON /DTDPMF/ IPVQ(MAXVQU),IPPV1(MAXVQU),IPPV2(MAXVQU),
@@ -6125,7 +6126,8 @@ C        ENDIF
 
 * Glauber formalism: collision properties
       COMMON /DTGLCP/ RPROJ,RTARG,BIMPAC,
-     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC
+     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC,
+     &                NCP,NCT
 **temporary
 
 * statistics: Glauber-formalism
@@ -9203,8 +9205,8 @@ C     PA2(3) = SIGN(SQRT(PZ2NSQ),PA2(3))
 
 * Glauber formalism: collision properties
       COMMON /DTGLCP/ RPROJ,RTARG,BIMPAC,
-     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC
-
+     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC,
+     &                NCP,NCT
       DIMENSION R(3),PIN(4),POUT(4),DEV(4)
 
       DO 1 K=1,4
@@ -9314,7 +9316,8 @@ C              PHKK(K,I) = PHKK(K,I)-DEV(K)/DBLE(NVAL)
 
 * Glauber formalism: collision properties
       COMMON /DTGLCP/ RPROJ,RTARG,BIMPAC,
-     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC
+     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC,
+     &                NCP,NCT
 
 * various options for treatment of partons (DTUNUC 1.x)
 * (chain recombination, Cronin,..)
@@ -11255,8 +11258,8 @@ C                    ENDIF
 
 * Glauber formalism: collision properties
       COMMON /DTGLCP/ RPROJ,RTARG,BIMPAC,
-     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC
-
+     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC,
+     &                NCP,NCT
 * Glauber formalism: flags and parameters for statistics
       LOGICAL LPROD
       CHARACTER*8 CGLB
@@ -16911,7 +16914,8 @@ C           QARJ(I) = PARJ(I)
 
 * Glauber formalism: collision properties
       COMMON /DTGLCP/ RPROJ,RTARG,BIMPAC,
-     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC
+     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC,
+     &                NCP,NCT
 
 * flags for input different options
       LOGICAL LEMCCK,LHADRO,LSEADI,LEVAPO
@@ -17110,8 +17114,8 @@ C9990 CONTINUE
 
 * Glauber formalism: collision properties
       COMMON /DTGLCP/ RPROJ,RTARG,BIMPAC,
-     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC
-
+     &                NWTSAM,NWASAM,NWBSAM,NWTACC,NWAACC,NWBACC,
+     &                NCP,NCT
 * nuclear potential
       LOGICAL LFERMI
       COMMON /DTNPOT/ PFERMP(2),PFERMN(2),FERMOD,
@@ -18854,37 +18858,37 @@ C     EPOT(2,8) = PFERMN(2)**2/(2.0D0*AAM(8)) + EBINDN(2)
 
 * correction of projectile 4-momentum for effective target pot.
 * and Coulomb-energy (in case of hadron-nucleus interaction only)
-      IF ((IP.EQ.1).AND.(IT.GT.1).AND.LFERMI) THEN
-         EPNI = EPN
+*      IF ((IP.EQ.1).AND.(IT.GT.1).AND.LFERMI) THEN
+*         EPNI = EPN
 *   Coulomb-energy:
 *     positively charged hadron - check energy for Coloumb pot.
-         IF (IICH(IJPROJ).EQ.1) THEN
-            THRESH = ETACOU(2)+AAM(IJPROJ)
-            IF (EPNI.LE.THRESH) THEN
-               WRITE(LOUT,1000)
- 1000          FORMAT(/,1X,'KKINC:  WARNING!  projectile energy',
-     &                ' below Coulomb threshold - event rejected',/)
-               ISTHKK(1) = 1
-               RETURN
-            ENDIF
+*         IF (IICH(IJPROJ).EQ.1) THEN
+*            THRESH = ETACOU(2)+AAM(IJPROJ)
+*            IF (EPNI.LE.THRESH) THEN
+*               WRITE(LOUT,1000)
+* 1000          FORMAT(/,1X,'KKINC:  WARNING!  projectile energy',
+*     &                ' below Coulomb threshold - event rejected',/)
+*               ISTHKK(1) = 1
+*               RETURN
+*            ENDIF
 *     negatively charged hadron - increase energy by Coulomb energy
-         ELSEIF (IICH(IJPROJ).EQ.-1) THEN
-            EPNI = EPNI+ETACOU(2)
-         ENDIF
-         IF ((IJPROJ.EQ.1).OR.(IJPROJ.EQ.8)) THEN
+*         ELSEIF (IICH(IJPROJ).EQ.-1) THEN
+*            EPNI = EPNI+ETACOU(2)
+*         ENDIF
+*         IF ((IJPROJ.EQ.1).OR.(IJPROJ.EQ.8)) THEN
 *   Effective target potential
 *sr 6.6. binding energy only (to avoid negative exc. energies)
 C           EPNI = EPNI+EPOT(2,IJPROJ)
-            EBIPOT = EBINDP(2)
-            IF ((IJPROJ.NE.1).AND.(ABS(EPOT(2,IJPROJ)).GT.5.0D-3))
-     &         EBIPOT = EBINDN(2)
-            EPNI = EPNI+ABS(EBIPOT)
+*            EBIPOT = EBINDP(2)
+*            IF ((IJPROJ.NE.1).AND.(ABS(EPOT(2,IJPROJ)).GT.5.0D-3))
+*     &         EBIPOT = EBINDN(2)
+*            EPNI = EPNI+ABS(EBIPOT)
 * re-initialization of DTLTRA
-            DUM1 = ZERO
-            DUM2 = ZERO
-            CALL DT_LTINI(IJPROJ,IJTARG,EPNI,DUM1,DUM2,0)
-         ENDIF
-      ENDIF
+*            DUM1 = ZERO
+*            DUM2 = ZERO
+*            CALL DT_LTINI(IJPROJ,IJTARG,EPNI,DUM1,DUM2,0)
+*         ENDIF
+*      ENDIF
 
 * projectile in n-n cms
       IF ((IP.LE.1).AND.(IT.GT.1)) THEN
index b77cba2..758ed30 100644 (file)
 # SHLIBS - Shared Libraries and objects for linking (Executables only)           #
 #--------------------------------------------------------------------------------#
 
-file( GLOB SRCS "EveBase/*.cxx")
-
+#file( GLOB SRCS "EveBase/*.cxx")
+set ( SRCS
+  EveBase/AliEveApplication.cxx
+  EveBase/AliEveBeamsInfo.cxx
+  EveBase/AliEveBeamsInfoEditor.cxx
+  EveBase/AliEveCascade.cxx
+  EveBase/AliEveCascadeEditor.cxx
+  EveBase/AliEveCascadeListEditor.cxx
+  EveBase/AliEveConfigManager.cxx
+  EveBase/AliEveCosmicRayFitter.cxx
+  EveBase/AliEveCosmicRayFitterEditor.cxx
+  EveBase/AliEveEventManager.cxx
+  EveBase/AliEveEventManagerEditor.cxx
+  EveBase/AliEveEventSelector.cxx
+  EveBase/AliEveEventSelectorWindow.cxx
+  EveBase/AliEveFileDialog.cxx
+  EveBase/AliEveGedEditor.cxx
+  EveBase/AliEveHF.cxx
+  EveBase/AliEveHFEditor.cxx
+  EveBase/AliEveHFListEditor.cxx
+  EveBase/AliEveJetPlane.cxx
+  EveBase/AliEveJetPlaneEditor.cxx
+  EveBase/AliEveJetPlaneGL.cxx
+  EveBase/AliEveKineTools.cxx
+  EveBase/AliEveKink.cxx
+  EveBase/AliEveKinkEditor.cxx
+  EveBase/AliEveKinkListEditor.cxx
+  EveBase/AliEveLego.cxx
+  EveBase/AliEveLegoEditor.cxx
+  EveBase/AliEveMacro.cxx
+  EveBase/AliEveMacroEditor.cxx
+  EveBase/AliEveMacroExecutor.cxx
+  EveBase/AliEveMacroExecutorWindow.cxx
+  EveBase/AliEveMagField.cxx
+  EveBase/AliEveMainWindow.cxx
+  EveBase/AliEveMultiView.cxx
+  EveBase/AliEveTrackCounter.cxx
+  EveBase/AliEveTrackCounterEditor.cxx
+  EveBase/AliEveTrack.cxx
+  EveBase/AliEveTrackFitter.cxx
+  EveBase/AliEveTrackFitterEditor.cxx
+  EveBase/AliEveTracklet.cxx
+  EveBase/AliEveUtil.cxx
+  EveBase/AliEveV0.cxx
+  EveBase/AliEveV0Editor.cxx
+  EveBase/AliEveV0ListEditor.cxx
+  EveBase/AliEveVSDCreator.cxx
+  )
 string ( REPLACE ".cxx" ".h" HDRS "${SRCS}" )
 
 set ( DHDR  EveBase/EveBaseLinkDef.h)
index 7c5c309..7d13921 100644 (file)
 # SHLIBS - Shared Libraries and objects for linking (Executables only)           #
 #--------------------------------------------------------------------------------#
 
-file( GLOB SRCS "EveDet/*.cxx")
-
+#file( GLOB SRCS "EveDet/*.cxx")
+set ( SRCS
+  EveDet/AliEveEMCALData.cxx
+  EveDet/AliEveEMCALSModule.cxx
+  EveDet/AliEveEMCALSModuleData.cxx
+  EveDet/AliEveFMDLoader.cxx
+  EveDet/AliEveITSDigitsInfo.cxx
+  EveDet/AliEveITSModule.cxx
+  EveDet/AliEveITSModuleStepper.cxx
+  EveDet/AliEveITSModuleStepperEditor.cxx
+  EveDet/AliEveITSScaledModule.cxx
+  EveDet/AliEveITSScaledModuleEditor.cxx
+  EveDet/AliEveITSUModule.cxx
+  EveDet/AliEveListAnalyser.cxx
+  EveDet/AliEveListAnalyserEditor.cxx
+  EveDet/AliEveMUONChamber.cxx
+  EveDet/AliEveMUONChamberData.cxx
+  EveDet/AliEveMUONChamberEditor.cxx
+  EveDet/AliEveMUONChamberGL.cxx
+  EveDet/AliEveMUONData.cxx
+  EveDet/AliEveMUONTrack.cxx
+  EveDet/AliEvePMDModule.cxx
+  EveDet/AliEvePMDModuleEditor.cxx
+  EveDet/AliEveT0Module.cxx
+  EveDet/AliEveTOFDigitsInfo.cxx
+  EveDet/AliEveTOFDigitsInfoEditor.cxx
+  EveDet/AliEveTOFSector.cxx
+  EveDet/AliEveTOFSectorEditor.cxx
+  EveDet/AliEveTOFStrip.cxx
+  EveDet/AliEveTOFStripEditor.cxx
+  EveDet/AliEveTPCData.cxx
+  EveDet/AliEveTPCLoader.cxx
+  EveDet/AliEveTPCLoaderEditor.cxx
+  EveDet/AliEveTPCSector2D.cxx
+  EveDet/AliEveTPCSector2DEditor.cxx
+  EveDet/AliEveTPCSector2DGL.cxx
+  EveDet/AliEveTPCSector3D.cxx
+  EveDet/AliEveTPCSector3DEditor.cxx
+  EveDet/AliEveTPCSector3DGL.cxx
+  EveDet/AliEveTPCSectorData.cxx
+  EveDet/AliEveTPCSectorViz.cxx
+  EveDet/AliEveTPCSectorVizEditor.cxx
+  EveDet/AliEveTRDData.cxx
+  EveDet/AliEveTRDDataEditor.cxx
+  EveDet/AliEveTRDLoader.cxx
+  EveDet/AliEveTRDLoaderImp.cxx
+  EveDet/AliEveTRDLoaderManager.cxx
+  EveDet/AliEveTRDModule.cxx
+  EveDet/AliEveTRDModuleImp.cxx
+  EveDet/AliEveTRDTrackList.cxx
+  EveDet/AliEveTRDTrackListEditor.cxx
+  EveDet/AliEveVZEROModule.cxx
+  EveDet/AliEveVZEROModuleEditor.cxx
+  )
 string ( REPLACE ".cxx" ".h" HDRS "${SRCS}" )
 
 set ( DHDR  EveDet/EveDetLinkDef.h)
index e46a69e..0f6e744 100644 (file)
 # SHLIBS - Shared Libraries and objects for linking (Executables only)           #
 #--------------------------------------------------------------------------------#
 
-file(GLOB SRCS "EveHLT/*.cxx")
+#file(GLOB SRCS "EveHLT/*.cxx")
+set ( SRCS
+  EveHLT/AliEveEventBuffer.cxx
+  EveHLT/AliEveEventBufferHomer.cxx
+  EveHLT/AliEveEventBufferOffline.cxx
+  EveHLT/AliEveHLTEventManager.cxx
+  EveHLT/AliEveHLTEventManagerEditor.cxx
+  EveHLT/AliEveHLTEventManagerHomer.cxx
+  EveHLT/AliEveHLTEventManagerOffline.cxx
+  EveHLT/AliEveHltGeometry.cxx
+  EveHLT/AliEveHOMERManager.cxx
+  EveHLT/AliEveHOMERManagerEditor.cxx
+  EveHLT/AliEveHOMERSource.cxx
+  EveHLT/AliEveHOMERSourceList.cxx
+  EveHLT/AliEveHOMERSourceMapByDet.cxx
+  EveHLT/AliEveHOMERSourceMapByType.cxx
+  EveHLT/AliEveHOMERSourceMap.cxx
+  )
 
 string ( REPLACE ".cxx" ".h" HDRS "${SRCS}" )
 
index e74f8c3..0f1bdc1 100644 (file)
@@ -1284,14 +1284,7 @@ Bool_t  AliITSQASDDChecker::MakeSDDImage( TObjArray ** list, AliQAv1::TASKINDEX_
     case AliQAv1::kNULLTASKINDEX:; case  AliQAv1::kNTASKINDEX: 
       {
        Int_t ts=(Int_t)task;
-       TString str;
-       if(ts>-1 && ts <9){
-         str= AliQAv1::GetTaskName(task);
-       }
-       else {
-         str="UNDEFINED";
-       }
-       AliWarning(Form("No histograms for this task ( %s ) \n", str.Data())); 
+       AliWarning(Form("No histograms for this task number %d  \n", ts)); 
        rval=kFALSE;
       }
       break;
index ee59e3c..aa83733 100644 (file)
@@ -193,10 +193,10 @@ void AliEmcalAodTrackFilterTask::UserExec(Option_t *)
         newt->SetBit(BIT(27),1);
         newt->SetBit(BIT(28),0);
       } else if (type==2) {
-        newt->SetBit(BIT(27),1);
+        newt->SetBit(BIT(27),0);
         newt->SetBit(BIT(28),1);
       } else if (type==3) {
-        newt->SetBit(BIT(27),0);
+        newt->SetBit(BIT(27),1);
         newt->SetBit(BIT(28),1);
       }
     }
index 7e48546..7c888cc 100644 (file)
@@ -174,7 +174,7 @@ void AliEmcalEsdTrackFilterTask::UserExec(Option_t *)
         AliESDtrack *newTrack = static_cast<AliESDtrack*>(fTracks->At(ntrnew));
        if (fDoPropagation) 
          AliEMCALRecoUtils::ExtrapolateTrackToEMCalSurface(newTrack,fDist);
-        newTrack->SetBit(BIT(27),0);
+        newTrack->SetBit(BIT(27),0); 
         newTrack->SetBit(BIT(28),0);
         ++ntrnew;
       } else if (fHybridTrackCuts->AcceptTrack(etrack)) {
@@ -189,11 +189,11 @@ void AliEmcalEsdTrackFilterTask::UserExec(Option_t *)
                         constrainParam->GetParameter(),
                         constrainParam->GetCovariance());
          if ((status&AliESDtrack::kITSrefit)==0) {
-            newTrack->SetBit(BIT(27),1);
-            newTrack->SetBit(BIT(28),0);
-          } else {
-            newTrack->SetBit(BIT(27),1);
+            newTrack->SetBit(BIT(27),0); //type 2
             newTrack->SetBit(BIT(28),1);
+          } else {
+            newTrack->SetBit(BIT(27),1); //type 1
+            newTrack->SetBit(BIT(28),0);
           }
          if (fDoPropagation)   
            AliEMCALRecoUtils::ExtrapolateTrackToEMCalSurface(newTrack,fDist);
index bed6cda..57064cb 100644 (file)
@@ -144,12 +144,10 @@ void AliEmcalPicoTrackMaker::UserExec(Option_t *)
       if (fESDtrackCuts && !fESDtrackCuts->AcceptTrack(esdtrack))
        continue;
       type = 0;
-      if (esdtrack->TestBit(BIT(27))) {
-        if (esdtrack->TestBit(BIT(28)))
-          type = 2;
-        else 
-          type =1;
-      }
+      if (esdtrack->TestBit(BIT(27)) && !esdtrack->TestBit(BIT(28)))
+       type = 1;
+      else if (!esdtrack->TestBit(BIT(27)) && esdtrack->TestBit(BIT(28)))
+       type = 2;
       if (!fIncludeNoITS && (type==2))
        continue;
       if (TMath::Abs(esdtrack->GetTrackEtaOnEMCal()) < 0.75 && 
index 319132a..d79e560 100644 (file)
@@ -103,26 +103,26 @@ void AliEmcalSetupTask::UserExec(Option_t *)
       man->SetDefaultStorage(fOcdbPath);
     } else { // use local copy of OCDB
       TString tmpdir=gSystem->WorkingDirectory();
+      if (gSystem->AccessPathName(tmpdir))
+       tmpdir = "/tmp";
       tmpdir+="/";
       tmpdir+=gSystem->GetUid();
       tmpdir+="-";
       TDatime t;
       tmpdir+=t.Get();
       tmpdir+="-";
-      fLocalOcdb = tmpdir;
-      fLocalOcdb+=gRandom->Integer(999999999);
-      gSystem->MakeDirectory(fLocalOcdb);
       Int_t counter = 0;
-      while (gSystem->AccessPathName(fLocalOcdb)) {
+      fLocalOcdb = tmpdir;
+      fLocalOcdb+=gRandom->Integer((UInt_t)999999999999);
+      while (!gSystem->AccessPathName(fLocalOcdb)) {
        fLocalOcdb = tmpdir;
-       fLocalOcdb+=gRandom->Integer(999999999);
-       gSystem->MakeDirectory(fLocalOcdb);
-       gSystem->Exec("ls");
+       fLocalOcdb+=gRandom->Integer((UInt_t)999999999999);
        counter++;
        if (counter>100) {
          AliFatal(Form("Could not create local directory for OCDB at %s",tmpdir.Data()));
        }
       }
+      gSystem->MakeDirectory(fLocalOcdb);
       TString filename(Form("$ALICE_ROOT/PWG/EMCAL/data/%d.dat",year));
       TString cmd(Form("cd %s && tar -xf %s",fLocalOcdb.Data(),filename.Data()));
       Int_t ret = gSystem->Exec(cmd);
@@ -143,7 +143,7 @@ void AliEmcalSetupTask::UserExec(Option_t *)
   if (man) {
     if (man->GetRun()!=runno)
       man->SetRun(runno);
-    AliInfo(Form("Loading grp data from OCDB"));
+    AliInfo(Form("Loading grp data from OCDB for run %d", runno));
     AliGRPManager GRPManager;
     GRPManager.ReadGRPEntry();
     GRPManager.SetMagField();
index 7541b72..61872f5 100644 (file)
Binary files a/PWG/EMCAL/data/2010.dat and b/PWG/EMCAL/data/2010.dat differ
index b06cecc..be38da5 100644 (file)
Binary files a/PWG/EMCAL/data/2011.dat and b/PWG/EMCAL/data/2011.dat differ
index d506605..97bfc52 100644 (file)
Binary files a/PWG/EMCAL/data/2012.dat and b/PWG/EMCAL/data/2012.dat differ
index ab8b7b9..c2e7c07 100644 (file)
Binary files a/PWG/EMCAL/data/2013.dat and b/PWG/EMCAL/data/2013.dat differ
index 068c821..13cac32 100644 (file)
@@ -123,9 +123,12 @@ Bool_t AliAnalysisMuMuCutCombination::IsEqual(const TObject* obj) const
   if ( IsTrackCutter() != other->IsTrackCutter() ) return kFALSE;
   if ( IsTrackPairCutter() != other->IsTrackPairCutter() ) return kFALSE;
   if ( IsTriggerClassCutter() != other->IsTriggerClassCutter() ) return kFALSE;
+
+  if ( !fCuts && !other->fCuts ) return kTRUE;
+
+  // no cuts, nothing to check further...
   
-  if ( fCuts && !other->fCuts ) return kFALSE;
-  if ( !fCuts && other->fCuts ) return kFALSE;
+  if ( ( fCuts && !other->fCuts ) || ( !fCuts && other->fCuts ) ) return kFALSE;
   
   if ( fCuts->GetEntries() != other->fCuts->GetEntries() ) return kFALSE;
   
index 13d0010..5141b49 100644 (file)
@@ -2960,7 +2960,11 @@ void AliAnalysisMuMu::TriggerCountCoverage(const char* triggerList,
   {
     ++n;
     current += it->first;
-    Double_t percent = ( total > 0.0 ? current*100.0/total : 0.0);
+    Double_t percent = 0.0;
+    if ( total > 0.0 )
+    {
+      percent = current*100.0/total;
+    }
     std::cout << Form("%10lld",it->first) << " " << it->second << " percentage of total = " << Form("%7.2f %% %3d",percent,n ) << std::endl;
   }
 
index 8a2b244..59f44d8 100644 (file)
@@ -1778,7 +1778,7 @@ AliAnalysisMuMuFnorm::WeightedMeanGraphs(const char* patternOrList, const char*
   
   for ( Int_t ipoint = 0; ipoint < npts; ++ipoint )
   {
-    Double_t x,xref(0.0),xerr;
+    Double_t x(0.0),xref(0.0),xerr(0.0);
     Double_t sum(0.0);
     Double_t sume2(0.0);
     
index a444088..4300348 100644 (file)
@@ -375,6 +375,7 @@ Double_t AliAnalysisMuMuResult::GetErrorStat(const char* name, const char* subRe
         return r->GetErrorStat(name);
       }
     }
+    return 0.0;
   }
   
   Double_t variance= (1.0/v1)*(1.0/(n-1))*d;
index 4b2a63b..f5acdfd 100644 (file)
@@ -1270,7 +1270,7 @@ void  AliDptDptInMC::UserExec(Option_t */*option*/)
                   continue;
                }
 
-              if(!t->IsPhysicalPrimary()) continue;                                                                                      
+             //if(!t->IsPhysicalPrimary()) continue;                                                                                      
               // Remove neutral tracks                                      
               if(t->Charge() == 0) continue;                                                                                              
              //Exclude Weak Decay Resonances                                                                                                          
@@ -1283,15 +1283,16 @@ void  AliDptDptInMC::UserExec(Option_t */*option*/)
                    if(motherTrack) {
                      Int_t pdgCodeOfMother = motherTrack->GetPdgCode();
 
-                     if(pdgCodeOfMother == 311   ||
-                          pdgCodeOfMother == -311  ||
-                          pdgCodeOfMother == 3122  ||
+                     if(pdgCodeOfMother == 311  ||
+                        pdgCodeOfMother == -311 ||
+                        pdgCodeOfMother == 310  ||
+                        pdgCodeOfMother == 3122 ||
                         pdgCodeOfMother == -3122) continue;
-
                    }
                  }
                }
 
+
              //Exclude electrons with PDG                                                                                                 
              if(fExcludeElectronsInMC) {
                if(TMath::Abs(t->GetPdgCode()) == 11) continue;
index 5e97932..5122d63 100644 (file)
@@ -1,6 +1,6 @@
 ////////////////////////////////////////////////////////////////////////////////
 //                                                                            //
-// AliFemtoModelCorrFctnDEtaDPhi - A correlation function that analyzes            //
+// AliFemtoModelCorrFctnDEtaDPhi - A correlation function that analyzes       //
 // two particle correlations with respect to the azimuthal angle (phi)        //
 // and pseudorapidity (eta) difference                                        //
 //                                                                            //
index 6c56c10..b374481 100644 (file)
@@ -6,7 +6,7 @@
 /////////////////////////////////////////////////////////////////////////////
 /***************************************************************************
  *
- * $Id$
+ * $Id: AliFemtoShareQualityPairCut.cxx 53713 2011-12-20 12:31:21Z akisiel $
  *
  * Author: Adam Kisiel, Ohio State, kisiel@mps.ohio-state.edu
  ***************************************************************************
@@ -64,45 +64,46 @@ bool AliFemtoShareQualityPairCut::Pass(const AliFemtoPair* pair){
   Int_t an = 0;
   Int_t ns = 0;
   
-  if ((fShareFractionMax < 1.0) && ( fShareQualityMax < 1.0)) {
-    for (unsigned int imap=0; imap<pair->Track1()->Track()->TPCclusters().GetNbits(); imap++) {
-      // If both have clusters in the same row
-      if (pair->Track1()->Track()->TPCclusters().TestBitNumber(imap) && 
-         pair->Track2()->Track()->TPCclusters().TestBitNumber(imap)) {
-       // Do they share it ?
-       if (pair->Track1()->Track()->TPCsharing().TestBitNumber(imap) &&
-           pair->Track2()->Track()->TPCsharing().TestBitNumber(imap))
-         {
-           //    cout << "A shared cluster !!!" << endl;
-           //  cout << "imap idx1 idx2 " 
-           //       << imap << " "
-           //       << tP1idx[imap] << " " << tP2idx[imap] << endl;
-           an++;
-           nh+=2;
-           ns+=2;
-         }
-       
-       // Different hits on the same padrow
-       else {
-         an--;
-         nh+=2;
-       }
-      }
-      else if (pair->Track1()->Track()->TPCclusters().TestBitNumber(imap) ||
-              pair->Track2()->Track()->TPCclusters().TestBitNumber(imap)) {
-       // One track has a hit, the other does not
-       an++;
-       nh++;
-      }
-    }
-    
-    Float_t hsmval = 0.0;
-    Float_t hsfval = 0.0;
-    
-    if (nh >0) {
-      hsmval = an*1.0/nh;
-      hsfval = ns*1.0/nh;
-    }
+  if ((fShareFractionMax >= 1.0) && ( fShareQualityMax >= 1.0)) {
+     temp = true;
+  }
+  else {
+     for (unsigned int imap=0; imap<pair->Track1()->Track()->TPCclusters().GetNbits(); imap++) {
+        // If both have clusters in the same row
+        if (pair->Track1()->Track()->TPCclusters().TestBitNumber(imap) && 
+            pair->Track2()->Track()->TPCclusters().TestBitNumber(imap)) {
+           // Do they share it ?
+           if (pair->Track1()->Track()->TPCsharing().TestBitNumber(imap) &&
+               pair->Track2()->Track()->TPCsharing().TestBitNumber(imap))
+           {
+              //         cout << "A shared cluster !!!" << endl;
+              //       cout << "imap idx1 idx2 " 
+              //            << imap << " "
+              //            << tP1idx[imap] << " " << tP2idx[imap] << endl;
+              an++;
+              nh+=2;
+              ns+=2;
+           }
+           // Different hits on the same padrow
+           else {
+              an--;
+              nh+=2;
+           }
+        }
+        else if (pair->Track1()->Track()->TPCclusters().TestBitNumber(imap) ||
+                 pair->Track2()->Track()->TPCclusters().TestBitNumber(imap)) {
+           // One track has a hit, the other does not
+           an++;
+           nh++;
+        }
+     }
+     Float_t hsmval = 0.0;
+     Float_t hsfval = 0.0;
+
+     if (nh >0) {
+        hsmval = an*1.0/nh;
+        hsfval = ns*1.0/nh;
+     }
     //  if (hsmval > -0.4) {
     //   cout << "Pair quality: " << hsmval << " " << an << " " << nh << " " 
     //        << (pair->Track1()->Track()) << " " 
@@ -112,11 +113,14 @@ bool AliFemtoShareQualityPairCut::Pass(const AliFemtoPair* pair){
     //   if (hsfval > 0.0) {
     //     cout << "Pair sharity: " << hsfval << " " << ns << " " << nh << "    " << hsmval << " " << an << " " << nh << endl;
     //   }
-    
-    temp = (hsmval < fShareQualityMax) && (hsfval < fShareFractionMax);
+     if( (fShareQualityMax < 1) && (fShareFractionMax < 1)  )
+        temp = (hsmval < fShareQualityMax) && (hsfval < fShareFractionMax);
+     else if (fShareQualityMax < 1)
+        temp = (hsmval < fShareQualityMax);
+     else if (fShareFractionMax < 1)
+        temp = (hsmval < fShareFractionMax);
+     else temp = false;
   }
-  else
-    temp = true;
 
   if (fRemoveSameLabel) {
     if (abs(pair->Track1()->Track()->Label()) == abs(pair->Track2()->Track()->Label())) {
index f6f5510..ecbe8d1 100644 (file)
@@ -57,6 +57,7 @@ AliAnalysisTaskSE(),
   fAODcase(kTRUE),
   fPbPbcase(kTRUE),
   fGenerateSignal(kFALSE),
+  fGeneratorOnly(kFALSE),
   fPdensityExplicitLoop(kFALSE),
   fPdensityPairCut(kTRUE),
   fTabulatePairs(kFALSE),
@@ -220,6 +221,7 @@ AliChaoticity::AliChaoticity(const Char_t *name)
   fAODcase(kTRUE),
   fPbPbcase(kTRUE),
   fGenerateSignal(kFALSE),
+  fGeneratorOnly(kFALSE),
   fPdensityExplicitLoop(kFALSE),
   fPdensityPairCut(kTRUE),
   fTabulatePairs(kFALSE),
@@ -389,6 +391,7 @@ AliChaoticity::AliChaoticity(const AliChaoticity &obj)
     fAODcase(obj.fAODcase),
     fPbPbcase(obj.fPbPbcase),
     fGenerateSignal(obj.fGenerateSignal),
+    fGeneratorOnly(obj.fGeneratorOnly),
     fPdensityExplicitLoop(obj.fPdensityExplicitLoop),
     fPdensityPairCut(obj.fPdensityPairCut),
     fTabulatePairs(obj.fTabulatePairs),
@@ -503,6 +506,7 @@ AliChaoticity &AliChaoticity::operator=(const AliChaoticity &obj)
   fAODcase = obj.fAODcase;
   fPbPbcase = obj.fPbPbcase; 
   fGenerateSignal = obj.fGenerateSignal;
+  fGeneratorOnly = obj.fGeneratorOnly;
   fPdensityExplicitLoop = obj.fPdensityExplicitLoop;
   fPdensityPairCut = obj.fPdensityPairCut;
   fTabulatePairs = obj.fTabulatePairs;
@@ -777,7 +781,7 @@ void AliChaoticity::ParInit()
   fQstepWeights = fQupperBoundWeights/Float_t(kQbinsWeights);
   for(Int_t i=0; i<kQbinsWeights; i++) {fQmean[i]=(i+0.5)*fQstepWeights;}
   //
-  fDampStart = 0.5;// was 0.3
+  fDampStart = 0.5;// was 0.3, then 0.5
   fDampStep = 0.02;
   
   //
@@ -1581,17 +1585,17 @@ void AliChaoticity::Exec(Option_t *)
       Double_t integratedTimesTOF[10]={0};
 
       /*if(fFilterBit != 7 ) {
-       nSigmaTPC[0]=fabs(fPIDResponse->NumberOfSigmasTPC(aodtrack,AliPID::kElectron));
-       nSigmaTPC[1]=fabs(fPIDResponse->NumberOfSigmasTPC(aodtrack,AliPID::kMuon));
-       nSigmaTPC[2]=fabs(fPIDResponse->NumberOfSigmasTPC(aodtrack,AliPID::kPion));
-       nSigmaTPC[3]=fabs(fPIDResponse->NumberOfSigmasTPC(aodtrack,AliPID::kKaon));
-       nSigmaTPC[4]=fabs(fPIDResponse->NumberOfSigmasTPC(aodtrack,AliPID::kProton));
+       nSigmaTPC[0]=fPIDResponse->NumberOfSigmasTPC(aodtrack,AliPID::kElectron);
+       nSigmaTPC[1]=fPIDResponse->NumberOfSigmasTPC(aodtrack,AliPID::kMuon);
+       nSigmaTPC[2]=fPIDResponse->NumberOfSigmasTPC(aodtrack,AliPID::kPion);
+       nSigmaTPC[3]=fPIDResponse->NumberOfSigmasTPC(aodtrack,AliPID::kKaon);
+       nSigmaTPC[4]=fPIDResponse->NumberOfSigmasTPC(aodtrack,AliPID::kProton);
        //
-       nSigmaTOF[0]=fabs(fPIDResponse->NumberOfSigmasTOF(aodtrack,AliPID::kElectron));
-       nSigmaTOF[1]=fabs(fPIDResponse->NumberOfSigmasTOF(aodtrack,AliPID::kMuon));
-       nSigmaTOF[2]=fabs(fPIDResponse->NumberOfSigmasTOF(aodtrack,AliPID::kPion));
-       nSigmaTOF[3]=fabs(fPIDResponse->NumberOfSigmasTOF(aodtrack,AliPID::kKaon));
-       nSigmaTOF[4]=fabs(fPIDResponse->NumberOfSigmasTOF(aodtrack,AliPID::kProton));
+       nSigmaTOF[0]=fPIDResponse->NumberOfSigmasTOF(aodtrack,AliPID::kElectron);
+       nSigmaTOF[1]=fPIDResponse->NumberOfSigmasTOF(aodtrack,AliPID::kMuon);
+       nSigmaTOF[2]=fPIDResponse->NumberOfSigmasTOF(aodtrack,AliPID::kPion);
+       nSigmaTOF[3]=fPIDResponse->NumberOfSigmasTOF(aodtrack,AliPID::kKaon);
+       nSigmaTOF[4]=fPIDResponse->NumberOfSigmasTOF(aodtrack,AliPID::kProton);
        signalTPC = aodtrack->GetTPCsignal();
        if( (status&AliESDtrack::kTOFpid)!=0 && (status&AliESDtrack::kTIME)!=0 && (status&AliESDtrack::kTOFout)!=0 && (status&AliESDtrack::kTOFmismatch)<=0){// good tof hit
          fTempStruct[myTracks].fTOFhit = kTRUE;
@@ -1608,17 +1612,17 @@ void AliChaoticity::Exec(Option_t *)
          
          UInt_t status2=aodTrack2->GetStatus();
          
-         nSigmaTPC[0]=fabs(fPIDResponse->NumberOfSigmasTPC(aodTrack2,AliPID::kElectron));
-         nSigmaTPC[1]=fabs(fPIDResponse->NumberOfSigmasTPC(aodTrack2,AliPID::kMuon));
-         nSigmaTPC[2]=fabs(fPIDResponse->NumberOfSigmasTPC(aodTrack2,AliPID::kPion));
-         nSigmaTPC[3]=fabs(fPIDResponse->NumberOfSigmasTPC(aodTrack2,AliPID::kKaon));
-         nSigmaTPC[4]=fabs(fPIDResponse->NumberOfSigmasTPC(aodTrack2,AliPID::kProton));
+         nSigmaTPC[0]=fPIDResponse->NumberOfSigmasTPC(aodTrack2,AliPID::kElectron);
+         nSigmaTPC[1]=fPIDResponse->NumberOfSigmasTPC(aodTrack2,AliPID::kMuon);
+         nSigmaTPC[2]=fPIDResponse->NumberOfSigmasTPC(aodTrack2,AliPID::kPion);
+         nSigmaTPC[3]=fPIDResponse->NumberOfSigmasTPC(aodTrack2,AliPID::kKaon);
+         nSigmaTPC[4]=fPIDResponse->NumberOfSigmasTPC(aodTrack2,AliPID::kProton);
          //
-         nSigmaTOF[0]=fabs(fPIDResponse->NumberOfSigmasTOF(aodTrack2,AliPID::kElectron));
-         nSigmaTOF[1]=fabs(fPIDResponse->NumberOfSigmasTOF(aodTrack2,AliPID::kMuon));
-         nSigmaTOF[2]=fabs(fPIDResponse->NumberOfSigmasTOF(aodTrack2,AliPID::kPion));
-         nSigmaTOF[3]=fabs(fPIDResponse->NumberOfSigmasTOF(aodTrack2,AliPID::kKaon));
-         nSigmaTOF[4]=fabs(fPIDResponse->NumberOfSigmasTOF(aodTrack2,AliPID::kProton));
+         nSigmaTOF[0]=fPIDResponse->NumberOfSigmasTOF(aodTrack2,AliPID::kElectron);
+         nSigmaTOF[1]=fPIDResponse->NumberOfSigmasTOF(aodTrack2,AliPID::kMuon);
+         nSigmaTOF[2]=fPIDResponse->NumberOfSigmasTOF(aodTrack2,AliPID::kPion);
+         nSigmaTOF[3]=fPIDResponse->NumberOfSigmasTOF(aodTrack2,AliPID::kKaon);
+         nSigmaTOF[4]=fPIDResponse->NumberOfSigmasTOF(aodTrack2,AliPID::kProton);
          signalTPC = aodTrack2->GetTPCsignal();
          
          if( (status2&AliESDtrack::kTOFpid)!=0 && (status2&AliESDtrack::kTIME)!=0 && (status2&AliESDtrack::kTOFout)!=0 && (status2&AliESDtrack::kTOFmismatch)<=0){// good tof hit
@@ -1640,15 +1644,17 @@ void AliChaoticity::Exec(Option_t *)
       
       // Use TOF if good hit and above threshold
       if(fTempStruct[myTracks].fTOFhit && fTempStruct[myTracks].fMom > fTPCTOFboundry){
-       if(nSigmaTOF[0]<fSigmaCutTOF) fTempStruct[myTracks].fElectron = kTRUE;// Electron candidate
-       if(nSigmaTOF[2]<fSigmaCutTOF) fTempStruct[myTracks].fPion = kTRUE;// Pion candidate
-       if(nSigmaTOF[3]<fSigmaCutTOF) fTempStruct[myTracks].fKaon = kTRUE;// Kaon candidate
-       if(nSigmaTOF[4]<fSigmaCutTOF) fTempStruct[myTracks].fProton = kTRUE;// Proton candidate
+       if(fabs(nSigmaTOF[0])<fSigmaCutTOF) fTempStruct[myTracks].fElectron = kTRUE;// Electron candidate
+       if(fabs(nSigmaTOF[2])<fSigmaCutTOF) fTempStruct[myTracks].fPion = kTRUE;// Pion candidate
+       if(fabs(nSigmaTOF[3])<fSigmaCutTOF) fTempStruct[myTracks].fKaon = kTRUE;// Kaon candidate
+       if(fabs(nSigmaTOF[4])<fSigmaCutTOF) fTempStruct[myTracks].fProton = kTRUE;// Proton candidate
       }else {// TPC info instead
-       if(nSigmaTPC[0]<fSigmaCutTPC) fTempStruct[myTracks].fElectron = kTRUE;// Electron candidate
-       if(nSigmaTPC[2]<fSigmaCutTPC) fTempStruct[myTracks].fPion = kTRUE;// Pion candidate
-       if(nSigmaTPC[3]<fSigmaCutTPC) fTempStruct[myTracks].fKaon = kTRUE;// Kaon candidate
-       if(nSigmaTPC[4]<fSigmaCutTPC) fTempStruct[myTracks].fProton = kTRUE;// Proton candidate
+       if(fabs(nSigmaTPC[0])<fSigmaCutTPC) fTempStruct[myTracks].fElectron = kTRUE;// Electron candidate
+       if(fabs(nSigmaTPC[2])<fSigmaCutTPC) fTempStruct[myTracks].fPion = kTRUE;// Pion candidate
+       if(fabs(nSigmaTPC[3])<fSigmaCutTPC) fTempStruct[myTracks].fKaon = kTRUE;// Kaon candidate
+       if(fabs(nSigmaTPC[4])<fSigmaCutTPC) fTempStruct[myTracks].fProton = kTRUE;// Proton candidate
+       // asymmetric dE/dx cut to reduce muon contamination
+       if(nSigmaTPC[2] < -0.5) fTempStruct[myTracks].fPion = kFALSE;// asymmetric dE/dx cut
       }
                
       
@@ -1711,6 +1717,46 @@ void AliChaoticity::Exec(Option_t *)
     return;
   }
   
+  // Generator info only
+  if(fMCcase && fGeneratorOnly){
+    myTracks=0; pionCount=0; kaonCount=0; protonCount=0;// reset track counters
+    for(Int_t mctrackN=0; mctrackN<mcArray->GetEntriesFast(); mctrackN++){
+      if(myTracks >= fMultLimit) {cout<<"More tracks than Track Limit"<<endl; return;}
+      if(myTracks >= 1300) continue;// additional cut to limit high mult events which exceed pair # limits
+      
+      AliAODMCParticle *mcParticle = (AliAODMCParticle*)mcArray->At(mctrackN);
+      if(!mcParticle) continue;
+      if(fabs(mcParticle->Eta())>0.8) continue;
+      if(mcParticle->Charge()!=-3 && mcParticle->Charge()!=+3) continue;// x3 by convention
+      if(mcParticle->Pt() < 0.16 || mcParticle->Pt() > 1.0) continue;
+      if(!mcParticle->IsPrimary()) continue;
+      if(!mcParticle->IsPhysicalPrimary()) continue;
+      if(abs(mcParticle->GetPdgCode())!=211) continue;
+      
+      fTempStruct[myTracks].fP[0] = mcParticle->Px();
+      fTempStruct[myTracks].fP[1] = mcParticle->Py();
+      fTempStruct[myTracks].fP[2] = mcParticle->Pz();
+      fTempStruct[myTracks].fX[0] = 0.; fTempStruct[myTracks].fX[1] = 0.; fTempStruct[myTracks].fX[2] = 0.;
+      
+      fTempStruct[myTracks].fId = myTracks;// use my track counter 
+      fTempStruct[myTracks].fLabel = mctrackN;
+      fTempStruct[myTracks].fPhi = atan2(fTempStruct[myTracks].fP[1], fTempStruct[myTracks].fP[0]);
+      if(fTempStruct[myTracks].fPhi < 0) fTempStruct[myTracks].fPhi += 2*PI;
+      fTempStruct[myTracks].fPt = sqrt(pow(fTempStruct[myTracks].fP[0],2) + pow(fTempStruct[myTracks].fP[1],2));
+      fTempStruct[myTracks].fMom = sqrt( pow(fTempStruct[myTracks].fPt,2) + pow(fTempStruct[myTracks].fP[2],2) );
+      fTempStruct[myTracks].fEta = mcParticle->Eta();
+      fTempStruct[myTracks].fCharge = int(mcParticle->Charge()/3.);
+      fTempStruct[myTracks].fDCAXY = 0.;
+      fTempStruct[myTracks].fDCAZ = 0.;
+      fTempStruct[myTracks].fDCA = 0.;
+      fTempStruct[myTracks].fPion = kTRUE;
+      fTempStruct[myTracks].fEaccepted = sqrt(pow(fTempStruct[myTracks].fMom,2) + pow(fTrueMassPi,2)); 
+      fTempStruct[myTracks].fKey = 1;
+      
+      myTracks++;
+      pionCount++;
+    }
+  }
   
   if(myTracks >= 1) {
     ((TH1F*)fOutputList->FindObject("fMultDist3"))->Fill(myTracks);
@@ -1973,7 +2019,7 @@ void AliChaoticity::Exec(Option_t *)
        
        // Pair Splitting/Merging cut
        if(qinv12 < fQLowerCut) continue;// remove unwanted low-q pairs (also a type of track splitting/merging cut)
-       if(ch1 == ch2){
+       if(ch1 == ch2 && !fGeneratorOnly){
          if(!AcceptPair((fEvt)->fTracks[i], (fEvt+en2)->fTracks[j])) {
            fPairSplitCut[0][i]->AddAt('1',j);
            ((TH1F*)fOutputList->FindObject("fRejectedPairs"))->Fill(qinv12);
@@ -1998,7 +2044,7 @@ void AliChaoticity::Exec(Option_t *)
              ((TProfile*)fOutputList->FindObject("fQsmearSq"))->Fill(1.,1000.*pow(qinv12-qinv12MC,2));
              ((TH1D*)fOutputList->FindObject("fQDist"))->Fill(qinv12-qinv12MC);
            }
-           
+           //cout<<pVect1[0]<<"  "<<pVect1MC[0]<<" : "<<pVect1[1]<<"  "<<pVect1MC[1]<<" : "<<pVect1[2]<<"  "<<pVect1MC[2]<<" : "<<pVect1[3]<<"  "<<pVect1MC[3]<<" : "<<endl;
            //if(transK12 <= 0.35) fEDbin=0;
            //else fEDbin=1;
 
@@ -2085,6 +2131,7 @@ void AliChaoticity::Exec(Option_t *)
            if(fGenerateSignal) {
              WInput = MCWeight(ch1,ch2, fRMax, fFixedLambdaBinr3, qinv12, transK12);
              //WInput = MCWeight(ch1,ch2, fRMax, fFixedLambdaBinr3, qinv12MC);
+             //cout<<qinv12<<"  "<<qinv12MC<<endl;
              KT[transKbin].KY[rapKbin].MB[fMbin].EDB[fEDbin].TwoPT[en2].fExplicit2ThreeD->Fill(fabs(qout), fabs(qside), fabs(qlong), WInput);
            }else KT[transKbin].KY[rapKbin].MB[fMbin].EDB[fEDbin].TwoPT[en2].fExplicit2ThreeD->Fill(fabs(qout), fabs(qside), fabs(qlong));
            
@@ -2492,7 +2539,7 @@ void AliChaoticity::Exec(Option_t *)
        
 
        if(qinv12 < fQLowerCut) continue;// remove unwanted low-q pairs (also a type of track splitting cut)
-       if(ch1 == ch2){
+       if(ch1 == ch2 && !fGeneratorOnly){
          if(!AcceptPair((fEvt)->fTracks[i], (fEvt+en2)->fTracks[j])) {
            fPairSplitCut[1][i]->AddAt('1',j);
            continue;
@@ -2658,7 +2705,7 @@ void AliChaoticity::Exec(Option_t *)
        ch1 = Int_t(((fEvt)->fTracks[i].fCharge + 1)/2.);
        ch2 = Int_t(((fEvt+en2)->fTracks[j].fCharge + 1)/2.);
        
-       if(ch1 == ch2){
+       if(ch1 == ch2 && !fGeneratorOnly){
          if(!AcceptPair((fEvt)->fTracks[i], (fEvt+en2)->fTracks[j])) {
            fPairSplitCut[2][i]->AddAt('1',j);
            continue;
@@ -2711,7 +2758,7 @@ void AliChaoticity::Exec(Option_t *)
        ch1 = Int_t(((fEvt+en1)->fTracks[i].fCharge + 1)/2.);
        ch2 = Int_t(((fEvt+en2)->fTracks[j].fCharge + 1)/2.);
        
-       if(ch1 == ch2){
+       if(ch1 == ch2 && !fGeneratorOnly){
          if(!AcceptPair((fEvt+en1)->fTracks[i], (fEvt+en2)->fTracks[j])) {
            fPairSplitCut[3][i]->AddAt('1',j);
            continue;
@@ -3165,6 +3212,7 @@ void AliChaoticity::Exec(Option_t *)
                MomResCorr12 = fMomResC2->GetBinContent(momResIndex+1, momBin12);
                MomResCorr13 = fMomResC2->GetBinContent(momResIndex+1, momBin13);
                MomResCorr23 = fMomResC2->GetBinContent(momResIndex+1, momBin23);
+               
                if(MomResCorr12 > 1.2 || MomResCorr13 > 1.2 || MomResCorr23 > 1.2) {// Safety check
                  if(fMbin==0 && bin1==0) {
                    ((TH3F*)fOutputList->FindObject("fTPNRejects3"))->Fill(qinv12, qinv13, qinv23, sqrt(fabs(weight12*weight13*weight23)));
@@ -3865,7 +3913,7 @@ void AliChaoticity::GetWeight(Float_t track1[], Float_t track2[], Float_t& wgt,
   qSide = fabs(qSide);
   qLong = fabs(qLong);
   Float_t wd=0, xd=0, yd=0, zd=0;
-  //Float_t qinv_temp=GetQinv(0,track1, track2);
+  //Float_t qinvtemp=GetQinv(0,track1, track2);
   //
   
   if(kt < fKmeanT[0]) {fKtIndexL=0; fKtIndexH=1;}
index 4fb4b70..95eded7 100644 (file)
@@ -81,6 +81,7 @@ class AliChaoticity : public AliAnalysisTaskSE {
   void SetTabulatePairs(Bool_t tabulate) {fTabulatePairs = tabulate;}
   void SetPbPbCase(Bool_t pbpb) {fPbPbcase = pbpb;}
   void SetGenerateSignal(Bool_t gen) {fGenerateSignal = gen;}
+  void SetGeneratorOnly(Bool_t genOnly) {fGeneratorOnly = genOnly;}
   void SetCentBinRange(Int_t low, Int_t high) {fCentBinLowLimit = low; fCentBinHighLimit = high;}
   void SetLEGOCase(Bool_t lego) {fLEGO = lego;}
   void SetFilterBit(UInt_t filterbit) {fFilterBit = filterbit;}
@@ -235,6 +236,7 @@ class AliChaoticity : public AliAnalysisTaskSE {
   Bool_t fAODcase;
   Bool_t fPbPbcase;
   Bool_t fGenerateSignal;
+  Bool_t fGeneratorOnly;
   Bool_t fPdensityExplicitLoop;
   Bool_t fPdensityPairCut;
   Bool_t fTabulatePairs;
index 97a30c8..9e1d87e 100644 (file)
@@ -11,7 +11,7 @@
 
 //this line for local: AliAnalysisTaskFemto *AddTaskFemtoKchHBT(const char *configMacroName="ConfigFemtoAnalysis.C", const char *configMacroParameters="" )
 
-AliAnalysisTaskFemto *AddTaskFemtoKchHBT0010(TString configMacroName, const char *containerName="femtolist", const char *configMacroParameters="" )
+AliAnalysisTaskFemto *AddTaskFemtoKchHBT0010(TString configMacroName, const char *containerName="lmlist005", const char *configMacroParameters="" )
 {
 // Creates a proton analysis task and adds it to the analysis manager.
   
@@ -56,7 +56,7 @@ AliAnalysisTaskFemto *AddTaskFemtoKchHBT0010(TString configMacroName, const char
   //[root@alicethinks Train]# ln -s /scratch/AliWork/PbPb2.76/Train2013/KchHBT KchHBT
   //
   AliAnalysisTaskFemto *taskfemto = new AliAnalysisTaskFemto("TaskFemto","$ALICE_ROOT/"+configMacroName,configMacroParameters,kFALSE);
-  taskfemto->SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral);// this a new line for train
+  taskfemto->SelectCollisionCandidates(AliVEvent::kCentral );// this a new line for train
   mgr->AddTask(taskfemto);
 
   // D. Configure the analysis task. Extra parameters can be used via optional
@@ -68,7 +68,7 @@ AliAnalysisTaskFemto *AddTaskFemtoKchHBT0010(TString configMacroName, const char
   //==============================================================================
   TString outputfile = AliAnalysisManager::GetCommonFileName();  
   outputfile += ":PWG2FEMTO";
-  AliAnalysisDataContainer *cout_femto  = mgr->CreateContainer("femtolist",  TList::Class(),
+  AliAnalysisDataContainer *cout_femto  = mgr->CreateContainer("lmlist005",  TList::Class(),
                                                               AliAnalysisManager::kOutputContainer,outputfile);
 
 
index 9dc2bda..55797b8 100644 (file)
@@ -11,7 +11,7 @@
 
 //this line for local: AliAnalysisTaskFemto *AddTaskFemtoKchHBT(const char *configMacroName="ConfigFemtoAnalysis.C", const char *configMacroParameters="" )
 
-AliAnalysisTaskFemto *AddTaskFemtoKchHBT1090(TString configMacroName, const char *containerName="femtolist", const char *configMacroParameters="" )
+AliAnalysisTaskFemto *AddTaskFemtoKchHBT1090(TString configMacroName, const char *containerName="lmlist090", const char *configMacroParameters="" )
 {
 // Creates a proton analysis task and adds it to the analysis manager.
   
@@ -71,7 +71,7 @@ AliAnalysisTaskFemto *AddTaskFemtoKchHBT1090(TString configMacroName, const char
   //==============================================================================
   TString outputfile = AliAnalysisManager::GetCommonFileName();  
   outputfile += ":PWG2FEMTO";
-  AliAnalysisDataContainer *cout_femto  = mgr->CreateContainer("femtolist",  TList::Class(),
+  AliAnalysisDataContainer *cout_femto  = mgr->CreateContainer("lmlist090",  TList::Class(),
                                                               AliAnalysisManager::kOutputContainer,outputfile);
 
 
index bdecb90..718efb3 100644 (file)
@@ -27,6 +27,7 @@
 #include "AliFemtoShareQualityTPCEntranceSepPairCut.h"
 #include "AliFemtoPairCutAntiGamma.h"
 #include "AliFemtoPairCutRadialDistance.h"
+#include "AliFemtoPairCutRadialDistanceKK.h"
 #include "AliFemtoQinvCorrFctn.h"
 #include "AliFemtoShareQualityCorrFctn.h"
 #include "AliFemtoTPCInnerCorrFctn.h"
@@ -54,31 +55,40 @@ AliFemtoManager* ConfigFemtoAnalysis() {
 
   double PionMass = 0.13956995;
   double KaonMass = 0.493677;
-  const int cMu=4;
-  const int cKt=8;
+  const int cMu=1;
+  const int cKt=5;
 
   //-------Single track cuts------------------------------------------------->
   double DCAxy=2.4;//cm // our standard is 0.20 cm; super narrow was 0.015cm
   double DCAz =3.0;//cm // our standard is 0.15 cm;
   //-------Single track cuts-------------------------------------------------<
+  //=======Double track cuts=================================================>
+  //Dhevan's : PhiStarDifferenceMinimum=0.06; EtaDifferenceMinimum=0.02;
+  double PhiStarDifferenceMinimum=0.017; //[radian]
+  double EtaDifferenceMinimum=0.015; //[radian]
+  //=======Double track cuts=================================================<
 
   // Switches for QA analyses
   // int runmults[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
   // int multbins[11] = {30, 70, 150, 310, 590, 990, 1570, 2370, 2370, 2370, 6500};
 
-  int runmults[cMu] = {1, 0, 0, 0};
+  int runmults[4] = {1, 0, 0, 0};
   //int multbins[11] = {0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900};
-  int multbins[cMu+1] = {0, 100, 300, 500, 900};
+  //Orig Kch in PbPb
+  //int multbins[cMu+1] = {0, 100, 300, 500, 900};
+  //Test for flat part of centrality distribution....
+  int multbins[5] = {0, 50, 300, 500, 900};
+  //.................................................
 
   int runch[2] = {1, 1};
   const char *chrgs[2] = { "Kp", "Km"};
   
   
   int runktdep = 1;
-  double ktrng[cKt+1] = {0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 1.0, 1.3};
+  double ktrng[cKt+1] = {0.2, 0.36, 0.48, 0.6, 1.0, 1.5};
 // double ktrng[8] = {0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 2.0};
 
-  int run3d = 0;
+  int run3d = 1;
   int runshlcms = 0;
 
   int runtype = 2; // Types 0 - global, 1 - ITS only, 2 - TPC Inner
@@ -122,6 +132,7 @@ AliFemtoManager* ConfigFemtoAnalysis() {
   AliFemtoEventReaderAODChain *Reader = new AliFemtoEventReaderAODChain();
     Reader->SetFilterBit(7);
     Reader->SetCentralityPreSelection(0, 100);
+    Reader->SetDCAglobalTrack(kTRUE);//option the DCA information from global tracks (ITS+TPC)
     
   AliFemtoManager* Manager=new AliFemtoManager();
   Manager->SetEventReader(Reader);
@@ -146,7 +157,8 @@ AliFemtoManager* ConfigFemtoAnalysis() {
   AliFemtoCutMonitorParticlePID *cutFail2PIDetaphitpc[20];
 //AliFemtoPairCutAntiGamma      *sqpcetaphitpc[20];
 //    AliFemtoShareQualityTPCEntranceSepPairCut      *sqpcetaphitpc[20];
-   AliFemtoPairCutRadialDistance      *sqpcetaphitpc[20];
+  //AliFemtoPairCutRadialDistance      *sqpcetaphitpc[20];//AliFemto dphi* cut
+  AliFemtoPairCutRadialDistanceKK      *sqpcetaphitpc[20];//Dhevan's dphi* cut
   AliFemtoCorrFctnDirectYlm     *cylmetaphitpc[20];
   AliFemtoCorrFctnDEtaDPhi      *cdedpetaphi[20*10];//20->20*10 due to kT
   AliFemtoChi2CorrFctn          *cchiqinvetaphitpc[20];
@@ -203,7 +215,7 @@ AliFemtoManager* ConfigFemtoAnalysis() {
            
          dtc1etaphitpc[aniter]->SetPt(0.14,1.5);
          //      dtc1etaphitpc[aniter]->SetEta(-1.2,1.2);
-         dtc1etaphitpc[aniter]->SetEta(-0.8,0.8);
+         dtc1etaphitpc[aniter]->SetEta(-0.5,0.5);
          //    //    dtc1etaphitpc[aniter]->SetEta(-0.5,0.5);
 ///      dtc1etaphitpc[aniter]->SetMass(PionMass);
          dtc1etaphitpc[aniter]->SetMass(KaonMass);
@@ -213,17 +225,20 @@ AliFemtoManager* ConfigFemtoAnalysis() {
                  
 ///////   ----!!!!!!      
          dtc1etaphitpc[aniter]->SetMostProbableKaon();  //!!!!!!
-         dtc1etaphitpc[aniter]->SetNsigmaTPCle250(1.5);
+         //------------------- November 2013 -----------------------------------< 
+         //New class in AliFemo: PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoKKTrackCut.cxx
+         dtc1etaphitpc[aniter]->SetNsigmaTPCle250(2.0);
          dtc1etaphitpc[aniter]->SetNsigmaTPC250_400(2.0);
-         dtc1etaphitpc[aniter]->SetNsigmaTPC400_450(0.0);
-         dtc1etaphitpc[aniter]->SetNsigmaTPC450_500(0.0);
+         dtc1etaphitpc[aniter]->SetNsigmaTPC400_450(2.0);
+         dtc1etaphitpc[aniter]->SetNsigmaTPC450_500(2.0);
          dtc1etaphitpc[aniter]->SetNsigmaTPCge500(3.0);
-             
-          dtc1etaphitpc[aniter]->SetNsigmaTOF500_800(2.0);
-          dtc1etaphitpc[aniter]->SetNsigmaTOF800_1000(1.5);
-          dtc1etaphitpc[aniter]->SetNsigmaTOFge1000(1.0);
+         // new cuts are stronger, better separation of pion in TOF 
+         // when momentum is greater then 800 MeV/c
+         dtc1etaphitpc[aniter]->SetNsigmaTOF500_800(2.0);
+         dtc1etaphitpc[aniter]->SetNsigmaTOF800_1000(1.5);
+         dtc1etaphitpc[aniter]->SetNsigmaTOFge1000(1.0);
+         //------------------- November 2013 ----------------------------------->
 
-         
 ////             dtc1etaphitpc[aniter]->SetMostProbablePion();
          //    // Track quality cuts
          if (runtype == 0) {
@@ -285,7 +300,8 @@ AliFemtoManager* ConfigFemtoAnalysis() {
        //  sqpcetaphitpc[aniter] = new AliFemtoShareQualityTPCEntranceSepPairCut();
          
           if (ichg < 2) {
-         sqpcetaphitpc[aniter] = new AliFemtoPairCutRadialDistance();
+           //sqpcetaphitpc[aniter] = new AliFemtoPairCutRadialDistance();//AliFemto dphi* cut
+         sqpcetaphitpc[aniter] = new AliFemtoPairCutRadialDistanceKK();  //Dhevan's dphi* cut
          if (runtype == 0) {
            sqpcetaphitpc[aniter]->SetShareQualityMax(1.0);
            sqpcetaphitpc[aniter]->SetShareFractionMax(0.05);
@@ -297,11 +313,11 @@ AliFemtoManager* ConfigFemtoAnalysis() {
 //ml       sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.02);
 
         
-          //--------- km:  eta-phi* standard custs ----------->>>>
-           sqpcetaphitpc[aniter]->SetPhiStarDifferenceMinimum(0.017);
-            sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.015);
-            sqpcetaphitpc[aniter]->SetMinimumRadius(0.8);
-          //--------- km:  eta-phi* standard custs -----------<<<
+          //--------- km:  eta-phi* Dhevan's custs ----------->>>>
+           sqpcetaphitpc[aniter]->SetPhiStarDifferenceMinimum(PhiStarDifferenceMinimum);
+            sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(EtaDifferenceMinimum);
+           //sqpcetaphitpc[aniter]->SetMinimumRadius(0.8);//not need for AliFemtoPairCutRadialDistanceKK()
+          //--------- km:  eta-phi* Dhevan's custs -----------<<<
 
           //////////////sqpcetaphitpc[aniter]->SetMagneticFieldSign(1);
          
@@ -323,11 +339,11 @@ AliFemtoManager* ConfigFemtoAnalysis() {
 //  void SetMinimumRadius(double minrad);
 //  void SetMagneticFieldSign(int magsign);
 
-          //--------- km:  eta-phi* standard custs ----------->>>>
-           sqpcetaphitpc[aniter]->SetPhiStarDifferenceMinimum(0.017);
-            sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.015);
-            sqpcetaphitpc[aniter]->SetMinimumRadius(0.8);
-          //--------- km:  eta-phi* standard custs -----------<<<
+          //--------- km:  eta-phi* Dhevan's custs ----------->>>>
+           sqpcetaphitpc[aniter]->SetPhiStarDifferenceMinimum(PhiStarDifferenceMinimum);
+            sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(EtaDifferenceMinimum);
+           //sqpcetaphitpc[aniter]->SetMinimumRadius(0.8);//not need for AliFemtoPairCutRadialDistanceKK()
+          //--------- km:  eta-phi* Dhevan's custs -----------<<<
 
          /////////sqpcetaphitpc[aniter]->SetMagneticFieldSign(1);
      //sqpcetaphitpc[aniter]->SetMagneticFieldSign(1.0);
@@ -345,11 +361,11 @@ AliFemtoManager* ConfigFemtoAnalysis() {
 //ml       sqpcetaphitpc[aniter]->SetRadialDistanceMinimum(1.2, 0.045);
 //ml       sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.016);
 
-          //--------- km:  eta-phi* standard custs ----------->>>>
-           sqpcetaphitpc[aniter]->SetPhiStarDifferenceMinimum(0.017);
-            sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.015);
-            sqpcetaphitpc[aniter]->SetMinimumRadius(0.8);
-          //--------- km:  eta-phi* standard custs -----------<<<
+          //--------- km:  eta-phi* Dhevan's custs ----------->>>>
+           sqpcetaphitpc[aniter]->SetPhiStarDifferenceMinimum(PhiStarDifferenceMinimum);
+            sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(EtaDifferenceMinimum);
+           //sqpcetaphitpc[aniter]->SetMinimumRadius(0.8);//not need for AliFemtoPairCutRadialDistanceKK()
+          //--------- km:  eta-phi* Dhevan's custs -----------<<<
 
            ////////sqpcetaphitpc[aniter]->SetMagneticFieldSign(1);
         
index 948019c..be2639b 100644 (file)
@@ -20,7 +20,8 @@ void AddTaskFlowCentralityPIDSP(Int_t centralitysel,
                               Float_t etamin=-0.8,
                               Float_t etamax=0.8,       
                                TString uniqueStr="",
-                              Int_t side      = 0 )
+                              Int_t side      = 0,
+                              Int_t filterbit=1)
 {
   // Define the range for eta subevents (for SP method)
   Double_t minA = -5;
@@ -129,7 +130,7 @@ void AddTaskFlowCentralityPIDSP(Int_t centralitysel,
 
   // POI TRACK CUTS:
   AliFlowTrackCuts* cutsPOI = new AliFlowTrackCuts("TPConlyPOI");
-//  cutsPOI->GetBayesianResponse()->ForceOldDedx(); // for 2010 data to use old TPC PID Response instead of the official one
+  cutsPOI->GetBayesianResponse()->ForceOldDedx(); // for 2010 data to use old TPC PID Response instead of the official one
   cutsPOI->SetParamType(poitype);
   cutsPOI->SetParamMix(poimix);
   cutsPOI->SetPtRange(0.0,10.);
@@ -155,7 +156,7 @@ void AddTaskFlowCentralityPIDSP(Int_t centralitysel,
   //cutsPOI->GetESDpid().GetTPCResponse().SetBetheBlochParameters(4.36414e-02,1.75977e+01,1.14385e-08,2.27907e+00,3.36699e+00);
   //cutsPOI->GetESDpid().GetTPCResponse().SetMip(49);
   cutsPOI->SetMinimalTPCdedx(10.);
-  cutsPOI->SetAODfilterBit(1);
+  cutsPOI->SetAODfilterBit(filterbit);
   cutsPOI->SetQA(doQA);
   cutsPOI->SetPriors((centrMin+centrMax)*0.5); // set priors and PID as a function of the centrality
 
index 3452f39..66c9d8b 100644 (file)
@@ -1,4 +1,4 @@
-AddTaskPidVZEROSP(Int_t centralityselection=AliVEvent::kAny,Float_t etamin=-0.8,Float_t etamax=0.8,Int_t side=0){
+AddTaskPidVZEROSP(Int_t centralityselection=AliVEvent::kAny,Float_t etamin=-0.8,Float_t etamax=0.8,Int_t side=0,Int_t filterbit=1,Bool_t TOFbeta=kFALSE){
   gROOT->LoadMacro("$ALICE_ROOT/PWGCF/FLOW/macros/AddTaskFlowCentralityPIDSP.C");
 
   const Int_t ncentr = 5;
@@ -6,15 +6,24 @@ AddTaskPidVZEROSP(Int_t centralityselection=AliVEvent::kAny,Float_t etamin=-0.8,
   Int_t cmax[ncentr]={5,10,20,30,50};
 
   for(Int_t i=0;i < ncentr;i++){
-    AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kFALSE,AliPID::kPion,AliFlowTrackCuts::kTOFbayesian,0,2,0,etamin,etamax,"",side); // no pid
-    AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kPion,AliFlowTrackCuts::kTOFbayesian,0,2,0,etamin,etamax,"",side);
-    AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kKaon,AliFlowTrackCuts::kTOFbayesian,0,2,0,etamin,etamax,"",side);
-    AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kProton,AliFlowTrackCuts::kTOFbayesian,-1,2,0,etamin,etamax,"",side);
-    AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kProton,AliFlowTrackCuts::kTOFbayesian,0,2,0,etamin,etamax,"",side);
-    AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kPion,AliFlowTrackCuts::kTPCbayesian,0,2,0,etamin,etamax,"",side);
-    AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kKaon,AliFlowTrackCuts::kTPCbayesian,0,2,0,etamin,etamax,"",side);
-    AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kProton,AliFlowTrackCuts::kTPCbayesian,-1,2,0,etamin,etamax,"",side);
-    AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kProton,AliFlowTrackCuts::kTPCbayesian,0,2,0,etamin,etamax,"",side);
+    if(!TOFbeta){
+      AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kFALSE,AliPID::kPion,AliFlowTrackCuts::kTOFbayesian,0,2,0,etamin,etamax,"",side,filterbit); // no pid
+      AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kPion,AliFlowTrackCuts::kTOFbayesian,0,2,0,etamin,etamax,"",side,filterbit);
+      AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kKaon,AliFlowTrackCuts::kTOFbayesian,0,2,0,etamin,etamax,"",side,filterbit);
+      AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kProton,AliFlowTrackCuts::kTOFbayesian,-1,2,0,etamin,etamax,"",side,filterbit);
+      AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kProton,AliFlowTrackCuts::kTOFbayesian,0,2,0,etamin,etamax,"",side,filterbit);
+    }
+    else{
+      AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kFALSE,AliPID::kPion,AliFlowTrackCuts::kTOFbeta,0,2,0,etamin,etamax,"",side,filterbit); // no pid
+      AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kPion,AliFlowTrackCuts::kTOFbeta,0,2,0,etamin,etamax,"",side,filterbit);
+      AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kKaon,AliFlowTrackCuts::kTOFbeta,0,2,0,etamin,etamax,"",side,filterbit);
+      AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kProton,AliFlowTrackCuts::kTOFbeta,-1,2,0,etamin,etamax,"",side,filterbit);
+      AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kProton,AliFlowTrackCuts::kTOFbeta,0,2,0,etamin,etamax,"",side,filterbit);
+    }
+    AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kPion,AliFlowTrackCuts::kTPCbayesian,0,2,0,etamin,etamax,"",side,filterbit);
+    AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kKaon,AliFlowTrackCuts::kTPCbayesian,0,2,0,etamin,etamax,"",side,filterbit);
+    AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kProton,AliFlowTrackCuts::kTPCbayesian,-1,2,0,etamin,etamax,"",side,filterbit);
+    AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kProton,AliFlowTrackCuts::kTPCbayesian,0,2,0,etamin,etamax,"",side,filterbit);
   }
 }
 
index ee478bf..32fdf43 100644 (file)
@@ -1,4 +1,4 @@
-AddTaskPidVZEROSP_2(Int_t centralityselection=AliVEvent::kAny,Float_t etamin=-0.8,Float_t etamax=0.8,Int_t side=0){
+AddTaskPidVZEROSP_2(Int_t centralityselection=AliVEvent::kAny,Float_t etamin=-0.8,Float_t etamax=0.8,Int_t side=0,Int_t filterbit=1,Bool_t TOFbeta=kFALSE){
   gROOT->LoadMacro("$ALICE_ROOT/PWGCF/FLOW/macros/AddTaskFlowCentralityPIDSP.C");
 
   const Int_t ncentr = 4;
@@ -6,15 +6,24 @@ AddTaskPidVZEROSP_2(Int_t centralityselection=AliVEvent::kAny,Float_t etamin=-0.
   Int_t cmax[ncentr]={40,60,70,80};
 
   for(Int_t i=0;i < ncentr;i++){
-    AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kFALSE,AliPID::kPion,AliFlowTrackCuts::kTOFbayesian,0,2,0,etamin,etamax,"",side); // no pid
-    AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kPion,AliFlowTrackCuts::kTOFbayesian,0,2,0,etamin,etamax,"",side);
-    AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kKaon,AliFlowTrackCuts::kTOFbayesian,0,2,0,etamin,etamax,"",side);
-    AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kProton,AliFlowTrackCuts::kTOFbayesian,-1,2,0,etamin,etamax,"",side);
-    AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kProton,AliFlowTrackCuts::kTOFbayesian,0,2,0,etamin,etamax,"",side);
-    AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kPion,AliFlowTrackCuts::kTPCbayesian,0,2,0,etamin,etamax,"",side);
-    AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kKaon,AliFlowTrackCuts::kTPCbayesian,0,2,0,etamin,etamax,"",side);
-    AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kProton,AliFlowTrackCuts::kTPCbayesian,-1,2,0,etamin,etamax,"",side);
-    AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kProton,AliFlowTrackCuts::kTPCbayesian,0,2,0,etamin,etamax,"",side);
+    if(!TOFbeta){
+      AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kFALSE,AliPID::kPion,AliFlowTrackCuts::kTOFbayesian,0,2,0,etamin,etamax,"",side,filterbit); // no pid
+      AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kPion,AliFlowTrackCuts::kTOFbayesian,0,2,0,etamin,etamax,"",side,filterbit);
+      AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kKaon,AliFlowTrackCuts::kTOFbayesian,0,2,0,etamin,etamax,"",side,filterbit);
+      AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kProton,AliFlowTrackCuts::kTOFbayesian,-1,2,0,etamin,etamax,"",side,filterbit);
+      AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kProton,AliFlowTrackCuts::kTOFbayesian,0,2,0,etamin,etamax,"",side,filterbit);
+    }
+    else{
+      AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kFALSE,AliPID::kPion,AliFlowTrackCuts::kTOFbeta,0,2,0,etamin,etamax,"",side,filterbit); // no pid
+      AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kPion,AliFlowTrackCuts::kTOFbeta,0,2,0,etamin,etamax,"",side,filterbit);
+      AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kKaon,AliFlowTrackCuts::kTOFbeta,0,2,0,etamin,etamax,"",side,filterbit);
+      AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kProton,AliFlowTrackCuts::kTOFbeta,-1,2,0,etamin,etamax,"",side,filterbit);
+      AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kProton,AliFlowTrackCuts::kTOFbeta,0,2,0,etamin,etamax,"",side,filterbit);
+    }
+    AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kPion,AliFlowTrackCuts::kTPCbayesian,0,2,0,etamin,etamax,"",side,filterbit);
+    AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kKaon,AliFlowTrackCuts::kTPCbayesian,0,2,0,etamin,etamax,"",side,filterbit);
+    AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kProton,AliFlowTrackCuts::kTPCbayesian,-1,2,0,etamin,etamax,"",side,filterbit);
+    AddTaskFlowCentralityPIDSP(centralityselection,cmin[i],cmax[i],"AnalysisResults",kTRUE,AliPID::kProton,AliFlowTrackCuts::kTPCbayesian,0,2,0,etamin,etamax,"",side,filterbit);
   }
 }
 
index bb3abe1..11af2c9 100644 (file)
@@ -43,6 +43,7 @@ set ( CLASS_HDRS
     AliAnalysisTaskDStarCorrelations.h
     AliAnalysisTaskSED0Correlations.h
     AliAnalysisTaskSEDplusCorrelations.h
+    AliAnalysisTaskSEmcCorr.h  
     )
 
 string ( REPLACE ".h" ".cxx" MODULE_SRCS "${CLASS_HDRS}" )
index 407230c..0710de7 100644 (file)
@@ -82,7 +82,6 @@ set (SRCS
     hfe/AliHFEdebugTreeTask.cxx
     hfe/AliHFEVZEROEventPlane.cxx
     hfe/AliAnalysisTaskFlowTPCTOFEPSP.cxx
-    hfe/AliAnalysisTaskFlowTPCTOFQCSP.cxx
     hfe/AliSelectNonHFE.cxx
     hfe/AliHFENonPhotonicElectron.cxx
     hfe/AliHFEdebugTreeTaskAOD.cxx
@@ -99,6 +98,7 @@ set (SRCS
     hfe/AliHFEreducedTrack.cxx
     hfe/AliHFEreducedMCParticle.cxx
     hfe/AliAnalysisTaskHFEQA.cxx
+    hfe/AliAnalysisTaskFlowITSTPCTOFQCSP.cxx
     )
 
 string (REPLACE ".cxx" ".h" HDRS "${SRCS}")
index 1b32bf3..3ce4554 100644 (file)
@@ -77,7 +77,6 @@
 
 #pragma link C++ class  AliHFEVZEROEventPlane+;
 #pragma link C++ class  AliAnalysisTaskFlowTPCTOFEPSP+;
-#pragma link C++ class  AliAnalysisTaskFlowTPCTOFQCSP+;
 
 #pragma link C++ class  AliSelectNonHFE+;
 #pragma link C++ class  AliHFENonPhotonicElectron+;
@@ -97,5 +96,6 @@
 #pragma link C++ class  AliHFEreducedTrack+;
 #pragma link C++ class  AliHFEreducedMCParticle+;
 #pragma link C++ class  AliAnalysisTaskHFEQA+;
+#pragma link C++ class  AliAnalysisTaskFlowITSTPCTOFQCSP+;
 
 #endif
diff --git a/PWGHF/correlationHF/AliAnalysisTaskSEmcCorr.cxx b/PWGHF/correlationHF/AliAnalysisTaskSEmcCorr.cxx
new file mode 100644 (file)
index 0000000..42b7133
--- /dev/null
@@ -0,0 +1,685 @@
+/**************************************************************************
+ * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/////////////////////////////////////////////////////////////
+//
+// Class AliAnalysisTaskSECharmFraction
+// AliAnalysisTaskSE for the extraction of the fraction of prompt charm
+// using the charm hadron impact parameter to the primary vertex
+//
+// Author: Andrea Rossi, andrea.rossi@pd.infn.it
+/////////////////////////////////////////////////////////////
+
+
+#include <TH1F.h>
+#include <TH2F.h>
+#include <TAxis.h>
+#include <THnSparse.h>
+#include <TDatabasePDG.h>
+#include <TMath.h>
+#include <TROOT.h>
+#include <TArrayI.h>
+#include "AliAODEvent.h"
+#include "AliAODRecoDecayHF2Prong.h"
+#include "AliAODRecoDecayHF.h"
+#include "AliAODRecoDecay.h"
+#include "AliAnalysisDataSlot.h"
+#include "AliAnalysisDataContainer.h"
+#include "AliAODTrack.h"
+#include "AliAODHandler.h"
+#include "AliESDtrack.h"
+#include "AliAODVertex.h"
+#include "AliESDVertex.h"
+#include "AliVertexerTracks.h"
+#include "AliAODMCParticle.h"
+#include "AliAODPid.h"
+#include "AliTPCPIDResponse.h"
+#include "AliAODMCHeader.h"
+#include "AliAnalysisVertexingHF.h"
+#include "AliRDHFCutsD0toKpi.h"
+#include "AliAODInputHandler.h"
+#include "AliAnalysisManager.h"
+#include "AliNormalizationCounter.h"
+//#include "/Users/administrator/ALICE/CHARM/HFCJ/TestsForProduction/AliAnalysisTaskSEmcCorr.h"
+#include "AliAnalysisTaskSEmcCorr.h"
+
+class TCanvas;
+class TTree;
+class TChain;
+class AliAnalysisTaskSE;
+
+
+ClassImp(AliAnalysisTaskSEmcCorr)
+
+AliAnalysisTaskSEmcCorr::AliAnalysisTaskSEmcCorr() 
+: AliAnalysisTaskSE(),
+  fReadMC(kTRUE),
+  fOnlyKine(kTRUE),
+  fDoHadronHadron(kFALSE),
+  fNentries(0),
+  fhNprongsD0(0),
+  fhNprongsD0chargedOnly(0),
+  fhNprongsD0chargedRef(0),
+  fYrangeTrig(0.5),
+  fEtarangeEleTrig(0.8),
+  fminDpt(1.),
+  fArrayDaugh(0x0),
+  flastdaugh(0),
+  fArrayAssoc(0x0),
+  fLastAss(0),
+  fminPtass(0.3),
+  fmaxEtaAss(99.),
+  fhMCcorrel(0x0),
+  fhMCtrigPart(0x0),
+  fhMChadroncorrel(0x0),
+  fhMChadrontrigPart(0x0)
+{// standard constructor
+  
+}
+
+
+
+//________________________________________________________________________
+AliAnalysisTaskSEmcCorr::AliAnalysisTaskSEmcCorr(const char *name) 
+  : AliAnalysisTaskSE(name),
+    fReadMC(kTRUE),
+    fOnlyKine(kTRUE),
+    fDoHadronHadron(kFALSE),
+    fNentries(0),
+    fhNprongsD0(0),
+    fhNprongsD0chargedOnly(0),
+    fhNprongsD0chargedRef(0),
+    fYrangeTrig(0.5),
+    fEtarangeEleTrig(0.8),
+    fminDpt(1.),
+    fArrayDaugh(0x0),
+    flastdaugh(0),
+    fArrayAssoc(0x0),
+    fLastAss(0),
+    fminPtass(0.3),
+    fmaxEtaAss(99.),
+    fhMCcorrel(0x0),
+    fhMCtrigPart(0x0),
+    fhMChadroncorrel(0x0),
+    fhMChadrontrigPart(0x0)
+{ // default constructor
+  
+  DefineOutput(1, TH1F::Class());
+  DefineOutput(2, TH1F::Class());
+  DefineOutput(3, TH1F::Class());
+  DefineOutput(4, TH1F::Class());
+  DefineOutput(5, THnSparseF::Class());
+  DefineOutput(6, THnSparseF::Class());
+  DefineOutput(7, THnSparseF::Class());
+  DefineOutput(8, THnSparseF::Class());
+
+}
+
+//________________________________________________________________________
+AliAnalysisTaskSEmcCorr::~AliAnalysisTaskSEmcCorr(){
+  // destructor
+  delete fNentries;
+  delete fhNprongsD0;
+  delete fhNprongsD0chargedOnly;
+  delete fhNprongsD0chargedRef;
+  delete fhMCcorrel;
+  delete fhMCtrigPart;
+  delete fhMChadroncorrel;
+  delete fhMChadrontrigPart;
+  delete fArrayDaugh;
+  delete fArrayAssoc;
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskSEmcCorr::Init()
+{
+  // Initialization
+  fArrayDaugh=new TArrayI(20);
+
+  fArrayAssoc=new TArrayI(200);
+
+}
+
+
+//________________________________________________________________________
+void AliAnalysisTaskSEmcCorr::UserCreateOutputObjects(){
+  if(!fArrayDaugh)  fArrayDaugh=new TArrayI(20);
+
+  if(!fArrayAssoc)fArrayAssoc=new TArrayI(200);
+
+  fNentries=new TH1F("nentriesChFr", "Analyzed sample properties", 21,0.5,21.5);
+  fNentries->GetXaxis()->SetBinLabel(1,"nEventsAnal");
+  fNentries->GetXaxis()->SetBinLabel(2,"nEvSel");
+  fNentries->GetXaxis()->SetBinLabel(3,"nEvPile-up Rej");
+  fNentries->GetXaxis()->SetBinLabel(4,"nEvGoodVtxS");
+  fNentries->GetXaxis()->SetBinLabel(5,"nEvRejVtxZ");
+  fNentries->GetXaxis()->SetBinLabel(6,"nD0");
+
+  fhNprongsD0=new TH1F("fhNprongsD0","fhNprongsD0",20,-0.5,19.5);
+  fhNprongsD0chargedOnly=new TH1F("fhNprongsD0chargedOnly","fhNprongsD0chargedOnly",20,-0.5,19.5);
+  fhNprongsD0chargedRef=new TH1F("fhNprongsD0chargedRef","fhNprongsD0chargedRef",20,-0.5,19.5);
+
+
+  Int_t nbinsCorrMC[8]={15,20.,20,20,50,63,20,11};
+  Double_t binlowCorrMC[8]={-7.5,0.,-1.,0.,-5.,-0.5*TMath::Pi(),-2,-1.5};
+  Double_t binupCorrMC[8]={7.5,20.,1.,2.,5.,1.5*TMath::Pi(),2.,9.5};
+  fhMCcorrel=new THnSparseF("fhMCcorrel","fhMCcorrel;pdg;ptTrig;etaTrig;ptAss;etaAss;deltaPhi;deltaEta;pdgAss;",8,nbinsCorrMC,binlowCorrMC,binupCorrMC);
+
+  Int_t nbinsTrigMC[3]={15,20.,20};
+  Double_t binlowTrigMC[3]={-7.5,0.,-1.};
+  Double_t binupTrigMC[3]={7.5,20.,1.};
+  fhMCtrigPart=new THnSparseF("fhMCtrigPart","fhMCcorrel;pdg;ptTrig;etaTrig;",3,nbinsTrigMC,binlowTrigMC,binupTrigMC);
+
+
+  Int_t nbinsCorrMChadron[8]={6,20.,20,20,50,63,20,7};
+  Double_t binlowCorrMChadron[8]={-1.5,0.,-1.,0.,-5.,-0.5*TMath::Pi(),-2,-1.5};
+  Double_t binupCorrMChadron[8]={4.5,20.,1.,2.,5.,1.5*TMath::Pi(),2.,5.5};
+  fhMChadroncorrel=new THnSparseF("fhMChadroncorrel","fhMChadroncorrel;pdg;ptTrig;etaTrig;ptAss;etaAss;deltaPhi;deltaEta;pdgAss;",8,nbinsCorrMChadron,binlowCorrMChadron,binupCorrMChadron);
+
+  Int_t nbinsTrigMChadron[3]={6,20.,20};
+  Double_t binlowTrigMChadron[3]={-1.5,0.,-1.};
+  Double_t binupTrigMChadron[3]={4.5,20.,1.};
+  fhMChadrontrigPart=new THnSparseF("fhMChadrontrigPart","fhMChadroncorrel;pdg;ptTrig;etaTrig;",3,nbinsTrigMChadron,binlowTrigMChadron,binupTrigMChadron);
+  
+
+  PostData(1,fNentries);
+  PostData(2,fhNprongsD0);
+  PostData(3,fhNprongsD0chargedOnly);
+  PostData(4,fhNprongsD0chargedRef);
+  PostData(5,fhMCcorrel);
+  PostData(6,fhMCtrigPart);
+  PostData(7,fhMChadroncorrel);
+  PostData(8,fhMChadrontrigPart);
+}
+
+
+
+//________________________________________________________________________
+void AliAnalysisTaskSEmcCorr::UserExec(Option_t */*option*/){
+
+
+
+  // Execute analysis for current event:
+  // heavy flavor candidates association to MC truth
+  
+  AliAODEvent *aod = dynamic_cast<AliAODEvent*> (InputEvent());
+  if (!aod) {
+    Printf("ERROR: aod not available");
+    return;
+  }
+
+
+  if(!aod)return;
+
+  fNentries->Fill(1);
+
+  // AOD primary vertex
+  
+  
+  if(!fOnlyKine){
+    AliAODVertex *vtx1 = (AliAODVertex*)aod->GetPrimaryVertex();
+    TString primTitle = vtx1->GetTitle();
+    if(primTitle.Contains("VertexerTracks") && vtx1->GetNContributors()>0) { 
+      
+      fNentries->Fill(3);
+      
+    }
+    else {
+      PostData(1,fNentries);
+      return;
+      
+    }
+  }
+
+
+  TClonesArray *arrayMC=0x0;
+  AliAODMCHeader *aodmcHeader=0x0;
+  Double_t vtxTrue[3];
+  
+  if(fReadMC){
+    //    aod->GetList()->Print();
+    // load MC particles
+    arrayMC = 
+      (TClonesArray*)aod->GetList()->At(23);//FindObject("mcparticles");
+    if(!arrayMC) {
+      Printf("AliAnalysisTaskSEmcCorr::UserExec: MC particles branch not found!\n");
+      fNentries->Fill(2);
+      PostData(1,fNentries);
+      return;
+    }
+    // load MC header
+    aodmcHeader = 
+      (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName());
+    if(!aodmcHeader) {
+      Printf("AliAnalysisTaskSEmcCorr::UserExec: MC header branch not found!\n");
+            fNentries->Fill(3);
+      PostData(1,fNentries);
+      return;
+    }
+    fNentries->Fill(4);
+    //    printf("N MC entries: %d \n",arrayMC->GetEntriesFast());
+    // MC primary vertex
+    aodmcHeader->GetVertex(vtxTrue);
+
+    // FILL HISTOS FOR D0 mesons, c quarks and D0 from B properties
+    SelectAssociatedParticles(arrayMC);
+    for(Int_t jp=0;jp<arrayMC->GetEntriesFast();jp++){
+
+      AliAODMCParticle *part=(AliAODMCParticle*)arrayMC->At(jp);
+      Int_t pdg=TMath::Abs(part->GetPdgCode());
+
+      if(pdg==421||pdg==411||pdg==413){
+
+       if(TMath::Abs(part->Y())>fYrangeTrig)continue;
+       if(TMath::Abs(part->Pt())<fminDpt)continue;
+       FillSkipParticleArray(part,arrayMC,jp);
+       FillCorrelationPlots(part,arrayMC);
+       
+
+      }
+      else if(pdg==11){
+
+       if(TMath::Abs(part->Eta())>fEtarangeEleTrig)continue;
+       if(TMath::Abs(part->Pt())<fminDpt)continue;
+       FillSkipParticleArray(part,arrayMC,jp);
+       FillCorrelationPlots(part,arrayMC);
+
+
+      }       
+
+      // NOW STUDY OF N-PRONGS
+      if(pdg==421){
+       Bool_t semilept=kFALSE;
+       Int_t nprongsD0=0;
+       Int_t nprongsD0charged=0;
+
+       Int_t lab1=part->GetDaughter(0);
+       Int_t lab2=part->GetDaughter(1);
+       if(lab1>=0&&lab2>=0){
+         for(Int_t jd=lab1;jd<=lab2;jd++){
+           AliAODMCParticle *d=(AliAODMCParticle*)arrayMC->At(jd);
+           Int_t pdgd=TMath::Abs(d->GetPdgCode());
+           if(pdgd>=11&&pdgd<=16){
+             semilept=kTRUE;      
+             break;
+           }
+           if(pdgd==211||pdgd==111||pdgd==321||pdgd==311||pdgd==310||pdgd==130){
+             nprongsD0++;
+           }
+           if(pdgd==211||pdgd==321){
+             nprongsD0charged++;
+           }       
+           else{           
+             Int_t lab1d=d->GetDaughter(0);
+             Int_t lab2d=d->GetDaughter(1);
+             if(lab1d>=0&&lab2d>=0){
+               for(Int_t jdd=lab1d;jdd<=lab2d;jdd++){
+                 AliAODMCParticle *dd=(AliAODMCParticle*)arrayMC->At(jdd);
+                 Int_t pdgdd=TMath::Abs(dd->GetPdgCode());
+                 if(pdgdd==211||pdgdd==111||pdgdd==321||pdgdd==311||pdgdd==310||pdgdd==130){
+                   nprongsD0++;
+                 }
+                 if(pdgd==211||pdgd==321){
+                   nprongsD0charged++;
+                 } 
+               }
+             }
+           }
+         }
+       }         
+       if(!semilept){
+         fhNprongsD0->Fill(nprongsD0);
+         fhNprongsD0chargedOnly->Fill(nprongsD0charged);
+         fhNprongsD0chargedRef->Fill(nprongsD0charged);
+       }
+      }
+
+    }
+    
+    if(fDoHadronHadron){
+      for(Int_t jp=0;jp<fLastAss;jp++){
+       
+       AliAODMCParticle *part=(AliAODMCParticle*)arrayMC->At(fArrayAssoc->At(jp));
+       Int_t pdg=TMath::Abs(part->GetPdgCode());      
+       if(pdg==11||pdg==13||pdg==211||pdg==2212||pdg==321){
+         if(TMath::Abs(part->Eta())>fEtarangeEleTrig)continue;
+         if(TMath::Abs(part->Pt())<fminDpt)continue;
+         FillSkipParticleArray(part,arrayMC,fArrayAssoc->At(jp));
+         FillCorrelationPlotsHadrons(part,arrayMC);
+       }
+      }
+      
+    }
+    
+  }
+  
+
+  PostData(1,fNentries);
+  PostData(2,fhNprongsD0);
+  PostData(3,fhNprongsD0chargedOnly);
+  PostData(4,fhNprongsD0chargedRef);
+  PostData(5,fhMCcorrel);
+  PostData(6,fhMCtrigPart);
+  PostData(7,fhMChadroncorrel);
+  PostData(8,fhMChadrontrigPart);
+}
+
+
+
+void AliAnalysisTaskSEmcCorr::FillSkipParticleArray(AliAODMCParticle *part,TClonesArray *arrayMC,Int_t partPos){
+  fArrayDaugh->Reset(0);
+  fArrayDaugh->AddAt(partPos,0);
+  flastdaugh=1;
+  
+  // Loop on daughters and nephews
+  if(part->GetNDaughters()>0){
+    Int_t pos1=part->GetDaughter(0);
+    Int_t pos2=part->GetDaughter(1);
+    if(pos2<0)pos2=pos1;
+    if(pos1>=0){
+      for(Int_t jd=pos1;jd<=pos2;jd++){ 
+       AliAODMCParticle *pd=(AliAODMCParticle*)arrayMC->At(jd);
+       Int_t pdgd=TMath::Abs(pd->GetPdgCode());
+       if(pdgd==11||pdgd==13||pdgd==211||pdgd==321||pdgd==2212){
+         fArrayDaugh->AddAt(jd,flastdaugh);
+         flastdaugh++;
+       }
+       else if(pdgd!=12&&pdgd!=14&&pdgd!=16&&pdgd!=310&&pdgd!=111){// CHECK NEPHEWS (FOR RESONANT CHANNELS)
+         Int_t nephw=pd->GetNDaughters();
+         if(nephw>0){
+           Int_t posN1=pd->GetDaughter(0);
+           Int_t posN2=pd->GetDaughter(1);
+           if(posN2<0)posN2=posN1;
+           if(posN1>=0){
+             for(Int_t jN=posN1;jN<=posN2;jN++){ 
+               AliAODMCParticle *pN=(AliAODMCParticle*)arrayMC->At(jN);
+               Int_t pdgN=TMath::Abs(pN->GetPdgCode());
+               if(pdgN==11||pdgN==13||pdgN==211||pdgN==321||pdgN==2212){
+                 fArrayDaugh->AddAt(jN,flastdaugh);
+                 flastdaugh++;
+               }
+               else if(pdgN!=12&&pdgN!=14&&pdgN!=16&&pdgN!=310&&pdgN!=111){// CHECK one step more (FOR RESONANT CHANNELS)       
+                 
+                 Int_t gnephw=pN->GetNDaughters();
+                 if(gnephw>0){
+                   Int_t posGN1=pN->GetDaughter(0);
+                   Int_t posGN2=pN->GetDaughter(1);
+                   if(posGN2<0)posGN2=posGN1;
+                   if(posGN1>=0){
+                     for(Int_t jGN=posGN1;jGN<=posGN2;jGN++){ 
+                       AliAODMCParticle *pGN=(AliAODMCParticle*)arrayMC->At(jGN);
+                       Int_t pdgGN=TMath::Abs(pGN->GetPdgCode());
+                       if(pdgGN==11||pdgGN==13||pdgGN==211||pdgGN==321||pdgGN==2212){
+                         fArrayDaugh->AddAt(jGN,flastdaugh);
+                         flastdaugh++;                  
+                       }
+                     }
+                   }
+                 }
+               }
+             }
+           }
+         }
+       }
+      }
+    } 
+  }
+  //  printf("particles to be skipped %d\n",flastdaugh++);
+}
+
+void AliAnalysisTaskSEmcCorr::SelectAssociatedParticles(TClonesArray *arrayMC){
+  fLastAss=0;
+  fArrayAssoc->Reset(0);
+  Double_t pt,eta;
+  for(Int_t jAss=0;jAss<arrayMC->GetEntriesFast();jAss++){
+    AliAODMCParticle *partAss=(AliAODMCParticle*)arrayMC->At(jAss);
+    Int_t pdgAss=TMath::Abs(partAss->GetPdgCode());
+    if(pdgAss==11||pdgAss==13||pdgAss==211||pdgAss==321||pdgAss==2212){// check type: keep only e,mu,pi,K+,protons
+      pt=partAss->Pt();
+      eta=TMath::Abs(partAss->Eta());
+      if(pt<fminPtass)continue;
+      if(eta>fmaxEtaAss)continue;
+      if(!partAss->IsPhysicalPrimary()){
+       if(pdgAss!=11)  continue;// keep ele
+      }
+      fArrayAssoc->AddAt(jAss,fLastAss);
+      fLastAss++;
+    }
+  }  
+  //  printf("n ass part: %d\n",fLastAss++);
+}
+
+void AliAnalysisTaskSEmcCorr::FillCorrelationPlots(AliAODMCParticle *part,TClonesArray *arrayMC){
+  
+
+  Bool_t hasToSkip=kFALSE;  
+  Int_t index=0,softpi=-1;
+  Int_t pdgTrig=TMath::Abs(part->GetPdgCode());
+  if(pdgTrig==421){
+    pdgTrig=1;
+  }
+  else if(pdgTrig==411){
+    pdgTrig=2;
+  }
+  else if(pdgTrig==413){
+    pdgTrig=3;
+  }
+  else if(pdgTrig==11){
+    
+    pdgTrig=4;
+  }
+  else pdgTrig=0;
+  // check if it is prompt or from B and, for electrons the origin
+  Int_t labmum=part->GetMother();
+  if(labmum>=0){
+    AliAODMCParticle *moth=(AliAODMCParticle*)arrayMC->At(labmum);
+    Int_t pdgmum=TMath::Abs(moth->GetPdgCode());
+    if(pdgTrig==4){// for electrons go to the parent hadron
+      //      labmum=part->GetMother();
+      //      moth=(AliAODMCParticle*)arrayMC->At(labmum);
+      //      pdgmum=TMath::Abs(moth->GetPdgCode());
+      if(!(pdgmum==5||pdgmum==4||(400<pdgmum&&pdgmum<600)||(4000<pdgmum&&pdgmum<6000))){// NON HF electron
+       if(pdgmum==22){// GAMMA CONV
+         pdgTrig=5;
+       }
+       else if(pdgmum==111||pdgmum==113||pdgmum==221||pdgmum==223){ //DALITZ DECAY
+         pdgTrig=6;
+       }
+       else pdgTrig=7;
+      }
+    }
+    if(pdgmum==413){ // D from Dstar: check soft pion  and go to the grandmother
+      if(pdgTrig==1){
+       for(Int_t isp=moth->GetDaughter(0);isp<=moth->GetDaughter(1);isp++){
+         AliAODMCParticle *sfp=(AliAODMCParticle*)arrayMC->At(isp);
+         Int_t pdgsp=TMath::Abs(sfp->GetPdgCode());
+         if(pdgsp==211)softpi=isp;
+       }
+      }
+      labmum=moth->GetMother();
+      moth=(AliAODMCParticle*)arrayMC->At(labmum);
+      pdgmum=TMath::Abs(moth->GetPdgCode());
+    }
+    else if(pdgmum==423){// D*0 -> go to the mother
+      labmum=moth->GetMother();
+      moth=(AliAODMCParticle*)arrayMC->At(labmum);
+      pdgmum=TMath::Abs(moth->GetPdgCode());
+    }
+    if(pdgmum==5||(500<pdgmum&&pdgmum<600)||(5000<pdgmum&&pdgmum<6000)){
+      pdgTrig*=-1;
+    }
+    else if(pdgmum==4){
+      labmum=moth->GetMother();
+      if(labmum>=0){
+       moth=(AliAODMCParticle*)arrayMC->At(labmum);
+       pdgmum=TMath::Abs(moth->GetPdgCode());
+       if(pdgmum==5||(500<pdgmum&&pdgmum<600)||(5000<pdgmum&&pdgmum<6000)){
+         //      Printf("c quark from b quark");
+         pdgTrig*=-1;
+       }   
+      }
+    }
+    else {
+      //      printf("Charm not from charm or beauty \n");
+    }
+  }
+  Double_t phiTrig=part->Phi();
+  Double_t etaTrig=part->Eta();
+  Double_t deltaPhi;
+  Double_t point[8]={pdgTrig,part->Pt(),etaTrig,0,0,0,0,0};//pdg,ptTrig,etaTrig,ptAss,etaAss,deltaPhi,deltaEta,pdgAss
+  fhMCtrigPart->Fill(point);
+  for(Int_t jAss=0;jAss<fLastAss;jAss++){
+    index=fArrayAssoc->At(jAss);
+    hasToSkip=kFALSE;  
+      for(Int_t jd=0;jd<flastdaugh;jd++){
+       if(index==fArrayDaugh->At(jd)){
+         hasToSkip=kTRUE;  
+         break;
+       }
+      }
+      if(hasToSkip)continue;
+      AliAODMCParticle *partAss=(AliAODMCParticle*)arrayMC->At(index);
+      point[3]=partAss->Pt();
+      point[4]=partAss->Eta();
+      deltaPhi=partAss->Phi()-phiTrig;
+      if(deltaPhi<-0.5*TMath::Pi())deltaPhi+=2.*TMath::Pi();
+      else if(deltaPhi>1.5*TMath::Pi())deltaPhi-=2.*TMath::Pi();
+      point[5]=deltaPhi;
+      point[6]=partAss->Eta()-etaTrig;      
+      UInt_t pdgassmum=TMath::Abs(partAss->GetPdgCode());
+      if(index==softpi){
+       point[7]=-1;
+      }
+      else if(pdgassmum==11){
+       if(partAss->IsPhysicalPrimary())point[7]=1;
+       Int_t elemum=partAss->GetMother();
+       if(elemum>0){
+         AliAODMCParticle *partEleMum=(AliAODMCParticle*)arrayMC->At(elemum);
+         UInt_t pdgelemum=TMath::Abs(partEleMum->GetPdgCode());
+         if(pdgelemum==111||pdgelemum==113||pdgelemum==221||pdgelemum==223){// DALITZ DECAY
+           point[7]=6;
+         }
+         else if(pdgelemum==22){// GAMMA CONV
+           point[7]=7;
+         }
+         else if(pdgelemum==4||pdgelemum==5||(pdgelemum>400&&pdgelemum<600)||(pdgelemum>4000&&pdgelemum<6000)){// HF e
+           point[7]=8;
+         }
+         else point[7]=9;
+       }
+      }
+      else if(pdgassmum==13){
+       point[7]=2;
+      }
+      else if(pdgassmum==211){
+       point[7]=3;
+      }
+      else if(pdgassmum==321){
+       point[7]=4;
+      }
+      else if(pdgassmum==2212){
+       point[7]=5;
+      }
+      else point[7]=0;
+
+      fhMCcorrel->Fill(point);
+  }
+
+}
+
+
+
+//______________________________________________________________
+void AliAnalysisTaskSEmcCorr::FillCorrelationPlotsHadrons(AliAODMCParticle *part,TClonesArray *arrayMC){
+  
+
+  Bool_t hasToSkip=kFALSE;  
+  Int_t index=0;
+  Int_t pdgTrig=TMath::Abs(part->GetPdgCode());
+  if(pdgTrig==11){
+    pdgTrig=0;
+  }
+  else if(pdgTrig==13){
+    pdgTrig=1;
+  }
+  else if(pdgTrig==211){
+    pdgTrig=2;
+  }
+  else if(pdgTrig==321){
+    pdgTrig=3;
+  }
+  else if(pdgTrig==2212){
+    pdgTrig=4;
+  }
+  else pdgTrig=-1;
+  
+  
+  Double_t phiTrig=part->Phi();
+  Double_t etaTrig=part->Eta();
+  Double_t deltaPhi;
+  Double_t point[8]={pdgTrig,part->Pt(),etaTrig,0,0,0,0,0};//pdg,ptTrig,etaTrig,ptAss,etaAss,deltaPhi,deltaEta,pdgAss
+  fhMChadrontrigPart->Fill(point);
+  for(Int_t jAss=0;jAss<fLastAss;jAss++){
+    index=fArrayAssoc->At(jAss);
+    hasToSkip=kFALSE;  
+    for(Int_t jd=0;jd<flastdaugh;jd++){
+      if(index==fArrayDaugh->At(jd)){
+       hasToSkip=kTRUE;  
+       break;
+      }
+    }
+    if(hasToSkip)continue;
+    AliAODMCParticle *partAss=(AliAODMCParticle*)arrayMC->At(index);
+    point[3]=partAss->Pt();
+    if(point[3]>point[1])continue;
+    point[4]=partAss->Eta();
+    deltaPhi=partAss->Phi()-phiTrig;
+    if(deltaPhi<-0.5*TMath::Pi())deltaPhi+=2.*TMath::Pi();
+    else if(deltaPhi>1.5*TMath::Pi())deltaPhi-=2.*TMath::Pi();
+    point[5]=deltaPhi;
+    point[6]=partAss->Eta()-etaTrig;
+    point[7]=TMath::Abs(partAss->GetPdgCode());
+    if(point[7]==11){
+      point[7]=0;
+    }
+    else if(point[7]==13){
+      point[7]=1;
+    }
+    else if(point[7]==211){
+      point[7]=2;
+    }
+    else if(point[7]==321){
+      point[7]=3;
+    }
+    else if(point[7]==2212){
+      point[7]=4;
+    }
+    else point[7]=-1;
+    
+    fhMChadroncorrel->Fill(point);
+  }
+}
+
+//_______________________________________________________________
+void AliAnalysisTaskSEmcCorr::Terminate(const Option_t*){
+  //TERMINATE METHOD: NOTHING TO DO
+
+
+
+}
+
diff --git a/PWGHF/correlationHF/AliAnalysisTaskSEmcCorr.h b/PWGHF/correlationHF/AliAnalysisTaskSEmcCorr.h
new file mode 100644 (file)
index 0000000..3967894
--- /dev/null
@@ -0,0 +1,82 @@
+#ifndef ALIANALYSISTASKSEMCCORR_H
+#define ALIANALYSISTASKSEMCORR_H
+
+/* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+//*************************************************************************
+// Class AliAnalysisTaskSECharmFraction
+// AliAnalysisTask for the extraction of the fraction of prompt charm
+// using the charm hadron impact parameter to the primary vertex
+//
+//
+// Author: Andrea Rossi andrea.rossi@pd.infn.it
+//*************************************************************************
+
+class TH1F;
+class TH2F;
+class TClonesArray;
+class AliAODDEvent;
+class AliAODMCHeader;
+class AliAODRecoDecayHF2Prong;
+class AliAODRecoDecayHF;
+class AliAODMCParticle;
+class AliAnalysisVertexingHF;
+class AliRDHFCutsD0toKpi;
+class AliNormalizationCounter;
+
+#include "AliAnalysisTaskSE.h"
+
+class AliAnalysisTaskSEmcCorr : public AliAnalysisTaskSE {
+ public:
+  AliAnalysisTaskSEmcCorr();
+  AliAnalysisTaskSEmcCorr(const char* name);
+  virtual ~AliAnalysisTaskSEmcCorr();
+
+ // Implementation of interface methods
+  virtual void UserCreateOutputObjects();
+  virtual void Init();
+  virtual void LocalInit() {Init();}
+  virtual void UserExec(Option_t *option);
+  virtual void Terminate(Option_t *option);  
+  void SetReadMC(Bool_t readMC){fReadMC=readMC;}
+  void SetKineOnly(Bool_t readKineOnly){fOnlyKine=readKineOnly;}
+  void DoHadronHadron(Bool_t dohh){fDoHadronHadron=dohh;}
+  void SetMinPtD(Double_t ptmin){fminDpt=ptmin;}
+  void SetMaxYtrigger(Double_t maxy){fYrangeTrig=maxy;}
+  void SetMaxEtaEleTrigger(Double_t maxeta){fEtarangeEleTrig=maxeta;}
+  void SelectAssociatedParticles(TClonesArray *arrayMC);
+  void SetEtaMaxAssPart(Double_t eta){fmaxEtaAss=eta;}
+  void FillCorrelationPlots(AliAODMCParticle *part,TClonesArray *arrayMC);
+  void FillCorrelationPlotsHadrons(AliAODMCParticle *part,TClonesArray *arrayMC);
+  void FillSkipParticleArray(AliAODMCParticle *part,TClonesArray *arrayMC,Int_t partPos);
+
+ private:
+  AliAnalysisTaskSEmcCorr(const AliAnalysisTaskSEmcCorr&); // copy constructo not implemented yet
+  AliAnalysisTaskSEmcCorr& operator=(const AliAnalysisTaskSEmcCorr&); // assignment operator not implemented yet
+  Bool_t fReadMC;                            // read MC flag
+  Bool_t fOnlyKine;                          // kine only
+  Bool_t fDoHadronHadron;                    // flag to activate h-h correlation
+  TH1F *fNentries;                           //  histo with event selection properties
+  TH1F *fhNprongsD0;                         //  histo with D0 nprongs
+  TH1F *fhNprongsD0chargedOnly;                         //  histo with D0 nprongs
+  TH1F *fhNprongsD0chargedRef;                         //  histo with D0 nprongs
+  Double_t fYrangeTrig;                       // max D y range
+  Double_t fEtarangeEleTrig;                       // max eta ele
+  Double_t   fminDpt;                       // min D pt
+  TArrayI *fArrayDaugh;                       //! array with index of D daughter particles 
+  Int_t  flastdaugh;                       // last filled position of farraydaugh 
+  TArrayI *fArrayAssoc;                       //! array with index of associated particle
+  Int_t  fLastAss;                       // last filled posistion of farrayassoc
+  Double_t   fminPtass;                       // min pt assoc
+  Double_t   fmaxEtaAss;                       // max eta assoc
+  THnSparseF*  fhMCcorrel;                       //!  histo with correlations
+  THnSparseF*  fhMCtrigPart;                       //! histo for counting trigger particles
+  THnSparseF*  fhMChadroncorrel;                       //!  histo with correlations for hadron-hadron
+  THnSparseF*  fhMChadrontrigPart;                       //! histo for counting trigger particles for hadron-hadron correl
+
+  ClassDef(AliAnalysisTaskSEmcCorr,1); // analysis task for MC study
+
+};
+
+#endif
diff --git a/PWGHF/correlationHF/macros/AddTaskSEmcCorr.C b/PWGHF/correlationHF/macros/AddTaskSEmcCorr.C
new file mode 100755 (executable)
index 0000000..efb1e78
--- /dev/null
@@ -0,0 +1,125 @@
+AliAnalysisTaskSEmcCorr* AddTaskSEmcCorr(TString fileout="d0D0.root",TString containerprefix="c",Bool_t readmc=kTRUE,Bool_t doHH=kFALSE)
+{  
+  //
+  // andrea.rossi@cern.ch
+  //
+  //==========================================================================
+
+  Int_t last=0;
+
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  if (!mgr) {
+    ::Error("AddTaskCheckNprongs", "No analysis manager to connect to.");
+    return NULL;
+  }   
+  
+  TString str,containername;
+  if(fileout=="standard"){
+    fileout=AliAnalysisManager::GetCommonFileName();
+    fileout+=":PWG3_HFCK_";
+    fileout+="TestNprongs";
+    if(containerprefix!="c")fileout+=containerprefix;
+    str="TestNprongs";
+  }
+  else {
+    str=fileout;
+    str.ReplaceAll(".root","");
+  }
+  str.Prepend("_");
+
+  AliAnalysisTaskSEmcCorr *hfTask = new AliAnalysisTaskSEmcCorr("AliAnalysisTaskSEmcCorr");
+  hfTask->SetReadMC(readmc);
+  hfTask->DoHadronHadron(doHH);
+  mgr->AddTask(hfTask);
+  
+  // Create containers for input/output
+  AliAnalysisDataContainer *cinput =   mgr->GetCommonInputContainer();
+  //mgr->CreateContainer("cinput",TChain::Class(),AliAnalysisManager::kInputContainer);
+  mgr->ConnectInput(hfTask,0,cinput);
+  
+
+  //Now container for general properties histograms
+  containername="outputNentries";
+  containername.Prepend(containerprefix.Data());
+  containername.Append(str.Data());
+  AliAnalysisDataContainer *coutputNentries = mgr->CreateContainer(containername.Data(),TH1F::Class(),
+                                                          AliAnalysisManager::kOutputContainer, 
+                                                          fileout.Data());
+  
+  mgr->ConnectOutput(hfTask,1,coutputNentries);
+
+  containername="outputNprongsD0";
+  containername.Prepend(containerprefix.Data());
+  containername.Append(str.Data());
+  AliAnalysisDataContainer *coutputNprongsD0 = mgr->CreateContainer(containername.Data(),TH1F::Class(),
+                                                          AliAnalysisManager::kOutputContainer, 
+                                                          fileout.Data());
+  
+  mgr->ConnectOutput(hfTask,2,coutputNprongsD0);
+
+
+  containername="outputNprongsD0chargedOnly";
+  containername.Prepend(containerprefix.Data());
+  containername.Append(str.Data());
+  AliAnalysisDataContainer *coutputNprongsD0chargedOnly = mgr->CreateContainer(containername.Data(),TH1F::Class(),
+                                                          AliAnalysisManager::kOutputContainer, 
+                                                          fileout.Data());
+  
+  mgr->ConnectOutput(hfTask,3,coutputNprongsD0chargedOnly);
+
+  containername="outputNprongsD0chargedRef";
+  containername.Prepend(containerprefix.Data());
+  containername.Append(str.Data());
+  AliAnalysisDataContainer *coutputNprongsD0chargedRef = mgr->CreateContainer(containername.Data(),TH1F::Class(),
+                                                          AliAnalysisManager::kOutputContainer, 
+                                                          fileout.Data());
+  
+  mgr->ConnectOutput(hfTask,4,coutputNprongsD0chargedRef);
+
+
+  containername="outputMCcorrel";
+  containername.Prepend(containerprefix.Data());
+  containername.Append(str.Data());
+  AliAnalysisDataContainer *coutputMCcorrel = mgr->CreateContainer(containername.Data(),THnSparseF::Class(),
+                                                          AliAnalysisManager::kOutputContainer, 
+                                                          fileout.Data());
+  
+  mgr->ConnectOutput(hfTask,5,coutputMCcorrel);
+
+
+  containername="outputMCcorrelTrig";
+  containername.Prepend(containerprefix.Data());
+  containername.Append(str.Data());
+  AliAnalysisDataContainer *coutputMCcorrelTrig = mgr->CreateContainer(containername.Data(),THnSparseF::Class(),
+                                                          AliAnalysisManager::kOutputContainer, 
+                                                          fileout.Data());
+  
+  mgr->ConnectOutput(hfTask,6,coutputMCcorrelTrig);
+
+
+
+  containername="outputMChadroncorrel";
+  containername.Prepend(containerprefix.Data());
+  containername.Append(str.Data());
+  AliAnalysisDataContainer *coutputMChadroncorrel = mgr->CreateContainer(containername.Data(),THnSparseF::Class(),
+                                                          AliAnalysisManager::kOutputContainer, 
+                                                          fileout.Data());
+  
+  mgr->ConnectOutput(hfTask,7,coutputMChadroncorrel);
+
+
+  containername="outputMChadroncorrelTrig";
+  containername.Prepend(containerprefix.Data());
+  containername.Append(str.Data());
+  AliAnalysisDataContainer *coutputMChadroncorrelTrig = mgr->CreateContainer(containername.Data(),THnSparseF::Class(),
+                                                          AliAnalysisManager::kOutputContainer, 
+                                                          fileout.Data());
+  
+  mgr->ConnectOutput(hfTask,8,coutputMChadroncorrelTrig);
+
+
+
+  return hfTask;
+}
diff --git a/PWGHF/hfe/AliAnalysisTaskFlowITSTPCTOFQCSP.cxx b/PWGHF/hfe/AliAnalysisTaskFlowITSTPCTOFQCSP.cxx
new file mode 100755 (executable)
index 0000000..68b0392
--- /dev/null
@@ -0,0 +1,1366 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+
+////////////////////////////////////////////////////////////////////////
+//                                                                    //
+//  Task for Heavy Flavour Electron Flow with TPC plus TOF            //
+//  Non-Photonic Electron identified with Invariant mass              //
+//  analysis methos in function  SelectPhotonicElectron               //
+//                                                                    //
+//                                                                    //
+//  Author: Andrea Dubla (Utrecht University)                         //
+//                                                                                        //
+//                                                                    //
+////////////////////////////////////////////////////////////////////////
+
+#include "TChain.h"
+#include "TTree.h"
+#include "TH2F.h"
+#include "TMath.h"
+#include "TCanvas.h"
+#include "THnSparse.h"
+#include "TLorentzVector.h"
+#include "TString.h"
+#include "TFile.h"
+#include "AliAnalysisTask.h"
+#include "AliAnalysisManager.h"
+#include "AliESDEvent.h"
+#include "AliESDHandler.h"
+#include "AliAODEvent.h"
+#include "AliAODHandler.h"
+#include "AliAnalysisTaskFlowITSTPCTOFQCSP.h"
+#include "TGeoGlobalMagField.h"
+#include "AliLog.h"
+#include "AliAnalysisTaskSE.h"
+#include "TRefArray.h"
+#include "TVector.h"
+#include "AliESDInputHandler.h"
+#include "AliESDpid.h"
+#include "AliAODInputHandler.h"
+#include "AliAODPid.h"
+#include "AliESDtrackCuts.h"
+#include "AliPhysicsSelection.h"
+#include "AliCentralitySelectionTask.h"
+#include "AliESDCaloCluster.h"
+#include "AliAODCaloCluster.h"
+#include "AliESDCaloTrigger.h"
+#include "AliGeomManager.h"
+#include "stdio.h"
+#include "TGeoManager.h"
+#include "iostream"
+#include "fstream"
+#include "AliEMCALTrack.h"
+//#include "AliEMCALTracker.h"
+#include "AliMagF.h"
+#include "AliKFParticle.h"
+#include "AliKFVertex.h"
+#include "AliHFEcontainer.h"
+#include "AliHFEcuts.h"
+#include "AliHFEpid.h"
+#include "AliHFEpidBase.h"
+#include "AliHFEpidQAmanager.h"
+#include "AliHFEtools.h"
+#include "AliCFContainer.h"
+#include "AliCFManager.h"
+#include "AliKFParticle.h"
+#include "AliKFVertex.h"
+#include "AliCentrality.h"
+#include "AliVEvent.h"
+#include "AliStack.h"
+#include "AliMCEvent.h"
+#include "TProfile.h"
+#include "AliFlowCandidateTrack.h"
+#include "AliFlowTrackCuts.h"
+#include "AliFlowEventSimple.h"
+#include "AliFlowCommonConstants.h"
+#include "AliFlowEvent.h"
+#include "TVector3.h"
+#include "TRandom2.h"
+#include "AliESDVZERO.h"
+#include "AliAODVZERO.h"
+#include "AliPID.h"
+#include "AliPIDResponse.h"
+#include "AliFlowTrack.h"
+#include "AliAnalysisTaskVnV0.h"
+#include "AliSelectNonHFE.h"
+
+
+class AliFlowTrackCuts;
+
+using namespace std;
+
+ClassImp(AliAnalysisTaskFlowITSTPCTOFQCSP)
+//________________________________________________________________________
+AliAnalysisTaskFlowITSTPCTOFQCSP::AliAnalysisTaskFlowITSTPCTOFQCSP(const char *name)
+: AliAnalysisTaskSE(name)
+,fDebug(0)
+,fAOD(0)
+,fOutputList(0)
+,fCuts(0)
+,fIdentifiedAsOutInz(kFALSE)
+,fPassTheEventCut(kFALSE)
+,fCFM(0)
+,fPID(0)
+,fPIDqa(0)
+,fCutsRP(0)     // track cuts for reference particles
+,fNullCuts(0) // dummy cuts for flow event tracks
+,fFlowEvent(0) //! flow events (one for each inv mass band)
+,fkCentralityMethod(0)
+,fCentrality(0)
+,fCentralityMin(0)
+,fCentralityMax(0)
+,fInvmassCut(0)
+,fpTCutmin(0)
+,fpTCutmax(5)
+,fTrigger(0)
+,fPhi(0)
+,fEta(0)
+,fVZEROA(0)
+,fVZEROC(0)
+,fTPCM(0)
+,fNoEvents(0)
+,fInclusiveElecPt(0)
+,fTPCnsigma(0)
+,fTPCnsigmaAft(0)
+,fITSnsigmaAft(0)
+,fTPCnsigmaVSptAft(0)
+,fTOFns(0)
+,fTOFnsAft(0)
+,fTOFBetaAft(0)
+,fCentralityPass(0)
+,fCentralityNoPass(0)
+,fInvmassLS1(0)
+,fInvmassULS1(0)
+,fPhotoElecPt(0)
+,fSemiInclElecPt(0)
+,fULSElecPt(0)
+,fLSElecPt(0)
+,fMultCorAfterCuts(0)
+,fMultvsCentr(0)
+,fSubEventDPhiv2(0)
+,EPVzA(0)
+,EPVzC(0)
+,EPTPC(0)
+,fV2Phi(0)
+,fvertex(0)
+,fMultCorBeforeCuts(0)
+,fQAPid(0)
+,fminITSnsigmaLowpT(-1)
+,fmaxITSnsigmaLowpT(1)
+,fminITSnsigmaHighpT(-2)
+,fmaxITSnsigmaHighpT(2)
+,fminTPCnsigmaLowpT(-1)
+,fmaxTPCnsigmaLowpT(3)
+,fminTPCnsigmaHighpT(0)
+,fmaxTPCnsigmaHighpT(3)
+//,fQAPIDSparse(kFALSE)
+,fminTOFnSigma(-2)
+,fmaxTOFnSigma(2)
+,fQAPidSparse(0)
+,fTPCS(0)
+,fVz(0)
+,fOpeningAngleCut(0.1)
+,fOP_angle(0)
+,fOpeningAngleLS(0)
+,fOpeningAngleULS(0)
+,fNonHFE(new AliSelectNonHFE)
+,fDCA(0)
+,fITSnsigma(0)
+,fTPCnsigmaAftITSTOF(0)
+,fTPCnsigmaAftTOF(0)
+,fITSnsigmaAftTOF(0)
+,fITSvsTOF(0)
+,fTPCvsITS(0)
+,fTPCvsITSafterTOF(0)
+,fTPCvsTOF(0)
+,fMultCut(0)
+,fMultCorAfterCentrBeforeCuts(0)
+,fMultCorAfterVZTRKComp(0)
+,fCentralityBeforePileup(0)
+,fCentralityAfterVZTRK(0)
+,fCentralityAfterCorrCut(0)
+,fMultCorAfterCorrCut(0)
+,EPVz(0)
+,EPTPCp(0)
+,EPTPCn(0)
+,fSubEventDPhiv2new(0)
+,fV2Phivzerotot(0)
+,fHistCentrDistr(0x0)
+,fCentralityNoPassForFlattening(0)
+{
+    //Named constructor
+    
+    fPID = new AliHFEpid("hfePid");
+    // Define input and output slots here
+    // Input slot #0 works with a TChain
+    DefineInput(0, TChain::Class());
+    // Output slot #0 id reserved by the base class for AOD
+    // Output slot #1 writes into a TH1 container
+    // DefineOutput(1, TH1I::Class());
+    DefineOutput(1, TList::Class());
+    DefineOutput(2, AliFlowEventSimple::Class());
+}
+
+//________________________________________________________________________
+AliAnalysisTaskFlowITSTPCTOFQCSP::AliAnalysisTaskFlowITSTPCTOFQCSP()
+: AliAnalysisTaskSE("DefaultAnalysis_AliAnalysisElectFlow")
+,fDebug(0)
+,fAOD(0)
+,fOutputList(0)
+,fCuts(0)
+,fIdentifiedAsOutInz(kFALSE)
+,fPassTheEventCut(kFALSE)
+,fCFM(0)
+,fPID(0)
+,fPIDqa(0)
+,fCutsRP(0)     // track cuts for reference particles
+,fNullCuts(0) // dummy cuts for flow event tracks
+,fFlowEvent(0) //! flow events (one for each inv mass band)
+,fkCentralityMethod(0)
+,fCentrality(0)
+,fCentralityMin(0)
+,fCentralityMax(0)
+,fInvmassCut(0)
+,fpTCutmin(0)
+,fpTCutmax(5)
+,fTrigger(0)
+,fPhi(0)
+,fEta(0)
+,fVZEROA(0)
+,fVZEROC(0)
+,fTPCM(0)
+,fNoEvents(0)
+,fInclusiveElecPt(0)
+,fTPCnsigma(0)
+,fTPCnsigmaAft(0)
+,fITSnsigmaAft(0)
+,fTPCnsigmaVSptAft(0)
+,fTOFns(0)
+,fTOFnsAft(0)
+,fTOFBetaAft(0)
+,fCentralityPass(0)
+,fCentralityNoPass(0)
+,fInvmassLS1(0)
+,fInvmassULS1(0)
+,fPhotoElecPt(0)
+,fSemiInclElecPt(0)
+,fULSElecPt(0)
+,fLSElecPt(0)
+,fMultCorAfterCuts(0)
+,fMultvsCentr(0)
+,fSubEventDPhiv2(0)
+,EPVzA(0)
+,EPVzC(0)
+,EPTPC(0)
+,fV2Phi(0)
+,fvertex(0)
+,fMultCorBeforeCuts(0)
+,fQAPid(0)
+,fminITSnsigmaLowpT(-1)
+,fmaxITSnsigmaLowpT(1)
+,fminITSnsigmaHighpT(-2)
+,fmaxITSnsigmaHighpT(2)
+,fminTPCnsigmaLowpT(-1)
+,fmaxTPCnsigmaLowpT(3)
+,fminTPCnsigmaHighpT(0)
+,fmaxTPCnsigmaHighpT(3)
+//,fQAPIDSparse(kFALSE)
+,fminTOFnSigma(-2)
+,fmaxTOFnSigma(2)
+,fQAPidSparse(0)
+,fTPCS(0)
+,fVz(0)
+,fOpeningAngleCut(0.1)
+,fOP_angle(0)
+,fOpeningAngleLS(0)
+,fOpeningAngleULS(0)
+,fNonHFE(new AliSelectNonHFE)
+,fDCA(0)
+,fITSnsigma(0)
+,fTPCnsigmaAftITSTOF(0)
+,fTPCnsigmaAftTOF(0)
+,fITSnsigmaAftTOF(0)
+,fITSvsTOF(0)
+,fTPCvsITS(0)
+,fTPCvsITSafterTOF(0)
+,fTPCvsTOF(0)
+,fMultCut(0)
+,fMultCorAfterCentrBeforeCuts(0)
+,fMultCorAfterVZTRKComp(0)
+,fCentralityBeforePileup(0)
+,fCentralityAfterVZTRK(0)
+,fCentralityAfterCorrCut(0)
+,fMultCorAfterCorrCut(0)
+,EPVz(0)
+,EPTPCp(0)
+,EPTPCn(0)
+,fSubEventDPhiv2new(0)
+,fV2Phivzerotot(0)
+,fHistCentrDistr(0x0)
+,fCentralityNoPassForFlattening(0)
+{
+    //Default constructor
+    fPID = new AliHFEpid("hfePid");
+    // Constructor
+    // Define input and output slots here
+    // Input slot #0 works with a TChain
+    DefineInput(0, TChain::Class());
+    // Output slot #0 id reserved by the base class for AOD
+    // Output slot #1 writes into a TH1 container
+    // DefineOutput(1, TH1I::Class());
+    DefineOutput(1, TList::Class());
+    DefineOutput(2, AliFlowEventSimple::Class());
+    //DefineOutput(3, TTree::Class());
+}
+//_________________________________________
+
+AliAnalysisTaskFlowITSTPCTOFQCSP::~AliAnalysisTaskFlowITSTPCTOFQCSP()
+{
+    //Destructor
+    
+    delete fOutputList;
+    delete fPID;
+    //  delete fPIDResponse;
+    delete fCFM;
+    delete fPIDqa;
+    if (fOutputList) delete fOutputList;
+    if (fFlowEvent) delete fFlowEvent;
+    delete fNonHFE;
+}
+//_________________________________________
+
+void AliAnalysisTaskFlowITSTPCTOFQCSP::UserExec(Option_t*)
+{
+    //Main loop
+    //Called for each event
+    
+    // create pointer to event
+    
+    fAOD = dynamic_cast<AliAODEvent*>(InputEvent());
+    
+    
+    if (!fAOD)
+    {
+        printf("ERROR: fAOD not available\n");
+        return;
+    }
+    
+    if(!fCuts)
+    {
+        AliError("HFE cuts not available");
+        return;
+    }
+    
+    if(!fPID->IsInitialized())
+    {
+        // Initialize PID with the given run number
+        AliWarning("PID not initialised, get from Run no");
+        fPID->InitializePID(fAOD->GetRunNumber());
+    }
+    
+    // cout << "kTrigger   ==   " << fTrigger <<endl;
+    
+    if(fTrigger==0){
+        if(!(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kCentral)) return;
+    }
+    if(fTrigger==1){
+        if(!(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kSemiCentral)) return;
+    }
+    if(fTrigger==2){
+        if(!(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kEMCEGA)) return;
+    }
+    if(fTrigger==3){
+        if(!(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kMB)) return;
+    }
+    if(fTrigger==4){
+        if(!(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & (AliVEvent::kCentral | AliVEvent::kSemiCentral))) return;
+    }
+    
+    
+    
+    //---------------CENTRALITY AND EVENT SELECTION-----------------------
+    
+    
+    
+    Int_t fNOtrks =  fAOD->GetNumberOfTracks();
+    Float_t vtxz = -999;
+    const AliAODVertex* trkVtx = fAOD->GetPrimaryVertex();
+    if (!trkVtx || trkVtx->GetNContributors()<=0)return;
+    TString vtxTtl = trkVtx->GetTitle();
+    if (!vtxTtl.Contains("VertexerTracks"))return;
+    const AliAODVertex* spdVtx = fAOD->GetPrimaryVertexSPD();
+    if (!spdVtx || spdVtx->GetNContributors()<=0)return;
+    if (TMath::Abs(spdVtx->GetZ() - trkVtx->GetZ())>0.5)return;
+    vtxz = trkVtx->GetZ();
+    if(TMath::Abs(vtxz)>fVz)return;
+    
+    // Event cut
+    if(!fCFM->CheckEventCuts(AliHFEcuts::kEventStepReconstructed, fAOD)) return;
+    if(fNOtrks<2) return;
+    
+    
+    Bool_t pass = kFALSE; //to select centrality
+    CheckCentrality(fAOD,pass);
+    if(!pass)return;
+    
+    fvertex->Fill(vtxz);
+    
+    
+    fNoEvents->Fill(0);
+    PlotVZeroMultiplcities(fAOD);
+    
+    SetNullCuts(fAOD);
+    PrepareFlowEvent(fAOD->GetNumberOfTracks(),fFlowEvent);    //Calculate event plane Qvector and EP resolution for inclusive
+
+    AliPIDResponse *pidResponse = fInputHandler->GetPIDResponse();
+    if(!pidResponse)
+    {
+        AliDebug(1, "Using default PID Response");
+        pidResponse = AliHFEtools::GetDefaultPID(kFALSE, fInputEvent->IsA() == AliAODEvent::Class());
+    }
+    
+    fPID->SetPIDResponse(pidResponse);
+    
+    fCFM->SetRecEventInfo(fAOD);
+    
+    // Look for kink mother
+    Int_t numberofvertices = fAOD->GetNumberOfVertices();
+    Double_t listofmotherkink[numberofvertices];
+    Int_t numberofmotherkink = 0;
+    for(Int_t ivertex=0; ivertex < numberofvertices; ivertex++) {
+        AliAODVertex *aodvertex = fAOD->GetVertex(ivertex);
+        if(!aodvertex) continue;
+        if(aodvertex->GetType()==AliAODVertex::kKink) {
+            AliAODTrack *mother = (AliAODTrack *) aodvertex->GetParent();
+            if(!mother) continue;
+            Int_t idmother = mother->GetID();
+            listofmotherkink[numberofmotherkink] = idmother;
+            //printf("ID %d\n",idmother);
+            numberofmotherkink++;
+        }
+    }
+    
+    //=============================================V0EP from Alex======================================================================
+    Double_t qxEPa = 0, qyEPa = 0;
+    Double_t qxEPc = 0, qyEPc = 0;
+    Double_t qxEP = 0, qyEP = 0;
+    
+    Double_t evPlAngV0A = fAOD->GetEventplane()->CalculateVZEROEventPlane(fAOD, 8, 2, qxEPa, qyEPa);
+    Double_t evPlAngV0C = fAOD->GetEventplane()->CalculateVZEROEventPlane(fAOD, 9, 2, qxEPc, qyEPc);
+    Double_t evPlAngV0 = fAOD->GetEventplane()->CalculateVZEROEventPlane(fAOD, 10, 2, qxEP, qyEP);
+    
+    
+    Double_t Qx2 = 0, Qy2 = 0;
+    Double_t Qx2p = 0, Qy2p = 0;
+    Double_t Qx2n = 0, Qy2n = 0;
+    
+    for (Int_t iT = 0; iT < fAOD->GetNumberOfTracks(); iT++){
+        
+        AliAODTrack* aodTrack = fAOD->GetTrack(iT);
+        
+        if (!aodTrack)
+            continue;
+        
+        if ((TMath::Abs(aodTrack->Eta()) > 0.8) || (aodTrack->Pt() < 0.2) || (aodTrack->GetTPCNcls() < 70) || (aodTrack->Pt() >= 20.0))
+            continue;
+        
+        if (!aodTrack->TestFilterBit(128))
+            continue;
+        
+        
+        if(aodTrack->Eta()>0 && aodTrack->Eta()<0.8){
+            
+            Qx2p += TMath::Cos(2*aodTrack->Phi());
+            Qy2p += TMath::Sin(2*aodTrack->Phi());
+        }
+        if(aodTrack->Eta()<0 && aodTrack->Eta()> -0.8){
+            
+            Qx2n += TMath::Cos(2*aodTrack->Phi());
+            Qy2n += TMath::Sin(2*aodTrack->Phi());
+        }
+        
+        
+        Qx2 += TMath::Cos(2*aodTrack->Phi());
+        Qy2 += TMath::Sin(2*aodTrack->Phi());
+        
+        
+        
+        
+    }
+    
+    Double_t evPlAngTPC = TMath::ATan2(Qy2, Qx2)/2.;
+    Double_t evPlAngTPCn = TMath::ATan2(Qy2n, Qx2n)/2.;
+    Double_t evPlAngTPCp = TMath::ATan2(Qy2p, Qx2p)/2.;
+    
+    EPVzA->Fill(evPlAngV0A);
+    EPVzC->Fill(evPlAngV0C);
+    EPTPC->Fill(evPlAngTPC);
+    
+    EPTPCn->Fill(evPlAngTPCn);
+    EPTPCp->Fill(evPlAngTPCp);
+    EPVz->Fill(evPlAngV0);
+    
+    fSubEventDPhiv2->Fill(0.5, TMath::Cos(2.*(evPlAngV0A-evPlAngTPC))); // vzeroa - tpc
+    fSubEventDPhiv2->Fill(1.5, TMath::Cos(2.*(evPlAngV0A-evPlAngV0C))); // vzeroa - vzeroc
+    fSubEventDPhiv2->Fill(2.5, TMath::Cos(2.*(evPlAngV0C-evPlAngTPC))); // tpc - vzeroc
+    
+    
+    fSubEventDPhiv2new->Fill(0.5, TMath::Cos(2.*(evPlAngV0-evPlAngTPCp))); // vzero - tpcp
+    fSubEventDPhiv2new->Fill(1.5, TMath::Cos(2.*(evPlAngV0-evPlAngTPCn))); // vzero - tpcn
+    fSubEventDPhiv2new->Fill(2.5, TMath::Cos(2.*(evPlAngTPCp-evPlAngTPCn))); // tpcp - tpcn
+    
+    
+    //====================================================================================================================
+    
+    AliAODTrack *track = NULL;
+    
+    // Track loop
+    for (Int_t iTracks = 0; iTracks < fAOD->GetNumberOfTracks(); iTracks++)
+    {
+         track = fAOD->GetTrack(iTracks);
+        if (!track)
+        {
+            printf("ERROR: Could not receive track %d\n", iTracks);
+            continue;
+        }
+        if(!track->TestFilterMask(AliAODTrack::kTrkGlobalNoDCA)) continue;  // TESTBIT FOR AOD double Counting
+        
+        //--------------------------------------hfe begin-----------------------------------------------------------
+        //==========================================================================================================
+        //======================================track cuts==========================================================
+        if(track->Eta()<-0.8 || track->Eta()>0.8)    continue;    //eta cuts on candidates
+        
+        // RecKine: ITSTPC cuts
+        if(!ProcessCutStep(AliHFEcuts::kStepRecKineITSTPC, track)) continue;
+        
+        // Reject kink mother
+        Bool_t kinkmotherpass = kTRUE;
+        for(Int_t kinkmother = 0; kinkmother < numberofmotherkink; kinkmother++) {
+            if(track->GetID() == listofmotherkink[kinkmother]) {
+                kinkmotherpass = kFALSE;
+                continue;
+            }
+        }
+        if(!kinkmotherpass) continue;
+        
+        // RecPrim
+        //  if(!ProcessCutStep(AliHFEcuts::kStepRecPrim, track)) continue;  //deleted for DCA absence
+        // HFEcuts: ITS layers cuts
+        if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsITS, track)) continue;
+        // HFE cuts: TPC PID cleanup
+        if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTPC, track)) continue;
+        //==========================================================================================================
+        Double_t eta = track->Eta();
+        Double_t phi = track->Phi();
+        Double_t pt = track->Pt();         //pt track after cuts
+        if(pt<fpTCutmin || pt>fpTCutmax) continue;
+        //==========================================================================================================
+        //=========================================PID==============================================================
+        if(track->GetTPCsignalN() < fTPCS) continue;
+        Float_t fITSnSigma = fPID->GetPIDResponse() ? fPID->GetPIDResponse()->NumberOfSigmasITS(track, AliPID::kElectron) : 1000;
+        Float_t fTPCnSigma = fPID->GetPIDResponse() ? fPID->GetPIDResponse()->NumberOfSigmasTPC(track, AliPID::kElectron) : 1000;
+        Float_t fTOFnSigma = fPID->GetPIDResponse() ? fPID->GetPIDResponse()->NumberOfSigmasTOF(track, AliPID::kElectron) : 1000;
+        //   Float_t eDEDX = fPIDResponse->GetTPCResponse().GetExpectedSignal(track, AliPID::kElectron, AliTPCPIDResponse::kdEdxDefault, kTRUE);
+        fITSnsigma->Fill(track->P(),fITSnSigma);
+        fTPCnsigma->Fill(track->P(),fTPCnSigma);
+        fTOFns->Fill(track->P(),fTOFnSigma);
+        fITSvsTOF->Fill(fTOFnSigma,fITSnSigma);
+        fTPCvsITS->Fill(fTPCnSigma,fITSnSigma);
+        fTPCvsTOF->Fill(fTPCnSigma,fTOFnSigma);
+        
+        if( pt >= 0.3){
+            if(fTOFnSigma < fminTOFnSigma || fTOFnSigma > fmaxTOFnSigma) continue;
+        }//cuts on nsigma tof full pt range
+
+        fITSnsigmaAftTOF->Fill(track->P(),fITSnSigma);
+        fTPCnsigmaAftTOF->Fill(track->P(),fTPCnSigma);
+        fTPCvsITSafterTOF->Fill(fTPCnSigma,fITSnSigma);
+        
+        Double_t valPidSparse[3] = {
+            pt,
+            fITSnSigma,
+            fTPCnSigma,
+        };
+        fQAPidSparse->Fill(valPidSparse);
+        
+        
+        if( pt < 1.5){
+            if(fITSnSigma < fminITSnsigmaLowpT || fITSnSigma > fmaxITSnsigmaLowpT)continue;
+        }//cuts on nsigma its low pt
+        if( pt >= 1.5){
+            if(fITSnSigma < fminITSnsigmaHighpT || fITSnSigma > fmaxITSnsigmaHighpT)continue;
+        }//cuts on nsigma its high pt
+        fTPCnsigmaAftITSTOF->Fill(track->P(),fTPCnSigma);
+        if(pt >= 0.25 && pt < 1.5){
+            if(fTPCnSigma < fminTPCnsigmaLowpT || fTPCnSigma > fmaxTPCnsigmaLowpT) continue;
+        }//cuts on nsigma tpc lowpt
+        if( pt >= 1.5){
+            if(fTPCnSigma < fminTPCnsigmaHighpT || fTPCnSigma > fmaxTPCnsigmaHighpT) continue;
+        }//cuts on nsigma tpc high pt
+        fTPCnsigmaAft->Fill(track->P(),fTPCnSigma);
+        fTPCnsigmaVSptAft->Fill(pt,fTPCnSigma);
+        
+        //==========================================================================================================
+        //=========================================QA PID SPARSE====================================================
+        Float_t timeTOF = track->GetTOFsignal();
+        Double_t intTime[5] = {-99., -99., -99., -99., -99.};
+        track->GetIntegratedTimes(intTime);
+        Float_t timeElec = intTime[0];
+        Float_t intLength = 2.99792458e-2* timeElec;
+        Double_t beta = 0.1;
+        if ((intLength > 0) && (timeTOF > 0))
+        beta = intLength/2.99792458e-2/timeTOF;
+        
+        //     if(fQAPIDSparse){
+        //         Double_t valPid[4] = {
+        //             track->P(),
+        //             track->GetTPCsignal(),
+        //             beta,
+        //             track->Charge()
+        //         };
+        //         fQAPid->Fill(valPid);
+        //     }
+        
+        
+        fITSnsigmaAft->Fill(track->P(),fITSnSigma);
+        fTPCnsigmaAft->Fill(track->P(),fTPCnSigma);
+        fTOFnsAft->Fill(track->P(),fTOFnSigma);
+        fTOFBetaAft->Fill(track->P(),beta);
+        fInclusiveElecPt->Fill(pt);
+        fPhi->Fill(phi);
+         fEta->Fill(eta);
+        //=========================================================================================================
+        //----------------------Flow of Inclusive Electrons--------------------------------------------------------
+        AliFlowTrack *sTrack = new AliFlowTrack();
+        sTrack->Set(track);
+        sTrack->SetID(track->GetID());
+        sTrack->SetForRPSelection(kTRUE);
+        sTrack->SetForPOISelection(kTRUE);
+        sTrack->SetMass(263732);
+        for(int iRPs=0; iRPs!=fFlowEvent->NumberOfTracks(); ++iRPs)
+        {
+            //   cout << " no of rps " << iRPs << endl;
+            AliFlowTrack *iRP = dynamic_cast<AliFlowTrack*>(fFlowEvent->GetTrack( iRPs ));
+            if (!iRP) continue;
+            if (!iRP->InRPSelection()) continue;
+            if( sTrack->GetID() == iRP->GetID())
+            {
+                if(fDebug) printf(" was in RP set");
+                //  cout << sTrack->GetID() <<"   ==  " << iRP->GetID() << " was in RP set====REMOVED" <<endl;
+                iRP->SetForRPSelection(kFALSE);
+                // fFlowEvent->SetNumberOfRPs(fFlowEvent->GetNumberOfRPs() - 1);
+            }
+        } //end of for loop on RPs
+        fFlowEvent->InsertTrack(((AliFlowTrack*) sTrack));
+        fFlowEvent->SetNumberOfPOIs(fFlowEvent->GetNumberOfPOIs()+1);
+        //============================Event Plane Method with V0====================================================
+        Double_t v2PhiV0A = TMath::Cos(2*(phi - evPlAngV0A));
+        Double_t v2PhiV0C = TMath::Cos(2*(phi - evPlAngV0C));
+        Double_t v2Phi[3] = {
+            v2PhiV0A,
+            v2PhiV0C,
+            pt};
+        fV2Phi->Fill(v2Phi);
+        
+        Double_t v2PhiVz = TMath::Cos(2*(phi - evPlAngV0));
+        Double_t v2PhiV0tot[2] = {
+            v2PhiVz,
+            pt};
+        fV2Phivzerotot->Fill(v2PhiV0tot);
+        
+        //==========================================================================================================
+        //=========================================================================================================
+        
+        
+        if(fDCA){
+         fNonHFE = new AliSelectNonHFE();
+         fNonHFE->SetAODanalysis(kTRUE);
+         fNonHFE->SetInvariantMassCut(fInvmassCut);
+         if(fOP_angle) fNonHFE->SetOpeningAngleCut(fOpeningAngleCut);
+         //fNonHFE->SetChi2OverNDFCut(fChi2Cut);
+         //if(fDCAcutFlag) fNonHFE->SetDCACut(fDCAcut);
+         fNonHFE->SetAlgorithm("DCA"); //KF
+         fNonHFE->SetPIDresponse(pidResponse);
+         fNonHFE->SetTrackCuts(-3,3);
+         
+         fNonHFE->SetHistAngleBack(fOpeningAngleLS);
+         fNonHFE->SetHistAngle(fOpeningAngleULS);
+         //fNonHFE->SetHistDCABack(fDCABack);
+         //fNonHFE->SetHistDCA(fDCA);
+         fNonHFE->SetHistMassBack(fInvmassLS1);
+         fNonHFE->SetHistMass(fInvmassULS1);
+         
+         fNonHFE->FindNonHFE(iTracks,track,fAOD);
+         
+         // Int_t *fUlsPartner = fNonHFE->GetPartnersULS();
+         // Int_t *fLsPartner = fNonHFE->GetPartnersLS();
+         // Bool_t fUlsIsPartner = kFALSE;
+         // Bool_t fLsIsPartner = kFALSE;
+         if(fNonHFE->IsULS()){
+         for(Int_t kULS =0; kULS < fNonHFE->GetNULS(); kULS++){
+         fULSElecPt->Fill(track->Pt());
+         }
+         }
+         
+         if(fNonHFE->IsLS()){
+         for(Int_t kLS =0; kLS < fNonHFE->GetNLS(); kLS++){
+         fLSElecPt->Fill(track->Pt());
+         }
+         }
+         }
+        if(!fDCA){
+        //=========================================================================================================
+        //----------------------Selection and Flow of Photonic Electrons-----------------------------
+        Bool_t fFlagPhotonicElec = kFALSE;
+        SelectPhotonicElectron(iTracks,track,fFlagPhotonicElec);
+        if(fFlagPhotonicElec){fPhotoElecPt->Fill(pt);}
+              // Semi inclusive electron
+        if(!fFlagPhotonicElec){fSemiInclElecPt->Fill(pt);}
+        }
+        //-------------------------------------------------------------------------------------------
+        
+    }//end loop on track
+    PostData(1, fOutputList);
+    PostData(2, fFlowEvent);
+
+    //----------hfe end---------
+}
+//_________________________________________
+void AliAnalysisTaskFlowITSTPCTOFQCSP::SelectPhotonicElectron(Int_t itrack,const AliAODTrack *track, Bool_t &fFlagPhotonicElec)
+{
+    
+    //Identify non-heavy flavour electrons using Invariant mass method
+    Bool_t flagPhotonicElec = kFALSE;
+    
+    for(Int_t jTracks = 0; jTracks<fAOD->GetNumberOfTracks(); jTracks++){
+        AliAODTrack *trackAsso = fAOD->GetTrack(jTracks);
+        if (!trackAsso) {
+            printf("ERROR: Could not receive track %d\n", jTracks);
+            continue;
+        }
+        //  if(!track->TestFilterMask(AliAODTrack::kTrkGlobalNoDCA)) continue;  // TESTBIT FOR AOD double Counting
+        if(!trackAsso->TestFilterMask(AliAODTrack::kTrkTPCOnly)) continue;
+        if((!(trackAsso->GetStatus()&AliESDtrack::kITSrefit)|| (!(trackAsso->GetStatus()&AliESDtrack::kTPCrefit)))) continue;
+        
+        
+        if(jTracks == itrack) continue;
+        Double_t ptAsso=-999., nsigma=-999.0;
+        Double_t mass=-999., width = -999;
+        Double_t openingAngle = -999.;
+        Bool_t fFlagLS=kFALSE, fFlagULS=kFALSE;
+        
+        
+        ptAsso = trackAsso->Pt();
+        Short_t chargeAsso = trackAsso->Charge();
+        Short_t charge = track->Charge();
+        // nsigma = fPIDResponse->NumberOfSigmasTPC(track, AliPID::kElectron);
+        nsigma = fPID->GetPIDResponse() ? fPID->GetPIDResponse()->NumberOfSigmasTPC(trackAsso, AliPID::kElectron) : 1000;
+        
+        
+        if(trackAsso->GetTPCNcls() < 80) continue;
+        if(nsigma < -3 || nsigma > 3) continue;
+        if(trackAsso->Eta()<-0.9 || trackAsso->Eta()>0.9) continue;
+        // if(ptAsso <0.3) continue;
+        
+        Int_t fPDGe1 = 11; Int_t fPDGe2 = 11;
+        if(charge>0) fPDGe1 = -11;
+        if(chargeAsso>0) fPDGe2 = -11;
+        
+        if(charge == chargeAsso) fFlagLS = kTRUE;
+        if(charge != chargeAsso) fFlagULS = kTRUE;
+        
+        AliKFParticle::SetField(fAOD->GetMagneticField());
+        AliKFParticle ge1 = AliKFParticle(*track, fPDGe1);
+        AliKFParticle ge2 = AliKFParticle(*trackAsso, fPDGe2);
+        AliKFParticle recg(ge1, ge2);
+        
+        if(recg.GetNDF()<1) continue;
+        Double_t chi2recg = recg.GetChi2()/recg.GetNDF();
+        if(TMath::Sqrt(TMath::Abs(chi2recg))>3.) continue;
+        recg.GetMass(mass,width);
+        
+        openingAngle = ge1.GetAngle(ge2);
+        if(fFlagLS) fOpeningAngleLS->Fill(openingAngle);
+        if(fFlagULS) fOpeningAngleULS->Fill(openingAngle);
+        if(fOP_angle){if(openingAngle > fOpeningAngleCut) continue;}
+        
+        
+        if(fFlagLS) fInvmassLS1->Fill(mass);
+        if(fFlagULS) fInvmassULS1->Fill(mass);
+        
+        if(mass<fInvmassCut){
+            if(fFlagULS){fULSElecPt->Fill(track->Pt());}
+            if(fFlagLS){fLSElecPt->Fill(track->Pt());}
+        }
+        
+        if(mass<fInvmassCut && fFlagULS && !flagPhotonicElec){
+            flagPhotonicElec = kTRUE;
+        }
+    }//track loop
+    
+    fFlagPhotonicElec = flagPhotonicElec;
+}
+//___________________________________________
+void AliAnalysisTaskFlowITSTPCTOFQCSP::UserCreateOutputObjects()
+{
+    
+    //Create histograms
+    //----------hfe initialising begin---------
+    fNullCuts = new AliFlowTrackCuts("null_cuts");
+    
+    AliFlowCommonConstants* cc = AliFlowCommonConstants::GetMaster();
+    cc->SetNbinsMult(10000);
+    cc->SetMultMin(0);
+    cc->SetMultMax(10000);
+    
+    cc->SetNbinsPt(100);
+    cc->SetPtMin(0);
+    cc->SetPtMax(5);
+    
+    cc->SetNbinsPhi(180);
+    cc->SetPhiMin(0.0);
+    cc->SetPhiMax(TMath::TwoPi());
+    
+    cc->SetNbinsEta(30);
+    cc->SetEtaMin(-8.0);
+    cc->SetEtaMax(+8.0);
+    
+    cc->SetNbinsQ(500);
+    cc->SetQMin(0.0);
+    cc->SetQMax(3.0);
+    
+    
+    //   AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
+    //   AliInputEventHandler *inputHandler=dynamic_cast<AliInputEventHandler*>(man->GetInputEventHandler());
+    //    if (!inputHandler){
+    //        AliFatal("Input handler needed");
+    //   }
+    //   else{
+    //       fPIDResponse=inputHandler->GetPIDResponse();
+    //   }
+    //pid response object
+    //  if (!fPIDResponse)AliError("PIDResponse object was not created");
+    
+    
+    //--------Initialize PID
+    fPID->SetHasMCData(kFALSE);
+    if(!fPID->GetNumberOfPIDdetectors())
+    {
+        fPID->AddDetector("ITS", 0);
+        fPID->AddDetector("TOF", 1);
+        fPID->AddDetector("TPC", 2);
+        
+    }
+    
+    fPID->SortDetectors();
+    fPIDqa = new AliHFEpidQAmanager();
+    fPIDqa->Initialize(fPID);
+    
+    
+    
+    //--------Initialize correction Framework and Cuts
+    fCFM = new AliCFManager;
+    const Int_t kNcutSteps = AliHFEcuts::kNcutStepsMCTrack + AliHFEcuts::kNcutStepsRecTrack + AliHFEcuts::kNcutStepsDETrack;
+    fCFM->SetNStepParticle(kNcutSteps);
+    for(Int_t istep = 0; istep < kNcutSteps; istep++)
+        fCFM->SetParticleCutsList(istep, NULL);
+    
+    if(!fCuts){
+        AliWarning("Cuts not available. Default cuts will be used");
+        fCuts = new AliHFEcuts;
+        fCuts->CreateStandardCuts();
+    }
+    
+    fCuts->SetAOD();
+    fCuts->Initialize(fCFM);
+    //----------hfe initialising end--------
+    //---------Output Tlist
+    fOutputList = new TList();
+    fOutputList->SetOwner();
+    fOutputList->Add(fPIDqa->MakeList("PIDQA"));
+    
+    fNoEvents = new TH1F("fNoEvents","",1,0,1) ;
+    fOutputList->Add(fNoEvents);
+    
+    fITSnsigma = new TH2F("fITSnsigma", "ITS - n sigma before HFE pid",600,0,6,400,-20,20);
+    fOutputList->Add(fITSnsigma);
+    
+    fTPCnsigma = new TH2F("fTPCnsigma", "TPC - n sigma before HFE pid",600,0,6,400,-20,20);
+    fOutputList->Add(fTPCnsigma);
+    
+    fITSnsigmaAft = new TH2F("fITSnsigmaAft", "ITS - n sigma after HFE pid",1000,0,10,300,-10,20);
+    fOutputList->Add(fITSnsigmaAft);
+    fITSvsTOF = new TH2F("fITSvsTOF", "ITS tof",400,-20,20,400,-20,20);
+    fOutputList->Add(fITSvsTOF);
+    fTPCvsITS = new TH2F("TPCvsITS", "TPC ITS",400,-20,20,400,-20,20);
+    fOutputList->Add(fTPCvsITS);
+    fTPCvsTOF = new TH2F("TPCvsTOF", "TPC TOF",400,-20,20,400,-20,20);
+    fOutputList->Add(fTPCvsTOF);
+    fTPCvsITSafterTOF = new TH2F("TPCvsITSafterTOF", "TPC ITS",400,-20,20,400,-20,20);
+    fOutputList->Add(fTPCvsITSafterTOF);
+    
+    
+    fITSnsigmaAftTOF = new TH2F("fITSnsigmaAftTOF", "ITS - n sigma after HFE pid",600,0,6,400,-20,20);
+    fOutputList->Add(fITSnsigmaAftTOF);
+    
+    fTPCnsigmaAft = new TH2F("fTPCnsigmaAft", "TPC - n sigma after HFE pid",600,0,6,400,-20,20);
+    fOutputList->Add(fTPCnsigmaAft);
+    
+    fTPCnsigmaVSptAft = new TH2F("fTPCnsigmaVSptAft", "TPC - n sigma after HFE pid",600,0,6,400,-20,20);
+    fOutputList->Add(fTPCnsigmaVSptAft);
+    
+    fTPCnsigmaAftITSTOF = new TH2F("fTPCnsigmaAftITSTOF", "TPC - n sigma after HFE pid",600,0,6,400,-20,20);
+    fOutputList->Add(fTPCnsigmaAftITSTOF);
+    
+    fTPCnsigmaAftTOF = new TH2F("fTPCnsigmaAftTOF", "TPC - n sigma after HFE pid",600,0,6,400,-20,20);
+    fOutputList->Add(fTPCnsigmaAftTOF);
+    
+    fTOFns = new TH2F("fTOFns","track TOFnSigma",600,0,6,400,-20,20);
+    fOutputList->Add(fTOFns);
+    
+    fTOFnsAft = new TH2F("fTOFnsAft","track TOFnSigma",600,0,6,400,-20,20);
+    fOutputList->Add(fTOFnsAft);
+    
+    fTOFBetaAft = new TH2F("fTOFBetaAft","track TOFBeta",600,0,6,120,0,1.2);
+    fOutputList->Add(fTOFBetaAft);
+    
+    fInclusiveElecPt = new TH1F("fInclElecPt", "Inclusive electron pt",100,0,5);
+    fOutputList->Add(fInclusiveElecPt);
+    
+    fPhotoElecPt = new TH1F("fPhotoElecPt", "photonic electron pt",100,0,5);
+    fOutputList->Add(fPhotoElecPt);
+    
+    fSemiInclElecPt = new TH1F("fSemiInclElecPt", "Semi-inclusive electron pt",100,0,5);
+    fOutputList->Add(fSemiInclElecPt);
+    
+    fULSElecPt = new TH1F("fULSElecPt", "ULS electron pt",100,0,5);
+    fOutputList->Add(fULSElecPt);
+    
+    fLSElecPt = new TH1F("fLSElecPt", "LS electron pt",100,0,5);
+    fOutputList->Add(fLSElecPt);
+    
+    fInvmassLS1 = new TH1F("fInvmassLS1", "Inv mass of LS (e,e); mass(GeV/c^2); counts;", 1000,0,1.0);
+    fOutputList->Add(fInvmassLS1);
+    
+    fInvmassULS1 = new TH1F("fInvmassULS1", "Inv mass of ULS (e,e); mass(GeV/c^2); counts;", 1000,0,1.0);
+    fOutputList->Add(fInvmassULS1);
+    
+    fCentralityPass = new TH1F("fCentralityPass", "Centrality Pass", 101, -1, 100);
+    fOutputList->Add(fCentralityPass);
+    
+    fCentralityNoPass = new TH1F("fCentralityNoPass", "Centrality No Pass", 101, -1, 100);
+    fOutputList->Add(fCentralityNoPass);
+    
+    fCentralityNoPassForFlattening = new TH1F("fCentralityNoPassForFlattening", "Centrality No Pass for flattening", 101, -1, 100);
+    fOutputList->Add(fCentralityNoPassForFlattening);
+    
+    fCentralityBeforePileup = new TH1F("fCentralityBeforePileup", "fCentralityBeforePileup Pass", 101, -1, 100);
+    fOutputList->Add(fCentralityBeforePileup);
+    
+    fCentralityAfterVZTRK = new TH1F("fCentralityAfterVZTRK", "fCentralityAfterVZTRK Pass", 101, -1, 100);
+    fOutputList->Add(fCentralityAfterVZTRK);
+    
+    fCentralityAfterCorrCut = new TH1F("fCentralityAfterCorrCut", "fCentralityAfterCorrCut Pass", 101, -1, 100);
+    fOutputList->Add(fCentralityAfterCorrCut);
+    
+    fPhi = new TH1F("fPhi", "#phi distribution", 100, -.5, 7);
+    fOutputList->Add(fPhi);
+    
+    fEta = new TH1F("fEta", "#eta distribution", 100, -1.1, 1.1);
+    fOutputList->Add(fEta);
+    
+    fVZEROA = new TH1F("fVZEROA", "VZERO A Multiplicity", 1000, 0, 10000);
+    fOutputList->Add(fVZEROA);
+    
+    fVZEROC = new TH1F("fVZEROC", "VZERO C Multiplicity", 1000, 0, 10000);
+    fOutputList->Add(fVZEROC);
+    
+    fTPCM = new TH1F("fTPCM", "TPC multiplicity", 1000, 0, 10000);
+    fOutputList->Add(fTPCM);
+    
+    fvertex = new TH1D("fvertex", "vertex distribution", 300, -15,15);
+    fOutputList->Add(fvertex);
+    
+    fMultCorBeforeCuts = new TH2F("fMultCorBeforeCuts", "TPC vs Global multiplicity (Before cuts); Global multiplicity; TPC multiplicity", 100, 0, 3000, 100, 0, 3000);
+    fOutputList->Add(fMultCorBeforeCuts);
+    
+    fMultCorAfterCuts = new TH2F("fMultCorAfterCuts", "TPC vs Global multiplicity (After cuts); Global multiplicity; TPC multiplicity", 100, 0, 3000, 100, 0, 3000);
+    fOutputList->Add(fMultCorAfterCuts);
+    
+    fMultCorAfterCentrBeforeCuts = new TH2F("fMultCorAfterCentrBeforeCuts", "TPC vs Global multiplicity (After CC before cuts); Global multiplicity; TPC multiplicity", 100, 0, 3000, 100, 0, 3000);
+    fOutputList->Add(fMultCorAfterCentrBeforeCuts);
+    
+    fMultCorAfterVZTRKComp = new TH2F("fMultCorAfterVZTRKComp", "TPC vs Global multiplicity (After V0-TRK); Global multiplicity; TPC multiplicity", 100, 0, 3000, 100, 0, 3000);
+    fOutputList->Add(fMultCorAfterVZTRKComp);
+    
+    fMultCorAfterCorrCut = new TH2F("fMultCorAfterCorrCut", "TPC vs Global multiplicity (After CorrCut); Global multiplicity; TPC multiplicity", 100, 0, 3000, 100, 0, 3000);
+    fOutputList->Add(fMultCorAfterCorrCut);
+    
+    fMultvsCentr = new TH2F("fMultvsCentr", "Multiplicity vs centrality; centrality; Multiplicity", 100, 0., 100, 100, 0, 3000);
+    fOutputList->Add(fMultvsCentr);
+    
+    fOpeningAngleLS = new TH1F("fOpeningAngleLS","Opening angle for LS pairs",100,0,1);
+    fOutputList->Add(fOpeningAngleLS);
+    
+    fOpeningAngleULS = new TH1F("fOpeningAngleULS","Opening angle for ULS pairs",100,0,1);
+    fOutputList->Add(fOpeningAngleULS);
+    
+    
+    
+    //----------------------------------------------------------------------------
+    EPVzA = new TH1D("EPVzA", "EPVzA", 80, -2, 2);
+    fOutputList->Add(EPVzA);
+    EPVzC = new TH1D("EPVzC", "EPVzC", 80, -2, 2);
+    fOutputList->Add(EPVzC);
+    EPTPC = new TH1D("EPTPC", "EPTPC", 80, -2, 2);
+    fOutputList->Add(EPTPC);
+    EPVz = new TH1D("EPVz", "EPVz", 80, -2, 2);
+    fOutputList->Add(EPVz);
+    EPTPCp = new TH1D("EPTPCp", "EPTPCp", 80, -2, 2);
+    fOutputList->Add(EPTPCp);
+    EPTPCn = new TH1D("EPTPCn", "EPTPCn", 80, -2, 2);
+    fOutputList->Add(EPTPCn);
+    
+    
+    //----------------------------------------------------------------------------
+    fSubEventDPhiv2 = new TProfile("fSubEventDPhiv2", "fSubEventDPhiv2", 3, 0, 3);
+    fSubEventDPhiv2->GetXaxis()->SetBinLabel(1, "<cos(2(#Psi_{a} - #Psi_{b}))>");
+    fSubEventDPhiv2->GetXaxis()->SetBinLabel(2, "<cos(2(#Psi_{a} - #Psi_{c}>))");
+    fSubEventDPhiv2->GetXaxis()->SetBinLabel(3, "<cos(2(#Psi_{b} - #Psi_{c}>))");
+    fOutputList->Add(fSubEventDPhiv2);
+    
+    fSubEventDPhiv2new = new TProfile("fSubEventDPhiv2new", "fSubEventDPhiv2new", 3, 0, 3);
+    fSubEventDPhiv2new->GetXaxis()->SetBinLabel(1, "<cos(2(#Psi_{a} - #Psi_{b}))>");
+    fSubEventDPhiv2new->GetXaxis()->SetBinLabel(2, "<cos(2(#Psi_{a} - #Psi_{c}>))");
+    fSubEventDPhiv2new->GetXaxis()->SetBinLabel(3, "<cos(2(#Psi_{b} - #Psi_{c}>))");
+    fOutputList->Add(fSubEventDPhiv2new);
+    
+    //================================Event Plane with VZERO=====================
+    const Int_t nPtBins = 12;
+    Double_t binsPt[nPtBins+1] = {0, 0.25, 0.5, 0.75, 1, 1.25, 1.5, 2, 2.5, 3, 3.5, 4, 5};
+    // v2A, v2C, pt
+    Int_t    bins[3] = {  50,  50, nPtBins};
+    Double_t xmin[3] = { -1., -1.,   0};
+    Double_t xmax[3] = {  1.,  1.,   5};
+    fV2Phi = new THnSparseF("fV2Phi", "v2A:v2C:pt", 3, bins, xmin, xmax);
+    // Set bin limits for axes which are not standard binned
+    fV2Phi->SetBinEdges(2, binsPt);
+    // set axes titles
+    fV2Phi->GetAxis(0)->SetTitle("v_{2} (V0A)");
+    fV2Phi->GetAxis(1)->SetTitle("v_{2} (V0C)");
+    fV2Phi->GetAxis(2)->SetTitle("p_{T} (GeV/c)");
+    fOutputList->Add(fV2Phi);
+    //================================Event Plane with VZERO=====================
+    Int_t    binsV[2] = {  50,  100};
+    Double_t xminV[2] = { -1.,   0};
+    Double_t xmaxV[2] = {  1.,   5};
+    fV2Phivzerotot = new THnSparseF("fV2Phivzerotot", "v2:pt", 2, binsV, xminV, xmaxV);
+    // Set bin limits for axes which are not standard binned
+    //fV2Phivzerotot->SetBinEdges(1, binsPt);
+    // set axes titles
+    fV2Phivzerotot->GetAxis(0)->SetTitle("v_{2} (V0)");
+    fV2Phivzerotot->GetAxis(1)->SetTitle("p_{T} (GeV/c)");
+    fOutputList->Add(fV2Phivzerotot);
+
+    
+   
+    //----------------------------------------------------------------------------
+    //----------------------------------------------------------------------------
+ //   if(fQAPIDSparse){
+ //       Int_t    binsQA[4] = { 150,  100,  120,    3};
+ //       Double_t xminQA[4] = { 0.,    50,   0, -1.5};
+ //       Double_t xmaxQA[4] = { 15.,  150, 1.2,  1.5};
+ //       fQAPid = new THnSparseF("fQAPid", "p:dEdx:beta:ch", 4, binsQA, xminQA, xmaxQA);
+ //       fQAPid->GetAxis(0)->SetTitle("p (Gev/c");
+ //       fQAPid->GetAxis(1)->SetTitle("dE/dx");
+//        fQAPid->GetAxis(2)->SetTitle("#beta (TOF)");
+//        fQAPid->GetAxis(3)->SetTitle("charge");
+//        fOutputList->Add(fQAPid);
+//    }
+    //===========================================================================
+    Int_t    binsQA2[3] = { 100,  40, 150/*,  60*/};
+    Double_t xminQA2[3] = { 0.,   -2, -15/*,  -3*/};
+    Double_t xmaxQA2[3] = { 5.,    2,  15/*,   3*/};
+    fQAPidSparse = new THnSparseF("fQAPidSparse", "pt:itsnsigma:tpcnsigma", 3, binsQA2, xminQA2, xmaxQA2);
+    fQAPidSparse->GetAxis(0)->SetTitle("pt (Gev/c)");
+    fQAPidSparse->GetAxis(1)->SetTitle("itsnsigma");
+    fQAPidSparse->GetAxis(2)->SetTitle("tpcnsigma");
+    fOutputList->Add(fQAPidSparse);
+    //===========================================================================
+    PostData(1,fOutputList);
+    // create and post flowevent
+    fFlowEvent = new AliFlowEvent(10000);
+    PostData(2, fFlowEvent);
+   
+}
+//________________________________________________________________________
+void AliAnalysisTaskFlowITSTPCTOFQCSP::Terminate(Option_t *)
+{
+    // Info("Terminate");
+    AliAnalysisTaskSE::Terminate();
+}
+//_____________________________________________________________________________
+template <typename T> void AliAnalysisTaskFlowITSTPCTOFQCSP::PlotVZeroMultiplcities(const T* event) const
+{
+    // QA multiplicity plots
+    fVZEROA->Fill(event->GetVZEROData()->GetMTotV0A());
+    fVZEROC->Fill(event->GetVZEROData()->GetMTotV0C());
+}
+//_____________________________________________________________________________
+template <typename T> void AliAnalysisTaskFlowITSTPCTOFQCSP::SetNullCuts(T* event)
+{
+    //Set null cuts
+    if (fDebug) cout << " fCutsRP " << fCutsRP << endl;
+    fCutsRP->SetEvent(event, MCEvent());
+    fNullCuts->SetParamType(AliFlowTrackCuts::kGlobal);
+    fNullCuts->SetPtRange(+1, -1); // select nothing QUICK
+    fNullCuts->SetEtaRange(+1, -1); // select nothing VZERO
+    fNullCuts->SetEvent(event, MCEvent());
+}
+//_____________________________________________________________________________
+void AliAnalysisTaskFlowITSTPCTOFQCSP::PrepareFlowEvent(Int_t iMulti, AliFlowEvent *FlowEv) const
+{
+    //Prepare flow events
+    FlowEv->ClearFast();
+    FlowEv->Fill(fCutsRP, fNullCuts);
+    FlowEv->SetReferenceMultiplicity(iMulti);
+    FlowEv->DefineDeadZone(0, 0, 0, 0);
+    //  FlowEv->TagSubeventsInEta(-0.7, 0, 0, 0.7);
+}
+//_____________________________________________________________________________
+Bool_t AliAnalysisTaskFlowITSTPCTOFQCSP::ProcessCutStep(Int_t cutStep, AliVParticle *track)
+{
+    // Check single track cuts for a given cut step
+    const Int_t kMCOffset = AliHFEcuts::kNcutStepsMCTrack;
+    if(!fCFM->CheckParticleCuts(cutStep + kMCOffset, track)) return kFALSE;
+    return kTRUE;
+}
+//_________________________________________
+void AliAnalysisTaskFlowITSTPCTOFQCSP::CheckCentrality(AliAODEvent* event, Bool_t &centralitypass)
+{
+    //============================Multiplicity TPV vs Global===============================================================================
+    const Int_t nGoodTracks = event->GetNumberOfTracks();
+    Float_t multTPC(0.); // tpc mult estimate
+    Float_t multGlob(0.); // global multiplicity
+    for(Int_t iTracks = 0; iTracks < nGoodTracks; iTracks++) { // fill tpc mult
+        AliAODTrack* trackAOD = event->GetTrack(iTracks);
+        if (!trackAOD) continue;
+        if (!(trackAOD->TestFilterBit(1))) continue;
+        if ((trackAOD->Pt() < .2) || (trackAOD->Pt() > 5.0) || (TMath::Abs(trackAOD->Eta()) > .8) || (trackAOD->GetTPCNcls() < 70)  || (trackAOD->GetDetPid()->GetTPCsignal() < 10.0) || (trackAOD->Chi2perNDF() < 0.2)) continue;
+        multTPC++;
+    }
+    for(Int_t iTracks = 0; iTracks < nGoodTracks; iTracks++) { // fill global mult
+        AliAODTrack* trackAOD = event->GetTrack(iTracks);
+        if (!trackAOD) continue;
+        if (!(trackAOD->TestFilterBit(16))) continue;
+        if ((trackAOD->Pt() < .2) || (trackAOD->Pt() > 5.0) || (TMath::Abs(trackAOD->Eta()) > .8) || (trackAOD->GetTPCNcls() < 70) || (trackAOD->GetDetPid()->GetTPCsignal() < 10.0) || (trackAOD->Chi2perNDF() < 0.1)) continue;
+        Double_t b[2] = {-99., -99.};
+        Double_t bCov[3] = {-99., -99., -99.};
+        if (!(trackAOD->PropagateToDCA(event->GetPrimaryVertex(), event->GetMagneticField(), 100., b, bCov))) continue;
+        if ((TMath::Abs(b[0]) > 0.3) || (TMath::Abs(b[1]) > 0.3)) continue;
+        multGlob++;
+    } //track loop
+    fMultCorBeforeCuts->Fill(multGlob, multTPC);//before all cuts...even before centrality selectrion
+    //============================================================================================================================
+    // Check if event is within the set centrality range. Falls back to V0 centrality determination if no method is set
+    if (!fkCentralityMethod) AliFatal("No centrality method set! FATAL ERROR!");
+    fCentrality = event->GetCentrality()->GetCentralityPercentile(fkCentralityMethod);
+    //   cout << "--------------Centrality evaluated-------------------------"<<endl;
+    if ((fCentrality <= fCentralityMin) || (fCentrality > fCentralityMax))
+    {
+        fCentralityNoPass->Fill(fCentrality);
+        //    cout << "--------------Fill no pass-----"<< fCentrality <<"--------------------"<<endl;
+        centralitypass = kFALSE;
+    }else
+    {
+        //    cout << "--------------Fill pass----"<< fCentrality <<"---------------------"<<endl;
+        centralitypass = kTRUE;
+    }
+    if (centralitypass){
+        fMultCorAfterCentrBeforeCuts->Fill(multGlob, multTPC);
+        fCentralityBeforePileup->Fill(fCentrality);
+    }//...after centrality selectrion
+    //============================================================================================================================
+    //to remove the bias introduced by multeplicity outliers---------------------
+    Float_t centTrk = event->GetCentrality()->GetCentralityPercentile("TRK");
+    Float_t centv0 = event->GetCentrality()->GetCentralityPercentile("V0M");
+    if (TMath::Abs(centv0 - centTrk) > 5.0){
+        centralitypass = kFALSE;
+        fCentralityNoPass->Fill(fCentrality);
+    }
+    if (centralitypass){
+        fMultCorAfterVZTRKComp->Fill(multGlob, multTPC);
+        fCentralityAfterVZTRK->Fill(fCentrality);
+    }//...after centrality selectrion
+    //============================================================================================================================
+    if(fMultCut){
+        if(fTrigger==1 || fTrigger==4){
+            if(! (multTPC > (-36.73 + 1.48*multGlob) && multTPC < (62.87 + 1.78*multGlob))){
+                //   cout <<" Trigger ==" <<fTrigger<< endl;
+                centralitypass = kFALSE;
+                fCentralityNoPass->Fill(fCentrality);
+            }//2011 Semicentral
+        }
+        if(fTrigger==0){
+            if(! (multTPC > (77.9 + 1.395*multGlob) && multTPC < (187.3 + 1.665*multGlob))){
+                //     cout <<" Trigger ==" <<fTrigger<< endl;
+                centralitypass = kFALSE;
+                fCentralityNoPass->Fill(fCentrality);
+            }//2011
+        }//2011 Central
+    }
+    if (centralitypass){
+        fMultCorAfterCorrCut->Fill(multGlob, multTPC);
+        fCentralityAfterCorrCut->Fill(fCentrality);
+    }//...after CORR CUT
+    //=================================All cuts are passed==================++++==================================================
+    //=================================Now Centrality flattening for central trigger==================++++==================================================
+    if(fTrigger==0 || fTrigger==4){
+        if(!IsEventSelectedForCentrFlattening(fCentrality)){
+            centralitypass = kFALSE;
+            fCentralityNoPassForFlattening->Fill(fCentrality);
+        }
+    }
+    //==============================fill histo after all cuts==============================++++==================================================
+    if(centralitypass){
+        fCentralityPass->Fill(fCentrality);
+        fMultCorAfterCuts->Fill(multGlob, multTPC);
+        fMultvsCentr->Fill(fCentrality, multTPC);
+    }
+}
+//_____________________________________________________________________________
+void AliAnalysisTaskFlowITSTPCTOFQCSP::SetCentralityParameters(Double_t CentralityMin, Double_t CentralityMax, const char* CentralityMethod)
+{
+    // Set a centrality range ]min, max] and define the method to use for centrality selection
+    fCentralityMin = CentralityMin;
+    fCentralityMax = CentralityMax;
+    fkCentralityMethod = CentralityMethod;
+}
+//_____________________________________________________________________________
+void AliAnalysisTaskFlowITSTPCTOFQCSP::SetIDCuts(Double_t minTOFnSigma, Double_t maxTOFnSigma, Double_t minITSnsigmalowpt, Double_t maxITSnsigmalowpt,  Double_t minITSnsigmahighpt, Double_t maxITSnsigmahighpt, Double_t minTPCnsigmalowpt, Double_t maxTPCnsigmalowpt,  Double_t minTPCnsigmahighpt, Double_t maxTPCnsigmahighpt)
+{
+    //Set PID cuts
+    fminTOFnSigma = minTOFnSigma;
+    fmaxTOFnSigma = maxTOFnSigma;
+    fminITSnsigmaLowpT = minITSnsigmalowpt;
+    fmaxITSnsigmaLowpT = maxITSnsigmalowpt;
+    fminITSnsigmaHighpT = minITSnsigmahighpt;
+    fmaxITSnsigmaHighpT = maxITSnsigmahighpt;
+    fminTPCnsigmaLowpT = minTPCnsigmalowpt;
+    fmaxTPCnsigmaLowpT = maxTPCnsigmalowpt;
+    fminTPCnsigmaHighpT = minTPCnsigmahighpt;
+    fmaxTPCnsigmaHighpT = maxTPCnsigmahighpt;
+
+}
+//_____________________________________________________________________________
+//_____________________________________________________________________________
+void AliAnalysisTaskFlowITSTPCTOFQCSP::SetpTCuttrack(Double_t ptmin, Double_t ptmax)
+{
+    //Set pt cuts
+    fpTCutmin = ptmin;
+    fpTCutmax = ptmax;
+    }
+//_____________________________________________________________________________
+//_____________________________________________________________________________
+void AliAnalysisTaskFlowITSTPCTOFQCSP::SetHistoForCentralityFlattening(TH1F *h,Double_t minCentr,Double_t maxCentr,Double_t centrRef,Int_t switchTRand){
+    // set the histo for centrality flattening
+    // the centrality is flatten in the range minCentr,maxCentr
+    // if centrRef is zero, the minimum in h within (minCentr,maxCentr) defines the reference
+    //                positive, the value of h(centrRef) defines the reference (-> the centrality distribution might be not flat in the whole desired range)
+    //                negative, h(bin with max in range)*centrRef is used to define the reference (-> defines the maximum loss of events, also in this case the distribution might be not flat)
+    // switchTRand is used to set the unerflow bin of the histo: if it is < -1 in the analysis the random event selection will be done on using TRandom
+    
+    if(maxCentr<minCentr){
+        AliWarning("AliAnalysisCheckCorrdist::Wrong centralities values while setting the histogram for centrality flattening");
+    }
+    
+    if(fHistCentrDistr)delete fHistCentrDistr;
+    fHistCentrDistr=(TH1F*)h->Clone("hCentralityFlat");
+    fHistCentrDistr->SetTitle("Reference histo for centrality flattening");
+    Int_t minbin=fHistCentrDistr->FindBin(minCentr*1.00001); // fast if fix bin width
+    Int_t maxbin=fHistCentrDistr->FindBin(maxCentr*0.9999);
+    fHistCentrDistr->GetXaxis()->SetRange(minbin,maxbin);
+    Double_t ref=0.,bincont=0.,binrefwidth=1.;
+    Int_t binref=0;
+    if(TMath::Abs(centrRef)<0.0001){
+        binref=fHistCentrDistr->GetMinimumBin();
+        binrefwidth=fHistCentrDistr->GetBinWidth(binref);
+        ref=fHistCentrDistr->GetBinContent(binref)/binrefwidth;
+    }
+    else if(centrRef>0.){
+        binref=h->FindBin(centrRef);
+        if(binref<1||binref>h->GetNbinsX()){
+            AliWarning("AliRDHFCuts::Wrong centrality reference value while setting the histogram for centrality flattening");
+        }
+        binrefwidth=fHistCentrDistr->GetBinWidth(binref);
+        ref=fHistCentrDistr->GetBinContent(binref)/binrefwidth;
+    }
+    else{
+        if(centrRef<-1) AliWarning("AliRDHFCuts: with this centrality reference no flattening will be applied");
+        binref=fHistCentrDistr->GetMaximumBin();
+        binrefwidth=fHistCentrDistr->GetBinWidth(binref);
+        ref=fHistCentrDistr->GetMaximum()*TMath::Abs(centrRef)/binrefwidth;
+    }
+    
+    for(Int_t j=1;j<=h->GetNbinsX();j++){// Now set the "probabilities"
+        if(h->GetBinLowEdge(j)*1.0001>=minCentr&&h->GetBinLowEdge(j+1)*0.9999<=maxCentr){
+            bincont=h->GetBinContent(j);
+            fHistCentrDistr->SetBinContent(j,ref/bincont*h->GetBinWidth(j));
+            fHistCentrDistr->SetBinError(j,h->GetBinError(j)*ref/bincont);
+        }
+        else{
+            h->SetBinContent(j,1.1);// prob > 1 to assure that events will not be rejected
+        }
+    }
+    
+    fHistCentrDistr->SetBinContent(0,switchTRand);
+    return;
+    
+}
+
+//-------------------------------------------------
+Bool_t AliAnalysisTaskFlowITSTPCTOFQCSP::IsEventSelectedForCentrFlattening(Float_t centvalue){
+    //
+    //  Random event selection, based on fHistCentrDistr, to flatten the centrality distribution
+    //  Can be faster if it was required that fHistCentrDistr covers
+    //  exactly the desired centrality range (e.g. part of the lines below should be done during the
+    // setting of the histo) and TH1::SetMinimum called
+    //
+    
+    if(!fHistCentrDistr) return kTRUE;
+    // Int_t maxbin=fHistCentrDistr->FindBin(fMaxCentrality*0.9999);
+    //   if(maxbin>fHistCentrDistr->GetNbinsX()){
+    //     AliWarning("AliRDHFCuts: The maximum centrality exceeds the x-axis limit of the histogram for centrality flattening");
+    //   }
+    
+    Int_t bin=fHistCentrDistr->FindBin(centvalue); // Fast if the histo has a fix bin
+    Double_t bincont=fHistCentrDistr->GetBinContent(bin);
+    Double_t centDigits=centvalue-(Int_t)(centvalue*100.)/100.;// this is to extract a random number between 0 and 0.01
+    
+    if(fHistCentrDistr->GetBinContent(0)<-0.9999){
+        if(gRandom->Uniform(1.)<bincont)return kTRUE;
+        return kFALSE;
+    }
+    
+    if(centDigits*100.<bincont)return kTRUE;
+    return kFALSE;
+    
+}
+//---------------------------------------------------------------------------
+
+
+//_____________________________________________________________________________
+
diff --git a/PWGHF/hfe/AliAnalysisTaskFlowITSTPCTOFQCSP.h b/PWGHF/hfe/AliAnalysisTaskFlowITSTPCTOFQCSP.h
new file mode 100755 (executable)
index 0000000..aeafacd
--- /dev/null
@@ -0,0 +1,188 @@
+#ifndef ALIANALYSISTASKFLOWITSTPCTOFQCSP_H
+#define ALIANALYSISTASKFLOWITSTPCTOFQCSP_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+////////////////////////////////////////////////////////////////////////
+//                                                                    //
+//  Task for Heavy Flavour Electron Flow  TPC plus TOF                //
+//                                                                    //
+//  Author: Andrea Dubla (Utrecht University)                         //
+//                                                                    //
+////////////////////////////////////////////////////////////////////////
+
+class THnSparse;
+class TH2F;
+class TLorentzVector;
+class AliMagF;
+class AliESDEvent;
+class AliAODEvent;
+class AliAnalysisFilter;
+class AliESDtrackCuts;
+class AliESDtrack;
+class AliAODtrack;
+class AliHFEcontainer;
+class AliHFEcuts;
+class AliHFEpid;
+class AliHFEpidQAmanager;
+class AliCFManager;
+class AliFlowTrackCuts;
+class AliFlowTrack;
+class AliFlowEvent;
+class AliFlowCandidateTrack;
+class AliFlowEventSimple;
+class AliCentrality;
+class AliPIDResponse;
+class AliSelectNonHFE;
+#include "AliAnalysisTaskSE.h"
+
+
+class AliAnalysisTaskFlowITSTPCTOFQCSP : public AliAnalysisTaskSE {
+    
+public:
+    AliAnalysisTaskFlowITSTPCTOFQCSP();
+    AliAnalysisTaskFlowITSTPCTOFQCSP(const char *name);
+    virtual ~AliAnalysisTaskFlowITSTPCTOFQCSP();
+    
+    void                                 SetEnableDebugMode() {fDebug = kTRUE; };
+    void                                 SetCentralityParameters(Double_t CentralityMin, Double_t CentralityMax, const char* CentralityMethod); //select centrality
+    void                                 CheckCentrality(AliAODEvent *event,Bool_t &centralitypass); //to use only events with the correct centrality....
+    void                                 SelectPhotonicElectron(Int_t itrack,const AliAODTrack *track, Bool_t &fFlagPhotonicElec);
+    void                                 SelectPhotonicElectronMethod(Bool_t dca){fDCA = dca;}
+    void                                 SetInvariantMassCut(Double_t invmass) {fInvmassCut = invmass;};
+    void                                 SetpTCuttrack(Double_t ptcutmin, Double_t ptcutmax);
+    void                                 SetTrigger(Int_t trig) {fTrigger = trig;};
+    void                                 SetTPCS(Int_t sig) {fTPCS = sig;};
+    void                                 SetVz(Int_t ver) {fVz = ver;};
+//    void                                 SetQAPIDSparse(Bool_t qapidsparse) {fQAPIDSparse = qapidsparse;};
+    void                                 SetOpeningAngleflag(Bool_t opang){fOP_angle = opang;};
+    void                                 SetOpeningAngleCut(Double_t opanglecut) {fOpeningAngleCut = opanglecut;};
+    template <typename T> void           PlotVZeroMultiplcities(const T* event) const;
+    template <typename T> void           SetNullCuts(T* aod);
+    void                                 PrepareFlowEvent(Int_t iMulti, AliFlowEvent *FlowEv) const;
+    virtual void                         UserCreateOutputObjects();
+    virtual void                         UserExec(Option_t *option);
+    virtual void                         Terminate(Option_t *);
+    void                                 SetRPCuts(AliFlowTrackCuts *cutsRP) { fCutsRP = cutsRP; }
+    void                                 SetHFECuts(AliHFEcuts * const cuts) { fCuts = cuts; };
+    void                                 SetIDCuts(Double_t minTOFnSigma, Double_t maxTOFnSigma, Double_t minITSnsigmalowpt, Double_t maxITSnsigmalowpt,Double_t minITSnsigmahighpt, Double_t maxITSnsigmahighpt, Double_t minTPCnsigmalowpt, Double_t maxTPCnsigmalowpt,Double_t minTPCnsigmahighpt, Double_t maxTPCnsigmahighpt );
+    
+    void                                 SetMultCorrelationCut(Bool_t multcut) {fMultCut = multcut;};
+    void                                 SetHistoForCentralityFlattening(TH1F *h,Double_t minCentr,Double_t maxCentr,Double_t centrRef=0.,Int_t switchTRand=0);
+    Bool_t                               IsEventSelectedForCentrFlattening(Float_t centvalue);
+    
+    
+    AliHFEpid *GetPID() const { return fPID; };
+    
+private:
+    
+    Bool_t ProcessCutStep(Int_t cutStep, AliVParticle *track);
+    
+    Bool_t               fDebug; //! enable debug mode
+    AliAODEvent          *fAOD;                     //AOD object
+    TList                *fOutputList;          //output list
+    AliHFEcuts           *fCuts;                 //Cut Collection
+    Bool_t               fIdentifiedAsOutInz;    //Out Of Range in z
+    Bool_t               fPassTheEventCut;       //Pass The Event Cut
+    AliCFManager         *fCFM;                  //!Correction Framework Manager
+    AliHFEpid            *fPID;                  //PID
+    AliHFEpidQAmanager   *fPIDqa;             //! PID QA manager
+    AliFlowTrackCuts     *fCutsRP; // track cuts for reference particles
+    AliFlowTrackCuts     *fNullCuts; // dummy cuts for flow event tracks
+    AliFlowEvent         *fFlowEvent; //! flow events Inclusive e
+    const char           *fkCentralityMethod; // method used to determine centrality (V0 by default)
+    Double_t             fCentrality; // event centrality for QA
+    Double_t             fCentralityMin; // lower bound of cenrality bin
+    Double_t             fCentralityMax; // upper bound of centrality bin
+    Double_t             fInvmassCut;           //invariant mass cut value
+    Double_t             fpTCutmin;    //pt cut value min
+    Double_t             fpTCutmax;    //pt cut value max
+    Int_t                fTrigger;          //invariant mass cut value
+    TH1F                 *fPhi; //! QA plot of azimuthal distribution of tracks used for event plane estimation
+    TH1F                 *fEta; //! QA plot of eta distribution of tracks used for event plane estimation
+    TH1F                 *fVZEROA; //! QA plot vzeroa multiplicity (all tracks in event)
+    TH1F                 *fVZEROC; //! QA plot vzeroc multiplicity (all tracks in event)
+    TH1F                 *fTPCM; //! QA plot TPC multiplicity (tracks used for event plane estimation)
+    TH1F                 *fNoEvents;            //no of events
+    TH1F                 *fInclusiveElecPt; // Inclusive elec pt
+    TH2F                 *fTPCnsigma;               //TPC n sigma vs p
+    TH2F                 *fTPCnsigmaAft;                //TPC n sigma vs p after HFE pid
+    TH2F                 *fITSnsigmaAft;                //ITS n sigma vs p after HFE pid
+    TH2F                 *fTPCnsigmaVSptAft;   //lodviow
+    TH2F                 *fTOFns;           //track TOFnSigma
+    TH2F                 *fTOFnsAft;                //track TOFnSigma after PID
+    TH2F                 *fTOFBetaAft;
+    TH1F                 *fCentralityPass; // ! QA histogram of events that pass centrality cut
+    TH1F                 *fCentralityNoPass; //! QA histogram of events that do not pass centrality cut
+    TH1F                 *fInvmassLS1; //LS Invmass for all rec par
+    TH1F                 *fInvmassULS1;//ULS Invmass for all rec par
+    TH1F                 *fPhotoElecPt;             //photonic elec pt
+    TH1F                 *fSemiInclElecPt;  //Semi inclusive ele pt
+    TH1F                 *fULSElecPt; //ULS elec Pt
+    TH1F                 *fLSElecPt;// LS elec pt
+    TH2F                 *fMultCorAfterCuts; //! QA profile global and tpc multiplicity after outlier cut
+    TH2F                 *fMultvsCentr; //! QA profile of centralty vs multiplicity
+    TProfile             *fSubEventDPhiv2;
+    TH1D                 *EPVzA;//ep v0a
+    TH1D                 *EPVzC;//ep v0c
+    TH1D                 *EPTPC;//ep tpc
+    THnSparseF           *fV2Phi;//! v2 analysis of EP-V0
+    TH1D                 *fvertex;//vertex
+    TH2F                 *fMultCorBeforeCuts; //! QA profile global and tpc multiplicity after outlier cut
+    THnSparseF           *fQAPid;             //! v2 analysis of EP-V0
+    Double_t             fminITSnsigmaLowpT;  //ID cuts its
+    Double_t             fmaxITSnsigmaLowpT;  //ID cuts its
+    Double_t             fminITSnsigmaHighpT;  //ID cuts its
+    Double_t             fmaxITSnsigmaHighpT;  //ID cuts its
+    Double_t             fminTPCnsigmaLowpT;  //ID cuts tpc
+    Double_t             fmaxTPCnsigmaLowpT;  //ID cuts tpc
+    Double_t             fminTPCnsigmaHighpT;  //ID cuts tpc
+    Double_t             fmaxTPCnsigmaHighpT;  //ID cuts tpc
+   // Bool_t               fQAPIDSparse;       //QAPIDSPARSE
+    Double_t             fminTOFnSigma;  //ID cuts tof
+    Double_t             fmaxTOFnSigma;//ID cuts tof
+    THnSparseF           *fQAPidSparse;             //! v2 analysis of EP-V0
+    Int_t                fTPCS; //tpc signal cluster
+    Int_t                fVz; //vertex range
+    Double_t             fOpeningAngleCut; //openingAngle cut value
+    Bool_t               fOP_angle; //to shitch on and off the op_angle cut
+    TH1F                 *fOpeningAngleLS;  //opening angle for LS pairs
+    TH1F                 *fOpeningAngleULS; //opening angle for ULS pairs
+    AliSelectNonHFE      *fNonHFE;//new elienos stuff
+    Bool_t               fDCA;//selection PHelectron
+    TH2F                 *fITSnsigma;               //TPC n sigma vs p
+    TH2F                 *fTPCnsigmaAftITSTOF;               //TPC n sigma vs p
+    TH2F                 *fTPCnsigmaAftTOF; //TPC n sigma vs p
+    TH2F                 *fITSnsigmaAftTOF;//jbd
+    TH2F                 *fITSvsTOF;               //TPC n sigma vs p
+    TH2F                 *fTPCvsITS;               //TPC n sigma vs p
+    TH2F                 *fTPCvsITSafterTOF; //TPC n sigma vs p
+    TH2F                 *fTPCvsTOF;//jbd
+    Bool_t               fMultCut;//for mult correlationcut
+    TH2F                 *fMultCorAfterCentrBeforeCuts; //! QA profile global and tpc multiplicity after outlier cut
+    TH2F                 *fMultCorAfterVZTRKComp;//!after cent comp
+    TH1F                 *fCentralityBeforePileup;//!cent chneck
+    TH1F                 *fCentralityAfterVZTRK;//!cent chneck2
+    TH1F                 *fCentralityAfterCorrCut;//!cent chneck2
+    TH2F                 *fMultCorAfterCorrCut;//!after cent comp
+    TH1D                 *EPVz;//v0cep
+    TH1D                 *EPTPCp;//tpcep
+    TH1D                 *EPTPCn;//!tpcep
+    TProfile             *fSubEventDPhiv2new;
+    THnSparseF           *fV2Phivzerotot;//! v2 analysis of EP-V0
+    TH1F                 *fHistCentrDistr;// isto for Centr Flat
+    TH1F                 *fCentralityNoPassForFlattening; //! QA histogram of events that do not pass centrality cut for flattening
+  
+    
+    AliAnalysisTaskFlowITSTPCTOFQCSP(const AliAnalysisTaskFlowITSTPCTOFQCSP&); // not implemented
+    AliAnalysisTaskFlowITSTPCTOFQCSP& operator=(const AliAnalysisTaskFlowITSTPCTOFQCSP&); // not implemented
+    
+    ClassDef(AliAnalysisTaskFlowITSTPCTOFQCSP, 2); //!example of analysis
+};
+
+#endif
+
+
+
+
diff --git a/PWGHF/hfe/AliAnalysisTaskFlowTPCTOFQCSP.cxx b/PWGHF/hfe/AliAnalysisTaskFlowTPCTOFQCSP.cxx
deleted file mode 100644 (file)
index 45bbc19..0000000
+++ /dev/null
@@ -1,1024 +0,0 @@
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *               
- *                                                                        *               
- * Author: The ALICE Off-line Project.                                    *               
- * Contributors are mentioned in the code where appropriate.              *               
- *                                                                        *               
- * Permission to use, copy, modify and distribute this software and its   *               
- * documentation strictly for non-commercial purposes is hereby granted   *               
- * without fee, provided that the above copyright notice appears in all   *               
- * copies and that both the copyright notice and this permission notice   *               
- * appear in the supporting documentation. The authors make no claims     *               
- * about the suitability of this software for any purpose. It is          *               
- * provided "as is" without express or implied warranty.                  *               
- **************************************************************************/
-
-
-////////////////////////////////////////////////////////////////////////
-//                                                                    //
-//  Task for Heavy Flavour Electron Flow with TPC plus TOF            //
-//  Non-Photonic Electron identified with Invariant mass              //
-//  analysis methos in function  SelectPhotonicElectron               //
-//                                                                    // 
-//                                                                    //
-//  Author: Andrea Dubla (Utrecht University)                         //
-//                                                                                       //
-//                                                                    //
-////////////////////////////////////////////////////////////////////////
-
-#include "TChain.h"
-#include "TTree.h"
-#include "TH2F.h"
-#include "TMath.h"
-#include "TCanvas.h"
-#include "THnSparse.h"
-#include "TLorentzVector.h"
-#include "TString.h"
-#include "TFile.h"
-#include "AliAnalysisTask.h"
-#include "AliAnalysisManager.h"
-#include "AliESDEvent.h"
-#include "AliESDHandler.h"
-#include "AliAODEvent.h"
-#include "AliAODHandler.h"
-#include "AliAnalysisTaskFlowTPCTOFQCSP.h"
-#include "TGeoGlobalMagField.h"
-#include "AliLog.h"
-#include "AliAnalysisTaskSE.h"
-#include "TRefArray.h"
-#include "TVector.h"
-#include "AliESDInputHandler.h"
-#include "AliESDpid.h"
-#include "AliAODInputHandler.h"
-#include "AliAODPid.h"
-#include "AliESDtrackCuts.h"
-#include "AliPhysicsSelection.h"
-#include "AliCentralitySelectionTask.h"
-#include "AliESDCaloCluster.h"
-#include "AliAODCaloCluster.h"
-#include "AliESDCaloTrigger.h"
-#include "AliGeomManager.h"
-#include "stdio.h"
-#include "TGeoManager.h"
-#include "iostream"
-#include "fstream"
-#include "AliEMCALTrack.h"
-//#include "AliEMCALTracker.h"
-#include "AliMagF.h"
-#include "AliKFParticle.h"
-#include "AliKFVertex.h"
-#include "AliHFEcontainer.h"
-#include "AliHFEcuts.h"
-//#include "AliHFEpid.h"
-//#include "AliHFEpidBase.h"
-//#include "AliHFEpidQAmanager.h"
-#include "AliHFEtools.h"
-#include "AliCFContainer.h"
-#include "AliCFManager.h"
-#include "AliKFParticle.h"
-#include "AliKFVertex.h"
-#include "AliCentrality.h"
-#include "AliVEvent.h"
-#include "AliStack.h"
-#include "AliMCEvent.h"
-#include "TProfile.h"
-#include "AliFlowCandidateTrack.h"
-#include "AliFlowTrackCuts.h"
-#include "AliFlowEventSimple.h"
-#include "AliFlowCommonConstants.h"
-#include "AliFlowEvent.h"
-#include "TVector3.h"
-#include "TRandom2.h"
-#include "AliESDVZERO.h"
-#include "AliAODVZERO.h"
-#include "AliPID.h"
-#include "AliPIDResponse.h"
-#include "AliAODPid.h"
-#include "AliFlowTrack.h"
-#include "AliAnalysisTaskVnV0.h"
-#include "AliSelectNonHFE.h"
-
-
-class AliFlowTrackCuts;
-
-using namespace std;
-
-ClassImp(AliAnalysisTaskFlowTPCTOFQCSP)
-//________________________________________________________________________
-  AliAnalysisTaskFlowTPCTOFQCSP::AliAnalysisTaskFlowTPCTOFQCSP(const char *name) 
-  : AliAnalysisTaskSE(name)
-,fDebug(0)
-,fAOD(0)
-,fOutputList(0)
-,fCuts(0)
-,fIdentifiedAsOutInz(kFALSE)
-,fPassTheEventCut(kFALSE)
-,fCFM(0)
-//,fPID(0)
-//,fPIDqa(0)
-,fCutsRP(0)     // track cuts for reference particles
-,fNullCuts(0) // dummy cuts for flow event tracks
-,fFlowEvent(0) //! flow events (one for each inv mass band)
-,fkCentralityMethod(0)
-,fCentrality(0)
-,fCentralityMin(0)
-,fCentralityMax(0)
-,fInvmassCut(0)
-,fpTCut(0)
-,fTrigger(0)
-,fPhi(0)
-,fEta(0)
-,fVZEROA(0)
-,fVZEROC(0)
-,fTPCM(0)
-,fNoEvents(0)
-,fInclusiveElecPt(0)
-//,fTPCnsigma(0)
-,fTPCnsigmaAft(0)
-//,fTOFns(0)
-,fTOFnsAft(0)
-,fTOFBetaAft(0)
-,fCentralityPass(0)
-,fCentralityNoPass(0)
-,fInvmassLS1(0)
-,fInvmassULS1(0)
-,fPhotoElecPt(0)
-,fSemiInclElecPt(0)
-,fULSElecPt(0)
-,fLSElecPt(0)
-,fMultCorAfterCuts(0)
-,fMultvsCentr(0)
-,fSubEventDPhiv2(0)
-,EPVzA(0)
-,EPVzC(0)
-,EPTPC(0)
-,fV2Phi(0)
-,fvertex(0)
-,fMultCorBeforeCuts(0)
-,fPIDResponse(0)
-,fQAPid(0)
-,fminTPCnsigma(0)
-,fmaxTPCnsigma(3)
-,fQAPIDSparse(kFALSE)
-,fminTOFnSigma(-2)
-,fmaxTOFnSigma(2)
-,fQAPidSparse(0)
-,fTPCS(0)
-,fVz(0)
-,fPhiCut(0)
-,fOpeningAngleCut(0.1)
-,fOP_angle(0)
-,fOpeningAngleLS(0)
-,fOpeningAngleULS(0)
-,fNonHFE(new AliSelectNonHFE)
-,fDCA(0)
-{
-  //Named constructor
-
-//  fPID = new AliHFEpid("hfePid");
-  // Define input and output slots here
-  // Input slot #0 works with a TChain
-  DefineInput(0, TChain::Class());
-  // Output slot #0 id reserved by the base class for AOD
-  // Output slot #1 writes into a TH1 container
-  // DefineOutput(1, TH1I::Class());
-  DefineOutput(1, TList::Class());
-  DefineOutput(2, AliFlowEventSimple::Class());
-}
-
-//________________________________________________________________________
-AliAnalysisTaskFlowTPCTOFQCSP::AliAnalysisTaskFlowTPCTOFQCSP() 
-  : AliAnalysisTaskSE("DefaultAnalysis_AliAnalysisElectFlow")
-,fDebug(0)
-,fAOD(0)
-,fOutputList(0)
-,fCuts(0)
-,fIdentifiedAsOutInz(kFALSE)
-,fPassTheEventCut(kFALSE)
-,fCFM(0)
-//,fPID(0)
-//,fPIDqa(0)
-,fCutsRP(0)     // track cuts for reference particles
-,fNullCuts(0) // dummy cuts for flow event tracks
-,fFlowEvent(0) //! flow events (one for each inv mass band)
-,fkCentralityMethod(0)
-,fCentrality(0)
-,fCentralityMin(0)
-,fCentralityMax(0)
-,fInvmassCut(0)
-,fpTCut(0)
-,fTrigger(0)
-,fPhi(0)
-,fEta(0)
-,fVZEROA(0)
-,fVZEROC(0)
-,fTPCM(0)
-,fNoEvents(0)
-,fInclusiveElecPt(0)
-//,fTPCnsigma(0)
-,fTPCnsigmaAft(0)
-//,fTOFns(0)
-,fTOFnsAft(0)
-,fTOFBetaAft(0)
-,fCentralityPass(0)
-,fCentralityNoPass(0)
-,fInvmassLS1(0)
-,fInvmassULS1(0)
-,fPhotoElecPt(0)
-,fSemiInclElecPt(0)
-,fULSElecPt(0)
-,fLSElecPt(0)
-,fMultCorAfterCuts(0)
-,fMultvsCentr(0)
-,fSubEventDPhiv2(0)
-,EPVzA(0)
-,EPVzC(0)
-,EPTPC(0)
-,fV2Phi(0)
-,fvertex(0)
-,fMultCorBeforeCuts(0)
-,fPIDResponse(0)
-,fQAPid(0)
-,fminTPCnsigma(0)
-,fmaxTPCnsigma(3)
-,fQAPIDSparse(kFALSE)
-,fminTOFnSigma(-2)
-,fmaxTOFnSigma(2)
-,fQAPidSparse(0)
-,fTPCS(0)
-,fVz(0)
-,fPhiCut(0)
-,fOpeningAngleCut(0.1)
-,fOP_angle(0)
-,fOpeningAngleLS(0)
-,fOpeningAngleULS(0)
-,fNonHFE(new AliSelectNonHFE)
-,fDCA(0)
-{
-  //Default constructor
-//  fPID = new AliHFEpid("hfePid");
-  // Constructor
-  // Define input and output slots here
-  // Input slot #0 works with a TChain
-  DefineInput(0, TChain::Class());
-  // Output slot #0 id reserved by the base class for AOD
-  // Output slot #1 writes into a TH1 container
-  // DefineOutput(1, TH1I::Class());
-  DefineOutput(1, TList::Class());
-  DefineOutput(2, AliFlowEventSimple::Class());
-    //DefineOutput(3, TTree::Class());
-}
-//_________________________________________
-
-AliAnalysisTaskFlowTPCTOFQCSP::~AliAnalysisTaskFlowTPCTOFQCSP()
-{
-  //Destructor 
-
-  delete fOutputList;
-//  delete fPID;
-  delete fPIDResponse;
-  delete fCFM;
-//  delete fPIDqa;
-  if (fOutputList) delete fOutputList;
-  if (fFlowEvent) delete fFlowEvent;
-    delete fNonHFE;
-}
-//_________________________________________
-
-void AliAnalysisTaskFlowTPCTOFQCSP::UserExec(Option_t*)
-{
-  //Main loop
-  //Called for each event
-
-  // create pointer to event
-
-  fAOD = dynamic_cast<AliAODEvent*>(InputEvent());
-    
-     
-  if (!fAOD)
-  {
-    printf("ERROR: fAOD not available\n");
-    return;
-  }
-
-  if(!fCuts)
-  {
-    AliError("HFE cuts not available");
-    return;
-  }
-
-//  if(!fPID->IsInitialized())
-//  {
-    // Initialize PID with the given run number
-//    AliWarning("PID not initialised, get from Run no");
-//    fPID->InitializePID(fAOD->GetRunNumber());
-//  }
-    
-  // cout << "kTrigger   ==   " << fTrigger <<endl;
-    
-    if(fTrigger==0){
-if(!(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kCentral) ) return;
-    }
-    if(fTrigger==1){
-if(!(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & (AliVEvent::kSemiCentral))) return;
-    }
-    if(fTrigger==2){
-if(!(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kEMCEGA) ) return;
-    }
-    if(fTrigger==3){
-if(!(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kMB) ) return;
-    }
-  
-    
-//---------------CENTRALITY AND EVENT SELECTION-----------------------
-    
-    
-    
-   Int_t fNOtrks =  fAOD->GetNumberOfTracks();
-    Float_t vtxz = -999;
-    const AliAODVertex* trkVtx = fAOD->GetPrimaryVertex();
-    if (!trkVtx || trkVtx->GetNContributors()<=0)return;
-    TString vtxTtl = trkVtx->GetTitle();
-    if (!vtxTtl.Contains("VertexerTracks"))return;
-    const AliAODVertex* spdVtx = fAOD->GetPrimaryVertexSPD();
-    if (!spdVtx || spdVtx->GetNContributors()<=0)return;
-    if (TMath::Abs(spdVtx->GetZ() - trkVtx->GetZ())>0.5)return;
-    vtxz = trkVtx->GetZ();
-    if(TMath::Abs(vtxz)>fVz)return;
-
-// Event cut
-    if(!fCFM->CheckEventCuts(AliHFEcuts::kEventStepReconstructed, fAOD)) return;
-    if(fNOtrks<2) return;
-    
-
-    Bool_t pass = kFALSE; //to select centrality
-    CheckCentrality(fAOD,pass);
-    if(!pass)return;
-    
-    fvertex->Fill(vtxz);
-
-    
-    fNoEvents->Fill(0);
-    PlotVZeroMultiplcities(fAOD);
-
-    SetNullCuts(fAOD);
-    PrepareFlowEvent(fAOD->GetNumberOfTracks(),fFlowEvent);    //Calculate event plane Qvector and EP resolution for inclusive
-    
-    fCFM->SetRecEventInfo(fAOD);
-
-  // Look for kink mother
-  Int_t numberofvertices = fAOD->GetNumberOfVertices();
-  Double_t listofmotherkink[numberofvertices];
-  Int_t numberofmotherkink = 0;
-  for(Int_t ivertex=0; ivertex < numberofvertices; ivertex++) {
-    AliAODVertex *aodvertex = fAOD->GetVertex(ivertex);
-    if(!aodvertex) continue;
-    if(aodvertex->GetType()==AliAODVertex::kKink) {
-      AliAODTrack *mother = (AliAODTrack *) aodvertex->GetParent();
-      if(!mother) continue;
-      Int_t idmother = mother->GetID();
-      listofmotherkink[numberofmotherkink] = idmother;
-      //printf("ID %d\n",idmother);
-      numberofmotherkink++;
-    }
-  }
-    
-//=============================================V0EP from Alex======================================================================
-    Double_t qxEPa = 0, qyEPa = 0;
-    Double_t qxEPc = 0, qyEPc = 0;
-    
-    Double_t evPlAngV0A = fAOD->GetEventplane()->CalculateVZEROEventPlane(fAOD, 8, 2, qxEPa, qyEPa);
-    Double_t evPlAngV0C = fAOD->GetEventplane()->CalculateVZEROEventPlane(fAOD, 9, 2, qxEPc, qyEPc);
-    
-    
-    Double_t Qx2 = 0, Qy2 = 0;
-    
-    for (Int_t iT = 0; iT < fAOD->GetNumberOfTracks(); iT++){
-        
-        AliAODTrack* aodTrack = fAOD->GetTrack(iT);
-        
-        if (!aodTrack)
-            continue;
-        
-        if ((TMath::Abs(aodTrack->Eta()) > 0.8) || (aodTrack->Pt() < 0.2) || (aodTrack->GetTPCNcls() < 70) || (aodTrack->Pt() >= 20.0))
-            continue;
-        
-        if (!aodTrack->TestFilterBit(128))
-            continue;
-        
-        Qx2 += TMath::Cos(2*aodTrack->Phi());
-        Qy2 += TMath::Sin(2*aodTrack->Phi());
-    }
-    
-    Double_t evPlAngTPC = TMath::ATan2(Qy2, Qx2)/2.;
-    
-    EPVzA->Fill(evPlAngV0A);
-    EPVzC->Fill(evPlAngV0C);
-    EPTPC->Fill(evPlAngTPC);
-    
-    fSubEventDPhiv2->Fill(0.5, TMath::Cos(2.*(evPlAngV0A-evPlAngTPC))); // vzeroa - tpc
-    fSubEventDPhiv2->Fill(1.5, TMath::Cos(2.*(evPlAngV0A-evPlAngV0C))); // vzeroa - vzeroc
-    fSubEventDPhiv2->Fill(2.5, TMath::Cos(2.*(evPlAngV0C-evPlAngTPC))); // tpc - vzeroc
-//====================================================================================================================
-    
- AliAODTrack *track = NULL;
-
-// Track loop 
- for (Int_t iTracks = 0; iTracks < fAOD->GetNumberOfTracks(); iTracks++) 
- {
-     
-     
-       
-   track = fAOD->GetTrack(iTracks);
-   if (!track)
-   {
-     printf("ERROR: Could not receive track %d\n", iTracks);
-     continue;
-   }
-     
-   if(!track->TestFilterMask(AliAODTrack::kTrkGlobalNoDCA)) continue;  // TESTBIT FOR AOD double Counting
-     
-//--------------------------------------hfe begin-----------------------------------------------------------
-//==========================================================================================================
-//======================================track cuts==========================================================
-   if(track->Eta()<-0.8 || track->Eta()>0.8)   continue;    //eta cuts on candidates
-
-   // RecKine: ITSTPC cuts  
-   if(!ProcessCutStep(AliHFEcuts::kStepRecKineITSTPC, track)) continue;
-
-   // Reject kink mother
-   Bool_t kinkmotherpass = kTRUE;
-   for(Int_t kinkmother = 0; kinkmother < numberofmotherkink; kinkmother++) {
-     if(track->GetID() == listofmotherkink[kinkmother]) {
-       kinkmotherpass = kFALSE;
-       continue;
-     }
-   }
-   if(!kinkmotherpass) continue;
-
-   // RecPrim
- //  if(!ProcessCutStep(AliHFEcuts::kStepRecPrim, track)) continue;  //deleted for DCA absence
-   // HFEcuts: ITS layers cuts
-   if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsITS, track)) continue;
-   // HFE cuts: TPC PID cleanup
-   if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTPC, track)) continue;
-//==========================================================================================================
-     Double_t eta = track->Eta();
-     Double_t phi = track->Phi();
-     Double_t pt = track->Pt();         //pt track after cuts
-     if(pt<fpTCut) continue;
-//==========================================================================================================
-//=========================================PID==============================================================
-     if(track->GetTPCsignalN() < fTPCS) continue;
-     Float_t fTPCnSigma = fPIDResponse->NumberOfSigmasTPC(track, AliPID::kElectron);
-     Float_t fTOFnSigma = fPIDResponse->NumberOfSigmasTOF(track, AliPID::kElectron);
-     
-  //   Float_t eDEDX = fPIDResponse->GetTPCResponse().GetExpectedSignal(track, AliPID::kElectron, AliTPCPIDResponse::kdEdxDefault, kTRUE);
-
-//     fTPCnsigma->Fill(track->P(),fTPCnSigma);
-//     fTOFns->Fill(track->P(),fTOFnSigma);
-     
-     Double_t valPidSparse[4] = {
-         pt,
-         fTPCnSigma,
-         fTOFnSigma,
-         phi
-        };
-     fQAPidSparse->Fill(valPidSparse);
-
-     /* || track->GetTPCsignal() < 72 || track->GetTPCsignal() > 95*/
-
-     if(fTOFnSigma < fminTOFnSigma || fTOFnSigma > fmaxTOFnSigma) continue;
-     if(fTPCnSigma < fminTPCnsigma || fTPCnSigma > fmaxTPCnsigma) continue; //cuts on nsigma tpc
-//==========================================================================================================
-//=========================================QA PID SPARSE====================================================
-     Float_t timeTOF = track->GetTOFsignal();
-     Double_t intTime[5] = {-99., -99., -99., -99., -99.};
-     track->GetIntegratedTimes(intTime);
-     Float_t timeElec = intTime[0];
-     Float_t intLength = 2.99792458e-2* timeElec;
-     Double_t beta = 0.1;
-     if ((intLength > 0) && (timeTOF > 0))
-         beta = intLength/2.99792458e-2/timeTOF;
-   
-    if(fQAPIDSparse){
-     Double_t valPid[4] = {
-         track->P(),
-         track->GetTPCsignal(),
-         beta,
-         track->Charge()
-         };
-     fQAPid->Fill(valPid);
-     }
-   
-     
-      if(fPhiCut){
-      if(phi<1.4 || phi >3.14)continue; //to have same EMCal phi acceptance
-      }
-     
-//==========================================================================================================
-//============================Event Plane Method with V0====================================================
-     Double_t v2PhiV0A = TMath::Cos(2*(phi - evPlAngV0A));
-     Double_t v2PhiV0C = TMath::Cos(2*(phi - evPlAngV0C));
-     Double_t v2Phi[3] = {
-         v2PhiV0A,
-         v2PhiV0C,
-         pt};
-     fV2Phi->Fill(v2Phi);
-//=========================================================================================================
-   fTPCnsigmaAft->Fill(track->P(),fTPCnSigma);
-   fTOFnsAft->Fill(track->P(),fTOFnSigma);
-   fTOFBetaAft->Fill(track->P(),beta);
-   fInclusiveElecPt->Fill(pt);
-   fPhi->Fill(phi);
-   fEta->Fill(eta);
-//=========================================================================================================
-//----------------------Flow of Inclusive Electrons--------------------------------------------------------
-   AliFlowTrack *sTrack = new AliFlowTrack();
-     sTrack->Set(track);
-     sTrack->SetID(track->GetID());
-     sTrack->SetForRPSelection(kFALSE);
-     sTrack->SetForPOISelection(kTRUE);
-     sTrack->SetMass(263732);
-     for(int iRPs=0; iRPs!=fFlowEvent->NumberOfTracks(); ++iRPs)
-     {
-      //   cout << " no of rps " << iRPs << endl;
-         AliFlowTrack *iRP = dynamic_cast<AliFlowTrack*>(fFlowEvent->GetTrack( iRPs ));
-         if (!iRP) continue;
-         if (!iRP->InRPSelection()) continue;
-        if( sTrack->GetID() == iRP->GetID())
-        {
-          if(fDebug) printf(" was in RP set");
-          //  cout << sTrack->GetID() <<"   ==  " << iRP->GetID() << " was in RP set====REMOVED" <<endl;
-            iRP->SetForRPSelection(kFALSE);
-            fFlowEvent->SetNumberOfRPs(fFlowEvent->GetNumberOfRPs() - 1);
-        }
-      } //end of for loop on RPs
-   fFlowEvent->InsertTrack(((AliFlowTrack*) sTrack));
-
-     
-     if(fDCA){
-     fNonHFE = new AliSelectNonHFE();
-     fNonHFE->SetAODanalysis(kTRUE);
-     fNonHFE->SetInvariantMassCut(fInvmassCut);
-     if(fOP_angle) fNonHFE->SetOpeningAngleCut(fOpeningAngleCut);
-     //fNonHFE->SetChi2OverNDFCut(fChi2Cut);
-     //if(fDCAcutFlag) fNonHFE->SetDCACut(fDCAcut);
-     fNonHFE->SetAlgorithm("DCA"); //KF
-     fNonHFE->SetPIDresponse(fPIDResponse);
-     fNonHFE->SetTrackCuts(-3,3);
-     
-     fNonHFE->SetHistAngleBack(fOpeningAngleLS);
-     fNonHFE->SetHistAngle(fOpeningAngleULS);
-     //fNonHFE->SetHistDCABack(fDCABack);
-     //fNonHFE->SetHistDCA(fDCA);
-     fNonHFE->SetHistMassBack(fInvmassLS1);
-     fNonHFE->SetHistMass(fInvmassULS1);
-     
-     fNonHFE->FindNonHFE(iTracks,track,fAOD);
-     
-     // Int_t *fUlsPartner = fNonHFE->GetPartnersULS();
-     // Int_t *fLsPartner = fNonHFE->GetPartnersLS();
-     // Bool_t fUlsIsPartner = kFALSE;
-     // Bool_t fLsIsPartner = kFALSE;
-     if(fNonHFE->IsULS()){
-     for(Int_t kULS =0; kULS < fNonHFE->GetNULS(); kULS++){
-   fULSElecPt->Fill(track->Pt());
-     }
-         }
-     
-     if(fNonHFE->IsLS()){
-         for(Int_t kLS =0; kLS < fNonHFE->GetNLS(); kLS++){
-             fLSElecPt->Fill(track->Pt());
-         }
-     }
-     }
-     if(!fDCA){
-     //=========================================================================================================
-     //----------------------Selection and Flow of Photonic Electrons-----------------------------
-      Bool_t fFlagPhotonicElec = kFALSE;
-        SelectPhotonicElectron(iTracks,track,fFlagPhotonicElec);
-   if(fFlagPhotonicElec){fPhotoElecPt->Fill(pt);}
-   // Semi inclusive electron 
-   if(!fFlagPhotonicElec){fSemiInclElecPt->Fill(pt);}
-     }
-//-------------------------------------------------------------------------------------------
-
- }//end loop on track
- PostData(1, fOutputList);
- PostData(2, fFlowEvent);
- //----------hfe end---------
-}
-//_________________________________________
-void AliAnalysisTaskFlowTPCTOFQCSP::SelectPhotonicElectron(Int_t itrack,const AliAODTrack *track, Bool_t &fFlagPhotonicElec)
-{
-    
-  //Identify non-heavy flavour electrons using Invariant mass method
-  Bool_t flagPhotonicElec = kFALSE;
-
-  for(Int_t jTracks = 0; jTracks<fAOD->GetNumberOfTracks(); jTracks++){
-    AliAODTrack *trackAsso = fAOD->GetTrack(jTracks);
-    if (!trackAsso) {
-      printf("ERROR: Could not receive track %d\n", jTracks);
-      continue;
-    }
-    //  if(!track->TestFilterMask(AliAODTrack::kTrkGlobalNoDCA)) continue;  // TESTBIT FOR AOD double Counting
-      if(!trackAsso->TestFilterMask(AliAODTrack::kTrkTPCOnly)) continue;
-      if((!(trackAsso->GetStatus()&AliESDtrack::kITSrefit)|| (!(trackAsso->GetStatus()&AliESDtrack::kTPCrefit)))) continue;
-
-      
-    if(jTracks == itrack) continue;
-    Double_t ptAsso=-999., nsigma=-999.0;
-    Double_t mass=-999., width = -999;
-      Double_t openingAngle = -999.;
-    Bool_t fFlagLS=kFALSE, fFlagULS=kFALSE;
-
-  
-    ptAsso = trackAsso->Pt();
-    Short_t chargeAsso = trackAsso->Charge();
-    Short_t charge = track->Charge();
-      nsigma = fPIDResponse->NumberOfSigmasTPC(track, AliPID::kElectron);
-
-    if(trackAsso->GetTPCNcls() < 80) continue;
-    if(nsigma < -3 || nsigma > 3) continue;
-    if(trackAsso->Eta()<-0.9 || trackAsso->Eta()>0.9) continue;
-    if(ptAsso <0.3) continue;
-
-    Int_t fPDGe1 = 11; Int_t fPDGe2 = 11;
-    if(charge>0) fPDGe1 = -11;
-    if(chargeAsso>0) fPDGe2 = -11;
-
-    if(charge == chargeAsso) fFlagLS = kTRUE;
-    if(charge != chargeAsso) fFlagULS = kTRUE;
-      
-    AliKFParticle::SetField(fAOD->GetMagneticField());
-    AliKFParticle ge1 = AliKFParticle(*track, fPDGe1);
-    AliKFParticle ge2 = AliKFParticle(*trackAsso, fPDGe2);
-    AliKFParticle recg(ge1, ge2);
-
-    if(recg.GetNDF()<1) continue;
-    Double_t chi2recg = recg.GetChi2()/recg.GetNDF();
-    if(TMath::Sqrt(TMath::Abs(chi2recg))>3.) continue;
-    recg.GetMass(mass,width);
-
-      openingAngle = ge1.GetAngle(ge2);
-      if(fFlagLS) fOpeningAngleLS->Fill(openingAngle);
-      if(fFlagULS) fOpeningAngleULS->Fill(openingAngle);
-      if(fOP_angle){if(openingAngle > fOpeningAngleCut) continue;}
-      
-      
-    if(fFlagLS) fInvmassLS1->Fill(mass);
-    if(fFlagULS) fInvmassULS1->Fill(mass);
-           
-       if(mass<fInvmassCut){
-       if(fFlagULS){fULSElecPt->Fill(track->Pt());}
-       if(fFlagLS){fLSElecPt->Fill(track->Pt());}
-       }
-    
-    if(mass<fInvmassCut && fFlagULS && !flagPhotonicElec){
-      flagPhotonicElec = kTRUE;
-    }
-  }//track loop
-    
-  fFlagPhotonicElec = flagPhotonicElec;
-} 
-//___________________________________________
-void AliAnalysisTaskFlowTPCTOFQCSP::UserCreateOutputObjects()
-{
-    
-  //Create histograms
-  //----------hfe initialising begin---------
-   fNullCuts = new AliFlowTrackCuts("null_cuts");
-   AliFlowCommonConstants* cc = AliFlowCommonConstants::GetMaster();
-  cc->SetNbinsMult(10000);
-  cc->SetMultMin(0);
-  cc->SetMultMax(10000);
-
-  cc->SetNbinsPt(20);
-  cc->SetPtMin(0);
-  cc->SetPtMax(10);
-
-  cc->SetNbinsPhi(180);
-  cc->SetPhiMin(0.0);
-  cc->SetPhiMax(TMath::TwoPi());
-
-  cc->SetNbinsEta(30);
-  cc->SetEtaMin(-8.0);
-  cc->SetEtaMax(+8.0);
-
-  cc->SetNbinsQ(500);
-  cc->SetQMin(0.0);
-  cc->SetQMax(3.0);
-
-    AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
-    AliInputEventHandler *inputHandler=dynamic_cast<AliInputEventHandler*>(man->GetInputEventHandler());
-    if (!inputHandler){
-        AliFatal("Input handler needed");
-    }
-    else{
-        fPIDResponse=inputHandler->GetPIDResponse();
-    }
-  //pid response object
-  if (!fPIDResponse)AliError("PIDResponse object was not created");
-    
-    
-    //--------Initialize PID
-    //    fPID->SetHasMCData(kFALSE);
-    //    if(!fPID->GetNumberOfPIDdetectors())
-    //   {
-    //       fPID->AddDetector("TPC", 0);
-    //   fPID->AddDetector("EMCAL", 1);
-    //   }
-    
-    //   fPID->SortDetectors();
-    //   fPIDqa = new AliHFEpidQAmanager();
-    //   fPIDqa->Initialize(fPID);
-    
-  
-    
-  //--------Initialize correction Framework and Cuts
-  fCFM = new AliCFManager;
-  const Int_t kNcutSteps = AliHFEcuts::kNcutStepsMCTrack + AliHFEcuts::kNcutStepsRecTrack + AliHFEcuts::kNcutStepsDETrack;
-  fCFM->SetNStepParticle(kNcutSteps);
-  for(Int_t istep = 0; istep < kNcutSteps; istep++)
-    fCFM->SetParticleCutsList(istep, NULL);
-
-  if(!fCuts){
-    AliWarning("Cuts not available. Default cuts will be used");
-    fCuts = new AliHFEcuts;
-    fCuts->CreateStandardCuts();
-  }
-
-  fCuts->SetAOD(); 
-  fCuts->Initialize(fCFM);
-  //----------hfe initialising end--------
-  //---------Output Tlist
-  fOutputList = new TList();
-  fOutputList->SetOwner();
-//  fOutputList->Add(fPIDqa->MakeList("PIDQA"));
-
-  fNoEvents = new TH1F("fNoEvents","",1,0,1) ;
-  fOutputList->Add(fNoEvents);
-
-//  fTPCnsigma = new TH2F("fTPCnsigma", "TPC - n sigma before HFE pid",1000,0,50,200,-10,10);
- // fOutputList->Add(fTPCnsigma);
-
-  fTPCnsigmaAft = new TH2F("fTPCnsigmaAft", "TPC - n sigma after HFE pid",1000,0,50,200,-10,10);
-  fOutputList->Add(fTPCnsigmaAft);
-
-//  fTOFns = new TH2F("fTOFns","track TOFnSigma",1000,0,50,200,-10,10);
-//  fOutputList->Add(fTOFns);
-
-  fTOFnsAft = new TH2F("fTOFnsAft","track TOFnSigma",1000,0,50,200,-10,10);
-  fOutputList->Add(fTOFnsAft);
-
-  fTOFBetaAft = new TH2F("fTOFBetaAft","track TOFBeta",1000,0,50,120,0,1.2);
-  fOutputList->Add(fTOFBetaAft);
-    
-  fInclusiveElecPt = new TH1F("fInclElecPt", "Inclusive electron pt",1000,0,100);
-  fOutputList->Add(fInclusiveElecPt);
-
-  fPhotoElecPt = new TH1F("fPhotoElecPt", "photonic electron pt",1000,0,100);
-  fOutputList->Add(fPhotoElecPt);
-      
-  fSemiInclElecPt = new TH1F("fSemiInclElecPt", "Semi-inclusive electron pt",1000,0,100);
-  fOutputList->Add(fSemiInclElecPt);
-
-  fULSElecPt = new TH1F("fULSElecPt", "ULS electron pt",1000,0,100);
-  fOutputList->Add(fULSElecPt);
-
-  fLSElecPt = new TH1F("fLSElecPt", "LS electron pt",1000,0,100);
-  fOutputList->Add(fLSElecPt);
-
-  fInvmassLS1 = new TH1F("fInvmassLS1", "Inv mass of LS (e,e); mass(GeV/c^2); counts;", 1000,0,1.0);
-  fOutputList->Add(fInvmassLS1);
-
-  fInvmassULS1 = new TH1F("fInvmassULS1", "Inv mass of ULS (e,e); mass(GeV/c^2); counts;", 1000,0,1.0);
-  fOutputList->Add(fInvmassULS1);
-
-  fCentralityPass = new TH1F("fCentralityPass", "Centrality Pass", 101, -1, 100);
-  fOutputList->Add(fCentralityPass);
-
-  fCentralityNoPass = new TH1F("fCentralityNoPass", "Centrality No Pass", 101, -1, 100);
-  fOutputList->Add(fCentralityNoPass);
-
-  fPhi = new TH1F("fPhi", "#phi distribution", 100, -.5, 7);
-  fOutputList->Add(fPhi);
-
-  fEta = new TH1F("fEta", "#eta distribution", 100, -1.1, 1.1);
-  fOutputList->Add(fEta);
-
-  fVZEROA = new TH1F("fVZEROA", "VZERO A Multiplicity", 1000, 0, 10000);
-  fOutputList->Add(fVZEROA);
-
-  fVZEROC = new TH1F("fVZEROC", "VZERO C Multiplicity", 1000, 0, 10000);
-  fOutputList->Add(fVZEROC);
-
-  fTPCM = new TH1F("fTPCM", "TPC multiplicity", 1000, 0, 10000);
-  fOutputList->Add(fTPCM);
-
-  fvertex = new TH1D("fvertex", "vertex distribution", 300, -15,15);
-  fOutputList->Add(fvertex);
-  
-  fMultCorBeforeCuts = new TH2F("fMultCorBeforeCuts", "TPC vs Global multiplicity (Before cuts); Global multiplicity; TPC multiplicity", 100, 0, 3000, 100, 0, 3000);
-  fOutputList->Add(fMultCorBeforeCuts);
-
-  fMultCorAfterCuts = new TH2F("fMultCorAfterCuts", "TPC vs Global multiplicity (After cuts); Global multiplicity; TPC multiplicity", 100, 0, 3000, 100, 0, 3000);
-  fOutputList->Add(fMultCorAfterCuts);
-
-  fMultvsCentr = new TH2F("fMultvsCentr", "Multiplicity vs centrality; centrality; Multiplicity", 100, 0., 100, 100, 0, 3000);
-  fOutputList->Add(fMultvsCentr);
-    
-  fOpeningAngleLS = new TH1F("fOpeningAngleLS","Opening angle for LS pairs",100,0,1);
-  fOutputList->Add(fOpeningAngleLS);
-    
-  fOpeningAngleULS = new TH1F("fOpeningAngleULS","Opening angle for ULS pairs",100,0,1);
-  fOutputList->Add(fOpeningAngleULS);
-  
-    
-    
-//----------------------------------------------------------------------------
-    EPVzA = new TH1D("EPVzA", "EPVzA", 80, -2, 2);
-    fOutputList->Add(EPVzA);
-    EPVzC = new TH1D("EPVzC", "EPVzC", 80, -2, 2);
-    fOutputList->Add(EPVzC);
-    EPTPC = new TH1D("EPTPC", "EPTPC", 80, -2, 2);
-    fOutputList->Add(EPTPC);
-//----------------------------------------------------------------------------
-    fSubEventDPhiv2 = new TProfile("fSubEventDPhiv2", "fSubEventDPhiv2", 3, 0, 3);
-    fSubEventDPhiv2->GetXaxis()->SetBinLabel(1, "<cos(2(#Psi_{a} - #Psi_{b}))>");
-    fSubEventDPhiv2->GetXaxis()->SetBinLabel(2, "<cos(2(#Psi_{a} - #Psi_{c}>))");
-    fSubEventDPhiv2->GetXaxis()->SetBinLabel(3, "<cos(2(#Psi_{b} - #Psi_{c}>))");
-    fOutputList->Add(fSubEventDPhiv2);
-//================================Event Plane with VZERO=====================
-    const Int_t nPtBins = 10;
-    Double_t binsPt[nPtBins+1] = {0, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0};
-    // v2A, v2C, pt
-    Int_t    bins[3] = {  50,  50, nPtBins};
-    Double_t xmin[3] = { -1., -1.,   0};
-    Double_t xmax[3] = {  1.,  1.,   8};
-    fV2Phi = new THnSparseF("fV2Phi", "v2A:v2C:pt", 3, bins, xmin, xmax);
-    // Set bin limits for axes which are not standard binned
-    fV2Phi->SetBinEdges(2, binsPt);
-    // set axes titles
-    fV2Phi->GetAxis(0)->SetTitle("v_{2} (V0A)");
-    fV2Phi->GetAxis(1)->SetTitle("v_{2} (V0C)");
-    fV2Phi->GetAxis(2)->SetTitle("p_{T} (GeV/c)");
-    fOutputList->Add(fV2Phi);
-//----------------------------------------------------------------------------
-//----------------------------------------------------------------------------
-    if(fQAPIDSparse){
-    Int_t    binsQA[4] = { 150,  100,  120,    3};
-    Double_t xminQA[4] = { 0.,    50,   0, -1.5};
-    Double_t xmaxQA[4] = { 15.,  150, 1.2,  1.5};    
-    fQAPid = new THnSparseF("fQAPid", "p:dEdx:beta:ch", 4, binsQA, xminQA, xmaxQA);
-    fQAPid->GetAxis(0)->SetTitle("p (Gev/c");
-    fQAPid->GetAxis(1)->SetTitle("dE/dx");
-    fQAPid->GetAxis(2)->SetTitle("#beta (TOF)");
-    fQAPid->GetAxis(3)->SetTitle("charge");
-    fOutputList->Add(fQAPid);
-    }
-//===========================================================================
-        Int_t    binsQA2[5] = { 200,  200, 200, 100};
-        Double_t xminQA2[5] = { 0.,   -10, -4, 0};
-        Double_t xmaxQA2[5] = { 20.,   10,  4, 6.28};
-        fQAPidSparse = new THnSparseF("fQAPidSparse", "pt:p:tpcnsigma:tofnsigma:phi", 4, binsQA2, xminQA2, xmaxQA2);
-        fQAPidSparse->GetAxis(0)->SetTitle("pt (Gev/c");
-        fQAPidSparse->GetAxis(1)->SetTitle("tpc nsigma");
-        fQAPidSparse->GetAxis(2)->SetTitle("tofnsigma");
-        fQAPidSparse->GetAxis(3)->SetTitle("phi");
-        fOutputList->Add(fQAPidSparse);
-//===========================================================================
-  PostData(1,fOutputList);
- // create and post flowevent
-  fFlowEvent = new AliFlowEvent(10000);
-  PostData(2, fFlowEvent);
- }
-//________________________________________________________________________
-void AliAnalysisTaskFlowTPCTOFQCSP::Terminate(Option_t *)
-{
-  // Info("Terminate");
-  AliAnalysisTaskSE::Terminate();
-}
-//_____________________________________________________________________________
-template <typename T> void AliAnalysisTaskFlowTPCTOFQCSP::PlotVZeroMultiplcities(const T* event) const
-{
-  // QA multiplicity plots
-  fVZEROA->Fill(event->GetVZEROData()->GetMTotV0A());
-  fVZEROC->Fill(event->GetVZEROData()->GetMTotV0C());
-}
-//_____________________________________________________________________________
-template <typename T> void AliAnalysisTaskFlowTPCTOFQCSP::SetNullCuts(T* event)
-{
- //Set null cuts
-    if (fDebug) cout << " fCutsRP " << fCutsRP << endl;
-    fCutsRP->SetEvent(event, MCEvent());
-    fNullCuts->SetParamType(AliFlowTrackCuts::kGlobal);
-    fNullCuts->SetPtRange(+1, -1); // select nothing QUICK
-    fNullCuts->SetEtaRange(+1, -1); // select nothing VZERO
-    fNullCuts->SetEvent(event, MCEvent());
-}
-//_____________________________________________________________________________
-void AliAnalysisTaskFlowTPCTOFQCSP::PrepareFlowEvent(Int_t iMulti, AliFlowEvent *FlowEv) const 
-{
- //Prepare flow events
-   FlowEv->ClearFast();
-   FlowEv->Fill(fCutsRP, fNullCuts);
-   FlowEv->SetReferenceMultiplicity(iMulti);
-   FlowEv->DefineDeadZone(0, 0, 0, 0);
- //  FlowEv->TagSubeventsInEta(-0.7, 0, 0, 0.7);
-}
-//_____________________________________________________________________________
-Bool_t AliAnalysisTaskFlowTPCTOFQCSP::ProcessCutStep(Int_t cutStep, AliVParticle *track)
-{
-  // Check single track cuts for a given cut step
-  const Int_t kMCOffset = AliHFEcuts::kNcutStepsMCTrack;
-  if(!fCFM->CheckParticleCuts(cutStep + kMCOffset, track)) return kFALSE;
-  return kTRUE;
-}
-//_________________________________________
-void AliAnalysisTaskFlowTPCTOFQCSP::CheckCentrality(AliAODEvent* event, Bool_t &centralitypass)
-{
-  // Check if event is within the set centrality range. Falls back to V0 centrality determination if no method is set
-  if (!fkCentralityMethod) AliFatal("No centrality method set! FATAL ERROR!");
-  fCentrality = event->GetCentrality()->GetCentralityPercentile(fkCentralityMethod);
- // cout << "--------------Centrality evaluated-------------------------"<<endl;
-  if ((fCentrality <= fCentralityMin) || (fCentrality > fCentralityMax))
-  {
-    fCentralityNoPass->Fill(fCentrality);
-    //cout << "--------------Fill no pass-----"<< fCentrality <<"--------------------"<<endl;
-    centralitypass = kFALSE;
-  }else
-  { 
-  //  cout << "--------------Fill pass----"<< fCentrality <<"---------------------"<<endl;
-    centralitypass = kTRUE; 
-  }
-//to remove the bias introduced by multeplicity outliers---------------------
-    Float_t centTrk = event->GetCentrality()->GetCentralityPercentile("TRK");
-    Float_t centv0 = event->GetCentrality()->GetCentralityPercentile("V0M");
-
-    if (TMath::Abs(centv0 - centTrk) > 5.0){
-        centralitypass = kFALSE;
-        fCentralityNoPass->Fill(fCentrality);
-     }
-    const Int_t nGoodTracks = event->GetNumberOfTracks();
-    
-    Float_t multTPC(0.); // tpc mult estimate
-    Float_t multGlob(0.); // global multiplicity
-    for(Int_t iTracks = 0; iTracks < nGoodTracks; iTracks++) { // fill tpc mult
-        AliAODTrack* trackAOD = event->GetTrack(iTracks);
-        if (!trackAOD) continue;
-        if (!(trackAOD->TestFilterBit(1))) continue;
-        if ((trackAOD->Pt() < .2) || (trackAOD->Pt() > 5.0) || (TMath::Abs(trackAOD->Eta()) > .8) || (trackAOD->GetTPCNcls() < 70)  || (trackAOD->GetDetPid()->GetTPCsignal() < 10.0) || (trackAOD->Chi2perNDF() < 0.2)) continue;
-        multTPC++;
-    }
-    for(Int_t iTracks = 0; iTracks < nGoodTracks; iTracks++) { // fill global mult
-        AliAODTrack* trackAOD = event->GetTrack(iTracks);
-        if (!trackAOD) continue;
-        if (!(trackAOD->TestFilterBit(16))) continue;
-        if ((trackAOD->Pt() < .2) || (trackAOD->Pt() > 5.0) || (TMath::Abs(trackAOD->Eta()) > .8) || (trackAOD->GetTPCNcls() < 70) || (trackAOD->GetDetPid()->GetTPCsignal() < 10.0) || (trackAOD->Chi2perNDF() < 0.1)) continue;
-        Double_t b[2] = {-99., -99.};
-        Double_t bCov[3] = {-99., -99., -99.};
-        if (!(trackAOD->PropagateToDCA(event->GetPrimaryVertex(), event->GetMagneticField(), 100., b, bCov))) continue;
-        if ((TMath::Abs(b[0]) > 0.3) || (TMath::Abs(b[1]) > 0.3)) continue;
-        multGlob++;
-    } //track loop
-    //     printf(" mult TPC %.2f, mult Glob %.2f \n", multTPC, multGlob);
- //   if(! (multTPC > (-40.3+1.22*multGlob) && multTPC < (32.1+1.59*multGlob))){  2010
-    if(! (multTPC > (-36.73 + 1.48*multGlob) && multTPC < (62.87 + 1.78*multGlob))){ 
-        centralitypass = kFALSE;
-        fCentralityNoPass->Fill(fCentrality);
-    }//2011
-    fMultCorBeforeCuts->Fill(multGlob, multTPC);
-
-    if(centralitypass){
-    fCentralityPass->Fill(fCentrality);
-    fMultCorAfterCuts->Fill(multGlob, multTPC);
-    fMultvsCentr->Fill(fCentrality, multTPC);
-    }
-}
-//_____________________________________________________________________________
-void AliAnalysisTaskFlowTPCTOFQCSP::SetCentralityParameters(Double_t CentralityMin, Double_t CentralityMax, const char* CentralityMethod)
-{
-  // Set a centrality range ]min, max] and define the method to use for centrality selection
-  fCentralityMin = CentralityMin;
-  fCentralityMax = CentralityMax;
-  fkCentralityMethod = CentralityMethod;
-}
-//_____________________________________________________________________________
-void AliAnalysisTaskFlowTPCTOFQCSP::SetIDCuts(Double_t minTPCnsigma, Double_t maxTPCnsigma, Double_t minTOFnSigma, Double_t maxTOFnSigma)
-{
-    //Set ID cuts
-    fminTPCnsigma = minTPCnsigma;
-    fmaxTPCnsigma = maxTPCnsigma;
-    fminTOFnSigma = minTOFnSigma;
-    fmaxTOFnSigma = maxTOFnSigma;
-}
-//_____________________________________________________________________________
-
-//_____________________________________________________________________________
-
-
diff --git a/PWGHF/hfe/AliAnalysisTaskFlowTPCTOFQCSP.h b/PWGHF/hfe/AliAnalysisTaskFlowTPCTOFQCSP.h
deleted file mode 100644 (file)
index 5289e5c..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-#ifndef ALIANALYSISTASKFLOWTPCTOFQCSP_H
-#define ALIANALYSISTASKFLOWTPCTOFQCSP_H
-
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-////////////////////////////////////////////////////////////////////////
-//                                                                    //
-//  Task for Heavy Flavour Electron Flow  TPC plus TOF                //
-//                                                                    //
-//  Author: Andrea Dubla (Utrecht University)                         //
-//                                                                    //
-////////////////////////////////////////////////////////////////////////
-
-class THnSparse;
-class TH2F;
-class TLorentzVector;
-class AliMagF;
-class AliESDEvent;
-class AliAODEvent;
-class AliAnalysisFilter;
-class AliESDtrackCuts;
-class AliESDtrack;
-class AliAODtrack;
-class AliHFEcontainer;
-class AliHFEcuts;
-//class AliHFEpid;
-//class AliHFEpidQAmanager;
-class AliCFManager;
-class AliFlowTrackCuts;
-class AliFlowTrack;
-class AliFlowEvent;
-class AliFlowCandidateTrack;
-class AliFlowEventSimple;
-class AliCentrality;
-class AliPIDResponse;
-class AliSelectNonHFE;
-#include "AliAnalysisTaskSE.h"
-
-
-class AliAnalysisTaskFlowTPCTOFQCSP : public AliAnalysisTaskSE {
-
-  public:
-    AliAnalysisTaskFlowTPCTOFQCSP();
-    AliAnalysisTaskFlowTPCTOFQCSP(const char *name);
-    virtual ~AliAnalysisTaskFlowTPCTOFQCSP();
-
-    void                                 SetEnableDebugMode() {fDebug = kTRUE; };
-    void                                 SetCentralityParameters(Double_t CentralityMin, Double_t CentralityMax, const char* CentralityMethod); //select centrality
-    void                                 CheckCentrality(AliAODEvent *event,Bool_t &centralitypass); //to use only events with the correct centrality....
-    void                                 SelectPhotonicElectron(Int_t itrack,const AliAODTrack *track, Bool_t &fFlagPhotonicElec);
-    void                                 SelectPhotonicElectronMethod(Bool_t dca){fDCA = dca;}
-    void                                 SetInvariantMassCut(Double_t invmass) {fInvmassCut = invmass;};
-    void                                 SetpTCuttrack(Double_t ptcut) {fpTCut = ptcut;};
-    void                                 SetTrigger(Int_t trig) {fTrigger = trig;};
-    void                                 SetTPCS(Int_t sig) {fTPCS = sig;};
-    void                                 SetVz(Int_t ver) {fVz = ver;};
-    void                                 SetQAPIDSparse(Bool_t qapidsparse) {fQAPIDSparse = qapidsparse;};
-    void                                 SetPhiCut(Bool_t phicut){fPhiCut = phicut;};
-    void                                 SetOpeningAngleflag(Bool_t opang){fOP_angle = opang;};
-    void                                 SetOpeningAngleCut(Double_t opanglecut) {fOpeningAngleCut = opanglecut;};
-    template <typename T> void           PlotVZeroMultiplcities(const T* event) const;
-    template <typename T> void           SetNullCuts(T* aod);
-    void                                 PrepareFlowEvent(Int_t iMulti, AliFlowEvent *FlowEv) const;
-    virtual void                         UserCreateOutputObjects();
-    virtual void                         UserExec(Option_t *option);
-    virtual void                         Terminate(Option_t *);
-    void                                 SetRPCuts(AliFlowTrackCuts *cutsRP) { fCutsRP = cutsRP; }
-    void                                 SetHFECuts(AliHFEcuts * const cuts) { fCuts = cuts; };
-    void                                 SetIDCuts(Double_t minTPCnsigma, Double_t maxTPCnsigma, Double_t minTOFnSigma, Double_t maxTOFnSigma);
-
-
-
-  //  AliHFEpid *GetPID() const { return fPID; };
-
-  private:
-
-    Bool_t ProcessCutStep(Int_t cutStep, AliVParticle *track);
-
-    Bool_t               fDebug; //! enable debug mode
-    AliAODEvent             *fAOD;                     //AOD object
-    TList                       *fOutputList;          //output list
-    AliHFEcuts                  *fCuts;                 //Cut Collection
-    Bool_t                          fIdentifiedAsOutInz;    //Out Of Range in z
-    Bool_t                          fPassTheEventCut;       //Pass The Event Cut
-    AliCFManager                *fCFM;                  //!Correction Framework Manager
- //   AliHFEpid                     *fPID;                  //PID
- //   AliHFEpidQAmanager   *fPIDqa;            //! PID QA manager
-    AliFlowTrackCuts     *fCutsRP; // track cuts for reference particles
-    AliFlowTrackCuts     *fNullCuts; // dummy cuts for flow event tracks
-    AliFlowEvent         *fFlowEvent; //! flow events Inclusive e 
-    const char           *fkCentralityMethod; // method used to determine centrality (V0 by default)
-    Double_t             fCentrality; // event centrality for QA
-    Double_t             fCentralityMin; // lower bound of cenrality bin
-    Double_t             fCentralityMax; // upper bound of centrality bin
-    Double_t            fInvmassCut;           //invariant mass cut value
-    Double_t             fpTCut;    //pt cut value
-    Int_t                   fTrigger;          //invariant mass cut value
-    TH1F                 *fPhi; //! QA plot of azimuthal distribution of tracks used for event plane estimation
-    TH1F                 *fEta; //! QA plot of eta distribution of tracks used for event plane estimation
-    TH1F                 *fVZEROA; //! QA plot vzeroa multiplicity (all tracks in event)
-    TH1F                 *fVZEROC; //! QA plot vzeroc multiplicity (all tracks in event)
-    TH1F                 *fTPCM; //! QA plot TPC multiplicity (tracks used for event plane estimation)
-    TH1F                        *fNoEvents;            //no of events
-    TH1F                 *fInclusiveElecPt; // Inclusive elec pt
-//    TH2F                          *fTPCnsigma;               //TPC n sigma vs p
-    TH2F                        *fTPCnsigmaAft;                //TPC n sigma vs p after HFE pid
-//    TH2F                          *fTOFns;           //track TOFnSigma
-    TH2F                            *fTOFnsAft;                //track TOFnSigma after PID
-    TH2F                            *fTOFBetaAft;
-    TH1F                 *fCentralityPass; // ! QA histogram of events that pass centrality cut
-    TH1F                 *fCentralityNoPass; //! QA histogram of events that do not pass centrality cut
-    TH1F                 *fInvmassLS1; //LS Invmass for all rec par
-    TH1F                 *fInvmassULS1;//ULS Invmass for all rec par
-    TH1F                            *fPhotoElecPt;             //photonic elec pt
-    TH1F                            *fSemiInclElecPt;  //Semi inclusive ele pt
-    TH1F                 *fULSElecPt; //ULS elec Pt
-    TH1F                 *fLSElecPt;// LS elec pt
-    TH2F                 *fMultCorAfterCuts; //! QA profile global and tpc multiplicity after outlier cut
-    TH2F                 *fMultvsCentr; //! QA profile of centralty vs multiplicity
-       TProfile                         *fSubEventDPhiv2;
-       TH1D                     *EPVzA;//ep v0a
-       TH1D                     *EPVzC;//ep v0c
-       TH1D                     *EPTPC;//ep tpc
-    THnSparseF           *fV2Phi;//! v2 analysis of EP-V0
-    TH1D                 *fvertex;//vertex
-    TH2F                 *fMultCorBeforeCuts; //! QA profile global and tpc multiplicity after outlier cut
-    AliPIDResponse       *fPIDResponse;//!  pidresponse
-    THnSparseF           *fQAPid;             //! v2 analysis of EP-V0
-    Double_t              fminTPCnsigma;  //ID cuts tpc
-    Double_t              fmaxTPCnsigma;  //ID cuts tpc
-    Bool_t                           fQAPIDSparse;       //QAPIDSPARSE
-    Double_t              fminTOFnSigma;  //ID cuts tof
-    Double_t              fmaxTOFnSigma;//ID cuts tof
-    THnSparseF           *fQAPidSparse;             //! v2 analysis of EP-V0
-    Int_t                 fTPCS; //tpc signal cluster
-    Int_t                 fVz; //vertex range
-    Bool_t                           fPhiCut;       //Phi cut to simulate emcal acc
-    Double_t                 fOpeningAngleCut; //openingAngle cut value
-    Bool_t                fOP_angle; //to shitch on and off the op_angle cut
-    TH1F                            *fOpeningAngleLS;  //opening angle for LS pairs
-    TH1F                            *fOpeningAngleULS; //opening angle for ULS pairs
-    AliSelectNonHFE      *fNonHFE;//new elienos stuff
-    Bool_t                fDCA;//selection PHelectron
-
-    
-    AliAnalysisTaskFlowTPCTOFQCSP(const AliAnalysisTaskFlowTPCTOFQCSP&); // not implemented
-    AliAnalysisTaskFlowTPCTOFQCSP& operator=(const AliAnalysisTaskFlowTPCTOFQCSP&); // not implemented
-
-    ClassDef(AliAnalysisTaskFlowTPCTOFQCSP, 2); //!example of analysis
-};
-
-#endif
-
-
old mode 100644 (file)
new mode 100755 (executable)
similarity index 62%
rename from PWGHF/hfe/macros/AddTaskFlowTPCTOFQCSP.C
rename to PWGHF/hfe/macros/AddTaskFlowITSTPCTOFQCSP.C
index 383d7e4..55946ef
@@ -1,6 +1,6 @@
 ///////////////////////////////////////////////////////////////////\r
-//                                                               //            \r
-// AddTaskFlowTPCTOFQCSP macro                                     //\r
+//                                                               //\r
+// AddTaskFlowITSTPCTOFQCSP macro                                     //\r
 // Author: Andrea Dubla, Utrecht University, 2012                //\r
 //                                                               //\r
 ///////////////////////////////////////////////////////////////////\r
@@ -12,41 +12,49 @@ class AliFlowEventSimpleCuts;
 class AliAnalysisDataContainer;\r
 class AliHFEextraCuts;\r
 \r
-AliAnalysisTaskFlowTPCTOFQCSP* AddTaskFlowTPCTOFQCSP(\r
-                                              TString uniqueID = "",\r
-                                              Float_t centrMin ,\r
-                                              Float_t centrMax ,\r
-                                              Double_t InvmassCut,\r
-                                              Int_t Trigger,\r
-                                              Double_t pTCut,\r
-                                              Double_t minTPCnsigma,\r
-                                              Double_t maxTPCnsigma,\r
-                                              Double_t minTOFnSigma,\r
-                                              Double_t maxTOFnSigma,\r
-                                              Int_t minTPCCluster,\r
-                                              Int_t TPCS,\r
-                                              Int_t Vz,\r
-                                              AliHFEextraCuts::ITSPixel_t pixel,\r
-                                              Bool_t PhotonicElectronDCA = kTRUE,\r
-                                              Bool_t PhiCut = kFALSE,\r
-                                              Bool_t QaPidSparse = kFALSE,\r
-                                              const char *Cent = "V0M",\r
-                                              Bool_t QC = kTRUE, // use qc2 and qc4\r
-                                              Bool_t SP_TPC = kTRUE, //use tpc sp method\r
-                                              Bool_t VZERO_SP = kFALSE, // use vzero sp method\r
-                                              Int_t harmonic = 2,\r
-                                              Bool_t shrinkSP = kTRUE,\r
-                                              Bool_t debug = kFALSE,\r
-                                              Int_t RPFilterBit = 1,\r
-                                              Bool_t op_ang = kFALSE,\r
-                                              Double_t op_angle_cut = 3.\r
-                                              )\r
+AliAnalysisTaskFlowITSTPCTOFQCSP* AddTaskFlowITSTPCTOFQCSP(\r
+                                                     TString uniqueID = "",\r
+                                                     Float_t centrMin ,\r
+                                                     Float_t centrMax ,\r
+                                                     Double_t InvmassCut,\r
+                                                     Int_t Trigger,\r
+                                                     Bool_t multCorrcut,\r
+                                                     Double_t pTCutmin,\r
+                                                     Double_t pTCutmax,\r
+                                                     Double_t minTOFnSigma,\r
+                                                     Double_t maxTOFnSigma,\r
+                                                     Double_t minITSnsigmaLowpT,\r
+                                                     Double_t maxITSnsigmaLowpT,\r
+                                                     Double_t minITSnsigmaHighpT,\r
+                                                     Double_t maxITSnsigmaHighpT,\r
+                                                     Double_t minTPCnsigmaLowpT,\r
+                                                     Double_t maxTPCnsigmaLowpT,\r
+                                                     Double_t minTPCnsigmaHighpT,\r
+                                                     Double_t maxTPCnsigmaHighpT,\r
+                                                     Int_t minTPCCluster,\r
+                                                     Int_t TPCS,\r
+                                                     AliHFEextraCuts::ITSPixel_t pixel,\r
+                                                     Bool_t PhotonicElectronDCA = kFALSE,\r
+                                                    // Bool_t QaPidSparse = kFALSE,\r
+                                                     const char *Cent = "V0M",\r
+                                                     Bool_t QC = kTRUE, // use qc2 and qc4\r
+                                                     Bool_t SP_TPC = kTRUE, //use tpc sp method\r
+                                                     Bool_t VZERO_SP = kFALSE, // use vzero sp method\r
+                                                     Int_t harmonic = 2,\r
+                                                     Bool_t shrinkSP = kTRUE,\r
+                                                     Bool_t debug = kFALSE,\r
+                                                     Int_t RPFilterBit = 1,\r
+                                                     Bool_t op_ang = kFALSE,\r
+                                                     Int_t Vz = 10,\r
+                                                     Double_t op_angle_cut = 3.,\r
+                                                     TString histoflatname = "alien:///alice/cern.ch/user/a/adubla/CentrDistrBins005.root"\r
+                                                     )\r
 \r
 {\r
-\r
-\r
-\r
-    if(debug) cout << " === Adding Task ElectFlow === " << endl;    \r
+    \r
+    \r
+    \r
+    if(debug) cout << " === Adding Task ElectFlow === " << endl;\r
     TString fileName = AliAnalysisManager::GetCommonFileName();\r
     fileName += ":ElectroID_";\r
     fileName += uniqueID;\r
@@ -60,38 +68,44 @@ AliAnalysisTaskFlowTPCTOFQCSP* AddTaskFlowTPCTOFQCSP(
         if(debug) cout << " Fatal error: no imput event handler found!" << endl;\r
         return 0x0;\r
     }\r
-\r
-//create a task\r
-  AliAnalysisTaskFlowTPCTOFQCSP *taskHFE = ConfigHFEStandardCuts(minTPCCluster, pixel);    //kTRUE if MC\r
     \r
-  if(debug) cout << " === AliAnalysisTaskFlowTPCTOFQCSP === " << taskHFE << endl;\r
-  if(!taskHFE) {\r
+    //create a task\r
+    AliAnalysisTaskFlowITSTPCTOFQCSP *taskHFE = ConfigHFEStandardCuts(kFALSE, minTPCCluster, pixel);    //kTRUE if MC\r
+    \r
+    if(debug) cout << " === AliAnalysisTaskFlowITSTPCTOFQCSP === " << taskHFE << endl;\r
+    if(!taskHFE) {\r
         if(debug) cout << " --> Unexpected error occurred: NO TASK WAS CREATED! (could be a library problem!) " << endl;\r
         return 0x0;\r
     }\r
+    taskHFE->SetTrigger(Trigger);\r
+    \r
+    if(Trigger==0 || Trigger==4){\r
+        TFile *fFlat=TFile::Open(histoflatname.Data());\r
+        TCanvas *c=fFlat->Get("cintegral");\r
+        TH1F *hfl=(TH1F*)c->FindObject("hint");\r
+        taskHFE->SetHistoForCentralityFlattening(hfl,centrMin,centrMax,0.,0);\r
+    }\r
+    // Set centrality percentiles and method V0M, FMD, TRK, TKL, CL0, CL1, V0MvsFMD, TKLvsV0M, ZEMvsZDC\r
+    taskHFE->SetCentralityParameters(centrMin, centrMax, Cent);\r
+    taskHFE->SetInvariantMassCut(InvmassCut);\r
+    taskHFE->SetpTCuttrack(pTCutmin, pTCutmax);\r
+    taskHFE->SetTPCS(TPCS);\r
+    taskHFE->SetVz(Vz);\r
+    taskHFE->SetIDCuts(minTOFnSigma, maxTOFnSigma, minITSnsigmaLowpT, maxITSnsigmaLowpT, minITSnsigmaHighpT, maxITSnsigmaHighpT, minTPCnsigmaLowpT, maxTPCnsigmaLowpT, minTPCnsigmaHighpT, maxTPCnsigmaHighpT);\r
+  //  taskHFE->SetQAPIDSparse(QaPidSparse);\r
+    taskHFE->SelectPhotonicElectronMethod(PhotonicElectronDCA);\r
+    taskHFE->SetOpeningAngleflag(op_ang);\r
+    taskHFE->SetOpeningAngleCut(op_angle_cut);\r
+    taskHFE->SetMultCorrelationCut(multCorrcut);\r
+\r
     \r
-// Set centrality percentiles and method V0M, FMD, TRK, TKL, CL0, CL1, V0MvsFMD, TKLvsV0M, ZEMvsZDC\r
-  taskHFE->SetCentralityParameters(centrMin, centrMax, Cent);\r
-  taskHFE->SetInvariantMassCut(InvmassCut);\r
-  taskHFE->SetpTCuttrack(pTCut);\r
-  taskHFE->SetTrigger(Trigger);\r
-  taskHFE->SetTPCS(TPCS);\r
-  taskHFE->SetVz(Vz);\r
-  taskHFE->SetIDCuts(minTPCnsigma, maxTPCnsigma, minTOFnSigma, maxTOFnSigma);\r
-  taskHFE->SetQAPIDSparse(QaPidSparse);\r
-  taskHFE->SetPhiCut(PhiCut);\r
-  taskHFE->SelectPhotonicElectronMethod(PhotonicElectronDCA);\r
-  taskHFE->SetOpeningAngleflag(op_ang);\r
-  taskHFE->SetOpeningAngleCut(op_angle_cut);\r
-    \r
-    \r
-//set RP cuts for flow package analysis\r
-  cutsRP = new AliFlowTrackCuts(Form("RFPcuts%s",uniqueID));\r
+    //set RP cuts for flow package analysis\r
+    cutsRP = new AliFlowTrackCuts(Form("RFPcuts%s",uniqueID));\r
     if(!cutsRP) {\r
         if(debug) cout << " Fatal error: no RP cuts found, could be a library problem! " << endl;\r
         return 0x0;\r
     }\r
-\r
+    \r
     if(!VZERO_SP) {\r
         AliFlowTrackCuts::trackParameterType rptype = AliFlowTrackCuts::kGlobal;\r
         cutsRP->SetParamType(rptype);\r
@@ -114,50 +128,73 @@ AliAnalysisTaskFlowTPCTOFQCSP* AddTaskFlowTPCTOFQCSP(
         QC = kFALSE;\r
         if(debug) cout << "    --> VZERO RP's " << cutsRP << endl;\r
     }\r
-\r
+    \r
     AliFlowTrackSimpleCuts *POIfilterLeft = new AliFlowTrackSimpleCuts();\r
     AliFlowTrackSimpleCuts *POIfilterRight = new AliFlowTrackSimpleCuts();\r
     if(SP_TPC){\r
         POIfilterLeft->SetEtaMin(-0.8);\r
         POIfilterLeft->SetEtaMax(0.0);\r
         POIfilterLeft->SetMassMin(263731); POIfilterLeft->SetMassMax(263733);\r
-\r
+        \r
         POIfilterRight->SetEtaMin(0.0);\r
         POIfilterRight->SetEtaMax(0.8);\r
         POIfilterRight->SetMassMin(263731); POIfilterRight->SetMassMax(263733);\r
     }\r
-\r
+    \r
     \r
     AliFlowTrackSimpleCuts *POIfilterVZERO = new AliFlowTrackSimpleCuts();\r
     if(VZERO_SP || QC){\r
         POIfilterVZERO->SetEtaMin(-0.8);\r
         POIfilterVZERO->SetEtaMax(0.8);\r
         POIfilterVZERO->SetMassMin(263731); POIfilterVZERO->SetMassMax(263733);\r
\r
+        \r
+    }\r
+    \r
+    \r
+    AliFlowTrackSimpleCuts *POIfilterLeftH = new AliFlowTrackSimpleCuts();\r
+    AliFlowTrackSimpleCuts *POIfilterRightH = new AliFlowTrackSimpleCuts();\r
+    if(SP_TPC){\r
+        POIfilterLeftH->SetEtaMin(-0.8);\r
+        POIfilterLeftH->SetEtaMax(0.0);\r
+        POIfilterLeftH->SetMassMin(2636); POIfilterLeftH->SetMassMax(2638);\r
+        \r
+        POIfilterRightH->SetEtaMin(0.0);\r
+        POIfilterRightH->SetEtaMax(0.8);\r
+        POIfilterRightH->SetMassMin(2636); POIfilterRightH->SetMassMax(2638);\r
     }\r
\r
+    \r
+    \r
+    AliFlowTrackSimpleCuts *POIfilterQCH = new AliFlowTrackSimpleCuts();\r
+    if(QC){\r
+        POIfilterQCH->SetEtaMin(-0.8);\r
+        POIfilterQCH->SetEtaMax(0.8);\r
+        POIfilterQCH->SetMassMin(2636); POIfilterQCH->SetMassMax(2638);\r
+        \r
+    }\r
+    \r
+    \r
     \r
     taskHFE->SetRPCuts(cutsRP);\r
\r
\r
- AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(Form("ccontainer0_%s",uniqueID.Data()),TList::Class(),AliAnalysisManager::kOutputContainer,fileName);\r
-  \r
- mgr->ConnectInput(taskHFE,0,mgr->GetCommonInputContainer());\r
- mgr->ConnectOutput(taskHFE,1,coutput3);\r
     \r
\r
+    \r
+    AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(Form("ccontainer0_%s",uniqueID.Data()),TList::Class(),AliAnalysisManager::kOutputContainer,fileName);\r
+    \r
+    mgr->ConnectInput(taskHFE,0,mgr->GetCommonInputContainer());\r
+    mgr->ConnectOutput(taskHFE,1,coutput3);\r
+    \r
+    \r
     if(debug) cout << " === RECEIVED REQUEST FOR FLOW ANALYSIS === " << endl;\r
     AliAnalysisDataContainer *flowEvent = mgr->CreateContainer(Form("FlowContainer_%s",uniqueID.Data()), AliFlowEventSimple::Class(), AliAnalysisManager::kExchangeContainer);\r
     mgr->ConnectOutput(taskHFE, 2, flowEvent);\r
-    if(debug) cout << "    --> Created IO containers " << flowEvent << endl;   \r
-    \r
+    if(debug) cout << "    --> Created IO containers " << flowEvent << endl;\r
+  \r
     \r
-  mgr->AddTask(taskHFE);\r
+    mgr->AddTask(taskHFE);\r
     \r
     if (QC) {  // add qc tasks\r
         TPCTOFnew::AddQCmethod(Form("QCTPCin_%s",uniqueID.Data()), harmonic, flowEvent,  debug ,uniqueID, -0.8, -0.0, 0.0, 0.8,false,POIfilterVZERO);\r
         if(debug) cout << "    --> Hanging QC task ...succes! "<< endl;\r
-    }   \r
+    }\r
     if (SP_TPC) {  // add sp subevent tasks\r
         TPCTOFnew::AddSPmethod(Form("SPTPCQa_in_%s", uniqueID.Data()), -0.8, -.0, .0, +0.8, "Qa", harmonic, flowEvent, false, shrinkSP, debug,uniqueID, false, POIfilterRight);\r
         if(debug) cout << "    --> Hanging SP Qa task ... succes!" << endl;\r
@@ -170,17 +207,16 @@ AliAnalysisTaskFlowTPCTOFQCSP* AddTaskFlowTPCTOFQCSP(
         TPCTOFnew::AddSPmethod(Form("SPVZEROQb_in_%s", uniqueID.Data()), -0.8, -.0, .0, +0.8, "Qb", harmonic, flowEvent, false, shrinkSP, debug,uniqueID, true, POIfilterVZERO);\r
         if(debug) cout << "    --> Hanging SP Qb task ... succes!"<< endl;\r
     }\r
-\r
-\r
     \r
-return taskHFE;\r
-\r
+    \r
+    return taskHFE;\r
+    \r
 }\r
 \r
 //_____________________________________________________________________________\r
 //_____________________________________________________________________________\r
-                    \r
-AliAnalysisTaskFlowTPCTOFQCSP* ConfigHFEStandardCuts(Int_t minTPCCulster,AliHFEextraCuts::ITSPixel_t pixel){\r
+\r
+AliAnalysisTaskFlowITSTPCTOFQCSP* ConfigHFEStandardCuts(Bool_t useMC,Int_t minTPCCulster,AliHFEextraCuts::ITSPixel_t pixel){\r
     //\r
     // HFE standard task configuration\r
     //\r
@@ -190,7 +226,7 @@ AliAnalysisTaskFlowTPCTOFQCSP* ConfigHFEStandardCuts(Int_t minTPCCulster,AliHFEe
     AliHFEcuts *hfecuts = new AliHFEcuts("hfeCuts","HFE Standard Cuts");  //TODO....change the cuts values to PbPb\r
     //  hfecuts->CreateStandardCuts();\r
     hfecuts->SetMinNClustersTPC(minTPCCulster);\r
-    hfecuts->SetMinNClustersITS(3);\r
+    hfecuts->SetMinNClustersITS(5);//5 for ITS pid.....usually i used 3.\r
     hfecuts->SetMinNTrackletsTRD(0);\r
     hfecuts->SetMinRatioTPCclusters(0.6);\r
     \r
@@ -198,7 +234,7 @@ AliAnalysisTaskFlowTPCTOFQCSP* ConfigHFEStandardCuts(Int_t minTPCCulster,AliHFEe
     //   hfecuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);\r
     hfecuts->SetRequireITSPixel();\r
     hfecuts->SetCutITSpixel(pixel);//kAny\r
-    hfecuts->SetMaxChi2perClusterITS(-1);\r
+    hfecuts->SetMaxChi2perClusterITS(36);  //new from ALberto\r
     hfecuts->SetMaxChi2perClusterTPC(3.5);\r
     hfecuts->SetCheckITSLayerStatus(kFALSE); // shud be put back\r
     //  hfecuts->UnsetVertexRequirement();\r
@@ -207,13 +243,13 @@ AliAnalysisTaskFlowTPCTOFQCSP* ConfigHFEStandardCuts(Int_t minTPCCulster,AliHFEe
     //hfecuts->SetSigmaToVertex(10);\r
     hfecuts->SetTOFPIDStep(kFALSE);\r
     //  hfecuts->SetQAOn();\r
-    hfecuts->SetPtRange(0, 30);\r
+    hfecuts->SetPtRange(0, 5.);\r
     \r
-    AliAnalysisTaskFlowTPCTOFQCSP *task = new AliAnalysisTaskFlowTPCTOFQCSP("HFE_Flow_TPCTOF");\r
+    AliAnalysisTaskFlowITSTPCTOFQCSP *task = new AliAnalysisTaskFlowITSTPCTOFQCSP("HFE_Flow_TPCTOF");\r
     printf("*************************************************************");\r
     printf("task -------------------------------------------- %p\n ", task);\r
     printf("*************************************************************\n");\r
-\r
+    \r
     \r
     task->SetHFECuts(hfecuts);\r
     \r
@@ -222,16 +258,17 @@ AliAnalysisTaskFlowTPCTOFQCSP* ConfigHFEStandardCuts(Int_t minTPCCulster,AliHFEe
     //  task->SetRemovePileUp(kTRUE);\r
     \r
     // Define PID\r
- //   AliHFEpid *pid = task->GetPID();\r
- //   if(useMC) pid->SetHasMCData(kTRUE);\r
- //   pid->AddDetector("TPC", 0);\r
-   // pid->AddDetector("EMCAL", 1);\r
-    \r
- //   printf("*************************************\n");\r
- //   printf("Configuring standard Task:\n");\r
+       AliHFEpid *pid = task->GetPID();\r
+       if(useMC) pid->SetHasMCData(kTRUE);\r
+    pid->AddDetector("ITS", 0);\r
+    pid->AddDetector("TOF", 1);\r
+    pid->AddDetector("TPC", 2);\r
+\r
+       printf("*************************************\n");\r
+       printf("Configuring standard Task:\n");\r
     //  task->PrintStatus();\r
-  //  pid->PrintStatus();\r
-  //  printf("*************************************\n");\r
+      pid->PrintStatus();\r
+      printf("*************************************\n");\r
     return task;\r
     \r
     \r
@@ -309,5 +346,3 @@ namespace TPCTOFnew{
     //_____________________________________________________________________________\r
 }\r
 \r
-\r
-\r
index 8d0663f..1ed33b5 100644 (file)
@@ -2703,7 +2703,6 @@ void AliAnalysisTaskFragmentationFunction::UserExec(Option_t *)
          TList* perpjettracklistGen1 = new TList();
          TList* perpjettracklistGen2 = new TList();
 
-         Double_t sumPtGenPerp  = 0.;
          Double_t sumPtGenPerp1 = 0.;
          Double_t sumPtGenPerp2 = 0.;
          GetTracksTiltedwrpJetAxis(TMath::Pi()/2.,fTracksAODMCCharged, perpjettracklistGen1, jet, TMath::Abs(GetFFRadius()) , sumPtGenPerp1); 
@@ -2711,36 +2710,31 @@ void AliAnalysisTaskFragmentationFunction::UserExec(Option_t *)
 
          perpjettracklistGen->AddAll(perpjettracklistGen1);
          perpjettracklistGen->AddAll(perpjettracklistGen2);
-         sumPtGenPerp = 0.5*(sumPtGenPerp1+sumPtGenPerp2);
 
          TList* perpjettracklistGenSecNS  = new TList();
          TList* perpjettracklistGenSecNS1 = new TList();
          TList* perpjettracklistGenSecNS2 = new TList();
 
-          Double_t sumPtGenPerpNS;
-          Double_t sumPtGenPerpNS1;
-          Double_t sumPtGenPerpNS2;
+          Double_t sumPtGenPerpNS1 = 0;
+          Double_t sumPtGenPerpNS2 = 0;
           GetTracksTiltedwrpJetAxis(TMath::Pi()/2.,fTracksAODMCChargedSecNS, perpjettracklistGenSecNS1, jet, TMath::Abs(GetFFRadius()) , sumPtGenPerpNS1); 
           GetTracksTiltedwrpJetAxis(-1*TMath::Pi()/2.,fTracksAODMCChargedSecNS, perpjettracklistGenSecNS2, jet, TMath::Abs(GetFFRadius()) , sumPtGenPerpNS2); 
 
          perpjettracklistGenSecNS->AddAll(perpjettracklistGenSecNS1);
          perpjettracklistGenSecNS->AddAll(perpjettracklistGenSecNS2);
-         sumPtGenPerpNS = 0.5*(sumPtGenPerpNS1+sumPtGenPerpNS2);
 
 
          TList* perpjettracklistGenSecS  = new TList();
          TList* perpjettracklistGenSecS1 = new TList();
          TList* perpjettracklistGenSecS2 = new TList();
 
-          Double_t sumPtGenPerpS;
-          Double_t sumPtGenPerpS1;
-          Double_t sumPtGenPerpS2;
+          Double_t sumPtGenPerpS1 = 0;
+          Double_t sumPtGenPerpS2 = 0;
           GetTracksTiltedwrpJetAxis(TMath::Pi()/2.,fTracksAODMCChargedSecS, perpjettracklistGenSecS1, jet, TMath::Abs(GetFFRadius()) , sumPtGenPerpS1); 
           GetTracksTiltedwrpJetAxis(-1*TMath::Pi()/2.,fTracksAODMCChargedSecS, perpjettracklistGenSecS2, jet, TMath::Abs(GetFFRadius()) , sumPtGenPerpS2); 
 
          perpjettracklistGenSecS->AddAll(perpjettracklistGenSecS1);
          perpjettracklistGenSecS->AddAll(perpjettracklistGenSecS2);
-         sumPtGenPerpS = 0.5*(sumPtGenPerpS1+sumPtGenPerpS2);
 
 
           if(perpjettracklistGen->GetSize() != perpjettracklistGen1->GetSize() + perpjettracklistGen2->GetSize()){
@@ -3274,7 +3268,7 @@ void AliAnalysisTaskFragmentationFunction::SetProperties(TH1* h,const char* x, c
 
 // ________________________________________________________________________________________________________________________________________________________
 void AliAnalysisTaskFragmentationFunction::GetJetTracksPointing(TList* inputlist, TList* outputlist, const AliAODJet* jet, 
-                                                                  const Double_t radius, Double_t& sumPt, const Double_t minPtL, const Double_t maxPt, Bool_t& isBadPt)
+                                                               const Double_t& radius, Double_t& sumPt, const Double_t& minPtL, const Double_t& maxPt, Bool_t& isBadPt)
 {
   // fill list of tracks in cone around jet axis  
 
@@ -3315,7 +3309,8 @@ void AliAnalysisTaskFragmentationFunction::GetJetTracksPointing(TList* inputlist
 }
 
 // _________________________________________________________________________________________________________________________________________________________________
-void AliAnalysisTaskFragmentationFunction::GetJetTracksTrackrefs(TList* list, const AliAODJet* jet, const Double_t minPtL, const Double_t maxPt, Bool_t& isBadPt)
+void AliAnalysisTaskFragmentationFunction::GetJetTracksTrackrefs(TList* list, const AliAODJet* jet, const Double_t& minPtL, 
+                                                                const Double_t& maxPt, Bool_t& isBadPt)
 {
   // list of jet tracks from trackrefs
   
@@ -3996,7 +3991,7 @@ void AliAnalysisTaskFragmentationFunction::GetClusterTracksMedian(TList* outputl
   // get median cluster
 
   AliAODJet* medianCluster = 0;
-  Double_t   medianDensity = 0;
+  //Double_t   medianDensity = 0;
 
   if(TMath::Odd(nBckgClusters)){
     
@@ -4006,7 +4001,7 @@ void AliAnalysisTaskFragmentationFunction::GetClusterTracksMedian(TList* outputl
     Double_t clusterPt = medianCluster->Pt();
     Double_t area      = medianCluster->EffectiveAreaCharged();
     
-    if(area>0) medianDensity = clusterPt/area;
+    //if(area>0) medianDensity = clusterPt/area;
   }
   else{
 
@@ -4026,7 +4021,7 @@ void AliAnalysisTaskFragmentationFunction::GetClusterTracksMedian(TList* outputl
     Double_t area2      = medianCluster2->EffectiveAreaCharged();
     if(area2>0) density2 = clusterPt2/area2;
     
-    medianDensity = 0.5*(density1+density2);
+    //medianDensity = 0.5*(density1+density2);
     
     medianCluster = ( (fRandom->Rndm()>0.5) ? medianCluster1 : medianCluster2 );  // select one randomly to avoid adding areas
   }
@@ -4619,7 +4614,7 @@ void AliAnalysisTaskFragmentationFunction::FillBckgHistos(Int_t type, TList* inp
 }
 
 //_____________________________________________________________________________________
-Double_t AliAnalysisTaskFragmentationFunction::GetMCStrangenessFactor(const Double_t pt)
+Double_t AliAnalysisTaskFragmentationFunction::GetMCStrangenessFactor(const Double_t& pt)
 {
   // factor strangeness data/MC as function of pt from UE analysis (Sara Vallero)
 
index 9836d46..b538e39 100644 (file)
@@ -260,8 +260,9 @@ class AliAnalysisTaskFragmentationFunction : public AliAnalysisTaskSE {
   Float_t  GetFFMaxTrackPt() const { return fFFMaxTrackPt; }
   Float_t  GetFFMinNTracks() const { return fFFMinnTracks; }
   Float_t  GetFFBckgRadius() const { return fFFBckgRadius; }
-  void    GetJetTracksTrackrefs(TList* l, const AliAODJet* j, const Double_t minPtL, const Double_t maxPt, Bool_t& isBadPt);
-  void    GetJetTracksPointing(TList* in, TList* out, const AliAODJet* j, const Double_t r, Double_t& sumPt, const Double_t minPtL, const Double_t maxPt, Bool_t& isBadPt);  
+  void    GetJetTracksTrackrefs(TList* l, const AliAODJet* j, const Double_t& minPtL, const Double_t& maxPt, Bool_t& isBadPt);
+  void    GetJetTracksPointing(TList* in, TList* out, const AliAODJet* j, const Double_t& r, Double_t& sumPt, 
+                               const Double_t& minPtL, const Double_t& maxPt, Bool_t& isBadPt);  
   void     GetTracksOutOfNJets(Int_t nCases, TList* in, TList* out, TList* jets, Double_t& pt);
   void     GetTracksOutOfNJetsStat(Int_t nCases, TList* in, TList* out, TList* jets, Double_t& pt, Double_t &normFactor);
   void     GetTracksTiltedwrpJetAxis(Float_t alpha, TList* inputlist, TList* outputlist, const AliAODJet* jet, Double_t radius, Double_t& sumPt);
@@ -286,7 +287,7 @@ class AliAnalysisTaskFragmentationFunction : public AliAnalysisTaskSE {
   void     FillBckgHistos(Int_t type, TList* inputtracklist, TList* inputjetlist, AliAODJet* jet, 
                          AliFragFuncHistos* ffbckghistocuts,AliFragFuncQATrackHistos* qabckghistos,TH1F* fh1Mult = 0); 
  
-  Double_t GetMCStrangenessFactor(const Double_t pt);
+  Double_t GetMCStrangenessFactor(const Double_t& pt);
   Double_t GetMCStrangenessFactorCMS(AliAODMCParticle* daughter);
 
   void FillJetShape(AliAODJet* jet, TList* list,  TProfile* hProNtracksLeadingJet, TProfile** hProDelRPtSum, TProfile* hProDelR80pcPt=0, Double_t dPhiUE=0, Double_t normUE = 0, Bool_t scaleStrangeness = kFALSE);
index 1943ac9..6bc2ce3 100644 (file)
@@ -552,7 +552,7 @@ void AliAnalysisTaskJetCorePP::UserCreateOutputObjects()
 
    //Centrality, A, pTjet, pTtrigg, dphi
    const Int_t dimSpec   = 5;
-   const Int_t nBinsSpec[dimSpec]     = {nBinsCentrality, 100,   220,  50, TMath::Nint(10*(TMath::Pi()-fkDeltaPhiCut))};
+   const Int_t nBinsSpec[dimSpec]     = {nBinsCentrality,  50,   110,  50, TMath::Nint(10*(TMath::Pi()-fkDeltaPhiCut))};
    const Double_t lowBinSpec[dimSpec] = {0.0,             0.0,   -20, 0.0, fkDeltaPhiCut};
    const Double_t hiBinSpec[dimSpec]  = {100.0,           1.0, 200.0,50.0, TMath::Pi()};
    fHJetSpec = new THnSparseF("fHJetSpec",
@@ -574,9 +574,9 @@ void AliAnalysisTaskJetCorePP::UserCreateOutputObjects()
    //------------------- HISTOS FOR DIAGNOSTIC ----------------------
    //A, pTjet, pTjet-pTUe, pTUe, rhoUe     bg estimate from kT median
    const Int_t    dimSpecMed   = 5;
-   const Int_t    nBinsSpecMed[dimSpecMed]  = {50,     50,  120,     50,   50};
+   const Int_t    nBinsSpecMed[dimSpecMed]  = {25,     50,    60,    20,   20};
    const Double_t lowBinSpecMed[dimSpecMed] = {0.0,   0.0, -20.0,   0.0,  0.0};
-   const Double_t hiBinSpecMed[dimSpecMed]  = {1.0, 100.0, 100.0,  20.0, 20.0};
+   const Double_t hiBinSpecMed[dimSpecMed]  = {1.0, 100.0, 100.0,  10.0, 20.0};
    fHJetUeMedian = new THnSparseF("fHJetUeMedian",
                    "Recoil jet spectrum [A,pTjet,pTjet-pTUe, pTUe, rhoUe]",
                    dimSpecMed, nBinsSpecMed, lowBinSpecMed, hiBinSpecMed);
@@ -589,7 +589,7 @@ void AliAnalysisTaskJetCorePP::UserCreateOutputObjects()
 
    //rho bacground reconstructed data
    const Int_t    dimRho   = 2;
-   const Int_t    nBinsRho[dimRho]  = {200  , 200};
+   const Int_t    nBinsRho[dimRho]  = {50  ,   50};
    const Double_t lowBinRho[dimRho] = {0.0  , 0.0};
    const Double_t hiBinRho[dimRho]  = {20.0 , 20.0};
 
@@ -682,20 +682,20 @@ void AliAnalysisTaskJetCorePP::UserCreateOutputObjects()
    if(fIsChargedMC){   
       if(fFillRespMx){
          //Fill response matrix only once 
-         fhJetPtGenVsJetPtRec = new TH2D("fhJetPtGenVsJetPtRec","JetPtGenVsJetPtRec", 200,0,200, 200,0,200); 
+         fhJetPtGenVsJetPtRec = new TH2D("fhJetPtGenVsJetPtRec","JetPtGenVsJetPtRec", 100,0,200, 100,0,200); 
          fOutputList->Add(fhJetPtGenVsJetPtRec); //gen MC charg jet pt spectrum versus rec charged jet pt spectrum
          //....
-         fhJetPtGenVsJetPtRecSubUeMedian = new TH2D("fhJetPtGenVsJetPtRecSubUeMedian","fhJetPtGenVsJetPtRecSubUeMedian", 220,-20,200, 220,-20,200); 
+         fhJetPtGenVsJetPtRecSubUeMedian = new TH2D("fhJetPtGenVsJetPtRecSubUeMedian","fhJetPtGenVsJetPtRecSubUeMedian", 110,-20,200, 110,-20,200); 
          fOutputList->Add(fhJetPtGenVsJetPtRecSubUeMedian); // with kT median bg subtr 
          //....
          fhJetPtGenVsJetPtRecSubUeCone=(TH2D*)fhJetPtGenVsJetPtRecSubUeMedian->Clone("fhJetPtGenVsJetPtRecSubUeCone");
          fhJetPtGenVsJetPtRecSubUeCone->SetTitle("fhJetPtGenVsJetPtRecSubUeCone");
          fOutputList->Add(fhJetPtGenVsJetPtRecSubUeCone); // with weighted kT median bg subtr 
          //....
-         fhJetPtGen = new TH1D("fhJetPtGen","Jet Pt (MC Gen)",200,0,200); //MC generator charged jet pt spectrum
+         fhJetPtGen = new TH1D("fhJetPtGen","Jet Pt (MC Gen)",100,0,200); //MC generator charged jet pt spectrum
          fOutputList->Add(fhJetPtGen);  
          //....
-         fhJetPtSubUeMedianGen = new TH1D("fhJetPtSubUeMedianGen","Jet Pt - UE pT (MC Gen)",220,-20,200); 
+         fhJetPtSubUeMedianGen = new TH1D("fhJetPtSubUeMedianGen","Jet Pt - UE pT (MC Gen)",110,-20,200); 
          fOutputList->Add(fhJetPtSubUeMedianGen);  // with kT median bg subtr
          //....
          fhJetPtSubUeConeGen = (TH1D*) fhJetPtSubUeMedianGen->Clone("fhJetPtSubUeConeGen");
@@ -703,10 +703,10 @@ void AliAnalysisTaskJetCorePP::UserCreateOutputObjects()
       
          //....
          if(fIsFullMC){
-            fhJetPtGenChargVsJetPtGenFull = new TH2D("fhJetPtGenChargVsJetPtGenFull","fhJetPtGenChargVsJetPtGenFull", 200,0,200, 200,0,200);
+            fhJetPtGenChargVsJetPtGenFull = new TH2D("fhJetPtGenChargVsJetPtGenFull","fhJetPtGenChargVsJetPtGenFull", 100,0,200, 100,0,200);
             fOutputList->Add(fhJetPtGenChargVsJetPtGenFull); //gen full MC jet pt versus gen charged jet MC pt
          //....
-            fhJetPtGenFull = new TH1D("fhJetPtGenFull","Jet Pt (MC Full jets Gen)",200,0,200); //MC generator full jet pt spectrum
+            fhJetPtGenFull = new TH1D("fhJetPtGenFull","Jet Pt (MC Full jets Gen)",100,0,200); //MC generator full jet pt spectrum
             fOutputList->Add(fhJetPtGenFull); 
          }
       }
index 1dd8214..6987fff 100644 (file)
@@ -220,7 +220,7 @@ private:
    const Double_t fCellArea; //cell area
    Double_t fSafetyMargin; //enlarge a bit the jet size to avoid contamination of UE
 
-   ClassDef(AliAnalysisTaskJetCorePP, 10);  //has to end with number larger than 0
+   ClassDef(AliAnalysisTaskJetCorePP, 11);  //has to end with number larger than 0
 };
 
 #endif
index 3c9892e..2377306 100644 (file)
@@ -907,7 +907,7 @@ void AliFragmentationFunctionCorrections::SetHistoBins(const Int_t jetPtSlice, c
 }
 
 //_____________________________________________________________________________________________________________________________________
-TArrayD* AliFragmentationFunctionCorrections::GetHistoBins(const Int_t jetPtSlice,  const Int_t type)
+TArrayD* AliFragmentationFunctionCorrections::GetHistoBins(const Int_t& jetPtSlice, const Int_t& type)
 { 
   // set histo bins for jet pt slice
   // if binning undefined for any slice, original binning will be used
index abc2704..709d7ea 100644 (file)
@@ -70,7 +70,7 @@ class AliFragmentationFunctionCorrections : public TObject {
 
   void SetHistoBins(const Int_t jetPtSlice, const Int_t sizeBins, Double_t* bins,Int_t type);
   void SetHistoBins(const Int_t jetPtSlice, const Int_t nBinsLimits, Double_t* binsLimits, Double_t* binsWidth,Int_t type);
-  TArrayD* GetHistoBins(const Int_t jetPtSlice,  const Int_t type);
+  TArrayD* GetHistoBins(const Int_t& jetPtSlice, const Int_t& type);
 
   void SetHistoBinsSinglePt(const Int_t sizeBins, Double_t* bins);
   void SetHistoBinsSinglePt(const Int_t nBinsLimits, Double_t* binsLimits, Double_t* binsWidth);
index 3876057..85fc61c 100644 (file)
@@ -71,6 +71,7 @@ set ( SRCS
  EMCALJetTasks/UserTasks/AliAnalysisTaskFullpAJets.cxx
  EMCALJetTasks/UserTasks/AliAnalysisTaskFullppJet.cxx
  EMCALJetTasks/UserTasks/AliAnalysisTaskHJetEmbed.cxx
+ EMCALJetTasks/UserTasks/AliAnalysisTaskHJetDphi.cxx
  EMCALJetTasks/UserTasks/AliAnalysisTaskRhoVnModulation.cxx
  EMCALJetTasks/UserTasks/AliAnalysisTaskJetMatching.cxx
  EMCALJetTasks/UserTasks/AliAnalysisTaskSAJF.cxx
index 0aaf5bc..1c40038 100644 (file)
@@ -2,7 +2,6 @@
 #include <Riostream.h>
 #include <TROOT.h>
 #include <TFile.h>
-#include <TCint.h>
 #include <TChain.h>
 #include <TTree.h>
 #include <TKey.h>
index 0bdb91d..6a81a9b 100644 (file)
@@ -84,6 +84,8 @@ class AliAnalysisTaskEmcalDiJetBase : public AliAnalysisTaskEmcalJet {
   void                        SetChargedFractionIndex();
   void                        SetChargedFractionIndexMC();
 
+  void                        SetPtMinTriggerJet(Double_t ptmin)  {fPtMinTriggerJet = ptmin;}
+
   Bool_t                     fDebug;                      // debug level
   JetCorrelationType         fJetCorrelationType;         // type of correlation between jets
   JetFullChargedMatchingType fJetFullChargedMatchingType; //matching type between full and charged jets to be used
diff --git a/PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskHJetDphi.cxx b/PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskHJetDphi.cxx
new file mode 100644 (file)
index 0000000..2285c48
--- /dev/null
@@ -0,0 +1,1344 @@
+#include <TCanvas.h>
+#include <TChain.h>
+#include <TFormula.h>
+#include <TH1.h>
+#include <TH2.h>
+#include <TH3.h>
+#include <TProfile2D.h>
+#include <THnSparse.h>
+#include <TROOT.h>
+#include <TTree.h>
+#include <TArrayI.h>
+#include <TClonesArray.h>
+#include <TRandom3.h>
+#include <TFile.h>
+#include <TF1.h>
+#include <TLorentzVector.h>
+#include "TKey.h"
+#include "TList.h"
+#include "TSystem.h"
+#include "AliFJWrapper.h"
+#include "AliAODHandler.h"
+#include "AliAODEvent.h"
+#include "AliAODInputHandler.h"
+#include "AliAnalysisManager.h"
+#include "AliAnalysisTask.h"
+#include "AliCentrality.h"
+#include "AliAnalysisTaskHJetDphi.h"
+#include "AliESDEvent.h"
+#include "AliESDInputHandler.h"
+#include "AliESDtrack.h"
+#include "AliESDtrackCuts.h"
+#include "AliVParticle.h"
+#include "AliVTrack.h"
+#include "AliInputEventHandler.h"
+#include "AliMCEvent.h"
+#include "AliStack.h"
+#include "AliGenEventHeader.h"
+#include "AliGenPythiaEventHeader.h"
+#include "AliLog.h"
+#include "AliRhoParameter.h"
+#include "AliAODMCParticle.h"
+#include "AliNamedArrayI.h"
+#include "AliNamedString.h"
+#include "AliPicoTrack.h"
+#include "AliAnalysisTaskFastEmbedding.h"
+#include "AliEmcalJet.h"
+#include "AliAODJet.h"
+#include "AliAODJetEventBackground.h"
+
+#include <iostream>
+using std::cout;
+using std::cerr;
+using std::endl;
+
+ClassImp(AliAnalysisTaskHJetDphi)
+
+const Double_t pi = TMath::Pi();
+const Double_t areaCut[4] = {0.1, 0.23, 0.4, 0.63};
+const Double_t kSector = pi/9;
+
+//________________________________________________________________________
+AliAnalysisTaskHJetDphi::AliAnalysisTaskHJetDphi() : 
+  AliAnalysisTaskSE(), 
+  fVerbosity(0), fIsEmbedding(kFALSE), fAnaType(0), fPeriod("lhc11h"), fCollisionSystem("PbPb"),
+  fIsMC(kFALSE), fAnalyzeMCTruth(kFALSE), fMC(0), 
+  fEvent(0x0), fESD(0x0), fAODIn(0x0), fAODOut(0x0), fAODExtension(0x0),
+  fOfflineTrgMask(AliVEvent::kAny), fTriggerType(-1), fCentrality(-1), fMaxVtxZ(10),
+  fEsdTrkCut(0x0), fEsdHybCut(0x0), fFilterMask(0), fRequireITSRefit(kTRUE),
+  fIsInit(kFALSE), fNonStdFile(""), fMcParticleArrName(""), fMcParticleArray(0x0),  fMcParticlelMap(0x0), 
+  fEmbTrkArrName(""), fEmbTrkArray(0x0), fTrackArrName(""), fTrackArray(0x0), 
+  fTriggerTrkIndex(-1), fTriggerTrkPt(-1), fSwitchOnAvoidTpcHole(kFALSE), fAvoidTpcHole(kFALSE), fCutTPCBoundary(kFALSE), fDistToTPCBoundary(0.), 
+  fMinTrkPt(0.15), fMaxTrkPt(1e4), fMinTrkEta(-0.9), fMaxTrkEta(0.9), fMinTrkPhi(0), fMaxTrkPhi(2*pi), 
+  fRadius(0.4), fJetArrName(""), fPLJetArrName(""), fDLJetArrName(""), fJetArray(0x0), fPLJetArray(0x0), fDLJetArray(0x0),
+  fRhoName(""), fRho(0x0), fRhoValue(0), fEvtBkg(0x0), fPtHardBinName(0x0), fPtHardBin(-1),
+  fRunTrkQA(kFALSE), fRunJetQA(kFALSE), fRunSingleInclHJet(kFALSE),  fTTtype(0), fTTMinPt(9), fTTMaxPt(10), fJetPtMin(10), 
+  fRunPLHJet(kFALSE), fRunDLHJet(kFALSE), fRunLeadTrkQA(kFALSE), fStudyKtEffects(kFALSE), fKtValue(0), fRandom(0), 
+  fRunBkgFlow(kFALSE),
+  fOutputList(0x0), fhEventStat(0x0), fhNTrials(0x0), fhPtHardBins(0x0)
+{
+  // Constructor
+
+  // Define input and output slots here
+  // Input slot #0 works with a TChain
+  //DefineInput(0, TChain::Class());
+  //DefineOutput(1, TList::Class());
+  // Output slot #0 id reserved by the base class for AOD
+
+  for(Int_t i=0; i<4; i++)
+    {
+      fhVtxZ[i]                  = 0x0;
+      fhCentrality[i]            = 0x0;
+      fhRhoVsCent[i]             = 0x0;
+
+      fhTrkPt[i]                 = 0x0;
+      fhTrkQA[i]                 = 0x0;
+      fhTrkPtRes[i]              = 0x0;
+      fhTrkPhiRes[i]             = 0x0;
+
+      fhNumberOfTT[i]            = 0x0;
+      for(Int_t j=0; j<3; j++)
+       {
+         fhJetPt[i][j]          = 0x0;
+         fhJetArea[i][j]        = 0x0;
+         fhJetQA[i][j]          = 0x0;
+         
+         fhTTPt[i][j]           = 0x0;
+         fHJetPhiCorr[i][j]     = 0x0;
+       }
+      fHJetPhiCorrUp[i]          = 0x0;
+      fHJetPhiCorrDown[i]        = 0x0;
+
+      fhLeadTrkQA[i]             = 0x0;
+      fhKtEffects[i]             = 0x0;
+    }
+
+  fAODfilterBits[0] = -1;
+  fAODfilterBits[1] = -1;
+}
+
+//________________________________________________________________________
+AliAnalysisTaskHJetDphi::AliAnalysisTaskHJetDphi(const char *name) : 
+  AliAnalysisTaskSE(name), 
+  fVerbosity(0), fIsEmbedding(kFALSE), fAnaType(0), fPeriod("lhc11h"), fCollisionSystem("PbPb"),
+  fIsMC(kFALSE), fAnalyzeMCTruth(kFALSE), fMC(0), 
+  fEvent(0x0), fESD(0x0), fAODIn(0x0), fAODOut(0x0), fAODExtension(0x0),
+  fOfflineTrgMask(AliVEvent::kAny), fTriggerType(-1), fCentrality(-1), fMaxVtxZ(10),
+  fEsdTrkCut(0x0), fEsdHybCut(0x0), fFilterMask(0), fRequireITSRefit(kTRUE),
+  fIsInit(kFALSE), fNonStdFile(""), fMcParticleArrName(""), fMcParticleArray(0x0),  fMcParticlelMap(0x0), 
+  fEmbTrkArrName(""), fEmbTrkArray(0x0), fTrackArrName(""), fTrackArray(0x0), 
+  fTriggerTrkIndex(-1), fTriggerTrkPt(-1), fSwitchOnAvoidTpcHole(kFALSE), fAvoidTpcHole(kFALSE), fCutTPCBoundary(kFALSE), fDistToTPCBoundary(0.), 
+  fMinTrkPt(0.15), fMaxTrkPt(1e4), fMinTrkEta(-0.9), fMaxTrkEta(0.9), fMinTrkPhi(0), fMaxTrkPhi(2*pi), 
+  fRadius(0.4), fJetArrName(""), fPLJetArrName(""), fDLJetArrName(""), fJetArray(0x0), fPLJetArray(0x0), fDLJetArray(0x0),
+  fRhoName(""), fRho(0x0), fRhoValue(0), fEvtBkg(0x0), fPtHardBinName(0x0), fPtHardBin(-1),
+  fRunTrkQA(kFALSE), fRunJetQA(kFALSE), fRunSingleInclHJet(kFALSE),  fTTtype(0), fTTMinPt(9), fTTMaxPt(10), fJetPtMin(10), 
+  fRunPLHJet(kFALSE), fRunDLHJet(kFALSE), fRunLeadTrkQA(kFALSE), fStudyKtEffects(kFALSE), fKtValue(0), fRandom(0), 
+  fRunBkgFlow(kFALSE),
+  fOutputList(0x0), fhEventStat(0x0), fhNTrials(0x0), fhPtHardBins(0x0)
+{
+  // Constructor
+
+  // Define input and output slots here
+  // Input slot #0 works with a TChain
+  DefineInput(0, TChain::Class());
+  DefineOutput(1, TList::Class());
+  // Output slot #0 id reserved by the base class for AOD
+
+  for(Int_t i=0; i<4; i++)
+    {
+      fhVtxZ[i]                  = 0x0;
+      fhCentrality[i]            = 0x0;
+      fhRhoVsCent[i]             = 0x0;
+
+      fhTrkPt[i]                 = 0x0;
+      fhTrkQA[i]                 = 0x0;
+      fhTrkPtRes[i]              = 0x0;
+      fhTrkPhiRes[i]             = 0x0;
+
+      fhNumberOfTT[i]            = 0x0;
+      for(Int_t j=0; j<3; j++)
+       {
+         fhJetPt[i][j]          = 0x0;
+         fhJetArea[i][j]        = 0x0;
+         fhJetQA[i][j]          = 0x0;
+         
+         fhTTPt[i][j]           = 0x0;
+         fHJetPhiCorr[i][j]     = 0x0;
+       }
+
+      fHJetPhiCorrUp[i]          = 0x0;
+      fHJetPhiCorrDown[i]        = 0x0;
+
+      fhLeadTrkQA[i]             = 0x0;
+      fhKtEffects[i]             = 0x0;
+    }
+
+  fAODfilterBits[0] = -1;
+  fAODfilterBits[1] = -1;
+}
+
+
+//________________________________________________________________________
+AliAnalysisTaskHJetDphi::~AliAnalysisTaskHJetDphi()
+{
+  //Destructor
+  if(fRandom)      delete fRandom;
+  if(fEsdTrkCut)   delete fEsdTrkCut;
+  if(fEsdHybCut)   delete fEsdHybCut;
+  if(fOutputList) { fOutputList->Delete(); delete fOutputList;}
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskHJetDphi::UserCreateOutputObjects()
+{
+  // Create histograms
+
+  const Int_t nTrkPtBins = 100;
+  const Float_t lowTrkPtBin=0, upTrkPtBin=100;
+  const Int_t nJetPtBins = 300;
+  const Float_t lowJetPtBin=-100, upJetPtBin=200;
+
+  // track QA
+  const Int_t dimTrkqa = 4;
+  const Int_t nBinsTrkqa[dimTrkqa]     = {nTrkPtBins/5,  36,  40, 10};
+  const Double_t lowBinTrkqa[dimTrkqa] = {lowTrkPtBin,   0,  -1,  0};
+  const Double_t hiBinTrkqa[dimTrkqa]  = {upTrkPtBin,    360, 1,  10};
+
+  const Int_t dimTrkRes = 5;
+  const Int_t nBinsTrkRes[dimTrkRes]     = {nTrkPtBins,    50,  50,  3, 10};
+  const Double_t lowBinTrkRes[dimTrkRes] = {lowTrkPtBin,   0,   0,   0,  0};
+  const Double_t hiBinTrkRes[dimTrkRes]  = {upTrkPtBin,    0.5, 0.5, 3,  10};
+
+  const Int_t dimPhiRes = 4;
+  const Int_t nBinsPhiRes[dimPhiRes]     = {nTrkPtBins,    200,     3, 10};
+  const Double_t lowBinPhiRes[dimPhiRes] = {lowTrkPtBin,   -0.00995, 0, 0};
+  const Double_t hiBinPhiRes[dimPhiRes]  = {upTrkPtBin,    0.01005,  3, 10};
+
+  // jet QA
+  const Int_t dimJetpt = 4;
+  const Int_t nBinsJetpt[dimJetpt]     = {nJetPtBins,    300, 10, 10};
+  const Double_t lowBinJetpt[dimJetpt] = {lowJetPtBin,   0,   0,  0};
+  const Double_t hiBinJetpt[dimJetpt]  = {upJetPtBin,    300, 10, 10};
+
+  const Int_t dimJetA = 4;
+  const Int_t nBinsJetA[dimJetA]     = {nJetPtBins,    100, 10, 10};
+  const Double_t lowBinJetA[dimJetA] = {lowJetPtBin,   0,   0,  0};
+  const Double_t hiBinJetA[dimJetA]  = {upJetPtBin,    1,   10, 10};
+
+  const Int_t dimJetqa = 7;
+  const Int_t nBinsJetqa[dimJetqa]     = {nJetPtBins/10, 36,  24,  6,   100, 10, 11};
+  const Double_t lowBinJetqa[dimJetqa] = {lowJetPtBin,   0,  -0.6, 0,   0,   0,  0};
+  const Double_t hiBinJetqa[dimJetqa]  = {upJetPtBin,    360, 0.6, 1.2, 500, 10, 11};
+
+  // h-jet analysis
+  const Int_t dimTT = 3;
+  const Int_t nBinsTT[dimTT]     = {nTrkPtBins,  10,  11};
+  const Double_t lowBinTT[dimTT] = {lowTrkPtBin, 0,   0};
+  const Double_t hiBinTT[dimTT]  = {upTrkPtBin,  100, 11}; 
+  
+  const Int_t dimCor = 7;
+  const Int_t nBinsCor[dimCor]     = {nTrkPtBins, nJetPtBins,  140,     6,   10, 40,    11};
+  const Double_t lowBinCor[dimCor] = {lowTrkPtBin,lowJetPtBin, pi-4.95, 0,   0,  -1.95, 0};
+  const Double_t hiBinCor[dimCor]  = {upTrkPtBin, upJetPtBin,  pi+2.05, 1.2, 100, 2.05,  11};
+
+  // Leading track QA
+  const Int_t dimLeadTrkqa = 5;
+  const Int_t nBinsLeadTrkqa[dimLeadTrkqa]     = {nTrkPtBins,  200,  80,   55, 10};
+  const Double_t lowBinLeadTrkqa[dimLeadTrkqa] = {lowTrkPtBin,   0,  -0.4, 0,   0};
+  const Double_t hiBinLeadTrkqa[dimLeadTrkqa]  = {upTrkPtBin,  200,  0.4,  1.1, 100};
+
+  // kt effects
+  const Int_t dimKt = 5;
+  const Int_t nBinsKt[dimKt]     = {nTrkPtBins,   20,  81,    10, 11};
+  const Double_t lowBinKt[dimKt] = {lowTrkPtBin,   0,  -40.5, 0,  0};
+  const Double_t hiBinKt[dimKt]  = {upTrkPtBin,  200,  40.5,  10, 11};
+
+  OpenFile(1);
+  fOutputList = new TList();
+  fOutputList->SetOwner(1);
+
+   // Called once
+   OpenFile(1);
+   if(!fOutputList) fOutputList = new TList;
+   fOutputList->SetOwner(kTRUE);
+   Bool_t oldStatus = TH1::AddDirectoryStatus();
+   if(fAnaType==1) TH1::AddDirectory(kFALSE);
+
+  fhEventStat = new TH1F("fhEventStat","Event statistics for jet analysis",9,0,9);
+  fhEventStat->GetXaxis()->SetBinLabel(1,"All");
+  fhEventStat->GetXaxis()->SetBinLabel(2,"PS");
+  fhEventStat->GetXaxis()->SetBinLabel(3,"Vtx");
+  fhEventStat->GetXaxis()->SetBinLabel(4,"Vtx+10cm");
+  fhEventStat->GetXaxis()->SetBinLabel(5,"kMB");
+  fhEventStat->GetXaxis()->SetBinLabel(6,"kCentral");
+  fhEventStat->GetXaxis()->SetBinLabel(7,"kSemiCentral");
+  fhEventStat->GetXaxis()->SetBinLabel(8,"kEMCEGA");
+  fhEventStat->GetXaxis()->SetBinLabel(9,"kEMCEJE");
+  fOutputList->Add(fhEventStat);
+
+  fhNTrials = new TH1F("fhNTrials","Number of trials",1,0,1);
+  fOutputList->Add(fhNTrials);
+
+  fhPtHardBins = new TH1F("fhPtHardBins","Number of events in each pT hard bin",11,0,11);
+  fOutputList->Add(fhPtHardBins);
+
+  const char *triggerName[4] = {"kMB","kEGA","kEJE","MC"};
+  const char *dataType[3]    = {"", "_DL","_PL"};
+  const char *dataName[3]    = {"Data","DL","PL"};
+  
+  Double_t newbins[7] = {0,0.07,0.2,0.4,0.6,0.8,1};
+
+  for(Int_t i=0; i<4; i++)
+    {
+      if( fAnalyzeMCTruth )
+       {
+         if(i!=3) continue;
+       }
+      else
+       {
+         if( fPeriod=="lhc11a" && i>1 ) continue;
+         if( fPeriod=="lhc10h" && i!=0 ) continue;
+         if( fPeriod=="lhc11h" && i!=0 ) continue;
+         if( fPeriod.Contains("lhc12a15a") && i!=0 ) continue;
+         if( fPeriod.Contains("lhc12a15e") && i!=0 ) continue;
+       }
+      fhVtxZ[i] = new TH1F(Form("%s_fhVtxZ",triggerName[i]),Form("%s: z distribution of event vertexz;z(cm)",triggerName[i]),400,-20,20);
+      fOutputList->Add(fhVtxZ[i]);
+
+      fhCentrality[i] = new TH1F(Form("%s_fhCentrality",triggerName[i]),Form("%s: Event centrality;centrality",triggerName[i]),100,0,100);
+      fOutputList->Add(fhCentrality[i]);
+
+      fhRhoVsCent[i] = new TH2F(Form("%s_fhRhoVsCent",triggerName[i]),Form("%s: Rho vs centrality (R=%1.1f);centrality;Rho",triggerName[i],fRadius),100,0,100,300,0,300);
+      fOutputList->Add(fhRhoVsCent[i]);
+
+      if(fRunTrkQA)
+       {
+         fhTrkPt[i] = new TH2F(Form("%s_fhTrkPt",triggerName[i]),Form("%s: Trigger track p_{T} vs centrality;p_{T}^{Trigger} (GeV/c);Centrality",triggerName[i]),nTrkPtBins,lowTrkPtBin,upTrkPtBin,10,0,100);
+         fOutputList->Add(fhTrkPt[i]);
+
+         fhTrkQA[i] = new THnSparseF(Form("%s_fhTrkQA",triggerName[i]),Form("%s: track p_{T} vs #phi vs #eta vs centrality;p_{T,track} (GeV/c);#phi;#eta;centrality",triggerName[i]),dimTrkqa,nBinsTrkqa,lowBinTrkqa,hiBinTrkqa);
+         fOutputList->Add(fhTrkQA[i]);
+
+         fhTrkPtRes[i] = new THnSparseF(Form("%s_fhTrkPtRes",triggerName[i]),Form("%s: track p_{T} vs resolution vs (p_{T}^{gen}-p_{T}^{rec})/p_{T}^{gen} vs type vs centrality;p_{T,track} (GeV/c);#sigma(p_{T})/p_{T};type;centrality",triggerName[i]),dimTrkRes,nBinsTrkRes,lowBinTrkRes,hiBinTrkRes);
+         fOutputList->Add(fhTrkPtRes[i]);
+
+         fhTrkPhiRes[i] = new THnSparseF(Form("%s_fhTrkPhiRes",triggerName[i]),Form("%s: track p_{T} vs #varphi^{gen}-#varphi^{rec} vs type vs centrality;p_{T,track} (GeV/c);#Delta#varphi;type;centrality",triggerName[i]),dimPhiRes,nBinsPhiRes,lowBinPhiRes,hiBinPhiRes);
+         fOutputList->Add(fhTrkPhiRes[i]);
+       }
+
+      for(Int_t j=0; j<3; j++)
+       {
+         if(!fRunDLHJet && j==1) continue;
+         if(!fRunPLHJet && j==2) continue;
+         if(fRunJetQA)
+           {
+             fhJetPt[i][j] = new THnSparseF(Form("%s_fhJetPt%s",triggerName[i],dataType[j]),Form("%s-%s: jet p_{T} vs raw jet p_{T} vs centrality vs pt hard bin (R=%1.1f);p_{T,jet}^{ch} (GeV/c);p_{T,jet}^{raw} (GeV/c);centrality;ptHardBin",dataName[j],triggerName[i],fRadius),dimJetpt,nBinsJetpt,lowBinJetpt,hiBinJetpt);
+             fOutputList->Add(fhJetPt[i][j]);
+
+             fhJetArea[i][j] = new THnSparseF(Form("%s_fhJetArea%s",triggerName[i],dataType[j]),Form("%s-%s: jet p_{T} vs area vs centrality vs pt hard bin (R=%1.1f);p_{T,jet}^{ch} (GeV/c);area;centrality;ptHardBin",dataName[j],triggerName[i],fRadius),dimJetA,nBinsJetA,lowBinJetA,hiBinJetA);
+             fOutputList->Add(fhJetArea[i][j]);
+
+             fhJetQA[i][j] = new THnSparseF(Form("%s_fhJetQA%s",triggerName[i],dataType[j]),Form("%s-%s: jet p_{T} vs #phi vs #eta vs area vs # of constituents vs centrality vs pt hard bin (R=%1.1f);p_{T,jet}^{ch} (GeV/c);#phi;#eta;area;# of constituents;centrality;ptHardBin",dataName[j],triggerName[i],fRadius),dimJetqa,nBinsJetqa,lowBinJetqa,hiBinJetqa);
+             fhJetQA[i][j]->SetBinEdges(3,newbins);
+             fOutputList->Add(fhJetQA[i][j]);
+           }
+
+         if(fRunSingleInclHJet)
+           {
+             fhTTPt[i][j] = new THnSparseF(Form("%s_fhTTPt%s",triggerName[i],dataType[j]),Form("%s-%s: TT p_{T} vs centrality vs pT hard bin;p_{T,TT}^{ch} (GeV/c);centrality;ptHardBin",dataName[j],triggerName[i]),dimTT,nBinsTT,lowBinTT,hiBinTT);
+             fOutputList->Add(fhTTPt[i][j]);
+
+             fHJetPhiCorr[i][j] = new THnSparseF(Form("%s_fHJetPhiCorr%s",triggerName[i],dataType[j]),Form("%s-%s: single inclusive TT p_{T} vs recoil jet p_{T} vs #Delta#varphi vs area vs centrality vs #Delta#eta vs pt hard bin (R=%1.1f);TT p_{T} (GeV/c);p_{T,jet}^{ch} (GeV/c);#Delta#varphi;area;centrality;#Delta#eta;ptHardBin",dataName[j],triggerName[i],fRadius),dimCor,nBinsCor,lowBinCor,hiBinCor);
+             fHJetPhiCorr[i][j]->SetBinEdges(3,newbins);
+             fOutputList->Add(fHJetPhiCorr[i][j]);
+           }
+       }
+
+
+      if(fRunSingleInclHJet)
+       {
+         fhNumberOfTT[i] = new TH1F(Form("%s_fhNumberOfTT",triggerName[i]), Form("%s: number of TT",triggerName[i]),6,0,6);
+         fOutputList->Add(fhNumberOfTT[i]);
+
+         fHJetPhiCorrUp[i] = new THnSparseF(Form("%s_fHJetPhiCorrUp",triggerName[i]),Form("%s: single inclusive TT p_{T} vs recoil jet p_{T} vs #Delta#varphi vs area vs centrality vs #Delta#eta vs pt hard bin (R=%1.1f);TT p_{T} (GeV/c);p_{T,jet}^{ch} (GeV/c);#Delta#varphi;area;centrality;#Delta#eta;ptHardBin",triggerName[i],fRadius),dimCor,nBinsCor,lowBinCor,hiBinCor);
+         fOutputList->Add(fHJetPhiCorrUp[i]);
+
+         fHJetPhiCorrDown[i] = new THnSparseF(Form("%s_fHJetPhiCorrDown",triggerName[i]),Form("%s: single inclusive TT p_{T} vs recoil jet p_{T} vs #Delta#varphi vs area vs centrality vs #Delta#eta vs pt hard bin (R=%1.1f);TT p_{T} (GeV/c);p_{T,jet}^{ch} (GeV/c);#Delta#varphi;area;centrality;#Delta#eta;ptHardBin",triggerName[i],fRadius),dimCor,nBinsCor,lowBinCor,hiBinCor);
+         fOutputList->Add(fHJetPhiCorrDown[i]);
+       }
+
+      if(fRunLeadTrkQA)
+       {
+         fhLeadTrkQA[i] = new THnSparseF(Form("%s_fhLeadTrkQA",triggerName[i]),Form("%s: p_{T,trk}^{leading} vs p_{T,jet}^{full} vs #Delta#varphi vs z vs centrality;p_{T,trk}^{leading} (GeV/c); p_{T,jet}^{full} (GeV/c);#Delta#varphi;z;centrality",triggerName[i]),dimLeadTrkqa,nBinsLeadTrkqa,lowBinLeadTrkqa,hiBinLeadTrkqa);
+         fOutputList->Add(fhLeadTrkQA[i]);
+       }
+
+      if(fStudyKtEffects)
+       {
+         fhKtEffects[i] = new THnSparseF(Form("%s_fhKtEffects",triggerName[i]),Form("%s: TT p_{T} vs recoil jet p_{T} vs k_{t} vs centrality vs pt hard bin (R=%1.1f);TT p_{T} (GeV/c);p_{T,jet}^{ch} (GeV/c);k_{t} (GeV/c);centrality;ptHardBin",triggerName[i],fRadius),dimKt,nBinsKt,lowBinKt,hiBinKt);
+         fOutputList->Add(fhKtEffects[i]);
+       }
+    }
+
+  //error calculation in THnSparse
+  Int_t nObj = fOutputList->GetEntries();
+  for(Int_t i=0; i<nObj; i++)
+    {
+      TObject *obj = (TObject*) fOutputList->At(i);
+      if (obj->IsA()->InheritsFrom( "THnSparse" ))
+       {
+         THnSparseF *hn = (THnSparseF*)obj;
+         hn->Sumw2();
+       }
+    }
+
+  if(fRunTrkQA)
+    {
+      fEsdTrkCut = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE,1);
+      fEsdTrkCut->SetMaxDCAToVertexXY(2.4);
+      fEsdTrkCut->SetMaxDCAToVertexZ(3.2);
+      fEsdTrkCut->SetDCAToVertex2D(kTRUE);
+      fEsdTrkCut->SetMaxChi2TPCConstrainedGlobal(36);
+      fEsdTrkCut->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
+
+      fEsdHybCut = new AliESDtrackCuts(*fEsdTrkCut);
+      fEsdHybCut->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kNone);
+    }
+
+  fRandom = new TRandom3(0);
+
+  PrintConfig();
+
+  if(fAnaType==1) TH1::AddDirectory(oldStatus);
+  PostData(1, fOutputList);
+}
+
+//________________________________________________________________________
+Bool_t AliAnalysisTaskHJetDphi::UserNotify()
+{
+  AliInfo("User Nofity");
+
+  Int_t runNumber = InputEvent()->GetRunNumber();
+  if(fSwitchOnAvoidTpcHole)
+    {
+      Int_t runs[28] = {169975, 169981, 170038, 170040, 170083, 170084, 170085, 170088, 170089, 170091, 170152, 170155, 170159, 170163, 170193, 170195, 170203, 170204, 170205, 170228, 170230, 170264, 170268, 170269, 170270, 170306, 170308, 170309};
+      Bool_t isSemigood = kFALSE;
+      for(Int_t i=0; i<28; i++)
+       {
+         if(runNumber==runs[i])
+           {
+             isSemigood = kTRUE;
+             break;
+           }
+       }
+      if(isSemigood) fAvoidTpcHole = kTRUE;
+      else           fAvoidTpcHole = kFALSE;
+    }
+
+  if(fIsMC)
+    {
+      TTree *tree = AliAnalysisManager::GetAnalysisManager()->GetTree();
+      TFile *currFile = tree->GetCurrentFile();
+      TString fileName(currFile->GetName());
+      if(fileName.Contains("root_archive.zip#"))
+       {
+         Ssiz_t pos = fileName.Index("#",0,TString::kExact);
+         fileName.Replace(pos+1,20,"");
+       }
+      else
+       {
+         fileName.ReplaceAll(gSystem->BaseName(fileName.Data()),"");
+       }
+
+      TFile *fxsec = TFile::Open(Form("%s%s",fileName.Data(),"pyxsec_hists.root"),"read");
+      if(fxsec)
+       {
+         TKey *key = (TKey*)fxsec->GetListOfKeys()->At(0);
+         if(key)
+           {
+             TList *list = dynamic_cast<TList*>(key->ReadObj());
+             if(list)
+               {
+                 fhNTrials->Fill(0.5, ((TH1F*)list->FindObject("h1Trials"))->GetBinContent(1));
+               }
+             else
+               return kFALSE;
+           }
+         else
+           return kFALSE;
+       }
+      else
+       {
+         fxsec = TFile::Open(Form("%s%s",fileName.Data(),"pyxsec.root"),"read");
+         TTree *xtree = (TTree*)fxsec->Get("Xsection");
+         if(xtree)
+           {
+             UInt_t ntrials = 0;
+             xtree->SetBranchAddress("ntrials",&ntrials);
+             xtree->GetEntry(0);
+             fhNTrials->Fill(0.5, ntrials);
+           }
+         else
+           return kFALSE;
+       }
+      fxsec->Close();
+    }
+  return kTRUE;
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskHJetDphi::UserExec(Option_t *) 
+{  
+  // Main loop, called for each event.
+
+  fTriggerType = -1;
+
+  // Get pointers to input events
+  fEvent = InputEvent();
+  if (!fEvent) 
+    {
+      AliError("Input event not available");
+      return;
+    }
+
+  if(fIsMC)  
+    {
+      fMC  = MCEvent();
+      if (!fMC)
+       {
+         AliError("MC event available");
+         return;
+       }
+    }
+
+  fESD=dynamic_cast<AliESDEvent*>(InputEvent());
+  if (!fESD) 
+    {
+      AliInfo("ESD not available");
+      fAODIn = dynamic_cast<AliAODEvent*>(InputEvent());
+    }
+  if(fAnaType==1)
+    {
+      fAODOut = dynamic_cast<AliAODEvent*>(AODEvent());
+      if(fNonStdFile.Length()!=0)
+       {
+         // case that we have an AOD extension we need can fetch the jets from the extended output
+         AliAODHandler *aodH = dynamic_cast<AliAODHandler*>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler());
+         fAODExtension = (aodH?aodH->GetExtension(fNonStdFile.Data()):0);
+         if(!fAODExtension)
+           {
+             if(fVerbosity>1) printf("AODExtension not found for %s",fNonStdFile.Data());
+           }
+       }
+    }
+
+  fhEventStat->Fill(0.5);
+
+  if(fIsEmbedding)
+    {
+      if(fAnaType==0)
+       {
+         TString fileName = fPtHardBinName->GetString();
+         fileName.Remove(0,51);
+         fileName.Remove(fileName.Index("/"));
+         fPtHardBin = fileName.Atoi();
+       }
+      if(fAnaType==1)
+       {
+         Double_t pthard = AliAnalysisTaskFastEmbedding::GetPtHard();
+         fPtHardBin = GetPtHardBin(pthard);
+       }
+    }
+
+  // physics selection
+  UInt_t trigger = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
+  if(fOfflineTrgMask==AliVEvent::kAny) fTriggerType = 0;
+  else
+    {
+      if(trigger & fOfflineTrgMask) fTriggerType=0;
+
+      if(fPeriod.Contains("lhc11a",TString::kIgnoreCase))
+       {
+         if (trigger & AliVEvent::kMB)     { fTriggerType=0; }
+         if (trigger & AliVEvent::kEMC1)   { fTriggerType=1; }
+       }  
+    }
+  if(fTriggerType==-1) return;
+  if(fAnalyzeMCTruth) fTriggerType = 3;
+  fhEventStat->Fill(1.5);
+  // Vertex cut 
+  const AliVVertex* vtx = fEvent->GetPrimaryVertex();
+  if (!vtx || vtx->GetNContributors()<1) return;
+  fhEventStat->Fill(2.5);
+  fhVtxZ[fTriggerType]->Fill(vtx->GetZ());
+  if (TMath::Abs(vtx->GetZ())>fMaxVtxZ)  return;
+  fhEventStat->Fill(3.5);
+  
+  if(fTriggerType==0)
+    {
+      if(trigger & AliVEvent::kCentral) fhEventStat->Fill(5.5);
+      else if (trigger & AliVEvent::kCentral) fhEventStat->Fill(6.5);
+      else fhEventStat->Fill(4.5);
+    }
+  if(fTriggerType==1) fhEventStat->Fill(7.5);
+  if(fTriggerType==2) fhEventStat->Fill(8.5);
+  
+    // GetCentrality
+  if(fCollisionSystem=="PbPb")
+    {
+      AliCentrality *centrality = fEvent->GetCentrality();
+      if (centrality) fCentrality = centrality->GetCentralityPercentile("V0M");
+      else            fCentrality = 99;
+    }
+  else if(fCollisionSystem=="pp")
+    fCentrality = 0;
+  fhCentrality[fTriggerType]->Fill(fCentrality);
+
+  // Retrieve arraies from memory
+  if(!fIsInit) fIsInit = RetrieveArraies();
+  if(!fIsInit) return;
+
+  // Get Rho value
+  if(fCollisionSystem=="PbPb")
+    {
+      if(fAnaType==0) fRhoValue = fRho->GetVal();
+      if(fAnaType==1) fRhoValue = fEvtBkg->GetBackground(0);
+    }
+  else if(fCollisionSystem=="pp")
+    {
+      fRhoValue = 0;
+    }
+  fhRhoVsCent[fTriggerType]->Fill(fCentrality,fRhoValue);
+  fhPtHardBins->Fill(fPtHardBin);
+
+  if(fRunSingleInclHJet) 
+    {
+      Double_t trigPt = -1, trigPhi = -999, trigEta = -999;
+      Int_t nTrig = FindSingleIncTrigger(fTrackArray, trigPt, trigPhi, trigEta, fIsEmbedding);
+      if(nTrig>0) fhNumberOfTT[fTriggerType]->Fill(nTrig);
+      RunSingleInclHJetCorr(trigPt, trigPhi, trigEta, fJetArray, fRhoValue, fhTTPt[fTriggerType][0], fHJetPhiCorr[fTriggerType][0]);
+      if(fRunBkgFlow)
+       {
+         RunSingleInclHJetCorr(trigPt, trigPhi, trigEta, fJetArray, fRhoValue+1, 0x0, fHJetPhiCorrUp[fTriggerType]);
+         RunSingleInclHJetCorr(trigPt, trigPhi, trigEta, fJetArray, fRhoValue-1, 0x0, fHJetPhiCorrDown[fTriggerType]);
+       }
+
+      if(fIsEmbedding)
+       {
+         if(fRunDLHJet) 
+           {
+             FindSingleIncTrigger(fTrackArray, trigPt, trigPhi, trigEta, 1);
+             RunSingleInclHJetCorr(trigPt, trigPhi, trigEta, fDLJetArray, 0, fhTTPt[fTriggerType][1], fHJetPhiCorr[fTriggerType][1]);
+           }
+
+         if(fRunPLHJet) 
+           {
+             FindSingleIncTrigger(fMcParticleArray, trigPt, trigPhi, trigEta, 2);
+             RunSingleInclHJetCorr(trigPt, trigPhi, trigEta, fPLJetArray, 0, fhTTPt[fTriggerType][2], fHJetPhiCorr[fTriggerType][2]);
+           }
+       }
+    }
+  
+  if(fRunJetQA) 
+    {
+      RunJetQA(fJetArray, fRhoValue, fhJetPt[fTriggerType][0], fhJetArea[fTriggerType][0], fhJetQA[fTriggerType][0]);
+      if(fIsEmbedding)
+       {
+         if(fRunDLHJet) RunJetQA(fDLJetArray, 0, fhJetPt[fTriggerType][1], fhJetArea[fTriggerType][1], fhJetQA[fTriggerType][1]);
+         if(fRunPLHJet)  RunJetQA(fPLJetArray, 0, fhJetPt[fTriggerType][2], fhJetArea[fTriggerType][2], fhJetQA[fTriggerType][2]);
+       }
+    }
+  
+  if(!fIsEmbedding)
+    {
+      if(fRunTrkQA) RunTrackQA();
+      if(fRunLeadTrkQA) RunLeadTrkQA();
+    }
+
+  if(fStudyKtEffects) StudyKtEffects();
+
+  PostData(1, fOutputList);
+  return;
+}
+
+//________________________________________________________________________
+Int_t AliAnalysisTaskHJetDphi::FindSingleIncTrigger(const TClonesArray *trackArray, Double_t &trigPt, Double_t &trigPhi, Double_t &trigEta, const Int_t arrayType)
+{
+  Int_t trigIndex = -1;
+  trigPt = -1;
+  trigPhi = -999; 
+  trigEta = -999;
+
+  // arrayType: 0 -> data, 1 -> embedding, 2 -> MC
+  if(!trackArray) return 0;
+
+  Int_t nTT = 0, counter = 0; 
+  Int_t ntracks = trackArray->GetEntries();
+  TArrayI arr;
+  arr.Set(ntracks);
+  for(Int_t it=0; it<ntracks; it++)
+    {
+      AliVParticle *t = dynamic_cast<AliVParticle*>(trackArray->At(it));
+      if(!t || t->Charge()==0 || !AcceptTrack(t)) continue;
+
+      if(fAnaType==0 && arrayType==1 && t->GetLabel()==0) continue; 
+
+      if(fAnaType==1 && arrayType<2 && !IsGoodAODtrack(t) ) continue;
+
+      Double_t pt = t->Pt();
+      if(fTTtype==0)
+       {
+         if (pt<fTTMaxPt && pt>=fTTMinPt)
+           {
+             nTT++;
+             arr.AddAt(it,counter);
+             counter++;
+           }
+       }
+    }
+  arr.Set(counter);
+
+  if(fTTtype==0)
+    {
+      if(counter==0) trigIndex = -1;
+      else if(counter==1) trigIndex = arr.At(0);
+      else
+       {
+         fRandom->SetSeed(arr.At(0)); //make this random selection reproducible
+         Double_t pro = fRandom->Uniform() * counter;
+         trigIndex = arr.At(TMath::FloorNint(pro));
+       }
+      arr.Reset();
+    }
+
+  if(trigIndex>0)
+    {
+      AliVParticle *tt = (AliVParticle*) fTrackArray->At(trigIndex);
+      trigPt = tt->Pt();
+      trigPhi = tt->Phi();
+      trigEta = tt->Eta();
+      if(fSwitchOnAvoidTpcHole && fAvoidTpcHole && trigPhi>3.91-pi && trigPhi<5.51-pi) trigIndex = -1;
+
+      if(fCutTPCBoundary)
+       {
+         Double_t phiDist = trigPhi - TMath::FloorNint(trigPhi/kSector)*kSector;
+         if(phiDist<fDistToTPCBoundary || phiDist>kSector-fDistToTPCBoundary)
+           {
+             trigIndex = -1;
+           }
+       }
+    }
+  if(trigIndex==-1) { trigPt = -1; trigPhi = -999; trigEta = -999;}
+  if(arrayType==0) fTriggerTrkIndex = trigIndex; 
+  return nTT;
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskHJetDphi::RunSingleInclHJetCorr(Double_t trigPt, Double_t trigPhi, Double_t trigEta, const TClonesArray *jetArray, Double_t rho, THnSparse *hTT, THnSparse *hn)
+{
+  if(trigPt<0 || !fJetArray) return;
+
+  if(hTT)
+    {
+      Double_t fillTT[] = {trigPt, fCentrality, fPtHardBin};
+      hTT->Fill(fillTT);
+    }
+
+  Int_t nJets = jetArray->GetEntries();
+  Double_t jetPt, jetEta, jetPhi, jetArea;
+  for(Int_t ij=0; ij<nJets; ij++)
+    {
+      if(fAnaType==0)
+       {
+         AliEmcalJet* jet = dynamic_cast<AliEmcalJet*>(jetArray->At(ij));
+         jetPt   = jet->Pt();
+         jetEta  = jet->Eta();
+         jetPhi  = jet->Phi();
+         jetArea = jet->Area();
+       }
+      if(fAnaType==1)
+       {
+         AliAODJet* jet = dynamic_cast<AliAODJet*>(jetArray->At(ij));
+         jetPt   = jet->Pt();
+         jetEta  = jet->Eta();
+         jetPhi  = jet->Phi();
+         jetArea = jet->EffectiveAreaCharged();
+       }
+      if(!IsGoodJet(jetEta)) continue; // eta cut
+      Double_t dPhi = CalculateDPhi(trigPhi,jetPhi);
+
+      Double_t jetPtCorr = jetPt-rho*jetArea;
+      if(jetPtCorr>fJetPtMin)
+       {
+         Double_t fill[] = {trigPt,jetPtCorr,dPhi,jetArea,fCentrality,trigEta-jetEta, fPtHardBin};
+         hn->Fill(fill);
+       }
+    }
+}
+
+
+//________________________________________________________________________
+void AliAnalysisTaskHJetDphi::RunTrackQA()
+{
+  if(fIsEmbedding) return;
+  if(!fTrackArray) return;
+
+  Int_t ntracks = fTrackArray->GetEntries();
+  for(Int_t it=0; it<ntracks; it++)
+    {
+      AliVParticle *t = dynamic_cast<AliVParticle*>(fTrackArray->At(it));
+      if(!t || t->Charge()==0 || !AcceptTrack(t)) continue;
+      if(fAnaType==1 && !IsGoodAODtrack(t)) continue;
+      fhTrkPt[fTriggerType]->Fill(t->Pt(),fCentrality);
+      Double_t phi = t->Phi();
+      if(phi<0) phi += 2*pi;
+      Double_t fill[] = {t->Pt(), phi*TMath::RadToDeg(), t->Eta(), fCentrality};
+      fhTrkQA[fTriggerType]->Fill(fill);
+    }
+
+  if(fESD)
+    {
+      Int_t ntrack = fESD->GetNumberOfTracks();
+      for(Int_t itr=0; itr<ntrack; itr++)
+       {
+         AliESDtrack *esdtrack = fESD->GetTrack(itr);
+         if(!esdtrack ||  TMath::Abs(esdtrack->Eta())>0.9 )continue;
+         Int_t type = -1;
+         if(fEsdTrkCut->AcceptTrack(esdtrack))
+           type = 0;
+         else if(fEsdHybCut->AcceptTrack(esdtrack))
+           type = 1;
+         else
+           continue;
+
+         Double_t resolution = -1;
+         Int_t label = esdtrack->GetLabel();
+         if(label>0 && fMC)
+           {
+             AliMCParticle *part = (AliMCParticle*)fMC->GetTrack(label);
+             TParticle *tpart = (TParticle*)part->Particle();
+             if(TMath::Abs(tpart->GetPdgCode())==211)
+               {
+                 Double_t fillPhiRes[] = {esdtrack->Pt(),part->Phi()-esdtrack->Phi(),type,fCentrality};
+                 fhTrkPhiRes[fTriggerType]->Fill(fillPhiRes);
+               }
+             resolution = (part->Pt()-esdtrack->Pt())/part->Pt();
+           }
+         Double_t fillPtRes[] = {esdtrack->Pt(),esdtrack->Pt()*TMath::Sqrt(esdtrack->GetSigma1Pt2()),resolution,type,fCentrality};
+         fhTrkPtRes[fTriggerType]->Fill(fillPtRes);
+       }
+    }
+  else if(fAODIn)
+    {
+      ntracks = fAODIn->GetNumberOfTracks();
+      Int_t type = -1;
+      for(Int_t itrack=0; itrack<ntracks; itrack++)
+       {
+         AliAODTrack *aodtrack = (AliAODTrack*)fAODIn->GetTrack(itrack);
+         if(!aodtrack || !AcceptTrack(dynamic_cast<AliVParticle*>(aodtrack)) ) continue;
+         if (fAODfilterBits[0] < 0) 
+           {
+             if (aodtrack->IsHybridGlobalConstrainedGlobal())
+               type = 3;
+             else
+               continue;
+           }
+         else 
+           {
+             if (aodtrack->TestFilterBit(fAODfilterBits[0]))  type = 0;
+             else if (aodtrack->TestFilterBit(fAODfilterBits[1]) && (aodtrack->GetStatus()&AliESDtrack::kITSrefit)!=0) type = 1;
+             else continue;
+           }
+         Double_t sigma1Pt2 = GetAODTrackPtRes(aodtrack);
+         Double_t resolution = -1;
+         Int_t label = aodtrack->GetLabel();
+         if(label>0 && fMC)
+           {
+             AliMCParticle *part = (AliMCParticle*)fMC->GetTrack(label);
+             resolution = (part->Pt()-aodtrack->Pt())/part->Pt();
+             Double_t fillPhiRes[] = {aodtrack->Pt(),part->Phi()-aodtrack->Phi(),type,fCentrality};
+             fhTrkPhiRes[fTriggerType]->Fill(fillPhiRes);
+           }
+         if(sigma1Pt2>0)
+           {
+             Double_t fillPtRes[5] = {aodtrack->Pt(),aodtrack->Pt()*TMath::Sqrt(sigma1Pt2),resolution,type,fCentrality};
+             fhTrkPtRes[fTriggerType]->Fill(fillPtRes);
+           }
+       }
+    }
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskHJetDphi::RunJetQA(const TClonesArray *jetArray, const Double_t rho, THnSparse *hJetPt, THnSparse *hJetArea, THnSparse *hJetQA)
+{
+  Int_t nJets = jetArray->GetEntries();
+  Double_t jetPt, jetEta, jetPhi, jetArea, jetPtCorr;
+  Int_t nCons;
+  for(Int_t ij=0; ij<nJets; ij++)
+    {
+      if(fAnaType==0)
+       {
+         AliEmcalJet* jet = dynamic_cast<AliEmcalJet*>(jetArray->At(ij));
+         jetPt   = jet->Pt();
+         jetEta  = jet->Eta();
+         jetPhi  = jet->Phi();
+         jetArea = jet->Area();
+         nCons   = jet->GetNumberOfConstituents();
+       }
+      if(fAnaType==1)
+       {
+         AliAODJet* jet = dynamic_cast<AliAODJet*>(jetArray->At(ij));
+         jetPt   = jet->Pt();
+         jetEta  = jet->Eta();
+         jetPhi  = jet->Phi();
+         jetArea = jet->EffectiveAreaCharged();
+         nCons   = jet->GetRefTracks()->GetEntriesFast();
+       }
+      if(!IsGoodJet(jetEta)) continue; // eta cut
+
+      jetPtCorr = jetPt-rho*jetArea;
+      Double_t fillPt[] = {jetPtCorr, jetPt, fCentrality, fPtHardBin};
+      hJetPt->Fill(fillPt);
+
+      Double_t fillA[] = {jetPtCorr, jetArea, fCentrality, fPtHardBin};
+      hJetArea->Fill(fillA);
+
+      if(jetPtCorr>fJetPtMin)
+       {
+         Double_t fillQA[] = {jetPtCorr, jetPhi*TMath::RadToDeg(), jetEta, jetArea, nCons, fCentrality, fPtHardBin};
+         hJetQA->Fill(fillQA);
+       }
+    }
+}
+
+
+//________________________________________________________________________
+void AliAnalysisTaskHJetDphi::RunLeadTrkQA()
+{
+  if(fIsEmbedding || fTriggerTrkIndex<0) return;
+  Double_t jetPt = -1, jetPhi = -999;
+
+  if(fAnaType==0)
+    {
+      Int_t nJets = fJetArray->GetEntries();
+      for(Int_t ij=0; ij<nJets; ij++)
+       {
+         AliEmcalJet* jet = dynamic_cast<AliEmcalJet*>(fJetArray->At(ij));
+         if(!IsGoodJet(jet->Eta())) continue; // eta cut
+         for (Int_t i = 0; i < jet->GetNumberOfTracks(); i++) 
+           {
+             if(jet->TrackAt(i)==fTriggerTrkIndex)
+               {
+                 jetPt = jet->Pt();
+                 jetPhi = jet->Phi();
+                 break;
+               }
+           }
+       }
+    }
+  if(fAnaType==1)
+    {
+      jetPt = -1;
+    }
+  
+
+  if(jetPt<=0) return;
+  AliVParticle *tt = (AliVParticle*) fTrackArray->At(fTriggerTrkIndex);
+  Double_t fill[] = {tt->Pt(), jetPt, tt->Phi()-jetPhi, tt->Pt()/jetPt, fCentrality};
+  fhLeadTrkQA[fTriggerType]->Fill(fill);
+}
+
+
+//________________________________________________________________________
+void AliAnalysisTaskHJetDphi::StudyKtEffects()
+{
+  if(fAnaType==1) return;
+  if(fTriggerTrkIndex<0) return;
+
+  fKtValue = 0; // dummy
+
+  AliPicoTrack *tt = (AliPicoTrack*) fTrackArray->At(fTriggerTrkIndex);
+  Double_t triggerPhi = tt->GetTrackPhiOnEMCal();
+
+  Int_t nJets = fDLJetArray->GetEntries();
+  Double_t jetPhi, jetPt, jetArea;
+  for(Int_t ij=0; ij<nJets; ij++)
+    {
+      AliEmcalJet* jet = dynamic_cast<AliEmcalJet*>(fDLJetArray->At(ij));
+      if(!IsGoodJet(jet->Eta())) continue; // eta cut
+      jetPhi = jet->Phi();
+      jetPt  = jet->Pt();
+      jetArea = jet->Area();
+      Double_t dPhi = CalculateDPhi(triggerPhi,jet->Phi());
+      if(dPhi<pi+0.6 && dPhi>pi-0.6)
+       {
+         Double_t fill[] = {tt->Pt(), jet->Pt(), jet->Pt()*TMath::Tan(tt->GetTrackPtOnEMCal()), fCentrality, fPtHardBin};
+         fhKtEffects[fTriggerType]->Fill(fill);
+       }
+    }
+}
+
+
+//________________________________________________________________________
+Bool_t AliAnalysisTaskHJetDphi::RetrieveArraies()
+{
+  if(fAnaType==0)
+    {
+      // Get mc particles
+      if (!fMcParticleArrName.IsNull()) 
+       {
+         AliInfo(Form("Retrieve mc particles %s!", fMcParticleArrName.Data()));
+         fMcParticleArray = dynamic_cast<TClonesArray*>(fEvent->FindListObject(fMcParticleArrName));
+         if (!fMcParticleArray) 
+           {
+             AliError(Form("Could not retrieve mc particles %s!", fMcParticleArrName.Data())); 
+             return kFALSE;
+           }
+
+         TString fMcParticleMapArrName = fMcParticleArrName + "_Map";
+         fMcParticlelMap = dynamic_cast<AliNamedArrayI*>(fEvent->FindListObject(fMcParticleMapArrName));
+         if (!fMcParticlelMap) 
+           {
+             AliWarning(Form("%s: Could not retrieve map for MC particles %s! Will assume MC labels consistent with indexes...", GetName(), fMcParticleArrName.Data())); 
+             return kFALSE;
+           }
+       }
+
+      // Get track collection
+      if (!fTrackArrName.IsNull()) 
+       {
+         AliInfo(Form("Retrieve tracks %s!", fTrackArrName.Data()));
+         fTrackArray = dynamic_cast<TClonesArray*>(fEvent->FindListObject(fTrackArrName));
+         if (!fTrackArray) 
+           {
+             AliError(Form("Could not retrieve tracks %s!", fTrackArrName.Data())); 
+             return kFALSE;
+           }
+       }
+
+      // Get mixed track collection
+      if (!fEmbTrkArrName.IsNull()) 
+       {
+         AliInfo(Form("Retrieve PYTHIA+PbPb tracks %s!", fEmbTrkArrName.Data()));
+         fEmbTrkArray = dynamic_cast<TClonesArray*>(fEvent->FindListObject(fEmbTrkArrName));
+         if (!fEmbTrkArray) 
+           {
+             AliError(Form("Could not retrieve PYTHIA+PbPb tracks %s!", fEmbTrkArrName.Data())); 
+             return kFALSE;
+           }
+       }
+  
+      // Get Rho value
+      if(fCollisionSystem=="PbPb")
+       {
+         if(!fRhoName.IsNull())
+           {
+             AliInfo(Form("Retrieve rho %s!", fRhoName.Data()));
+             fRho = dynamic_cast<AliRhoParameter*>(InputEvent()->FindListObject(fRhoName));
+             if(!fRho)
+               {
+                 AliError(Form("Could not retrieve rho %s!",fRhoName.Data()));
+                 return kFALSE;
+               }
+           }
+       }
+      
+      // Get jet collection
+      if (!fJetArrName.IsNull())
+       {
+         AliInfo(Form("Retrieve jets %s!", fJetArrName.Data()));
+         fJetArray = dynamic_cast<TClonesArray*>(fEvent->FindListObject(fJetArrName));
+         if (!fJetArray)
+           {
+             AliError(Form("%s: Could not retrieve jets %s!", GetName(), fJetArrName.Data()));
+             return kFALSE;
+           }
+       }
+
+      // Get DL jet collection
+      if (!fDLJetArrName.IsNull())
+       {
+         AliInfo(Form("Retrieve DL jets %s!", fDLJetArrName.Data()));
+         fDLJetArray = dynamic_cast<TClonesArray*>(fEvent->FindListObject(fDLJetArrName));
+         if (!fDLJetArray)
+           {
+             AliError(Form("%s: Could not retrieve DL jets %s!", GetName(), fDLJetArrName.Data()));
+             return kFALSE;
+           }
+       }
+
+      // Get PL jet collection
+      if (!fPLJetArrName.IsNull())
+       {
+         AliInfo(Form("Retrieve PL jets %s!", fPLJetArrName.Data()));
+         fPLJetArray = dynamic_cast<TClonesArray*>(fEvent->FindListObject(fPLJetArrName));
+         if (!fPLJetArray)
+           {
+             AliError(Form("%s: Could not retrieve PL jets %s!", GetName(), fPLJetArrName.Data()));
+             return kFALSE;
+           }
+       }
+
+      if(fIsEmbedding)
+       {
+         if(fAnaType==0 && !fPtHardBinName)
+           {
+             // Get embedded pt hard bin number
+             fPtHardBinName = static_cast<AliNamed