]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Moving gamma jet ana to separate folder. Addding several ana processors.
authorslindal <slindal@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 15 Mar 2011 15:37:40 +0000 (15:37 +0000)
committerslindal <slindal@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 15 Mar 2011 15:37:40 +0000 (15:37 +0000)
18 files changed:
PWG4/CMakelibPWG4GammaConv.pkg
PWG4/GammaConv/AliAnalysisTaskGCPartToPWG4Part.h
PWG4/GammaConv/AliAnalysisTaskGammaJet.cxx [deleted file]
PWG4/GammaConv/AliAnalysisTaskGammaJet.h [deleted file]
PWG4/GammaConv/ConvCorrelations/AliAnaConvCorrBase.cxx [new file with mode: 0644]
PWG4/GammaConv/ConvCorrelations/AliAnaConvCorrBase.h [new file with mode: 0644]
PWG4/GammaConv/ConvCorrelations/AliAnaConvCorrPhoton.cxx [new file with mode: 0644]
PWG4/GammaConv/ConvCorrelations/AliAnaConvCorrPhoton.h [new file with mode: 0644]
PWG4/GammaConv/ConvCorrelations/AliAnaConvCorrPhotonJet.cxx [new file with mode: 0644]
PWG4/GammaConv/ConvCorrelations/AliAnaConvCorrPhotonJet.h [new file with mode: 0644]
PWG4/GammaConv/ConvCorrelations/AliAnaConvCorrPion.cxx [new file with mode: 0644]
PWG4/GammaConv/ConvCorrelations/AliAnaConvCorrPion.h [new file with mode: 0644]
PWG4/GammaConv/ConvCorrelations/AliAnaConvIsolation.cxx [new file with mode: 0644]
PWG4/GammaConv/ConvCorrelations/AliAnaConvIsolation.h [new file with mode: 0644]
PWG4/GammaConv/ConvCorrelations/AliAnalysisTaskGammaJet.cxx [new file with mode: 0644]
PWG4/GammaConv/ConvCorrelations/AliAnalysisTaskGammaJet.h [new file with mode: 0644]
PWG4/GammaConv/ConvCorrelations/macros/ConfigGammaJet.C [new file with mode: 0644]
PWG4/PWG4GammaConvLinkDef.h

index 64fbb3cdb141e410210e23bdd769bb9f5fad14dc..8aab4978fa1ade7adb709a88a53182d4a19e68aa 100644 (file)
 # SHLIBS - Shared Libraries and objects for linking (Executables only)           #
 #--------------------------------------------------------------------------------#
 
-set ( SRCS  GammaConv/AliV0Reader.cxx  GammaConv/AliAnalysisTaskGammaConversion.cxx GammaConv/AliGammaConversionHistograms.cxx GammaConv/AliGammaConversionAODObject.cxx GammaConv/AliAODConversionParticle.cxx GammaConv/AliGammaConversionBGHandler.cxx GammaConv/AliAnalysisTaskCaloConv.cxx GammaConv/AliAnalysisTaskGammaJet.cxx GammaConv/AliAnalysisTaskGammaConvDalitz.cxx GammaConv/AliAnalysisTaskGCPartToPWG4Part.cxx )
+set ( SRCS  GammaConv/AliV0Reader.cxx  
+    GammaConv/AliAnalysisTaskGammaConversion.cxx 
+    GammaConv/AliGammaConversionHistograms.cxx 
+    GammaConv/AliGammaConversionAODObject.cxx 
+    GammaConv/AliAODConversionParticle.cxx 
+    GammaConv/AliGammaConversionBGHandler.cxx 
+    GammaConv/AliAnalysisTaskCaloConv.cxx 
+    GammaConv/AliAnalysisTaskGammaConvDalitz.cxx 
+    GammaConv/AliAnalysisTaskGCPartToPWG4Part.cxx 
+    GammaConv/ConvCorrelations/AliAnalysisTaskGammaJet.cxx 
+    GammaConv/ConvCorrelations/AliAnaConvIsolation.cxx 
+    GammaConv/ConvCorrelations/AliAnaConvCorrBase.cxx 
+    GammaConv/ConvCorrelations/AliAnaConvCorrPion.cxx 
+    GammaConv/ConvCorrelations/AliAnaConvCorrPhoton.cxx 
+    GammaConv/ConvCorrelations/AliAnaConvCorrPhotonJet.cxx)
 
 string ( REPLACE ".cxx" ".h" HDRS "${SRCS}" )
 
index 36dd9e779d4622bdf5b7ee4109c77c110431adfa..fe30e153b21a4afe999e9828ed60db7cd04bd066 100644 (file)
@@ -12,7 +12,6 @@ class AliAODPWG4ParticleCorrelation;
 class AliAODPWG4Particle;\r
 class TClonesArray;\r
 class TString;\r
-class AliMCAnalysisUtils;\r
 class AliAODMCHeader;\r
 \r
 #include "AliAnalysisTaskSE.h"\r
diff --git a/PWG4/GammaConv/AliAnalysisTaskGammaJet.cxx b/PWG4/GammaConv/AliAnalysisTaskGammaJet.cxx
deleted file mode 100644 (file)
index bcfd18a..0000000
+++ /dev/null
@@ -1,654 +0,0 @@
-#include <iostream>
-#include "TChain.h"
-#include "TTree.h"
-#include "TH1F.h"
-#include "TCanvas.h"
-#include "TString.h"
-
-#include "AliAnalysisTask.h"
-#include "AliAnalysisManager.h"
-#include "AliAnalysisTaskGammaJet.h"
-
-#include "AliESDEvent.h"
-#include "AliESDCaloCluster.h"
-#include "AliESDInputHandler.h"
-
-#include "AliAODPWG4ParticleCorrelation.h"
-#include "AliAODEvent.h"
-#include "AliAODHandler.h"
-#include "AliAODCaloCluster.h"
-#include "AliGammaConversionAODObject.h"
-#include "AliAODConversionParticle.h"
-#include "AliAODJet.h"
-
-#include "AliAODInputHandler.h"
-
-// Gamma - jet correlation analysis task
-// Authors: Svein Lindal
-
-
-using namespace std;
-
-ClassImp(AliAnalysisTaskGammaJet)
-
-//________________________________________________________________________
-AliAnalysisTaskGammaJet::AliAnalysisTaskGammaJet() : AliAnalysisTaskSE(), 
-  fOutputList(NULL), 
-  fHistPt(NULL),
-  fHistPtPhos(NULL),
-  fHistPtEmcal(NULL),
-
-  fHistPhotPhi(NULL), 
-  fHistHadPhi(NULL), 
-  fHistJetPhi(NULL), 
-
-  fHistPtJets(NULL),
-  fHistGammaJets(NULL),
-  fHistGammaJetsIso(NULL),
-  fHistMaxdPhi(NULL),
-  fHistMaxdPhiIso(NULL),
-  fHistMaxdPhiIsoPt(NULL),
-
-  fHadHistPt(NULL), //! Pt spectrum
-  fHadHistdPhi(NULL), //!Phi correlations
-  fHadHistdPhiIso(NULL), //!Phi correlations
-  fHadHistMaxdPhi(NULL), //!Phi correlations
-  fHadHistMaxdPhiIso(NULL), //!Phi correlations
-  fHadHistMaxdPhiIsoPt(NULL), //!Phi correlations
-
-  fMinPt(2.0),
-  fConeSize(0.9),
-  fPtThreshold(2.0),
-  fDeltaAODFileName(""),
-  fPhotons(NULL)
-{
-  // Dummy Constructor
-}
-
-//________________________________________________________________________________
-AliAnalysisTaskGammaJet::~AliAnalysisTaskGammaJet() {
-
-  if(fOutputList)
-    delete fOutputList; 
-  fOutputList = NULL;
-
-  if(fHistPt)
-    fHistPt = NULL;
-  delete fHistPt;
-  if(fHistPtPhos)
-    fHistPtPhos = NULL;
-  delete fHistPtPhos;
-
-  if(fHistPtEmcal)
-    fHistPtEmcal = NULL;
-  delete fHistPtEmcal;
-
-  if(fHistPtJets)
-    fHistPtJets= NULL;
-  delete fHistPtJets;
-
-    if(fHistGammaJets)
-      fHistGammaJets = NULL;
-  delete fHistGammaJets;
-
-  if(fHistGammaJetsIso)
-    fHistGammaJetsIso = NULL;
-  delete fHistGammaJetsIso;
-  if(fHistMaxdPhi)
-    fHistMaxdPhi = NULL;
-  delete fHistMaxdPhi;
-  if(fHistMaxdPhiIso)
-    fHistMaxdPhiIso = NULL;
-  delete fHistMaxdPhiIso;
-  if(fHistMaxdPhiIsoPt)
-    fHistMaxdPhiIsoPt = NULL;
-  delete fHistMaxdPhiIsoPt;
-   
-  if(fPhotons)
-    fPhotons = NULL;
-  delete fPhotons;
-
-
-}
-
-
-
-//________________________________________________________________________
-AliAnalysisTaskGammaJet::AliAnalysisTaskGammaJet(const char *name) : 
-  AliAnalysisTaskSE(name), 
-  fOutputList(0), 
-  fHistPt(0),
-  fHistPtPhos(0),
-  fHistPtEmcal(0),
-
-  fHistPhotPhi(NULL), 
-  fHistHadPhi(NULL), 
-  fHistJetPhi(NULL), 
-
-  fHistPtJets(0),
-  fHistGammaJets(NULL),
-  fHistGammaJetsIso(NULL),
-  fHistMaxdPhi(NULL),
-  fHistMaxdPhiIso(NULL),
-  fHistMaxdPhiIsoPt(NULL),
-
-  fHadHistPt(NULL), //! Pt spectrum
-  fHadHistdPhi(NULL), //!Phi correlations
-  fHadHistdPhiIso(NULL), //!Phi correlations
-  fHadHistMaxdPhi(NULL), //!Phi correlations
-  fHadHistMaxdPhiIso(NULL), //!Phi correlations
-  fHadHistMaxdPhiIsoPt(NULL), //!Phi correlations
-
-  fMinPt(0.0),
-  fConeSize(0.0),
-  fPtThreshold(0.0),
-  fDeltaAODFileName(""),
-  fPhotons(NULL)
-{
-  // Constructor
-  // Define input and output slots here
-  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, TList::Class());
-}
-
-//________________________________________________________________________
-void AliAnalysisTaskGammaJet::UserCreateOutputObjects()
-{
-  //Create histograms add, to outputlist
-  fOutputList = new TList();
-
-  fHistPt = new TH1F("fHistPt", "P_{T} distribution", 150, 0.1, 50);
-  fHistPt->GetXaxis()->SetTitle("P_{T} (GeV/c)");
-  fHistPt->GetYaxis()->SetTitle("dN/dP_{T} (c/GeV)");
-  fHistPt->SetMarkerStyle(kFullCircle);
-  fOutputList->Add(fHistPt);
-  
-  fHistPtPhos = new TH1F("fHistPtPhos", "P_{T} distribution", 150, 0.1, 50);
-  fHistPtPhos->GetXaxis()->SetTitle("P_{T} (GeV/c)");
-  fHistPtPhos->GetYaxis()->SetTitle("dN/dP_{T} (c/GeV)");
-  fHistPtPhos->SetMarkerStyle(kFullCircle);
-  fOutputList->Add(fHistPtPhos);
-  
-  fHistPtEmcal = new TH1F("fHistPtEmcal", "P_{T} distribution", 150, 0.1, 50);
-  fHistPtEmcal->GetXaxis()->SetTitle("P_{T} (GeV/c)");
-  fHistPtEmcal->GetYaxis()->SetTitle("dN/dP_{T} (c/GeV)");
-  fHistPtEmcal->SetMarkerStyle(kFullCircle);
-  fOutputList->Add(fHistPtEmcal);
-
-  fHistPhotPhi = new TH1F("phi gamma", "phi gamma", 120, -6.3, 6.3);
-  fOutputList->Add(fHistPhotPhi);
-  fHistHadPhi = new TH1F("phi track", "phi track", 120, -6.3, 6.3);
-  fOutputList->Add(fHistHadPhi);
-  fHistJetPhi = new TH1F("phi jet", "phi jet", 120, -6.3, 6.3);
-  fOutputList->Add(fHistJetPhi);
-
-
-  fHistPtJets = new TH1F("fHistPtJets", "P_{T} distribution", 150, 0.1, 50);
-  fHistPtJets->GetXaxis()->SetTitle("P_{T} (GeV/c)");
-  fHistPtJets->GetYaxis()->SetTitle("dN/dP_{T} (c/GeV)");
-  fHistPtJets->SetMarkerStyle(kFullCircle);
-  fOutputList->Add(fHistPtJets);
-
-  fHistGammaJets = new TH1F("fHistGammaJets", "fHistGammaJets", 200, -2*TMath::Pi(), 2*TMath::Pi());
-  fOutputList->Add(fHistGammaJets);
-  
-  fHistGammaJetsIso = new TH1F("fHistGammaJetsIso", "fHistGammaJetsIso", 200, -2*TMath::Pi(), 2*TMath::Pi());
-  fOutputList->Add(fHistGammaJetsIso);
-
-
-  fHistMaxdPhi = new TH1F("fHistMaxdPhi", "fHistMaxdPhi", 200, -2*TMath::Pi(), 2*TMath::Pi());
-  fOutputList->Add(fHistMaxdPhi);
-  
-  fHistMaxdPhiIso = new TH1F("fHistMaxdPhiIso", "fHistMaxdPhiIso", 200, -2*TMath::Pi(), 2*TMath::Pi());
-  fOutputList->Add(fHistMaxdPhiIso);
-
-  fHistMaxdPhiIsoPt = new TH1F("fHistMaxdPhiIsoPt", "fHistMaxdPhiIsoPt", 200, -2*TMath::Pi(), 2*TMath::Pi());
-  fOutputList->Add(fHistMaxdPhiIsoPt);
-
-
-
-
-  fHadHistPt = new TH1F("fHadHistPt", "P_{T} distribution", 150, 0.1, 50);
-  fHadHistPt->GetXaxis()->SetTitle("P_{T} (GeV/c)");
-  fHadHistPt->GetYaxis()->SetTitle("dN/dP_{T} (c/GeV)");
-  fHadHistPt->SetMarkerStyle(kFullCircle);
-  fOutputList->Add(fHadHistPt);
-  
-
-  fHadHistdPhi = new TH1F("fHadHistdPhi", "fHadHistdPhi", 200, -2*TMath::Pi(), 2*TMath::Pi());
-  fOutputList->Add(fHadHistdPhi);
-  
-  fHadHistdPhiIso = new TH1F("fHadHistdPhiIso", "fHadHistdPhiIso", 200, -2*TMath::Pi(), 2*TMath::Pi());
-  fOutputList->Add(fHadHistdPhiIso);
-
-
-  fHadHistMaxdPhi = new TH1F("fHadHistMaxdPhi", "fHadHistMaxdPhi", 200, -2*TMath::Pi(), 2*TMath::Pi());
-  fOutputList->Add(fHadHistMaxdPhi);
-  
-  fHadHistMaxdPhiIso = new TH1F("fHadHistMaxdPhiIso", "fHadHistMaxdPhiIso", 200, -2*TMath::Pi(), 2*TMath::Pi());
-  fOutputList->Add(fHadHistMaxdPhiIso);
-
-  fHadHistMaxdPhiIsoPt = new TH1F("fHadHistMaxdPhiIsoPt", "fHadHistMaxdPhiIsoPt", 200, -2*TMath::Pi(), 2*TMath::Pi());
-  fOutputList->Add(fHadHistMaxdPhiIsoPt);
-
-
-
-
-  
-  //TNtuple * tuple = new TNtuple("fNtuple", "fNtuple", dPhi, 
-
-
-  ///Create AOD branch
-  fPhotons = new TClonesArray("AliAODPWG4ParticleCorrelation", 0);
-  fPhotons->SetName("ConversionGamma");
-  AddAODBranch("TClonesArray", &fPhotons);
-
-
-}
-
-//________________________________________________________________________
-void AliAnalysisTaskGammaJet::UserExec(Option_t *) 
-{
-
-
-  //BALLE BALLE not do always
-  AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillAOD(kTRUE);
-
-
-  //Clear stuff for new event
-  CleanUp();
-
-
-  
-
-
-  ///Get AOD event
-  AliAODEvent * aodEvent = GetAODEvent();
-  if(!aodEvent) {
-    AliError("No AOD event!!");
-    return;
-  }
-  
-  ProcessConvGamma(aodEvent);
-  //ProcessCalorimeters(aodEvent);
-    
-
-  PostData(1, fOutputList);
-        
-}
-//_____________________________________________________________________
-void AliAnalysisTaskGammaJet::Terminate(Option_t *) {
-  // Draw result to the screen
-  // Called once at the end of the query
-}
-
-//_____________________________________________________________________
-AliAODEvent * AliAnalysisTaskGammaJet::GetAODEvent() {
-  //Get the AOD event from whereever it might be
-  AliAODEvent * aodEvent = dynamic_cast<AliAODEvent*>(InputEvent());
-  if(!aodEvent) {
-    aodEvent = AODEvent();
-  }
-  
-  return aodEvent;
-
-}
-
-
-//_____________________________________________________________________
-TClonesArray * AliAnalysisTaskGammaJet::GetConversionGammas(const AliAODEvent * aodEvent) {
-
-  //Get Conversion gamma branch of AOD. First try standard AOD
-  TClonesArray * convGamma = dynamic_cast<TClonesArray*>(aodEvent->FindListObject("GammaConv_gamma"));
-  
-  //If it's there, send it back
-  if(convGamma)  return convGamma;
-
-
-  //If AOD not in standard file have to locate it in delta AOD
-  if( !(fDeltaAODFileName.Length() > 0)  ) return NULL;
-  
-  AliAODHandler * aodHandler = dynamic_cast<AliAODHandler*>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()); 
-  if(aodHandler) {
-    AliAODExtension * gExt = dynamic_cast<AliAODExtension*>(aodHandler->GetExtensions()->FindObject(fDeltaAODFileName));
-    if(gExt) {
-      AliAODEvent * gcEvent = gExt->GetAOD();
-      return dynamic_cast<TClonesArray*>(gcEvent->FindListObject("GammaConv_gamma"));
-    }
-  }  
-  return NULL;
-}
-
-
-// //_____________________________________________________________________
-// void AliAnalysisTaskGammaJet::FillPWG4PartCorrBranch( TClonesArray * gcBranch, TClonesArray * partCorrBranch , TString detector ) {
-  
-//   for(int i = 0; i < gcBranch->GetEntriesFast(); i++) {
-//     AliGammaConversionAODObject * gcObject = dynamic_cast<AliGammaConversionAODObject*>(gcBranch->At(i));
-//     if ( gcObject ) {
-//       AliAODPWG4ParticleCorrelation pc(gcObject->Px(), gcObject->Py(), gcObject->Pz(), gcObject->E()); 
-//       pc.SetTagged(gcObject->IsTagged());
-//       pc.SetTrackLabel(gcObject->GetLabel1(), gcObject->GetLabel2());
-//       pc.SetDetector(detector);
-//       new((*partCorrBranch)[i]) AliAODPWG4ParticleCorrelation(pc);
-    
-//     } else {
-//       AliError(Form("Couldn't get gamma conversion aod object"));
-//     }
-   
-//   }
-// }
-
-
-// //_____________________________________________________________________
-// AliAODPWG4ParticleCorrelation * AliAnalysisTaskGammaJet::PWG4PartFromGammaConvAODObject(AliGammaConversionAODObject * gcObject, TString detector ) {
-
-//   AliAODPWG4ParticleCorrelation * pc = new AliAODPWG4ParticleCorrelation(gcObject->Px(), gcObject->Py(), gcObject->Pz(), gcObject->E());
-//   pc->SetTagged(gcObject->IsTagged());
-//   pc->SetTrackLabel(gcObject->GetLabel1(), gcObject->GetLabel2());
-//   pc->SetDetector(detector);
-//   return pc;
-// }
-
-
-//_________________________________________________________________________
-void AliAnalysisTaskGammaJet::CleanUp() {
-  fPhotons->Delete();
-}
-
-//_________________________________________________________________________
-Bool_t AliAnalysisTaskGammaJet::IsIsolated( AliAODPWG4Particle * particle, TClonesArray * tracks, Float_t coneSize, Float_t ptThreshold ) {
-  //See header file for documentation
-  for(int it = 0; it < tracks->GetEntriesFast(); it++) {
-    if ( (it == particle->GetTrackLabel(0)) || it == particle->GetTrackLabel(1) ) 
-      continue;
-
-    //BALLE Svein:How are you checking the calorimeters for whether they are decay particles ?
-
-    AliAODTrack * track = dynamic_cast<AliAODTrack*>(tracks->At(it));
-    if (track) {
-      if ( IsInCone(particle->Eta() - track->Eta(), particle->Phi() - track->Phi(), coneSize) ) {
-       if (track->Pt() > ptThreshold) {
-         return kFALSE;
-       }
-      }
-    } else {
-      AliError(Form("Bad track!!!! "));
-    }
-  }
-  
-  //No particle above threshold, it's isolated
-  return kTRUE;
-}
-
-
-//______________________________________________________________________________________________
-void AliAnalysisTaskGammaJet::ProcessCalorimeters( const AliAODEvent * const aodEvent ) {
-  
-  TClonesArray * clusters = aodEvent->GetCaloClusters();
-  
-
-  for(int ic = 0; ic < clusters->GetEntriesFast(); ic++) {
-    AliAODCaloCluster * cluster = dynamic_cast<AliAODCaloCluster*>(clusters->At(ic));
-    if (!cluster) { 
-      AliError(Form("Error getting cluster"));
-      continue;
-    }
-
-
-    if (cluster->GetNCells() < 6) continue;
-    if (cluster->GetEmcCpvDistance() < 15) continue;
-
-    TLorentzVector tlvec;
-    
-    AliAODVertex * vertex = aodEvent->GetPrimaryVertex();
-    Double_t vertexPosition[3];
-    vertex->GetXYZ(vertexPosition);
-    cluster->GetMomentum(tlvec, vertexPosition);
-    if (tlvec.Pt() < GetMinPt()) continue; 
-    
-  }
-  
-}
-
-// // ///____________________________________________________________________________________
-// // void AddToAOD(AliAODConversionParticle * photon, TClonesArray * branch) {
-
-
-// // }
-
-
-// //__________________________________________________________________________________________
-// void AddToOutputAOD(AliGammaConversionAODObject * photon, TClonesArray * branch) {
-  
-//   cout <<"BALLE BALLE BALLE AddToOutputAOD"<<endl;
-
-//   AliAODPWG4ParticleCorrelation particle = AliAODPWG4ParticleCorrelation(photon->Px(), photon->Py(), photon->Pz(), photon->E());
-//   particle.SetTrackLabel(photon->GetLabel1(), photon->GetLabel2());
-//   particle.SetDetector("CTS");
-//   //particle.SetPdg(AliPID::kElecon);
-
-//   Int_t i = branch->GetEntriesFast();
-//   // if(! (branch.GetClass("Correlation")) ) {
-//   //   new((*branch)[i])  AliAODPWG4Particle(particle);
-//   // } else {
-//   TList * list = particle.GetObjArrayList();
-//   if(list)
-//     cout <<"BALLE BALLE we have the list"<<endl;
-//   else
-//     cout <<"BALLE BALLE we don't"<<endl;
-
-//  particle.GetObjArrayList()->Dump();
-//   new((*branch)[i])  AliAODPWG4ParticleCorrelation(particle);
-//     //}
-// }
-
-
-//___________________________________________________________________________________________
-void AliAnalysisTaskGammaJet::ProcessConvGamma( const AliAODEvent * const aodEvent ) {
-  
-  TClonesArray * tracks = aodEvent->GetTracks();
-  if(!tracks) {
-    cout << "No tracks!!!"<<endl;
-    return;
-  }
-
-  TClonesArray * convGamma = dynamic_cast<TClonesArray*>(aodEvent->FindListObject("GammaConversionTask_900356200010031"));
-  
-
-  if(!convGamma) {
-
-    convGamma = GetConversionGammas(aodEvent);
-    if(!convGamma) {
-      AliError(Form("No convgamma"));
-      return;
-    }
-  }
-  
-
-
-  for (Int_t iPhot = 0; iPhot < convGamma->GetEntriesFast(); iPhot++) {
-    AliAODPWG4Particle * photon = dynamic_cast<AliAODPWG4Particle*>(convGamma->At(iPhot));
-    
-    
-    if(!photon) {
-      AliGammaConversionAODObject * aodO = dynamic_cast<AliGammaConversionAODObject*>(convGamma->At(iPhot));
-      if (!aodO) {
-       AliError(Form("ERROR: Could not receive ga %d\n", iPhot));
-       continue;
-      }
-      
-      if(aodO->Pt() < GetMinPt()) continue;
-      photon = AddToAOD(aodO, fPhotons, "ConvGamma");
-    } 
-  
-    if(photon) {
-      Bool_t isolated = IsIsolated(photon, tracks, GetConeSize(), GetPtThreshold() );
-      
-      
-      CorrelateWithJets(photon, aodEvent->GetJets(), isolated);
-      CorrelateWithHadrons(photon, aodEvent->GetTracks(), isolated);
-
-      fHistPt->Fill(photon->Pt());
-      fHistPhotPhi->Fill(photon->Phi());
-    }
-  }
-}
-
-
-AliAODPWG4ParticleCorrelation * AliAnalysisTaskGammaJet::AddToAOD(AliGammaConversionAODObject * aodO, TClonesArray * branch, TString detector) {
-  new((*branch)[branch->GetEntriesFast()]) AliAODPWG4ParticleCorrelation(aodO->Px(), aodO->Py(), aodO->Pz(), aodO->E());
-  AliAODPWG4ParticleCorrelation * photon = dynamic_cast<AliAODPWG4ParticleCorrelation*>(branch->Last());
-  if(photon) {
-    photon->SetTagged(aodO->IsTagged());
-    photon->SetTrackLabel(aodO->GetLabel1(), aodO->GetLabel2());
-    photon->SetDetector(detector);
-  }
-  
-  return photon;
-}
-
-AliAODPWG4ParticleCorrelation * AliAnalysisTaskGammaJet::AddToAOD(AliAODConversionParticle * aodO, TClonesArray * branch, TString detector) {
-  new((*branch)[branch->GetEntriesFast()]) AliAODPWG4ParticleCorrelation(aodO->Px(), aodO->Py(), aodO->Pz(), aodO->E());
-  AliAODPWG4ParticleCorrelation * photon = dynamic_cast<AliAODPWG4ParticleCorrelation*>(branch->Last());
-  if(photon) {
-    photon->SetTrackLabel(aodO->GetLabel1(), aodO->GetLabel2());
-    photon->SetDetector(detector);
-  }
-
-  return photon;
-}
-
-///____________________________________________________________________________________________________
-void AliAnalysisTaskGammaJet::CorrelateWithHadrons(AliAODPWG4Particle * photon, const TClonesArray * tracks, Bool_t const isolated) {
-
-  //See header file for documentation
-  if (tracks) {
-    Float_t maxdPhi = 0.0;
-    Float_t maxdPhiPt = 0.0;
-
-    for(int ij = 0; ij < tracks->GetEntriesFast(); ij++) {
-      AliAODTrack * track = dynamic_cast<AliAODTrack*>(tracks->At(ij));
-      if(track) {
-       if (track->Pt() < 2.0 ) continue;
-
-       fHadHistPt->Fill(track->Pt());
-       fHistHadPhi->Fill(track->Phi());
-       Float_t dPhi = TMath::Abs(photon->Phi() - track->Phi());
-       
-       fHadHistdPhi->Fill(dPhi);
-       if (isolated) {
-         fHadHistdPhiIso->Fill(dPhi, track->Pt()/photon->Pt());
-       }
-
-
-       if(photon->Phi() < 0)
-         cout << "BALLE"<<endl;
-       if(track->Phi() < 0 )
-         cout << "KUKKK"<<endl;
-         
-       //cout << dPhi << " " << maxdPhi << endl;
-       //cout << TMath::Abs( dPhi - TMath::Pi() ) << " " << TMath::Abs( maxdPhi - TMath::Pi()) <<endl;;
-
-       if ( TMath::Abs( dPhi - TMath::Pi() ) <   TMath::Abs( maxdPhi - TMath::Pi()) ){
-         maxdPhi = dPhi;
-
-         maxdPhiPt = track->Pt();
-         //cout << dPhi << " " << maxdPhi << endl;
-       
-       }
-
-      }
-    }
-
-
-    if(tracks->GetEntriesFast() > 0) {
-      //cout << maxdPhi << endl;
-      fHadHistMaxdPhi->Fill(maxdPhi);
-      if(isolated) {
-       fHadHistMaxdPhiIso->Fill(maxdPhi);
-       fHadHistMaxdPhiIsoPt->Fill(maxdPhi, maxdPhiPt/photon->Pt());
-      }
-    }
-  }
-
-
-
-}
-
-
-///________________________________________________________________________________________________________________
-void AliAnalysisTaskGammaJet::CorrelateWithJets(AliAODPWG4ParticleCorrelation * photon, const TClonesArray * const jets) {
-  //See header file for documentation
-  if (jets) {
-    for(int ij = 0; ij < jets->GetEntriesFast(); ij++) {
-      AliAODJet * jet = dynamic_cast<AliAODJet*>(jets->At(ij));
-      if(jet) {
-       fHistPtJets->Fill(jet->Pt());
-       
-       Float_t dPhi = TMath::Abs(photon->Phi() - jet->Phi());
-       if (photon->IsIsolated())
-         fHistGammaJetsIso->Fill(dPhi, jet->Pt()/photon->Pt());
-       else
-         fHistGammaJets->Fill(dPhi);
-       
-      }
-    }
-  }
-}
-
-
-
-///________________________________________________________________________________________________________________
-void AliAnalysisTaskGammaJet::CorrelateWithJets(AliAODPWG4Particle * photon, const TClonesArray * const jets, Bool_t const isolated ) {
-  //See header file for documentation
-  if (jets) {
-    Float_t maxdPhi = 0.0;
-    Float_t maxdPhiPt = 0.0;
-
-    for(int ij = 0; ij < jets->GetEntriesFast(); ij++) {
-      AliAODJet * jet = dynamic_cast<AliAODJet*>(jets->At(ij));
-      if(jet) {
-       fHistPtJets->Fill(jet->Pt());
-       fHistJetPhi->Fill(jet->Phi());
-       Float_t dPhi = TMath::Abs(photon->Phi() - jet->Phi());
-
-       fHistGammaJets->Fill(dPhi);
-       if (isolated) {
-         fHistGammaJetsIso->Fill(dPhi, jet->Pt()/photon->Pt());
-       }
-
-
-
-       if ( TMath::Abs( dPhi - TMath::Pi() ) <   TMath::Abs( maxdPhi - TMath::Pi()) ){
-         maxdPhi = dPhi;
-
-         maxdPhiPt = jet->Pt();
-         //cout << dPhi << " " << maxdPhi << endl;
-       
-       }
-        
-      }
-    }
-
-
-    if(jets->GetEntriesFast() > 0) {
-      //cout << maxdPhi << endl;
-      fHistMaxdPhi->Fill(maxdPhi);
-      if(isolated) {
-       fHistMaxdPhiIso->Fill(maxdPhi);
-       fHistMaxdPhiIsoPt->Fill(maxdPhi, maxdPhiPt/photon->Pt());
-      }
-    }
-  }
-}
diff --git a/PWG4/GammaConv/AliAnalysisTaskGammaJet.h b/PWG4/GammaConv/AliAnalysisTaskGammaJet.h
deleted file mode 100644 (file)
index 70d606b..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-#ifndef AliAnalysisTaskGammaJet_cxx\r
-#define AliAnalysisTaskGammaJet_cxx\r
-\r
-// example of an analysis task creating a p_t spectrum\r
-// Authors: Panos Cristakoglou, Jan Fiete Grosse-Oetringhaus, Christian Klein-Boesing\r
-\r
-class TH1F;\r
-class AliESDEvent;\r
-class AliGammaConversionAODObject;\r
-class AliAODConversionParticle;\r
-class AliAODPWG4ParticleCorrelation;\r
-class AliAODPWG4Particle;\r
-class TClonesArray;\r
-class TString;\r
-\r
-#include "AliAnalysisTaskSE.h"\r
-\r
-class AliAnalysisTaskGammaJet : public AliAnalysisTaskSE {\r
-\r
-public:\r
-  \r
-  AliAnalysisTaskGammaJet(); \r
-  AliAnalysisTaskGammaJet(const char *name);\r
-  virtual ~AliAnalysisTaskGammaJet();\r
-  \r
-  virtual void   UserCreateOutputObjects();\r
-  virtual void   UserExec(Option_t *option);\r
-  virtual void   Terminate(Option_t *);\r
-\r
-  void SetDeltaAODFileName(TString string) { fDeltaAODFileName = string;}\r
\r
-  inline Float_t GetMinPt() const { return fMinPt;} \r
-  void SetMinPt( const Float_t pt ) { fMinPt = pt; }\r
-  inline Float_t GetConeSize () const { return fConeSize; }\r
-  void SetConeSize ( const Float_t cs ) { fConeSize = cs; }\r
-  inline Float_t GetPtThreshold () const { return fPtThreshold; }\r
-  void SetPtThreshold ( Float_t ptt ) { fPtThreshold = ptt; }\r
\r
-  \r
- private:\r
-\r
-  //Clean up\r
-  void CleanUp();\r
-\r
-  //Get the AOD event from whereever it might be accessible\r
-  AliAODEvent * GetAODEvent();\r
-\r
-  //Get Conversion gammas branch\r
-  TClonesArray * GetConversionGammas(const AliAODEvent * aodEvent);\r
-\r
-  //Create PWG4 particles from the aod objects\r
-  AliAODPWG4ParticleCorrelation * PWG4PartFromGammaConvAODObject(AliGammaConversionAODObject * gcObject, TString detector);\r
-\r
-  //Fill AOD tree with PWG4 particles\r
-  AliAODPWG4ParticleCorrelation * AddToAOD(AliGammaConversionAODObject * aodO, TClonesArray * branch, TString detector);\r
-  AliAODPWG4ParticleCorrelation * AddToAOD(AliAODConversionParticle * aodO, TClonesArray * branch, TString detector);\r
-  \r
-  //Is particle isolated\r
-  Bool_t IsIsolated( AliAODPWG4Particle * particle, TClonesArray * tracks, Float_t coneSize, Float_t ptThreshold);\r
-\r
-  //Process conv gamma\r
-  void ProcessConvGamma( const AliAODEvent * const aodEvent );\r
-\r
-  //Process calorimeters\r
-  void ProcessCalorimeters( const AliAODEvent * const aodEvent );\r
-  \r
-  //Correlate particle with jets\r
-  void CorrelateWithJets(AliAODPWG4ParticleCorrelation * photon, const TClonesArray * const jets);\r
-  void CorrelateWithJets(AliAODPWG4Particle * photon, const TClonesArray * const jets, Bool_t const isolated);\r
-  void CorrelateWithHadrons(AliAODPWG4Particle * photon, const TClonesArray * tracks, Bool_t const isolated);\r
-\r
-  //Is eta - phi distance smaller than conesize ?\r
-  inline Bool_t IsInCone(Float_t dEta, Float_t dPhi, Float_t coneSize) {   \r
-    return ( (dEta*dEta + dPhi*dPhi) < coneSize*coneSize);\r
-  }\r
-\r
-  TList       *fOutputList; //! Output list\r
-  TH1F        *fHistPt; //! Pt spectrum\r
-  TH1F        *fHistPtPhos; //! Pt spectrum\r
-  TH1F        *fHistPtEmcal; //! Pt spectrum\r
-\r
-  TH1F        *fHistPhotPhi;\r
-  TH1F        *fHistHadPhi;\r
-  TH1F        *fHistJetPhi;\r
-\r
-\r
-  TH1F        *fHistPtJets; //! Pt spectrum\r
-  TH1F        *fHistGammaJets; //!Phi correlations\r
-  TH1F        *fHistGammaJetsIso; //!Phi correlations\r
-  TH1F        *fHistMaxdPhi; //!Phi correlations\r
-  TH1F        *fHistMaxdPhiIso; //!Phi correlations\r
-  TH1F        *fHistMaxdPhiIsoPt; //!Phi correlations\r
-\r
-  TH1F        *fHadHistPt; //! Pt spectrum\r
-  TH1F        *fHadHistdPhi; //!Phi correlations\r
-  TH1F        *fHadHistdPhiIso; //!Phi correlations\r
-  TH1F        *fHadHistMaxdPhi; //!Phi correlations\r
-  TH1F        *fHadHistMaxdPhiIso; //!Phi correlations\r
-  TH1F        *fHadHistMaxdPhiIsoPt; //!Phi correlations\r
-  \r
-  \r
-  Float_t fMinPt; //Minimum pt for correlation\r
-  Float_t fConeSize; //cone size for isolation\r
-  Float_t fPtThreshold; //Threshold pt for isolation\r
-\r
-  TString     fDeltaAODFileName;//! File where Gamma Conv AOD is located, if not in default AOD\r
-\r
-  TClonesArray * fPhotons;\r
-\r
-  AliAnalysisTaskGammaJet(const AliAnalysisTaskGammaJet&); // not implemented\r
-  AliAnalysisTaskGammaJet& operator=(const AliAnalysisTaskGammaJet&); // not implemented\r
-  \r
-  ClassDef(AliAnalysisTaskGammaJet, 2); // example of analysis\r
-};\r
-\r
-#endif\r
diff --git a/PWG4/GammaConv/ConvCorrelations/AliAnaConvCorrBase.cxx b/PWG4/GammaConv/ConvCorrelations/AliAnaConvCorrBase.cxx
new file mode 100644 (file)
index 0000000..0e17055
--- /dev/null
@@ -0,0 +1,216 @@
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project        *
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ *                                                                        *
+ * Primary Author: Svein Lindal <slindal@fys.uio.no>                      *
+ *                                                                        *
+ * 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.                  *
+ **************************************************************************/
+
+/// @file   AliAnaConvCorrBase.cxx
+/// @author Svein Lindal
+/// @brief  Base class for analysation of conversion particle - track correlations
+
+
+#include "AliAnaConvCorrBase.h"
+#include "AliAODTrack.h"
+
+#include "TClonesArray.h"
+#include "TH1F.h"
+#include "TH1I.h"
+#include "TH2F.h"
+#include "TList.h"
+#include "TNtuple.h"
+#include "AliAODConversionParticle.h"
+
+
+#include <iostream>
+
+// Gamma - jet correlation analysis task
+// Authors: Svein Lindal
+
+
+using namespace std;
+ClassImp(AliAnaConvCorrBase)
+
+//________________________________________________________________________
+AliAnaConvCorrBase::AliAnaConvCorrBase(TString name) : TObject(),
+  fName(name),
+  fHistograms(NULL),
+  fTriggerPt(0), 
+  fCorrelatedPt(0),
+  fNPhiBins(32)
+{
+  //Constructor
+  fTBins[0] = 7.0;
+  fTBins[1] = 5.0;
+  fTBins[2] = 3.0;
+
+  fCBins[0] = 5.0;
+  fCBins[1] = 3.0;
+  fCBins[2] = 1.5;
+  
+}
+
+
+//________________________________________________________________________________
+AliAnaConvCorrBase::~AliAnaConvCorrBase() {
+  
+  ///destructor
+  // delete[] fCBins;
+  // delete[] fTBins;
+
+}
+
+
+//________________________________________________________________________
+void AliAnaConvCorrBase::CreateHistograms() {
+  //Create histograms add, to outputlis
+
+  fHistograms = new TList();
+  fHistograms->SetOwner(kFALSE);
+  fHistograms->SetName(fName);
+
+
+
+  for(int iIso = 0; iIso < 2; iIso++) {
+    fHEtaPhiPt[iIso] = new TH2F(
+                                 Form("%s_deta_dphi_corr_%s", fName.Data(),  (iIso==0)?"nonIso":"isolated"),
+                                 Form("%s_deta_dphi_corr_%s", fName.Data(),  (iIso==0)?"nonIso":"isolated"),
+                                 200, -2., 2., fNPhiBins, -TMath::PiOver2(), 3*TMath::PiOver2());
+      fHistograms->Add(fHEtaPhiPt[iIso]);
+  }
+
+  for(int iIso = 0; iIso < 2; iIso++) {
+    fHdEta[iIso] = new TH1F(Form("%s_deta_corr_%s", fName.Data(),  (iIso==0)?"nonIso":"isolated"),
+                           Form("%s_deta_corr_%s", fName.Data(),  (iIso==0)?"nonIso":"isolated"),
+                           200, -2, 2);
+    fHistograms->Add(fHdEta[iIso]);
+  }
+
+  for(int iIso = 0; iIso < 2; iIso++) {
+    fHdPhi[iIso] = new TH1F(Form("%s_dphi_corr_%s", fName.Data(),  (iIso==0)?"nonIso":"isolated"),
+                           Form("%s_dphi_corr_%s", fName.Data(),  (iIso==0)?"nonIso":"isolated"),
+                           fNPhiBins, -TMath::PiOver2(), 3*TMath::PiOver2());
+    fHistograms->Add(fHdPhi[iIso]);
+  }
+  
+  for(int iIso = 0; iIso < 2; iIso++) {
+      fHNTriggers[iIso] = new TH1I(Form("%s_%s_fNTriggers", fName.Data(), (iIso==0)?"nonIso":"isolated"), 
+                                  Form("%s_%s_fNTriggers", fName.Data(), (iIso==0)?"nonIso":"isolated"), 
+                                  fNTBins, 0, fNTBins );
+      fHistograms->Add(fHNTriggers[iIso]);
+  }
+
+
+  for(int iIso = 0; iIso < 2; iIso++) {
+    for(Int_t tBin = 0; tBin < fNTBins; tBin++) {
+      for(Int_t cBin = 0; cBin < fNCBins; cBin++) {
+       fHdPhiBins[iIso][tBin][cBin] =  new TH1F(Form("%s_%s_phi_corr_tBin_%d_cBin_%d", fName.Data(), (iIso==0)?"nonIso":"isolated", tBin, cBin),
+                                                Form("%s particles dPhi %f<tPt< %f  %f<cPt<%f", (iIso==0)?"not isolated":"isolated", GetLowerBinLimit(tBin, fTBins), GetUpperBinLimit(tBin, fTBins), 
+                                                     GetLowerBinLimit(cBin, fCBins), GetUpperBinLimit(cBin, fCBins)),
+                                                fNPhiBins, -TMath::PiOver2(), 3*TMath::PiOver2());
+       fHistograms->Add(fHdPhiBins[iIso][tBin][cBin]);
+      }
+    }
+  }
+}
+
+
+///____________________________________________________________________________
+void AliAnaConvCorrBase::FillTriggerCounters(Float_t tPt, Bool_t isolated){ 
+  //Fill histogram with trigger counters
+  fHNTriggers[0]->Fill(GetTriggerBin(tPt));
+  if(isolated)   fHNTriggers[isolated]->Fill(GetTriggerBin(tPt));
+
+
+}
+
+///_____________________________________________________________________________
+void AliAnaConvCorrBase::FillHistograms(Float_t tPt, Float_t cPt, Float_t dPhi, Float_t dEta, Bool_t isolated) {
+  //Fill histograms
+  Float_t ptFrac = cPt/tPt;
+
+  Int_t triggerBin = GetTriggerBin(tPt);
+  Int_t corrBin = GetCorrBin(cPt);
+
+  if(triggerBin < 0 ||corrBin < 0) return;
+
+  fHEtaPhiPt[0]->Fill(dEta, dPhi, cPt);
+  fHdEta[0]->Fill(dEta, cPt);
+  fHdPhi[0]->Fill(dPhi, cPt);
+  fHdPhiBins[0][triggerBin][corrBin]->Fill(dPhi);
+  
+
+  if(isolated) {
+    fHEtaPhiPt[isolated]->Fill(dEta, dPhi, cPt);
+    fHdEta[isolated]->Fill(dEta, ptFrac);
+    fHdPhi[isolated]->Fill(dPhi, ptFrac);
+    fHdPhiBins[isolated][triggerBin][corrBin]->Fill(dPhi);
+
+  }
+}
+
+///____________________________________________________________________________
+Int_t AliAnaConvCorrBase::GetTriggerBin(Float_t pt) const {
+  //Get trigger bin
+  for(Int_t i = 0; i < fNTBins; i++) {
+    if(pt > fTBins[i]) return i;
+  }
+
+  return -1;
+}
+
+///____________________________________________________________________________
+Int_t AliAnaConvCorrBase::GetCorrBin(Float_t pt) const {
+  //Get correlation particle bin
+  for(Int_t i = 0; i < fNCBins; i++) {
+    if(pt > fCBins[i]) return i;
+  }
+
+  return -1;
+}
+
+
+
+///______________________________________________________________________________
+Float_t AliAnaConvCorrBase::GetLowerBinLimit(const Int_t bin, const Float_t * const bins) const {
+  //Get lower bin limit for bin 
+  return bins[bin];
+}
+
+///______________________________________________________________________________
+Float_t AliAnaConvCorrBase::GetUpperBinLimit(const Int_t bin, const Float_t * const bins) const {
+  //Get upper bin limit for bin 
+
+  Float_t limit = -999;
+  if(bin < 1)
+    limit = 999;
+  else
+    limit = bins[bin -1];
+
+  return limit;
+
+}
+
+
+//_______________________________________________________________________________
+
+void AliAnaConvCorrBase::PrintStatistics()  { 
+  //Print some statistics between each file
+  
+  for(int i = 0; i < fNTBins; i++) {
+    Int_t nTrig = fHNTriggers[0]->GetBinContent(i+1);
+    cout << "triggers: " << nTrig << endl;
+    for(int j = 0; j < fNCBins; j++) {
+      cout << fHdPhiBins[0][i][j]->GetEntries() << "/" << ((nTrig>0)? fHdPhiBins[0][i][j]->GetEntries()/nTrig : 0) << ";  ";
+    }
+    cout << endl;
+  }
+}
diff --git a/PWG4/GammaConv/ConvCorrelations/AliAnaConvCorrBase.h b/PWG4/GammaConv/ConvCorrelations/AliAnaConvCorrBase.h
new file mode 100644 (file)
index 0000000..1de58bb
--- /dev/null
@@ -0,0 +1,116 @@
+/* This file is property of and copyright                                 *\r
+ * ALICE Experiment at CERN, All rights reserved.                         *\r
+ * See cxx source for full Copyright notice                               */\r
+\r
+/// @file   AliAnaConvCorrPhoton.h\r
+/// @author Svein Lindal\r
+/// @brief  Base class for analysis of correlations between conversion particles and charged tracks\r
+\r
+#ifndef ALIANACONVCORRBASE_CXX\r
+#define ALIANACONVCORRBASE_CXX\r
+\r
+#include "Rtypes.h"\r
+#include "TMath.h"\r
+#include "TList.h"\r
+#include "TH1.h"\r
+\r
+class TH1F;\r
+class TH1I;\r
+class TH2F;\r
+class AliAODConversionParticle;\r
+class TClonesArray;\r
+class TNtuple;\r
+class TString;\r
+\r
+\r
+class AliAnaConvCorrBase : public TObject {\r
+\r
+public:\r
+\r
+  \r
+\r
+  //Constructor / desctructor\r
+  AliAnaConvCorrBase(TString name); \r
+  virtual ~AliAnaConvCorrBase();\r
+  \r
+  //Set and get min pt for triggers\r
+  void SetTriggerPt(Float_t pt) { fTriggerPt = pt; }\r
+  inline Float_t GetTriggerPt() const {return fTriggerPt; }\r
+\r
+\r
+  //Set and get min pt for correlation particles\r
+  void SetCorrelatedPt(Float_t pt) { fCorrelatedPt = pt; }\r
+  inline Float_t GetCorrelatedPt() const {return fCorrelatedPt; }\r
+\r
+  //CreateHistograms\r
+  void CreateHistograms();\r
+  \r
+  //Get list of histograms\r
+  TList * GetHistograms() const { return fHistograms;}\r
+\r
+  //Add histogram to list\r
+  void AddHistogram(TH1 * histogram) { fHistograms->Add(dynamic_cast<TObject*>(histogram));}\r
+\r
+  //Set and get number of bins in phi direction\r
+  void SetNPhiBins(Int_t bins) { fNPhiBins = bins; }\r
+  Int_t GetNPhiBins() const { return fNPhiBins;}\r
+\r
+  ///Get the distance in phi between trigger particle and correlated particle\r
+  Float_t GetDPhi(Float_t dPhi) { \r
+    if ( dPhi < 3*TMath::PiOver2() && dPhi > - TMath::PiOver2() ) return dPhi;\r
+    else return ( (dPhi>0)? dPhi - TMath::TwoPi() : dPhi + TMath::TwoPi() ); \r
+  }\r
+\r
+  ///Get bin limits of various pt bins\r
+  Float_t GetLowerBinLimit(const Int_t bin, const Float_t * const bins) const;\r
+  Float_t GetUpperBinLimit(const Int_t bin, const Float_t * const bins) const;\r
+\r
+  //Get trigger bin for particle carrying given pt\r
+  Int_t GetTriggerBin(Float_t pt) const;\r
+  //Get correlation particle pt bin for particle carrying given pt\r
+  Int_t GetCorrBin(Float_t pt) const;\r
+\r
+\r
+  //Print statistics for histograms\r
+  void PrintStatistics();\r
+\r
+\r
+protected:\r
+\r
+  //Fill histograms\r
+  void FillHistograms(Float_t tPt, Float_t cPt, Float_t dPhi, Float_t dEta, Bool_t isolated);\r
+  //Fill trigger counter histograms\r
+  void FillTriggerCounters(Float_t tPt, Bool_t isolated);\r
+\r
+ private:\r
+  \r
+  TString fName; //name of analysis\r
+\r
+  static const Int_t fNTBins = 3; //Number of trigger pt bins\r
+  static const Int_t fNCBins = 3; //Number of corr particles pt bins\r
+\r
+  TList * fHistograms; //List of histograms\r
+\r
+  TH2F * fHEtaPhiPt[2]; //2D eta phi correlations histogram\r
+  TH1F * fHdEta[2]; //Eta correlations histogram\r
+  TH1F * fHdPhi[2]; //Phi correlations histogram\r
+\r
+  TH1F * fHdPhiBins[2][fNTBins][fNCBins]; //dPhi correlations histograms in several bins\r
+  TH1I * fHNTriggers[2]; //Histograms containing number of triggers in various bins\r
+  \r
+  Float_t fTBins[fNTBins]; ///Array of trigger bin limits\r
+  Float_t fCBins[fNCBins];///Array of corr particle pt bin limits\r
+  \r
+  Float_t fTriggerPt; //Min trigger particle pt\r
+  Float_t fCorrelatedPt; // Min correlation particle pt\r
+\r
+  Int_t fNPhiBins; //Number of bins in phi \r
+  \r
+  //Default constructor prohibited\r
+  AliAnaConvCorrBase(); //not implemented\r
+  AliAnaConvCorrBase(const AliAnaConvCorrBase&); // not implemented\r
+  AliAnaConvCorrBase& operator=(const AliAnaConvCorrBase&); // not implemented\r
+  ClassDef(AliAnaConvCorrBase, 2); // example of analysis\r
+};\r
+\r
+#endif\r
diff --git a/PWG4/GammaConv/ConvCorrelations/AliAnaConvCorrPhoton.cxx b/PWG4/GammaConv/ConvCorrelations/AliAnaConvCorrPhoton.cxx
new file mode 100644 (file)
index 0000000..4d24b43
--- /dev/null
@@ -0,0 +1,77 @@
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project        *
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ *                                                                        *
+ * Primary Author: Svein Lindal <slindal@fys.uio.no>                      *
+ *                                                                        *
+ * 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.                  *
+ **************************************************************************/
+
+/// @file   AliAnaConvCorrPhoton.cxx
+/// @author Svein Lindal
+/// @brief  Class used to fill calculate correlation between photons - tracks
+#include "AliAnaConvCorrPhoton.h"
+#include "AliAODTrack.h"
+#include "TClonesArray.h"
+#include "AliAODConversionParticle.h"
+
+#include <iostream>
+// Gamma - jet correlation analysis task
+// Authors: Svein Lindal
+
+
+using namespace std;
+ClassImp(AliAnaConvCorrPhoton)
+
+//________________________________________________________________________
+AliAnaConvCorrPhoton::AliAnaConvCorrPhoton() :
+AliAnaConvCorrBase("photon_hadron_corr"), 
+  fSkipDecayParticles(kFALSE)
+{
+  //consctructor
+}
+//________________________________________________________________________
+AliAnaConvCorrPhoton::AliAnaConvCorrPhoton(TString name) :
+AliAnaConvCorrBase(name), 
+fSkipDecayParticles(kFALSE)
+{
+  //consctructor
+}
+
+
+//________________________________________________________________________________
+AliAnaConvCorrPhoton::~AliAnaConvCorrPhoton() {
+  //destructor
+}
+
+///__________________________________________________________________________
+void AliAnaConvCorrPhoton::CorrelateWithHadrons(const AliAODConversionParticle * const photon, const TClonesArray * const tracks, const Bool_t isolated, const Bool_t decayParticle) {
+
+
+  if( decayParticle && fSkipDecayParticles ) return;
+
+  FillTriggerCounters(photon->Pt(), isolated);
+  //See header file for documentation
+  if (tracks) {
+      
+    for(int ij = 0; ij < tracks->GetEntriesFast(); ij++) {
+      AliAODTrack * track = dynamic_cast<AliAODTrack*>(tracks->At(ij));
+      if(track) {
+       
+       if ( (track->GetID() == photon->GetTrackLabel(0)) || track->GetID() == photon->GetTrackLabel(1) )   continue;
+       
+       //if (track->Pt() < GetCorrelatedPt() ) continue;
+       
+       FillHistograms(photon->Pt(), track->Pt(), GetDPhi(photon->Phi() - track->Phi()), photon->Eta() - track->Eta(), isolated);
+       
+      }
+    }
+  }
+}
diff --git a/PWG4/GammaConv/ConvCorrelations/AliAnaConvCorrPhoton.h b/PWG4/GammaConv/ConvCorrelations/AliAnaConvCorrPhoton.h
new file mode 100644 (file)
index 0000000..ceec7b1
--- /dev/null
@@ -0,0 +1,43 @@
+/* This file is property of and copyright                                 *\r
+ * ALICE Experiment at CERN, All rights reserved.                         *\r
+ * See cxx source for full Copyright notice                               */\r
+\r
+/// @file   AliAnaConvCorrPhoton.h\r
+/// @author Svein Lindal\r
+/// @brief  Class used to find correlations between photons and charged tracks\r
\r
+#ifndef ALIANACONVCORRPHOTON_CXX\r
+#define ALIANACONVCORRPHOTON_CXX\r
+\r
+#include "AliAnaConvCorrBase.h"\r
+\r
+class AliAODConversionParticle;\r
+class TClonesArray;\r
+\r
+class AliAnaConvCorrPhoton : public AliAnaConvCorrBase {\r
+\r
+public:\r
+\r
+  AliAnaConvCorrPhoton(); \r
+  AliAnaConvCorrPhoton(TString name); \r
+  virtual ~AliAnaConvCorrPhoton();\r
+\r
+  ///Correlation photon with tracks\r
+  virtual void CorrelateWithHadrons(const AliAODConversionParticle * const photon, const TClonesArray * const tracks, const Bool_t isolated, const Bool_t decayParticle);\r
+\r
+  //Process particles identified as pion / eta decay \r
+  void SkipDecayParticles() { fSkipDecayParticles = kTRUE; }\r
+  void DoDecayParticles() { fSkipDecayParticles = kFALSE; }\r
+  \r
+ private:\r
+\r
+  \r
+  Bool_t fSkipDecayParticles; //Process particles identified as pion / eta decay particles\r
+\r
+  AliAnaConvCorrPhoton(const AliAnaConvCorrPhoton&); // not implemented\r
+  AliAnaConvCorrPhoton& operator=(const AliAnaConvCorrPhoton&); // not implemented\r
+  ClassDef(AliAnaConvCorrPhoton, 1); // example of analysis\r
+\r
+};\r
+\r
+#endif\r
diff --git a/PWG4/GammaConv/ConvCorrelations/AliAnaConvCorrPhotonJet.cxx b/PWG4/GammaConv/ConvCorrelations/AliAnaConvCorrPhotonJet.cxx
new file mode 100644 (file)
index 0000000..11626e9
--- /dev/null
@@ -0,0 +1,64 @@
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project        *
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ *                                                                        *
+ * Primary Author: Svein Lindal <slindal@fys.uio.no>                      *
+ *                                                                        *
+ * 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.                  *
+ **************************************************************************/
+
+/// @file   AliAnaConvCorrPhoton.cxx
+/// @author Svein Lindal
+/// @brief  Class used to fill calculate correlation between photons - jets
+
+#include "AliAnaConvCorrPhotonJet.h"
+#include "AliAODTrack.h"
+#include "TClonesArray.h"
+#include "AliAODConversionParticle.h"
+#include "AliAODJet.h"
+
+#include <iostream>
+// Gamma - jet correlation analysis task
+// Authors: Svein Lindal
+
+
+using namespace std;
+ClassImp(AliAnaConvCorrPhotonJet)
+
+//________________________________________________________________________________
+AliAnaConvCorrPhotonJet::AliAnaConvCorrPhotonJet() :
+AliAnaConvCorrBase("photonJet") {
+  //consctructor
+}
+//________________________________________________________________________________
+AliAnaConvCorrPhotonJet::AliAnaConvCorrPhotonJet(TString name) :
+AliAnaConvCorrBase(name) {
+  //consctructor
+}
+
+
+//________________________________________________________________________________
+AliAnaConvCorrPhotonJet::~AliAnaConvCorrPhotonJet() {
+  //destructor
+}
+
+///_______________________________________________________________________________
+void AliAnaConvCorrPhotonJet::CorrelateWithHadrons(const AliAODConversionParticle * const photon, const TClonesArray * const tracks, const Bool_t isolated) {
+
+  //See header file for documentation
+  if (tracks) {
+      
+    for(int ij = 0; ij < tracks->GetEntriesFast(); ij++) {
+      AliAODJet * jet = dynamic_cast<AliAODJet*>(tracks->At(ij));
+      if(jet) {
+       FillHistograms(photon->Pt(), jet->Pt(), GetDPhi(photon->Phi() - jet->Phi()), photon->Eta() - jet->Eta(), isolated);
+      }
+    }
+  }
+}
diff --git a/PWG4/GammaConv/ConvCorrelations/AliAnaConvCorrPhotonJet.h b/PWG4/GammaConv/ConvCorrelations/AliAnaConvCorrPhotonJet.h
new file mode 100644 (file)
index 0000000..ae570ff
--- /dev/null
@@ -0,0 +1,36 @@
+/* This file is property of and copyright                                 *\r
+ * ALICE Experiment at CERN, All rights reserved.                         *\r
+ * See cxx source for full Copyright notice                               */\r
+\r
+/// @file   AliAnaConvCorrPhoton.h\r
+/// @author Svein Lindal\r
+/// @brief  Class used to find correlations between photons and jets\r
+\r
+#ifndef ALIANACONVCORRPHOTONJET_CXX\r
+#define ALIANACONVCORRPHOTONJET_CXX\r
+\r
+#include "AliAnaConvCorrBase.h"\r
+\r
+class AliAODConversionParticle;\r
+class TClonesArray;\r
+\r
+class AliAnaConvCorrPhotonJet : public AliAnaConvCorrBase {\r
+\r
+public:\r
+\r
+  AliAnaConvCorrPhotonJet(); \r
+  AliAnaConvCorrPhotonJet(TString name); \r
+  virtual ~AliAnaConvCorrPhotonJet();\r
+  \r
+  //Correlate photon with jets\r
+  virtual void CorrelateWithHadrons(const AliAODConversionParticle * const photon, const TClonesArray * const jets, const Bool_t isolated);\r
+  \r
+ private:\r
+\r
+  AliAnaConvCorrPhotonJet(const AliAnaConvCorrPhotonJet&); // not implemented\r
+  AliAnaConvCorrPhotonJet& operator=(const AliAnaConvCorrPhotonJet&); // not implemented\r
+  ClassDef(AliAnaConvCorrPhotonJet, 1); // \r
+\r
+};\r
+\r
+#endif\r
diff --git a/PWG4/GammaConv/ConvCorrelations/AliAnaConvCorrPion.cxx b/PWG4/GammaConv/ConvCorrelations/AliAnaConvCorrPion.cxx
new file mode 100644 (file)
index 0000000..5bc7eca
--- /dev/null
@@ -0,0 +1,97 @@
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project        *
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ *                                                                        *
+ * Primary Author: Svein Lindal <slindal@fys.uio.no>                      *
+ *                                                                        *
+ * 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.                  *
+ **************************************************************************/
+
+/// @file   AliAnaConvCorrPion.cxx
+/// @author Svein Lindal
+/// @brief  Class used to run conversion gamma/pion - hadron/jet analysis
+
+
+
+#include "AliAnaConvCorrPion.h"
+#include "AliAODTrack.h"
+#include "TClonesArray.h"
+#include "AliAODConversionParticle.h"
+
+#include <iostream>
+
+
+using namespace std;
+ClassImp(AliAnaConvCorrPion)
+
+//________________________________________________________________________
+AliAnaConvCorrPion::AliAnaConvCorrPion() :
+AliAnaConvCorrBase("pion_hadron_corr") {
+  //consctructor
+}
+//________________________________________________________________________
+AliAnaConvCorrPion::AliAnaConvCorrPion(TString name) :
+AliAnaConvCorrBase(name) {
+  //consctructor
+}
+
+
+//________________________________________________________________________________
+AliAnaConvCorrPion::~AliAnaConvCorrPion() {
+  //destructor
+}
+
+
+///_______________________________________________________________________________
+void AliAnaConvCorrPion::GetTrackLabels(const AliAODConversionParticle * pion, const TClonesArray * photons, Int_t* trackLabels) {
+  ///Get the track labels of the electrons reconstructed as gamma forming the pion
+
+  for(Int_t i = 0; i< 2; i++) {
+    AliAODConversionParticle * gamma = dynamic_cast<AliAODConversionParticle*>(photons->At(pion->GetTrackLabel(i)));
+
+    if(gamma) { 
+      for(Int_t j = 0; j< 2; j++) {
+       cout << "index " << i + j + ((i>=j)?1:0) << " " << gamma->GetTrackLabel(j) << endl;
+       trackLabels[ i*2+ j] = gamma->GetTrackLabel(j);
+      }
+
+    } else {
+      AliGammaConversionAODObject * aodO = dynamic_cast<AliGammaConversionAODObject*>(photons->At(pion->GetTrackLabel(i)));
+      if(aodO) {
+       trackLabels[i*2] = aodO->GetLabel1();
+       trackLabels[i*2 + 1] = aodO->GetLabel2();
+      } else {
+       cout << "AliAnaConvCorrPion::GetTrackLabels() :: Not good!!!"<<endl;
+      }
+    }
+  }
+}
+
+///__________________________________________________________________________
+void AliAnaConvCorrPion::CorrelateWithHadrons(AliAODConversionParticle * pion, const TClonesArray * tracks,  const Bool_t isolated, const Int_t nSpawn, const Int_t * const spawn) {
+  //See header file for documentation
+
+  FillTriggerCounters(pion->Pt(), isolated);
+
+
+  if (tracks) {
+    for(int ij = 0; ij < tracks->GetEntriesFast(); ij++) {
+      AliAODTrack * track = dynamic_cast<AliAODTrack*>(tracks->At(ij));
+      if(track) {
+       if(pion->IsMySpawn(track->GetID(), nSpawn, spawn)) continue;
+       
+       if (track->Pt() < GetCorrelatedPt() ) continue;
+
+       FillHistograms(pion->Pt(), track->Pt(), GetDPhi(pion->Phi() - track->Phi()), pion->Eta() - track->Eta(), isolated);
+
+      }
+    }
+  }
+}
diff --git a/PWG4/GammaConv/ConvCorrelations/AliAnaConvCorrPion.h b/PWG4/GammaConv/ConvCorrelations/AliAnaConvCorrPion.h
new file mode 100644 (file)
index 0000000..6cec4d3
--- /dev/null
@@ -0,0 +1,40 @@
+/* This file is property of and copyright                                 *\r
+ * ALICE Experiment at CERN, All rights reserved.                         *\r
+ * See cxx source for full Copyright notice                               */\r
+\r
+/// @file   AliAnaConvCorrPion.h\r
+/// @author Svein Lindal\r
+/// @brief  Class used to find correlations between pions and charged tracks\r
+\r
+\r
+#ifndef ALIANACONVCORRPION_CXX\r
+#define ALIANACONVCORRPION_CXX\r
+\r
+#include "AliAnaConvCorrBase.h"\r
+\r
+class AliAODConversionParticle;\r
+class TClonesArray;\r
+\r
+class AliAnaConvCorrPion : public AliAnaConvCorrBase {\r
+\r
+public:\r
+\r
+  AliAnaConvCorrPion(); \r
+  AliAnaConvCorrPion(TString name);\r
+  virtual ~AliAnaConvCorrPion();\r
+\r
+  //Correlate pions with charged tracks\r
+  virtual void CorrelateWithHadrons(AliAODConversionParticle * pion, const TClonesArray * tracks, const Bool_t isolated, const Int_t nSpawn, const Int_t * const spawn );\r
+  \r
+ private:\r
+\r
+  //Get array of track labels of the 4 decay electrons (2gamma * 2 electrons)\r
+  void GetTrackLabels(const AliAODConversionParticle * pion, const TClonesArray * photons, Int_t* trackLabels);\r
+\r
+  AliAnaConvCorrPion(const AliAnaConvCorrPion&); // not implemented\r
+  AliAnaConvCorrPion& operator=(const AliAnaConvCorrPion&); // not implemented\r
+  ClassDef(AliAnaConvCorrPion, 1); // example of analysis\r
+\r
+};\r
+\r
+#endif\r
diff --git a/PWG4/GammaConv/ConvCorrelations/AliAnaConvIsolation.cxx b/PWG4/GammaConv/ConvCorrelations/AliAnaConvIsolation.cxx
new file mode 100644 (file)
index 0000000..75a6dc0
--- /dev/null
@@ -0,0 +1,257 @@
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project        *
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ *                                                                        *
+ * Primary Author: Svein Lindal <slindal@fys.uio.no>                      *
+ *                                                                        *
+ * 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.                  *
+ **************************************************************************/
+
+/// @file   AliAnalysisTaskGammaJet.cxx
+/// @author Svein Lindal
+/// @brief  Class used to run isolation studies of conversion gamma/pions
+
+
+#include "AliAnaConvIsolation.h"
+#include "AliAODTrack.h"
+
+#include "TObject.h"
+#include "TClonesArray.h"
+#include "TH2F.h"
+#include "TList.h"
+#include "AliAODConversionParticle.h"
+
+
+#include <iostream>
+
+// Gamma - jet correlation analysis task
+// Author: Svein Lindal
+
+
+using namespace std;
+ClassImp(AliAnaConvIsolation)
+
+//________________________________________________________________________
+AliAnaConvIsolation::AliAnaConvIsolation () : TObject(),
+  fIsoCurve(NULL),
+  fCurveFunction("0.1*x"),
+  fConeSize(0), 
+  fMinPt(0.1),
+  fMaxPtThreshold(0),
+  fSumPtThreshold(0),
+  fMaxPtFraction(0),
+  fSumPtFraction(0),
+  fHistograms(NULL),
+  fHistogramMaxPt(50)  
+{
+  fHistograms = new TList();
+  fHistograms->SetName("Isolation_histo");
+}
+
+//________________________________________________________________________
+AliAnaConvIsolation::AliAnaConvIsolation(Float_t coneSize, Float_t maxPtThreshold, Float_t sumPtThreshold, Float_t maxPtFraction, Float_t sumPtFraction) :
+  TObject(), 
+  fIsoCurve(NULL),
+  fCurveFunction("0.1*x"),
+  fConeSize(coneSize), 
+  fMinPt(0.1),
+  fMaxPtThreshold(maxPtThreshold),
+  fSumPtThreshold(sumPtThreshold),
+  fMaxPtFraction(maxPtFraction),
+  fSumPtFraction(sumPtFraction),
+  fHistograms(NULL),
+  fHistogramMaxPt(50)
+{
+
+}
+
+
+//________________________________________________________________________________
+AliAnaConvIsolation::~AliAnaConvIsolation() {
+
+
+}
+
+
+//________________________________________________________________________
+void AliAnaConvIsolation::CreateHistograms()
+{
+
+  fHistograms = new TList();
+  fHistograms->SetName(Form("Isolation_histo_cone_%f_maxPt_%f_sumPt_%f", fConeSize, fSumPtThreshold, fMaxPtThreshold));
+
+  fIsoCurve = new TF1("Isolation_curve", fCurveFunction.Data(), 0, 100);
+  fHistograms->Add(fIsoCurve);
+
+  cout << "Creatin isolation histograms conesize :" << fConeSize << endl;
+
+  //Create histograms add, to outputlis
+  for(Int_t i = 0; i < 2; i++){
+    fhMaxPtInCone[i] = new TH2F(Form("fhMaxPtInCone_%s_%f", (i==0)? "nonIso" : "isolated", fConeSize), 
+                               Form("Max pt nonIso particle in cone %f vs candidate pt", fConeSize), 
+                               200, 0, fHistogramMaxPt, 200, 0, fHistogramMaxPt);
+    fHistograms->Add(fhMaxPtInCone[i]);
+    
+    fhSumPtInCone[i] = new TH2F(Form("fhSumPtInCone_%s_%f",  (i==0)? "nonIso" : "isolated", fConeSize), 
+                            Form("Sum pt in cone %f vs candidate pt %s", fConeSize,  (i==0)? "nonIsoay" : "isolated"), 
+                            200, 0, fHistogramMaxPt, 200, 0, fHistogramMaxPt);
+    fHistograms->Add(fhSumPtInCone[i]);
+
+    fhSumPtVsMaxPt[i] = new TH2F(Form("fhSumPtVsMaxPt_%s_%f",  (i==0)? "nonIso" : "isolated", fConeSize), 
+                                Form("fhSumPtVsMaxPt_%s_%f",  (i==0)? "nonIso" : "isolated", fConeSize), 
+                                200, 0, fHistogramMaxPt, 200, 0, fHistogramMaxPt);
+    fHistograms->Add(fhSumPtVsMaxPt[i]);
+  }
+
+  for(Int_t iIso = 0; iIso < 2; iIso++){
+    fhPtCandidates[iIso] = new TH1F(Form("fhPtCandidates_%s_%f", (iIso==0)? "nonIso" : "isolated", fConeSize),
+                                   Form("Pt of %s candidates, cone size %f", (iIso==0)? "nonIsolated" : "isolated", fConeSize),
+                                200, 0 , fHistogramMaxPt);
+    fhPtCandidates[iIso]->GetXaxis()->SetTitle("P_{T} (GeV/c)");
+    fhPtCandidates[iIso]->GetYaxis()->SetTitle("dN/dP_{T} (c/GeV)");
+    fhPtCandidates[iIso]->SetMarkerStyle(kFullCircle);
+    fHistograms->Add(fhPtCandidates[iIso]);
+  }
+
+  // for(int iDec = 0; iDec < 2; iDec++) {
+  //   for(int iIso = 0; iIso < 2; iIso++) {
+
+  //     fHistSumPt[iIso][iDec] = new TH1F(Form("fHistSumPt_%f_%s_%s", fConeSize, (iIso==0)?"nonIso":"isolated" , (iDec==0)?"noDec":"decay" ),  
+  //                                   Form("P_{T} distribution cone %f %s %s", fConeSize, (iIso==0)?"nonIso":"isolated" , (iDec==0)?"noDec":"decay" ), 
+  //                                150, 0.1, 50);
+  //     fHistSumPt[iIso][iDec]->GetXaxis()->SetTitle("P_{T} (GeV/c)");
+  //     fHistSumPt[iIso][iDec]->GetYaxis()->SetTitle("dN/dP_{T} (c/GeV)");
+  //     fHistSumPt[iIso][iDec]->SetMarkerStyle(kFullCircle);
+  //     fHistograms->Add(fHistSumPt[iIso][iDec]);
+     
+      
+  //     fHistMaxPt[iIso][iDec] = new TH1F(Form("fHistMaxPt_%f_%s_%s", fConeSize, (iIso==0)?"nonIso":"isolated" , (iDec==0)?"noDec":"decay" ),  
+  //                                   Form("P_{T} distribution cone %f %s %s", fConeSize, (iIso==0)?"nonIso":"isolated" , (iDec==0)?"noDec":"decay" ), 
+  //                                150, 0.1, 50);
+  //     fHistMaxPt[iIso][iDec]->GetXaxis()->SetTitle("P_{T} (GeV/c)");
+  //     fHistMaxPt[iIso][iDec]->GetYaxis()->SetTitle("dN/dP_{T} (c/GeV)");
+  //     fHistMaxPt[iIso][iDec]->SetMarkerStyle(kFullCircle);
+  //     fHistograms->Add(fHistMaxPt[iIso][iDec]);
+     
+  //   }
+  // }
+
+
+  for(Int_t iIso = 0; iIso < 2; iIso++){
+    fhTrackMult[iIso] = new TH1F(Form("fhTrackMult_%s_%f", (iIso==0)? "nonIso" : "isolated", fConeSize),
+                                   Form("Pt of %s candidates, cone size %f", (iIso==0)? "nonIsolated" : "isolated", fConeSize),
+                                150, 0 , 150);
+    fhTrackMult[iIso]->GetXaxis()->SetTitle("n tracks in event");
+    fhTrackMult[iIso]->GetYaxis()->SetTitle("dN/dNTracks");
+    fhTrackMult[iIso]->SetMarkerStyle(kFullCircle);
+    fHistograms->Add(fhTrackMult[iIso]);
+  }
+
+}
+
+
+//_________________________________________________________________________
+Bool_t AliAnaConvIsolation::IsIsolated(AliAODConversionParticle * particle, const TClonesArray * const tracks, const Int_t nSpawn, const Int_t * const spawn, Bool_t &leading) {
+  //See header file for documentation
+
+  leading = kTRUE;
+
+  Float_t ptSum = 0.0;
+  Float_t ptMax = 0.0;
+
+  for(int it = 0; it < tracks->GetEntriesFast(); it++) {
+    AliAODTrack * track = dynamic_cast<AliAODTrack*>(tracks->At(it));
+
+    if (track) {
+
+      if(track->Pt() < fMinPt) continue;
+
+      ///Ignore tracks that are grandchildren of pion
+      if ( particle->IsMySpawn(track->GetID(), nSpawn, spawn)) 
+       continue;
+      
+      
+      if ( IsInCone(particle->Eta() - track->Eta(), particle->Phi() - track->Phi(), fConeSize) ) {
+       ptSum += track->Pt();
+       if(track->Pt() > ptMax) ptMax = track->Pt();
+       if(track->Pt() > particle->Pt()) leading = kFALSE;
+      }
+    } else {
+      cout << "Bad track"<<endl;
+    }
+  }
+  
+
+  Bool_t isolated = EvaluateIsolationCriteria( ptSum, particle->Pt());
+
+  FillHistograms(particle->Pt(), ptMax, ptSum, isolated, tracks->GetEntriesFast());
+
+  return isolated;
+
+}
+
+
+//_________________________________________________________________________
+Bool_t AliAnaConvIsolation::IsIsolated(const AliAODConversionParticle * const particle, const TClonesArray * const tracks, Bool_t &leading ) {
+  //See header file for documentation
+
+  leading = kTRUE;
+
+  Float_t ptSum = 0.0;
+  Float_t ptMax = 0.0;
+
+  for(int it = 0; it < tracks->GetEntriesFast(); it++) {
+  
+    AliAODTrack * track = dynamic_cast<AliAODTrack*>(tracks->At(it));
+   
+    if (track) {
+    
+      if(track->Pt() < fMinPt) continue;
+      
+      if ( (track->GetID() == particle->GetTrackLabel(0)) || track->GetID() == particle->GetTrackLabel(1) )  
+       continue;
+      
+      if ( IsInCone(particle->Eta() - track->Eta(), particle->Phi() - track->Phi(), fConeSize) ) {
+       ptSum += track->Pt();
+       if(track->Pt() > ptMax) ptMax = track->Pt();
+       if(track->Pt() > particle->Pt()) leading = kFALSE;
+      }
+    } else {
+      cout << "Bad track"<<endl;
+    }
+  }
+  
+
+  Bool_t isolated = EvaluateIsolationCriteria( ptSum, particle->Pt());
+
+  FillHistograms(particle->Pt(), ptMax, ptSum, isolated, tracks->GetEntriesFast());
+
+  
+  return isolated;
+
+}
+
+///___________________________________________________________________________
+void AliAnaConvIsolation::FillHistograms(Float_t pt, Float_t ptMax, Float_t ptSum, Bool_t isolated, Int_t nTracks) {
+  
+  fhMaxPtInCone[isolated]->Fill(pt, ptMax);
+  fhSumPtInCone[isolated]->Fill(pt, ptSum);
+  fhSumPtVsMaxPt[isolated]->Fill(ptMax, ptSum);
+  fhPtCandidates[isolated]->Fill(pt);
+  fhTrackMult[isolated]->Fill(nTracks);
+}
+
+
+///_____________________________________________________________________________
+Bool_t AliAnaConvIsolation::EvaluateIsolationCriteria(Float_t ptSum, Float_t pt) const {
+
+  return (ptSum < fIsoCurve->Eval(pt));
+
+}
diff --git a/PWG4/GammaConv/ConvCorrelations/AliAnaConvIsolation.h b/PWG4/GammaConv/ConvCorrelations/AliAnaConvIsolation.h
new file mode 100644 (file)
index 0000000..af29e4b
--- /dev/null
@@ -0,0 +1,118 @@
+/* This file is property of and copyright                                 *\r
+ * ALICE Experiment at CERN, All rights reserved.                         *\r
+ * See cxx source for full Copyright notice                               */\r
+\r
+/// @file   AliAnalysisTaskGammaJet.h\r
+/// @author Svein Lindal\r
+/// @brief  Class used to run isolation studies of conversion gamma/pions\r
\r
+\r
+#ifndef ALIANACONVISOLATION_CXX\r
+#define ALIANACONVISOLATION_CXX\r
+\r
+#include "TObject.h"\r
+#include "Rtypes.h"\r
+#include "TF1.h"\r
+class TH2F;\r
+class TH1F;\r
+class AliAODConversionParticle;\r
+class TClonesArray;\r
+class TList;\r
+\r
+class AliAnaConvIsolation : public TObject {\r
+\r
+public:\r
+  \r
+  AliAnaConvIsolation(); \r
+  AliAnaConvIsolation(Float_t coneSize, Float_t maxPtThreshold, Float_t sumPtThreshold, Float_t maxPtFraction, Float_t sumPtFraction);\r
+  virtual ~AliAnaConvIsolation();\r
+  \r
+\r
+  void CreateHistograms();\r
+\r
+\r
+  ///Set And get cone size\r
+  void SetConeSize(Float_t cs) {fConeSize = cs;}\r
+  Float_t GetConeSize() const {return fConeSize;}\r
+\r
+\r
+  //Set and get max pt threshold\r
+  void SetMaxPtThreshold(Float_t cs) {fMaxPtThreshold = cs;}\r
+  Float_t GetPtThreshold() const {return fMaxPtThreshold;}\r
+\r
+\r
+  //Set and get sum pt threshold\r
+  void SetSumPtThreshold(Float_t cs) {fSumPtThreshold = cs;}\r
+  Float_t GetPtSumThreshold() const {return fSumPtThreshold;}\r
+\r
+  //Set and get max Pt fraction threshold\r
+  void SetMaxPtFraction(Float_t cs) {fMaxPtFraction = cs;}\r
+  Float_t GetPtFraction() const {return fMaxPtFraction;}\r
+\r
+  //Set and get sum pt fraction threshold\r
+  void SetSumPtFraction(Float_t cs) {fSumPtFraction = cs;}\r
+  Float_t GetPtSumFraction() const {return fSumPtFraction;}\r
+\r
+  //Set min pt for a particle to be counted in bg\r
+  void SetMinPt( Float_t minpt) {fMinPt = minpt; }\r
+\r
+  //Get isolation curve\r
+  TF1 * GetIsolationCurve() const { return fIsoCurve; }\r
+\r
+  //Set function of isolation curve\r
+  void SetIsolationCurve(TString  curve) { \r
+    fCurveFunction = curve;\r
+  }\r
+\r
+  //Fill histograms\r
+  void FillHistograms(Float_t pt, Float_t ptMax, Float_t ptSum, Bool_t isolated, Int_t nTracks);\r
+\r
+  //Get list of histograms\r
+  TList * GetHistograms() const { return fHistograms;}\r
+\r
+  //Is particle isolated\r
+  Bool_t IsIsolated( const AliAODConversionParticle * const particle, const TClonesArray * const tracks, Bool_t &leading);\r
+  Bool_t IsIsolated( AliAODConversionParticle * const particle, const TClonesArray * const tracks, const Int_t nSpawn, const Int_t * const spawn, Bool_t &leading );\r
+\r
+ private:\r
+\r
+  //Is eta - phi distance smaller than conesize ?\r
+  Bool_t IsInCone(Float_t dEta, Float_t dPhi, Float_t coneSize) const {\r
+    return ( (dEta*dEta + dPhi*dPhi) < coneSize*coneSize);\r
+  }\r
+\r
+  ///Evaluate whether particle is isolated according to criterie\r
+  Bool_t EvaluateIsolationCriteria(Float_t ptSum, Float_t pt) const;\r
+\r
+  TF1 * fIsoCurve; ///Curve defining if particle is isolated or not \r
+  TString fCurveFunction; ///Funtion defining curve\r
+\r
+  Float_t fConeSize; //Size of isolation cone\r
+  Float_t fMinPt; //min pt for bg particles\r
+  Float_t fMaxPtThreshold; //max pt threshold\r
+  Float_t fSumPtThreshold; //sum pt threhold\r
+  Float_t fMaxPtFraction;  //max pt fraction threshold\r
+  Float_t fSumPtFraction; //sum pt fraction threshold\r
+\r
+  TList * fHistograms; //list of histograms\r
+\r
+  TH2F * fhMaxPtInCone[2]; //histogram of max pt in cone\r
+  TH2F * fhSumPtInCone[2]; //histogram of sum pt in cone\r
+  TH2F * fhSumPtVsMaxPt[2];//sum pt vs max pt\r
+  \r
+  // TH1F * fHistSumPt[2][2]; \r
+  // TH1F * fHistMaxPt[2][2];\r
+  \r
+  TH1F * fhPtCandidates[2]; //pt distribution of isolation candidates\r
+  TH1F * fhTrackMult[2];    //Track multiplicity of events with / wo isolated particles\r
+  \r
+\r
+  Float_t fHistogramMaxPt; //Upper pt limit in histograms\r
+\r
+\r
+  AliAnaConvIsolation(const AliAnaConvIsolation&); // not implemented\r
+  AliAnaConvIsolation& operator=(const AliAnaConvIsolation&); // not implemented\r
+  ClassDef(AliAnaConvIsolation, 2); // example of analysis\r
+};\r
+\r
+#endif\r
diff --git a/PWG4/GammaConv/ConvCorrelations/AliAnalysisTaskGammaJet.cxx b/PWG4/GammaConv/ConvCorrelations/AliAnalysisTaskGammaJet.cxx
new file mode 100644 (file)
index 0000000..3ca941d
--- /dev/null
@@ -0,0 +1,503 @@
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project        *
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ *                                                                        *
+ * Primary Author: Svein Lindal <slindal@fys.uio.no>                      *
+ *                                                                        *
+ * 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.                  *
+ **************************************************************************/
+
+/// @file   AliAnalysisTaskGammaJet.cxx
+/// @author Svein Lindal
+/// @brief  Class used to run conversion gamma/pion - hadron/jet analysis
+
+
+#include <iostream>
+#include "TChain.h"
+#include "TTree.h"
+#include "TH1F.h"
+#include "TCanvas.h"
+#include "TString.h"
+#include "TObjArray.h"
+
+
+#include "AliAnalysisTask.h"
+#include "AliAnalysisManager.h"
+#include "AliAnalysisTaskGammaJet.h"
+
+#include "AliESDEvent.h"
+#include "AliESDCaloCluster.h"
+#include "AliESDInputHandler.h"
+
+#include "AliAODPWG4ParticleCorrelation.h"
+#include "AliAODEvent.h"
+#include "AliAODHandler.h"
+#include "AliAODCaloCluster.h"
+#include "AliGammaConversionAODObject.h"
+#include "AliAODConversionParticle.h"
+#include "AliAODJet.h"
+
+#include "AliAODInputHandler.h"
+
+#include "AliAnaConvIsolation.h"
+
+#include "AliAnaConvCorrPhoton.h"
+#include "AliAnaConvCorrPhotonJet.h"
+#include "AliAnaConvCorrPion.h"
+// Gamma - jet correlation analysis task
+// Authors: Svein Lindal
+
+
+using namespace std;
+
+ClassImp(AliAnalysisTaskGammaJet)
+
+//________________________________________________________________________
+AliAnalysisTaskGammaJet::AliAnalysisTaskGammaJet() : 
+AliAnalysisTaskSE(), 
+  fOutputList(NULL), 
+  fDeltaAODFileName("AliAODGammaConversion.root"),
+  fConversionCutString("GammaConv"),
+  fAnaIsolation(NULL), 
+  fAnaIsolationArray(NULL), 
+  fAnaPionArray(NULL), 
+  fAnaPhotonArray(NULL),
+  fAnaPhotonJetArray(NULL),
+  fMinPt(3.0), 
+  fMinNTracks(20)
+{
+  // Dummy Constructor
+}
+
+//________________________________________________________________________________
+AliAnalysisTaskGammaJet::~AliAnalysisTaskGammaJet() {
+  //Destructor
+}
+
+
+//________________________________________________________________________
+AliAnalysisTaskGammaJet::AliAnalysisTaskGammaJet(const char *name) : 
+  AliAnalysisTaskSE(name), 
+  fOutputList(0), 
+  fDeltaAODFileName("AliAODGammaConversion.root"),
+  fConversionCutString("GammaConv"),
+  fAnaIsolation(NULL),
+  fAnaIsolationArray(NULL),
+  fAnaPionArray(NULL),
+  fAnaPhotonArray(NULL),
+  fAnaPhotonJetArray(NULL), 
+  fMinPt(3.0),
+  fMinNTracks(20)
+{
+  // Constructor
+  // Output slot #1 writes into a TList container
+  DefineOutput(1, TList::Class());
+
+  fAnaIsolation = new AliAnaConvIsolation();
+
+  fAnaPionArray = new TObjArray();
+  fAnaPionArray->SetOwner(kTRUE);
+
+  fAnaPhotonArray = new TObjArray();
+  fAnaPhotonArray->SetOwner(kTRUE);
+
+  fAnaPhotonJetArray = new TObjArray();
+  fAnaPhotonJetArray->SetOwner(kTRUE);
+
+  fAnaIsolationArray = new TObjArray();
+  fAnaIsolationArray->SetOwner(kTRUE);
+
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskGammaJet::UserCreateOutputObjects()
+{
+  //Create histograms add, to outputlist
+  fOutputList = new TList();
+  fOutputList->SetOwner(kTRUE);
+
+  fAnaIsolation->CreateHistograms();
+  fOutputList->Add(fAnaIsolation->GetHistograms());
+
+  for(int i = 0; i < fAnaIsolationArray->GetEntriesFast(); i++) {
+    AliAnaConvIsolation * isoAna = dynamic_cast<AliAnaConvIsolation*>(fAnaIsolationArray->At(i));
+    if(isoAna) {
+      isoAna->CreateHistograms();
+      fOutputList->Add(isoAna->GetHistograms());
+    } else {
+      AliError("problem getting ana pointer!!!");
+      cout << i << endl;
+    }
+  }
+
+  for(int i = 0; i < fAnaPhotonArray->GetEntriesFast(); i++) {
+    AliAnaConvCorrPhoton * photonAna = dynamic_cast<AliAnaConvCorrPhoton*>(fAnaPhotonArray->At(i));
+    if(photonAna) {
+      photonAna->CreateHistograms();
+      fOutputList->Add(photonAna->GetHistograms());
+    } else {
+      AliError("problem getting ana pointer!!!");
+    }
+  }
+
+
+  for(int i = 0; i < fAnaPionArray->GetEntriesFast(); i++) {
+    AliAnaConvCorrPion * pionAna = dynamic_cast<AliAnaConvCorrPion*>(fAnaPionArray->At(i));
+    if(pionAna) {
+      pionAna->CreateHistograms();
+      fOutputList->Add(pionAna->GetHistograms());
+    } else {
+      AliError("problem getting ana pointer!!!");
+    }
+  }
+
+  for(int i = 0; i < fAnaPhotonJetArray->GetEntriesFast(); i++) {
+    AliAnaConvCorrPhotonJet * jetAna = dynamic_cast<AliAnaConvCorrPhotonJet*>(fAnaPhotonJetArray->At(i));
+    if(jetAna) {
+      jetAna->CreateHistograms();
+      fOutputList->Add(jetAna->GetHistograms());
+    } else {
+      AliError("problem getting jet  ana pointer!!!");
+    }
+  }
+  
+
+  PostData(1, fOutputList);
+
+
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskGammaJet::UserExec(Option_t *) 
+{
+  //Inherited from AliAnalysisTaskSE
+
+  ///Get AOD event
+  AliAODEvent * aodEvent = GetAODEvent();
+  if(!aodEvent) {
+    AliError("No AOD event!!");
+    return;
+  }
+
+  TClonesArray * photons = GetConversionGammas(aodEvent);
+  if(!photons) {
+    AliError("No Conversion gamma!!");
+    return;
+  }
+
+  TClonesArray * pions = GetConversionPions(aodEvent);
+  if(!pions) {
+    AliError("No Conversion gamma!!");
+    return;
+  }
+
+  if(!((Entry() )%10000)) {
+    AliInfo(Form("%s ----> Processing event # %lld", CurrentFileName(), Entry()));
+    AliInfo(Form("%d %d", photons->GetEntriesFast(), pions->GetEntriesFast()));
+  }
+
+
+ if(aodEvent->GetNumberOfTracks() < fMinNTracks) return;
+
+  if(photons->GetEntriesFast() > aodEvent->GetNumberOfTracks()) {
+    AliError(Form("more conv gamma than tracks, ntracks %d, nconvGamma %d:  ", aodEvent->GetNumberOfTracks(), photons->GetEntriesFast()));
+    return;
+  } else if(photons->GetEntriesFast() > 0) {
+    
+    ProcessConvGamma(photons, pions, aodEvent->GetTracks());
+    ProcessPions(pions, photons, aodEvent->GetTracks());
+  } 
+
+       
+
+  PostData(1, fOutputList);
+
+
+        
+}
+
+
+
+
+//______________________________________________________________________________________________
+void AliAnalysisTaskGammaJet::ProcessCalorimeters( const AliAODEvent * const aodEvent ) {
+  //See header file for documentation
+  TClonesArray * clusters = aodEvent->GetCaloClusters();
+  
+
+  for(int ic = 0; ic < clusters->GetEntriesFast(); ic++) {
+    AliAODCaloCluster * cluster = dynamic_cast<AliAODCaloCluster*>(clusters->At(ic));
+    if (!cluster) { 
+      AliError(Form("Error getting cluster"));
+      continue;
+    }
+
+
+    if (cluster->GetNCells() < 6) continue;
+    if (cluster->GetEmcCpvDistance() < 15) continue;
+
+    TLorentzVector tlvec;
+    
+    AliAODVertex * vertex = aodEvent->GetPrimaryVertex();
+    Double_t vertexPosition[3];
+    vertex->GetXYZ(vertexPosition);
+    cluster->GetMomentum(tlvec, vertexPosition);
+    //if (tlvec.Pt() < GetMinPt()) continue; 
+    
+  }
+  
+}
+
+//___________________________________________________________________________________________
+void AliAnalysisTaskGammaJet::ProcessConvGamma( const TClonesArray * convGamma, const TClonesArray * const pions, const TClonesArray * tracks ) {
+  //See header file for documentation
+  
+
+  for (Int_t iPhot = 0; iPhot < convGamma->GetEntriesFast(); iPhot++) {
+    Bool_t delP = kFALSE;
+    AliAODConversionParticle * photon = dynamic_cast<AliAODConversionParticle*>(convGamma->At(iPhot));
+    if(!photon) {
+      AliGammaConversionAODObject * aodO = dynamic_cast<AliGammaConversionAODObject*>(convGamma->At(iPhot));
+      if (!aodO) {
+       AliError(Form("ERROR: Could not receive ga %d\n", iPhot));
+       continue;
+      }
+      
+      photon = new AliAODConversionParticle(aodO);
+      delP = kTRUE;
+    } 
+    
+    if(photon->Pt() < fMinPt) {
+      if(delP) delete photon;
+      continue;
+    }
+    
+    Bool_t leading = kTRUE;
+    Bool_t decayPion = IsDecayPion(iPhot, pions);
+
+    for(Int_t i = 0; i < fAnaIsolationArray->GetEntriesFast(); i ++) {
+      AliAnaConvIsolation * isoAna = dynamic_cast<AliAnaConvIsolation*>(fAnaIsolationArray->At(i));
+      isoAna->IsIsolated(photon, tracks, leading);
+    }
+
+    Bool_t isolated = fAnaIsolation->IsIsolated(photon, tracks, leading);
+    if(leading) {
+      for(Int_t i = 0; i < fAnaPhotonArray->GetEntriesFast(); i ++) {
+       AliAnaConvCorrPhoton * ana = static_cast<AliAnaConvCorrPhoton*>(fAnaPhotonArray->At(i));
+       if(ana && tracks) {
+         ana->CorrelateWithHadrons(photon, tracks, isolated, decayPion);
+       } 
+      }
+      TClonesArray * jets = GetAODEvent()->GetJets();
+      if(jets) {
+       for(Int_t i = 0; i < fAnaPhotonJetArray->GetEntriesFast(); i ++) {
+         AliAnaConvCorrPhotonJet * ana = static_cast<AliAnaConvCorrPhotonJet*>(fAnaPhotonJetArray->At(i));
+         if(ana && tracks) {
+           ana->CorrelateWithHadrons(photon, jets, isolated);
+         } 
+       }
+      } else {
+       cout << "No jets "<<endl;
+      }
+    } 
+    if (photon && delP) delete photon;
+  } // 
+}
+
+///______________________________________________________________________________________________
+void AliAnalysisTaskGammaJet::ProcessPions( const TClonesArray * const pions, const TClonesArray * const photons, const TClonesArray * const tracks) {
+  //See header file for documentation
+
+  for (Int_t iPi = 0; iPi < pions->GetEntriesFast(); iPi++) {
+    Bool_t delP = kFALSE;
+    AliAODConversionParticle * pion = dynamic_cast<AliAODConversionParticle*>(pions->At(iPi));
+    if(!pion) {
+      AliGammaConversionAODObject * aodO = dynamic_cast<AliGammaConversionAODObject*>(pions->At(iPi));
+      if (!aodO) {
+       AliError(Form("ERROR: Could not receive ga %d\n", iPi));
+       continue;
+      }
+      
+      pion = new AliAODConversionParticle(aodO);
+      delP = kTRUE;
+    } 
+
+
+    if(pion->Pt() < fMinPt) {
+      if(delP) delete pion;
+      continue;
+    }
+
+    
+    Int_t trackLabels[4] = {-1, -1, -1, -1};
+    GetPionGrandChildren(pion, photons, trackLabels);
+    Bool_t leading = kTRUE;
+
+    for(Int_t i = 0; i < fAnaIsolationArray->GetEntriesFast(); i ++) {
+      AliAnaConvIsolation * isoAna = dynamic_cast<AliAnaConvIsolation*>(fAnaIsolationArray->At(i));
+      isoAna->IsIsolated(pion, tracks, 4, trackLabels, leading);
+    }
+
+    Bool_t isolated = fAnaIsolation->IsIsolated(pion, tracks, 4, trackLabels, leading);
+    if(leading) {
+      for(Int_t i = 0; i < fAnaPionArray->GetEntriesFast(); i ++) {
+       AliAnaConvCorrPion * ana = dynamic_cast<AliAnaConvCorrPion*>(fAnaPionArray->At(i));
+       ana->CorrelateWithHadrons(pion, tracks, isolated, 4, trackLabels );
+      }
+    } 
+    if (delP) delete pion;
+  } // 
+
+
+}
+
+///_______________________________________________________________________________________________
+Bool_t AliAnalysisTaskGammaJet::IsDecayPion(Int_t iPhot, const TClonesArray * const pions) {
+  //See header file for documentation
+
+  for(int ip = 0; ip < pions->GetEntriesFast(); ip++) {
+    AliAODConversionParticle * pion = dynamic_cast<AliAODConversionParticle*>(pions->At(ip));
+    if(pion) {
+      if(pion->GetLabel1() == iPhot || pion->GetLabel2() == iPhot) 
+       
+       return kTRUE;
+    } else {
+      AliGammaConversionAODObject * aodPion = dynamic_cast<AliGammaConversionAODObject*>(pions->At(ip));
+      if(aodPion) {
+       if(aodPion->GetLabel1() == iPhot || aodPion->GetLabel2() == iPhot) 
+         return kTRUE;
+      } else {
+       AliError("pion corrupted!");
+      }
+    }
+  }
+
+  return kFALSE;
+}
+
+
+///_______________________________________________________________________________
+Bool_t AliAnalysisTaskGammaJet::UserNotify() {
+    //See header file for documentation
+
+    AliInfo(Form("%s ----> Processing event # %lld", CurrentFileName(), Entry()));
+
+    AliAnaConvCorrPhoton * phJetAna = dynamic_cast<AliAnaConvCorrPhoton*>(fAnaPhotonArray->At(0));
+    phJetAna->PrintStatistics();
+
+    return kTRUE;
+
+}
+
+///_______________________________________________________________________________
+void AliAnalysisTaskGammaJet::NotifyRun() {
+  //See header file for documentation
+  
+  AliInfo(Form("we have a new run: %d", fCurrentRunNumber));
+  cout << Form("we have a new run: %d", fCurrentRunNumber) << endl;
+  
+}
+
+///_______________________________________________________________________________
+void AliAnalysisTaskGammaJet::GetPionGrandChildren(const AliAODConversionParticle * pion, const TClonesArray * photons, Int_t* trackLabels) {
+  ///Get the track labels of the electrons reconstructed as gamma forming the pion
+
+  for(Int_t i = 0; i< 2; i++) {
+    AliAODConversionParticle * gamma = dynamic_cast<AliAODConversionParticle*>(photons->At(pion->GetTrackLabel(i)));
+
+    if(gamma) { 
+      for(Int_t j = 0; j< 2; j++) {
+       trackLabels[ i*2+ j] = gamma->GetTrackLabel(j);
+      }
+
+    } else {
+      AliGammaConversionAODObject * aodO = dynamic_cast<AliGammaConversionAODObject*>(photons->At(pion->GetTrackLabel(i)));
+      if(aodO) {
+       trackLabels[i*2] = aodO->GetLabel1();
+       trackLabels[i*2 + 1] = aodO->GetLabel2();
+      } else {
+       cout << "AliAnaConvCorrPion::GetTrackLabels() :: Not good!!!"<<endl;
+      }
+    }
+  }
+}
+
+
+
+
+//_____________________________________________________________________
+void AliAnalysisTaskGammaJet::Terminate(Option_t *) {
+  // Draw result to the screen
+  // Called once at the end of the query
+}
+
+//_____________________________________________________________________
+AliAODEvent * AliAnalysisTaskGammaJet::GetAODEvent() {
+  //Get the AOD event from whereever it might be
+  AliAODEvent * aodEvent = dynamic_cast<AliAODEvent*>(InputEvent());
+  if(!aodEvent) {
+    aodEvent = AODEvent();
+  }
+  
+  return aodEvent;
+
+}
+
+//_____________________________________________________________________
+TClonesArray * AliAnalysisTaskGammaJet::GetConversionGammas(const AliAODEvent * aodEvent) {
+
+  //Get Conversion gamma branch of AOD. First try standard AOD
+  TClonesArray * convGamma = dynamic_cast<TClonesArray*>(aodEvent->FindListObject(Form("%s_gamma", fConversionCutString.Data())));
+  
+  //If it's there, send it back
+  if(convGamma)  return convGamma;
+
+
+  //If AOD not in standard file have to locate it in delta AOD
+  if( !(fDeltaAODFileName.Length() > 0)  ) return NULL;
+  
+  AliAODHandler * aodHandler = dynamic_cast<AliAODHandler*>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()); 
+  if(aodHandler) {
+    AliAODExtension * gExt = dynamic_cast<AliAODExtension*>(aodHandler->GetExtensions()->FindObject(fDeltaAODFileName));
+    if(gExt) {
+      AliAODEvent * gcEvent = gExt->GetAOD();
+      return dynamic_cast<TClonesArray*>(gcEvent->FindListObject(Form("%s_gamma", fConversionCutString.Data())));
+    }
+  }
+
+  cout << "could not find branch " << Form("%s_gamma", fConversionCutString.Data()) << endl; 
+  return NULL;
+}
+
+
+
+///_____________________________________________________________________
+TClonesArray * AliAnalysisTaskGammaJet::GetConversionPions(const AliAODEvent * aodEvent) {
+
+  //Get Conversion pion branch of AOD. First try standard AOD
+  TClonesArray * convGamma = dynamic_cast<TClonesArray*>(aodEvent->FindListObject(Form("%s_Pi0", fConversionCutString.Data()) ));
+  
+  //If it's there, send it back
+  if(convGamma)  return convGamma;
+
+
+  //If AOD not in standard file have to locate it in delta AOD
+  if( !(fDeltaAODFileName.Length() > 0)  ) return NULL;
+  
+  AliAODHandler * aodHandler = dynamic_cast<AliAODHandler*>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()); 
+  if(aodHandler) {
+    AliAODExtension * gExt = dynamic_cast<AliAODExtension*>(aodHandler->GetExtensions()->FindObject(fDeltaAODFileName));
+    if(gExt) {
+      AliAODEvent * gcEvent = gExt->GetAOD();
+      return dynamic_cast<TClonesArray*>(gcEvent->FindListObject(Form("%s_Pi0", fConversionCutString.Data())));
+    }
+  }  
+  return NULL;
+}
diff --git a/PWG4/GammaConv/ConvCorrelations/AliAnalysisTaskGammaJet.h b/PWG4/GammaConv/ConvCorrelations/AliAnalysisTaskGammaJet.h
new file mode 100644 (file)
index 0000000..9203e9c
--- /dev/null
@@ -0,0 +1,105 @@
+/* This file is property of and copyright                                 *\r
+ * ALICE Experiment at CERN, All rights reserved.                         *\r
+ * See cxx source for full Copyright notice                               */\r
+\r
+/// @file   AliAnalysisTaskGammaJet.h\r
+/// @author Svein Lindal\r
+/// @brief  Class used to run isolation studies of conversion gamma / pions\r
\r
+\r
+\r
+#ifndef ALIANALYSISTASKGAMMAJET_H\r
+#define ALIANALYSISTASKGAMMAJET_H\r
+\r
+\r
+\r
+class TH1F;\r
+class AliESDEvent;\r
+class AliGammaConversionAODObject;\r
+class AliAODConversionParticle;\r
+class AliAODPWG4ParticleCorrelation;\r
+class AliAODPWG4Particle;\r
+class TObjArray;\r
+class TString;\r
+class TClonesArray;\r
+\r
+\r
+#include "AliAnaConvIsolation.h"\r
+#include "AliAnalysisTaskSE.h"\r
+\r
+class AliAnalysisTaskGammaJet : public AliAnalysisTaskSE {\r
+\r
+public:\r
\r
+  AliAnalysisTaskGammaJet(); \r
+  AliAnalysisTaskGammaJet(const char *name);\r
+  virtual ~AliAnalysisTaskGammaJet();\r
+  \r
+  virtual void   UserCreateOutputObjects();\r
+  virtual void   UserExec(Option_t *option);\r
+  virtual void   Terminate(Option_t *);\r
+\r
+  void SetDeltaAODFileName(TString string) { fDeltaAODFileName = string;}\r
\r
+  AliAnaConvIsolation * GetIsolation() const {return fAnaIsolation;}\r
+  void SetIsolation( AliAnaConvIsolation * isolation) { fAnaIsolation = isolation; }\r
+\r
+  void SetConversionCutId(TString cut) { fConversionCutString = Form("GammaConv_%s", cut.Data());}\r
+\r
+  void SetMinPt(Float_t minpt) { fMinPt = minpt;}\r
+  void SetMinNTracks(Int_t nTracks) { fMinNTracks = nTracks; }\r
+\r
+  void AddIsolationAna(TObject * isoAna) { fAnaIsolationArray->Add(isoAna);}\r
+  void AddPhotonHadronAna(TObject * ana) { fAnaPhotonArray->Add(ana);}\r
+  void AddPhotonJetAna(TObject * ana) { fAnaPhotonJetArray->Add(ana);}\r
+  void AddPionHadronAna(TObject * ana) { fAnaPionArray->Add(ana);}\r
+\r
+  void GetPionGrandChildren(const AliAODConversionParticle * const pion, const TClonesArray * photons, Int_t* trackLabels);\r
+\r
+ private:\r
+\r
+  void NotifyRun();\r
+  Bool_t UserNotify();\r
+\r
+\r
+  //Get the AOD event from whereever it might be accessible\r
+  AliAODEvent * GetAODEvent();\r
+\r
+  //Get Conversion gammas branch\r
+  TClonesArray * GetConversionGammas(const AliAODEvent * aodEvent);\r
+  TClonesArray * GetConversionPions(const AliAODEvent * aodEvent);\r
+\r
+  //Process conv gamma\r
+  void ProcessConvGamma( const TClonesArray * const convGamma, const TClonesArray * const pions, const TClonesArray * const tracks);\r
+  void ProcessPions( const TClonesArray * const pions, const TClonesArray * const photons, const TClonesArray * const tracks);\r
+\r
+  //Process calorimeters\r
+  void ProcessCalorimeters( const AliAODEvent * const aodEvent );\r
+  \r
+\r
+  //Does any pions have given photon (iPhot) index listed as daughter\r
+  Bool_t IsDecayPion(Int_t iPhot, const TClonesArray * const pions); //see above\r
+\r
+\r
+  TList       *fOutputList;       //! Output list\r
+  TString     fDeltaAODFileName;  //! File where Gamma Conv AOD is located, if not in default AOD\r
+  TString fConversionCutString;   //! The cut string of the conversion analysis used to produce input AOD\r
+\r
+\r
+  AliAnaConvIsolation * fAnaIsolation;\r
+\r
+  TObjArray * fAnaIsolationArray; //!Array of isolation analysis objects\r
+  TObjArray * fAnaPionArray;      //!Array of pion - hadron ana objects\r
+  TObjArray * fAnaPhotonArray;    //!Array of photon - hadron ana objects\r
+  TObjArray * fAnaPhotonJetArray; //!Array of photon - jet ana objects\r
+\r
+  Float_t fMinPt; //Minimum pt for leading particles\r
+  Int_t fMinNTracks; //Minimum number of tracks in event\r
+  \r
+  AliAnalysisTaskGammaJet(const AliAnalysisTaskGammaJet&); // not implemented\r
+  AliAnalysisTaskGammaJet& operator=(const AliAnalysisTaskGammaJet&); // not implemented\r
+  \r
+  ClassDef(AliAnalysisTaskGammaJet, 4); // example of analysis\r
+};\r
+\r
+#endif\r
diff --git a/PWG4/GammaConv/ConvCorrelations/macros/ConfigGammaJet.C b/PWG4/GammaConv/ConvCorrelations/macros/ConfigGammaJet.C
new file mode 100644 (file)
index 0000000..deaec9f
--- /dev/null
@@ -0,0 +1,102 @@
+
+void ConfigGammaJet (TString inputfile = "files.txt" ) {
+
+  Int_t debugLevel = 0;
+  
+  gSystem->Load("libTree.so");
+  gSystem->Load("libPhysics.so");
+  gSystem->Load("libGeom.so");
+  gSystem->Load("libVMC.so");
+  gSystem->Load("libSTEERBase.so");
+  gSystem->Load("libESD.so");
+  gSystem->Load("libAOD.so"); 
+  gSystem->Load("libANALYSIS");
+  gSystem->Load("libANALYSISalice");
+  gSystem->Load("libJETAN.so");
+  gSystem->Load("libPWG4GammaConv.so");
+  gSystem->AddIncludePath("-I$ALICE_ROOT/include");
+
+
+  TChain * chain = createAODChain (inputfile);
+  if(!chain) {
+    cout << "Errror in chain cration"<<endl;
+    return -1;
+  }
+  
+  AliAODInputHandler * inpHandler = new AliAODInputHandler();
+  inpHandler->AddFriend("AliAODGammaConversion.root");
+  
+  AliAnalysisManager *mgr  = new AliAnalysisManager("GammaJet Manager", "GammaJet Manager");
+  mgr->SetInputEventHandler  (inpHandler);
+  mgr->SetDebugLevel(debugLevel);
+
+  AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
+  AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("histos", TList::Class(), AliAnalysisManager::kOutputContainer, "histos.root");
+
+  // AliAnaConvIsolation * iso3 = new AliAnaConvIsolation(0.7, 0.5, 0.5, 0.5, 0.5);
+  // gammaJetAna->AddIsolationAna(dynamic_cast<TObject*>(iso3));
+
+
+  AliAnalysisTaskGammaJet * gammaJetAna = new AliAnalysisTaskGammaJet("gamma jet analysis");
+  gammaJetAna->SetDebugLevel(0);
+  gammaJetAna->SetConversionCutId("90022670901120321036000000090");
+  gammaJetAna->SetMinNTracks(0);
+  mgr->AddTask(gammaJetAna);
+
+  AliAnaConvIsolation * isolation = gammaJetAna->GetIsolation();
+  isolation->SetMaxPtThreshold(0.7);
+  isolation->SetSumPtThreshold(2.5);
+  isolation->SetSumPtFraction(0.1);
+  isolation->SetConeSize(0.4);
+  AliAnaConvCorrPhoton * ghAna = new AliAnaConvCorrPhoton("photon_wDec");
+  ghAna->DoDecayParticles();
+  gammaJetAna->AddPhotonHadronAna(dynamic_cast<TObject*>(ghAna));
+
+  AliAnaConvCorrPhoton * ghAna2 = new AliAnaConvCorrPhoton("photon_noDec");
+  ghAna2->SkipDecayParticles();
+  gammaJetAna->AddPhotonHadronAna(dynamic_cast<TObject*>(ghAna2));
+
+  AliAnaConvCorrPion * gPiAna = new AliAnaConvCorrPion("pionHadron");
+  gammaJetAna->AddPionHadronAna(dynamic_cast<TObject*>(gPiAna));
+
+  inpHandler->AddFriend("AliAODs.pwg4jets.root");
+  AliAnaConvCorrPhotonJet* gJetAna = new AliAnaConvCorrPhotonJet("photonJet");
+  gJetAna->SetTriggerPt(0.0);
+  gJetAna->SetCorrelatedPt(0.0);
+  gammaJetAna->AddPhotonJetAna(gJetAna);
+
+  // gROOT->LoadMacro("AddTaskGammaJet.C");
+  // AliAnalysisTaskGammaJet * gj2 =  AddTaskGammaJet("test", 3.0, 40, 0.4);
+  // isolation = gj2->GetIsolation();
+  // isolation->SetMinPt(0.3);
+
+
+  mgr->ConnectInput  (gammaJetAna,  0, cinput1  );
+  mgr->ConnectOutput (gammaJetAna,  1, coutput2 );
+  
+  mgr->InitAnalysis();
+  mgr->PrintStatus();
+  mgr->StartAnalysis("local",chain);
+  //mgr->StartAnalysis("local",chain, 10000);
+
+}
+
+
+///_________________________________________________________________________________________
+TChain * createAODChain (TString inputfile = "allfiles.txt") {
+
+  chain = new TChain("aodTree");
+
+  TString line;
+  ifstream in;
+  in.open(inputfile.Data());
+  while (in.good()) {
+    in >> line;
+    if (line.Length() == 0) continue;
+    chain->Add(line.Data());
+  }
+
+  return chain;
+  
+}
index 8e43bc9c722e26f0ce09919b3bef16c041ff1160..ca31e4cf45bd11a202e2e1b9879dd80ce664657f 100644 (file)
 #pragma link C++ class AliGammaConversionAODObject+;
 #pragma link C++ class AliAODConversionParticle+;
 #pragma link C++ class AliGammaConversionBGHandler+;
-#pragma link C++ class AliAnalysisTaskGammaJet+;
 #pragma link C++ class AliAnalysisTaskGammaConvDalitz+;
 #pragma link C++ class AliAnalysisTaskGCPartToPWG4Part+;
+#pragma link C++ class AliAnalysisTaskGammaJet+;
+#pragma link C++ class AliAnaConvIsolation+;
+#pragma link C++ class AliAnaConvCorrBase++;
+#pragma link C++ class AliAnaConvCorrPion++;
+#pragma link C++ class AliAnaConvCorrPhoton++;
+#pragma link C++ class AliAnaConvCorrPhotonJet++;
+
 #endif