Information for TOF resolution added.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 5 Jan 2011 14:06:49 +0000 (14:06 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 5 Jan 2011 14:06:49 +0000 (14:06 +0000)
 Davide Caffarri <davide.caffarri@pd.infn.it>
 Pietro Antonioli <pietro.antonioli@bo.infn.it>, Andrea Dainese <andrea.dainese@pd.infn.it>

ANALYSIS/AliAnalysisTaskESDfilter.cxx
ANALYSIS/AliAnalysisTaskESDfilter.h
STEER/AliAODPid.cxx
STEER/AliAODPid.h

index 0d1569d..9d76fcb 100644 (file)
@@ -48,7 +48,8 @@
 #include "AliLog.h"\r
 #include "AliTrackerBase.h"\r
 #include "AliESDtrackCuts.h"\r
-\r
+#include "AliPID.h"\r
\r
 ClassImp(AliAnalysisTaskESDfilter)\r
 \r
 ////////////////////////////////////////////////////////////////////////\r
@@ -238,7 +239,7 @@ void AliAnalysisTaskESDfilter::ConvertESDtoAOD() {
 \r
     AliAODTrack   *aodTrack       = 0x0;\r
     AliAODPid     *detpid         = 0x0;\r
-    Double_t      timezero        = 0;   //TO BE FIXED\r
+    //    Double_t      timezero        = 0;   //not needed anymore \r
     AliAODVertex  *vV0FromCascade = 0x0;\r
     AliAODv0      *aodV0          = 0x0;\r
     AliAODcascade *aodCascade     = 0x0;\r
@@ -349,6 +350,26 @@ void AliAnalysisTaskESDfilter::ConvertESDtoAOD() {
 \r
     // Create vertices starting from the most complex objects\r
     Double_t chi2 = 0.;\r
+\r
+\r
+    //setting best TOF PID\r
+    AliESDpid *esdPid = new AliESDpid;\r
+    \r
+    if(!esd->GetTOFHeader()){\r
+      Float_t *t0spread= new Float_t[10];\r
+      Float_t intrinsicTOFres=100; //ps ok for LHC10b,c,d pass2!! \r
+      for (Int_t i=0; i<10; i++) t0spread[i] = (TMath::Sqrt(esd->GetSigma2DiamondZ()))/0.03; //0.03 to convert from cm to ps\r
+      \r
+      esdPid->GetTOFResponse().SetT0resolution(t0spread);\r
+      esdPid->GetTOFResponse().SetTimeResolution(intrinsicTOFres);\r
+      delete[] t0spread;\r
+      t0spread=0x0;\r
+    }\r
+    else{\r
+      esdPid->SetTOFResponse(esd, AliESDpid::kBest_T0); //TOF_T0 uses the T0 computed with TOF, kBest_T0 uses the best information available \r
+    }\r
+    esdPid->MakePID(esd, kFALSE);\r
+    \r
     \r
     // Cascades (Modified by A.Maire - February 2009)\r
     for (Int_t nCascade = 0; nCascade < nCascades; ++nCascade) {\r
@@ -485,7 +506,7 @@ void AliAnalysisTaskESDfilter::ConvertESDtoAOD() {
            if (esdCascadeBach->GetSign() > 0) nPosTracks++;\r
            aodTrack->ConvertAliPIDtoAODPID();\r
            aodTrack->SetFlags(esdCascadeBach->GetStatus());\r
-            SetAODPID(esdCascadeBach,aodTrack,detpid,timezero,esd->GetMagneticField());\r
+            SetAODPID(esdCascadeBach,aodTrack,detpid,esd->GetMagneticField(), esdPid);\r
        }\r
        else {\r
            aodTrack = dynamic_cast<AliAODTrack*>( aodTrackRefs->At(idxBachFromCascade) );\r
@@ -567,7 +588,7 @@ void AliAnalysisTaskESDfilter::ConvertESDtoAOD() {
                if (esdCascadePos->GetSign() > 0) nPosTracks++;\r
                aodTrack->ConvertAliPIDtoAODPID();\r
                aodTrack->SetFlags(esdCascadePos->GetStatus());\r
-               SetAODPID(esdCascadePos,aodTrack,detpid,timezero,esd->GetMagneticField());\r
+               SetAODPID(esdCascadePos,aodTrack,detpid,esd->GetMagneticField(), esdPid);\r
                }\r
                else {\r
                        aodTrack = dynamic_cast<AliAODTrack*>(aodTrackRefs->At(idxPosFromV0Dghter));\r
@@ -612,7 +633,7 @@ void AliAnalysisTaskESDfilter::ConvertESDtoAOD() {
                if (esdCascadeNeg->GetSign() > 0) nPosTracks++;\r
                aodTrack->ConvertAliPIDtoAODPID();\r
                aodTrack->SetFlags(esdCascadeNeg->GetStatus());\r
-               SetAODPID(esdCascadeNeg,aodTrack,detpid,timezero,esd->GetMagneticField());\r
+               SetAODPID(esdCascadeNeg,aodTrack,detpid,esd->GetMagneticField(),esdPid);\r
                }\r
                else {\r
                        aodTrack = dynamic_cast<AliAODTrack*>(aodTrackRefs->At(idxNegFromV0Dghter));\r
@@ -829,7 +850,7 @@ void AliAnalysisTaskESDfilter::ConvertESDtoAOD() {
            if (esdV0Pos->GetSign() > 0) nPosTracks++;\r
            aodTrack->ConvertAliPIDtoAODPID();\r
            aodTrack->SetFlags(esdV0Pos->GetStatus());\r
-            SetAODPID(esdV0Pos,aodTrack,detpid,timezero,esd->GetMagneticField());\r
+            SetAODPID(esdV0Pos,aodTrack,detpid,esd->GetMagneticField(),esdPid);\r
        }\r
        else {\r
            aodTrack = dynamic_cast<AliAODTrack*>(aodTrackRefs->At(posFromV0));\r
@@ -873,7 +894,7 @@ void AliAnalysisTaskESDfilter::ConvertESDtoAOD() {
            if (esdV0Neg->GetSign() > 0) nPosTracks++;\r
            aodTrack->ConvertAliPIDtoAODPID();\r
            aodTrack->SetFlags(esdV0Neg->GetStatus());\r
-            SetAODPID(esdV0Neg,aodTrack,detpid,timezero,esd->GetMagneticField());\r
+            SetAODPID(esdV0Neg,aodTrack,detpid,esd->GetMagneticField(),esdPid);\r
        }\r
        else {\r
            aodTrack = dynamic_cast<AliAODTrack*>(aodTrackRefs->At(negFromV0));\r
@@ -1009,7 +1030,7 @@ void AliAnalysisTaskESDfilter::ConvertESDtoAOD() {
                        mother->ConvertAliPIDtoAODPID();\r
                        primary->AddDaughter(mother);\r
                        mother->ConvertAliPIDtoAODPID();\r
-                        SetAODPID(esdTrackM,mother,detpid,timezero,esd->GetMagneticField());\r
+                        SetAODPID(esdTrackM,mother,detpid,esd->GetMagneticField(),esdPid);\r
                    }\r
                    else {\r
 //                     cerr << "Error: event " << esd->GetEventNumberInFile() << " kink " << TMath::Abs(ikink)-1\r
@@ -1067,7 +1088,7 @@ void AliAnalysisTaskESDfilter::ConvertESDtoAOD() {
                        daughter->ConvertAliPIDtoAODPID();\r
                        vkink->AddDaughter(daughter);\r
                        daughter->ConvertAliPIDtoAODPID();\r
-                       SetAODPID(esdTrackD,daughter,detpid,timezero,esd->GetMagneticField());\r
+                       SetAODPID(esdTrackD,daughter,detpid,esd->GetMagneticField(),esdPid);\r
                    }\r
                    else {\r
 //                     cerr << "Error: event " << esd->GetEventNumberInFile() << " kink " << TMath::Abs(ikink)-1\r
@@ -1131,7 +1152,7 @@ void AliAnalysisTaskESDfilter::ConvertESDtoAOD() {
        if (esdTrack->GetSign() > 0) nPosTracks++;\r
        aodTrack->SetFlags(esdTrack->GetStatus());\r
        aodTrack->ConvertAliPIDtoAODPID();\r
-       SetAODPID(esdTrack,aodTrack,detpid,timezero,esd->GetMagneticField());\r
+       SetAODPID(esdTrack,aodTrack,detpid,esd->GetMagneticField(),esdPid);\r
     } // end of loop on tracks\r
     \r
     // Update number of AOD tracks in header at the end of track loop (M.G.)\r
@@ -1344,12 +1365,12 @@ void AliAnalysisTaskESDfilter::ConvertESDtoAOD() {
     delete    aodV0Refs;\r
     delete    aodV0VtxRefs;\r
     delete    aodTrackRefs;\r
-\r
+    delete    esdPid;\r
     return;\r
 }\r
 \r
 \r
-void AliAnalysisTaskESDfilter::SetAODPID(AliESDtrack *esdtrack, AliAODTrack *aodtrack, AliAODPid *detpid, Double_t timezero, Double_t bfield)\r
+void AliAnalysisTaskESDfilter::SetAODPID(AliESDtrack *esdtrack, AliAODTrack *aodtrack, AliAODPid *detpid, Double_t bfield, AliESDpid *esdpid)\r
 {\r
   //\r
   // Setter for the raw PID detector signals\r
@@ -1380,13 +1401,13 @@ void AliAnalysisTaskESDfilter::SetAODPID(AliESDtrack *esdtrack, AliAODTrack *aod
     if (pidSave) {\r
       if(!aodtrack->GetDetPid()){// prevent memory leak when calling SetAODPID twice for the same track\r
        detpid = new AliAODPid();\r
-       SetDetectorRawSignals(detpid,esdtrack,timezero, bfield);\r
+       SetDetectorRawSignals(detpid,esdtrack, bfield, esdpid);\r
        aodtrack->SetDetPID(detpid);\r
       }\r
     }\r
 }\r
 \r
-void AliAnalysisTaskESDfilter::SetDetectorRawSignals(AliAODPid *aodpid, AliESDtrack *track, Double_t timezero, Double_t bfield)\r
+void AliAnalysisTaskESDfilter::SetDetectorRawSignals(AliAODPid *aodpid, AliESDtrack *track, Double_t bfield, AliESDpid *esdpid)\r
 {\r
 //\r
 //assignment of the detector signals (AliXXXesdPID inspired)\r
@@ -1422,10 +1443,19 @@ void AliAnalysisTaskESDfilter::SetDetectorRawSignals(AliAODPid *aodpid, AliESDtr
  }\r
 \r
  aodpid->SetTRDsignal(track->GetNumberOfTRDslices()*6,trdslices);\r
+\r
+ //TOF PID  \r
  Double_t times[AliAODPid::kSPECIES]; track->GetIntegratedTimes(times);\r
  aodpid->SetIntegratedTimes(times);\r
+ Float_t tzeroTrack = esdpid->GetTOFResponse().GetStartTime(track->P());\r
+ aodpid->SetTOFsignal(track->GetTOFsignal()-tzeroTrack);\r
 \r
- aodpid->SetTOFsignal(track->GetTOFsignal()-timezero); // to be fixed\r
+ Double_t tofRes[5];\r
+ for (Int_t iMass=0; iMass<5; iMass++){\r
+   tofRes[iMass]=(Double_t)esdpid->GetTOFResponse().GetExpectedSigma(track->P(), times[iMass], AliPID::ParticleMass(iMass));\r
+ }\r
+ aodpid->SetTOFpidResolution(tofRes);\r
\r
  aodpid->SetHMPIDsignal(track->GetHMPIDsignal());\r
 \r
  //Extrapolate track to EMCAL surface for AOD-level track-cluster matching\r
index 89a24ec..eccca31 100644 (file)
@@ -1,68 +1,70 @@
-#ifndef ALIANALYSISTASKESDFILTER_H
-#define ALIANALYSISTASKESDFILTER_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-/* $Id: AliAnalysisTaskESDfilter.h 24429 2008-03-12 10:27:50Z jgrosseo $ */
-
-#include <TList.h> 
-#include <TF1.h> 
-#include "AliAnalysisTaskSE.h"
-#include "AliESDtrack.h"
-#include "AliAODTrack.h"
-#include "AliAODPid.h"
-class AliAnalysisFilter;
-class AliStack;
-class AliESDtrack;
-
-class AliAnalysisTaskESDfilter : public AliAnalysisTaskSE
-{
- public:
-    AliAnalysisTaskESDfilter();
-    AliAnalysisTaskESDfilter(const char* name);
-    virtual ~AliAnalysisTaskESDfilter() {;}
-    // Implementation of interface methods
-    virtual void   UserCreateOutputObjects();
-    virtual void   Init();
-    virtual void   LocalInit() {Init();}
-    virtual void   UserExec(Option_t *option);
-    virtual void   Terminate(Option_t *option);
-
-    virtual void ConvertESDtoAOD();
-    // Setters
-    virtual void SetTrackFilter   (AliAnalysisFilter*   trackF) {fTrackFilter    =   trackF;}
-    virtual void SetTPCOnlyFilterMask (UInt_t filterMask)       {fTPCOnlyFilterMask    =  filterMask;}
-    virtual void SetKinkFilter    (AliAnalysisFilter*    KinkF) {fKinkFilter     =    KinkF;}
-    virtual void SetV0Filter      (AliAnalysisFilter*      V0F) {fV0Filter       =      V0F;}
-    virtual void SetCascadeFilter (AliAnalysisFilter* CascadeF) {fCascadeFilter  = CascadeF;}
-    virtual void SetPthreshold    (Double_t p)                  {fHighPthreshold =        p;}
-    virtual void SetPshape        (TF1 *func)                   {fPtshape        =     func;}
-    virtual void SetEnableFillAOD (Bool_t b)                    {fEnableFillAOD  =     b;}
-
-    virtual void SetAODPID(AliESDtrack *esdtrack, AliAODTrack *aodtrack, AliAODPid *detpid, Double_t timezero, Double_t bfield);
-    void SetDetectorRawSignals(AliAODPid *aodpid, AliESDtrack *track, Double_t timezero, Double_t bfield);
-
- private:
-    AliAnalysisTaskESDfilter(const AliAnalysisTaskESDfilter&);
-    AliAnalysisTaskESDfilter& operator=(const AliAnalysisTaskESDfilter&);
-    void PrintMCInfo(AliStack *pStack,Int_t label); // for debugging
-    Double_t Chi2perNDF(AliESDtrack* track);
-    
-    // Filtering
-    AliAnalysisFilter* fTrackFilter;      //  Track   Filter
-    AliAnalysisFilter* fKinkFilter;       //  Kink    Filter
-    AliAnalysisFilter* fV0Filter;         //  V0      Filter
-    AliAnalysisFilter* fCascadeFilter;    //  Cascade Filter
-    UInt_t             fTPCOnlyFilterMask;//  Fitler Mask used to select and store refitted TPC only tracks
-
-
-    // PID
-    Double_t     fHighPthreshold;    //  Pt threshold for detector signal setting
-    TF1 *        fPtshape;           //  Pt spectrum distribution
-    Bool_t       fEnableFillAOD;     //  value that decides if this task activates AOD filling
-
-    ClassDef(AliAnalysisTaskESDfilter, 5); // Analysis task for standard ESD filtering
-};
-#endif
+#ifndef ALIANALYSISTASKESDFILTER_H\r
+#define ALIANALYSISTASKESDFILTER_H\r
\r
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
+ * See cxx source for full Copyright notice                               */\r
+\r
+/* $Id: AliAnalysisTaskESDfilter.h 24429 2008-03-12 10:27:50Z jgrosseo $ */\r
+\r
+#include <TList.h> \r
+#include <TF1.h> \r
+#include "AliAnalysisTaskSE.h"\r
+#include "AliESDtrack.h"\r
+#include "AliAODTrack.h"\r
+#include "AliAODPid.h"\r
+#include "AliESDpid.h"\r
+\r
+class AliAnalysisFilter;\r
+class AliStack;\r
+class AliESDtrack;\r
+\r
+class AliAnalysisTaskESDfilter : public AliAnalysisTaskSE\r
+{\r
+ public:\r
+    AliAnalysisTaskESDfilter();\r
+    AliAnalysisTaskESDfilter(const char* name);\r
+    virtual ~AliAnalysisTaskESDfilter() {;}\r
+    // Implementation of interface methods\r
+    virtual void   UserCreateOutputObjects();\r
+    virtual void   Init();\r
+    virtual void   LocalInit() {Init();}\r
+    virtual void   UserExec(Option_t *option);\r
+    virtual void   Terminate(Option_t *option);\r
+\r
+    virtual void ConvertESDtoAOD();\r
+    // Setters\r
+    virtual void SetTrackFilter   (AliAnalysisFilter*   trackF) {fTrackFilter    =   trackF;}\r
+    virtual void SetTPCOnlyFilterMask (UInt_t filterMask)       {fTPCOnlyFilterMask    =  filterMask;}\r
+    virtual void SetKinkFilter    (AliAnalysisFilter*    KinkF) {fKinkFilter     =    KinkF;}\r
+    virtual void SetV0Filter      (AliAnalysisFilter*      V0F) {fV0Filter       =      V0F;}\r
+    virtual void SetCascadeFilter (AliAnalysisFilter* CascadeF) {fCascadeFilter  = CascadeF;}\r
+    virtual void SetPthreshold    (Double_t p)                  {fHighPthreshold =        p;}\r
+    virtual void SetPshape        (TF1 *func)                   {fPtshape        =     func;}\r
+    virtual void SetEnableFillAOD (Bool_t b)                    {fEnableFillAOD  =     b;}\r
+\r
+    virtual void SetAODPID(AliESDtrack *esdtrack, AliAODTrack *aodtrack, AliAODPid *detpid, Double_t bfield, AliESDpid *esdpid);\r
+    void SetDetectorRawSignals(AliAODPid *aodpid, AliESDtrack *track, Double_t bfield, AliESDpid *esdpid);\r
+\r
+ private:\r
+    AliAnalysisTaskESDfilter(const AliAnalysisTaskESDfilter&);\r
+    AliAnalysisTaskESDfilter& operator=(const AliAnalysisTaskESDfilter&);\r
+    void PrintMCInfo(AliStack *pStack,Int_t label); // for debugging\r
+    Double_t Chi2perNDF(AliESDtrack* track);\r
+    \r
+    // Filtering\r
+    AliAnalysisFilter* fTrackFilter;      //  Track   Filter\r
+    AliAnalysisFilter* fKinkFilter;       //  Kink    Filter\r
+    AliAnalysisFilter* fV0Filter;         //  V0      Filter\r
+    AliAnalysisFilter* fCascadeFilter;    //  Cascade Filter\r
+    UInt_t             fTPCOnlyFilterMask;//  Fitler Mask used to select and store refitted TPC only tracks\r
+\r
+\r
+    // PID\r
+    Double_t     fHighPthreshold;    //  Pt threshold for detector signal setting\r
+    TF1 *        fPtshape;           //  Pt spectrum distribution\r
+    Bool_t       fEnableFillAOD;     //  value that decides if this task activates AOD filling\r
+\r
+    ClassDef(AliAnalysisTaskESDfilter, 5); // Analysis task for standard ESD filtering\r
+};\r
\r
+#endif\r
index b359af9..41a5e2a 100644 (file)
@@ -41,6 +41,7 @@ AliAODPid::AliAODPid():
   // default constructor
     for(Int_t i=0; i<kSPECIES; i++) fIntTime[i]=0; 
     for(Int_t i=0; i<3; i++) fEMCALPosition[i] = 0.;
+    for(Int_t i=0; i<5; i++) fTOFpidResolution[i] = 0.;
   
 }
 
@@ -74,6 +75,8 @@ AliAODPid::AliAODPid(const AliAODPid& pid) :
       fEMCALMomentum[i]=pid.fEMCALMomentum[i];
     }
     for(Int_t i=0; i<6; i++) fTRDmomentum[i]=pid.fTRDmomentum[i];
+
+    for(Int_t i=0; i<5; i++) fTOFpidResolution[i]=pid.fTOFpidResolution[i];
 }
 
 //______________________________________________________________________________
@@ -102,6 +105,7 @@ AliAODPid& AliAODPid::operator=(const AliAODPid& pid)
       fEMCALPosition[i]=pid.fEMCALPosition[i];
       fEMCALMomentum[i]=pid.fEMCALMomentum[i];
     }
+    for (Int_t i=0; i<5; i++) fTOFpidResolution[i]=pid.fTOFpidResolution[i];
   }
 
   return *this;
@@ -142,3 +146,15 @@ void AliAODPid::SetEMCALMomentum(Double_t emcmom[3])
  // Sets the array with extrapolated track momentum at the EMCAL surface
   for(Int_t i=0; i<3; i++) fEMCALMomentum[i]=emcmom[i];
 }
+//______________________________________________________________________________
+void AliAODPid::SetTOFpidResolution(Double_t tofPIDres[5])
+{
+  for (Int_t i=0; i<5; i++) fTOFpidResolution[i]=tofPIDres[i];
+
+}
+//______________________________________________________________________________
+void AliAODPid::GetTOFpidResolution(Double_t tofRes[5]) const
+{
+  for (Int_t i=0; i<5; i++) tofRes[i]=fTOFpidResolution[i];
+}
+
index 37bf870..5893aa1 100644 (file)
@@ -30,6 +30,7 @@ class AliAODPid : public TObject {
   void      SetTRDsignal(Int_t nslices, Double_t* trdslices)   {fTRDnSlices = nslices; fTRDslices=trdslices;}
   void      SetTRDmomentum(Int_t nplane, Float_t trdMom)       {fTRDmomentum[nplane]=trdMom;}
   void      SetTOFsignal(Double_t tof)                         {fTOFesdsignal=tof;}
+  void      SetTOFpidResolution(Double_t tofPIDres[5]);
   void      SetIntegratedTimes(Double_t timeint[5]);
   void      SetHMPIDsignal(Double_t hmpid)                     {fHMPIDsignal=hmpid;}
   void      SetEMCALPosition(Double_t emcalpos[3]);
@@ -48,6 +49,7 @@ class AliAODPid : public TObject {
   void      GetIntegratedTimes(Double_t timeint[5])  const; 
   void      GetEMCALPosition  (Double_t emcalpos[3]) const;
   void      GetEMCALMomentum  (Double_t emcalmom[3]) const;
+  void      GetTOFpidResolution (Double_t tofRes[5]) const;
 
  private :
   Double32_t  fITSsignal;        //[0.,0.,10] detector raw signal
@@ -58,6 +60,7 @@ class AliAODPid : public TObject {
   Double32_t* fTRDslices;        //[fTRDnSlices]
   Float_t     fTRDmomentum[6];   // momentum at the TRD layers
   Double32_t  fTOFesdsignal;     // TOF signal - t0 (T0 interaction time)
+  Double32_t  fTOFpidResolution[5]; // TOF pid resolution for each mass hypotesys 
   Double32_t  fIntTime[5];       // track time hypothesis
   Double32_t  fHMPIDsignal;      // detector raw signal
   Double32_t  fEMCALPosition[3]; // global position of track
@@ -65,7 +68,7 @@ class AliAODPid : public TObject {
   Double32_t  fEMCALMomentum[3]; // momentum of track
                                 // extrapolated to EMCAL surface
 
-  ClassDef(AliAODPid, 4);
+  ClassDef(AliAODPid, 5);
 };
 
 #endif