]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
jet framework from Marta/Salvatore
authorloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 12 Jun 2013 20:06:12 +0000 (20:06 +0000)
committerloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 12 Jun 2013 20:06:12 +0000 (20:06 +0000)
PWG/CMakelibPWGEMCAL.pkg
PWG/EMCAL/AliAnalysisTaskEmcalDev.cxx [new file with mode: 0644]
PWG/EMCAL/AliAnalysisTaskEmcalDev.h [new file with mode: 0644]
PWG/EMCAL/AliClusterContainer.cxx [new file with mode: 0644]
PWG/EMCAL/AliClusterContainer.h [new file with mode: 0644]
PWG/EMCAL/AliEmcalContainer.cxx [new file with mode: 0644]
PWG/EMCAL/AliEmcalContainer.h [new file with mode: 0644]
PWG/EMCAL/AliParticleContainer.cxx [new file with mode: 0644]
PWG/EMCAL/AliParticleContainer.h [new file with mode: 0644]
PWG/PWGEMCALLinkDef.h

index 5e654034372181bff8ae0d82229f8574e2b9014a..98e77e387d4015ded6cb3dd72370937cbcf31c98 100644 (file)
 set ( SRCS 
  EMCAL/AliAnalysisTaskEMCALClusterizeFast.cxx
  EMCAL/AliAnalysisTaskEmcal.cxx
+ EMCAL/AliAnalysisTaskEmcalDev.cxx
+ EMCAL/AliClusterContainer.cxx
  EMCAL/AliEMCALClusterParams.cxx
  EMCAL/AliEmcalClusTrackMatcherTask.cxx
  EMCAL/AliEmcalCompatTask.cxx
+ EMCAL/AliEmcalContainer.cxx
  EMCAL/AliEmcalEsdTpcTrackTask.cxx
  EMCAL/AliEmcalMCTrackSelector.cxx
  EMCAL/AliEmcalParticle.cxx
@@ -44,6 +47,7 @@ set ( SRCS
  EMCAL/AliEmcalTrackPropagatorTask.cxx
  EMCAL/AliEsdSkimTask.cxx
  EMCAL/AliEsdTrackExt.cxx
+ EMCAL/AliParticleContainer.cxx
  EMCAL/AliPicoTrack.cxx
 )
 
diff --git a/PWG/EMCAL/AliAnalysisTaskEmcalDev.cxx b/PWG/EMCAL/AliAnalysisTaskEmcalDev.cxx
new file mode 100644 (file)
index 0000000..b241bac
--- /dev/null
@@ -0,0 +1,747 @@
+// $Id$
+//
+// Emcal base analysis task.
+//
+// Author: S.Aiola, M. Verweij
+
+#include "AliAnalysisTaskEmcalDev.h"
+
+#include <TClonesArray.h>
+#include <TList.h>
+#include <TObject.h>
+#include <TH1F.h>
+
+#include "AliAODEvent.h"
+#include "AliAnalysisManager.h"
+#include "AliCentrality.h"
+#include "AliEMCALGeometry.h"
+#include "AliESDEvent.h"
+#include "AliEmcalParticle.h"
+#include "AliEventplane.h"
+#include "AliInputEventHandler.h"
+#include "AliLog.h"
+#include "AliMCParticle.h"
+#include "AliVCluster.h"
+#include "AliVEventHandler.h"
+#include "AliVParticle.h"
+
+#include "AliParticleContainer.h"
+#include "AliClusterContainer.h"
+
+ClassImp(AliAnalysisTaskEmcalDev)
+
+//________________________________________________________________________
+AliAnalysisTaskEmcalDev::AliAnalysisTaskEmcalDev() : 
+  AliAnalysisTaskSE("AliAnalysisTaskEmcalDev"),
+  fAnaType(kTPC),
+  fForceBeamType(kNA),
+  fGeneralHistograms(kFALSE),
+  fInitialized(kFALSE),
+  fCreateHisto(kTRUE),
+  fTracksName(),
+  fCaloName(),
+  fCaloCellsName(),
+  fMinCent(-999),
+  fMaxCent(-999),
+  fMinVz(-999),
+  fMaxVz(-999),
+  fOffTrigger(AliVEvent::kAny),
+  fTrigClass(),
+  fNbins(500),
+  fMinBinPt(0),
+  fMaxBinPt(250),
+  fClusPtCut(0.15),
+  fTrackPtCut(0.15),
+  fTrackMinEta(-0.9),
+  fTrackMaxEta(0.9),
+  fTrackMinPhi(-10),
+  fTrackMaxPhi(10),
+  fClusTimeCutLow(-10),
+  fClusTimeCutUp(10),
+  fMinPtTrackInEmcal(0),
+  fEventPlaneVsEmcal(-1),
+  fMinEventPlane(-10),
+  fMaxEventPlane(10),
+  fCentEst("V0M"),
+  fTrackBitMap(0),
+  fClusterBitMap(0),
+  fMCTrackBitMap(0),
+  fMCClusterBitMap(0),
+  fMinMCLabel(0),
+  fNcentBins(4),
+  fGeom(0),
+  fTracks(0),
+  fCaloClusters(0),
+  fCaloCells(0),
+  fCent(0),
+  fCentBin(-1),
+  fEPV0(-1.0),
+  fEPV0A(-1.0),
+  fEPV0C(-1.0),
+  fNVertCont(0),
+  fBeamType(kNA),
+  fParticleCollArray(),
+  fClusterCollArray(),
+  fOutput(0),
+  fHistCentrality(0),
+  fHistZVertex(0),
+  fHistEventPlane(0)
+{
+  // Default constructor.
+
+  fVertex[0] = 0;
+  fVertex[1] = 0;
+  fVertex[2] = 0;
+
+  fParticleCollArray.SetOwner(kTRUE);
+  fClusterCollArray.SetOwner(kTRUE);
+
+}
+
+//________________________________________________________________________
+AliAnalysisTaskEmcalDev::AliAnalysisTaskEmcalDev(const char *name, Bool_t histo) : 
+  AliAnalysisTaskSE(name),
+  fAnaType(kTPC),
+  fForceBeamType(kNA),
+  fGeneralHistograms(kFALSE),
+  fInitialized(kFALSE),
+  fCreateHisto(histo),
+  fTracksName(),
+  fCaloName(),
+  fCaloCellsName(),
+  fMinCent(-999),
+  fMaxCent(-999),
+  fMinVz(-999),
+  fMaxVz(-999),
+  fOffTrigger(AliVEvent::kAny),
+  fTrigClass(),
+  fNbins(500),
+  fMinBinPt(0),
+  fMaxBinPt(250),
+  fClusPtCut(0.15),
+  fTrackPtCut(0.15),
+  fTrackMinEta(-0.9),
+  fTrackMaxEta(0.9),
+  fTrackMinPhi(-10),
+  fTrackMaxPhi(10),
+  fClusTimeCutLow(-10),
+  fClusTimeCutUp(10),
+  fMinPtTrackInEmcal(0),
+  fEventPlaneVsEmcal(-1),
+  fMinEventPlane(-10),
+  fMaxEventPlane(10),
+  fCentEst("V0M"),
+  fTrackBitMap(0),
+  fClusterBitMap(0),
+  fMCTrackBitMap(0),
+  fMCClusterBitMap(0),
+  fMinMCLabel(0),
+  fNcentBins(4),
+  fGeom(0),
+  fTracks(0),
+  fCaloClusters(0),
+  fCaloCells(0),
+  fCent(0),
+  fCentBin(-1),
+  fEPV0(-1.0),
+  fEPV0A(-1.0),
+  fEPV0C(-1.0),
+  fNVertCont(0),
+  fBeamType(kNA),
+  fParticleCollArray(),
+  fClusterCollArray(),
+  fOutput(0),
+  fHistCentrality(0),
+  fHistZVertex(0),
+  fHistEventPlane(0)
+{
+  // Standard constructor.
+
+  fVertex[0] = 0;
+  fVertex[1] = 0;
+  fVertex[2] = 0;
+
+  fParticleCollArray.SetOwner(kTRUE);
+  fClusterCollArray.SetOwner(kTRUE);
+
+  if (fCreateHisto) {
+    DefineOutput(1, TList::Class()); 
+  }
+}
+
+//________________________________________________________________________
+AliAnalysisTaskEmcalDev::~AliAnalysisTaskEmcalDev()
+{
+  // Destructor
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskEmcalDev::UserCreateOutputObjects()
+{
+  // Create user output.
+  if (!fCreateHisto)
+    return;
+
+  OpenFile(1);
+  fOutput = new TList();
+  fOutput->SetOwner();
+
+  if (fForceBeamType == kpp)
+    fNcentBins = 1;
+
+  if (!fGeneralHistograms)
+    return;
+
+  fHistCentrality = new TH1F("fHistCentrality","Event centrality distribution", 200, 0, 100);
+  fHistCentrality->GetXaxis()->SetTitle("Centrality (%)");
+  fHistCentrality->GetYaxis()->SetTitle("counts");
+  fOutput->Add(fHistCentrality);
+
+  fHistZVertex = new TH1F("fHistZVertex","Z vertex position", 60, -30, 30);
+  fHistZVertex->GetXaxis()->SetTitle("z");
+  fHistZVertex->GetYaxis()->SetTitle("counts");
+  fOutput->Add(fHistZVertex);
+
+  fHistEventPlane = new TH1F("fHistEventPlane","Event plane", 120, -TMath::Pi(), TMath::Pi());
+  fHistEventPlane->GetXaxis()->SetTitle("event plane");
+  fHistEventPlane->GetYaxis()->SetTitle("counts");
+  fOutput->Add(fHistEventPlane);
+
+  PostData(1, fOutput);
+}
+
+//________________________________________________________________________
+Bool_t AliAnalysisTaskEmcalDev::FillGeneralHistograms()
+{
+  fHistCentrality->Fill(fCent);
+  fHistZVertex->Fill(fVertex[2]);
+  fHistEventPlane->Fill(fEPV0);
+
+  return kTRUE;
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskEmcalDev::UserExec(Option_t *) 
+{
+  // Main loop, called for each event.
+
+  if (!fInitialized)
+    ExecOnce();
+
+  if (!fInitialized)
+    return;
+
+  if (!RetrieveEventObjects())
+    return;
+
+  if (!IsEventSelected()) 
+    return;
+
+  if (fGeneralHistograms && fCreateHisto) {
+    if (!FillGeneralHistograms())
+      return;
+  }
+
+  if (!Run())
+    return;
+
+  if (fCreateHisto) {
+    if (!FillHistograms())
+      return;
+  }
+    
+  if (fCreateHisto && fOutput) {
+    // information for this iteration of the UserExec in the container
+    PostData(1, fOutput);
+  }
+}
+
+//________________________________________________________________________
+Bool_t AliAnalysisTaskEmcalDev::AcceptCluster(AliVCluster *clus, const Int_t c) const
+{
+  // Return true if cluster is accepted.
+
+  if (!clus)
+    return kFALSE;
+
+  AliClusterContainer *cont = GetClusterContainer(c);
+  if(!cont) {
+    AliError(Form("%s:Container %d not found",GetName(),c));
+    return 0;
+  }
+
+  return cont->AcceptCluster(clus);
+
+}
+
+//________________________________________________________________________
+Bool_t AliAnalysisTaskEmcalDev::AcceptTrack(AliVParticle *track, Int_t c) const
+{
+  // Return true if track is accepted.
+
+  if (!track)
+    return kFALSE;
+
+  AliParticleContainer *cont = GetParticleContainer(c);
+  if(!cont) {
+    AliError(Form("%s:Container %d not found",GetName(),c));
+    return 0;
+  }
+
+  return cont->AcceptParticle(track);
+
+  if (!track)
+    return kFALSE;
+
+}
+
+//________________________________________________________________________
+Bool_t AliAnalysisTaskEmcalDev::AcceptEmcalPart(AliEmcalParticle *part) const
+{
+  // Return true if EMCal particle is accepted.
+
+  if (!part)
+    return kFALSE;
+
+  if (part->IsTrack()) {
+    if (part->IsMC()) { 
+      if (part->TestBits(fMCTrackBitMap) != (Int_t)fMCTrackBitMap)
+       return kFALSE;
+    }
+    else {
+      if (part->TestBits(fTrackBitMap) != (Int_t)fTrackBitMap)
+       return kFALSE;
+    }
+
+    if (part->Pt() < fTrackPtCut)
+      return kFALSE;
+
+    if (part->Eta() < fTrackMinEta || part->Eta() > fTrackMaxEta || 
+       part->Phi() < fTrackMinPhi || part->Phi() > fTrackMaxPhi)
+      return kFALSE;
+  }
+
+  if (part->IsCluster()) {
+    if (part->IsMC(fMinMCLabel)) { 
+      if (part->TestBits(fMCClusterBitMap) != (Int_t)fMCClusterBitMap)
+       return kFALSE;
+    }
+    else {
+      if (part->TestBits(fClusterBitMap) != (Int_t)fClusterBitMap)
+       return kFALSE;
+    }
+
+    if (!part->IsEMCAL())
+      return kFALSE;
+
+    if (part->Pt() < fClusPtCut)
+      return kFALSE;
+  }
+
+  return kTRUE;
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskEmcalDev::ExecOnce()
+{
+  // Init the analysis.
+
+  if (!InputEvent()) {
+    AliError(Form("%s: Could not retrieve event! Returning!", GetName()));
+    return;
+  }
+
+  fGeom = AliEMCALGeometry::GetInstance();
+  if (!fGeom) {
+    AliError(Form("%s: Can not create geometry", GetName()));
+    return;
+  }
+
+  if (fEventPlaneVsEmcal >= 0) {
+    Double_t ep = (fGeom->GetArm1PhiMax() + fGeom->GetArm1PhiMin()) / 2 * TMath::DegToRad() + fEventPlaneVsEmcal - TMath::Pi();
+    fMinEventPlane = ep - TMath::Pi() / 4;
+    fMaxEventPlane = ep + TMath::Pi() / 4;
+  }
+
+  //Load all requested track branches - each container knows name already
+  for(Int_t i =0; i<fParticleCollArray.GetEntriesFast(); i++) {
+    AliParticleContainer *cont = static_cast<AliParticleContainer*>(fParticleCollArray.At(i));
+    cont->SetParticleArray(InputEvent());
+  }
+
+  fTracks = GetParticleArray(0);
+  if(!fTracks && fParticleCollArray.GetEntriesFast()>0) {
+    AliError(Form("%s: Could not retrieve first track branch!", GetName()));
+    return;
+  }
+
+  //Load all requested cluster branches - each container knows name already
+  for(Int_t i =0; i<fClusterCollArray.GetEntriesFast(); i++) {
+    AliClusterContainer *cont = static_cast<AliClusterContainer*>(fClusterCollArray.At(i));
+    cont->SetClusterArray(InputEvent());
+  }
+  fCaloClusters = GetClusterArray(0);
+  if(!fCaloClusters && fClusterCollArray.GetEntriesFast()>0) {
+    AliError(Form("%s: Could not retrieve first cluster branch!", GetName()));
+    return;
+  }
+
+  if (!fCaloCellsName.IsNull() && !fCaloCells) {
+    fCaloCells =  dynamic_cast<AliVCaloCells*>(InputEvent()->FindListObject(fCaloCellsName));
+    if (!fCaloCells) {
+      AliError(Form("%s: Could not retrieve cells %s!", GetName(), fCaloCellsName.Data())); 
+      return;
+    }
+  }
+
+
+  fInitialized = kTRUE;
+}
+
+//_____________________________________________________
+AliAnalysisTaskEmcalDev::BeamType AliAnalysisTaskEmcalDev::GetBeamType()
+{
+  // Get beam type : pp-AA-pA
+  // ESDs have it directly, AODs get it from hardcoded run number ranges
+
+  if (fForceBeamType != kNA)
+    return fForceBeamType;
+
+  AliESDEvent *esd = dynamic_cast<AliESDEvent*>(InputEvent());
+  if (esd) {
+    const AliESDRun *run = esd->GetESDRun();
+    TString beamType = run->GetBeamType();
+    if (beamType == "p-p")
+      return kpp;
+    else if (beamType == "A-A")
+      return kAA;
+    else if (beamType == "p-A")
+      return kpA;
+    else
+      return kNA;
+  } else {
+    Int_t runNumber = InputEvent()->GetRunNumber();
+    if ((runNumber >= 136851 && runNumber <= 139517) ||  // LHC10h
+       (runNumber >= 166529 && runNumber <= 170593))    // LHC11h
+    { 
+      return kAA;
+    } 
+    else if ((runNumber>=188365 && runNumber <= 188366) || // LHC12g
+            (runNumber >= 195344 && runNumber <= 196608))  // LHC13b-f
+    {
+      return kpA;
+    } else {
+      return kpp;
+    }
+  }  
+}
+
+//________________________________________________________________________
+Bool_t AliAnalysisTaskEmcalDev::IsEventSelected()
+{
+  // Check if event is selected
+
+  if (fOffTrigger != AliVEvent::kAny) {
+    UInt_t res = 0;
+    const AliESDEvent *eev = dynamic_cast<const AliESDEvent*>(InputEvent());
+    if (eev) {
+      res = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
+    } else {
+      const AliAODEvent *aev = dynamic_cast<const AliAODEvent*>(InputEvent());
+      if (aev) {
+        res = aev->GetHeader()->GetOfflineTrigger();
+      }
+    }
+    if ((res & fOffTrigger) == 0)
+      return kFALSE;
+  }
+
+  if (!fTrigClass.IsNull()) {
+    TString fired;
+    const AliESDEvent *eev = dynamic_cast<const AliESDEvent*>(InputEvent());
+    if (eev) {
+      fired = eev->GetFiredTriggerClasses();
+    } else {
+      const AliAODEvent *aev = dynamic_cast<const AliAODEvent*>(InputEvent());
+      if (aev) {
+        fired = aev->GetFiredTriggerClasses();
+      }
+    }
+    if (!fired.Contains("-B-"))
+      return kFALSE;
+    TObjArray *arr = fTrigClass.Tokenize("|");
+    if (!arr)
+      return kFALSE;
+    Bool_t match = 0;
+    for (Int_t i=0;i<arr->GetEntriesFast();++i) {
+      TObject *obj = arr->At(i);
+      if (!obj)
+        continue;
+      if (fired.Contains(obj->GetName())) {
+        match = 1;
+        break;
+      }
+    }
+    delete arr;
+    if (!match)
+      return kFALSE;
+  }
+
+  if ((fMinCent != -999) && (fMaxCent != -999)) {
+    if (fCent<fMinCent)
+      return kFALSE;
+    if (fCent>fMaxCent)
+      return kFALSE;
+  }
+
+  if ((fMinVz != -999) && (fMaxVz != -999)) {
+    if (fNVertCont == 0 )
+      return kFALSE;
+    Double_t vz = fVertex[2];
+    if (vz<fMinVz)
+      return kFALSE;
+    if (vz>fMaxVz)
+      return kFALSE;
+  }
+
+  if (fMinPtTrackInEmcal > 0 && fTracks && fGeom) { //what is fTracks for? remove?
+    Bool_t trackInEmcalOk = kFALSE;
+    Int_t ntracks = GetNParticles(0);
+    for (Int_t i = 0; i < ntracks; i++) {
+      AliVParticle *track = GetAcceptParticleFromArray(i,0);
+      if(!track)
+       continue;
+      if (track->Eta() < fGeom->GetArm1EtaMin() || track->Eta() > fGeom->GetArm1EtaMax() ||
+         track->Phi() < fGeom->GetArm1PhiMin() * TMath::DegToRad() || track->Phi() > fGeom->GetArm1PhiMax() * TMath::DegToRad())
+       continue;
+      if (track->Pt() > fMinPtTrackInEmcal) {
+       trackInEmcalOk = kTRUE;
+       break;
+      }
+    }
+    if (!trackInEmcalOk)
+      return kFALSE;
+  }
+
+
+  if (!(fEPV0 > fMinEventPlane && fEPV0 <= fMaxEventPlane) &&
+      !(fEPV0 + TMath::Pi() > fMinEventPlane && fEPV0 + TMath::Pi() <= fMaxEventPlane) &&
+      !(fEPV0 - TMath::Pi() > fMinEventPlane && fEPV0 - TMath::Pi() <= fMaxEventPlane)) 
+    return kFALSE;
+
+
+  return kTRUE;
+}
+
+//________________________________________________________________________
+TClonesArray *AliAnalysisTaskEmcalDev::GetArrayFromEvent(const char *name, const char *clname)
+{
+  // Get array from event.
+
+  TClonesArray *arr = 0;
+  TString sname(name);
+  if (!sname.IsNull()) {
+    arr = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(sname));
+    if (!arr) {
+      AliWarning(Form("%s: Could not retrieve array with name %s!", GetName(), name)); 
+      return 0;
+    }
+  } else {
+    return 0;
+  }
+
+  if (!clname)
+    return arr;
+
+  TString objname(arr->GetClass()->GetName());
+  TClass cls(objname);
+  if (!cls.InheritsFrom(clname)) {
+    AliWarning(Form("%s: Objects of type %s in %s are not inherited from %s!", 
+                    GetName(), cls.GetName(), name, clname)); 
+    return 0;
+  }
+  return arr;
+}
+
+//________________________________________________________________________
+Bool_t AliAnalysisTaskEmcalDev::RetrieveEventObjects()
+{
+  // Retrieve objects from event.
+
+  fVertex[0] = 0;
+  fVertex[1] = 0;
+  fVertex[2] = 0;
+  fNVertCont = 0;
+
+  const AliVVertex *vert = InputEvent()->GetPrimaryVertex();
+  if (vert) {
+    vert->GetXYZ(fVertex);
+    fNVertCont = vert->GetNContributors();
+  }
+
+  fBeamType = GetBeamType();
+
+  if (fBeamType == kAA || fBeamType == kpA ) {
+    AliCentrality *aliCent = InputEvent()->GetCentrality();
+    if (aliCent) {
+      fCent = aliCent->GetCentralityPercentile(fCentEst.Data()); 
+      if      (fCent >=  0 && fCent <   10) fCentBin = 0;
+      else if (fCent >= 10 && fCent <   30) fCentBin = 1;
+      else if (fCent >= 30 && fCent <   50) fCentBin = 2;
+      else if (fCent >= 50 && fCent <= 100) fCentBin = 3; 
+      else {
+       AliWarning(Form("%s: Negative centrality: %f. Assuming 99", GetName(), fCent));
+       fCentBin = 3;
+      }
+    } else {
+      AliWarning(Form("%s: Could not retrieve centrality information! Assuming 99", GetName()));
+      fCentBin = 3;
+    }
+    AliEventplane *aliEP = InputEvent()->GetEventplane();
+    if (aliEP) {
+      fEPV0  = aliEP->GetEventplane("V0" ,InputEvent());
+      fEPV0A = aliEP->GetEventplane("V0A",InputEvent());
+      fEPV0C = aliEP->GetEventplane("V0C",InputEvent());
+    } else {
+      AliWarning(Form("%s: Could not retrieve event plane information!", GetName()));
+    }
+  } else {
+    fCent = 99;
+    fCentBin = 0;
+  }
+
+  return kTRUE;
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskEmcalDev::AddParticleContainer(const char *n) {
+
+  // Add particle container
+  // will be called in AddTask macro
+
+  AliParticleContainer *cont = 0x0;
+  cont = new AliParticleContainer();
+  cont->SetArrayName(n);
+  TString contName = cont->GetArrayName();
+  fParticleCollArray.Add(cont);
+
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskEmcalDev::AddClusterContainer(const char *n) {
+
+  // Add cluster container
+  // will be called in AddTask macro
+
+  AliClusterContainer *cont = 0x0;
+  cont = new AliClusterContainer();
+  cont->SetArrayName(n);
+
+  fClusterCollArray.Add(cont);
+
+}
+
+//________________________________________________________________________
+AliParticleContainer* AliAnalysisTaskEmcalDev::GetParticleContainer(Int_t i) const {
+  // Get i^th particle container
+
+  if(i<0 || i>fParticleCollArray.GetEntriesFast()) return 0;
+  AliParticleContainer *cont = static_cast<AliParticleContainer*>(fParticleCollArray.At(i));
+  return cont;
+}
+
+//________________________________________________________________________
+AliClusterContainer* AliAnalysisTaskEmcalDev::GetClusterContainer(Int_t i) const {
+  // Get i^th cluster container
+
+  if(i<0 || i>fClusterCollArray.GetEntriesFast()) return 0;
+  AliClusterContainer *cont = static_cast<AliClusterContainer*>(fClusterCollArray.At(i));
+  return cont;
+}
+
+//________________________________________________________________________
+TClonesArray* AliAnalysisTaskEmcalDev::GetParticleArray(Int_t i) const {
+  // Get i^th TClonesArray with AliVParticle
+
+  AliParticleContainer *cont = GetParticleContainer(i);
+  if(!cont) {
+    AliError(Form("%s: Particle container %d not found",GetName(),i));
+    return 0;
+  }
+  TString contName = cont->GetArrayName();
+  return cont->GetArray();
+
+}
+
+//________________________________________________________________________
+TClonesArray* AliAnalysisTaskEmcalDev::GetClusterArray(Int_t i) const {
+  // Get i^th TClonesArray with AliVCluster
+
+  AliClusterContainer *cont = GetClusterContainer(i);
+  if(!cont) {
+    AliError(Form("%s:Cluster container %d not found",GetName(),i));
+    return 0;
+  }
+  return cont->GetArray();
+
+}
+
+//________________________________________________________________________
+AliVParticle* AliAnalysisTaskEmcalDev::GetAcceptParticleFromArray(Int_t p, Int_t c) const {
+  // Get particle p if accepted from  container c
+  // If particle not accepted return 0
+
+  AliParticleContainer *cont = GetParticleContainer(c);
+  if(!cont) {
+    AliError(Form("%s: Particle container %d not found",GetName(),c));
+    return 0;
+  }
+  AliVParticle *vp = cont->GetAcceptParticle(p);
+
+  return vp;
+  
+}
+
+//________________________________________________________________________
+AliVCluster* AliAnalysisTaskEmcalDev::GetAcceptClusterFromArray(Int_t cl, Int_t c) const {
+  // Get particle p if accepted from  container c
+  // If particle not accepted return 0
+
+  AliClusterContainer *cont = GetClusterContainer(c);
+  if(!cont) {
+    AliError(Form("%s: Cluster container %d not found",GetName(),c));
+    return 0;
+  }
+  AliVCluster *vc = cont->GetAcceptCluster(cl);
+
+  return vc;
+  
+}
+
+//________________________________________________________________________
+Int_t AliAnalysisTaskEmcalDev::GetNParticles(Int_t i) const {
+  // Get number of entries in particle array i
+
+  AliParticleContainer *cont = GetParticleContainer(i);
+  if(!cont) {
+    AliError(Form("%s: Particle container %d not found",GetName(),i));
+    return 0;
+  }
+  return cont->GetNEntries();
+
+}
+
+//________________________________________________________________________
+Int_t AliAnalysisTaskEmcalDev::GetNClusters(Int_t i) const {
+  // Get number of entries in cluster array i
+
+  AliClusterContainer *cont = GetClusterContainer(i);
+  if(!cont) {
+    AliError(Form("%s: Cluster container %d not found",GetName(),i));
+    return 0;
+  }
+  return cont->GetNEntries();
+
+}
+
diff --git a/PWG/EMCAL/AliAnalysisTaskEmcalDev.h b/PWG/EMCAL/AliAnalysisTaskEmcalDev.h
new file mode 100644 (file)
index 0000000..4b8523a
--- /dev/null
@@ -0,0 +1,171 @@
+#ifndef ALIANALYSISTASKEMCALDEV_H
+#define ALIANALYSISTASKEMCALDEV_H
+
+// $Id$
+
+class TClonesArray;
+class TString;
+class TList;
+class AliEmcalParticle;
+class AliMCParticle;
+class AliVCluster;
+class AliVTrack;
+class AliVParticle;
+class AliVCaloCells;
+class TH1F;
+class AliEMCALGeometry;
+class AliParticleContainer;
+class AliClusterContainer;
+
+#include "Rtypes.h"
+
+#include "AliAnalysisTaskSE.h"
+
+class AliAnalysisTaskEmcalDev : public AliAnalysisTaskSE {
+ public:
+  
+  enum EmcalAnaType {
+    kTPC       = 0,     // TPC acceptance
+    kEMCAL     = 1,     // EMCal acceptance
+    kUser      = 2,     // User defined acceptance
+  };
+
+  enum BeamType {
+    kNA       = -1,
+    kpp       = 0,
+    kAA       = 1,
+    kpA       = 2
+  };
+
+  AliAnalysisTaskEmcalDev();
+  AliAnalysisTaskEmcalDev(const char *name, Bool_t histo=kFALSE); 
+  virtual ~AliAnalysisTaskEmcalDev();
+
+  void                        UserExec(Option_t *option);
+  void                        UserCreateOutputObjects();
+
+  void                        SetAnaType(EmcalAnaType type)                         { fAnaType           = type ;                         ; }
+  void                        SetCentRange(Double_t min, Double_t max)              { fMinCent           = min  ; fMaxCent = max          ; }
+  void                        SetClusName(const char *n)                            { fCaloName          = n    ; AddClusterContainer(n);   }
+  void                        SetCaloCellsName(const char *n)                       { fCaloCellsName     = n                              ; }
+  void                        SetClusPtCut(Double_t cut)                            { fClusPtCut         = cut                            ; }
+  void                        SetClusTimeCut(Double_t min, Double_t max)            { fClusTimeCutLow    = min  ; fClusTimeCutUp = max    ; }
+  void                        SetHistoBins(Int_t nbins, Double_t min, Double_t max) { fNbins = nbins; fMinBinPt = min; fMaxBinPt = max    ; }
+  void                        SetOffTrigger(UInt_t t)                               { fOffTrigger        = t                              ; }
+  void                        SetPtCut(Double_t cut)                                { SetClusPtCut(cut)         ; SetTrackPtCut(cut)      ; }
+  void                        SetTrackPtCut(Double_t cut)                           { fTrackPtCut        = cut                            ; }
+  void                        SetTrackEtaLimits(Double_t min, Double_t max)         { fTrackMaxEta       = max  ; fTrackMinEta      = min ; }
+  void                        SetTrackPhiLimits(Double_t min, Double_t max)         { fTrackMaxPhi       = max  ; fTrackMinPhi      = min ; }
+  void                        SetTracksName(const char *n)                          { fTracksName        = n    ; AddParticleContainer(n);  }
+  void                        SetTrigClass(const char *n)                           { fTrigClass         = n                              ; }  
+  void                        SetVzRange(Double_t min, Double_t max)                { fMinVz             = min  ; fMaxVz   = max          ; }
+  void                        SetForceBeamType(BeamType f)                          { fForceBeamType     = f                              ; }
+  void                        SetMakeGeneralHistograms(Bool_t g)                    { fGeneralHistograms = g                              ; }
+  void                        SetMinPtTrackInEmcal(Double_t min)                    { fMinPtTrackInEmcal = min                            ; }
+  void                        SetEventPlaneVsEmcal(Double_t ep)                     { fEventPlaneVsEmcal = ep                             ; }
+  void                        SetCentralityEstimator(const char *c)                 { fCentEst           = c                              ; }
+  void                        SetTrackBitMap(UInt_t m)                              { fTrackBitMap       = m                              ; }
+  void                        SetClusterBitMap(UInt_t m)                            { fClusterBitMap     = m                              ; }
+  void                        SetParticleBitMap(UInt_t m)                           { fClusterBitMap     = m    ; fTrackBitMap       = m  ; }
+  void                        SetMCTrackBitMap(UInt_t m)                            { fMCTrackBitMap     = m                              ; }
+  void                        SetMCClusterBitMap(UInt_t m)                          { fMCClusterBitMap   = m                              ; }
+  void                        SetMCParticleBitMap(UInt_t m)                         { fMCClusterBitMap   = m    ; fMCTrackBitMap     = m  ; }
+  void                        SetMinMCLabel(Int_t s)                                { fMinMCLabel        = s                              ; }
+
+  void                        AddParticleContainer(const char *n);
+  void                        AddClusterContainer(const char *n);
+
+
+  AliParticleContainer       *GetParticleContainer(const Int_t i)   const;
+  AliClusterContainer        *GetClusterContainer(const Int_t i)    const;
+  void                        RemoveParticleContainer(Int_t i)                      { fParticleCollArray.RemoveAt(i);} 
+  void                        RemoveClusterContainer(Int_t i)                       { fClusterCollArray.RemoveAt(i);} 
+
+
+  TClonesArray               *GetParticleArray(const Int_t i)       const;
+  TClonesArray               *GetClusterArray(const Int_t i)        const;
+
+  AliVParticle               *GetAcceptParticleFromArray(Int_t p, Int_t c) const;
+  AliVCluster                *GetAcceptClusterFromArray(Int_t cl, Int_t c) const;
+
+  Int_t                       GetNParticles(Int_t i) const;
+  Int_t                       GetNClusters(Int_t i)  const;
+
+ protected:
+  Bool_t                      AcceptCluster(AliVCluster        *clus,  Int_t c = 0)  const;
+  Bool_t                      AcceptEmcalPart(AliEmcalParticle *part)                const;
+  Bool_t                      AcceptTrack(AliVParticle         *track, Int_t c = 0)  const;
+  virtual void                ExecOnce();
+  virtual Bool_t              FillGeneralHistograms();
+  virtual Bool_t              FillHistograms()                                     { return kTRUE                 ; }
+  BeamType                    GetBeamType();
+  TClonesArray               *GetArrayFromEvent(const char *name, const char *clname=0);
+  virtual Bool_t              IsEventSelected();
+  virtual Bool_t              RetrieveEventObjects();
+  virtual Bool_t              Run()                                                { return kTRUE                 ; }
+
+  EmcalAnaType                fAnaType;                    // analysis type
+  BeamType                    fForceBeamType;              // forced beam type
+  Bool_t                      fGeneralHistograms;          // whether or not it should fill some general histograms
+  Bool_t                      fInitialized;                // whether or not the task has been already initialized
+  Bool_t                      fCreateHisto;                // whether or not create histograms
+  TString                     fTracksName;                 // name of track collection
+  TString                     fCaloName;                   // name of calo cluster collection
+  TString                     fCaloCellsName;              // name of calo cell collection
+  Double_t                    fMinCent;                    // min centrality for event selection
+  Double_t                    fMaxCent;                    // max centrality for event selection
+  Double_t                    fMinVz;                      // min vertex for event selection
+  Double_t                    fMaxVz;                      // max vertex for event selection
+  UInt_t                      fOffTrigger;                 // offline trigger for event selection
+  TString                     fTrigClass;                  // trigger class name for event selection
+  Int_t                       fNbins;                      // no. of pt bins
+  Double_t                    fMinBinPt;                   // min pt in histograms
+  Double_t                    fMaxBinPt;                   // max pt in histograms
+  Double_t                    fClusPtCut;                  // cut on cluster pt
+  Double_t                    fTrackPtCut;                 // cut on track pt
+  Double_t                    fTrackMinEta;                // cut on track eta
+  Double_t                    fTrackMaxEta;                // cut on track eta
+  Double_t                    fTrackMinPhi;                // cut on track phi
+  Double_t                    fTrackMaxPhi;                // cut on track phi
+  Double_t                    fClusTimeCutLow;             // low time cut for clusters
+  Double_t                    fClusTimeCutUp;              // up time cut for clusters
+  Double_t                    fMinPtTrackInEmcal;          // min pt track in emcal
+  Double_t                    fEventPlaneVsEmcal;          // select events which have a certain event plane wrt the emcal
+  Double_t                    fMinEventPlane;              // minimum event plane value
+  Double_t                    fMaxEventPlane;              // maximum event plane value
+  TString                     fCentEst;                    // name of V0 centrality estimator
+  UInt_t                      fTrackBitMap;                // bit map of accepted tracks (non MC)
+  UInt_t                      fClusterBitMap;              // bit map of accepted clusters (non MC)
+  UInt_t                      fMCTrackBitMap;              // bit map of accepted MC tracks
+  UInt_t                      fMCClusterBitMap;            // bit map of accepted MC clusters
+  Int_t                       fMinMCLabel;                 // minimum MC label value for the tracks/clusters being considered MC particles
+  Int_t                       fNcentBins;                  //!how many centrality bins
+  AliEMCALGeometry           *fGeom;                       //!emcal geometry
+  TClonesArray               *fTracks;                     //!tracks
+  TClonesArray               *fCaloClusters;               //!clusters
+  AliVCaloCells              *fCaloCells;                  //!cells
+  Double_t                    fCent;                       //!event centrality
+  Int_t                       fCentBin;                    //!event centrality bin
+  Double_t                    fEPV0;                       //!event plane V0
+  Double_t                    fEPV0A;                      //!event plane V0A
+  Double_t                    fEPV0C;                      //!event plane V0C
+  Double_t                    fVertex[3];                  //!event vertex
+  Int_t                       fNVertCont;                  //!event vertex number of contributors
+  BeamType                    fBeamType;                   //!event beam type
+
+  TObjArray                   fParticleCollArray;          // particle/track collection array
+  TObjArray                   fClusterCollArray;           // cluster collection array
+
+  TList                      *fOutput;                     //!output list
+
+  TH1F                       *fHistCentrality;             //!Event centrality distribution
+  TH1F                       *fHistZVertex;                //!Z vertex position
+  TH1F                       *fHistEventPlane;             //!Event plane distribution
+
+ private:
+  AliAnalysisTaskEmcalDev(const AliAnalysisTaskEmcalDev&);            // not implemented
+  AliAnalysisTaskEmcalDev &operator=(const AliAnalysisTaskEmcalDev&); // not implemented
+
+  ClassDef(AliAnalysisTaskEmcalDev, 1) // EMCAL base analysis task
+};
+#endif
diff --git a/PWG/EMCAL/AliClusterContainer.cxx b/PWG/EMCAL/AliClusterContainer.cxx
new file mode 100644 (file)
index 0000000..b721bc9
--- /dev/null
@@ -0,0 +1,139 @@
+//
+// Cluster Container
+//
+// Author: M. Verweij
+
+#include <TROOT.h>
+#include <TSystem.h>
+#include <TInterpreter.h>
+
+#include <TChain.h>
+#include <TClonesArray.h>
+#include <TObject.h>
+#include "AliVEvent.h"
+#include "AliLog.h"
+
+#include "AliClusterContainer.h"
+
+ClassImp(AliClusterContainer)
+
+//________________________________________________________________________
+AliClusterContainer::AliClusterContainer():
+  AliEmcalContainer("AliClusterContainer"),
+  fClusPtCut(0.15),
+  fClusTimeCutLow(-10),
+  fClusTimeCutUp(10),
+  fClusterBitMap(0),
+  fMCClusterBitMap(0),
+  fMinMCLabel(0),
+  fVVertex(0)
+{
+  // Default constructor.
+
+  fVertex[0] = 0;
+  fVertex[1] = 0;
+  fVertex[2] = 0;
+
+}
+
+//________________________________________________________________________
+AliClusterContainer::AliClusterContainer(const char *name):
+  AliEmcalContainer(name),
+  fClusPtCut(0.15),
+  fClusTimeCutLow(-10),
+  fClusTimeCutUp(10),
+  fClusterBitMap(0),
+  fMCClusterBitMap(0),
+  fMinMCLabel(0),
+  fVVertex(0)
+{
+  // Standard constructor.
+
+  fVertex[0] = 0;
+  fVertex[1] = 0;
+  fVertex[2] = 0;
+
+}
+
+//________________________________________________________________________
+AliClusterContainer::~AliClusterContainer()
+{
+  // Destructor.
+}
+
+//________________________________________________________________________
+void AliClusterContainer::SetClusterArray(AliVEvent *event) 
+{
+  // Set jet array
+
+  SetArray(event, "AliVCluster");
+
+  fVVertex = event->GetPrimaryVertex();
+  if (fVVertex) {
+    fVVertex->GetXYZ(fVertex);
+  }
+
+}
+
+//________________________________________________________________________
+AliVCluster* AliClusterContainer::GetCluster(Int_t i) const {
+
+  //Get i^th jet in array
+
+  if(i<0 || i>fClArray->GetEntriesFast()) return 0;
+  AliVCluster *vp = static_cast<AliVCluster*>(fClArray->At(i));
+  return vp;
+
+}
+
+//________________________________________________________________________
+AliVCluster* AliClusterContainer::GetAcceptCluster(Int_t i) const {
+  //return pointer to particle if particle is accepted
+
+  AliVCluster *vc = GetCluster(i);
+  if(!vc) return 0;
+
+  if(AcceptCluster(vc))
+    return vc;
+  else {
+    AliDebug(2,"Cluster not accepted.");
+    return 0;
+  }
+}
+
+//________________________________________________________________________
+Bool_t AliClusterContainer::AcceptCluster(AliVCluster *clus) const
+{
+  // Return true if cluster is accepted.
+
+  if (!clus)
+    return kFALSE;
+      
+  if (!clus->IsEMCAL())
+    return kFALSE;
+
+  if (clus->GetLabel() > fMinMCLabel) {
+    if (clus->TestBits(fMCClusterBitMap) != (Int_t)fMCClusterBitMap) {
+      AliDebug(2,"MC Cluster not accepted because of MC bit map.");
+      return kFALSE;
+    }
+  }
+  else {
+    if (clus->TestBits(fClusterBitMap) != (Int_t)fClusterBitMap) {
+      AliDebug(2,"Cluster not accepted because of bit map.");
+      return kFALSE;
+    }
+  }
+
+  if (clus->GetTOF() > fClusTimeCutUp || clus->GetTOF() < fClusTimeCutLow)
+    return kFALSE;
+
+  TLorentzVector nPart;
+  clus->GetMomentum(nPart, const_cast<Double_t*>(fVertex));
+
+  if (nPart.Et() < fClusPtCut)
+    return kFALSE;
+  
+  return kTRUE;
+
+}
diff --git a/PWG/EMCAL/AliClusterContainer.h b/PWG/EMCAL/AliClusterContainer.h
new file mode 100644 (file)
index 0000000..a9e7fae
--- /dev/null
@@ -0,0 +1,61 @@
+#ifndef AliClusterContainer_H
+#define AliClusterContainer_H
+
+//
+// container with name, TClonesArray and cuts for particles
+//
+
+
+class TClonesArray;
+class TString;
+class TList;
+
+class AliVEvent;
+class AliVVertex;
+class AliVCluster;
+
+#include "Rtypes.h"
+#include <TArrayS.h>
+#include "TString.h"
+#include "AliEmcalContainer.h"
+
+
+class AliClusterContainer : public AliEmcalContainer {
+ public:
+  AliClusterContainer();
+  AliClusterContainer(const char *name); 
+  virtual ~AliClusterContainer();
+
+  void SetClusterArray(AliVEvent *event);
+
+  void SetClusPtCut(Double_t cut)                  { fClusPtCut      = cut ; }
+  void SetClusTimeCut(Double_t min, Double_t max)  { fClusTimeCutLow = min ; fClusTimeCutUp = max ; }
+  void SetClusterBitMap(UInt_t m)                  { fClusterBitMap     = m ; }
+  void SetMCClusterBitMap(UInt_t m)                { fMCClusterBitMap   = m ; }
+  void SetMinMCLabel(Int_t s)                      { fMinMCLabel        = s ; }
+
+  AliVCluster                *GetCluster(Int_t i) const;
+  AliVCluster                *GetAcceptCluster(Int_t i)              const;
+  Bool_t                      AcceptCluster(AliVCluster         *vp) const;
+  Int_t                       GetNClusters()                         const   {return GetNEntries();}
+
+ protected:
+  Double_t                    fClusPtCut;                  // cut on cluster pt
+  Double_t                    fClusTimeCutLow;             // low time cut for clusters
+  Double_t                    fClusTimeCutUp;              // up time cut for clusters
+  UInt_t                      fClusterBitMap;              // bit map of accepted clusters (non MC)
+  UInt_t                      fMCClusterBitMap;            // bit map of accepted MC clusters
+  Int_t                       fMinMCLabel;                 // minimum MC label value for the tracks/clusters being considered MC particles
+  const AliVVertex           *fVVertex;                    //!event vertex object
+  Double_t                    fVertex[3];                  //!event vertex array
+
+ private:
+  AliClusterContainer(const AliClusterContainer& obj); // copy constructor
+  AliClusterContainer& operator=(const AliClusterContainer& other); // assignment
+
+  ClassDef(AliClusterContainer,1);
+
+};
+
+#endif
+
diff --git a/PWG/EMCAL/AliEmcalContainer.cxx b/PWG/EMCAL/AliEmcalContainer.cxx
new file mode 100644 (file)
index 0000000..70f9f43
--- /dev/null
@@ -0,0 +1,77 @@
+//
+// Emcal Container Base class
+//
+// Author: M. Verweij
+
+#include <TROOT.h>
+#include <TSystem.h>
+#include <TInterpreter.h>
+
+#include <TChain.h>
+#include <TClonesArray.h>
+#include <TList.h>
+#include <TObject.h>
+#include "AliEmcalJet.h"
+#include "AliVEvent.h"
+#include "AliLog.h"
+
+#include "AliEmcalContainer.h"
+
+ClassImp(AliEmcalContainer)
+
+//________________________________________________________________________
+AliEmcalContainer::AliEmcalContainer():
+  TNamed("AliEmcalContainer","AliEmcalContainer"),
+  fClArray(0),
+  fClArrayName()
+{
+  // Default constructor.
+
+}
+
+//________________________________________________________________________
+AliEmcalContainer::AliEmcalContainer(const char *name):
+  TNamed(name,name),
+  fClArray(0),
+  fClArrayName()
+{
+  // Standard constructor.
+
+}
+
+//________________________________________________________________________
+AliEmcalContainer::~AliEmcalContainer()
+{
+  // Destructor.
+}
+
+//________________________________________________________________________
+void AliEmcalContainer::SetArray(AliVEvent *event, const char *clname) {
+
+  // Get array from event.
+
+  if (!fClArrayName.IsNull() && !fClArray) {
+    fClArray = dynamic_cast<TClonesArray*>(event->FindListObject(fClArrayName));
+    if (!fClArray) {
+      AliWarning(Form("%s: Could not retrieve array with name %s!", GetName(), fClArrayName.Data())); 
+      return;
+    }
+  } else {
+    return;
+  }
+
+  if (!clname)
+    return;
+
+  TString objname(fClArray->GetClass()->GetName());
+  TClass cls(objname);
+  if (!cls.InheritsFrom(clname)) {
+    AliWarning(Form("%s: Objects of type %s in %s are not inherited from %s!", 
+                    GetName(), cls.GetName(), fClArrayName.Data(), clname)); 
+    return;
+  }
+  return;
+
+}
+
diff --git a/PWG/EMCAL/AliEmcalContainer.h b/PWG/EMCAL/AliEmcalContainer.h
new file mode 100644 (file)
index 0000000..11bb6c3
--- /dev/null
@@ -0,0 +1,43 @@
+#ifndef AliEmcalContainer_H
+#define AliEmcalContainer_H
+
+//
+// container with name, TClonesArray
+//
+
+class AliVEvent;
+
+#include <iostream>
+#include "Rtypes.h"
+#include <TArrayS.h>
+#include "TString.h"
+#include "TNamed.h"
+#include "TClonesArray.h"
+
+class AliEmcalContainer : public TNamed {
+ public:
+  AliEmcalContainer();
+  AliEmcalContainer(const char *name); 
+  virtual ~AliEmcalContainer();
+
+  void SetArrayName(const char *n)                 {fClArrayName = n;}
+  TClonesArray               *GetArray()           {return fClArray;}
+  Int_t                       GetNEntries() const  {return fClArray->GetEntriesFast();}
+  TString                     GetArrayName()       {return fClArrayName;}
+
+ protected:
+  void SetArray(AliVEvent *event, const char *clname=0);
+
+  TClonesArray               *fClArray;                 //!TClonesArray
+  TString                     fClArrayName;             // name of branch
+
+ private:
+  AliEmcalContainer(const AliEmcalContainer& obj); // copy constructor
+  AliEmcalContainer& operator=(const AliEmcalContainer& other); // assignment
+
+  ClassDef(AliEmcalContainer,1);
+
+};
+
+#endif
+
diff --git a/PWG/EMCAL/AliParticleContainer.cxx b/PWG/EMCAL/AliParticleContainer.cxx
new file mode 100644 (file)
index 0000000..8d5a0b9
--- /dev/null
@@ -0,0 +1,122 @@
+//
+// Particle Container
+//
+// Author: M. Verweij
+
+#include <TROOT.h>
+#include <TSystem.h>
+#include <TInterpreter.h>
+
+#include <TChain.h>
+#include <TClonesArray.h>
+#include <TObject.h>
+#include "AliVEvent.h"
+#include "AliLog.h"
+
+#include "AliParticleContainer.h"
+
+ClassImp(AliParticleContainer)
+
+//________________________________________________________________________
+AliParticleContainer::AliParticleContainer():
+  AliEmcalContainer("AliParticleContainer"),
+  fParticlePtCut(0.15),
+  fParticleMinEta(-0.9),
+  fParticleMaxEta(0.9),
+  fParticleMinPhi(-10),
+  fParticleMaxPhi(10),
+  fTrackBitMap(0),
+  fMCTrackBitMap(0),
+  fMinMCLabel(0)
+{
+  // Default constructor.
+
+}
+
+//________________________________________________________________________
+AliParticleContainer::AliParticleContainer(const char *name):
+  AliEmcalContainer(name),
+  fParticlePtCut(0.15),
+  fParticleMinEta(-0.9),
+  fParticleMaxEta(0.9),
+  fParticleMinPhi(-10),
+  fParticleMaxPhi(10),
+  fTrackBitMap(0),
+  fMCTrackBitMap(0),
+  fMinMCLabel(0)
+{
+  // Standard constructor.
+
+}
+
+//________________________________________________________________________
+AliParticleContainer::~AliParticleContainer()
+{
+  // Destructor.
+}
+
+//________________________________________________________________________
+void AliParticleContainer::SetParticleArray(AliVEvent *event) 
+{
+  // Set jet array
+
+  SetArray(event, "AliVParticle");
+
+}
+
+//________________________________________________________________________
+AliVParticle* AliParticleContainer::GetParticle(Int_t i) const {
+
+  //Get i^th jet in array
+
+  if(i<0 || i>fClArray->GetEntriesFast()) return 0;
+  AliVParticle *vp = static_cast<AliVParticle*>(fClArray->At(i));
+  return vp;
+
+}
+
+//________________________________________________________________________
+AliVParticle* AliParticleContainer::GetAcceptParticle(Int_t i) const {
+  //return pointer to particle if particle is accepted
+
+  AliVParticle *vp = GetParticle(i);
+  if(!vp) return 0;
+
+  if(AcceptParticle(vp))
+    return vp;
+  else {
+    AliDebug(2,"Particle not accepted.");
+    return 0;
+  }
+}
+
+//________________________________________________________________________
+Bool_t AliParticleContainer::AcceptParticle(AliVParticle *vp) const
+{
+  // Return true if vp is accepted.
+
+  if (!vp)
+    return kFALSE;
+
+  if (TMath::Abs(vp->GetLabel()) > fMinMCLabel) {
+    if(vp->TestBits(fMCTrackBitMap) != (Int_t)fMCTrackBitMap) {
+      AliDebug(2,"MC particle not accepted because of MC bit map.");
+      return kFALSE;
+    }
+  }
+  else {
+    if(vp->TestBits(fTrackBitMap) != (Int_t)fTrackBitMap) {
+      AliDebug(2,"Track not accepted because of bit map.");
+      return kFALSE;
+    }
+  }
+
+  if (vp->Pt() < fParticlePtCut)
+    return kFALSE;
+
+  if (vp->Eta() < fParticleMinEta || vp->Eta() > fParticleMaxEta || 
+      vp->Phi() < fParticleMinPhi || vp->Phi() > fParticleMaxPhi)
+    return kFALSE;
+  
+  return kTRUE;
+}
diff --git a/PWG/EMCAL/AliParticleContainer.h b/PWG/EMCAL/AliParticleContainer.h
new file mode 100644 (file)
index 0000000..2d92532
--- /dev/null
@@ -0,0 +1,64 @@
+#ifndef AliParticleContainer_H
+#define AliParticleContainer_H
+
+//
+// container with name, TClonesArray and cuts for particles
+//
+
+
+class TClonesArray;
+class TString;
+class TList;
+
+class AliVEvent;
+class AliEmcalParticle;
+class AliMCParticle;
+class AliVTrack;
+class AliVParticle;
+
+#include "Rtypes.h"
+#include <TArrayS.h>
+#include "TString.h"
+#include "AliEmcalContainer.h"
+
+
+class AliParticleContainer : public AliEmcalContainer {
+ public:
+  AliParticleContainer();
+  AliParticleContainer(const char *name); 
+  virtual ~AliParticleContainer();
+
+  void  SetParticleArray(AliVEvent *event);
+
+  void  SetParticlePtCut(Double_t cut)                   { fParticlePtCut = cut ; }
+  void  SetParticleEtaLimits(Double_t min, Double_t max) { fParticleMaxEta = max ; fParticleMinEta = min ; }
+  void  SetParticlePhiLimits(Double_t min, Double_t max) { fParticleMaxPhi = max ; fParticleMinPhi = min ; }
+  void  SetTrackBitMap(UInt_t m)                          { fTrackBitMap     = m ; }
+  void  SetMCTrackBitMap(UInt_t m)                        { fMCTrackBitMap   = m ; }
+  void  SetMinMCLabel(Int_t s)                            { fMinMCLabel        = s ; }
+
+  AliVParticle               *GetParticle(Int_t i) const;
+  AliVParticle               *GetAcceptParticle(Int_t i)               const;
+  Bool_t                      AcceptParticle(AliVParticle         *vp) const;
+  Int_t                       GetNParticles()                          const   {return GetNEntries();}
+
+ protected:
+  Double_t                    fParticlePtCut;                 // cut on particle pt
+  Double_t                    fParticleMinEta;                // cut on particle eta
+  Double_t                    fParticleMaxEta;                // cut on particle eta
+  Double_t                    fParticleMinPhi;                // cut on particle phi
+  Double_t                    fParticleMaxPhi;                // cut on particle phi
+  UInt_t                      fTrackBitMap;                   // bit map of accepted tracks (non MC)
+  UInt_t                      fMCTrackBitMap;                 // bit map of accepted MC tracks
+  Int_t                       fMinMCLabel;                    // minimum MC label value for the tracks/clusters being considered MC particles
+
+ private:
+  AliParticleContainer(const AliParticleContainer& obj); // copy constructor
+  AliParticleContainer& operator=(const AliParticleContainer& other); // assignment
+
+  ClassDef(AliParticleContainer,1);
+
+};
+
+#endif
+
index 3f47bd8c836e32499bad415b102c43a3059dd7f9..c67d365a62d1fbb3fdfd4a8a026bc657ff74eb0c 100644 (file)
@@ -6,9 +6,12 @@
 
 #pragma link C++ class AliAnalysisTaskEMCALClusterizeFast+;
 #pragma link C++ class AliAnalysisTaskEmcal+;
+#pragma link C++ class AliAnalysisTaskEmcalDev+;
+#pragma link C++ class AliClusterContainer+;
 #pragma link C++ class AliEMCALClusterParams+;
 #pragma link C++ class AliEmcalClusTrackMatcherTask+;
 #pragma link C++ class AliEmcalCompatTask+;
+#pragma link C++ class AliEmcalContainer+;
 #pragma link C++ class AliEmcalEsdTpcTrackTask+;
 #pragma link C++ class AliEmcalMCTrackSelector+;
 #pragma link C++ class AliEmcalParticle+;
@@ -21,6 +24,7 @@
 #pragma link C++ class AliEmcalTrackPropagatorTask+;
 #pragma link C++ class AliEsdSkimTask+;
 #pragma link C++ class AliEsdTrackExt+;
+#pragma link C++ class AliParticleContainer+;
 #pragma link C++ class AliPicoTrack+;
 
 #endif