From becde6cefaae50698b7e48291827c9e715ec60d1 Mon Sep 17 00:00:00 2001 From: skowron Date: Tue, 13 Apr 2004 13:58:18 +0000 Subject: [PATCH] Functions for handling PID purity added --- HBTAN/AliHBTPIDPurityFctns.cxx | 360 +++++++++++++++++++++++++++++++++ HBTAN/AliHBTPIDPurityFctns.h | 94 +++++++++ HBTAN/AliHBTPair.h | 4 +- HBTAN/HBTAnalysisLinkDef.h | 11 +- HBTAN/libHBTAN.pkg | 3 +- 5 files changed, 468 insertions(+), 4 deletions(-) create mode 100644 HBTAN/AliHBTPIDPurityFctns.cxx create mode 100644 HBTAN/AliHBTPIDPurityFctns.h diff --git a/HBTAN/AliHBTPIDPurityFctns.cxx b/HBTAN/AliHBTPIDPurityFctns.cxx new file mode 100644 index 00000000000..a4edf2ad880 --- /dev/null +++ b/HBTAN/AliHBTPIDPurityFctns.cxx @@ -0,0 +1,360 @@ +#include "AliHBTPIDPurityFctns.h" +//_______________________________________________________________________________ +///////////////////////////////////////////////////////////////////////////////// +// +// class AliHBTMonPhiResolutionVsPtFctn; +// class AliHBTMonThetaResolutionVsPtFctn; +// +// file: AliHBTPIDPurityFctns.cxx AliHBTPIDPurityFctns.h +// +// Caution: On 2D plots on X axis in simulated values +// That is contrary to two-particle resolutions where it is reconstructed one +// +// added by Piotr.Skowronski@cern.ch +// +// +////////////////////////////////////////////////////////////////////////////////// + + +/******************************************************************/ +/******************************************************************/ + +ClassImp(AliHBTMonPIDPurityVsPtFctn) + +AliHBTMonPIDPurityVsPtFctn::AliHBTMonPIDPurityVsPtFctn(Int_t nbins, Double_t maxXval, Double_t minXval): + AliHBTMonTwoParticleFctn1D(nbins,maxXval,minXval), + fGood(0x0) +{ + //ctor + Rename("pidpurityvspt","PIDPurityVsPt"); + +} +/******************************************************************/ + +AliHBTMonPIDPurityVsPtFctn::~AliHBTMonPIDPurityVsPtFctn() +{ + //dtor + delete fGood; +} +/******************************************************************/ +void AliHBTMonPIDPurityVsPtFctn::Write() +{ + AliHBTMonitorFunction::Write(); + fGood->Write(); +} +/******************************************************************/ + +void AliHBTMonPIDPurityVsPtFctn::Init() +{ +//Initializes fuction + if (AliHBTParticle::GetDebug()>0) Info("Init","%s",GetName()); + + if (fResult == 0x0) + { + Warning("Init","Function has NULL result histogram!"); + return; + } + + if (fGood == 0x0) + { + TString numstr = fName + " Good"; //title and name of the + //result histogram + TAxis* xax = fResult->GetXaxis(); + fGood = new TH1D(numstr,numstr,xax->GetNbins(),xax->GetXmin(),xax->GetXmax()); + } + + fResult->Reset(); + fResult->SetDirectory(0x0); + fGood->Reset(); + fGood->SetDirectory(0x0); + + if (AliHBTParticle::GetDebug()>0) Info("Init","%s Done.",GetName()); +} + +/******************************************************************/ + +void AliHBTMonPIDPurityVsPtFctn::Rename(const Char_t * name) +{ + //Rename fuctions and all histograms belonging to it + SetName(name); + SetTitle(name); + + if (fResult) + { + TString numstr = fName + " Result"; //title and name of the result histogram + fResult->SetName(numstr); + fResult->SetTitle(numstr); + } + if (fGood) + { + TString numstr = fName + " Good"; + fGood->SetName(numstr); + fGood->SetTitle(numstr); + } +} +/******************************************************************/ + +void AliHBTMonPIDPurityVsPtFctn::Rename(const Char_t * name, const Char_t * title) +{ + //renames and retitle the function and histograms + + SetName(name); + SetTitle(title); + + if (fResult) + { + TString numstrn = fName + " Result"; //name of the result histogram + TString numstrt = fTitle + " Result"; //title of the result histogram + fResult->SetName(numstrn); + fResult->SetTitle(numstrt); + } + if (fGood) + { + TString numstrn = fName + " Good"; //name of the Good histogram + TString numstrt = fTitle + " Good"; //title of the Good histogram + fGood->SetName(numstrn); + fGood->SetTitle(numstrt); + } + +} +/******************************************************************/ + +TH1* AliHBTMonPIDPurityVsPtFctn::GetResult() +{ + //Returns the result of the fuction + //that is histogram with effciency and contamination + + TH1D* htmp = (TH1D*)fResult->Clone("PIDPurityHTMP"); + fResult->Reset(); + fResult->Divide(fGood,htmp); + return fResult; +} +/******************************************************************/ + +void AliHBTMonPIDPurityVsPtFctn::Process(AliHBTParticle * track,AliHBTParticle * part) +{ + //process the particle/track + Double_t pt = part->Pt(); + fResult->Fill(pt); + if (track->GetPdgCode() == part->GetPdgCode()) + { + fGood->Fill(pt); + } +// else +// { +// Info("Process","Catched pid impurity ..."); +// } +} + +/******************************************************************/ +/******************************************************************/ +/******************************************************************/ + +ClassImp(AliHBTMonPIDContaminationVsPtFctn) + +AliHBTMonPIDContaminationVsPtFctn::AliHBTMonPIDContaminationVsPtFctn(Int_t nbins, Double_t maxXval, Double_t minXval): + AliHBTMonTwoParticleFctn1D(nbins,maxXval,minXval), + fWrong(0x0) +{ + //ctor + Rename("pidcontaminationvspt","PIDContaminationVsPt"); +} +/******************************************************************/ + +AliHBTMonPIDContaminationVsPtFctn::~AliHBTMonPIDContaminationVsPtFctn() +{ + //dtor + delete fWrong; +} +/******************************************************************/ + +void AliHBTMonPIDContaminationVsPtFctn::Write() +{ + //Writes the function results + AliHBTMonitorFunction::Write(); + fWrong->Write(); +} +/******************************************************************/ + +void AliHBTMonPIDContaminationVsPtFctn::Init() +{ +//Initializes fuction + if (AliHBTParticle::GetDebug()>0) Info("Init","%s",GetName()); + + if (fResult == 0x0) + { + Warning("Init","Function has NULL result histogram!"); + return; + } + + if (fWrong == 0x0) + { + TString numstr = fName + " Wrong"; //title and name of the + //result histogram + TAxis* xax = fResult->GetXaxis(); + fWrong = new TH1D(numstr,numstr,xax->GetNbins(),xax->GetXmin(),xax->GetXmax()); + } + + fResult->Reset(); + fResult->SetDirectory(0x0); + fWrong->Reset(); + fWrong->SetDirectory(0x0); + + if (AliHBTParticle::GetDebug()>0) Info("Init","%s Done.",GetName()); +} + +/******************************************************************/ + +void AliHBTMonPIDContaminationVsPtFctn::Rename(const Char_t * name) +{ + //Rename fuctions and all histograms belonging to it + SetName(name); + SetTitle(name); + + if (fResult) + { + TString numstr = fName + " Result"; //title and name of the result histogram + fResult->SetName(numstr); + fResult->SetTitle(numstr); + } + if (fWrong) + { + TString numstr = fName + " Wrong"; + fWrong->SetName(numstr); + fWrong->SetTitle(numstr); + } +} +/******************************************************************/ + +void AliHBTMonPIDContaminationVsPtFctn::Rename(const Char_t * name, const Char_t * title) +{ + //renames and retitle the function and histograms + + SetName(name); + SetTitle(title); + + if (fResult) + { + TString numstrn = fName + " Result"; //name of the result histogram + TString numstrt = fTitle + " Result"; //title of the result histogram + fResult->SetName(numstrn); + fResult->SetTitle(numstrt); + } + if (fWrong) + { + TString numstrn = fName + " Wrong"; //name of the Wrong histogram + TString numstrt = fTitle + " Wrong"; //title of the Wrong histogram + fWrong->SetName(numstrn); + fWrong->SetTitle(numstrt); + } +} +/******************************************************************/ + +TH1* AliHBTMonPIDContaminationVsPtFctn::GetResult() +{ + //Returns the result of the fuction + //that is histogram with effciency and contamination + + TH1D* htmp = (TH1D*)fResult->Clone("PIDContaminationHTMP"); + fResult->Reset(); + fResult->Divide(fWrong,htmp); + return fResult; +} +/******************************************************************/ + +void AliHBTMonPIDContaminationVsPtFctn::Process(AliHBTParticle * track, AliHBTParticle * part) +{ + //process the particle/track + Double_t pt = part->Pt(); + fResult->Fill(pt); + + if (track->GetPdgCode() != part->GetPdgCode()) + { +// Info("Process","Catched contamination"); +// track->Print();part->Print(); + fWrong->Fill(pt); + } +} + +/******************************************************************/ +ClassImp(AliHBTPairPIDProbVsQInvFctn) + +AliHBTPairPIDProbVsQInvFctn::AliHBTPairPIDProbVsQInvFctn(Int_t nbins, Double_t maxXval, Double_t minXval): + AliHBTOnePairFctn1D(nbins,maxXval,minXval) +{ + fWriteNumAndDen = kTRUE;//change default behaviour + Rename("qinvpidpur","Q_{inv} Function"); +} +/******************************************************************/ + +TH1* AliHBTPairPIDProbVsQInvFctn::GetResult() +{ + //returns the scaled ratio + delete fRatio; + fRatio = GetRatio(Scale()); + return fRatio; +} +/******************************************************************/ + +void AliHBTPairPIDProbVsQInvFctn::ProcessSameEventParticles(AliHBTPair* pair) +{ + //Fills the numerator using pair from the same event + pair = CheckPair(pair); + if(pair) fNumerator->Fill(pair->GetQInv(),pair->GetPIDProb()); +} +/******************************************************************/ + +void AliHBTPairPIDProbVsQInvFctn::ProcessDiffEventParticles(AliHBTPair* pair) + { + //Fills the denumerator using mixed pairs + pair = CheckPair(pair); + if(pair) fDenominator->Fill(pair->GetQInv(),pair->GetPIDProb()); + } + + +ClassImp(AliHBTPairPIDProbVsQOutSQideQLongFctn) + +AliHBTPairPIDProbVsQOutSQideQLongFctn::AliHBTPairPIDProbVsQOutSQideQLongFctn(Int_t nXbins, Double_t maxXval, Double_t minXval, + Int_t nYbins, Double_t maxYval, Double_t minYval, + Int_t nZbins, Double_t maxZval, Double_t minZval): + AliHBTOnePairFctn3D(nXbins,maxXval,minXval,nYbins,maxYval,minYval,nZbins,maxZval,minZval) +{ + //ctor + fWriteNumAndDen = kTRUE;//change default behaviour + Rename("qoslpidpur","Pair PID Probablilty .vs. Q_{out}-Q_{side}-Q_{long} Fctn"); +} +/*************************************************************/ + +void AliHBTPairPIDProbVsQOutSQideQLongFctn::ProcessSameEventParticles(AliHBTPair* pair) +{ +//Fills numerator + pair = CheckPair(pair); + if (pair == 0x0) return; + Double_t weight = pair->GetPIDProb(); + Double_t out = TMath::Abs(pair->GetQOutCMSLC()); + Double_t side = TMath::Abs(pair->GetQSideCMSLC()); + Double_t lon = TMath::Abs(pair->GetQLongCMSLC()); + fNumerator->Fill(out,side,lon,weight); +} +/*************************************************************/ + +void AliHBTPairPIDProbVsQOutSQideQLongFctn::ProcessDiffEventParticles(AliHBTPair* pair) +{ +//Fills numerator + pair = CheckPair(pair); + if (pair == 0x0) return; + Double_t weight = pair->GetPIDProb(); + Double_t out = TMath::Abs(pair->GetQOutCMSLC()); + Double_t side = TMath::Abs(pair->GetQSideCMSLC()); + Double_t lon = TMath::Abs(pair->GetQLongCMSLC()); + fDenominator->Fill(out,side,lon,weight); +} +/*************************************************************/ + +TH1* AliHBTPairPIDProbVsQOutSQideQLongFctn::GetResult() +{ + //returns the scaled ratio + delete fRatio; + fRatio = GetRatio(Scale()); + return fRatio; +} diff --git a/HBTAN/AliHBTPIDPurityFctns.h b/HBTAN/AliHBTPIDPurityFctns.h new file mode 100644 index 00000000000..8c2499ef26e --- /dev/null +++ b/HBTAN/AliHBTPIDPurityFctns.h @@ -0,0 +1,94 @@ +#ifndef ALIHBTPIDPURITYFCTNS_H +#define ALIHBTPIDPURITYFCTNS_H +//_______________________________________________________________________________ +///////////////////////////////////////////////////////////////////////////////// +// +// class AliHBTMonPIDPurityVsPtFctn; +// class AliHBTMonThetaResolutionVsPtFctn; +// +// file: AliHBTPIDPurityFctns.cxx AliHBTPIDPurityFctns.h +// +// Caution: On 2D plots on X axis in simulated values +// That is contrary to two-particle resolutions where it is reconstructed one +// +// added by Piotr.Skowronski@cern.ch +// +// +////////////////////////////////////////////////////////////////////////////////// + +#include "AliHBTFunction.h" +#include "AliHBTMonitorFunction.h" + +class AliHBTMonPIDPurityVsPtFctn: public AliHBTMonTwoParticleFctn1D +{ + public: + AliHBTMonPIDPurityVsPtFctn(Int_t nbins = 20, Double_t maxXval = 2.0, Double_t minXval = 0.0); + virtual ~AliHBTMonPIDPurityVsPtFctn(); + void Init(); + void Write(); + void Rename(const Char_t * name); + void Rename(const Char_t * name, const Char_t * title); + TH1* GetResult(); + Double_t GetValue(AliHBTParticle * /*track*/,AliHBTParticle * /*part*/) { return 0.0; } + void Process(AliHBTParticle * track,AliHBTParticle * part); + protected: + TH1D* fGood; + ClassDef(AliHBTMonPIDPurityVsPtFctn,1) +}; +/***********************************************************************/ + +class AliHBTMonPIDContaminationVsPtFctn: public AliHBTMonTwoParticleFctn1D, public AliHBTCorrelFunction +{ + public: + AliHBTMonPIDContaminationVsPtFctn(Int_t nbins = 20, Double_t maxXval = 2.0, Double_t minXval = 0.0); + virtual ~AliHBTMonPIDContaminationVsPtFctn(); + void Init(); + void Write(); + void Rename(const Char_t * name); + void Rename(const Char_t * name, const Char_t * title); + TH1* GetResult(); + Double_t GetValue(AliHBTParticle * /*track*/,AliHBTParticle * /*part*/) { return 0.0; } + void Process(AliHBTParticle * track,AliHBTParticle * part); + protected: + TH1D* fWrong; + ClassDef(AliHBTMonPIDContaminationVsPtFctn,1) +}; +/*************************************************************************************/ + +class AliHBTPairPIDProbVsQInvFctn: public AliHBTOnePairFctn1D, public AliHBTCorrelFunction +{ +//Q Invaraint Correlation Function +//1D two particle function + public: + AliHBTPairPIDProbVsQInvFctn(Int_t nbins = 100, Double_t maxXval = 0.15, Double_t minXval = 0.0); + virtual ~AliHBTPairPIDProbVsQInvFctn(){}; + void ProcessSameEventParticles(AliHBTPair* pair); + void ProcessDiffEventParticles(AliHBTPair* pair); + TH1* GetResult(); + protected: + Double_t GetValue(AliHBTPair * pair){return pair->GetQInv();} + private: + ClassDef(AliHBTPairPIDProbVsQInvFctn,1) +}; +/*************************************************************************************/ +class AliHBTPairPIDProbVsQOutSQideQLongFctn: public AliHBTOnePairFctn3D, public AliHBTCorrelFunction +{ + + public: + AliHBTPairPIDProbVsQOutSQideQLongFctn(Int_t nXbins = 100, Double_t maxXval = 0.15, Double_t minXval = 0.0, + Int_t nYbins = 100, Double_t maxYval = 0.15, Double_t minYval = 0.0, + Int_t nZbins = 100, Double_t maxZval = 0.15, Double_t minZval = 0.0); + virtual ~AliHBTPairPIDProbVsQOutSQideQLongFctn(){} + + TH1* GetResult(); + void ProcessSameEventParticles(AliHBTPair* part); + void ProcessDiffEventParticles(AliHBTPair* pair); + + protected: + void GetValues(AliHBTPair* /*pair*/, Double_t& /*x*/, Double_t& /*y*/, Double_t& /*z*/){} + + ClassDef(AliHBTPairPIDProbVsQOutSQideQLongFctn,1) +}; + + +#endif diff --git a/HBTAN/AliHBTPair.h b/HBTAN/AliHBTPair.h index ca5d7abef32..4f82aa5557e 100644 --- a/HBTAN/AliHBTPair.h +++ b/HBTAN/AliHBTPair.h @@ -58,7 +58,9 @@ class AliHBTPair: public TObject virtual Double_t GetDeltaPhi(); virtual Double_t GetGammaToCMSLC(); - Double_t GetWeight(); + virtual Double_t GetWeight(); + virtual Double_t GetPIDProb() const {return fPart1->GetPidProb()*fPart2->GetPidProb();} + protected: AliHBTParticle* fPart1; //pointer to first particle AliHBTParticle* fPart2; //pointer to second particle diff --git a/HBTAN/HBTAnalysisLinkDef.h b/HBTAN/HBTAnalysisLinkDef.h index 73d381d8c60..30deb038503 100644 --- a/HBTAN/HBTAnalysisLinkDef.h +++ b/HBTAN/HBTAnalysisLinkDef.h @@ -39,11 +39,12 @@ #pragma link C++ class AliHBTParticleCut-; #pragma link C++ class AliHBTEmptyParticleCut-; +#pragma link C++ class AliHbtBaseCut+; + #pragma link C++ class AliHBTPairCut-; #pragma link C++ class AliHBTEmptyPairCut-; - -#pragma link C++ class AliHbtBaseCut+; #pragma link C++ class AliHbtBasePairCut+; + #pragma link C++ class AliHBTQInvCut+; #pragma link C++ class AliHBTKtCut+; #pragma link C++ class AliHBTKStarCut+; @@ -170,6 +171,12 @@ #pragma link C++ class AliHBTMonPhiResolutionVsPhiFctn+; #pragma link C++ class AliHBTMonThetaResolutionVsThetaFctn+; + +#pragma link C++ class AliHBTMonPIDPurityVsPtFctn+; +#pragma link C++ class AliHBTMonPIDContaminationVsPtFctn+; +#pragma link C++ class AliHBTPairPIDProbVsQInvFctn+; +#pragma link C++ class AliHBTPairPIDProbVsQOutSQideQLongFctn+; + #pragma link C++ class AliHBTTwoTrackEffFctn+; #pragma link C++ class AliHBTTwoTrackEffFctnPtThetaPhi+; #pragma link C++ class AliHBTTwoTrackEffFctnPxPyPz+; diff --git a/HBTAN/libHBTAN.pkg b/HBTAN/libHBTAN.pkg index 9b448e96aa9..7fd8e26cbd3 100644 --- a/HBTAN/libHBTAN.pkg +++ b/HBTAN/libHBTAN.pkg @@ -15,7 +15,8 @@ AliHBTWeightsPID.cxx AliHBTWeightTheorFctn.cxx \ AliHBTPositionRandomizer.cxx AliHBTEventBuffer.cxx \ AliHBTCorrFitFctn.cxx \ AliHBTCorrectQInvCorrelFctn.cxx AliHBTCorrectOSLCorrelFctn.cxx \ -AliHBTTrackPoints.cxx AliHBTClusterMap.cxx AliHBTFits.cxx +AliHBTTrackPoints.cxx AliHBTClusterMap.cxx AliHBTFits.cxx \ +AliHBTPIDPurityFctns.cxx FSRCS = fsiini.F fsiw.F led_bldata.F ltran12.F -- 2.43.0