ove all PID related things to AliFlowTrackCuts, make Bethe Bloch parameters user...
authorsnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 20 Jan 2011 12:28:24 +0000 (12:28 +0000)
committersnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 20 Jan 2011 12:28:24 +0000 (12:28 +0000)
PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.cxx
PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.h
PWG2/FLOW/AliFlowTasks/AliFlowTrackCuts.cxx
PWG2/FLOW/AliFlowTasks/AliFlowTrackCuts.h
PWG2/FLOW/macros/AddTaskFlow.C
PWG2/FLOW/macros/AddTaskFlowCentrality.C
PWG2/FLOW/macros/AddTaskTenderTOF.C

index 1ef1cea..53a1666 100644 (file)
@@ -71,8 +71,6 @@
 #include "AliFlowCommonConstants.h"
 #include "AliAnalysisTaskFlowEvent.h"
 
-#include "AliESDpid.h"
-
 #include "AliLog.h"
 
 ClassImp(AliAnalysisTaskFlowEvent)
@@ -123,8 +121,7 @@ AliAnalysisTaskFlowEvent::AliAnalysisTaskFlowEvent() :
   fV2(0.),
   fV3(0.),
   fV4(0.),
-  fMyTRandom3(NULL),
-  fESDpid(NULL)
+  fMyTRandom3(NULL)
 {
   // Constructor
   cout<<"AliAnalysisTaskFlowEvent::AliAnalysisTaskFlowEvent()"<<endl;
@@ -176,8 +173,7 @@ AliAnalysisTaskFlowEvent::AliAnalysisTaskFlowEvent(const char *name, TString RPt
   fV2(0.),
   fV3(0.),
   fV4(0.),
-  fMyTRandom3(NULL),
-  fESDpid(NULL)
+  fMyTRandom3(NULL)
 {
   // Constructor
   cout<<"AliAnalysisTaskFlowEvent::AliAnalysisTaskFlowEvent(const char *name, Bool_t on, UInt_t iseed)"<<endl;
@@ -193,9 +189,6 @@ AliAnalysisTaskFlowEvent::AliAnalysisTaskFlowEvent(const char *name, TString RPt
   if( fLoadCandidates )
     DefineInput(availableINslot, TObjArray::Class());
 
-  //PID
-  fESDpid=new AliESDpid();
-
   // Define output slots here
   // Define here the flow event output
   DefineOutput(1, AliFlowEventSimple::Class());
@@ -217,7 +210,6 @@ AliAnalysisTaskFlowEvent::~AliAnalysisTaskFlowEvent()
   // Destructor
   //
   delete fMyTRandom3;
-  delete fESDpid;
   // objects in the output list are deleted
   // by the TSelector dtor (I hope)
 
@@ -246,44 +238,6 @@ void AliAnalysisTaskFlowEvent::UserCreateOutputObjects()
     exit(1);
   }
 
-  //PID
-  if (fCutsRP->GetParamType()==AliFlowTrackCuts::kMC)
-  {
-    fESDpid->GetTPCResponse().SetBetheBlochParameters( 2.15898e+00/50.,
-                                                       1.75295e+01,
-                                                       3.40030e-09,
-                                                       1.96178e+00,
-                                                       3.91720e+00);
-  }
-  else
-  {
-    fESDpid->GetTPCResponse().SetBetheBlochParameters( 0.0283086,
-                                                       2.63394e+01,
-                                                       5.04114e-11,
-                                                       2.12543e+00,
-                                                       4.88663e+00 );
-  }
-
-  // Added by F. Noferini for TOF PID
-  // F. Noferini personal tuning for DATA
-  if(0){
-    Double_t AlephParameters[5];
-    
-    AlephParameters[0] = 4.36414e-02;
-    AlephParameters[1] = 1.75977e+01;
-    AlephParameters[2] = 1.14385e-08;
-    AlephParameters[3] = 2.27907e+00;
-    AlephParameters[4] = 3.36699e+00;
-    
-    Float_t mip = 49;
-    fESDpid->GetTPCResponse().SetBetheBlochParameters(AlephParameters[0],AlephParameters[1],AlephParameters[2],AlephParameters[3],AlephParameters[4]);
-    fESDpid->GetTPCResponse().SetMip(mip);
-  }
-  // End F. Noferini added part
-
-  fCutsRP->SetESDpid(fESDpid);
-  fCutsPOI->SetESDpid(fESDpid);
-
   //set the common constants
   AliFlowCommonConstants* cc = AliFlowCommonConstants::GetMaster();
   cc->SetNbinsMult(fNbinsMult);
@@ -317,11 +271,6 @@ void AliAnalysisTaskFlowEvent::UserExec(Option_t *)
   AliESDPmdTrack* pmdtracks = NULL;//pmd      
   TH2F* histFMD = NULL;
 
-  // Added by F. Noferini for TOF PID
-  fESDpid->SetTOFResponse(myESD,AliESDpid::kTOF_T0);
-  fESDpid->MakePID(myESD,kFALSE);
-  // End F. Noferini added part
-
   int availableINslot=1;
   if(strcmp(fRPType,"FMD")==0) {
     TList* FMDdata = dynamic_cast<TList*>(GetInputData(availableINslot++));
@@ -336,7 +285,6 @@ void AliAnalysisTaskFlowEvent::UserExec(Option_t *)
     }
   }
 
-
   if (!(fCutsRP&&fCutsPOI&&fCutsEvent))
   {
     AliError("cuts not set");
@@ -352,8 +300,6 @@ void AliAnalysisTaskFlowEvent::UserExec(Option_t *)
     //first attach all possible information to the cuts
     fCutsRP->SetEvent( InputEvent(), MCEvent() );  //attach event
     fCutsPOI->SetEvent( InputEvent(), MCEvent() );
-    fCutsRP->SetESDpid(fESDpid);
-    fCutsPOI->SetESDpid(fESDpid);
 
     //then make the event
     flowEvent = new AliFlowEvent( fCutsRP, fCutsPOI );
index fec170a..735ee24 100644 (file)
@@ -163,9 +163,6 @@ class AliAnalysisTaskFlowEvent : public AliAnalysisTaskSE {
   TRandom3* fMyTRandom3;     // TRandom3 generator
   // end afterburner
   
-  //PID stuff
-  AliESDpid *fESDpid;//pid object
-
   ClassDef(AliAnalysisTaskFlowEvent, 1); // example of analysis
 };
 
index 8d44756..1c90ebf 100644 (file)
@@ -93,7 +93,7 @@ AliFlowTrackCuts::AliFlowTrackCuts():
   fMCparticle(NULL),
   fEvent(NULL),
   fTPCtrack(),
-  fESDpid(NULL),
+  fESDpid(),
   fPIDsource(kTPCTOFpid),
   fTPCpidCuts(NULL),
   fTOFpidCuts(NULL),
@@ -142,7 +142,7 @@ AliFlowTrackCuts::AliFlowTrackCuts(const char* name):
   fMCparticle(NULL),
   fEvent(NULL),
   fTPCtrack(),
-  fESDpid(NULL),
+  fESDpid(),
   fPIDsource(kTPCTOFpid),
   fTPCpidCuts(NULL),
   fTOFpidCuts(NULL),
@@ -152,6 +152,12 @@ AliFlowTrackCuts::AliFlowTrackCuts(const char* name):
   //constructor 
   SetName(name);
   SetTitle("AliFlowTrackCuts");
+  fESDpid.GetTPCResponse().SetBetheBlochParameters( 0.0283086,
+                                                    2.63394e+01,
+                                                    5.04114e-11,
+                                                    2.12543e+00,
+                                                    4.88663e+00 );
+
 }
 
 //-----------------------------------------------------------------------
@@ -270,6 +276,45 @@ AliFlowTrackCuts::~AliFlowTrackCuts()
 }
 
 //-----------------------------------------------------------------------
+void AliFlowTrackCuts::SetEvent(AliVEvent* event, AliMCEvent* mcEvent)
+{
+  //set the event
+  Clear();
+  fEvent=event;
+  fMCevent=mcEvent;
+
+  //do the magic for ESD
+  AliESDEvent* myESD = dynamic_cast<AliESDEvent*>(event);
+  if (fCutPID && myESD)
+  {
+    //TODO: maybe call it only for the TOF options?
+    // Added by F. Noferini for TOF PID
+    fESDpid.SetTOFResponse(myESD,AliESDpid::kTOF_T0);
+    fESDpid.MakePID(myESD,kFALSE);
+    // End F. Noferini added part
+  }
+
+  //TODO: AOD
+}
+
+//-----------------------------------------------------------------------
+void AliFlowTrackCuts::SetCutMC( Bool_t b )
+{
+  //will we be cutting on MC information?
+  fCutMC=b;
+
+  //if we cut on MC info then also the Bethe Bloch should be the one tuned for MC
+  if (fCutMC)
+  {
+    fESDpid.GetTPCResponse().SetBetheBlochParameters( 2.15898e+00/50.,
+                                                       1.75295e+01,
+                                                       3.40030e-09,
+                                                       1.96178e+00,
+                                                       3.91720e+00);
+  }
+}
+
+//-----------------------------------------------------------------------
 Bool_t AliFlowTrackCuts::IsSelected(TObject* obj, Int_t id)
 {
   //check cuts
@@ -772,13 +817,18 @@ void AliFlowTrackCuts::Clear(Option_t*)
 Bool_t AliFlowTrackCuts::PassesTOFpidCut(AliESDtrack* t )
 {
   //check if passes PID cut using timing in TOF
-  if (!fESDpid) return kFALSE;
-  if (!(t && (t->GetStatus() & AliESDtrack::kTOFout) && (t->GetStatus() & AliESDtrack::kTIME)
-       && (t->GetTOFsignal() > 12000) && (t->GetTOFsignal() < 100000) && (t->GetIntegratedLength() > 365)))
-       return kFALSE;
+  Bool_t goodtrack = (t) && 
+                     (t->GetStatus() & AliESDtrack::kTOFpid) && 
+                     (t->GetTOFsignal() > 12000) && 
+                     (t->GetTOFsignal() < 100000) && 
+                     (t->GetIntegratedLength() > 365) && 
+                    !(t->GetStatus() & AliESDtrack::kTOFmismatch);
+
+  if (!goodtrack) return kFALSE;
+  
   Float_t pt = t->Pt();
   Float_t p = t->GetP();
-  Float_t trackT0 = fESDpid->GetTOFResponse().GetStartTime(p);
+  Float_t trackT0 = fESDpid.GetTOFResponse().GetStartTime(p);
   Float_t timeTOF = t->GetTOFsignal()- trackT0; 
   //2=pion 3=kaon 4=protons
   Double_t inttimes[5] = {-1.0,-1.0,-1.0,-1.0,-1.0};
@@ -815,10 +865,6 @@ Bool_t AliFlowTrackCuts::PassesTOFpidCut(AliESDtrack* t )
 Bool_t AliFlowTrackCuts::PassesTPCpidCut(AliESDtrack* track)
 {
   //check if passes PID cut using dedx signal in the TPC
-  if (!fESDpid) 
-  {
-    return kFALSE;
-  }
   if (!fTPCpidCuts)
   {
     printf("no TPCpidCuts\n");
@@ -827,7 +873,7 @@ Bool_t AliFlowTrackCuts::PassesTPCpidCut(AliESDtrack* track)
 
   const AliExternalTrackParam* tpcparam = track->GetInnerParam();
   if (!tpcparam) return kFALSE;
-  Float_t sigExp = fESDpid->GetTPCResponse().GetExpectedSignal(tpcparam->GetP(), fAliPID);
+  Float_t sigExp = fESDpid.GetTPCResponse().GetExpectedSignal(tpcparam->GetP(), fAliPID);
   Float_t sigTPC = track->GetTPCsignal();
   Float_t s = (sigTPC-sigExp)/sigExp;
   Double_t pt = track->Pt();
@@ -1018,10 +1064,6 @@ void AliFlowTrackCuts::InitPIDcuts()
 //-----------------------------------------------------------------------
 // part added by F. Noferini (some methods)
 Bool_t AliFlowTrackCuts::PassesTOFbayesianCut(AliESDtrack* track){
-  if (!fESDpid) 
-  {
-    return kFALSE;
-  }
   SetPriors();
 
   Bool_t goodtrack = track && (track->GetStatus() & AliESDtrack::kTOFpid) && (track->GetTOFsignal() > 12000) && (track->GetTOFsignal() < 100000) && (track->GetIntegratedLength() > 365) && !(track->GetStatus() & AliESDtrack::kTOFmismatch);
@@ -1236,8 +1278,8 @@ Int_t AliFlowTrackCuts::GetESDPdg(AliESDtrack *track,Option_t *option,Int_t ipar
     track->GetIntegratedTimes(exptimes);
 
     // Take resolution for TOF response
-    // like fESDpid->GetTOFResponse().GetExpectedSigma(p, exptimes[ipart], mass[ipart]);
-    Float_t resolution = fESDpid->GetTOFResponse().GetExpectedSigma(p, exptimes[ipart], mass[ipart]);
+    // like fESDpid.GetTOFResponse().GetExpectedSigma(p, exptimes[ipart], mass[ipart]);
+    Float_t resolution = fESDpid.GetTOFResponse().GetExpectedSigma(p, exptimes[ipart], mass[ipart]);
 
     if(TMath::Abs(exptimes[ipart] - track->GetTOFsignal()) < 3 * resolution){
       pdg = pdgvalues[ipart] * Int_t(track->GetSign());
index 8b2395f..ee1d19a 100644 (file)
@@ -15,6 +15,7 @@
 #include "TMCProcess.h"
 #include "AliESDtrack.h"
 #include "AliPID.h"
+#include "AliESDpid.h"
 
 class TObjArray;
 class AliVParticle;
@@ -23,7 +24,6 @@ class AliFlowTrack;
 class AliMCEvent;
 class AliVEvent;
 class AliMultiplicity; 
-class AliESDpid;
 
 class AliFlowTrackCuts : public AliFlowTrackSimpleCuts {
 
@@ -99,10 +99,10 @@ class AliFlowTrackCuts : public AliFlowTrackSimpleCuts {
   TObjArray* GetQA() const {return fQA;}
 
   //MC stuff
-  void SetCutMC( Bool_t b=kTRUE ) {fCutMC=b;}
-  void SetMCprocessType( TMCProcess t ) { fMCprocessType = t; fCutMCprocessType=kTRUE; fCutMC=kTRUE;}
-  void SetMCisPrimary( Bool_t b ) { fMCisPrimary=b; fCutMCisPrimary=kTRUE; fCutMC=kTRUE;}
-  void SetMCPID( Int_t pid ) { fMCPID=pid; fCutMCPID=kTRUE; fCutMC=kTRUE; }
+  void SetCutMC( Bool_t b=kTRUE );
+  void SetMCprocessType( TMCProcess t ) { fMCprocessType = t; fCutMCprocessType=kTRUE; SetCutMC();}
+  void SetMCisPrimary( Bool_t b ) { fMCisPrimary=b; fCutMCisPrimary=kTRUE; SetCutMC();}
+  void SetMCPID( Int_t pid ) { fMCPID=pid; fCutMCPID=kTRUE; SetCutMC(); }
   TMCProcess GetMCprocessType() const { return fMCprocessType; }
   Bool_t GetMCisPrimary() const {return fMCisPrimary;}
   Int_t GetMCPID() const {return fMCPID;}
@@ -123,7 +123,7 @@ class AliFlowTrackCuts : public AliFlowTrackSimpleCuts {
   
   void SetMCevent(AliMCEvent* mcEvent) {fMCevent=mcEvent;}
   AliMCEvent* GetMCevent() const {return fMCevent;}
-  void SetEvent(AliVEvent* event, AliMCEvent* mcEvent=NULL) {Clear();fEvent=event;fMCevent=mcEvent;}
+  void SetEvent(AliVEvent* event, AliMCEvent* mcEvent=NULL);
   AliVEvent* GetEvent() const {return fEvent;}
   Int_t GetNumberOfInputObjects() const;
   TObject* GetInputObject(Int_t i);
@@ -131,10 +131,10 @@ class AliFlowTrackCuts : public AliFlowTrackSimpleCuts {
 
   //PID
   void SetPID(AliPID::EParticleType pid, PIDsource s=kTPCTOFpid) {fAliPID=pid; fPIDsource=s; fCutPID=kTRUE; InitPIDcuts();}
-  void SetESDpid(AliESDpid* o) {fESDpid=o;}
   void SetTPCTOFpidCrossOverPt(Double_t pt) {fTPCTOFpidCrossOverPt=pt;}
   void SetTPCpidCuts(TMatrixF* mat) {fTPCpidCuts=new TMatrixF(*mat);}
   void SetTOFpidCuts(TMatrixF* mat) {fTOFpidCuts=new TMatrixF(*mat);}
+  AliESDpid& GetESDpid() {return fESDpid;}
 
  protected:
   Bool_t PassesCuts(AliVParticle* track);
@@ -195,7 +195,7 @@ class AliFlowTrackCuts : public AliFlowTrackSimpleCuts {
   AliESDtrack fTPCtrack;             //!placeholder for TPC only track to avoid new/delete on every track
 
   //PID
-  AliESDpid* fESDpid; //pid obj
+  AliESDpid fESDpid; //pid obj
   PIDsource fPIDsource; //pid source
   TMatrixF* fTPCpidCuts; //tpc pid cuts
   TMatrixF* fTOFpidCuts; //tof pid cuts
index 83f7c17..10a06a0 100644 (file)
@@ -157,6 +157,9 @@ void AddTaskFlow(Float_t centrMin=-1,
     //cutsPOI->SetPID(AliPID::kPion, AliFlowTrackCuts::kTPCpid);
     //cutsPOI->SetPID(AliPID::kProton, AliFlowTrackCuts::kTPCTOFpid);
     //cutsPOI->SetTPCTOFpidCrossOverPt(0.4);
+    //francesco's TPC Bethe Bloch for data:
+    //cutsPOI->GetESDpid().GetTPCResponse().SetBetheBlochParameters(4.36414e-02,1.75977e+01,1.14385e-08,2.27907e+00,3.36699e+00);
+    //cutsPOI->GetESDpid().GetTPCResponse().SetMip(49);
   }
 
   Bool_t useWeights  = WEIGHTS[0] || WEIGHTS[1] || WEIGHTS[2];
index b4ec558..b7a0686 100644 (file)
@@ -147,6 +147,9 @@ void AddTaskFlowCentrality( Float_t centrMin=0.,
   //cutsPOI->SetPID(AliPID::kPion, AliFlowTrackCuts::kTPCpid);
   //cutsPOI->SetPID(AliPID::kProton, AliFlowTrackCuts::kTPCTOFpid);
   //cutsPOI->SetTPCTOFpidCrossOverPt(0.4);
+  //iexample: francesco's tunig TPC Bethe Bloch for data:
+  //cutsPOI->GetESDpid().GetTPCResponse().SetBetheBlochParameters(4.36414e-02,1.75977e+01,1.14385e-08,2.27907e+00,3.36699e+00);
+  //cutsPOI->GetESDpid().GetTPCResponse().SetMip(49);
 
   Bool_t useWeights  = WEIGHTS[0] || WEIGHTS[1] || WEIGHTS[2];
   if (useWeights) cout<<"Weights are used"<<endl;
index 74a969d..75ee1cd 100644 (file)
@@ -1,4 +1,4 @@
-AliAnalysisTask *AddTaskTenderTOF(Float_t tofres = 80,Bool_t corrExpTimes=kTRUE,Bool_t applyT0=kFALSE){
+AliAnalysisTask *AddTaskTenderTOF(Float_t tofres = 80,Bool_t corrExpTimes=kFALSE,Bool_t applyT0=kFALSE){
   //get the current analysis manager
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   if (!mgr) {