]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
TRD PID included in the ESD schema (T.Kuhr)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 27 May 2003 17:46:13 +0000 (17:46 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 27 May 2003 17:46:13 +0000 (17:46 +0000)
13 files changed:
STEER/AliESDtest.C
STEER/AliESDtrack.cxx
STEER/AliESDtrack.h
STEER/AliKalmanTrack.cxx
STEER/pid.root [new file with mode: 0644]
TRD/AliTRDPartID.cxx [new file with mode: 0644]
TRD/AliTRDPartID.h [new file with mode: 0644]
TRD/AliTRDtrack.cxx
TRD/AliTRDtrack.h
TRD/AliTRDtracker.cxx
TRD/AliTRDtracker.h
TRD/TRDLinkDef.h
TRD/libTRD.pkg

index 8c721282ebfec3cb5d15c0c83cc52304b8793015..5029952501f5ac60b20c779ef85e5f1b4992bfd5 100644 (file)
   #include "AliTPCtracker.h"
   #include "AliITSgeom.h"
   #include "AliITStrackerV2.h"
   #include "AliTPCtracker.h"
   #include "AliITSgeom.h"
   #include "AliITStrackerV2.h"
+  #include "AliTRDtracker.h"
+  #include "AliTRDPartID.h"
   #include "AliITSpidESD.h"
 #endif
 
   #include "AliITSpidESD.h"
 #endif
 
-Int_t AliESDtest(Int_t nev=1) { 
+Int_t AliESDtest(Int_t nev=1, 
+                const char* fileNameITSClusters = "its.clusters.root",
+                const char* fileNameTPCClusters = "tpc.clusters.root",
+                const char* fileNameTRDClusters = "trd.clusters.root") { 
+
    //File with the TPC clusters
    //File with the TPC clusters
-   TFile *tpccf=TFile::Open("AliTPCclusters.root");
+   TFile *tpccf=TFile::Open(fileNameTPCClusters);
    if (!tpccf->IsOpen()) {
    if (!tpccf->IsOpen()) {
-      cerr<<"Can't open AliTPCclusters.root !\n"; 
+      cerr<<"Can't open "<<fileNameTPCClusters<<" !\n"; 
       return 2;
    }
    AliTPCParam *par=(AliTPCParam*)tpccf->Get("75x40_100x60_150x60");
       return 2;
    }
    AliTPCParam *par=(AliTPCParam*)tpccf->Get("75x40_100x60_150x60");
@@ -44,9 +50,9 @@ Int_t AliESDtest(Int_t nev=1) {
    AliTPCpidESD tpcPID(parTPC);
 
    //File with the ITS clusters
    AliTPCpidESD tpcPID(parTPC);
 
    //File with the ITS clusters
-   TFile *itscf=TFile::Open("AliITSclustersV2.root");
+   TFile *itscf=TFile::Open(fileNameITSClusters);
    if (!itscf->IsOpen()) {
    if (!itscf->IsOpen()) {
-      cerr<<"Can't open AliITSclustersV2.root !\n"; 
+      cerr<<"Can't open "<<fileNameITSClusters<<".root !\n"; 
       return 4;
    }
    AliITSgeom *geom=(AliITSgeom*)itscf->Get("AliITSgeom");
       return 4;
    }
    AliITSgeom *geom=(AliITSgeom*)itscf->Get("AliITSgeom");
@@ -58,8 +64,30 @@ Int_t AliESDtest(Int_t nev=1) {
    //An instance of the ITS PID maker
    Double_t parITS[]={34.,0.12,3.};
    AliITSpidESD itsPID(parITS);
    //An instance of the ITS PID maker
    Double_t parITS[]={34.,0.12,3.};
    AliITSpidESD itsPID(parITS);
-   
-   TFile *ef=TFile::Open("AliESDs.root","new");
+
+   //File with the TRD clusters
+   TFile *trdcf=TFile::Open(fileNameTRDClusters);
+   if (!trdcf->IsOpen()) {
+      cerr<<"Can't open "<<fileNameTRDClusters<<".root !\n"; 
+      return 6;
+   }
+
+   //An instance of the TRD tracker
+   AliTRDtracker trdTracker(trdcf);
+
+   //An instance of the TRD PID maker
+   TFile* pidFile = TFile::Open("pid.root");
+   if (!pidFile->IsOpen()) {
+     cerr << "Can't get pid.root !\n";
+     return 7;
+   }
+   AliTRDPartID* trdPID = (AliTRDPartID*) pidFile->Get("AliTRDPartID");
+   if (!trdPID) {
+     cerr << "Can't get PID object !\n";
+     return 8;
+   }
+
+   TFile *ef=TFile::Open("AliESDs.root","RECREATE");
    if (!ef->IsOpen()) {cerr<<"Can't AliESDs.root !\n"; return 1;}
 
    TStopwatch timer;
    if (!ef->IsOpen()) {cerr<<"Can't AliESDs.root !\n"; return 1;}
 
    TStopwatch timer;
@@ -81,18 +109,33 @@ Int_t AliESDtest(Int_t nev=1) {
 
      rc+=itsTracker.PropagateBack(event); 
      itsTracker.UnloadClusters();
 
      rc+=itsTracker.PropagateBack(event); 
      itsTracker.UnloadClusters();
+
      itsPID.MakePID(event);
      
      rc+=tpcTracker.PropagateBack(event);
      tpcTracker.UnloadClusters();
      itsPID.MakePID(event);
      
      rc+=tpcTracker.PropagateBack(event);
      tpcTracker.UnloadClusters();
+
      tpcPID.MakePID(event);
 
      tpcPID.MakePID(event);
 
+     trdTracker.SetEventNumber(i);
+     trdcf->cd();
+     trdTracker.LoadClusters();
+
+     rc+=trdTracker.PropagateBack(event);
+     trdTracker.UnloadClusters();
+
+     for (Int_t iTrack = 0; iTrack < event->GetNumberOfTracks(); iTrack++) {
+       AliESDtrack* track = event->GetTrack(iTrack);
+       trdPID->MakePID(track);
+     }
+
     //Here is the combined PID
      AliESDpid::MakePID(event);
 
      if (rc==0) {
         Char_t ename[100]; 
         sprintf(ename,"%d",i);
     //Here is the combined PID
      AliESDpid::MakePID(event);
 
      if (rc==0) {
         Char_t ename[100]; 
         sprintf(ename,"%d",i);
+       ef->cd();
         if (!event->Write(ename)) rc++;
      } 
      if (rc) {
         if (!event->Write(ename)) rc++;
      } 
      if (rc) {
@@ -102,6 +145,8 @@ Int_t AliESDtest(Int_t nev=1) {
    }
    timer.Stop(); timer.Print();
 
    }
    timer.Stop(); timer.Print();
 
+   pidFile->Close();
+   trdcf->Close();
    delete geom;
    itscf->Close();
    delete par;
    delete geom;
    itscf->Close();
    delete par;
index ea507e889685c2935f8b2b5f573fd0055eca9882..8a4e2fbc7942ef43c44cda72fb5dd88a704a015a 100644 (file)
@@ -77,6 +77,11 @@ Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags) {
     else if (mass<0.4) fR[2]=1.;    // the ITS reconstruction
     else fR[3]=1.;}                 //
     break;
     else if (mass<0.4) fR[2]=1.;    // the ITS reconstruction
     else fR[3]=1.;}                 //
     break;
+  case kTRDin: case kTRDout: case kTRDrefit:
+    fTRDncls=t->GetNumberOfClusters();
+    fTRDchi2=t->GetChi2();
+    fTRDsignal=t->GetPIDsignal();
+    break;
   default: 
     Error("UpdateTrackParams()","Wrong flag !\n");
     return kFALSE;
   default: 
     Error("UpdateTrackParams()","Wrong flag !\n");
     return kFALSE;
@@ -180,6 +185,17 @@ void AliESDtrack::GetTPCpid(Double_t *p) const {
   for (Int_t i=0; i<kSPECIES; i++) p[i]=fTPCr[i];
 }
 
   for (Int_t i=0; i<kSPECIES; i++) p[i]=fTPCr[i];
 }
 
+//_______________________________________________________________________
+void    AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p)
+{
+  fTRDr[iSpecies] = p;
+}
+
+Float_t AliESDtrack::GetTRDpid(Int_t iSpecies) const
+{
+  return fTRDr[iSpecies];
+}
+
 //_______________________________________________________________________
 void AliESDtrack::SetESDpid(const Double_t *p) {  
   for (Int_t i=0; i<kSPECIES; i++) fR[i]=p[i];
 //_______________________________________________________________________
 void AliESDtrack::SetESDpid(const Double_t *p) {  
   for (Int_t i=0; i<kSPECIES; i++) fR[i]=p[i];
index 125d30471931a13dbf32a576b8ec93a328384896..12cd82c399b87b85ec34f60f2c82cf58ae0f9ea2 100644 (file)
@@ -47,6 +47,10 @@ public:
   Float_t GetITSsignal() const {return fITSsignal;}
   Int_t GetITSclusters(UInt_t *idx) const;
 
   Float_t GetITSsignal() const {return fITSsignal;}
   Int_t GetITSclusters(UInt_t *idx) const;
 
+  Float_t GetTRDsignal() const {return fTRDsignal;}
+  void    SetTRDpid(Int_t iSpecies, Float_t p);
+  Float_t GetTRDpid(Int_t iSpecies) const;
+
   enum {
     kITSin=0x0001,kITSout=0x0002,kITSrefit=0x0004,kITSpid=0x0008,
     kTPCin=0x0010,kTPCout=0x0020,kTPCrefit=0x0040,kTPCpid=0x0080,
   enum {
     kITSin=0x0001,kITSout=0x0002,kITSrefit=0x0004,kITSpid=0x0008,
     kTPCin=0x0010,kTPCout=0x0020,kTPCrefit=0x0040,kTPCpid=0x0080,
@@ -56,7 +60,7 @@ public:
     kTIME=0x80000000
   }; 
   enum {kSPECIES=5}; // Number of particle species recognized by the PID
     kTIME=0x80000000
   }; 
   enum {kSPECIES=5}; // Number of particle species recognized by the PID
-  
+
 protected:
   ULong_t   fFlags;        // Reconstruction status flags 
   Int_t     fLabel;        // Track label
 protected:
   ULong_t   fFlags;        // Reconstruction status flags 
   Int_t     fLabel;        // Track label
@@ -94,6 +98,11 @@ protected:
   Float_t fTPCr[kSPECIES]; // "detector response probabilities" (for the PID)
 
   // TRD related track information
   Float_t fTPCr[kSPECIES]; // "detector response probabilities" (for the PID)
 
   // TRD related track information
+  Float_t fTRDchi2;        // chi2 in the TRD
+  Int_t   fTRDncls;        // number of clusters assigned in the TRD
+  Float_t fTRDsignal;      // detector's PID signal
+  Float_t fTRDr[kSPECIES]; //! "detector response probabilities" (for the PID)
+
   // TOF related track information
   // HMPID related track information
 
   // TOF related track information
   // HMPID related track information
 
index 26a95cd9b9718e5bf1352ab484f41079d48e3a80..39886242bcd773054329881a50bd8f23fe11f79b 100644 (file)
@@ -132,6 +132,8 @@ Double_t AliKalmanTrack::Phi() const
   Double_t par[5];
   Double_t localX = GetX();
   GetExternalParameters(localX, par);
   Double_t par[5];
   Double_t localX = GetX();
   GetExternalParameters(localX, par);
+  if (par[2] >  1.) par[2] =  1.;
+  if (par[2] < -1.) par[2] = -1.;
   Double_t phi = TMath::ASin(par[2]) + GetAlpha();
   while (phi < 0) phi += TMath::TwoPi();
   while (phi > TMath::TwoPi()) phi -= TMath::TwoPi();
   Double_t phi = TMath::ASin(par[2]) + GetAlpha();
   while (phi < 0) phi += TMath::TwoPi();
   while (phi > TMath::TwoPi()) phi -= TMath::TwoPi();
@@ -233,7 +235,7 @@ Double_t AliKalmanTrack::P() const
   Double_t par[5];
   Double_t localX = GetX();
   GetExternalParameters(localX, par);
   Double_t par[5];
   Double_t localX = GetX();
   GetExternalParameters(localX, par);
-  return 1. / TMath::Abs(par[4] * TMath::Sin(TMath::ATan(par[3])));
+  return 1. / TMath::Abs(par[4] * TMath::Cos(TMath::ATan(par[3])));
 }
 //_______________________________________________________________________
 void AliKalmanTrack::StartTimeIntegral() 
 }
 //_______________________________________________________________________
 void AliKalmanTrack::StartTimeIntegral() 
diff --git a/STEER/pid.root b/STEER/pid.root
new file mode 100644 (file)
index 0000000..6f33838
Binary files /dev/null and b/STEER/pid.root differ
diff --git a/TRD/AliTRDPartID.cxx b/TRD/AliTRDPartID.cxx
new file mode 100644 (file)
index 0000000..91e3ca3
--- /dev/null
@@ -0,0 +1,140 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, 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.                  *
+ **************************************************************************/
+
+#include "AliTRDPartID.h"
+#include "AliESDtrack.h"
+#include "TProfile.h"
+#include "TF1.h"
+
+#include <TMath.h>
+
+ClassImp(AliTRDPartID)
+
+
+AliTRDPartID::AliTRDPartID()
+{
+// create a TRD particle identifier
+
+  fBetheBloch = NULL;
+  fRes = 0.2;
+  fRange = 3.;
+}
+
+AliTRDPartID::AliTRDPartID(TF1* betheBloch, Double_t res, Double_t range)
+{
+// create a TRD particle identifier with custom settings
+
+  fBetheBloch = betheBloch;
+  fRes = res;
+  fRange = range;
+}
+
+AliTRDPartID::~AliTRDPartID()
+{
+  if (fBetheBloch) delete fBetheBloch;
+}
+
+
+Bool_t AliTRDPartID::MakePID(AliESDtrack* track)
+{
+// This function calculates the "detector response" PID probabilities 
+
+  static const Double_t masses[]={
+    0.000511, 0.105658, 0.139570, 0.493677, 0.938272
+  };
+
+  if (((track->GetStatus()&AliESDtrack::kTRDin) == 0) &&
+      ((track->GetStatus()&AliESDtrack::kTRDout) == 0)) return kFALSE;
+  Double_t momentum = track->GetP();
+  if (momentum < 0.001) return kFALSE;
+
+  // get the probability densities
+  Double_t pSum = 0;
+  for (Int_t iSpecies = 0; iSpecies < AliESDtrack::kSPECIES; iSpecies++) {
+    Double_t expectedSignal = fBetheBloch->Eval(momentum/masses[iSpecies]);
+    Double_t expectedError = fRes * expectedSignal;
+    Double_t measuredSignal = track->GetTRDsignal();
+    if (TMath::Abs(measuredSignal - expectedSignal) > fRange * expectedError) {
+      track->SetTRDpid(iSpecies, 0.);
+    } else {
+      Double_t p = TMath::Gaus(measuredSignal, expectedSignal, expectedError);
+      pSum += p;
+      track->SetTRDpid(iSpecies, p);
+    }
+  }
+
+  // "normalize" the probability densities
+  if (pSum <= 0) return kFALSE;
+  for (Int_t iSpecies = 0; iSpecies < AliESDtrack::kSPECIES; iSpecies++) {
+    track->SetTRDpid(iSpecies, track->GetTRDpid(iSpecies) / pSum);
+  }
+
+  return kTRUE;
+}
+
+
+void AliTRDPartID::FitBetheBloch(TProfile* dEdxVsBetaGamma)
+{
+// determine the parameters of the bethe bloch function
+
+  if (fBetheBloch) delete fBetheBloch;
+  fBetheBloch = new TF1("fBetheBlochTRD", fcnBetheBloch, 
+                       0.001, 100000., 5);
+  fBetheBloch->SetParameters(1, 10, 0.00002, 2, 2);
+  fBetheBloch->SetParLimits(2, 0., 0.01);
+  fBetheBloch->SetParLimits(3, 0., 10.);
+  fBetheBloch->SetParLimits(4, 0., 10.);
+  fBetheBloch->SetFillStyle(0);
+  fBetheBloch->SetLineColor(kRed);
+  dEdxVsBetaGamma->Fit(fBetheBloch, "N");
+}
+
+TF1* AliTRDPartID::CreateBetheBloch(Double_t mass)
+{
+// create a function for expected dE/dx vs p
+
+  TF1* result = new TF1("betheBlochMass", fcnBetheBlochMass, 
+                       0.001, 100000., 6);
+  result->SetParameter(0, mass);
+  if (fBetheBloch) {
+    for (Int_t iPar = 0; iPar < 5; iPar++) {
+      result->SetParameter(iPar+1, fBetheBloch->GetParameter(iPar));
+      result->SetParError(iPar+1, fBetheBloch->GetParError(iPar));
+    }
+  }
+  result->SetFillStyle(0);
+  return result;
+}
+
+Double_t AliTRDPartID::fcnBetheBloch(Double_t* xx, Double_t* par)
+{
+// parametrized bethe bloch function (xx[0] = beta*gamma = p/m):
+//
+//   p0/beta^p3 * [ p1 - log(p2 + 1/(beta*gamma)^p4) - beta^p3 ]
+//
+
+  Double_t betaGamma2 = xx[0] * xx[0];
+  Double_t beta2 = betaGamma2 / (1. + betaGamma2);
+  Double_t betaPar3 = TMath::Power(beta2, par[3]/2.);
+  return par[0]/betaPar3 * (par[1] - TMath::Log(TMath::Abs(par[2] + TMath::Power(betaGamma2, -par[4]/2.))) - betaPar3);
+}
+
+Double_t AliTRDPartID::fcnBetheBlochMass(Double_t* xx, Double_t* par)
+{
+// parametrized bethe bloch function:  xx[0] = p,  p0 = mass
+
+  Double_t betaGamma = xx[0] / par[0];
+  return fcnBetheBloch(&betaGamma, &par[1]);
+}
diff --git a/TRD/AliTRDPartID.h b/TRD/AliTRDPartID.h
new file mode 100644 (file)
index 0000000..40af603
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef ALITRDPARTID_H
+#define ALITRDPARTID_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+#include <TObject.h>
+
+class AliESDtrack;
+class TProfile;
+class TF1;
+
+
+class AliTRDPartID: public TObject {
+  public: 
+    AliTRDPartID();
+    AliTRDPartID(TF1* betheBloch, Double_t res, Double_t range);
+    virtual ~AliTRDPartID();
+
+    Bool_t          MakePID(AliESDtrack* track);
+
+    void            FitBetheBloch(TProfile* dEdxVsBetaGamma);
+    inline TF1*     GetBetheBloch() {return fBetheBloch;};
+    TF1*            CreateBetheBloch(Double_t mass);
+
+  private:
+    static Double_t fcnBetheBloch(Double_t* xx, Double_t* par);
+    static Double_t fcnBetheBlochMass(Double_t* xx, Double_t* par);
+
+    TF1*            fBetheBloch;   // parametrized bethe bloch function
+    Double_t        fRes;          // relative dE/dx resolution
+    Double_t        fRange;        // cut off in standard deviations
+
+    ClassDef(AliTRDPartID,1)   // TRD PID class
+};
+
+#endif
+
+
index 02641355c9b758e4c5614094b529762a49d39db7..9af132f4cfb6fc8745261da1cda3779f538a7bf7 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
 
 /*
 $Log$
+Revision 1.19  2003/05/22 10:46:46  hristov
+Using access methods instead of data members
+
 Revision 1.18  2003/04/10 10:36:54  hristov
 Code for unified TPC/TRD tracking (S.Radomski)
 
 Revision 1.18  2003/04/10 10:36:54  hristov
 Code for unified TPC/TRD tracking (S.Radomski)
 
@@ -72,6 +75,7 @@ Add the tracking code
 #include "AliTRDcluster.h" 
 #include "AliTRDtrack.h"
 #include "../TPC/AliTPCtrack.h" 
 #include "AliTRDcluster.h" 
 #include "AliTRDtrack.h"
 #include "../TPC/AliTPCtrack.h" 
+#include "AliESDtrack.h" 
 
 
 ClassImp(AliTRDtrack)
 
 
 ClassImp(AliTRDtrack)
@@ -221,6 +225,62 @@ AliTRDtrack::AliTRDtrack(const AliKalmanTrack& t, Double_t alpha)
   }
 }              
 //_____________________________________________________________________________
   }
 }              
 //_____________________________________________________________________________
+AliTRDtrack::AliTRDtrack(const AliESDtrack& t) 
+           :AliKalmanTrack() {
+  //
+  // Constructor from AliESDtrack
+  //
+
+  SetLabel(t.GetLabel());
+  SetChi2(0.);
+  SetMass(t.GetMass());
+  SetNumberOfClusters(0); 
+  // WARNING: cluster indices are NOT copied !!!
+
+  fdEdx=0;
+
+  fLhElectron = 0.0;
+  fNWrong = 0;
+  fNRotate = 0;
+
+  fAlpha = t.GetAlpha();
+  if      (fAlpha < -TMath::Pi()) fAlpha += 2*TMath::Pi();
+  else if (fAlpha >= TMath::Pi()) fAlpha -= 2*TMath::Pi();
+
+  Double_t x, p[5]; t.GetExternalParameters(x,p);
+
+  fX=x;
+
+  x = GetConvConst();  
+
+  fY=p[0];
+  fZ=p[1];
+  fT=p[3];
+  fC=p[4]/x;
+  fE=fC*fX - p[2];   
+
+  //Conversion of the covariance matrix
+  Double_t c[15]; t.GetExternalCovariance(c);
+
+  c[10]/=x; c[11]/=x; c[12]/=x; c[13]/=x; c[14]/=x*x;
+
+  Double_t c22=fX*fX*c[14] - 2*fX*c[12] + c[5];
+  Double_t c32=fX*c[13] - c[8];
+  Double_t c20=fX*c[10] - c[3], c21=fX*c[11] - c[4], c42=fX*c[14] - c[12];
+
+  fCyy=c[0 ];
+  fCzy=c[1 ];   fCzz=c[2 ];
+  fCey=c20;     fCez=c21;     fCee=c22;
+  fCty=c[6 ];   fCtz=c[7 ];   fCte=c32;   fCtt=c[9 ];
+  fCcy=c[10];   fCcz=c[11];   fCce=c42;   fCct=c[13]; fCcc=c[14];  
+
+  // Initialization [SR, GSI, 18.02.2003]
+  for(Int_t i=0; i<kMAX_CLUSTERS_PER_TRACK; i++) {
+    fdQdl[i] = 0;
+    fIndex[i] = 0;
+  }
+}              
+//_____________________________________________________________________________
 
 void  AliTRDtrack::GetBarrelTrack(AliBarrelTrack *track) {
   //
 
 void  AliTRDtrack::GetBarrelTrack(AliBarrelTrack *track) {
   //
index 6a92c3981221ad9a7c6345f932772b4597c2e014..8c96176a570244cab19fa5bfcd7869b3eaf31b95 100644 (file)
@@ -13,6 +13,7 @@
 
 class AliTRDcluster;
 class AliTPCtrack;
 
 class AliTRDcluster;
 class AliTPCtrack;
+class AliESDtrack;
 
 const unsigned kMAX_CLUSTERS_PER_TRACK=210; 
 
 
 const unsigned kMAX_CLUSTERS_PER_TRACK=210; 
 
@@ -27,6 +28,7 @@ public:
                const Double_t cc[15], Double_t xr, Double_t alpha);  
    AliTRDtrack(const AliTRDtrack& t);    
    AliTRDtrack(const AliKalmanTrack& t, Double_t alpha); 
                const Double_t cc[15], Double_t xr, Double_t alpha);  
    AliTRDtrack(const AliTRDtrack& t);    
    AliTRDtrack(const AliKalmanTrack& t, Double_t alpha); 
+   AliTRDtrack(const AliESDtrack& t);    
 
    Int_t    Compare(const TObject *o) const;
    void     CookdEdx(Double_t low=0.05, Double_t up=0.70);   
 
    Int_t    Compare(const TObject *o) const;
    void     CookdEdx(Double_t low=0.05, Double_t up=0.70);   
@@ -42,6 +44,7 @@ public:
 
    void     GetCovariance(Double_t cov[15]) const;  
    Double_t GetdEdx()  const {return fdEdx;}
 
    void     GetCovariance(Double_t cov[15]) const;  
    Double_t GetdEdx()  const {return fdEdx;}
+   Double_t GetPIDsignal()  const {return GetdEdx();}
    Double_t GetEta()   const {return fE;}
 
    void     GetExternalCovariance(Double_t cov[15]) const ;   
    Double_t GetEta()   const {return fE;}
 
    void     GetExternalCovariance(Double_t cov[15]) const ;   
index 4b666449257e65a443282c19ace600f98c9b2e88..e0321025b234f58733edf00042bd1c110780879c 100644 (file)
@@ -15,6 +15,9 @@
                                                       
 /*
 $Log$
                                                       
 /*
 $Log$
+Revision 1.26  2003/04/10 10:36:54  hristov
+Code for unified TPC/TRD tracking (S.Radomski)
+
 Revision 1.25  2003/03/19 17:14:11  hristov
 Load/UnloadClusters added to the base class and the derived classes changed correspondingly. Possibility to give 2 input files for ITS and TPC tracks in PropagateBack. TRD tracker uses fEventN from the base class (T.Kuhr)
 
 Revision 1.25  2003/03/19 17:14:11  hristov
 Load/UnloadClusters added to the base class and the derived classes changed correspondingly. Possibility to give 2 input files for ITS and TPC tracks in PropagateBack. TRD tracker uses fEventN from the base class (T.Kuhr)
 
@@ -98,6 +101,7 @@ Add the tracking code
 #include "AliTRDgeometryDetail.h"
 #include "AliTRDcluster.h" 
 #include "AliTRDtrack.h"
 #include "AliTRDgeometryDetail.h"
 #include "AliTRDcluster.h" 
 #include "AliTRDtrack.h"
+#include "AliTRDPartID.h"
 #include "../TPC/AliTPCtrack.h"
 
 #include "AliTRDtracker.h"
 #include "../TPC/AliTPCtrack.h"
 
 #include "AliTRDtracker.h"
@@ -154,10 +158,10 @@ AliTRDtracker::AliTRDtracker(const TFile *geomfile):AliTracker()
   }
   else {
     in->cd();  
   }
   else {
     in->cd();  
-    in->ls();
+//    in->ls();
     fGeom = (AliTRDgeometry*) in->Get("TRDgeometry");
     fPar  = (AliTRDparameter*) in->Get("TRDparameter");
     fGeom = (AliTRDgeometry*) in->Get("TRDgeometry");
     fPar  = (AliTRDparameter*) in->Get("TRDparameter");
-    fGeom->Dump();
+//    fGeom->Dump();
   }
 
   if(fGeom) {
   }
 
   if(fGeom) {
@@ -754,6 +758,58 @@ Int_t AliTRDtracker::PropagateBack(const TFile *inp, TFile *out) {
 
 }
 
 
 }
 
+//_____________________________________________________________________________
+Int_t AliTRDtracker::PropagateBack(AliESD* event) {
+  //
+  // Gets seeds from ESD event. The seeds are AliTPCtrack's found and
+  // backpropagated by the TPC tracker. Each seed is first propagated 
+  // to the TRD, and then its prolongation is searched in the TRD.
+  // If sufficiently long continuation of the track is found in the TRD
+  // the track is updated, otherwise it's stored as originaly defined 
+  // by the TPC tracker.   
+  //  
+
+  Int_t found=0;  
+  Float_t foundMin = 40;
+
+  Int_t n = event->GetNumberOfTracks();
+  for (Int_t i=0; i<n; i++) {
+    AliESDtrack* seed=event->GetTrack(i);
+    ULong_t status=seed->GetStatus();
+    if ( (status & AliESDtrack::kTPCout ) == 0 ) continue;
+    if ( (status & AliESDtrack::kTRDout) != 0 ) continue;
+
+    Int_t lbl = seed->GetLabel();
+    AliTRDtrack *track = new AliTRDtrack(*seed);
+    track->SetSeedLabel(lbl);
+    fNseeds++;
+
+    Int_t expectedClr = FollowBackProlongation(*track);
+
+    Int_t foundClr = track->GetNumberOfClusters();
+    if (foundClr >= foundMin) {
+      if(foundClr >= 2) {
+       track->CookdEdx(); 
+//     CookLabel(track, 1-fLabelFraction);
+       UseClusters(track);
+      }
+      
+      // Propagate to outer reference plane [SR, GSI, 18.02.2003]
+//      track->PropagateTo(364.8);  why?
+      
+      seed->UpdateTrackParams(track, AliESDtrack::kTRDout);
+      found++;
+    }
+
+  }
+  
+  cerr<<"Number of seeds: "<<fNseeds<<endl;  
+  cerr<<"Number of back propagated TRD tracks: "<<found<<endl;
+
+  return 0;
+
+}
+
 
 //---------------------------------------------------------------------------
 Int_t AliTRDtracker::FollowProlongation(AliTRDtrack& t, Int_t rf)
 
 //---------------------------------------------------------------------------
 Int_t AliTRDtracker::FollowProlongation(AliTRDtrack& t, Int_t rf)
@@ -1046,7 +1102,7 @@ Int_t AliTRDtracker::FollowBackProlongation(AliTRDtrack& t)
     if (fTrSec[s]->GetLayer(nr)->IsSensitive() != 
         fTrSec[s]->GetLayer(nr+1)->IsSensitive() ) {
 
     if (fTrSec[s]->GetLayer(nr)->IsSensitive() != 
         fTrSec[s]->GetLayer(nr+1)->IsSensitive() ) {
 
-      if (IsStoringBarrel()) StoreBarrelTrack(&t, nRefPlane++, kTrackBack);
+//      if (IsStoringBarrel()) StoreBarrelTrack(&t, nRefPlane++, kTrackBack);
     }
 
     if (fTrSec[s]->GetLayer(nr-1)->IsSensitive() && 
     }
 
     if (fTrSec[s]->GetLayer(nr-1)->IsSensitive() && 
index 0bcc07d929b69ef136f1ab86bfc7f82073922184..fbf9c26225b5075faf793d044e0e2efbc79c4d3b 100644 (file)
@@ -7,8 +7,10 @@
 #include "AliTracker.h" 
 #include "TObjArray.h" 
 #include "AliBarrelTrack.h"
 #include "AliTracker.h" 
 #include "TObjArray.h" 
 #include "AliBarrelTrack.h"
+#include "AliESD.h"
 
 class TFile;
 
 class TFile;
+class TTree;
 class TParticle;
 class TParticlePDG;
 
 class TParticle;
 class TParticlePDG;
 
@@ -34,11 +36,12 @@ class AliTRDtracker : public AliTracker {
 
   Int_t         Clusters2Tracks(const TFile *in, TFile *out);
   Int_t         PropagateBack(const TFile *in, TFile *out);
 
   Int_t         Clusters2Tracks(const TFile *in, TFile *out);
   Int_t         PropagateBack(const TFile *in, TFile *out);
+  Int_t         PropagateBack(AliESD* event);
   //Int_t         Refit(const TFile *in, TFile *out);
 
   Int_t         LoadClusters() {LoadEvent(); return 0;};
   void          UnloadClusters() {UnloadEvent();};
   //Int_t         Refit(const TFile *in, TFile *out);
 
   Int_t         LoadClusters() {LoadEvent(); return 0;};
   void          UnloadClusters() {UnloadEvent();};
-  AliCluster   *GetCluster(Int_t index) const { return (AliCluster*) fClusters->UncheckedAt(index); };
+  AliCluster   *GetCluster(Int_t index) const { if (index >= fNclusters) return NULL; return (AliCluster*) fClusters->UncheckedAt(index); };
   virtual void  CookLabel(AliKalmanTrack *t,Float_t wrong) const;
   virtual void  UseClusters(const AliKalmanTrack *t, Int_t from=0) const;  
   
   virtual void  CookLabel(AliKalmanTrack *t,Float_t wrong) const;
   virtual void  UseClusters(const AliKalmanTrack *t, Int_t from=0) const;  
   
index b518bf61a74c0f740a6b81f56def26626478b420..26d2d48291448d1b3d53b34a79900aaf0a842da8 100644 (file)
@@ -47,5 +47,6 @@
 #pragma link C++ class  AliTRDarrayI+;
 #pragma link C++ class  AliTRDarrayF+;
 #pragma link C++ class  AliTRDparameter+;
 #pragma link C++ class  AliTRDarrayI+;
 #pragma link C++ class  AliTRDarrayF+;
 #pragma link C++ class  AliTRDparameter+;
+#pragma link C++ class  AliTRDPartID+;
 
 #endif
 
 #endif
index bec87af4f2678e4b5cdb6acb78ba6f8d6ef7333f..aaac52af4018d8aa1fb7aae30f563a5b4fd60761 100644 (file)
@@ -36,7 +36,8 @@ SRCS= AliTRD.cxx \
       AliTRDsimple.cxx \
       AliTRDsimpleMC.cxx \
       AliTRDsimpleGen.cxx \
       AliTRDsimple.cxx \
       AliTRDsimpleMC.cxx \
       AliTRDsimpleGen.cxx \
-      AliTRDparameter.cxx
+      AliTRDparameter.cxx \
+      AliTRDPartID.cxx
 
 HDRS= $(SRCS:.cxx=.h)                
 
 
 HDRS= $(SRCS:.cxx=.h)