Savannah request #94499
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 15 May 2012 20:58:42 +0000 (20:58 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 15 May 2012 20:58:42 +0000 (20:58 +0000)
 Pietro Antonioli

OADB/COMMON/PID/data/TOFPIDParams.root [new file with mode: 0644]
STEER/AOD/AliAODpidUtil.h
STEER/CMakelibSTEERBase.pkg
STEER/STEERBase/AliPIDResponse.cxx
STEER/STEERBase/AliPIDResponse.h
STEER/STEERBase/AliTOFPIDParams.cxx [new file with mode: 0644]
STEER/STEERBase/AliTOFPIDParams.h [new file with mode: 0644]
STEER/STEERBase/AliTOFPIDResponse.h
STEER/STEERBaseLinkDef.h

diff --git a/OADB/COMMON/PID/data/TOFPIDParams.root b/OADB/COMMON/PID/data/TOFPIDParams.root
new file mode 100644 (file)
index 0000000..52e781b
Binary files /dev/null and b/OADB/COMMON/PID/data/TOFPIDParams.root differ
index 451ed6c..3b66e9d 100644 (file)
 //                    for the AOD class
 //   Origin: Rosa Romita, GSI, r.romita@gsi.de 
 //   Modified: Jens Wiechula, Uni Tuebingen, jens.wiechula@cern.ch
+//   Modified: Pietro Antonioli, INFN BO, pietro.antonioli@bo.infn.it
 //-------------------------------------------------------
 #include <Rtypes.h>
 #include <TMatrixD.h>
+#include "AliAODEvent.h" // Needed for inline functions
 #include "AliAODTrack.h" // Needed for inline functions
 #include "AliAODPid.h" // Needed for inline functions
+#include "AliTOFHeader.h" //Needed for inline functions
 //#include "HMPID/AliHMPID.h"
 
 #include "AliPIDResponse.h"
@@ -48,10 +51,19 @@ inline Float_t AliAODpidUtil::NumberOfSigmasTOF(const AliVParticle *vtrack, AliP
   Double_t sigmaTOFPid[AliPID::kSPECIES];
   AliAODPid *pidObj = track->GetDetPid();
   if (!pidObj) return -999.;
+  Double_t tofTime=pidObj->GetTOFsignal();
   pidObj->GetIntegratedTimes(times);
   pidObj->GetTOFpidResolution(sigmaTOFPid);
-  if (sigmaTOFPid[type]>0) return (pidObj->GetTOFsignal() - times[type])/sigmaTOFPid[type];
-  else return (pidObj->GetTOFsignal() - times[type])/fTOFResponse.GetExpectedSigma(track->P(),times[type],AliPID::ParticleMass(type));
+  AliAODEvent *event=(AliAODEvent*)track->GetAODEvent();
+  if (event) {
+    AliTOFHeader* tofH=(AliTOFHeader*)event->GetTOFHeader();
+    if (tofH) { 
+      sigmaTOFPid[type]=fTOFResponse.GetExpectedSigma(track->P(),times[type],AliPID::ParticleMass(type)); //fTOFResponse is set in InitialiseEvent
+      tofTime -= fTOFResponse.GetStartTime(vtrack->P());
+    } 
+  }
+  if (sigmaTOFPid[type]>0) return (tofTime - times[type])/sigmaTOFPid[type];
+  else return (tofTime - times[type])/fTOFResponse.GetExpectedSigma(track->P(),times[type],AliPID::ParticleMass(type));
 }
 
 #endif
index baf0f69..d7916e0 100644 (file)
@@ -62,6 +62,7 @@ set ( SRCS
     STEERBase/AliITSPidParams.cxx 
     STEERBase/AliTRDPIDReference.cxx 
     STEERBase/AliTRDPIDParams.cxx 
+    STEERBase/AliTOFPIDParams.cxx 
     STEERBase/AliPIDResponse.cxx 
     STEERBase/AliITSPIDResponse.cxx 
     STEERBase/AliTPCPIDResponse.cxx 
index 2e6d680..547aa24 100644 (file)
@@ -37,6 +37,7 @@
 #include <AliOADBContainer.h>
 #include <AliTRDPIDParams.h>
 #include <AliTRDPIDReference.h>
+#include <AliTOFPIDParams.h>
 
 #include "AliPIDResponse.h"
 
@@ -68,9 +69,8 @@ fArrPidResponseMaster(0x0),
 fResolutionCorrection(0x0),
 fTRDPIDParams(0x0),
 fTRDPIDReference(0x0),
-fTOFTimeZeroType(kBest_T0),
-fTOFres(100.),
 fTOFtail(1.1),
+fTOFPIDParams(0x0),
 fEMCALPIDParams(0x0),
 fCurrentEvent(0x0),
 fCurrCentrality(0.0)
@@ -94,6 +94,7 @@ AliPIDResponse::~AliPIDResponse()
   delete fArrPidResponseMaster;
   delete fTRDPIDParams;
   delete fTRDPIDReference;
+  if (fTOFPIDParams) delete fTOFPIDParams;
 }
 
 //______________________________________________________________________________
@@ -121,9 +122,8 @@ fArrPidResponseMaster(0x0),
 fResolutionCorrection(0x0),
 fTRDPIDParams(0x0),
 fTRDPIDReference(0x0),
-fTOFTimeZeroType(AliPIDResponse::kBest_T0),
-fTOFres(100.),
 fTOFtail(1.1),
+fTOFPIDParams(0x0),
 fEMCALPIDParams(0x0),
 fCurrentEvent(0x0),
 fCurrCentrality(0.0)
@@ -167,9 +167,8 @@ AliPIDResponse& AliPIDResponse::operator=(const AliPIDResponse &other)
     fTRDPIDReference=0x0;
     fEMCALPIDParams=0x0;
     memset(fTRDslicesForPID,0,sizeof(UInt_t)*2);
-    fTOFTimeZeroType=AliPIDResponse::kBest_T0;
-    fTOFres=100.;
     fTOFtail=1.1;
+    fTOFPIDParams=0x0;
     fCurrentEvent=other.fCurrentEvent;
   }
   return *this;
@@ -592,7 +591,8 @@ void AliPIDResponse::InitialiseEvent(AliVEvent *event, Int_t pass)
   }
   
   //TOF resolution
-  SetTOFResponse(event, (AliPIDResponse::EStartTimeType_t)fTOFTimeZeroType);
+  SetTOFResponse(event, (AliPIDResponse::EStartTimeType_t)fTOFPIDParams->GetStartTimeMethod());
+
 
   // Get and set centrality
   AliCentrality *centrality = event->GetCentrality();
@@ -623,7 +623,8 @@ void AliPIDResponse::ExecNewRun()
   SetEMCALPidResponseMaster(); 
   InitializeEMCALResponse();
   
-  fTOFResponse.SetTimeResolution(fTOFres);
+  SetTOFPidResponseMaster();
+  InitializeTOFResponse();
 }
 
 //_____________________________________________________
@@ -870,6 +871,41 @@ void AliPIDResponse::InitializeTRDResponse(){
   }
 }
 
+//______________________________________________________________________________
+void AliPIDResponse::SetTOFPidResponseMaster()
+{
+  //
+  // Load the TOF pid params from the OADB
+  //
+  TFile *oadbf = new TFile(Form("%s/COMMON/PID/data/TOFPIDParams.root",fOADBPath.Data()));
+  if (oadbf->IsOpen()) {
+    AliInfo(Form("Loading TOF Params from %s/COMMON/PID/data/TOFPIDParams.root", fOADBPath.Data()));
+    AliOADBContainer *oadbc = (AliOADBContainer *)oadbf->Get("TOFoadb");
+    if (fTOFPIDParams) delete fTOFPIDParams;
+    fTOFPIDParams = dynamic_cast<AliTOFPIDParams *>(oadbc->GetObject(fRun));
+    oadbf->Close();
+    delete oadbc;
+  } else {
+    AliError(Form("TOFPIDParams.root not found in %s/COMMON/PID/data !!",fOADBPath.Data()));
+  }
+  delete oadbf;
+
+  }
+
+//______________________________________________________________________________
+void AliPIDResponse::InitializeTOFResponse(){
+  //
+  // Set PID Params to the TOF PID response
+  // 
+  TString stMethod[4]={"kFILL_T0","kTOF_T0","kT0_T0","kBest_T0"};
+  for (Int_t i=0;i<4;i++) {
+    fTOFResponse.SetTrackParameter(i,fTOFPIDParams->GetSigParams(i));
+  }
+  fTOFResponse.SetTimeResolution(fTOFPIDParams->GetTOFresolution());
+
+}
+
+
 //_________________________________________________________________________
 Bool_t AliPIDResponse::IdentifiedAsElectronTRD(const AliVTrack *vtrack, Double_t efficiencyLevel) const {
   //
index ef44dbe..6f11e9f 100644 (file)
@@ -17,6 +17,7 @@
 #include "AliTOFPIDResponse.h"
 #include "AliEMCALPIDResponse.h"
 
+
 #include "AliVParticle.h"
 #include "AliVTrack.h"
 
@@ -133,9 +134,8 @@ private:
   AliTRDPIDReference *fTRDPIDReference; //! TRD PID References
   UInt_t fTRDslicesForPID[2];           //! TRD PID slices
 
-  Int_t   fTOFTimeZeroType;            //! default start time type for tof (ESD)
-  Float_t fTOFres;                     //! TOF resolution
   Float_t fTOFtail;                    //! TOF tail effect used in TOF probability
+  AliTOFPIDParams *fTOFPIDParams;      //! TOF PID Params - period depending (OADB loaded)
 
   TObjArray *fEMCALPIDParams;             //! EMCAL PID Params
 
@@ -162,6 +162,8 @@ private:
   void InitializeTRDResponse();
 
   //TOF
+  void SetTOFPidResponseMaster();
+  void InitializeTOFResponse();
 
   //EMCAL
   void SetEMCALPidResponseMaster();
@@ -170,7 +172,7 @@ private:
   //
   void SetRecoInfo();
   
-  ClassDef(AliPIDResponse,5);  //PID response handling
+  ClassDef(AliPIDResponse,6);  //PID response handling
 };
 
 inline Float_t AliPIDResponse::NumberOfSigmasTPC(const AliVParticle *vtrack, AliPID::EParticleType type) const {
diff --git a/STEER/STEERBase/AliTOFPIDParams.cxx b/STEER/STEERBase/AliTOFPIDParams.cxx
new file mode 100644 (file)
index 0000000..de42412
--- /dev/null
@@ -0,0 +1,66 @@
+/**************************************************************************
+ * Copyright(c) 1998-2010, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+//***********************************************************
+// Class AliTODPIDParams
+// class to store PID parameters for TOF in OADB
+// Author: P. Antonioli, pietro.antonioli@to.infn.it
+//***********************************************************
+
+#include <Riostream.h>
+#include <TNamed.h>
+#include "AliLog.h"
+#include "AliTOFPIDParams.h"
+
+ClassImp(AliTOFPIDParams)
+
+//_____________________________________________________________________________
+AliTOFPIDParams::AliTOFPIDParams():
+TNamed("default",""),
+  fStartTime(AliPIDResponse::kBest_T0),
+  fTOFresolution(100)
+{
+  for (Int_t i=0;i<kSigPparams;i++) fSigPparams[i]=0;
+}
+
+//_____________________________________________________________________________
+AliTOFPIDParams::AliTOFPIDParams(Char_t *name):
+  TNamed(name,""),
+  fStartTime(AliPIDResponse::kBest_T0),
+  fTOFresolution(100)
+{
+  for (Int_t i=0;i<kSigPparams;i++) fSigPparams[i]=0;
+}
+
+//_____________________________________________________________________________
+AliTOFPIDParams::~AliTOFPIDParams(){
+}
+
+
+//_____________________________________________________________________________
+void AliTOFPIDParams::SetSigPparams(Float_t *d) 
+{
+  //
+  // Setting the SigP values
+  //
+  if (d == 0x0){
+    AliError(Form("Null pointer passed"));
+  }
+  else{
+    for (Int_t i=0;i<kSigPparams;i++) fSigPparams[i]=d[i];
+  }
+  return;
+}
+
diff --git a/STEER/STEERBase/AliTOFPIDParams.h b/STEER/STEERBase/AliTOFPIDParams.h
new file mode 100644 (file)
index 0000000..a4f2813
--- /dev/null
@@ -0,0 +1,43 @@
+#ifndef ALITOFPIDPARAMS_H
+#define ALITOFPIDPARAMS_H
+/* Copyright(c) 1998-2010, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+//***********************************************************
+// Class AliTODPIDparams
+// class to store PID parameters for TOF in OADB
+// Author: P. Antonioli, pietro.antonioli@to.infn.it
+//***********************************************************
+
+#include <TObject.h>
+#include <TNamed.h>
+#include "AliPIDResponse.h"
+
+class AliTOFPIDParams : public TNamed {
+
+ public:
+  AliTOFPIDParams();
+  AliTOFPIDParams(Char_t * name);
+  virtual ~AliTOFPIDParams();
+
+  enum {kSigPparams = 4};
+
+  Float_t GetTOFresolution(void) const {return fTOFresolution;}
+  AliPIDResponse::EStartTimeType_t GetStartTimeMethod(void) const {return fStartTime;}
+  Float_t GetSigParams(Int_t i) const {
+    return ((i >= 0)  && (i<kSigPparams)) ? fSigPparams[i] : 0;}    
+  void SetTOFresolution(Float_t res){fTOFresolution = res;}
+  void SetStartTimeMethod(AliPIDResponse::EStartTimeType_t method){fStartTime=method;}
+  void SetSigPparams(Float_t *params);
+
+ private:
+  AliPIDResponse::EStartTimeType_t fStartTime;      // startTime method
+  Float_t fTOFresolution;                           // TOF MRPC intrinsic resolution
+  Float_t fSigPparams[kSigPparams];                // parameterisation of sigma(p) dependency 
+
+  ClassDef(AliTOFPIDParams,1);
+
+};
+
+#endif
+
index 014f13b..1f79361 100644 (file)
@@ -12,6 +12,8 @@
 #include "TObject.h"
 #include "AliPID.h"
 
+class AliTOFPIDParams;
+
 class AliTOFPIDResponse : public TObject {
 public:
 
index f8a8b29..2becb10 100644 (file)
 
 #pragma link C++ class AliVCaloTrigger+;
 
+#pragma link C++ class AliTOFPIDParams+;
+
 #endif