hooks for PMD flow analysis
authorsnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 7 Mar 2011 17:56:23 +0000 (17:56 +0000)
committersnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 7 Mar 2011 17:56:23 +0000 (17:56 +0000)
PWG2/FLOW/AliFlowTasks/AliFlowTrackCuts.cxx
PWG2/FLOW/AliFlowTasks/AliFlowTrackCuts.h
PWG2/FLOW/macros/AddTaskFlow.C
PWG2/FLOW/macros/AddTaskFlowCentrality.C

index 1dbea6b4778fbed3dc4fc0055338e26b41a22e9e..ccfad35cc124af51392a8f722a1e7104d0965ba6 100644 (file)
@@ -51,6 +51,7 @@
 #include "AliFlowTrackCuts.h"
 #include "AliLog.h"
 #include "AliESDpid.h"
+#include "AliESDPmdTrack.h"
 
 ClassImp(AliFlowTrackCuts)
 
@@ -370,6 +371,8 @@ Bool_t AliFlowTrackCuts::IsSelected(TObject* obj, Int_t id)
   if (flowtrack) return PassesCuts(flowtrack);
   AliMultiplicity* tracklets = dynamic_cast<AliMultiplicity*>(obj);
   if (tracklets) return PassesCuts(tracklets,id);
+  AliESDPmdTrack* pmdtrack = dynamic_cast<AliESDPmdTrack*>(obj);
+  if (pmdtrack) return PassesPMDcuts(pmdtrack);
   return kFALSE;  //default when passed wrong type of object
 }
 
@@ -795,94 +798,165 @@ AliFlowTrackCuts* AliFlowTrackCuts::GetStandardITSTPCTrackCuts2009(Bool_t selPri
 }
 
 //-----------------------------------------------------------------------
-AliFlowTrack* AliFlowTrackCuts::MakeFlowTrack() const
+AliFlowTrack* AliFlowTrackCuts::MakeFlowTrackSPDtracklet() const
 {
-  //get a flow track constructed from whatever we applied cuts on
-  //caller is resposible for deletion
-  //if construction fails return NULL
+  //make a flow track from tracklet
   AliFlowTrack* flowtrack=NULL;
   TParticle *tmpTParticle=NULL;
   AliMCParticle* tmpAliMCParticle=NULL;
-  if (fParamType==kESD_SPDtracklet)
+  switch (fParamMix)
   {
-    switch (fParamMix)
-    {
-      case kPure:
-        flowtrack = new AliFlowTrack();
-        flowtrack->SetPhi(fTrackPhi);
-        flowtrack->SetEta(fTrackEta);
-        break;
-      case kTrackWithMCkine:
-        if (!fMCparticle) return NULL;
-        flowtrack = new AliFlowTrack();
-        flowtrack->SetPhi( fMCparticle->Phi() );
-        flowtrack->SetEta( fMCparticle->Eta() );
-        flowtrack->SetPt( fMCparticle->Pt() );
-        break;
-      case kTrackWithMCpt:
-        if (!fMCparticle) return NULL;
-        flowtrack = new AliFlowTrack();
-        flowtrack->SetPhi(fTrackPhi);
-        flowtrack->SetEta(fTrackEta);
-        flowtrack->SetPt(fMCparticle->Pt());
-        break;
-      case kTrackWithPtFromFirstMother:
-        if (!fMCparticle) return NULL;
-        flowtrack = new AliFlowTrack();
-        flowtrack->SetPhi(fTrackPhi);
-        flowtrack->SetEta(fTrackEta);
-        tmpTParticle = fMCparticle->Particle();
-        tmpAliMCParticle = static_cast<AliMCParticle*>(fMCevent->GetTrack(tmpTParticle->GetFirstMother()));
-        flowtrack->SetPt(tmpAliMCParticle->Pt());
-        break;
-      default:
-        flowtrack = new AliFlowTrack();
-        flowtrack->SetPhi(fTrackPhi);
-        flowtrack->SetEta(fTrackEta);
-        break;
-    }
-    flowtrack->SetSource(AliFlowTrack::kFromTracklet);
+    case kPure:
+      flowtrack = new AliFlowTrack();
+      flowtrack->SetPhi(fTrackPhi);
+      flowtrack->SetEta(fTrackEta);
+      break;
+    case kTrackWithMCkine:
+      if (!fMCparticle) return NULL;
+      flowtrack = new AliFlowTrack();
+      flowtrack->SetPhi( fMCparticle->Phi() );
+      flowtrack->SetEta( fMCparticle->Eta() );
+      flowtrack->SetPt( fMCparticle->Pt() );
+      break;
+    case kTrackWithMCpt:
+      if (!fMCparticle) return NULL;
+      flowtrack = new AliFlowTrack();
+      flowtrack->SetPhi(fTrackPhi);
+      flowtrack->SetEta(fTrackEta);
+      flowtrack->SetPt(fMCparticle->Pt());
+      break;
+    case kTrackWithPtFromFirstMother:
+      if (!fMCparticle) return NULL;
+      flowtrack = new AliFlowTrack();
+      flowtrack->SetPhi(fTrackPhi);
+      flowtrack->SetEta(fTrackEta);
+      tmpTParticle = fMCparticle->Particle();
+      tmpAliMCParticle = static_cast<AliMCParticle*>(fMCevent->GetTrack(tmpTParticle->GetFirstMother()));
+      flowtrack->SetPt(tmpAliMCParticle->Pt());
+      break;
+    default:
+      flowtrack = new AliFlowTrack();
+      flowtrack->SetPhi(fTrackPhi);
+      flowtrack->SetEta(fTrackEta);
+      break;
   }
-  else
+  flowtrack->SetSource(AliFlowTrack::kFromTracklet);
+  return flowtrack;
+}
+
+//-----------------------------------------------------------------------
+AliFlowTrack* AliFlowTrackCuts::MakeFlowTrackVParticle() const
+{
+  //make flow track from AliVParticle (ESD,AOD,MC)
+  if (!fTrack) return NULL;
+  AliFlowTrack* flowtrack=NULL;
+  TParticle *tmpTParticle=NULL;
+  AliMCParticle* tmpAliMCParticle=NULL;
+  switch(fParamMix)
   {
-    if (!fTrack) return NULL;
-    switch(fParamMix)
-    {
-      case kPure:
-        flowtrack = new AliFlowTrack(fTrack);
-        break;
-      case kTrackWithMCkine:
-        flowtrack = new AliFlowTrack(fMCparticle);
-        break;
-      case kTrackWithMCPID:
-        flowtrack = new AliFlowTrack(fTrack);
-        //flowtrack->setPID(...) from mc, when implemented
-        break;
-      case kTrackWithMCpt:
-        if (!fMCparticle) return NULL;
-        flowtrack = new AliFlowTrack(fTrack);
-        flowtrack->SetPt(fMCparticle->Pt());
-        break;
-      case kTrackWithPtFromFirstMother:
-        if (!fMCparticle) return NULL;
-        flowtrack = new AliFlowTrack(fTrack);
-        tmpTParticle = fMCparticle->Particle();
-        tmpAliMCParticle = static_cast<AliMCParticle*>(fMCevent->GetTrack(tmpTParticle->GetFirstMother()));
-        flowtrack->SetPt(tmpAliMCParticle->Pt());
-        break;
-      default:
-        flowtrack = new AliFlowTrack(fTrack);
-        break;
-    }
-    if (fParamType==kMC) flowtrack->SetSource(AliFlowTrack::kFromMC);
-    else if (dynamic_cast<AliESDtrack*>(fTrack)) flowtrack->SetSource(AliFlowTrack::kFromESD);
-    else if (dynamic_cast<AliAODTrack*>(fTrack)) flowtrack->SetSource(AliFlowTrack::kFromAOD);
-    else if (dynamic_cast<AliMCParticle*>(fTrack)) flowtrack->SetSource(AliFlowTrack::kFromMC);
+    case kPure:
+      flowtrack = new AliFlowTrack(fTrack);
+      break;
+    case kTrackWithMCkine:
+      flowtrack = new AliFlowTrack(fMCparticle);
+      break;
+    case kTrackWithMCPID:
+      flowtrack = new AliFlowTrack(fTrack);
+      //flowtrack->setPID(...) from mc, when implemented
+      break;
+    case kTrackWithMCpt:
+      if (!fMCparticle) return NULL;
+      flowtrack = new AliFlowTrack(fTrack);
+      flowtrack->SetPt(fMCparticle->Pt());
+      break;
+    case kTrackWithPtFromFirstMother:
+      if (!fMCparticle) return NULL;
+      flowtrack = new AliFlowTrack(fTrack);
+      tmpTParticle = fMCparticle->Particle();
+      tmpAliMCParticle = static_cast<AliMCParticle*>(fMCevent->GetTrack(tmpTParticle->GetFirstMother()));
+      flowtrack->SetPt(tmpAliMCParticle->Pt());
+      break;
+    default:
+      flowtrack = new AliFlowTrack(fTrack);
+      break;
+  }
+  if (fParamType==kMC) flowtrack->SetSource(AliFlowTrack::kFromMC);
+  else if (dynamic_cast<AliESDtrack*>(fTrack)) flowtrack->SetSource(AliFlowTrack::kFromESD);
+  else if (dynamic_cast<AliAODTrack*>(fTrack)) flowtrack->SetSource(AliFlowTrack::kFromAOD);
+  else if (dynamic_cast<AliMCParticle*>(fTrack)) flowtrack->SetSource(AliFlowTrack::kFromMC);
+  return flowtrack;
+}
+
+//-----------------------------------------------------------------------
+AliFlowTrack* AliFlowTrackCuts::MakeFlowTrackPMDtrack() const
+{
+  //make a flow track from PMD track
+  AliFlowTrack* flowtrack=NULL;
+  TParticle *tmpTParticle=NULL;
+  AliMCParticle* tmpAliMCParticle=NULL;
+  switch (fParamMix)
+  {
+    case kPure:
+      flowtrack = new AliFlowTrack();
+      flowtrack->SetPhi(fTrackPhi);
+      flowtrack->SetEta(fTrackEta);
+      flowtrack->SetWeight(fTrackWeight);
+      break;
+    case kTrackWithMCkine:
+      if (!fMCparticle) return NULL;
+      flowtrack = new AliFlowTrack();
+      flowtrack->SetPhi( fMCparticle->Phi() );
+      flowtrack->SetEta( fMCparticle->Eta() );
+      flowtrack->SetWeight(fTrackWeight);
+      flowtrack->SetPt( fMCparticle->Pt() );
+      break;
+    case kTrackWithMCpt:
+      if (!fMCparticle) return NULL;
+      flowtrack = new AliFlowTrack();
+      flowtrack->SetPhi(fTrackPhi);
+      flowtrack->SetEta(fTrackEta);
+      flowtrack->SetWeight(fTrackWeight);
+      flowtrack->SetPt(fMCparticle->Pt());
+      break;
+    case kTrackWithPtFromFirstMother:
+      if (!fMCparticle) return NULL;
+      flowtrack = new AliFlowTrack();
+      flowtrack->SetPhi(fTrackPhi);
+      flowtrack->SetEta(fTrackEta);
+      flowtrack->SetWeight(fTrackWeight);
+      tmpTParticle = fMCparticle->Particle();
+      tmpAliMCParticle = static_cast<AliMCParticle*>(fMCevent->GetTrack(tmpTParticle->GetFirstMother()));
+      flowtrack->SetPt(tmpAliMCParticle->Pt());
+      break;
+    default:
+      flowtrack = new AliFlowTrack();
+      flowtrack->SetPhi(fTrackPhi);
+      flowtrack->SetEta(fTrackEta);
+      flowtrack->SetWeight(fTrackWeight);
+      break;
   }
 
+  flowtrack->SetSource(AliFlowTrack::kFromPMD);
   return flowtrack;
 }
 
+//-----------------------------------------------------------------------
+AliFlowTrack* AliFlowTrackCuts::MakeFlowTrack() const
+{
+  //get a flow track constructed from whatever we applied cuts on
+  //caller is resposible for deletion
+  //if construction fails return NULL
+  switch (fParamType)
+  {
+    case kESD_SPDtracklet:
+      return MakeFlowTrackSPDtracklet();
+    case kPMD:
+      return MakeFlowTrackPMDtrack();
+    default:
+      return MakeFlowTrackVParticle();
+  }
+}
+
 //-----------------------------------------------------------------------
 Bool_t AliFlowTrackCuts::IsPhysicalPrimary() const
 {
@@ -927,6 +1001,10 @@ Int_t AliFlowTrackCuts::GetNumberOfInputObjects() const
     case kMC:
       if (!fMCevent) return 0;
       return fMCevent->GetNumberOfTracks();
+    case kPMD:
+      esd = dynamic_cast<AliESDEvent*>(fEvent);
+      if (!esd) return 0;
+      return esd->GetNumberOfPmdTracks();
     default:
       if (!fEvent) return 0;
       return fEvent->GetNumberOfTracks();
@@ -949,6 +1027,10 @@ TObject* AliFlowTrackCuts::GetInputObject(Int_t i)
     case kMC:
       if (!fMCevent) return NULL;
       return fMCevent->GetTrack(i);
+    case kPMD:
+      esd = dynamic_cast<AliESDEvent*>(fEvent);
+      if (!esd) return NULL;
+      return esd->GetPmdTrack(i);
     default:
       if (!fEvent) return NULL;
       return fEvent->GetTrack(i);
@@ -1723,8 +1805,30 @@ const char* AliFlowTrackCuts::GetParamTypeName(trackParameterType type)
       return "TPC only";
     case kESD_SPDtracklet:
       return "SPD tracklet";
+    case kPMD:
+      return "PMD";
     default:
       return "unknown";
   }
 }
 
+//-----------------------------------------------------------------------
+Bool_t AliFlowTrackCuts::PassesPMDcuts(AliESDPmdTrack* /*track*/ )
+{
+  //check PMD specific cuts
+  //clean up from last iteration, and init label
+
+  fTrack = NULL;
+  fMCparticle=NULL;
+  fTrackLabel=-1;
+
+  fTrackPhi = 0.;
+  fTrackEta = 0.;
+  fTrackWeight = 1.0;
+
+  Bool_t pass=kTRUE;
+  if (fCutEta) {if (  fTrackEta < fEtaMin || fTrackEta >= fEtaMax ) pass = kFALSE;}
+  if (fCutPhi) {if ( fTrackPhi < fPhiMin || fTrackPhi >= fPhiMax ) pass = kFALSE;}
+
+  return kFALSE;
+}
index f4a635b6a030ce167f6929162ae473b12f38124c..2f7b5aa22845265a2ccac75fc748b4ce6ec36827 100644 (file)
@@ -26,6 +26,7 @@ class AliVEvent;
 class AliMultiplicity; 
 class AliAODTrack;
 class AliESDtrack;
+class AliESDPmdTrack;
 
 class AliFlowTrackCuts : public AliFlowTrackSimpleCuts {
 
@@ -46,7 +47,8 @@ class AliFlowTrackCuts : public AliFlowTrackSimpleCuts {
   enum trackParameterType { kMC, 
                             kGlobal, 
                             kESD_TPConly, 
-                            kESD_SPDtracklet 
+                            kESD_SPDtracklet,
+                            kPMD
                           };
   enum trackParameterMix  { kPure, 
                             kTrackWithMCkine, 
@@ -167,6 +169,7 @@ class AliFlowTrackCuts : public AliFlowTrackSimpleCuts {
   Bool_t PassesCuts(AliVParticle* track);
   Bool_t PassesESDcuts(AliESDtrack* track);
   Bool_t PassesAODcuts(AliAODTrack* track);
+  Bool_t PassesPMDcuts(AliESDPmdTrack* track);
   Bool_t PassesCuts(AliFlowTrackSimple* track);
   Bool_t PassesCuts(AliMultiplicity* track, Int_t id);
   Bool_t PassesMCcuts();
@@ -175,6 +178,9 @@ class AliFlowTrackCuts : public AliFlowTrackSimpleCuts {
   Bool_t PassesTPCpidCut(AliESDtrack* track);
   Bool_t PassesTOFbetaCut(AliESDtrack* track);  
   Bool_t PassesTOFpidCut(AliESDtrack* track);  
+  AliFlowTrack* MakeFlowTrackSPDtracklet() const;
+  AliFlowTrack* MakeFlowTrackPMDtrack() const;
+  AliFlowTrack* MakeFlowTrackVParticle() const;
   void HandleESDtrack(AliESDtrack* track);
   void HandleVParticle(AliVParticle* track);
   void DefineHistograms();
index 10a06a013a870a2c8eabe9797ab8fe84908fbd51..2a9d6fadf7f3a50301bbc2f25729085f8c02e8f2 100644 (file)
@@ -62,7 +62,7 @@ Bool_t WEIGHTS[] = {kFALSE,kFALSE,kFALSE}; //Phi, v'(pt), v'(eta)
 // SETTING THE CUTS
 
 //---------Data selection----------
-//kMC, kGlobal, kESD_TPConly, kESD_SPDtracklet
+//kMC, kGlobal, kESD_TPConly, kESD_SPDtracklet, kPMD
 AliFlowTrackCuts::trackParameterType rptype = AliFlowTrackCuts::kGlobal;
 AliFlowTrackCuts::trackParameterType poitype = AliFlowTrackCuts::kGlobal;
 
index 48e396f3ed02adc9a32e3d67a68a7427d5f3d5c1..1506c2df56a8b73826948472ad423f6635ae24d3 100644 (file)
@@ -59,7 +59,7 @@ Bool_t WEIGHTS[] = {kFALSE,kFALSE,kFALSE}; //Phi, v'(pt), v'(eta)
 // SETTING THE CUTS
 
 //---------Data selection----------
-//kMC, kGlobal, kESD_TPConly, kESD_SPDtracklet
+//kMC, kGlobal, kESD_TPConly, kESD_SPDtracklet, kPMD
 AliFlowTrackCuts::trackParameterType rptype = AliFlowTrackCuts::kGlobal;
 AliFlowTrackCuts::trackParameterType poitype = AliFlowTrackCuts::kGlobal;