#92331: preparing to move AliTOFHeader to AOD
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 12 Mar 2012 17:11:44 +0000 (17:11 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 12 Mar 2012 17:11:44 +0000 (17:11 +0000)
Pietro Antonioli

STEER/AOD/AliAODEvent.h
STEER/ESD/AliESDEvent.h
STEER/ESD/AliESDpid.cxx
STEER/ESD/AliESDpid.h
STEER/STEERBase/AliPIDResponse.cxx
STEER/STEERBase/AliPIDResponse.h
STEER/STEERBase/AliVEvent.h

index 7d3fe4d3e06f9f8167300fe3a7ff1fbaca4d80aa..960105d78f60c72faf164482c62eb267ef8d38c6 100644 (file)
@@ -34,7 +34,6 @@
 #include "AliAODTZERO.h"
 #include "AliAODVZERO.h"
 #include "AliAODZDC.h"
-#include "AliTOFHeader.h"
 #ifdef MFT_UPGRADE
 #include "AliAODMFT.h"
 #endif
index ad1935a599b4786d7f9c296e4b7ef6995b21dfda..685b021d33947e182408938c1e19c393d2c5c8ad 100644 (file)
@@ -39,8 +39,6 @@
 #include "AliESDCaloCluster.h"
 #include "AliESDCaloCells.h"
 
-#include "AliTOFHeader.h"
-
 #include "AliESDVZERO.h"
 #ifdef MFT_UPGRADE
 //#include "AliESDMFT.h"
index 0a9e8277051ad212e9faaa675680ab73dd89d904..41b0aa4e5c9f41c2a296fe05968dcdacc73f25c3 100644 (file)
@@ -337,214 +337,3 @@ Bool_t AliESDpid::CheckTOFMatching(AliESDtrack *track) const{
     
     return status;
 }
-//_________________________________________________________________________
-void AliESDpid::SetTOFResponse(AliVEvent *vevent,EStartTimeType_t option){
-  //
-  // Set TOF response function
-  // Input option for event_time used
-  //
-
-    AliESDEvent *event=(AliESDEvent*)vevent;
-  
-    Float_t t0spread = 0.; //event->GetEventTimeSpread();
-    if(t0spread < 10) t0spread = 80;
-
-    // T0 from TOF algorithm
-
-    Bool_t flagT0TOF=kFALSE;
-    Bool_t flagT0T0=kFALSE;
-    Float_t *startTime = new Float_t[fTOFResponse.GetNmomBins()];
-    Float_t *startTimeRes = new Float_t[fTOFResponse.GetNmomBins()];
-    Int_t *startTimeMask = new Int_t[fTOFResponse.GetNmomBins()];
-
-    // T0-TOF arrays
-    Float_t *estimatedT0event = new Float_t[fTOFResponse.GetNmomBins()];
-    Float_t *estimatedT0resolution = new Float_t[fTOFResponse.GetNmomBins()];
-    for(Int_t i=0;i<fTOFResponse.GetNmomBins();i++){
-      estimatedT0event[i]=0.0;
-      estimatedT0resolution[i]=0.0;
-      startTimeMask[i] = 0;
-    }
-
-    Float_t resT0A=75,resT0C=65,resT0AC=55;
-    if(event->GetT0TOF()){ // check if T0 detector information is available
-       flagT0T0=kTRUE;
-    }
-
-
-    AliTOFHeader *tofHeader = (AliTOFHeader*)event->GetTOFHeader();
-
-    if (tofHeader) { // read global info and T0-TOF info from ESD
-      fTOFResponse.SetTimeResolution(tofHeader->GetTOFResolution());
-      t0spread = tofHeader->GetT0spread(); // read t0 sprad
-      if(t0spread < 10) t0spread = 80;
-
-      flagT0TOF=kTRUE;
-      for(Int_t i=0;i<fTOFResponse.GetNmomBins();i++){ // read T0-TOF default value
-       startTime[i]=tofHeader->GetDefaultEventTimeVal();
-       startTimeRes[i]=tofHeader->GetDefaultEventTimeRes();
-       if(startTimeRes[i] < 1.e-5) startTimeRes[i] = t0spread;
-      }
-
-      TArrayI *ibin=(TArrayI*)tofHeader->GetNvalues();
-      TArrayF *t0Bin=(TArrayF*)tofHeader->GetEventTimeValues();
-      TArrayF *t0ResBin=(TArrayF*)tofHeader->GetEventTimeRes();
-      for(Int_t j=0;j < tofHeader->GetNbins();j++){ // fill T0-TOF in p-bins
-       Int_t icurrent = (Int_t)ibin->GetAt(j);
-       startTime[icurrent]=t0Bin->GetAt(j);
-       startTimeRes[icurrent]=t0ResBin->GetAt(j);
-       if(startTimeRes[icurrent] < 1.e-5) startTimeRes[icurrent] = t0spread;
-      }
-    }
-
-    // for cut of 3 sigma on t0 spread
-    Float_t t0cut = 3 * t0spread;
-    if(t0cut < 500) t0cut = 500;
-
-    if(option == kFILL_T0){ // T0-FILL is used
-       for(Int_t i=0;i<fTOFResponse.GetNmomBins();i++){
-         estimatedT0event[i]=0.0;
-         estimatedT0resolution[i]=t0spread;
-       }
-       fTOFResponse.SetT0event(estimatedT0event);
-       fTOFResponse.SetT0resolution(estimatedT0resolution);
-    }
-
-    if(option == kTOF_T0){ // T0-TOF is used when available (T0-FILL otherwise) from ESD
-       if(flagT0TOF){
-           fTOFResponse.SetT0event(startTime);
-           fTOFResponse.SetT0resolution(startTimeRes);
-           for(Int_t i=0;i<fTOFResponse.GetNmomBins();i++){
-             if(startTimeRes[i]<t0spread) startTimeMask[i]=1;
-             fTOFResponse.SetT0binMask(i,startTimeMask[i]);
-           }
-       }
-       else{
-           for(Int_t i=0;i<fTOFResponse.GetNmomBins();i++){
-             estimatedT0event[i]=0.0;
-             estimatedT0resolution[i]=t0spread;
-             fTOFResponse.SetT0binMask(i,startTimeMask[i]);
-           }
-           fTOFResponse.SetT0event(estimatedT0event);
-           fTOFResponse.SetT0resolution(estimatedT0resolution);
-       }
-    }
-    else if(option == kBest_T0){ // T0-T0 or T0-TOF are used when available (T0-FILL otherwise) from ESD
-       Float_t t0AC=-10000;
-       Float_t t0A=-10000;
-       Float_t t0C=-10000;
-       if(flagT0T0){
-           t0AC= event->GetT0TOF()[0];
-           t0A= event->GetT0TOF()[1];
-           t0C= event->GetT0TOF()[2];
-       }
-
-       Float_t t0t0Best = 0;
-       Float_t t0t0BestRes = 9999;
-       Int_t t0used=0;
-       if(TMath::Abs(t0A) < t0cut && TMath::Abs(t0C) < t0cut && TMath::Abs(t0C-t0A) < 500){
-           t0t0Best = t0AC;
-           t0t0BestRes = resT0AC;
-           t0used=6;
-       }
-       else if(TMath::Abs(t0C) < t0cut){
-           t0t0Best = t0C;
-           t0t0BestRes = resT0C;
-           t0used=4;
-       }
-       else if(TMath::Abs(t0A) < t0cut){
-           t0t0Best = t0A;
-           t0t0BestRes = resT0A;
-           t0used=2;
-       }
-
-       if(flagT0TOF){ // if T0-TOF info is available
-           for(Int_t i=0;i<fTOFResponse.GetNmomBins();i++){
-               if(t0t0BestRes < 999){
-                 if(startTimeRes[i] < t0spread){
-                   Double_t wtot = 1./startTimeRes[i]/startTimeRes[i] + 1./t0t0BestRes/t0t0BestRes;
-                   Double_t t0best = startTime[i]/startTimeRes[i]/startTimeRes[i] + t0t0Best/t0t0BestRes/t0t0BestRes;
-                   estimatedT0event[i]=t0best / wtot;
-                   estimatedT0resolution[i]=1./TMath::Sqrt(wtot);
-                   startTimeMask[i] = t0used+1;
-                 }
-                 else {
-                   estimatedT0event[i]=t0t0Best;
-                   estimatedT0resolution[i]=t0t0BestRes;
-                   startTimeMask[i] = t0used;
-                 }
-               }
-               else{
-                 estimatedT0event[i]=startTime[i];
-                 estimatedT0resolution[i]=startTimeRes[i];
-                 if(startTimeRes[i]<t0spread) startTimeMask[i]=1;
-               }
-               fTOFResponse.SetT0binMask(i,startTimeMask[i]);
-           }
-           fTOFResponse.SetT0event(estimatedT0event);
-           fTOFResponse.SetT0resolution(estimatedT0resolution);
-       }
-       else{ // if no T0-TOF info is available
-           for(Int_t i=0;i<fTOFResponse.GetNmomBins();i++){
-             fTOFResponse.SetT0binMask(i,t0used);
-             if(t0t0BestRes < 999){
-               estimatedT0event[i]=t0t0Best;
-               estimatedT0resolution[i]=t0t0BestRes;
-             }
-             else{
-               estimatedT0event[i]=0.0;
-               estimatedT0resolution[i]=t0spread;
-             }
-           }
-           fTOFResponse.SetT0event(estimatedT0event);
-           fTOFResponse.SetT0resolution(estimatedT0resolution);
-       }
-    }
-
-    else if(option == kT0_T0){ // T0-T0 is used when available (T0-FILL otherwise) from ESD
-       Float_t t0AC=-10000;
-       Float_t t0A=-10000;
-       Float_t t0C=-10000;
-       if(flagT0T0){
-           t0AC= event->GetT0TOF()[0];
-           t0A= event->GetT0TOF()[1];
-           t0C= event->GetT0TOF()[2];
-       }
-
-       if(TMath::Abs(t0A) < t0cut && TMath::Abs(t0C) < t0cut && TMath::Abs(t0C-t0A) < 500){
-           for(Int_t i=0;i<fTOFResponse.GetNmomBins();i++){
-             estimatedT0event[i]=t0AC;
-             estimatedT0resolution[i]=resT0AC;
-             fTOFResponse.SetT0binMask(i,6);
-           }
-       }
-       else if(TMath::Abs(t0C) < t0cut){
-           for(Int_t i=0;i<fTOFResponse.GetNmomBins();i++){
-             estimatedT0event[i]=t0C;
-             estimatedT0resolution[i]=resT0C;
-             fTOFResponse.SetT0binMask(i,4);
-           }
-       }
-       else if(TMath::Abs(t0A) < t0cut){
-           for(Int_t i=0;i<fTOFResponse.GetNmomBins();i++){
-             estimatedT0event[i]=t0A;
-             estimatedT0resolution[i]=resT0A;
-             fTOFResponse.SetT0binMask(i,2);
-           }
-       }
-       else{
-           for(Int_t i=0;i<fTOFResponse.GetNmomBins();i++){
-             estimatedT0event[i]=0.0;
-             estimatedT0resolution[i]=t0spread;
-             fTOFResponse.SetT0binMask(i,0);
-           }
-       }
-       fTOFResponse.SetT0event(estimatedT0event);
-       fTOFResponse.SetT0resolution(estimatedT0resolution);
-    }
-    delete [] startTime;
-    delete [] startTimeRes;
-    delete [] startTimeMask;
-    delete [] estimatedT0event;
-    delete [] estimatedT0resolution;
-}
index 5096afc9ed247f7fdeaa33e88ed1e6c67b03b78b..52a8d03e8bcd29360c545e268659d4d065684256 100644 (file)
@@ -40,8 +40,6 @@ public:
   virtual Float_t NumberOfSigmasTOF(const AliVParticle *vtrack, AliPID::EParticleType type, const Float_t timeZeroTOF) const;
   virtual Float_t NumberOfSigmasTOF(const AliVParticle *vtrack, AliPID::EParticleType type) const {return NumberOfSigmasTOF(vtrack,type,0); }
   
-  void SetTOFResponse(AliVEvent *vevent,EStartTimeType_t option);
-
   void SetNMaxSigmaTOFTPCMismatch(Float_t range) {fRangeTOFMismatch=range;}
   Float_t GetNMaxSigmaTOFTPCMismatch() const {return fRangeTOFMismatch;}
 
index 20aa086c3c71744667c22ae51605546e7c5713d9..fb4970bbeb7ca440ecb332ac61bd91fc5f163ecc 100644 (file)
@@ -891,3 +891,212 @@ void AliPIDResponse::InitializeEMCALResponse(){
   fEMCALResponse.SetPIDParams(fEMCALPIDParams);
 
 }
+//_________________________________________________________________________
+void AliPIDResponse::SetTOFResponse(AliVEvent *vevent,EStartTimeType_t option){
+  //
+  // Set TOF response function
+  // Input option for event_time used
+  //
+  
+    Float_t t0spread = 0.; //vevent->GetEventTimeSpread();
+    if(t0spread < 10) t0spread = 80;
+
+    // T0 from TOF algorithm
+
+    Bool_t flagT0TOF=kFALSE;
+    Bool_t flagT0T0=kFALSE;
+    Float_t *startTime = new Float_t[fTOFResponse.GetNmomBins()];
+    Float_t *startTimeRes = new Float_t[fTOFResponse.GetNmomBins()];
+    Int_t *startTimeMask = new Int_t[fTOFResponse.GetNmomBins()];
+
+    // T0-TOF arrays
+    Float_t *estimatedT0event = new Float_t[fTOFResponse.GetNmomBins()];
+    Float_t *estimatedT0resolution = new Float_t[fTOFResponse.GetNmomBins()];
+    for(Int_t i=0;i<fTOFResponse.GetNmomBins();i++){
+      estimatedT0event[i]=0.0;
+      estimatedT0resolution[i]=0.0;
+      startTimeMask[i] = 0;
+    }
+
+    Float_t resT0A=75,resT0C=65,resT0AC=55;
+    if(vevent->GetT0TOF()){ // check if T0 detector information is available
+       flagT0T0=kTRUE;
+    }
+
+
+    AliTOFHeader *tofHeader = (AliTOFHeader*)vevent->GetTOFHeader();
+
+    if (tofHeader) { // read global info and T0-TOF
+      fTOFResponse.SetTimeResolution(tofHeader->GetTOFResolution());
+      t0spread = tofHeader->GetT0spread(); // read t0 sprad
+      if(t0spread < 10) t0spread = 80;
+
+      flagT0TOF=kTRUE;
+      for(Int_t i=0;i<fTOFResponse.GetNmomBins();i++){ // read T0-TOF default value
+       startTime[i]=tofHeader->GetDefaultEventTimeVal();
+       startTimeRes[i]=tofHeader->GetDefaultEventTimeRes();
+       if(startTimeRes[i] < 1.e-5) startTimeRes[i] = t0spread;
+      }
+
+      TArrayI *ibin=(TArrayI*)tofHeader->GetNvalues();
+      TArrayF *t0Bin=(TArrayF*)tofHeader->GetEventTimeValues();
+      TArrayF *t0ResBin=(TArrayF*)tofHeader->GetEventTimeRes();
+      for(Int_t j=0;j < tofHeader->GetNbins();j++){ // fill T0-TOF in p-bins
+       Int_t icurrent = (Int_t)ibin->GetAt(j);
+       startTime[icurrent]=t0Bin->GetAt(j);
+       startTimeRes[icurrent]=t0ResBin->GetAt(j);
+       if(startTimeRes[icurrent] < 1.e-5) startTimeRes[icurrent] = t0spread;
+      }
+    }
+
+    // for cut of 3 sigma on t0 spread
+    Float_t t0cut = 3 * t0spread;
+    if(t0cut < 500) t0cut = 500;
+
+    if(option == kFILL_T0){ // T0-FILL is used
+       for(Int_t i=0;i<fTOFResponse.GetNmomBins();i++){
+         estimatedT0event[i]=0.0;
+         estimatedT0resolution[i]=t0spread;
+       }
+       fTOFResponse.SetT0event(estimatedT0event);
+       fTOFResponse.SetT0resolution(estimatedT0resolution);
+    }
+
+    if(option == kTOF_T0){ // T0-TOF is used when available (T0-FILL otherwise) from ESD
+       if(flagT0TOF){
+           fTOFResponse.SetT0event(startTime);
+           fTOFResponse.SetT0resolution(startTimeRes);
+           for(Int_t i=0;i<fTOFResponse.GetNmomBins();i++){
+             if(startTimeRes[i]<t0spread) startTimeMask[i]=1;
+             fTOFResponse.SetT0binMask(i,startTimeMask[i]);
+           }
+       }
+       else{
+           for(Int_t i=0;i<fTOFResponse.GetNmomBins();i++){
+             estimatedT0event[i]=0.0;
+             estimatedT0resolution[i]=t0spread;
+             fTOFResponse.SetT0binMask(i,startTimeMask[i]);
+           }
+           fTOFResponse.SetT0event(estimatedT0event);
+           fTOFResponse.SetT0resolution(estimatedT0resolution);
+       }
+    }
+    else if(option == kBest_T0){ // T0-T0 or T0-TOF are used when available (T0-FILL otherwise) from ESD
+       Float_t t0AC=-10000;
+       Float_t t0A=-10000;
+       Float_t t0C=-10000;
+       if(flagT0T0){
+           t0AC= vevent->GetT0TOF()[0];
+           t0A= vevent->GetT0TOF()[1];
+           t0C= vevent->GetT0TOF()[2];
+       }
+
+       Float_t t0t0Best = 0;
+       Float_t t0t0BestRes = 9999;
+       Int_t t0used=0;
+       if(TMath::Abs(t0A) < t0cut && TMath::Abs(t0C) < t0cut && TMath::Abs(t0C-t0A) < 500){
+           t0t0Best = t0AC;
+           t0t0BestRes = resT0AC;
+           t0used=6;
+       }
+       else if(TMath::Abs(t0C) < t0cut){
+           t0t0Best = t0C;
+           t0t0BestRes = resT0C;
+           t0used=4;
+       }
+       else if(TMath::Abs(t0A) < t0cut){
+           t0t0Best = t0A;
+           t0t0BestRes = resT0A;
+           t0used=2;
+       }
+
+       if(flagT0TOF){ // if T0-TOF info is available
+           for(Int_t i=0;i<fTOFResponse.GetNmomBins();i++){
+               if(t0t0BestRes < 999){
+                 if(startTimeRes[i] < t0spread){
+                   Double_t wtot = 1./startTimeRes[i]/startTimeRes[i] + 1./t0t0BestRes/t0t0BestRes;
+                   Double_t t0best = startTime[i]/startTimeRes[i]/startTimeRes[i] + t0t0Best/t0t0BestRes/t0t0BestRes;
+                   estimatedT0event[i]=t0best / wtot;
+                   estimatedT0resolution[i]=1./TMath::Sqrt(wtot);
+                   startTimeMask[i] = t0used+1;
+                 }
+                 else {
+                   estimatedT0event[i]=t0t0Best;
+                   estimatedT0resolution[i]=t0t0BestRes;
+                   startTimeMask[i] = t0used;
+                 }
+               }
+               else{
+                 estimatedT0event[i]=startTime[i];
+                 estimatedT0resolution[i]=startTimeRes[i];
+                 if(startTimeRes[i]<t0spread) startTimeMask[i]=1;
+               }
+               fTOFResponse.SetT0binMask(i,startTimeMask[i]);
+           }
+           fTOFResponse.SetT0event(estimatedT0event);
+           fTOFResponse.SetT0resolution(estimatedT0resolution);
+       }
+       else{ // if no T0-TOF info is available
+           for(Int_t i=0;i<fTOFResponse.GetNmomBins();i++){
+             fTOFResponse.SetT0binMask(i,t0used);
+             if(t0t0BestRes < 999){
+               estimatedT0event[i]=t0t0Best;
+               estimatedT0resolution[i]=t0t0BestRes;
+             }
+             else{
+               estimatedT0event[i]=0.0;
+               estimatedT0resolution[i]=t0spread;
+             }
+           }
+           fTOFResponse.SetT0event(estimatedT0event);
+           fTOFResponse.SetT0resolution(estimatedT0resolution);
+       }
+    }
+
+    else if(option == kT0_T0){ // T0-T0 is used when available (T0-FILL otherwise)
+       Float_t t0AC=-10000;
+       Float_t t0A=-10000;
+       Float_t t0C=-10000;
+       if(flagT0T0){
+           t0AC= vevent->GetT0TOF()[0];
+           t0A= vevent->GetT0TOF()[1];
+           t0C= vevent->GetT0TOF()[2];
+       }
+
+       if(TMath::Abs(t0A) < t0cut && TMath::Abs(t0C) < t0cut && TMath::Abs(t0C-t0A) < 500){
+           for(Int_t i=0;i<fTOFResponse.GetNmomBins();i++){
+             estimatedT0event[i]=t0AC;
+             estimatedT0resolution[i]=resT0AC;
+             fTOFResponse.SetT0binMask(i,6);
+           }
+       }
+       else if(TMath::Abs(t0C) < t0cut){
+           for(Int_t i=0;i<fTOFResponse.GetNmomBins();i++){
+             estimatedT0event[i]=t0C;
+             estimatedT0resolution[i]=resT0C;
+             fTOFResponse.SetT0binMask(i,4);
+           }
+       }
+       else if(TMath::Abs(t0A) < t0cut){
+           for(Int_t i=0;i<fTOFResponse.GetNmomBins();i++){
+             estimatedT0event[i]=t0A;
+             estimatedT0resolution[i]=resT0A;
+             fTOFResponse.SetT0binMask(i,2);
+           }
+       }
+       else{
+           for(Int_t i=0;i<fTOFResponse.GetNmomBins();i++){
+             estimatedT0event[i]=0.0;
+             estimatedT0resolution[i]=t0spread;
+             fTOFResponse.SetT0binMask(i,0);
+           }
+       }
+       fTOFResponse.SetT0event(estimatedT0event);
+       fTOFResponse.SetT0resolution(estimatedT0resolution);
+    }
+    delete [] startTime;
+    delete [] startTimeRes;
+    delete [] startTimeMask;
+    delete [] estimatedT0event;
+    delete [] estimatedT0resolution;
+}
index 78e7053802940fc4c9519bfb97cb1f943589221d..04aa00008f2c5f2e55528b0d2d59bd7b556ef511 100644 (file)
@@ -76,7 +76,6 @@ public:
 
 
   void SetITSPIDmethod(ITSPIDmethod pmeth) { fITSPIDmethod = pmeth; }
-  virtual void SetTOFResponse(AliVEvent */*event*/,EStartTimeType_t /*option*/) {;}
   void SetTRDslicesForPID(UInt_t slice1, UInt_t slice2) {fTRDslicesForPID[0]=slice1;fTRDslicesForPID[1]=slice2;}
   
   void SetOADBPath(const char* path) {fOADBPath=path;}
@@ -95,6 +94,7 @@ public:
 
   // TOF setting
   void SetTOFtail(Float_t tail=1.1){if(tail > 0) fTOFtail=tail; else printf("TOF tail should be greater than 0 (nothing done)\n");};
+  void SetTOFResponse(AliVEvent *vevent,EStartTimeType_t option);
 
   AliPIDResponse(const AliPIDResponse &other);
   AliPIDResponse& operator=(const AliPIDResponse &other);
index 85fbc3923ab32e0b5b492a235fc767576f165904..2b9e46c044a289771ef47362ad5d1f4b39a92a32 100644 (file)
@@ -22,6 +22,7 @@
 #include "AliVCluster.h"
 #include "AliVCaloCells.h"
 #include "TRefArray.h"
+#include "AliTOFHeader.h"
 class AliCentrality;
 class AliEventplane;
 class AliVVZERO;
@@ -130,6 +131,13 @@ public:
   virtual Int_t        GetNumberOfV0s() const = 0;
   virtual Int_t        GetNumberOfCascades() const = 0;
 
+  // TOF header and T0 methods
+  virtual const AliTOFHeader *GetTOFHeader() const {return NULL;}
+  virtual Float_t GetEventTimeSpread() const {return 0.;}
+  virtual Float_t GetTOFTimeResolution() const {return 0.;}
+  virtual Double32_t GetT0TOF(Int_t icase) const {return 0.0*icase;}
+  virtual const Double32_t * GetT0TOF() const {return NULL;}
+
   // Calorimeter Clusters/Cells
   virtual AliVCluster *GetCaloCluster(Int_t)   const {return 0;}
   virtual Int_t GetNumberOfCaloClusters()      const {return 0;}