Functions for handling PID purity added
authorskowron <skowron@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 13 Apr 2004 13:58:18 +0000 (13:58 +0000)
committerskowron <skowron@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 13 Apr 2004 13:58:18 +0000 (13:58 +0000)
HBTAN/AliHBTPIDPurityFctns.cxx [new file with mode: 0644]
HBTAN/AliHBTPIDPurityFctns.h [new file with mode: 0644]
HBTAN/AliHBTPair.h
HBTAN/HBTAnalysisLinkDef.h
HBTAN/libHBTAN.pkg

diff --git a/HBTAN/AliHBTPIDPurityFctns.cxx b/HBTAN/AliHBTPIDPurityFctns.cxx
new file mode 100644 (file)
index 0000000..a4edf2a
--- /dev/null
@@ -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 (file)
index 0000000..8c2499e
--- /dev/null
@@ -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
index ca5d7abef32ae0258cb9668e81fe80cd38d0fae1..4f82aa5557e1dd6ace91f290bbb8e0950cd17266 100644 (file)
@@ -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
index 73d381d8c6080afd7f6b92cdcf6892faf62c7be1..30deb03850310f5c742a24aa2dc5fd5299185944 100644 (file)
 
 #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+;
 #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+;
index 9b448e96aa907c159bf00847afce6e91b8f8212e..7fd8e26cbd336a0580b03396dc6c67a1ab6146ae 100644 (file)
@@ -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