changes by Andrea for flow part of GammaConv
authorfbock <friederike.bock@cern.ch>
Fri, 5 Dec 2014 11:56:38 +0000 (12:56 +0100)
committerfbock <friederike.bock@cern.ch>
Fri, 5 Dec 2014 11:56:38 +0000 (12:56 +0100)
PWGGA/GammaConv/AliAnalysisTaskGammaConvFlow.cxx
PWGGA/GammaConv/AliAnalysisTaskGammaConvFlow.h
PWGGA/GammaConv/macros/AddTask_GammaConvFlow_PbPb2.C

index 30e1586..334d22c 100644 (file)
@@ -1,12 +1,7 @@
 /**************************************************************************
  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  *                                                                        *
- * Author: Martin Wilde, Daniel Lohner, Friederike Bock                              *
- * Version 1.0                                                            *
- *                                                                        *
- * based on: on older version (see aliroot up to v5-04-42-AN)             *
- *           AliAnalysisTaskGammaConversion.cxx                           *
- *           Authors: Kathrin Koch, Kenneth Aamodt, Ana Marin             *
+ * Author: Andrea Dubla, Redmer Alexander Bertens, Friederike Bock           *
  *                                                                        *
  * Permission to use, copy, modify and distribute this software and its          *
  * documentation strictly for non-commercial purposes is hereby granted          *
 #include "AliFlowEventSimple.h"
 #include "AliFlowCommonConstants.h"
 #include "AliFlowEvent.h"
+#include "AliFlowTrack.h"
+
+class AliFlowTrackCuts;
 
+using namespace std;
 
 ClassImp(AliAnalysisTaskGammaConvFlow)
 
@@ -143,13 +142,13 @@ fDoMesonAnalysis(kTRUE),
 fDoMesonQA(0),
 fDoPhotonQA(0),
 fIsFromMBHeader(kTRUE),
-fCandidates(0),
 fDebug(0),
-fCutsRP(0),     // track cuts for reference particles
-fNullCuts(0), // dummy cuts for flow event tracks
-fFlowEvent(0) // flow events
+fCutsRP(0),
+fNullCuts(0), 
+fFlowEvent(0) 
 {
-
+       // DefineOutput(1, TList::Class());
+       // DefineOutput(2, AliFlowEventSimple::Class());
 }
 
 //________________________________________________________________________
@@ -230,11 +229,10 @@ fDoMesonAnalysis(kTRUE),
 fDoMesonQA(0),
 fDoPhotonQA(0),
 fIsFromMBHeader(kTRUE),
-fCandidates(0),
 fDebug(0),
-fCutsRP(0),     // track cuts for reference particles
-fNullCuts(0), // dummy cuts for flow event tracks
-fFlowEvent(0) // flow events
+fCutsRP(0), 
+fNullCuts(0), 
+fFlowEvent(0)
 
 {
     // Define output slots here
@@ -245,441 +243,371 @@ fFlowEvent(0) // flow events
 //___________________________________________________________
 AliAnalysisTaskGammaConvFlow::~AliAnalysisTaskGammaConvFlow()
 {
-    if(fGammaCandidates){
-        delete fGammaCandidates;
-        fGammaCandidates = 0x0;
-    }
-    if(fBGHandler){
-        delete[] fBGHandler;
-        fBGHandler = 0x0;
-    }
-    if(fBGHandlerRP){
-        delete[] fBGHandlerRP;
-        fBGHandlerRP = 0x0;
-    }
-    
-    
-    if (fCandidates) delete fCandidates;
-    if (fFlowEvent) delete fFlowEvent;
-
+       if(fGammaCandidates){
+               delete fGammaCandidates;
+               fGammaCandidates = 0x0;
+       }
+       if(fBGHandler){
+               delete[] fBGHandler;
+               fBGHandler = 0x0;
+       }
+       if(fBGHandlerRP){
+               delete[] fBGHandlerRP;
+               fBGHandlerRP = 0x0;
+       }
+       
+       if (fFlowEvent) delete fFlowEvent;
 
 }
 
-// //___________________________________________________________
-// void AliAnalysisTaskGammaConvFlow::InitBack(){
-//     
-//     const Int_t nDim = 4;
-//     Int_t nBins[nDim] = {800,250,7,4};
-//     Double_t xMin[nDim] = {0,0, 0,0};
-//     Double_t xMax[nDim] = {0.8,25,7,4};
-//     
-//   //  sESDMotherInvMassPtZM = new THnSparseF*[fnCuts];
-//   //  sESDMotherBackInvMassPtZM = new THnSparseF*[fnCuts];
-//     
-//     fBGHandler = new AliGammaConversionAODBGHandler*[fnCuts];
-//     fBGHandlerRP = new AliConversionAODBGHandlerRP*[fnCuts];
-//     for(Int_t iCut = 0; iCut<fnCuts;iCut++){
-//         if (((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation()){
-//             TString cutstringEvent  = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
-//             TString cutstringPhoton         = ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber();
-//             TString cutstringMeson  = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
-//             
-//             Int_t collisionSystem = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(0,1));
-//             Int_t centMin = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(1,1));
-//             Int_t centMax = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(2,1));
-//             
-//             if(collisionSystem == 1 || collisionSystem == 2 ||
-//                collisionSystem == 5 || collisionSystem == 8 ||
-//                collisionSystem == 9){
-//                 centMin = centMin*10;
-//                 centMax = centMax*10;
-//                 if(centMax ==0 && centMax!=centMin) centMax=100;
-//             } else if(collisionSystem == 3 || collisionSystem == 6) {
-//                 centMin = centMin*5;
-//                 centMax = centMax*5;
-//             } else if(collisionSystem == 4 || collisionSystem == 7) {
-//                 centMin = ((centMin*5)+45);
-//                 centMax = ((centMax*5)+45);
-//             }
-//             
-//             fBackList[iCut] = new TList();
-//             fBackList[iCut]->SetName(Form("%s_%s_%s Back histograms",cutstringEvent.Data(), cutstringPhoton.Data(),cutstringMeson.Data()));
-//             fBackList[iCut]->SetOwner(kTRUE);
-//             fCutFolder[iCut]->Add(fBackList[iCut]);
-//             
-//           //  sESDMotherBackInvMassPtZM[iCut] = new THnSparseF("Back_Back_InvMass_Pt_z_m","Back_Back_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
-//           //  fBackList[iCut]->Add(sESDMotherBackInvMassPtZM[iCut]);
-//             
-//             fMotherList[iCut] = new TList();
-//             fMotherList[iCut]->SetName(Form("%s_%s_%s Mother histograms",cutstringEvent.Data() ,cutstringPhoton.Data(),cutstringMeson.Data()));
-//             fMotherList[iCut]->SetOwner(kTRUE);
-//             fCutFolder[iCut]->Add(fMotherList[iCut]);
-//             
-//          //   sESDMotherInvMassPtZM[iCut] = new THnSparseF("Back_Mother_InvMass_Pt_z_m","Back_Mother_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
-//          //   fMotherList[iCut]->Add(sESDMotherInvMassPtZM[iCut]);
-//             
-//             if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->BackgroundHandlerType() == 0){
-//                 fBGHandler[iCut] = new AliGammaConversionAODBGHandler(
-//                                                                       collisionSystem,centMin,centMax,
-//                                                                       ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetNumberOfBGEvents(),
-//                                                                       ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseTrackMultiplicity(),
-//                                                                       0,8,5);
-//                 fBGHandlerRP[iCut] = NULL;
-//             } else {
-//                 fBGHandlerRP[iCut] = new AliConversionAODBGHandlerRP(
-//                                                                      ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsHeavyIon(),
-//                                                                      ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity(),
-//                                                                      ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetNumberOfBGEvents());
-//                 fBGHandler[iCut] = NULL;
-//             }
-//         }
-//     }
-// }
 //________________________________________________________________________
 void AliAnalysisTaskGammaConvFlow::UserCreateOutputObjects(){
-    
-    // Create histograms
-    if(fOutputContainer != NULL){
-        delete fOutputContainer;
-        fOutputContainer = NULL;
-    }
-    if(fOutputContainer == NULL){
-        fOutputContainer = new TList();
-        fOutputContainer->SetOwner(kTRUE);
-    }
-    
-   //========================= again flow setting==========================
-    fNullCuts = new AliFlowTrackCuts("null_cuts");
-    
-    AliFlowCommonConstants* cc = AliFlowCommonConstants::GetMaster();
-    cc->SetNbinsMult(10000);
-    cc->SetMultMin(0);
-    cc->SetMultMax(10000);
-    
-    cc->SetNbinsPt(400);
-    cc->SetPtMin(0);
-    cc->SetPtMax(20);
-    
-    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);
-    //===========================================================================
-
-    
-    
-    
-    // Array of current cut's gammas
-    fGammaCandidates = new TList();
-    
-    fCutFolder = new TList*[fnCuts];
-    fESDList = new TList*[fnCuts];
-    fBackList = new TList*[fnCuts];
-    fMotherList = new TList*[fnCuts];
-    hNEvents = new TH1I*[fnCuts];
-    hNGoodESDTracks = new TH1I*[fnCuts];
-    hNGammaCandidates = new TH1I*[fnCuts];
-    hNGoodESDTracksVsNGammaCanditates = new TH2F*[fnCuts];
-    hNV0Tracks = new TH1I*[fnCuts];
-    hEtaShift = new TProfile*[fnCuts];
-    hESDConvGammaPt = new TH1F*[fnCuts];
-    
-    if (fDoPhotonQA == 2){
-        fPhotonDCAList = new TList*[fnCuts];
-  //      tESDConvGammaPtDcazCat = new TTree*[fnCuts];
-    }
-    if (fDoPhotonQA > 0){
-        hESDConvGammaR = new TH1F*[fnCuts];
-        hESDConvGammaEta = new TH1F*[fnCuts];
-    }
-    
-    if(fDoMesonAnalysis){
-        hESDMotherInvMassPt = new TH2F*[fnCuts];
-        hESDMotherBackInvMassPt = new TH2F*[fnCuts];
-        hESDMotherInvMassEalpha = new TH2F*[fnCuts];
-        if (fDoMesonQA == 2){
-            fMesonDCAList = new TList*[fnCuts];
-            tESDMesonsInvMassPtDcazMinDcazMaxFlag = new TTree*[fnCuts];
-        }
-        if (fDoMesonQA > 0){
-            hESDMotherPi0PtY =  new TH2F*[fnCuts];
-            hESDMotherEtaPtY =  new TH2F*[fnCuts];
-            hESDMotherPi0PtAlpha =  new TH2F*[fnCuts];
-            hESDMotherEtaPtAlpha =  new TH2F*[fnCuts];
-            hESDMotherPi0PtOpenAngle =  new TH2F*[fnCuts];
-            hESDMotherEtaPtOpenAngle =  new TH2F*[fnCuts];
-        }
-    }
-    
-    for(Int_t iCut = 0; iCut<fnCuts;iCut++){
-        
-        TString cutstringEvent         = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
-        TString cutstringPhoton = ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber();
-        TString cutstringMeson = "NoMesonCut";
-        if(fDoMesonAnalysis)cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
-        
-        fCutFolder[iCut] = new TList();
-        fCutFolder[iCut]->SetName(Form("Cut Number %s_%s_%s",cutstringEvent.Data() ,cutstringPhoton.Data(),cutstringMeson.Data()));
-        fCutFolder[iCut]->SetOwner(kTRUE);
-        fOutputContainer->Add(fCutFolder[iCut]);
-        fESDList[iCut] = new TList();
-        fESDList[iCut]->SetName(Form("%s_%s_%s ESD histograms",cutstringEvent.Data() ,cutstringPhoton.Data(),cutstringMeson.Data()));
-        fESDList[iCut]->SetOwner(kTRUE);
-        fCutFolder[iCut]->Add(fESDList[iCut]);
-        
-        hNEvents[iCut] = new TH1I("NEvents","NEvents",10,-0.5,9.5);
-        hNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
-        hNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
-        hNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Missing MC");
-        if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
-            TString TriggerNames = "Not Trigger: ";
-            TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
-            hNEvents[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
-        } else {
-            hNEvents[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
-        }
-        hNEvents[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
-        hNEvents[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
-        hNEvents[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
-        hNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
-        hNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
-        hNEvents[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problem");
-        fESDList[iCut]->Add(hNEvents[iCut]);
-        
-        if(fIsHeavyIon == 1) hNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",4000,0,4000);
-        else if(fIsHeavyIon == 2) hNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",400,0,400);
-        else hNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",200,0,200);
-        fESDList[iCut]->Add(hNGoodESDTracks[iCut]);
-        if(fIsHeavyIon == 1) hNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",100,0,100);
-        else if(fIsHeavyIon == 2) hNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",50,0,50);
-        else hNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",50,0,50);
-        fESDList[iCut]->Add(hNGammaCandidates[iCut]);
-        if(fIsHeavyIon == 1) hNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",4000,0,4000,100,0,100);
-        else if(fIsHeavyIon == 2) hNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",400,0,400,50,0,50);
-        else hNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",200,0,200,50,0,50);
-        fESDList[iCut]->Add(hNGoodESDTracksVsNGammaCanditates[iCut]);
-        
-        
-        if(fIsHeavyIon == 1) hNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",30000,0,30000);
-        else if(fIsHeavyIon == 2) hNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",2500,0,2500);
-        else hNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",1500,0,1500);
-        fESDList[iCut]->Add(hNV0Tracks[iCut]);
-        hEtaShift[iCut] = new TProfile("Eta Shift","Eta Shift",1, -0.5,0.5);
-        fESDList[iCut]->Add(hEtaShift[iCut]);
-        hESDConvGammaPt[iCut] = new TH1F("ESD_ConvGamma_Pt","ESD_ConvGamma_Pt",250,0,25);
-        fESDList[iCut]->Add(hESDConvGammaPt[iCut]);
-        
-        if (fDoPhotonQA == 2){
-            fPhotonDCAList[iCut] = new TList();
-            fPhotonDCAList[iCut]->SetName(Form("%s_%s_%s Photon DCA tree",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringMeson.Data()));
-            fPhotonDCAList[iCut]->SetOwner(kTRUE);
-            fCutFolder[iCut]->Add(fPhotonDCAList[iCut]);
-            
+       
+       // Create histograms
+       if(fOutputContainer != NULL){
+               delete fOutputContainer;
+               fOutputContainer = NULL;
+       }
+       if(fOutputContainer == NULL){
+               fOutputContainer = new TList();
+               fOutputContainer->SetOwner(kTRUE);
+       }
+       
+       //========================= again flow setting==========================
+       //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(20);
+       
+       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);
+
+       // Array of current cut's gammas
+       fGammaCandidates = new TList();
+       
+       fCutFolder = new TList*[fnCuts];
+       fESDList = new TList*[fnCuts];
+       fBackList = new TList*[fnCuts];
+       fMotherList = new TList*[fnCuts];
+       hNEvents = new TH1I*[fnCuts];
+       hNGoodESDTracks = new TH1I*[fnCuts];
+       hNGammaCandidates = new TH1I*[fnCuts];
+       hNGoodESDTracksVsNGammaCanditates = new TH2F*[fnCuts];
+       hNV0Tracks = new TH1I*[fnCuts];
+       hEtaShift = new TProfile*[fnCuts];
+       hESDConvGammaPt = new TH1F*[fnCuts];
+       
+       if (fDoPhotonQA == 2){
+               fPhotonDCAList = new TList*[fnCuts];
+//      tESDConvGammaPtDcazCat = new TTree*[fnCuts];
+       }
+       if (fDoPhotonQA > 0){
+               hESDConvGammaR = new TH1F*[fnCuts];
+               hESDConvGammaEta = new TH1F*[fnCuts];
+       }
+       
+       if(fDoMesonAnalysis){
+               hESDMotherInvMassPt = new TH2F*[fnCuts];
+               hESDMotherBackInvMassPt = new TH2F*[fnCuts];
+               hESDMotherInvMassEalpha = new TH2F*[fnCuts];
+               if (fDoMesonQA == 2){
+                       fMesonDCAList = new TList*[fnCuts];
+                       tESDMesonsInvMassPtDcazMinDcazMaxFlag = new TTree*[fnCuts];
+               }
+               if (fDoMesonQA > 0){
+                       hESDMotherPi0PtY =  new TH2F*[fnCuts];
+                       hESDMotherEtaPtY =  new TH2F*[fnCuts];
+                       hESDMotherPi0PtAlpha =  new TH2F*[fnCuts];
+                       hESDMotherEtaPtAlpha =  new TH2F*[fnCuts];
+                       hESDMotherPi0PtOpenAngle =  new TH2F*[fnCuts];
+                       hESDMotherEtaPtOpenAngle =  new TH2F*[fnCuts];
+               }
+       }
+       
+       for(Int_t iCut = 0; iCut<fnCuts;iCut++){
+               
+               TString cutstringEvent  = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
+               TString cutstringPhoton = ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber();
+               TString cutstringMeson = "NoMesonCut";
+               if(fDoMesonAnalysis)cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
+               
+               fCutFolder[iCut] = new TList();
+               fCutFolder[iCut]->SetName(Form("Cut Number %s_%s_%s",cutstringEvent.Data() ,cutstringPhoton.Data(),cutstringMeson.Data()));
+               fCutFolder[iCut]->SetOwner(kTRUE);
+               fOutputContainer->Add(fCutFolder[iCut]);
+               fESDList[iCut] = new TList();
+               fESDList[iCut]->SetName(Form("%s_%s_%s ESD histograms",cutstringEvent.Data() ,cutstringPhoton.Data(),cutstringMeson.Data()));
+               fESDList[iCut]->SetOwner(kTRUE);
+               fCutFolder[iCut]->Add(fESDList[iCut]);
+               
+               hNEvents[iCut] = new TH1I("NEvents","NEvents",10,-0.5,9.5);
+               hNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
+               hNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
+               hNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Missing MC");
+               if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
+                       TString TriggerNames = "Not Trigger: ";
+                       TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
+                       hNEvents[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
+               } else {
+                       hNEvents[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
+               }
+               hNEvents[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
+               hNEvents[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
+               hNEvents[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
+               hNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
+               hNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
+               hNEvents[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problem");
+               fESDList[iCut]->Add(hNEvents[iCut]);
+               
+               if(fIsHeavyIon == 1) hNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",4000,0,4000);
+               else if(fIsHeavyIon == 2) hNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",400,0,400);
+               else hNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",200,0,200);
+               fESDList[iCut]->Add(hNGoodESDTracks[iCut]);
+               if(fIsHeavyIon == 1) hNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",100,0,100);
+               else if(fIsHeavyIon == 2) hNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",50,0,50);
+               else hNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",50,0,50);
+               fESDList[iCut]->Add(hNGammaCandidates[iCut]);
+               if(fIsHeavyIon == 1) hNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",4000,0,4000,100,0,100);
+               else if(fIsHeavyIon == 2) hNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",400,0,400,50,0,50);
+               else hNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",200,0,200,50,0,50);
+               fESDList[iCut]->Add(hNGoodESDTracksVsNGammaCanditates[iCut]);
+               
+               
+               if(fIsHeavyIon == 1) hNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",30000,0,30000);
+               else if(fIsHeavyIon == 2) hNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",2500,0,2500);
+               else hNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",1500,0,1500);
+               fESDList[iCut]->Add(hNV0Tracks[iCut]);
+               hEtaShift[iCut] = new TProfile("Eta Shift","Eta Shift",1, -0.5,0.5);
+               fESDList[iCut]->Add(hEtaShift[iCut]);
+               hESDConvGammaPt[iCut] = new TH1F("ESD_ConvGamma_Pt","ESD_ConvGamma_Pt",250,0,25);
+               fESDList[iCut]->Add(hESDConvGammaPt[iCut]);
+               
+               if (fDoPhotonQA == 2){
+                       fPhotonDCAList[iCut] = new TList();
+                       fPhotonDCAList[iCut]->SetName(Form("%s_%s_%s Photon DCA tree",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringMeson.Data()));
+                       fPhotonDCAList[iCut]->SetOwner(kTRUE);
+                       fCutFolder[iCut]->Add(fPhotonDCAList[iCut]);
+                       
 //            tESDConvGammaPtDcazCat[iCut] = new TTree("ESD_ConvGamma_Pt_Dcaz_R_Eta","ESD_ConvGamma_Pt_Dcaz_R_Eta_Cat");
 //            tESDConvGammaPtDcazCat[iCut]->Branch("Pt",&fPtGamma,"fPtGamma/F");
 //            tESDConvGammaPtDcazCat[iCut]->Branch("DcaZPhoton",&fDCAzPhoton,"fDCAzPhoton/F");
-            //          tESDConvGammaPtDcazCat[iCut]->Branch("R",&fRConvPhoton,"fRConvPhoton/F");
-            //          tESDConvGammaPtDcazCat[iCut]->Branch("Eta",&fEtaPhoton,"fEtaPhoton/F");
-            
-        //    tESDConvGammaPtDcazCat[iCut]->Branch("cat",&iCatPhoton,"iCatPhoton/b");
-
-    //        fPhotonDCAList[iCut]->Add(tESDConvGammaPtDcazCat[iCut]);
-        }
-        
-        if (fDoPhotonQA > 0){
-            hESDConvGammaR[iCut] = new TH1F("ESD_ConvGamma_R","ESD_ConvGamma_R",800,0,200);
-            fESDList[iCut]->Add(hESDConvGammaR[iCut]);
-            hESDConvGammaEta[iCut] = new TH1F("ESD_ConvGamma_Eta","ESD_ConvGamma_Eta",2000,-2,2);
-            fESDList[iCut]->Add(hESDConvGammaEta[iCut]);
-        }
-        
-        if(fDoMesonAnalysis){
-            hESDMotherInvMassPt[iCut] = new TH2F("ESD_Mother_InvMass_Pt","ESD_Mother_InvMass_Pt",800,0,0.8,250,0,25);
-            fESDList[iCut]->Add(hESDMotherInvMassPt[iCut]);
-            hESDMotherBackInvMassPt[iCut] = new TH2F("ESD_Background_InvMass_Pt","ESD_Background_InvMass_Pt",800,0,0.8,250,0,25);
-            fESDList[iCut]->Add(hESDMotherBackInvMassPt[iCut]);
-            hESDMotherInvMassEalpha[iCut] = new TH2F("ESD_Mother_InvMass_vs_E_alpha","ESD_Mother_InvMass_vs_E_alpha",800,0,0.8,250,0,25);
-            fESDList[iCut]->Add(hESDMotherInvMassEalpha[iCut]);
-            if (fDoMesonQA == 2){
-                fMesonDCAList[iCut] = new TList();
-                fMesonDCAList[iCut]->SetName(Form("%s_%s_%s Meson DCA tree",cutstringEvent.Data() ,cutstringPhoton.Data(),cutstringMeson.Data()));
-                fMesonDCAList[iCut]->SetOwner(kTRUE);
-                fCutFolder[iCut]->Add(fMesonDCAList[iCut]);
-                
-                tESDMesonsInvMassPtDcazMinDcazMaxFlag[iCut] = new TTree("ESD_Mesons_InvMass_Pt_DcazMin_DcazMax_Flag","ESD_Mesons_InvMass_Pt_DcazMin_DcazMax_Flag");
-                tESDMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("InvMass",&fInvMass,"fInvMass/F");
-                tESDMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("Pt",&fPt,"fPt/F");
-                tESDMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("DcaZMin",&fDCAzGammaMin,"fDCAzGammaMin/F");
-                tESDMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("DcaZMax",&fDCAzGammaMax,"fDCAzGammaMax/F");
-                
-                fMesonDCAList[iCut]->Add(tESDMesonsInvMassPtDcazMinDcazMaxFlag[iCut]);
-                
-            }
-            if (fDoMesonQA > 0 ){
-                hESDMotherPi0PtY[iCut] = new TH2F("ESD_MotherPi0_Pt_Y","ESD_MotherPi0_Pt_Y",150,0.03,15.,150,-1.5,1.5);
-                SetLogBinningXTH2(hESDMotherPi0PtY[iCut]);
-                fESDList[iCut]->Add(hESDMotherPi0PtY[iCut]);
-                hESDMotherEtaPtY[iCut] = new TH2F("ESD_MotherEta_Pt_Y","ESD_MotherEta_Pt_Y",150,0.03,15.,150,-1.5,1.5);
-                SetLogBinningXTH2(hESDMotherEtaPtY[iCut]);
-                fESDList[iCut]->Add(hESDMotherEtaPtY[iCut]);
-                hESDMotherPi0PtAlpha[iCut] = new TH2F("ESD_MotherPi0_Pt_Alpha","ESD_MotherPi0_Pt_Alpha",150,0.03,15.,100,0,1);
-                SetLogBinningXTH2(hESDMotherPi0PtAlpha[iCut]);
-                fESDList[iCut]->Add(hESDMotherPi0PtAlpha[iCut]);
-                hESDMotherEtaPtAlpha[iCut] = new TH2F("ESD_MotherEta_Pt_Alpha","ESD_MotherEta_Pt_Alpha",150,0.03,15.,100,0,1);
-                SetLogBinningXTH2(hESDMotherEtaPtAlpha[iCut]);
-                fESDList[iCut]->Add(hESDMotherEtaPtAlpha[iCut]);
-                hESDMotherPi0PtOpenAngle[iCut] = new TH2F("ESD_MotherPi0_Pt_OpenAngle","ESD_MotherPi0_Pt_OpenAngle",150,0.03,15.,100,0,TMath::Pi());
-                SetLogBinningXTH2(hESDMotherPi0PtOpenAngle[iCut]);
-                fESDList[iCut]->Add(hESDMotherPi0PtOpenAngle[iCut]);
-                hESDMotherEtaPtOpenAngle[iCut] = new TH2F("ESD_MotherEta_Pt_OpenAngle","ESD_MotherEta_Pt_OpenAngle",150,0.03,15.,100,0,TMath::Pi());
-                SetLogBinningXTH2(hESDMotherEtaPtOpenAngle[iCut]);
-                fESDList[iCut]->Add(hESDMotherEtaPtOpenAngle[iCut]);
-            }
-            
-            
-        }
-        
-        
-    }
+                       //          tESDConvGammaPtDcazCat[iCut]->Branch("R",&fRConvPhoton,"fRConvPhoton/F");
+                       //          tESDConvGammaPtDcazCat[iCut]->Branch("Eta",&fEtaPhoton,"fEtaPhoton/F");
+                       
+               //    tESDConvGammaPtDcazCat[iCut]->Branch("cat",&iCatPhoton,"iCatPhoton/b");
+
+       //        fPhotonDCAList[iCut]->Add(tESDConvGammaPtDcazCat[iCut]);
+               }
+               
+               if (fDoPhotonQA > 0){
+                       hESDConvGammaR[iCut] = new TH1F("ESD_ConvGamma_R","ESD_ConvGamma_R",800,0,200);
+                       fESDList[iCut]->Add(hESDConvGammaR[iCut]);
+                       hESDConvGammaEta[iCut] = new TH1F("ESD_ConvGamma_Eta","ESD_ConvGamma_Eta",2000,-2,2);
+                       fESDList[iCut]->Add(hESDConvGammaEta[iCut]);
+               }
+               
+               if(fDoMesonAnalysis){
+                       hESDMotherInvMassPt[iCut] = new TH2F("ESD_Mother_InvMass_Pt","ESD_Mother_InvMass_Pt",800,0,0.8,250,0,25);
+                       fESDList[iCut]->Add(hESDMotherInvMassPt[iCut]);
+                       hESDMotherBackInvMassPt[iCut] = new TH2F("ESD_Background_InvMass_Pt","ESD_Background_InvMass_Pt",800,0,0.8,250,0,25);
+                       fESDList[iCut]->Add(hESDMotherBackInvMassPt[iCut]);
+                       hESDMotherInvMassEalpha[iCut] = new TH2F("ESD_Mother_InvMass_vs_E_alpha","ESD_Mother_InvMass_vs_E_alpha",800,0,0.8,250,0,25);
+                       fESDList[iCut]->Add(hESDMotherInvMassEalpha[iCut]);
+                       if (fDoMesonQA == 2){
+                               fMesonDCAList[iCut] = new TList();
+                               fMesonDCAList[iCut]->SetName(Form("%s_%s_%s Meson DCA tree",cutstringEvent.Data() ,cutstringPhoton.Data(),cutstringMeson.Data()));
+                               fMesonDCAList[iCut]->SetOwner(kTRUE);
+                               fCutFolder[iCut]->Add(fMesonDCAList[iCut]);
+                               
+                               tESDMesonsInvMassPtDcazMinDcazMaxFlag[iCut] = new TTree("ESD_Mesons_InvMass_Pt_DcazMin_DcazMax_Flag","ESD_Mesons_InvMass_Pt_DcazMin_DcazMax_Flag");
+                               tESDMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("InvMass",&fInvMass,"fInvMass/F");
+                               tESDMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("Pt",&fPt,"fPt/F");
+                               tESDMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("DcaZMin",&fDCAzGammaMin,"fDCAzGammaMin/F");
+                               tESDMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("DcaZMax",&fDCAzGammaMax,"fDCAzGammaMax/F");
+                               
+                               fMesonDCAList[iCut]->Add(tESDMesonsInvMassPtDcazMinDcazMaxFlag[iCut]);
+                               
+                       }
+                       if (fDoMesonQA > 0 ){
+                               hESDMotherPi0PtY[iCut] = new TH2F("ESD_MotherPi0_Pt_Y","ESD_MotherPi0_Pt_Y",150,0.03,15.,150,-1.5,1.5);
+                               SetLogBinningXTH2(hESDMotherPi0PtY[iCut]);
+                               fESDList[iCut]->Add(hESDMotherPi0PtY[iCut]);
+                               hESDMotherEtaPtY[iCut] = new TH2F("ESD_MotherEta_Pt_Y","ESD_MotherEta_Pt_Y",150,0.03,15.,150,-1.5,1.5);
+                               SetLogBinningXTH2(hESDMotherEtaPtY[iCut]);
+                               fESDList[iCut]->Add(hESDMotherEtaPtY[iCut]);
+                               hESDMotherPi0PtAlpha[iCut] = new TH2F("ESD_MotherPi0_Pt_Alpha","ESD_MotherPi0_Pt_Alpha",150,0.03,15.,100,0,1);
+                               SetLogBinningXTH2(hESDMotherPi0PtAlpha[iCut]);
+                               fESDList[iCut]->Add(hESDMotherPi0PtAlpha[iCut]);
+                               hESDMotherEtaPtAlpha[iCut] = new TH2F("ESD_MotherEta_Pt_Alpha","ESD_MotherEta_Pt_Alpha",150,0.03,15.,100,0,1);
+                               SetLogBinningXTH2(hESDMotherEtaPtAlpha[iCut]);
+                               fESDList[iCut]->Add(hESDMotherEtaPtAlpha[iCut]);
+                               hESDMotherPi0PtOpenAngle[iCut] = new TH2F("ESD_MotherPi0_Pt_OpenAngle","ESD_MotherPi0_Pt_OpenAngle",150,0.03,15.,100,0,TMath::Pi());
+                               SetLogBinningXTH2(hESDMotherPi0PtOpenAngle[iCut]);
+                               fESDList[iCut]->Add(hESDMotherPi0PtOpenAngle[iCut]);
+                               hESDMotherEtaPtOpenAngle[iCut] = new TH2F("ESD_MotherEta_Pt_OpenAngle","ESD_MotherEta_Pt_OpenAngle",150,0.03,15.,100,0,TMath::Pi());
+                               SetLogBinningXTH2(hESDMotherEtaPtOpenAngle[iCut]);
+                               fESDList[iCut]->Add(hESDMotherEtaPtOpenAngle[iCut]);
+                       }
+                       
+                       
+               }
+               
+               
+       }
 //     if(fDoMesonAnalysis){
 //         InitBack(); // Init Background Handler
 //     }
-    
-
-    
-    fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask("V0ReaderV1");
-    if(!fV0Reader){printf("Error: No V0 Reader");return;} // GetV0Reader
-    
-    if(fV0Reader)
-        if((AliConvEventCuts*)fV0Reader->GetEventCuts())
-            if(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms())
-                fOutputContainer->Add(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms());
-    
-    if(fV0Reader)
-        if((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())
-            if(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms())
-                fOutputContainer->Add(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms());
-    
-    for(Int_t iCut = 0; iCut<fnCuts;iCut++){
-        if(!((AliConvEventCuts*)fEventCutArray->At(iCut))) continue;
-        if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms()){
-            fCutFolder[iCut]->Add(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms());
-        }
-        if(!((AliConversionPhotonCuts*)fCutArray->At(iCut))) continue;
-        if(((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutHistograms()){
-            fCutFolder[iCut]->Add(((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutHistograms());
-        }
-        if(fDoMesonAnalysis){
-            if(!((AliConversionMesonCuts*)fMesonCutArray->At(iCut))) continue;
-            if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms()){
-                fCutFolder[iCut]->Add(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms());
-            }
-        }
-    }
-    
-    PostData(1, fOutputContainer);
-
-    fCandidates = new TObjArray(10000);
-    fCandidates->SetOwner(kTRUE);
-    fFlowEvent = new AliFlowEvent(10000);
-    PostData(2, fFlowEvent);
-    
+       
+
+       
+       fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask("V0ReaderV1");
+       if(!fV0Reader){printf("Error: No V0 Reader");return;} // GetV0Reader
+       
+       if(fV0Reader)
+               if((AliConvEventCuts*)fV0Reader->GetEventCuts())
+                       if(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms())
+                               fOutputContainer->Add(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms());
+       
+       if(fV0Reader)
+               if((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())
+                       if(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms())
+                               fOutputContainer->Add(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms());
+       
+       for(Int_t iCut = 0; iCut<fnCuts;iCut++){
+               if(!((AliConvEventCuts*)fEventCutArray->At(iCut))) continue;
+               if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms()){
+                       fCutFolder[iCut]->Add(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms());
+               }
+               if(!((AliConversionPhotonCuts*)fCutArray->At(iCut))) continue;
+               if(((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutHistograms()){
+                       fCutFolder[iCut]->Add(((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutHistograms());
+               }
+               if(fDoMesonAnalysis){
+                       if(!((AliConversionMesonCuts*)fMesonCutArray->At(iCut))) continue;
+                       if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms()){
+                               fCutFolder[iCut]->Add(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms());
+                       }
+               }
+       }
+       
+       EPVZ = new TH1D("EPVZ", "EPVZ", 60, -TMath::Pi()/2, TMath::Pi()/2);
+    fOutputContainer->Add(EPVZ);
+
+
+       
+       PostData(1, fOutputContainer);
+
+       fFlowEvent = new AliFlowEvent(10000);
+       PostData(2, fFlowEvent);
+       
 }
+
 //_____________________________________________________________________________
 Bool_t AliAnalysisTaskGammaConvFlow::Notify()
 {
-    for(Int_t iCut = 0; iCut<fnCuts;iCut++){
-        if(!((AliConvEventCuts*)fEventCutArray->At(iCut))->GetDoEtaShift()){
-            hEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
-            continue; // No Eta Shift requested, continue
-        }
-        if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
-            ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCorrectEtaShiftFromPeriod(fV0Reader->GetPeriodName());
-            hEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
-            ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
-            continue;
-        }
-        else{
-            printf(" Gamma Conversion Task %s :: Eta Shift Manually Set to %f \n\n",
-                   (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber()).Data(),((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift());
-            hEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
-            ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
-        }
-    }
-    return kTRUE;
+       for(Int_t iCut = 0; iCut<fnCuts;iCut++){
+               if(!((AliConvEventCuts*)fEventCutArray->At(iCut))->GetDoEtaShift()){
+                       hEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
+                       continue; // No Eta Shift requested, continue
+               }
+               if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
+                       ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCorrectEtaShiftFromPeriod(fV0Reader->GetPeriodName());
+                       hEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
+                       ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
+                       continue;
+               }
+               else{
+                       printf(" Gamma Conversion Task %s :: Eta Shift Manually Set to %f \n\n",
+                               (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber()).Data(),((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift());
+                       hEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
+                       ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
+               }
+       }
+       return kTRUE;
 }
 //_____________________________________________________________________________
 void AliAnalysisTaskGammaConvFlow::UserExec(Option_t *)
 {
-    //
-    // Called for each event
-    //
-    Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
-    if(eventQuality == 2 || eventQuality == 3){// Event Not Accepted due to MC event missing or wrong trigger for V0ReaderV1
-        for(Int_t iCut = 0; iCut<fnCuts; iCut++){
-            hNEvents[iCut]->Fill(eventQuality);
-        }
-        return;
-    }
-    
-    fInputEvent = InputEvent();
-
-    fReaderGammas = fV0Reader->GetReconstructedGammas(); // Gammas from default Cut
-    
-    // ------------------- BeginEvent ----------------------------
-    
-    AliEventplane *EventPlane = fInputEvent->GetEventplane();
-    if(fIsHeavyIon ==1)fEventPlaneAngle = EventPlane->GetEventplane("V0",fInputEvent,2);
-    else fEventPlaneAngle=0.0;
-    
-   
-    for(Int_t iCut = 0; iCut<fnCuts; iCut++){
-        fiCut = iCut;
-        Int_t eventNotAccepted =
-        ((AliConvEventCuts*)fEventCutArray->At(iCut))
-        ->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon,kFALSE);
-        if(eventNotAccepted){
-            // cout << "event rejected due to wrong trigger: " <<eventNotAccepted << endl;
-            hNEvents[iCut]->Fill(eventNotAccepted); // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
-            continue;
-        }
-        
-        if(eventQuality != 0){// Event Not Accepted
-            // cout << "event rejected due to: " <<eventQuality << endl;
-            hNEvents[iCut]->Fill(eventQuality);
-            continue;
-        }
-        
-        //======================= FlowPackage Stuff ================================
-        fCandidates->SetLast(-1);
-        SetNullCuts(fInputEvent);
-        PrepareFlowEvent(fInputEvent->GetNumberOfTracks());    //Calculate event plane Qvector and EP resolution for inclusive
-        //==========================================================================
-        
-        hNEvents[iCut]->Fill(eventQuality); // Should be 0 here
-        hNGoodESDTracks[iCut]->Fill(fV0Reader->GetNumberOfPrimaryTracks());
-        if(((AliConvEventCuts*)fEventCutArray->At(iCut))->IsHeavyIon() == 2)   hNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A());
-        else hNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A()+fInputEvent->GetVZEROData()->GetMTotV0C());
-        
-        ProcessPhotonCandidates(); // Process this cuts gammas
-        ProcessPhotonCandidatesforV2(); // Process this cuts gammas and do v2 for gamma
-        hNGammaCandidates[iCut]->Fill(fGammaCandidates->GetEntries());
-        hNGoodESDTracksVsNGammaCanditates[iCut]->Fill(fV0Reader->GetNumberOfPrimaryTracks(),fGammaCandidates->GetEntries());
-
-        fGammaCandidates->Clear(); // delete this cuts good gammas
-    }
-    
-    
-    PostData(1, fOutputContainer);
-    PostData(2, fFlowEvent);
+       //
+       // Called for each event
+       //
+       Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
+       if(eventQuality == 2 || eventQuality == 3){// Event Not Accepted due to MC event missing or wrong trigger for V0ReaderV1
+               for(Int_t iCut = 0; iCut<fnCuts; iCut++){
+                       hNEvents[iCut]->Fill(eventQuality);
+               }
+               return;
+       }
+       
+       fInputEvent = InputEvent();
+
+       fReaderGammas = fV0Reader->GetReconstructedGammas(); // Gammas from default Cut
+       
+       // ------------------- BeginEvent ----------------------------
+       
+       AliEventplane *EventPlane = fInputEvent->GetEventplane();
+       if(fIsHeavyIon ==1)fEventPlaneAngle = EventPlane->GetEventplane("V0",fInputEvent,2);
+       else fEventPlaneAngle=0.0;
+       
+       SetNullCuts(fInputEvent);
+       PrepareFlowEvent(fInputEvent->GetNumberOfTracks(),fFlowEvent);    //Calculate event plane Qvector and EP resolution for inclusive
+
+       
+
+       
+//     for(Int_t iCut = 0; iCut<fnCuts; iCut++){
+               Int_t iCut = 0;
+               fiCut = iCut;
+               Int_t eventNotAccepted =
+               ((AliConvEventCuts*)fEventCutArray->At(iCut))
+               ->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon,kFALSE);
+               if(eventNotAccepted){
+                       // cout << "event rejected due to wrong trigger: " <<eventNotAccepted << endl;
+                       hNEvents[iCut]->Fill(eventNotAccepted); // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
+                       return;
+               }
+               
+               if(eventQuality != 0){// Event Not Accepted
+                       // cout << "event rejected due to: " <<eventQuality << endl;
+                       hNEvents[iCut]->Fill(eventQuality);
+                       return;
+               }
+                               
+               hNEvents[iCut]->Fill(eventQuality); // Should be 0 here
+               hNGoodESDTracks[iCut]->Fill(fV0Reader->GetNumberOfPrimaryTracks());
+               if(((AliConvEventCuts*)fEventCutArray->At(iCut))->IsHeavyIon() == 2)    hNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A());
+               else hNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A()+fInputEvent->GetVZEROData()->GetMTotV0C());
+               
+               ProcessPhotonCandidates(); // Process this cuts gammas
+               ProcessPhotonCandidatesforV2(); // Process this cuts gammas and do v2
+
+               hNGammaCandidates[iCut]->Fill(fGammaCandidates->GetEntries());
+               hNGoodESDTracksVsNGammaCanditates[iCut]->Fill(fV0Reader->GetNumberOfPrimaryTracks(),fGammaCandidates->GetEntries());
+
+               fGammaCandidates->Clear(); // delete this cuts good gammas
+//     }
+       
+       EPVZ->Fill(fEventPlaneAngle);
+
+       PostData(1, fOutputContainer);
+       PostData(2, fFlowEvent);
 
 }
 //________________________________________________________________________
@@ -855,106 +783,65 @@ void AliAnalysisTaskGammaConvFlow::Terminate(const Option_t *)
 }
 
 //________________________________________________________________________
-//============================= FROM HERE FLOW METHODS============================================================================
 void AliAnalysisTaskGammaConvFlow::ProcessPhotonCandidatesforV2()
 {
-   
-    // Loop over Photon Candidates allocated by ReaderV1
-    
-    
-    for(Int_t i = 0; i < fGammaCandidates->GetEntries(); i++){
-        
-//        AliAODTrack* un[unTracks];
-//        AliAODTrack* up[unTracks];
-//        Int_t unp(0);
-//        Int_t unn(0);
-//        Int_t nIDs[2];
-//        nIDs[0] = up[pTracks]->GetID();
-//        nIDs[1] = un[nTracks]->GetID();
-    
-        //fGammaCandidates->
-        AliAODConversionPhoton *gammaForv2=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(i));
-        if (gammaForv2==NULL) continue;
-
-        
-        
-        MakeTrack(gammaForv2->GetPhotonMass(), gammaForv2->Pt(), gammaForv2->GetPhotonPhi(), gammaForv2->GetPhotonEta()/*, 2, nIDs*/);
-        
-        for (int iCand = 0; iCand != fCandidates->GetEntriesFast(); ++iCand) {
-            AliFlowCandidateTrack *cand = dynamic_cast<AliFlowCandidateTrack*>(fCandidates->At(iCand));
-            if (!cand) continue;
-         //   if (fDebug > 1) printf(" --> Checking at candidate %d with %d daughters: mass %f\n", iCand, cand->GetNDaughters(), cand->Mass());
-       /*     for (int iDau = 0; iDau != cand->GetNDaughters(); ++iDau) {
-                if (fDebug>1) printf("     *** Daughter %d with fID %d ***", iDau, cand->GetIDDaughter(iDau));
-                for (int iRPs = 0; iRPs != fFlowEvent->NumberOfTracks(); ++iRPs) {
-                    AliFlowTrack *iRP = dynamic_cast<AliFlowTrack*>(fFlowEvent->GetTrack(iRPs));
-                    if (!iRP) continue;
-                    if (!iRP->InRPSelection()) continue;
-                    if (cand->GetIDDaughter(iDau) == iRP->GetID()) {
-                        if (fDebug > 1) printf("      was in RP set");
-                        iRP->SetForRPSelection(kFALSE);
-                        fFlowEvent->SetNumberOfRPs(fFlowEvent->GetNumberOfRPs() - 1);
-                    }
-                }
-                if (fDebug > 1) printf("\n");
-            }*/
-            cand->SetForPOISelection(kTRUE);
-            fFlowEvent->InsertTrack(((AliFlowTrack*) cand));
-        }
-        
-
-    
-    
-    }// end loop on photon
 
+       // Loop over Photon Candidates allocated by ReaderV1
+       
+       
+       for(Int_t i = 0; i < fGammaCandidates->GetEntries(); i++){
+               
+               AliAODConversionPhoton *gammaForv2=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(i));
+
+               AliFlowTrack *sTrack = new AliFlowTrack();
+               sTrack->SetForRPSelection(kFALSE);
+               sTrack->SetForPOISelection(kTRUE);
+               sTrack->SetMass(263732);
+               sTrack->SetPt(gammaForv2->Pt());
+               sTrack->SetPhi(gammaForv2->GetPhotonPhi());
+               sTrack->SetEta(gammaForv2->GetPhotonEta());
+
+       /*     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);
+       }
 }
-//========================================================================================================================
-//______________________________________________________________________________
-void  AliAnalysisTaskGammaConvFlow::MakeTrack(Double_t mass, Double_t pt, Double_t phi, Double_t eta/*, Int_t nDau, Int_t iID[]*/) const
-{
-    // Construct Flow Candidate Track from two selected candidates
-    if(fDebug > 1 ) cout << " *** MakeTrack() *** " << endl;
-    Bool_t overwrite = kTRUE;
-    AliFlowCandidateTrack *sTrack = static_cast<AliFlowCandidateTrack*>(fCandidates->At(fCandidates->GetLast() + 1));
-    if (!sTrack) {
-        sTrack = new AliFlowCandidateTrack(); //deleted by fCandidates
-        overwrite = kFALSE;
-    }
-    else sTrack->ClearMe();
-    sTrack->SetMass(mass);
-    sTrack->SetPt(pt);
-    sTrack->SetPhi(phi);
-    sTrack->SetEta(eta);
-  //  for (Int_t iDau = 0; iDau != nDau; ++iDau) sTrack->AddDaughter(iID[iDau]);
-    sTrack->SetForPOISelection(kTRUE);
-    sTrack->SetForRPSelection(kFALSE);
-    if (overwrite) fCandidates->SetLast(fCandidates->GetLast() + 1);
-    else fCandidates->AddLast(sTrack);
-    return;
-}
-//_____________________________________________________________________________
+
 //_____________________________________________________________________________
 template <typename T> void AliAnalysisTaskGammaConvFlow::SetNullCuts(T* event)
 {
-    // Set null cuts
-    if (fDebug > 0) cout << " *** SetNullCuts() *** " << 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());
+       // 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 AliAnalysisTaskGammaConvFlow::PrepareFlowEvent(Int_t iMulti) const
+void AliAnalysisTaskGammaConvFlow::PrepareFlowEvent(Int_t iMulti, AliFlowEvent *FlowEv) const
 {
-    // Prepare flow events
-    if (fDebug > 0 ) cout << " *** PrepareFlowEvent() *** " << endl;
-    fFlowEvent->ClearFast();
-    fFlowEvent->Fill(fCutsRP, fNullCuts);
-    fFlowEvent->SetReferenceMultiplicity(iMulti);
-    //fFlowEvent->DefineDeadZone(0, 0, 0, 0);
+   //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);
 }
-//_____________________________________________________________________________
 
 
 
index 40dc8bd..b5bf814 100644 (file)
@@ -33,7 +33,6 @@ public:
     virtual Bool_t Notify();
     virtual void   UserExec(Option_t *);
     virtual void   Terminate(const Option_t*);
-//     void InitBack();
     
     void SetIsHeavyIon(Int_t flag){
         fIsHeavyIon = flag;
@@ -75,123 +74,116 @@ public:
   //  Int_t GetSourceClassification(Int_t daughter, Int_t pdgCode);
     
     
-    //=========================================Flow Staff=========================================================================================
-    template <typename T> void           SetNullCuts(T* esd);
-    void                                 PrepareFlowEvent(Int_t iMulti) const;
+    template <typename T> void           SetNullCuts(T* aod);
+    void                                 PrepareFlowEvent(Int_t iMulti, AliFlowEvent *FlowEv) const;
     void                                 SetRPCuts(AliFlowTrackCuts *cutsRP) { fCutsRP = cutsRP; }
     void                                 ProcessPhotonCandidatesforV2();
-    void                                 MakeTrack(Double_t mass, Double_t pt, Double_t phi, Double_t eta/*, Int_t nDau, Int_t iID[]*/) const;
-    //=========================================ENd Flow Staff=========================================================================================
     
     
 protected:
-    AliV0ReaderV1                                              *fV0Reader;                                                                                     //
-    AliGammaConversionAODBGHandler             **fBGHandler;                                                                           //
-    AliConversionAODBGHandlerRP                **fBGHandlerRP;                                                                         //
-    AliVEvent                                                  *fInputEvent;                                                                           //
+       AliV0ReaderV1                                           *fV0Reader;                                                                                     //
+       AliGammaConversionAODBGHandler          **fBGHandler;                                                                           //
+       AliConversionAODBGHandlerRP             **fBGHandlerRP;                                                                         //
+       AliVEvent                                                       *fInputEvent;                                                                           //
 //    AliMCEvent                                                       *fMCEvent;                                                                                      //
 //    AliStack                                                         *fMCStack;                                                                                      //
-    TList                                                              **fCutFolder;                                                                           //
-    TList                                                              **fESDList;                                                                                     //
-    TList                                                              **fBackList;                                                                            //
-    TList                                                              **fMotherList;                                                                          //
-    TList                                                              **fPhotonDCAList;                                                                       //
-    TList                                                              **fMesonDCAList;                                                                        //
- //   TList                                                            **fTrueList;                                                                            //
- //   TList                                                            **fMCList;                                                                                      //
-    TList                                                              **fHeaderNameList;                                                                      //
-    TList                                                              *fOutputContainer;                                                                      //
-    TClonesArray                                               *fReaderGammas;                                                                         //
-    TList                                                              *fGammaCandidates;                                                                      //
-    TList                                                              *fEventCutArray;                                                                        //
-    AliConvEventCuts                                   *fEventCuts;                                                                            //
-    TList                                                              *fCutArray;                                                                                     //
-    AliConversionPhotonCuts                    *fConversionCuts;                                                                       //
-    TList                                                              *fMesonCutArray;                                                                        //
-    AliConversionMesonCuts                             *fMesonCuts;                                                                            //
-    TH1F                                                               **hESDConvGammaPt;                                                                      //
-    TH1F                                                               **hESDConvGammaR;                                                                       //
-    TH1F                                                               **hESDConvGammaEta;                                                                     //
-  //  TTree                                                            **tESDConvGammaPtDcazCat;                                                       //
-    Float_t                                                    fPtGamma;                                                                                       //
-    Float_t                                                    fDCAzPhoton;                                                                            //
-    Float_t                                                    fRConvPhoton;                                                                           //
-    Float_t                                                    fEtaPhoton;                                                                                     //
-    UChar_t                                                    iCatPhoton;                                                                                     //
-    UChar_t                                                    iPhotonMCInfo;                                                                          //
-    // 0: garbage,
-    // 1: background
-    // 2: secondary photon not from eta or k0s,
-    // 3: secondary photon from eta,
-    // 4: secondary photon from k0s,
-    // 5: dalitz
-    // 6: primary gamma
-    TH2F                                                               **hESDMotherInvMassPt;                                                          //
-  //  THnSparseF                                                       **sESDMotherInvMassPtZM;                                                        //
-    TH2F                                                               **hESDMotherBackInvMassPt;                                                      //
-  //  THnSparseF                                                       **sESDMotherBackInvMassPtZM;                                            //
-    TH2F                                                               **hESDMotherInvMassEalpha;                                                      //
-    TH2F                                                               **hESDMotherPi0PtY;                                                                     //
-    TH2F                                                               **hESDMotherEtaPtY;                                                                     //
-    TH2F                                                               **hESDMotherPi0PtAlpha;                                                         //
-    TH2F                                                               **hESDMotherEtaPtAlpha;                                                         //
-    TH2F                                                               **hESDMotherPi0PtOpenAngle;                                                     //
-    TH2F                                                               **hESDMotherEtaPtOpenAngle;                                                     //
+       TList                                                           **fCutFolder;                                                                           //
+       TList                                                           **fESDList;                                                                                     //
+       TList                                                           **fBackList;                                                                            //
+       TList                                                           **fMotherList;                                                                          //
+       TList                                                           **fPhotonDCAList;                                                                       //
+       TList                                                           **fMesonDCAList;                                                                        //
+//   TList                                                             **fTrueList;                                                                            //
+//   TList                                                             **fMCList;                                                                                      //
+       TList                                                           **fHeaderNameList;                                                                      //
+       TList                                                           *fOutputContainer;                                                                      //
+       TClonesArray                                            *fReaderGammas;                                                                         //
+       TList                                                           *fGammaCandidates;                                                                      //
+       TList                                                           *fEventCutArray;                                                                        //
+       AliConvEventCuts                                        *fEventCuts;                                                                            //
+       TList                                                           *fCutArray;                                                                                     //
+       AliConversionPhotonCuts                         *fConversionCuts;                                                                       //
+       TList                                                           *fMesonCutArray;                                                                        //
+       AliConversionMesonCuts                          *fMesonCuts;                                                                            //
+       TH1F                                                            **hESDConvGammaPt;                                                                      //
+       TH1F                                                            **hESDConvGammaR;                                                                       //
+       TH1F                                                            **hESDConvGammaEta;                                                                     //
+       Float_t                                                         fPtGamma;                                                                                       //
+       Float_t                                                         fDCAzPhoton;                                                                            //
+       Float_t                                                         fRConvPhoton;                                                                           //
+       Float_t                                                         fEtaPhoton;                                                                                     //
+       UChar_t                                                         iCatPhoton;                                                                                     //
+       UChar_t                                                         iPhotonMCInfo;                                                                          //
+       // 0: garbage,
+       // 1: background
+       // 2: secondary photon not from eta or k0s,
+       // 3: secondary photon from eta,
+       // 4: secondary photon from k0s,
+       // 5: dalitz
+       // 6: primary gamma
+       TH2F                                                            **hESDMotherInvMassPt;                                                          //
+//  THnSparseF                                                         **sESDMotherInvMassPtZM;                                                        //
+       TH2F                                                            **hESDMotherBackInvMassPt;                                                      //
+//  THnSparseF                                                         **sESDMotherBackInvMassPtZM;                                            //
+       TH2F                                                            **hESDMotherInvMassEalpha;                                                      //
+       TH2F                                                            **hESDMotherPi0PtY;                                                                     //
+       TH2F                                                            **hESDMotherEtaPtY;                                                                     //
+       TH2F                                                            **hESDMotherPi0PtAlpha;                                                         //
+       TH2F                                                            **hESDMotherEtaPtAlpha;                                                         //
+       TH2F                                                            **hESDMotherPi0PtOpenAngle;                                                     //
+       TH2F                                                            **hESDMotherEtaPtOpenAngle;                                                     //
+
+       TH1I                                                            **hNEvents;                                                                                     //
+       TH1I                                                            **hNGoodESDTracks;                                                                      //
+       TH1I                                                            **hNGammaCandidates;                                                            //
+       TH2F                                                            **hNGoodESDTracksVsNGammaCanditates;                            //
+       TH1I                                                            **hNV0Tracks;                                                                           //
+       TProfile                                                        **hEtaShift;                                                                            //
+       TTree                                                           **tESDMesonsInvMassPtDcazMinDcazMaxFlag;                        //
+       Float_t                                                         fInvMass;                                                                                       //
+       Float_t                                                         fPt;                                                                                            //
+       Float_t                                                         fDCAzGammaMin;                                                                          //
+       Float_t                                                         fDCAzGammaMax;                                                                          //
+       UChar_t                                                         iFlag;                                                                                          //
+       UChar_t                                                         iMesonMCInfo;                                                                           //
+       // 0: garbage,
+       // 1: background
+       // 2: secondary meson not from eta or k0s,
+       // 3: secondary meson from eta,
+       // 4: secondary meson from k0s,
+       // 5: dalitz
+       // 6: primary meson gamma-gamma-channel
+       Double_t                                                        fEventPlaneAngle;                                                                       // EventPlaneAngle
+       TRandom3                                                        fRandom;                                                                                        //
+       Int_t                                                           fnGammaCandidates;                                                                      //
+       Double_t                                                        *fUnsmearedPx;                                                                          //[fnGammaCandidates]
+       Double_t                                                        *fUnsmearedPy;                                                                          //[fnGammaCandidates]
+       Double_t                                                        *fUnsmearedPz;                                                                          //[fnGammaCandidates]
+       Double_t                                                        *fUnsmearedE;                                                                           //[fnGammaCandidates]
+       Int_t                                                           *fMCStackPos;                                                                           //[fnGammaCandidates]
+       Int_t                                                           *fMCStackNeg;                                                                           //[fnGammaCandidates]
+       Int_t                                                           *fESDArrayPos;                                                                          //[fnGammaCandidates]
+       Int_t                                                           *fESDArrayNeg;                                                                          //[fnGammaCandidates]
+       Int_t                                                           fnCuts;                                                                                         //
+       Int_t                                                           fiCut;                                                                                          //
+       Bool_t                                                          fMoveParticleAccordingToVertex;                                         //
+       Int_t                                                           fIsHeavyIon;                                                                            //
+       Bool_t                                                          fDoMesonAnalysis;                                                                       //
+       Int_t                                                           fDoMesonQA;                                                                                     //
+       Int_t                                                           fDoPhotonQA;                                                                            //
+       Bool_t                                                          fIsFromMBHeader;                                                                        //
+       TH1D                                    *EPVZ;                                                                                          //!
 
-    TH1I                                                               **hNEvents;                                                                                     //
-    TH1I                                                               **hNGoodESDTracks;                                                                      //
-    TH1I                                                               **hNGammaCandidates;                                                            //
-    TH2F                                                               **hNGoodESDTracksVsNGammaCanditates;                            //
-    TH1I                                                               **hNV0Tracks;                                                                           //
-    TProfile                                                   **hEtaShift;                                                                            //
-    TTree                                                              **tESDMesonsInvMassPtDcazMinDcazMaxFlag;                        //
-    Float_t                                                    fInvMass;                                                                                       //
-    Float_t                                                    fPt;                                                                                            //
-    Float_t                                                    fDCAzGammaMin;                                                                          //
-    Float_t                                                    fDCAzGammaMax;                                                                          //
-    UChar_t                                                    iFlag;                                                                                          //
-    UChar_t                                                    iMesonMCInfo;                                                                           //
-    // 0: garbage,
-    // 1: background
-    // 2: secondary meson not from eta or k0s,
-    // 3: secondary meson from eta,
-    // 4: secondary meson from k0s,
-    // 5: dalitz
-    // 6: primary meson gamma-gamma-channel
-    Double_t                                                   fEventPlaneAngle;                                                                       // EventPlaneAngle
-    TRandom3                                                   fRandom;                                                                                        //
-    Int_t                                                              fnGammaCandidates;                                                                      //
-    Double_t                                                   *fUnsmearedPx;                                                                          //[fnGammaCandidates]
-    Double_t                                                   *fUnsmearedPy;                                                                          //[fnGammaCandidates]
-    Double_t                                                   *fUnsmearedPz;                                                                          //[fnGammaCandidates]
-    Double_t                                                   *fUnsmearedE;                                                                           //[fnGammaCandidates]
-    Int_t                                                              *fMCStackPos;                                                                           //[fnGammaCandidates]
-    Int_t                                                              *fMCStackNeg;                                                                           //[fnGammaCandidates]
-    Int_t                                                              *fESDArrayPos;                                                                          //[fnGammaCandidates]
-    Int_t                                                              *fESDArrayNeg;                                                                          //[fnGammaCandidates]
-    Int_t                                                              fnCuts;                                                                                         //
-    Int_t                                                              fiCut;                                                                                          //
-    Bool_t                                                             fMoveParticleAccordingToVertex;                                         //
-    Int_t                                                              fIsHeavyIon;                                                                            //
-    Bool_t                                                             fDoMesonAnalysis;                                                                       //
-    Int_t                                                              fDoMesonQA;                                                                                     //
-    Int_t                                                              fDoPhotonQA;                                                                            //
-    Bool_t                                                             fIsFromMBHeader;                                                                        //
     
 private:
-    TObjArray            *fCandidates; // candidate array
-    Int_t                fDebug; // debug level (0 none, 1 fcn calls, 2 verbose)
-    AliFlowTrackCuts     *fCutsRP; // track cuts for reference particles
-    AliFlowTrackCuts     *fNullCuts; // dummy cuts for flow event tracks
-    AliFlowEvent         *fFlowEvent; //! flow events
+       Bool_t               fDebug; //! enable debug mode
+       AliFlowTrackCuts     *fCutsRP; // track cuts for reference particles
+       AliFlowTrackCuts     *fNullCuts; // dummy cuts for flow event tracks
+       AliFlowEvent         *fFlowEvent; //! flow events Inclusive e
 
-    
-    
-    
-    
-    AliAnalysisTaskGammaConvFlow(const AliAnalysisTaskGammaConvFlow&); // Prevent copy-construction
-    AliAnalysisTaskGammaConvFlow &operator=(const AliAnalysisTaskGammaConvFlow&); // Prevent assignment
-    ClassDef(AliAnalysisTaskGammaConvFlow, 2);
+       AliAnalysisTaskGammaConvFlow(const AliAnalysisTaskGammaConvFlow&); // Prevent copy-construction
+       AliAnalysisTaskGammaConvFlow &operator=(const AliAnalysisTaskGammaConvFlow&); // Prevent assignment
+       ClassDef(AliAnalysisTaskGammaConvFlow, 2);
 };
 
 #endif
index ff6784b..d2c7283 100644 (file)
@@ -1,54 +1,15 @@
+/////////////////////////////////////////////////////////////////////////////////////////////
+//
+// AddTaskGammaConvFlow_PbPb2 macro
+// Author: Andrea Dubla, Redmer A. Bertens, Friederike Bock
+//         Commented where necessary
+/////////////////////////////////////////////////////////////////////////////////////////////
+
 class AliAnalysisDataContainer;
 class AliFlowTrackCuts;
 class AliFlowTrackSimpleCuts;
 class AliFlowEventCuts;
 class AliFlowEventSimpleCuts;
-class AliAnalysisDataContainer;
-
-
-
-//===================from here Flow pakage================
-void AddSPmethod(char *name, char *Qvector, int harmonic, AliAnalysisDataContainer *flowEvent,  bool shrink = false, bool debug, TString uniqueID,/*Bool_t VZERO_SP = kFALSE,*/  AliFlowTrackSimpleCuts* POIfilter, int trainConfig)
-{
-    // add sp task and invm filter tasks
-    if(debug) (bEP) ? cout << " ****** Reveived request for EP task ****** " << endl : cout << " ******* Switching to SP task ******* " << endl;
-    TString fileName = Form("GammaConvFlow_%i.root:SP_V0",trainConfig);
-    //    (bEP) ? fileName+=":EP_tpctof" : fileName+=":SP_tpctof";
-    //          if(etagap) {
-    //            fileName+="_SUBEVENTS";
-    //          if(debug) cout << "    --> Setting up subevent analysis <-- " << endl;
-    //    }
-    if(debug) cout << "    --> fileName " << fileName << endl;
-    TString myFolder = fileName;
-    if(debug) cout << "    --> myFolder " << myFolder << endl;
-    TString myNameSP;
-    //(bEP) ? myNameSP = Form("%sEPv%d%s", name, harmonic, Qvector): myNameSP = Form("%sSPv%d%s", name, harmonic, Qvector);
-    myNameSP = Form("%sSPv%d%s", name, harmonic, Qvector);
-    
-    if(debug) cout << " myNameSP " << myNameSP << endl;
-    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
-    AliAnalysisDataContainer *flowEventOut = mgr->CreateContainer(Form("Filter_%s",myNameSP.Data()),AliFlowEventSimple::Class(),AliAnalysisManager::kExchangeContainer);
-    AliAnalysisTaskFilterFE *tskFilter = new AliAnalysisTaskFilterFE(Form("TaskFilter_%s", myNameSP.Data()), NULL, POIfilter);
-    //  tskFilter->SetSubeventEtaRange(minEtaA, maxEtaA, minEtaB, maxEtaB);
-    //if(VZERO_SP) tskFilter->SetSubeventEtaRange(-10, 0, 0, 10);
-    tskFilter->SetSubeventEtaRange(-10, -1, 1, 10);
-    mgr->AddTask(tskFilter);
-    mgr->ConnectInput(tskFilter, 0, flowEvent);
-    mgr->ConnectOutput(tskFilter, 1, flowEventOut);
-    AliAnalysisDataContainer *outSP = mgr->CreateContainer(myNameSP.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, fileName);
-    AliAnalysisTaskScalarProduct *tskSP = new AliAnalysisTaskScalarProduct(Form("TaskScalarProduct_%s", myNameSP.Data()), kFALSE);
-    tskSP->SetApplyCorrectionForNUA(kTRUE);
-    tskSP->SetHarmonic(harmonic);
-    tskSP->SetTotalQvector(Qvector);
-    // if (bEP) tskSP->SetBehaveAsEP();
-    if (shrink) tskSP->SetBookOnlyBasicCCH(kTRUE);
-    mgr->AddTask(tskSP);
-    mgr->ConnectInput(tskSP, 0, flowEventOut);
-    mgr->ConnectOutput(tskSP, 1, outSP);
-}
-//_____________________________________________________________________________
-
-
 
 void AddTask_GammaConvFlow_PbPb2(
                                TString uniqueID = "",
@@ -60,7 +21,7 @@ void AddTask_GammaConvFlow_PbPb2(
                                //TString fileNameInputForWeighting = "MCSpectraInput.root", // path to file for weigting input
                                Bool_t doWeighting = kFALSE,  //enable Weighting
                                TString cutnumberAODBranch = "1000000060084000001500000",
-                               Bool_t shrinkSP = kTRUE,
+                               Bool_t BasicHistoSP = kFALSE,
                                Bool_t debug = kFALSE
                                ) {
     
@@ -159,13 +120,10 @@ void AddTask_GammaConvFlow_PbPb2(
     //========= Add task to the ANALYSIS manager =====
     //================================================
     AliAnalysisTaskGammaConvFlow *task=NULL;
-    task= new AliAnalysisTaskGammaConvFlow(Form("GammaConvV1_%i",trainConfig));
+    task= new AliAnalysisTaskGammaConvFlow(Form("GammaConvV1_%i_v%d",trainConfig,harmonic));
     task->SetIsHeavyIon(isHeavyIon);
     //task->SetIsMC(isMC);
     
-    
-//=====================from here call/book the flow package stuff==============
-    //set RP cuts for flow package analysis
     cutsRP = new AliFlowTrackCuts(Form("RFPcuts%s",uniqueID));
     if(!cutsRP) {
         if(debug) cout << " Fatal error: no RP cuts found, could be a library problem! " << endl;
@@ -174,30 +132,22 @@ void AddTask_GammaConvFlow_PbPb2(
     cutsRP = cutsRP->GetStandardVZEROOnlyTrackCuts(); // select vzero tracks
     cutsRP->SetVZEROgainEqualizationPerRing(kFALSE);
     cutsRP->SetApplyRecentering(kTRUE);
-    if(debug) cout << "    --> VZERO RP's " << cutsRP << endl;
     
     task->SetRPCuts(cutsRP);
     
     AliFlowTrackSimpleCuts *POIfilterVZERO = new AliFlowTrackSimpleCuts();
     POIfilterVZERO->SetEtaMin(-0.8);
     POIfilterVZERO->SetEtaMax(0.8);
-    //  POIfilterVZERO->SetMassMin(263731); POIfilterVZERO->SetMassMax(263733);
-    
+    POIfilterVZERO->SetMassMin(263731); POIfilterVZERO->SetMassMax(263733);
     
     if(debug) cout << " === RECEIVED REQUEST FOR FLOW ANALYSIS === " << endl;
     AliAnalysisDataContainer *flowEvent = mgr->CreateContainer(Form("FlowContainer_%s",uniqueID.Data()), AliFlowEventSimple::Class(), AliAnalysisManager::kExchangeContainer);
     mgr->ConnectOutput(task, 2, flowEvent);
     if(debug) cout << "    --> Created IO containers " << flowEvent << endl;
-    
-    AddSPmethod(Form("SPVZEROQa_in_%s", uniqueID.Data()), "Qa", harmonic, flowEvent, shrinkSP, debug, uniqueID, POIfilterVZERO, trainConfig);
+    AddSPmethod(Form("SPVZEROQa_in_%s", uniqueID.Data()), "Qa", harmonic, flowEvent, debug,uniqueID, POIfilterVZERO, trainConfig,BasicHistoSP);
     if(debug) cout << "    --> Hanging SP Qa task ... succes!" << endl;
-    AddSPmethod(Form("SPVZEROQb_in_%s", uniqueID.Data()), "Qb", harmonic, flowEvent, shrinkSP, debug, uniqueID, POIfilterVZERO, trainConfig);
+    AddSPmethod(Form("SPVZEROQb_in_%s", uniqueID.Data()), "Qb", harmonic, flowEvent, debug,uniqueID, POIfilterVZERO, trainConfig,BasicHistoSP);
     if(debug) cout << "    --> Hanging SP Qb task ... succes!"<< endl;
-//================================END flow stuff===========================================
-    
-    
-    
-    
     
     
     // Cut Numbers to use in Analysis
@@ -330,9 +280,9 @@ void AddTask_GammaConvFlow_PbPb2(
     
     //connect containers
     AliAnalysisDataContainer *coutput =
-    mgr->CreateContainer(Form("GammaConvV1_%i",trainConfig), TList::Class(),
+       mgr->CreateContainer(Form("GammaConvV1_%i_v%d",trainConfig,harmonic), TList::Class(),
                          AliAnalysisManager::kOutputContainer,Form("GammaConvFlow_%i.root",trainConfig));
-    
+        
     mgr->AddTask(task);
     mgr->ConnectInput(task,0,cinput);
     mgr->ConnectOutput(task,1,coutput);
@@ -341,5 +291,40 @@ void AddTask_GammaConvFlow_PbPb2(
     
 }
 
+//_____________________________________________________________________________
+void AddSPmethod(char *name, char *Qvector, int harmonic, AliAnalysisDataContainer *flowEvent, bool debug, TString uniqueID,  AliFlowTrackSimpleCuts* POIfilter,Int_t trainConfig, bool BasicHistoSP = kTRUE)
+{
+    // add sp task and invm filter tasks
+    if(debug)  cout << " ******* Switching to SP task ******* " << endl;
+    TString fileName = Form("GammaConvFlow_%i.root:SP_V0",trainConfig);
+    if(debug) cout << "    --> fileName " << fileName << endl;
+    TString myFolder = fileName;
+    if(debug) cout << "    --> myFolder " << myFolder << endl;
+    TString myNameSP;
+    myNameSP = Form("%sSPv%d%s", name, harmonic, Qvector);
+    if(debug) cout << " myNameSP " << myNameSP << endl;
+    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+    AliAnalysisDataContainer *flowEventOut = mgr->CreateContainer(Form("Filter_%s",myNameSP.Data()),AliFlowEventSimple::Class(),AliAnalysisManager::kExchangeContainer);
+    AliAnalysisTaskFilterFE *tskFilter = new AliAnalysisTaskFilterFE(Form("TaskFilter_%s", myNameSP.Data()), NULL, POIfilter);
+   // tskFilter->SetSubeventEtaRange(minEtaA, maxEtaA, minEtaB, maxEtaB);
+    tskFilter->SetSubeventEtaRange(-10, -1, 1, 10);
+    mgr->AddTask(tskFilter);
+    mgr->ConnectInput(tskFilter, 0, flowEvent);
+    mgr->ConnectOutput(tskFilter, 1, flowEventOut);
+    AliAnalysisDataContainer *outSP = mgr->CreateContainer(myNameSP.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, fileName);
+    AliAnalysisTaskScalarProduct *tskSP = new AliAnalysisTaskScalarProduct(Form("TaskScalarProduct_%s", myNameSP.Data()), kFALSE);
+    tskSP->SetApplyCorrectionForNUA(kTRUE);
+    tskSP->SetHarmonic(harmonic);
+    tskSP->SetTotalQvector(Qvector);
+    //if (bEP) tskSP->SetBehaveAsEP();
+    tskSP->SetBookOnlyBasicCCH(BasicHistoSP);
+    mgr->AddTask(tskSP);
+    mgr->ConnectInput(tskSP, 0, flowEventOut);
+    mgr->ConnectOutput(tskSP, 1, outSP);
+}
+//_____________________________________________________________________________
+
+
+