ext track class
authorloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 22 Jan 2012 21:31:37 +0000 (21:31 +0000)
committerloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 22 Jan 2012 21:31:37 +0000 (21:31 +0000)
PWG4/CMakelibPWG4UserTasks.pkg
PWG4/PWG4UserTasksLinkDef.h
PWG4/UserTasks/EmcalTasks/AliEsdTrackExt.cxx [new file with mode: 0644]
PWG4/UserTasks/EmcalTasks/AliEsdTrackExt.h [new file with mode: 0644]

index e2a6223..07271ac 100644 (file)
@@ -44,6 +44,7 @@ set ( SRCS
  UserTasks/EmcalTasks/AliEmcalSetupTask.cxx
  UserTasks/EmcalTasks/AliEmcalTrackPropagatorTask.cxx
  UserTasks/EmcalTasks/AliEsdSkimTask.cxx
+ UserTasks/EmcalTasks/AliEsdTrackExt.cxx
 )
 
 string ( REPLACE ".cxx" ".h" HDRS "${SRCS}" )
index 02556fa..6170a2b 100644 (file)
@@ -31,6 +31,7 @@
 #pragma link C++ class AliEmcalSetupTask+;
 #pragma link C++ class AliEmcalTrackPropagatorTask+;
 #pragma link C++ class AliEsdSkimTask+;
+#pragma link C++ class AliEsdTrackExt+;
 #pragma link C++ class AliStaHeader+;
 #pragma link C++ class AliStaCluster+;
 #pragma link C++ class AliStaVertex+;
diff --git a/PWG4/UserTasks/EmcalTasks/AliEsdTrackExt.cxx b/PWG4/UserTasks/EmcalTasks/AliEsdTrackExt.cxx
new file mode 100644 (file)
index 0000000..58690eb
--- /dev/null
@@ -0,0 +1,192 @@
+// $Id$
+//
+// Modified track class to be able to store cached quantities.
+//
+//
+
+#include "AliEsdTrackExt.h"
+#include <TVector3.h>
+#include "AliESDEvent.h"
+
+//_________________________________________________________________________________________________
+AliEsdTrackExt::AliEsdTrackExt(const AliESDtrack &t)
+  : AliESDtrack(t), fEmcEta(-10), fEmcPhi(-10), fNCrossedRows(-10), fChi2TPCConstrainedVsGlobal(-10)
+{
+  // Constructor.
+
+  const AliExternalTrackParam *outp = GetOuterParam();
+  if (outp&&IsEMCAL()) {
+    Double_t trkPos[3] = {0.,0.,0.};
+    if (outp->GetXYZ(trkPos)) {
+      TVector3 vec(trkPos[0],trkPos[1],trkPos[2]);
+      Double_t veta = vec.Eta();
+      Double_t vphi = vec.Phi();
+      if(vphi<0)
+        vphi += 2*TMath::Pi();
+      fEmcEta = veta;
+      fEmcPhi = vphi;
+    }
+  }
+
+  fNCrossedRows = GetTPCCrossedRows();
+
+  const AliESDVertex* vertex = 0;
+  vertex = fESDEvent->GetPrimaryVertexTracks();
+  if (!vertex || !vertex->GetStatus()) 
+    vertex = fESDEvent->GetPrimaryVertexSPD();
+  if (vertex) {
+    fChi2TPCConstrainedVsGlobal            = GetChi2TPCConstrainedVsGlobal(vertex);
+    fCacheChi2TPCConstrainedVsGlobalVertex = vertex;
+  }
+}
+
+//_________________________________________________________________________________________________
+void AliEsdTrackExt::DeleteParams()
+{ 
+  // Delete the unneeded params.
+
+  delete fIp;          fIp          = 0;
+  delete fTPCInner;    fTPCInner    = 0;
+  delete fHMPIDp;      fHMPIDp      = 0;
+  delete fFriendTrack; fFriendTrack = 0;
+  if (!IsEMCAL()) {
+    delete fOp;        fOp          = 0;
+  }
+}
+
+//_________________________________________________________________________________________________
+void AliEsdTrackExt::MakeMiniTrack(Bool_t dall, Bool_t dtrp, Bool_t dmap, Bool_t dits, 
+                                   Bool_t dtpc, Bool_t dtrd, Bool_t dtof, Bool_t dhmp)
+{ 
+  // Make mini track depending on what should be reset.
+
+  if (dtrp) {
+    delete fCp;          fCp          = 0;
+    delete fIp;          fIp          = 0;
+    delete fTPCInner;    fTPCInner    = 0;
+    delete fOp;          fOp          = 0;
+    delete fHMPIDp;      fHMPIDp      = 0;
+    delete fFriendTrack; fFriendTrack = 0;
+  }
+
+  if (dmap) {
+    fTPCFitMap.Clear();
+    fTPCClusterMap.Clear();
+    fTPCSharedMap.Clear();
+  }
+
+  // Reset ITS track related information
+  if (dits) {
+    if (dall) {
+      fITSchi2       = 0;
+      fITSncls       = 0;       
+      fITSClusterMap = 0;
+      fITSSharedMap  = 0;
+      fITSsignal     = 0;     
+      fITSLabel      = 0;  
+    }     
+    for (Int_t i=0;i<4;++i) fITSdEdxSamples[i] = 0.;
+    for (Int_t i=0;i<AliPID::kSPECIES;++i) fITSr[i] = 0; 
+    for (Int_t i=0;i<12;++i) fITSModule[i] = -1;
+  }
+
+  // Reset TPC related track information
+  if (dtpc) {
+    if (dall) {
+      fTPCchi2       = 0;
+      fTPCchi2Iter1  = 0;
+      fTPCncls       = 0;
+      fTPCnclsF      = 0;
+      fTPCnclsIter1  = 0;
+      fTPCnclsFIter1 = 0;
+      fTPCFitMap     = 0;
+      fTPCClusterMap = 0;
+      fTPCSharedMap  = 0;
+      fTPCsignal     = 0;
+      fTPCsignalS    = 0;
+      fTPCsignalN    = 0;
+      fTPCLabel      = 0;
+      fdTPC          = 0;
+      fzTPC          = 0;
+      fCddTPC        = 0;
+      fCdzTPC        = 0;
+      fCzzTPC        = 0;
+      fCchi2TPC      = 0;
+    }
+    for (Int_t i=0;i<AliPID::kSPECIES;++i) fTPCr[i] = 0; 
+    for (Int_t i=0;i<4;++i) fTPCPoints[i] = 0;
+    for (Int_t i=0; i<3;++i) fKinkIndexes[i] = 0;
+    for (Int_t i=0; i<3;++i) fV0Indexes[i] = 0;
+    delete fTPCdEdxInfo; fTPCdEdxInfo = 0;
+  }
+
+  // Reset TRD related track information
+  if (dtrd) {
+    fTRDchi2       = 0;
+    fTRDncls       = 0;
+    fTRDncls0      = 0;
+    fTRDsignal     = 0;
+    fTRDLabel      = 0;
+    fTRDQuality    = 0;
+    fTRDntracklets = 0;
+    fTRDslices     = 0;
+    fTRDBudget     = 0;
+    for (Int_t i=0;i<kTRDnPlanes;++i) fTRDTimBin[i] = 0;
+    for (Int_t i=0;i<AliPID::kSPECIES;++i) fTRDr[i] = 0; 
+    fTRDnSlices    = 0;
+    if(fTRDnSlices)
+      delete[] fTRDslices;
+  }
+
+  // Reset TOF related track information
+  if (dtof) {
+    if (dall) {
+      fTOFchi2       = 0;        
+      fTOFindex      = -1;       
+      fTOFsignal     = 99999;      
+      fTOFCalChannel = -1;
+      fTOFsignalToT  = 99999;
+      fTOFsignalRaw  = 99999;
+      fTOFsignalDz   = 999;
+      fTOFsignalDx   = 999;
+      fTOFdeltaBC    = 999;
+      fTOFl0l1       = 999;
+    }
+    for (Int_t i=0;i<AliPID::kSPECIES;++i) fTOFr[i] = 0;
+    for (Int_t i=0;i<3;++i) fTOFLabel[i] = -1;
+    for (Int_t i=0;i<10;++i) fTOFInfo[i] = 0;
+    for (Int_t i=0;i<AliPID::kSPECIES;++i) fTrackTime[i] = 0;
+  }
+
+  // Reset HMPID related track information
+  if (dhmp) {
+    fHMPIDchi2     = 0;     
+    fHMPIDqn       = 0;     
+    fHMPIDcluIdx   = -1;     
+    fHMPIDsignal   = 0;     
+    fHMPIDtrkTheta = 0;     
+    fHMPIDtrkPhi   = 0;      
+    fHMPIDtrkX     = 0;     
+    fHMPIDtrkY     = 0;      
+    fHMPIDmipX     = 0;
+    fHMPIDmipY     = 0;
+    for (Int_t i=0;i<AliPID::kSPECIES;++i) fHMPIDr[i] = 0;
+  }
+}
+
+//_________________________________________________________________________________________________
+void AliEsdTrackExt::Setup()
+{
+  // Setup cache with stored variables.
+
+  fCacheNCrossedRows = fNCrossedRows;
+
+  const AliESDVertex* vertex = 0;
+  vertex = fESDEvent->GetPrimaryVertexTracks();
+  if (!vertex || !vertex->GetStatus()) 
+    vertex = fESDEvent->GetPrimaryVertexSPD();
+  if (vertex) {
+    fCacheChi2TPCConstrainedVsGlobal       = fChi2TPCConstrainedVsGlobal;
+    fCacheChi2TPCConstrainedVsGlobalVertex = vertex;
+  }
+}
diff --git a/PWG4/UserTasks/EmcalTasks/AliEsdTrackExt.h b/PWG4/UserTasks/EmcalTasks/AliEsdTrackExt.h
new file mode 100644 (file)
index 0000000..c85a58d
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef ALIESDTRACKEXT_H
+#define ALIESDTRACKEXT_H
+
+// $Id$
+
+#include "AliESDtrack.h"
+
+class AliEsdTrackExt : public AliESDtrack {
+ public: 
+  AliEsdTrackExt() : AliESDtrack(), fEmcEta(-10), fEmcPhi(-10), fNCrossedRows(-10), fChi2TPCConstrainedVsGlobal(-10) {;}
+  AliEsdTrackExt(const AliESDtrack &t);
+  void        DeleteParams();
+  Double_t    GetEmcEta() const { return fEmcEta; }
+  Double_t    GetEmcPhi() const { return fEmcPhi; }
+  void        MakeMiniTrack(Bool_t dall=0, Bool_t dtrp=1, Bool_t dmap=1, Bool_t dits=1, 
+                            Bool_t dtpc=1, Bool_t dtrd=1, Bool_t dtof=1, Bool_t dhmp=1);
+  void        Setup();
+ protected: 
+   Double32_t fEmcEta;                      //[0,0,16]  
+   Double32_t fEmcPhi;                      //[0,0,16]  
+   Double32_t fNCrossedRows;                //[0,0,16]  
+   Double32_t fChi2TPCConstrainedVsGlobal;  //[0,0,16]  
+
+  ClassDef(AliEsdTrackExt,1) // Extended ESD track class
+};
+#endif