move ESDfilter to separate library + copy calo info for all tracks
authormverweij <marta.verweij@cern.ch>
Wed, 11 Dec 2013 21:08:06 +0000 (22:08 +0100)
committermverweij <marta.verweij@cern.ch>
Wed, 11 Dec 2013 21:08:06 +0000 (22:08 +0100)
ANALYSIS/ANALYSISaliceLinkDef.h
ANALYSIS/AliAnalysisTaskMCParticleFilter.cxx
ANALYSIS/AliAnalysisTaskMCParticleFilter.h
ANALYSIS/CMakelibANALYSISalice.pkg
ANALYSIS/CMakelibESDfilter.pkg [new file with mode: 0644]
ANALYSIS/ESDfilter/AliAnalysisTaskESDfilter.cxx [moved from ANALYSIS/AliAnalysisTaskESDfilter.cxx with 98% similarity]
ANALYSIS/ESDfilter/AliAnalysisTaskESDfilter.h [moved from ANALYSIS/AliAnalysisTaskESDfilter.h with 99% similarity]
ANALYSIS/ESDfilter/macros/AddTaskESDFilter.C [moved from ANALYSIS/macros/AddTaskESDFilter.C with 100% similarity]
ANALYSIS/ESDfilterLinkDef.h [new file with mode: 0644]

index 34fbb29..b323efd 100644 (file)
@@ -6,7 +6,6 @@
 
 #pragma link C++ class  AliAnalysisTaskSE+;
 #pragma link C++ class  AliAnalysisTaskME+;
-#pragma link C++ class  AliAnalysisTaskESDfilter+;
 #pragma link C++ class  AliAnalysisTaskMCParticleFilter+;
 #pragma link C++ class  AliAnalysisTaskTagCreator+;
 #pragma link C++ class  AliKineTrackCuts+;
index 7f6bae2..f699ef1 100644 (file)
 #include "AliGenPythiaEventHeader.h"
 #include "AliGenCocktailEventHeader.h"
 #include "AliGenEventHeaderTunedPbPb.h"
+#include "AliESDtrack.h"
+#include "AliAODTrack.h"
+#include "AliAODPid.h"
+#include "AliESDpid.h"
 
 #include "AliLog.h"
 
index d47f284..9957966 100644 (file)
@@ -18,6 +18,11 @@ class AliAODMCHeader;
 class AliMCParticle;
 class TClonesArray;
 
+#include "AliESDtrack.h"
+#include "AliAODTrack.h"
+#include "AliAODPid.h"
+#include "AliESDpid.h"
+
 class AliAnalysisTaskMCParticleFilter : public AliAnalysisTaskSE
 {
  public:
index ee8f339..c3b9107 100644 (file)
@@ -29,7 +29,6 @@
 set ( SRCS     
     AliAnalysisTaskSE.cxx 
     AliAnalysisTaskME.cxx 
-    AliAnalysisTaskESDfilter.cxx 
     AliAnalysisTaskMCParticleFilter.cxx 
     AliKineTrackCuts.cxx 
     AliESDtrackCuts.cxx 
diff --git a/ANALYSIS/CMakelibESDfilter.pkg b/ANALYSIS/CMakelibESDfilter.pkg
new file mode 100644 (file)
index 0000000..439b11c
--- /dev/null
@@ -0,0 +1,39 @@
+# -*- mode: Makefile -*-
+#--------------------------------------------------------------------------------#
+# Package File for PWGmuon                                                      #
+# Author : Johny Jose (johny.jose@cern.ch)                                       #
+# Variables Defined :                                                            #
+#                                                                                #
+# SRCS - C++ source files                                                        #
+# HDRS - C++ header files                                                        #
+# DHDR - ROOT Dictionary Linkdef header file                                     #
+# CSRCS - C source files                                                         #
+# CHDRS - C header files                                                         #
+# EINCLUDE - Include directories                                                 #
+# EDEFINE - Compiler definitions                                                 #
+# ELIBS - Extra libraries to link                                                #
+# ELIBSDIR - Extra library directories                                           #
+# PACKFFLAGS - Fortran compiler flags for package                                #
+# PACKCXXFLAGS - C++ compiler flags for package                                  #
+# PACKCFLAGS - C compiler flags for package                                      #
+# PACKSOFLAGS - Shared library linking flags                                     #
+# PACKLDFLAGS - Module linker flags                                              #
+# PACKBLIBS - Libraries to link (Executables only)                               #
+# EXPORT - Header files to be exported                                           #
+# CINTHDRS - Dictionary header files                                             #
+# CINTAUTOLINK - Set automatic dictionary generation                             #
+# ARLIBS - Archive Libraries and objects for linking (Executables only)          #
+# SHLIBS - Shared Libraries and objects for linking (Executables only)           #
+#--------------------------------------------------------------------------------#
+
+set ( SRCS 
+    ESDfilter/AliAnalysisTaskESDfilter.cxx
+)
+
+string ( REPLACE ".cxx" ".h" HDRS "${SRCS}" )
+
+string ( REPLACE ".cxx" ".h" EXPORT "${SRCS}" )
+
+set ( DHDR  ESDfilterLinkDef.h)
+
+set ( EINCLUDE ANALYSIS/ESDfilter EMCAL OADB STEER/AOD STEER/ESD STEER/STEERBase ANALYSIS)
similarity index 98%
rename from ANALYSIS/AliAnalysisTaskESDfilter.cxx
rename to ANALYSIS/ESDfilter/AliAnalysisTaskESDfilter.cxx
index dd1e8bc..3ccdef2 100644 (file)
@@ -15,6 +15,7 @@
 
 /* $Id$ */
  
+#include <Riostream.h>
 #include <TChain.h>
 #include <TTree.h>
 #include <TList.h>
@@ -23,6 +24,7 @@
 #include <TRandom.h>
 #include <TParticle.h>
 #include <TFile.h>
+#include <TVector3.h>
 
 #include "AliAnalysisTaskESDfilter.h"
 #include "AliAnalysisManager.h"
 #include "AliAODHMPIDrings.h"
 #include "AliV0vertexer.h"
 #include "AliCascadeVertexer.h"
-#include "Riostream.h"
 #include "AliExternalTrackParam.h"
 #include "AliTrackerBase.h"
-#include "TVector3.h"
 #include "AliTPCdEdxInfo.h"
 
 #include "AliESDTrdTrack.h"
 #include "AliESDTrdTracklet.h"
 #include "AliAODTrdTrack.h"
 #include "AliAODTrdTracklet.h"
+#include "AliEMCALRecoUtils.h"
 
 using std::cout;
 using std::endl;
@@ -995,6 +996,7 @@ void AliAnalysisTaskESDfilter::ConvertV0s(const AliESDEvent& esd)
            aodTrack->SetTPCNCrossedRows(UShort_t(esdV0Pos->GetTPCCrossedRows()));
            aodTrack->SetIntegratedLength(esdV0Pos->GetIntegratedLength());
            aodTrack->SetTOFLabel(tofLabel);
+           CopyCaloProps(esdV0Pos,aodTrack);
            fAODTrackRefs->AddAt(aodTrack,posFromV0);
            //      if (fDebug > 0) printf("-------------------Bo: pos track from original pt %.3f \n",aodTrack->Pt());
            if (esdV0Pos->GetSign() > 0) ++fNumberOfPositiveTracks;
@@ -1044,6 +1046,7 @@ void AliAnalysisTaskESDfilter::ConvertV0s(const AliESDEvent& esd)
            aodTrack->SetTPCNCrossedRows(UShort_t(esdV0Neg->GetTPCCrossedRows()));
            aodTrack->SetIntegratedLength(esdV0Neg->GetIntegratedLength());
            aodTrack->SetTOFLabel(tofLabel);
+           CopyCaloProps(esdV0Neg,aodTrack);
            fAODTrackRefs->AddAt(aodTrack,negFromV0);
            //      if (fDebug > 0) printf("-------------------Bo: neg track from original pt %.3f \n",aodTrack->Pt());
            if (esdV0Neg->GetSign() > 0) ++fNumberOfPositiveTracks;
@@ -1255,10 +1258,8 @@ void AliAnalysisTaskESDfilter::ConvertTPCOnlyTracks(const AliESDEvent& esd)
     aodTrack->SetTPCNCrossedRows(UShort_t(track->GetTPCCrossedRows()));
     aodTrack->SetIntegratedLength(track->GetIntegratedLength());
     aodTrack->SetTOFLabel(tofLabel);
-    //Perform progagation of tracks if needed
-    if(fDoPropagateTrackToEMCal) PropagateTrackToEMCal(esdTrack);
-    aodTrack->SetTrackPhiEtaPtOnEMCal(esdTrack->GetTrackPhiOnEMCal(),esdTrack->GetTrackEtaOnEMCal(),esdTrack->GetTrackPtOnEMCal());
-
+    CopyCaloProps(track,aodTrack);
+  
     // do not duplicate PID information 
     //    aodTrack->ConvertAliPIDtoAODPID();
     //    SetAODPID(esdTrack,aodTrack,detpid);
@@ -1394,27 +1395,22 @@ void AliAnalysisTaskESDfilter::ConvertGlobalConstrainedTracks(const AliESDEvent&
     aodTrack->SetTPCClusterMap(esdTrack->GetTPCClusterMap());
     aodTrack->SetTPCSharedMap (esdTrack->GetTPCSharedMap());
     aodTrack->SetChi2perNDF(Chi2perNDF(esdTrack));
-    
 
     // set the DCA values to the AOD track
     aodTrack->SetPxPyPzAtDCA(pDCA[0],pDCA[1],pDCA[2]);
     aodTrack->SetXYAtDCA(rDCA[0],rDCA[1]);
     aodTrack->SetDCA(dDCA[0],dDCA[1]);
-
     aodTrack->SetFlags(esdTrack->GetStatus());
     aodTrack->SetTPCPointsF(esdTrack->GetTPCNclsF());
     aodTrack->SetTPCNCrossedRows(UShort_t(esdTrack->GetTPCCrossedRows()));
     aodTrack->SetIntegratedLength(esdTrack->GetIntegratedLength());
     aodTrack->SetTOFLabel(tofLabel);
+    CopyCaloProps(esdTrack,aodTrack);
     if(isHybridGC){
       // only copy AOD information for hybrid, no duplicate information
       aodTrack->ConvertAliPIDtoAODPID();
       SetAODPID(esdTrack,aodTrack,detpid);
     }
-
-    //Perform progagation of tracks if needed
-    if(fDoPropagateTrackToEMCal) PropagateTrackToEMCal(esdTrack);
-    aodTrack->SetTrackPhiEtaPtOnEMCal(esdTrack->GetTrackPhiOnEMCal(),esdTrack->GetTrackEtaOnEMCal(),esdTrack->GetTrackPtOnEMCal());
   } // end of loop on tracks
   
 }
@@ -1484,16 +1480,10 @@ void AliAnalysisTaskESDfilter::ConvertTracks(const AliESDEvent& esd)
     aodTrack->SetTPCNCrossedRows(UShort_t(esdTrack->GetTPCCrossedRows()));
     aodTrack->SetIntegratedLength(esdTrack->GetIntegratedLength());
     aodTrack->SetTOFLabel(tofLabel);
-    if(esdTrack->IsEMCAL()) aodTrack->SetEMCALcluster(esdTrack->GetEMCALcluster());
-    if(esdTrack->IsPHOS())  aodTrack->SetPHOScluster(esdTrack->GetPHOScluster());
-
-    //Perform progagation of tracks if needed
-    if(fDoPropagateTrackToEMCal) PropagateTrackToEMCal(esdTrack);
-    aodTrack->SetTrackPhiEtaPtOnEMCal(esdTrack->GetTrackPhiOnEMCal(),esdTrack->GetTrackEtaOnEMCal(),esdTrack->GetTrackPtOnEMCal());
+    CopyCaloProps(esdTrack,aodTrack);
 
     fAODTrackRefs->AddAt(aodTrack, nTrack);
     
-    
     if (esdTrack->GetSign() > 0) ++fNumberOfPositiveTracks;
     aodTrack->SetFlags(esdTrack->GetStatus());
     aodTrack->ConvertAliPIDtoAODPID();
@@ -1502,32 +1492,6 @@ void AliAnalysisTaskESDfilter::ConvertTracks(const AliESDEvent& esd)
 }
 
 //______________________________________________________________________________
-void AliAnalysisTaskESDfilter::PropagateTrackToEMCal(AliESDtrack *esdTrack)
-{
-  Double_t trkPos[3] = {0.,0.,0.};
-  Double_t EMCalEta=-999, EMCalPhi=-999, EMCalPt=-999;
-  Double_t trkphi = esdTrack->Phi()*TMath::RadToDeg();
-  if(TMath::Abs(esdTrack->Eta())<0.9 && trkphi > 10 && trkphi < 250 )
-    {
-      AliExternalTrackParam *trkParam = const_cast<AliExternalTrackParam*>(esdTrack->GetInnerParam());
-      if(trkParam)
-       {
-         AliExternalTrackParam trkParamTmp(*trkParam);
-         if(AliTrackerBase::PropagateTrackToBxByBz(&trkParamTmp, fEMCalSurfaceDistance, esdTrack->GetMass(), 20, kTRUE, 0.8, -1))
-           {
-             trkParamTmp.GetXYZ(trkPos);
-             TVector3 trkPosVec(trkPos[0],trkPos[1],trkPos[2]);
-             EMCalEta = trkPosVec.Eta();
-             EMCalPhi = trkPosVec.Phi();
-             EMCalPt = trkParamTmp.Pt();
-             if(EMCalPhi<0)  EMCalPhi += 2*TMath::Pi();
-             esdTrack->SetTrackPhiEtaPtOnEMCal(EMCalPhi,EMCalEta,EMCalPt);
-           }
-       }
-    }
-}
-
-//______________________________________________________________________________
 void AliAnalysisTaskESDfilter::ConvertPmdClusters(const AliESDEvent& esd)
 {
 // Convert PMD Clusters 
@@ -1869,6 +1833,7 @@ void AliAnalysisTaskESDfilter::ConvertKinks(const AliESDEvent& esd)
            mother->SetTPCNCrossedRows(UShort_t(esdTrackM->GetTPCCrossedRows()));
            mother->SetIntegratedLength(esdTrackM->GetIntegratedLength());
            mother->SetTOFLabel(tofLabel);
+           CopyCaloProps(esdTrackM,mother);
             fAODTrackRefs->AddAt(mother, imother);
             
             if (esdTrackM->GetSign() > 0) ++fNumberOfPositiveTracks;
@@ -1936,6 +1901,7 @@ void AliAnalysisTaskESDfilter::ConvertKinks(const AliESDEvent& esd)
            daughter->SetTPCNCrossedRows(UShort_t(esdTrackD->GetTPCCrossedRows()));
            daughter->SetIntegratedLength(esdTrackD->GetIntegratedLength());
            daughter->SetTOFLabel(tofLabel);
+           CopyCaloProps(esdTrackD,daughter);
             fAODTrackRefs->AddAt(daughter, idaughter);
             
             if (esdTrackD->GetSign() > 0) ++fNumberOfPositiveTracks;
@@ -2286,7 +2252,8 @@ void AliAnalysisTaskESDfilter::ConvertTRD(const AliESDEvent& esd)
          aodTrkMatch->SetTPCPointsF(esdTrkMatch->GetTPCNclsF());
          aodTrkMatch->SetTPCNCrossedRows(UShort_t(esdTrkMatch->GetTPCCrossedRows()));
          aodTrkMatch->SetIntegratedLength(esdTrkMatch->GetIntegratedLength());
-         fAODTrackRefs->AddAt(aodTrkMatch,idx);
+         CopyCaloProps(esdTrkMatch,aodTrkMatch);
+         fAODTrackRefs->AddAt(aodTrkMatch,idx);
          if (esdTrkMatch->GetSign() > 0) ++fNumberOfPositiveTracks;
          aodTrkMatch->ConvertAliPIDtoAODPID();
          aodTrkMatch->SetFlags(esdTrkMatch->GetStatus());
@@ -2326,6 +2293,14 @@ void AliAnalysisTaskESDfilter::ConvertESDtoAOD()
     lCascVtxer.V0sTracks2CascadeVertices(esd);
   }
 
+  // Perform progagation of tracks if needed
+  if (fDoPropagateTrackToEMCal) {
+    const Int_t ntrack = esd->GetNumberOfTracks();
+    for (Int_t i=0;i<ntrack;++i) {
+      AliESDtrack *t = esd->GetTrack(i);
+      AliEMCALRecoUtils::ExtrapolateTrackToEMCalSurface(t,fEMCalSurfaceDistance);
+    }
+  }
  
   fNumberOfTracks = 0;
   fNumberOfPositiveTracks = 0;
@@ -2642,5 +2617,16 @@ void  AliAnalysisTaskESDfilter::PrintMCInfo(AliStack *pStack,Int_t label){
   Printf("########################");
 }
 
-//______________________________________________________
+//______________________________________________________________________________
+void  AliAnalysisTaskESDfilter::CopyCaloProps(AliESDtrack *tre, AliAODTrack *tra) {
+  //Copy calo properties from ESD track to AOD track
+
+  tra->SetTrackPhiEtaPtOnEMCal(tre->GetTrackPhiOnEMCal(),tre->GetTrackEtaOnEMCal(),tre->GetTrackPtOnEMCal());
+  if(tre->IsEMCAL()) tra->SetEMCALcluster(tre->GetEMCALcluster());
+  if(tre->IsPHOS())  tra->SetPHOScluster(tre->GetPHOScluster());
+
+}
+
+//______________________________________________________________________________
+
 
similarity index 99%
rename from ANALYSIS/AliAnalysisTaskESDfilter.h
rename to ANALYSIS/ESDfilter/AliAnalysisTaskESDfilter.h
index 7a32eae..6a48321 100644 (file)
@@ -117,7 +117,7 @@ private:
   void ConvertZDC(const AliESDEvent& esd);
   Int_t ConvertHMPID(const AliESDEvent& esd);
   void ConvertTRD(const AliESDEvent& esd);
-  void PropagateTrackToEMCal(AliESDtrack *esdTrack);
+  void CopyCaloProps(AliESDtrack *esdt, AliAODTrack *aodt);
 
   TClonesArray& Tracks();
   TClonesArray& V0s();
diff --git a/ANALYSIS/ESDfilterLinkDef.h b/ANALYSIS/ESDfilterLinkDef.h
new file mode 100644 (file)
index 0000000..920f3cf
--- /dev/null
@@ -0,0 +1,9 @@
+#ifdef __CINT__
+
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+
+#pragma link C++ class AliAnalysisTaskESDfilter+;
+
+#endif