Asymmetric nSigma cuts for TOF
authorfprino <prino@to.infn.it>
Fri, 21 Mar 2014 11:46:20 +0000 (12:46 +0100)
committerhristov <Peter.Hristov@cern.ch>
Thu, 27 Mar 2014 15:25:22 +0000 (16:25 +0100)
PWGHF/vertexingHF/AliAODPidHF.cxx [changed mode: 0755->0644]
PWGHF/vertexingHF/AliAODPidHF.h [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index 230fe41..72bb88e
@@ -57,6 +57,11 @@ AliAODPidHF::AliAODPidHF():
   fMatch(0),
   fCompat(kFALSE),
   fPCompatTOF(1.5),
+  fUseAsymTOF(kFALSE),
+  fLownSigmaTOF(-3.),
+  fUpnSigmaTOF(3.),
+  fLownSigmaCompatTOF(-3.),
+  fUpnSigmaCompatTOF(3.),
   fnNSigmaCompat(2),
   fnSigmaCompat(0),
   fMC(kFALSE),
@@ -140,6 +145,11 @@ AliAODPidHF::AliAODPidHF(const AliAODPidHF& pid) :
   fMatch(pid.fMatch),
   fCompat(pid.fCompat),
   fPCompatTOF(pid.fPCompatTOF),
+  fUseAsymTOF(pid.fUseAsymTOF),
+  fLownSigmaTOF(pid.fLownSigmaTOF),
+  fUpnSigmaTOF(pid.fUpnSigmaTOF),
+  fLownSigmaCompatTOF(pid.fLownSigmaCompatTOF),
+  fUpnSigmaCompatTOF(pid.fUpnSigmaCompatTOF),
   fnNSigmaCompat(pid.fnNSigmaCompat),
   fnSigmaCompat(0x0),
   fMC(pid.fMC),
@@ -335,64 +345,42 @@ Int_t AliAODPidHF::ApplyPidTOFRaw(AliAODTrack *track,Int_t specie) const{
       }
     }
   }else{ // asks only for one particle specie
+    Double_t nSigmaMin,nSigmaMax;
+    if(fUseAsymTOF){
+      nSigmaMin=fLownSigmaTOF;
+      nSigmaMax=fUpnSigmaTOF;
+    }else{
+      nSigmaMin=-fnSigma[3];
+      nSigmaMax=fnSigma[3];
+    }
     if(GetnSigmaTOF(track,specie,nsigma)==1){
-      nsigma=TMath::Abs(nsigma);
-      if (nsigma>fnSigma[3]) pid=-1; 
+      if(nsigma<nSigmaMin || nsigma>nSigmaMax) pid=-1;
       else pid=specie;
     }
   }
   return pid; 
-  /*
- Double_t time[AliPID::kSPECIESN];
- Double_t sigmaTOFPid[AliPID::kSPECIES];
- AliAODPid *pidObj = track->GetDetPid();
- pidObj->GetIntegratedTimes(time);
- Double_t sigTOF=pidObj->GetTOFsignal();
-
- AliAODEvent *event=(AliAODEvent*)track->GetAODEvent();
- if (event) {
-   AliTOFHeader* tofH=(AliTOFHeader*)event->GetTOFHeader();
-   if (tofH && fPidResponse) { // reading new AOD with new aliroot
-     AliTOFPIDResponse TOFres = (AliTOFPIDResponse)fPidResponse->GetTOFResponse();
-     sigTOF -= TOFres.GetStartTime(track->P());
-     if (specie<0) {
-       for (Int_t ipart = 0; ipart<5; ipart++) {
-        sigmaTOFPid[ipart]=TOFres.GetExpectedSigma(track->P(),time[ipart],AliPID::ParticleMass(ipart));
-       }
-     }
-     else sigmaTOFPid[specie]=TOFres.GetExpectedSigma(track->P(),time[specie],AliPID::ParticleMass(specie)); //fTOFResponse is set in InitialiseEvent
-   } else  pidObj->GetTOFpidResolution(sigmaTOFPid); // reading old AOD with new aliroot
- } else  pidObj->GetTOFpidResolution(sigmaTOFPid);  //reading old AOD with old aliroot
+}
+//----------------------------
+Int_t AliAODPidHF::ApplyTOFCompatibilityBand(AliAODTrack *track,Int_t specie) const{
+// n-sigma cut, TOF PID
 
- Int_t pid=-1;
+  if(specie<0) return -1;
+  Double_t nsigma=-999.;
+  Int_t pid=-1;
 
-  if(specie<0){  
-   Double_t sigmaTOFtrack;
-   if (sigmaTOFPid[4]>0) sigmaTOFtrack=sigmaTOFPid[4];
-   else sigmaTOFtrack=fTOFSigma;
-   Double_t nsigmaMax=sigmaTOFtrack*fnSigma[3];
-   for(Int_t ipart=0;ipart<5;ipart++){
-    Double_t nsigma=TMath::Abs(sigTOF-time[ipart]);
-    if (sigmaTOFPid[ipart]>0) sigmaTOFtrack=sigmaTOFPid[ipart]; 
-    else sigmaTOFtrack=fTOFSigma;  // backward compatibility for old AODs
-    if((nsigma<nsigmaMax) && (nsigma<fnSigma[3]*sigmaTOFtrack)) {
-     pid=ipart;
-     nsigmaMax=nsigma;
-    }
-   }
-  }else{ // asks only for one particle specie
-    Double_t nsigma=TMath::Abs(sigTOF-time[specie]);
-    Double_t sigmaTOFtrack;
-    if (sigmaTOFPid[specie]>0) sigmaTOFtrack=sigmaTOFPid[specie]; 
-    else sigmaTOFtrack=fTOFSigma;  // backward compatibility for old AODs
-    if (nsigma>fnSigma[3]*sigmaTOFtrack) {
-      pid=-1; 
-    }else{
-      pid=specie;
-    }
+  Double_t nSigmaMin,nSigmaMax;
+  if(fUseAsymTOF){
+    nSigmaMin=fLownSigmaCompatTOF;
+    nSigmaMax=fUpnSigmaCompatTOF;      
+  }else{
+    nSigmaMin=-fnSigmaCompat[1];
+    nSigmaMax=fnSigmaCompat[1];
   }
- return pid; 
-  */
+  if(GetnSigmaTOF(track,specie,nsigma)==1){
+    if(nsigma<nSigmaMin || nsigma>nSigmaMax) pid=-1;
+    else pid=specie;
+  }
+  return pid; 
 }
 //------------------------------
 void AliAODPidHF::CombinedProbability(AliAODTrack *track,Bool_t *type) const{
@@ -520,10 +508,7 @@ Int_t AliAODPidHF::MatchTPCTOF(AliAODTrack *track, Int_t specie){
       if(ApplyPidTOFRaw(track,specie)==specie) tTOFinfo=1;
       if(fCompat && tTOFinfo>0){
        if(ptrack>fPCompatTOF) {
-         Double_t sig0tmp=fnSigma[3];
-         SetSigma(3,fnSigmaCompat[1]);
-         if(ApplyPidTOFRaw(track,specie)==specie) tTOFinfo=0;
-         SetSigma(3,sig0tmp);
+         if(ApplyTOFCompatibilityBand(track,specie)==specie) tTOFinfo=0;
        }
       }
     }
old mode 100755 (executable)
new mode 100644 (file)
index ea2ad9f..17b8059
@@ -88,6 +88,11 @@ class AliAODPidHF : public TObject{
   void SetPLimit(Double_t *plim){for(Int_t i=0;i<fnPLimit;i++) fPLimit[i]=plim[i];return;}
   void SetPLimit(Double_t *plim,Int_t npLim){fnPLimit=npLim;for(Int_t i=0;i<fnPLimit;i++) fPLimit[i]=plim[i];return;}
   void SetAsym(Bool_t asym){fAsym=asym;return;}
+  void SetUseAsymmnSigmaTOF(Double_t nsmin, Double_t nsmax, Double_t nscompmin, Double_t nscompmax){
+    fUseAsymTOF=kTRUE; 
+    fLownSigmaTOF=nsmin; fUpnSigmaTOF=nsmax;
+    fLownSigmaCompatTOF=nscompmin; fUpnSigmaCompatTOF=nscompmax;
+  }
   void SetTPC(Bool_t tpc){fTPC=tpc;return;}
   void SetTOF(Bool_t tof){fTOF=tof;return;}
   void SetITS(Bool_t its){fITS=its;return;}
@@ -195,6 +200,7 @@ class AliAODPidHF : public TObject{
   Int_t ApplyPidTPCRaw(AliAODTrack *track,Int_t specie) const;
   Int_t ApplyPidTOFRaw(AliAODTrack *track,Int_t specie) const;
   Int_t ApplyPidITSRaw(AliAODTrack *track,Int_t specie) const;
+  Int_t ApplyTOFCompatibilityBand(AliAODTrack *track,Int_t specie) const;
 
   void PrintAll() const;
 
@@ -219,6 +225,11 @@ class AliAODPidHF : public TObject{
   Int_t fMatch; //switch to combine the info from more detectors: 1 = || , 2 = &, 3 = p region
   Bool_t fCompat; // compatibility region : useful only if fMatch=1
   Double_t fPCompatTOF; //  compatibility p limit for TOF  
+  Bool_t fUseAsymTOF; // flag for using asymmetrig nSigmaCut in TOF for fMatch==1
+  Double_t fLownSigmaTOF;  // lower nsigma TOF (for fUseAsymTOF)
+  Double_t fUpnSigmaTOF;  // upper nsigma TOF (for fUseAsymTOF)
+  Double_t fLownSigmaCompatTOF;  // lower nsigma TOF (for fUseAsymTOF)
+  Double_t fUpnSigmaCompatTOF;  // upper nsigma TOF (for fUseAsymTOF)
   Int_t fnNSigmaCompat; // number of sigmas
   Double_t *fnSigmaCompat; //[fnNSigmaCompat]  0: n sigma for TPC compatibility band, 1: for TOF  
   Double_t fMaxnSigmaCombined[3];  // nSigma cut for pi,K,p (TPC^2+TOF^2)
@@ -245,7 +256,7 @@ class AliAODPidHF : public TObject{
   Bool_t fUseCombined; // detectors to be involved for combined PID
   Bool_t fDefaultPriors; // use default priors for combined PID
 
-  ClassDef(AliAODPidHF,21) // AliAODPid for heavy flavor PID
+  ClassDef(AliAODPidHF,22) // AliAODPid for heavy flavor PID
 
     };