From 8c6a71abb98199a5d18a188bb74ef747113efad5 Mon Sep 17 00:00:00 2001 From: hristov Date: Mon, 26 May 2003 09:37:39 +0000 Subject: [PATCH] First version of combined PID (Yu.Belikov) --- ITS/AliITSpidESD.cxx | 79 ++++++++++++++++++++++++++++++++++++++++++ ITS/AliITSpidESD.h | 29 ++++++++++++++++ ITS/ITSLinkDef.h | 1 + ITS/libITS.pkg | 2 +- STEER/AliESDanalysis.C | 63 ++++++++++++++++++++++++++++----- STEER/AliESDpid.cxx | 53 ++++++++++++++++++++++++++++ STEER/AliESDpid.h | 25 +++++++++++++ STEER/AliESDtest.C | 17 ++++++++- STEER/AliESDtrack.cxx | 23 ++++++++++++ STEER/AliESDtrack.h | 17 ++++++--- STEER/STEERLinkDef.h | 1 + STEER/libSTEER.pkg | 2 +- TPC/AliTPCpidESD.cxx | 79 ++++++++++++++++++++++++++++++++++++++++++ TPC/AliTPCpidESD.h | 29 ++++++++++++++++ TPC/TPCLinkDef.h | 1 + TPC/libTPC.pkg | 2 +- 16 files changed, 406 insertions(+), 17 deletions(-) create mode 100644 ITS/AliITSpidESD.cxx create mode 100644 ITS/AliITSpidESD.h create mode 100644 STEER/AliESDpid.cxx create mode 100644 STEER/AliESDpid.h create mode 100644 TPC/AliTPCpidESD.cxx create mode 100644 TPC/AliTPCpidESD.h diff --git a/ITS/AliITSpidESD.cxx b/ITS/AliITSpidESD.cxx new file mode 100644 index 00000000000..d502949afd7 --- /dev/null +++ b/ITS/AliITSpidESD.cxx @@ -0,0 +1,79 @@ +/************************************************************************** + * 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. * + **************************************************************************/ + +//----------------------------------------------------------------- +// Implementation of the ITS PID class +// Very naive one... Should be made better by the detector experts... +// Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch +//----------------------------------------------------------------- + +#include "AliITSpidESD.h" +#include "AliESD.h" +#include "AliESDtrack.h" + +ClassImp(AliITSpidESD) + +//_________________________________________________________________________ +AliITSpidESD::AliITSpidESD(Double_t *param) +{ + // + // The main constructor + // + fMIP=param[0]; + fRes=param[1]; + fRange=param[2]; +} + +Double_t AliITSpidESD::Bethe(Double_t bg) { + // + // This is the Bethe-Bloch function normalised to 1 at the minimum + // + Double_t bg2=bg*bg; + Double_t bethe=(1.+ bg2)/bg2*(log(5940*bg2) - bg2/(1.+ bg2)); + return bethe/11.091; +} + +//_________________________________________________________________________ +Int_t AliITSpidESD::MakePID(AliESD *event) +{ + // + // This function calculates the "detector response" PID probabilities + // + static const Double_t masses[]={ + 0.000511, 0.105658, 0.139570, 0.493677, 0.938272, 1.875613 + }; + Int_t ntrk=event->GetNumberOfTracks(); + for (Int_t i=0; iGetTrack(i); + if ((t->GetStatus()&AliESDtrack::kITSin )==0) + if ((t->GetStatus()&AliESDtrack::kITSout)==0) continue; + Int_t ns=AliESDtrack::kSPECIES; + Double_t p[10]; + for (Int_t j=0; jGetP(); + Double_t dedx=t->GetITSsignal()/fMIP; + Double_t bethe=Bethe(mom/mass); + Double_t sigma=fRes*bethe; + if (TMath::Abs(dedx-bethe) > fRange*sigma) { + p[j]=0.; + continue; + } + p[j]=TMath::Exp(-0.5*(dedx-bethe)*(dedx-bethe)/(sigma*sigma)); + } + t->SetITSpid(p); + } + return 0; +} diff --git a/ITS/AliITSpidESD.h b/ITS/AliITSpidESD.h new file mode 100644 index 00000000000..92bfc40a6b8 --- /dev/null +++ b/ITS/AliITSpidESD.h @@ -0,0 +1,29 @@ +#ifndef ALIITSpIDESD_H +#define ALIITSpIDESD_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +//------------------------------------------------------- +// ITS PID class +// A very naive design... Should be made better by the detector experts... +// Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch +//------------------------------------------------------- +#include + +class AliESD; + +class AliITSpidESD { +public: + AliITSpidESD(Double_t *param); + Int_t MakePID(AliESD *event); + static Double_t Bethe(Double_t bg); +private: + Double_t fMIP; // dEdx for MIP + Double_t fRes; // relative dEdx resolution + Double_t fRange; // one particle type PID range (in sigmas) + ClassDef(AliITSpidESD,1) // ITS PID class +}; + +#endif + + diff --git a/ITS/ITSLinkDef.h b/ITS/ITSLinkDef.h index c7f54aa8514..282a64dc67c 100644 --- a/ITS/ITSLinkDef.h +++ b/ITS/ITSLinkDef.h @@ -120,6 +120,7 @@ #pragma link C++ class AliITSclusterSSD+; #pragma link C++ class AliITSpackageSSD+; #pragma link C++ class AliITSPid+; +#pragma link C++ class AliITSpidESD+; #pragma link C++ class AliITStrackV2Pid+; // Classes used for Tracking #pragma link C++ class AliITSTrackV1+; diff --git a/ITS/libITS.pkg b/ITS/libITS.pkg index ae331349cb1..1acfcd6ba8c 100644 --- a/ITS/libITS.pkg +++ b/ITS/libITS.pkg @@ -44,7 +44,7 @@ SRCS = AliITS.cxx AliITSv1.cxx AliITSv5.cxx AliITSvSPD02.cxx \ AliITSFindClustersV2.cxx \ AliITSRiemannFit.cxx \ AliITSFDigitizer.cxx \ - AliITSDDLRawData.cxx + AliITSDDLRawData.cxx AliITSpidESD.cxx # AliITSAlignmentTrack.cxx AliITSAlignmentModule.cxx \ HDRS:= $(SRCS:.cxx=.h) diff --git a/STEER/AliESDanalysis.C b/STEER/AliESDanalysis.C index 9c011060708..7593cb69587 100644 --- a/STEER/AliESDanalysis.C +++ b/STEER/AliESDanalysis.C @@ -1,7 +1,7 @@ //******************************************************************** -// Example (very basic for the moment) of the data analysis +// Example (very naive for the moment) of the data analysis // using the ESD classes -// +// It demonstrates the idea of the "combined PID". // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch //******************************************************************** @@ -17,8 +17,32 @@ #endif Int_t AliESDanalysis(Int_t nev=1) { - TH2F *tpcHist=new TH2F("tpcHist","dE/dX vs momentum",50,0.,2.,50,0.,400.); - TH2F *itsHist=new TH2F("itsHits","dE/dX vs momentum",50,0.,2.,50,0.,200.); + TH2F *tpcHist= + new TH2F("tpcHist","TPC dE/dX vs momentum",100,0.,4.,100,0.,500.); + tpcHist->SetXTitle("p (GeV/c)"); tpcHist->SetYTitle("dE/dx (Arb. Units)"); + tpcHist->SetMarkerStyle(8); + tpcHist->SetMarkerSize(0.3); + + TH2F *elHist=new TH2F("elHist","dE/dX vs momentum",100,0.,4.,50,0.,500.); + elHist->SetMarkerStyle(8); + elHist->SetMarkerSize(0.3); + + TH2F *piHist=new TH2F("piHist","dE/dX vs momentum",100,0.,4.,50,0.,500.); + piHist->SetMarkerColor(2); + piHist->SetMarkerStyle(8); + piHist->SetMarkerSize(0.3); + + TH2F *kaHist=new TH2F("kaHist","dE/dX vs momentum",100,0.,4.,100,0.,500.); + kaHist->SetMarkerColor(4); + kaHist->SetMarkerStyle(8); + kaHist->SetMarkerSize(0.3); + + TH2F *prHist=new + TH2F("prHist","Classification into e, pi, K and p",100,0.,4.,100,0.,500.); + prHist->SetXTitle("p (GeV/c)"); prHist->SetYTitle("dE/dx (Arb. Units)"); + prHist->SetMarkerColor(6); + prHist->SetMarkerStyle(8); + prHist->SetMarkerSize(0.3); TFile *ef=TFile::Open("AliESDs.root"); if (!ef->IsOpen()) {cerr<<"Can't AliESDs.root !\n"; return 1;} @@ -28,6 +52,9 @@ Int_t AliESDanalysis(Int_t nev=1) { TKey *key=0; TIter next(ef->GetListOfKeys()); + //****** Tentative particle type "concentrations" + Double_t c[5]={0.05, 0., 0.85, 0.10, 0.05}; + //******* The loop over events while ((key=(TKey*)next())!=0) { cerr<<"Processing event number : "<GetTrack(ntrk); + Double_t p=t->GetP(); + if (t->GetStatus()&AliESDtrack::kTPCin) { Double_t dedx=t->GetTPCsignal(); tpcHist->Fill(p,dedx,1); } - if (t->GetStatus()&AliESDtrack::kITSin) { - Double_t dedx=t->GetITSsignal(); - itsHist->Fill(p,dedx,1); + + if (t->GetStatus()&AliESDtrack::kESDpid) { + Double_t dedx=t->GetTPCsignal(); + Double_t r[10]; t->GetESDpid(r); + Double_t rc=0.; + Int_t i; + for (i=0; iw[3] && w[4]>w[2] && w[4]>w[0]) prHist->Fill(p,dedx,1); + if (w[3]>w[4] && w[3]>w[2] && w[3]>w[0]) kaHist->Fill(p,dedx,1); + if (w[2]>w[3] && w[2]>w[4] && w[2]>w[0]) piHist->Fill(p,dedx,1); + if (w[0]>w[3] && w[0]>w[2] && w[0]>w[4]) elHist->Fill(p,dedx,1); } + } delete event; } @@ -58,7 +102,10 @@ Int_t AliESDanalysis(Int_t nev=1) { c1->cd(1); tpcHist->Draw(); c1->cd(2); - itsHist->Draw(); + prHist->Draw(); + kaHist->Draw("same"); + piHist->Draw("same"); + elHist->Draw("same"); ef->Close(); diff --git a/STEER/AliESDpid.cxx b/STEER/AliESDpid.cxx new file mode 100644 index 00000000000..1b92e349a04 --- /dev/null +++ b/STEER/AliESDpid.cxx @@ -0,0 +1,53 @@ +/************************************************************************** + * 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. * + **************************************************************************/ + +//----------------------------------------------------------------- +// Implementation of the combined PID class +// +// Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch +//----------------------------------------------------------------- + +#include "AliESDpid.h" +#include "AliESD.h" +#include "AliESDtrack.h" + +ClassImp(AliESDpid) + +//_________________________________________________________________________ +Int_t AliESDpid::MakePID(AliESD *event) +{ + Int_t ntrk=event->GetNumberOfTracks(); + for (Int_t i=0; iGetTrack(i); + + if ((t->GetStatus()&AliESDtrack::kITSpid )!=0) { + Double_t d[10]; + t->GetITSpid(d); + for (Int_t j=0; jGetStatus()&AliESDtrack::kTPCpid )!=0) { + Double_t d[10]; + t->GetTPCpid(d); + for (Int_t j=0; jSetESDpid(p); + } + return 0; +} diff --git a/STEER/AliESDpid.h b/STEER/AliESDpid.h new file mode 100644 index 00000000000..72071e4dd64 --- /dev/null +++ b/STEER/AliESDpid.h @@ -0,0 +1,25 @@ +#ifndef ALIESDPID_H +#define ALIESDPID_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +//------------------------------------------------------- +// Combined PID class +// +// Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch +//------------------------------------------------------- +#include + +class AliESD; + +class AliESDpid { +public: + AliESDpid(){} + static Int_t MakePID(AliESD *event); +private: + ClassDef(AliESDpid,1) // TPC PID class +}; + +#endif + + diff --git a/STEER/AliESDtest.C b/STEER/AliESDtest.C index 12570bd5b55..8c721282ebf 100644 --- a/STEER/AliESDtest.C +++ b/STEER/AliESDtest.C @@ -17,10 +17,13 @@ #include "TStopwatch.h" #include "AliESD.h" + #include "AliESDpid.h" + #include "AliTPCpidESD.h" #include "AliTPCParam.h" #include "AliTPCtracker.h" #include "AliITSgeom.h" #include "AliITStrackerV2.h" + #include "AliITSpidESD.h" #endif Int_t AliESDtest(Int_t nev=1) { @@ -36,6 +39,9 @@ Int_t AliESDtest(Int_t nev=1) { //An instance of the TPC tracker AliTPCtracker tpcTracker(par); + //An instance of the TPC PID maker + Double_t parTPC[]={47.,0.1,3.}; + AliTPCpidESD tpcPID(parTPC); //File with the ITS clusters TFile *itscf=TFile::Open("AliITSclustersV2.root"); @@ -48,7 +54,11 @@ Int_t AliESDtest(Int_t nev=1) { //An instance of the ITS tracker AliITStrackerV2 itsTracker(geom); - + + //An instance of the ITS PID maker + Double_t parITS[]={34.,0.12,3.}; + AliITSpidESD itsPID(parITS); + TFile *ef=TFile::Open("AliESDs.root","new"); if (!ef->IsOpen()) {cerr<<"Can't AliESDs.root !\n"; return 1;} @@ -71,9 +81,14 @@ Int_t AliESDtest(Int_t nev=1) { rc+=itsTracker.PropagateBack(event); itsTracker.UnloadClusters(); + itsPID.MakePID(event); rc+=tpcTracker.PropagateBack(event); tpcTracker.UnloadClusters(); + tpcPID.MakePID(event); + + //Here is the combined PID + AliESDpid::MakePID(event); if (rc==0) { Char_t ename[100]; diff --git a/STEER/AliESDtrack.cxx b/STEER/AliESDtrack.cxx index df87488bde2..ea507e88968 100644 --- a/STEER/AliESDtrack.cxx +++ b/STEER/AliESDtrack.cxx @@ -168,3 +168,26 @@ Int_t AliESDtrack::GetTPCclusters(UInt_t *idx) const { for (Int_t i=0; iGetNumberOfTracks(); + for (Int_t i=0; iGetTrack(i); + if ((t->GetStatus()&AliESDtrack::kTPCin )==0) + if ((t->GetStatus()&AliESDtrack::kTPCout)==0) continue; + Int_t ns=AliESDtrack::kSPECIES; + Double_t p[10]; + for (Int_t j=0; jGetP(); + Double_t dedx=t->GetTPCsignal()/fMIP; + Double_t bethe=Bethe(mom/mass); + Double_t sigma=fRes*bethe; + if (TMath::Abs(dedx-bethe) > fRange*sigma) { + p[j]=0.; + continue; + } + p[j]=TMath::Exp(-0.5*(dedx-bethe)*(dedx-bethe)/(sigma*sigma)); + } + t->SetTPCpid(p); + } + return 0; +} diff --git a/TPC/AliTPCpidESD.h b/TPC/AliTPCpidESD.h new file mode 100644 index 00000000000..09a6c48af17 --- /dev/null +++ b/TPC/AliTPCpidESD.h @@ -0,0 +1,29 @@ +#ifndef ALITPCpIDESD_H +#define ALITPCpIDESD_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +//------------------------------------------------------- +// TPC PID class +// A very naive design... Should be made better by the detector experts... +// Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch +//------------------------------------------------------- +#include + +class AliESD; + +class AliTPCpidESD { +public: + AliTPCpidESD(Double_t *param); + Int_t MakePID(AliESD *event); + static Double_t Bethe(Double_t bg); +private: + Double_t fMIP; // dEdx for MIP + Double_t fRes; // relative dEdx resolution + Double_t fRange; // one particle type PID range (in sigmas) + ClassDef(AliTPCpidESD,1) // TPC PID class +}; + +#endif + + diff --git a/TPC/TPCLinkDef.h b/TPC/TPCLinkDef.h index 2fa7af8ec77..eb8f880e9b6 100644 --- a/TPC/TPCLinkDef.h +++ b/TPC/TPCLinkDef.h @@ -82,6 +82,7 @@ #pragma link C++ class AliTPCKalmanSegment+; #pragma link C++ class AliTPCPid+; +#pragma link C++ class AliTPCpidESD+; #pragma link C++ class AliTPCtrackPid+; diff --git a/TPC/libTPC.pkg b/TPC/libTPC.pkg index dab4348ce25..af30b16e71e 100644 --- a/TPC/libTPC.pkg +++ b/TPC/libTPC.pkg @@ -15,7 +15,7 @@ SRCS:= AliTPC.cxx AliTPCv0.cxx AliTPCv1.cxx AliTPCv2.cxx \ AliTPCpolyTrack.cxx \ AliTPCBuffer.cxx AliTPCBuffer160.cxx \ AliTPCCompression.cxx AliTPCDDLRawData.cxx \ - AliTPCHuffman.cxx AliTPCPid.cxx AliTPCtrackPid.cxx + AliTPCHuffman.cxx AliTPCPid.cxx AliTPCtrackPid.cxx AliTPCpidESD.cxx HDRS:= $(SRCS:.cxx=.h) -- 2.43.0