From 720a0a16fa8d7f72fbb392f133f2999631f9dad4 Mon Sep 17 00:00:00 2001 From: cblume Date: Thu, 26 Jul 2007 12:22:55 +0000 Subject: [PATCH] Rename AliTRDCalPIDLQ --- TRD/AliTRDcalibDB.cxx | 6 +- TRD/AliTRDcalibDB.h | 4 +- TRD/AliTRDgtuTrack.cxx | 4 +- TRD/AliTRDpidESD.cxx | 8 +- TRD/AliTRDtrack.cxx | 8 +- TRD/AliTRDtrack.h | 2 +- TRD/AliTRDtrigger.cxx | 2 +- TRD/Cal/AliTRDCalPID.cxx | 412 +++++++++++++++++++++++++++++++ TRD/Cal/AliTRDCalPID.h | 77 ++++++ TRD/Cal/AliTRDCalPIDRefMaker.cxx | 32 +-- TRD/TRDbaseLinkDef.h | 2 +- TRD/libTRDbase.pkg | 2 +- 12 files changed, 524 insertions(+), 35 deletions(-) create mode 100644 TRD/Cal/AliTRDCalPID.cxx create mode 100644 TRD/Cal/AliTRDCalPID.h diff --git a/TRD/AliTRDcalibDB.cxx b/TRD/AliTRDcalibDB.cxx index 2d03ac5b915..2f3e1f06428 100644 --- a/TRD/AliTRDcalibDB.cxx +++ b/TRD/AliTRDcalibDB.cxx @@ -45,7 +45,7 @@ #include "Cal/AliTRDCalPad.h" #include "Cal/AliTRDCalDet.h" #include "Cal/AliTRDCalFEE.h" -#include "Cal/AliTRDCalPIDLQ.h" +#include "Cal/AliTRDCalPID.h" #include "Cal/AliTRDCalMonitoring.h" #include "Cal/AliTRDCalChamberStatus.h" #include "Cal/AliTRDCalPadStatus.h" @@ -798,13 +798,13 @@ Bool_t AliTRDcalibDB::IsChamberMasked(Int_t det) } //_____________________________________________________________________________ -const AliTRDCalPIDLQ *AliTRDcalibDB::GetPIDLQObject() +const AliTRDCalPID *AliTRDcalibDB::GetPIDLQObject() { // // Returns the object storing the distributions for PID with likelihood // - return dynamic_cast + return dynamic_cast (GetCachedCDBObject(kIDPIDLQ)); } diff --git a/TRD/AliTRDcalibDB.h b/TRD/AliTRDcalibDB.h index 5a1799d4ea4..a1537281988 100644 --- a/TRD/AliTRDcalibDB.h +++ b/TRD/AliTRDcalibDB.h @@ -15,7 +15,7 @@ class AliCDBEntry; -class AliTRDCalPIDLQ; +class AliTRDCalPID; class AliTRDCalMonitoring; class AliTRDCalROC; class AliTRDCalDet; @@ -66,7 +66,7 @@ class AliTRDcalibDB : public TObject { Bool_t IsChamberMasked(Int_t det); const AliTRDCalMonitoring *GetMonitoringObject(); - const AliTRDCalPIDLQ *GetPIDLQObject(); + const AliTRDCalPID *GetPIDLQObject(); // Related functions, these depend on calibration data static Float_t GetOmegaTau(Float_t vdrift, Float_t bz); diff --git a/TRD/AliTRDgtuTrack.cxx b/TRD/AliTRDgtuTrack.cxx index e08f09b445b..abbb80977a8 100644 --- a/TRD/AliTRDgtuTrack.cxx +++ b/TRD/AliTRDgtuTrack.cxx @@ -33,7 +33,7 @@ #include "AliTRDcalibDB.h" #include "AliTRDltuTracklet.h" #include "AliTRDgtuTrack.h" -#include "Cal/AliTRDCalPIDLQ.h" +#include "Cal/AliTRDCalPID.h" ClassImp(AliTRDgtuTrack) @@ -390,7 +390,7 @@ void AliTRDgtuTrack::MakePID() AliError("No instance of AliTRDcalibDB."); return; } - const AliTRDCalPIDLQ *pd = calibration->GetPIDLQObject(); + const AliTRDCalPID *pd = calibration->GetPIDLQObject(); AliTRDltuTracklet *trk; Int_t nTracklets = GetNtracklets(); diff --git a/TRD/AliTRDpidESD.cxx b/TRD/AliTRDpidESD.cxx index 17442854699..87b15a7734d 100644 --- a/TRD/AliTRDpidESD.cxx +++ b/TRD/AliTRDpidESD.cxx @@ -41,7 +41,7 @@ #include "AliTRDcalibDB.h" #include "AliRun.h" #include "AliTRDtrack.h" -#include "Cal/AliTRDCalPIDLQ.h" +#include "Cal/AliTRDCalPID.h" ClassImp(AliTRDpidESD) @@ -116,7 +116,7 @@ Int_t AliTRDpidESD::MakePID(AliESDEvent *event) // The method produces probabilities based on the charge // and the position of the maximum time bin in each layer. // The dE/dx information can be used as global charge or 2 to 3 - // slices. Check AliTRDCalPIDLQ and AliTRDCalPIDLQRef for the actual + // slices. Check AliTRDCalPID and AliTRDCalPIDRefMaker for the actual // implementation. // // Author @@ -130,10 +130,10 @@ Int_t AliTRDpidESD::MakePID(AliESDEvent *event) } // Retrieve the CDB container class with the probability distributions - const AliTRDCalPIDLQ *pd = calibration->GetPIDLQObject(); + const AliTRDCalPID *pd = calibration->GetPIDLQObject(); if (!pd) { AliErrorGeneral("AliTRDpidESD::MakePID()" - ,"No access to AliTRDCalPIDLQ"); + ,"No access to AliTRDCalPID"); return -1; } diff --git a/TRD/AliTRDtrack.cxx b/TRD/AliTRDtrack.cxx index d53b358d841..ab47ca77106 100644 --- a/TRD/AliTRDtrack.cxx +++ b/TRD/AliTRDtrack.cxx @@ -30,7 +30,7 @@ // A. Bercuci - used for PID calculations #include "AliTRDcalibDB.h" -#include "Cal/AliTRDCalPIDLQ.h" +#include "Cal/AliTRDCalPID.h" ClassImp(AliTRDtrack) @@ -578,7 +578,7 @@ Int_t AliTRDtrack::CookPID(AliESDtrack *esd) // The method produces probabilities based on the charge // and the position of the maximum time bin in each layer. // The dE/dx information can be used as global charge or 2 to 3 - // slices. Check AliTRDCalPIDLQ and AliTRDCalPIDLQRef for the actual + // slices. Check AliTRDCalPID and AliTRDCalPIDRefMaker for the actual // implementation. // // Author @@ -592,9 +592,9 @@ Int_t AliTRDtrack::CookPID(AliESDtrack *esd) } // Retrieve the CDB container class with the probability distributions - const AliTRDCalPIDLQ *pd = calibration->GetPIDLQObject(); + const AliTRDCalPID *pd = calibration->GetPIDLQObject(); if (!pd) { - AliError("No access to AliTRDCalPIDLQ"); + AliError("No access to AliTRDCalPID"); return -1; } diff --git a/TRD/AliTRDtrack.h b/TRD/AliTRDtrack.h index 236fea3a9aa..486757a2e78 100644 --- a/TRD/AliTRDtrack.h +++ b/TRD/AliTRDtrack.h @@ -101,7 +101,7 @@ class AliTRDtrack : public AliKalmanTrack { inline Float_t GetMomentumPlane(Int_t plane) const {return (plane >= 0 && plane < kNplane) ? fMom[plane] : 0.;} inline Float_t GetSnpPlane(Int_t plane) const {return (plane >= 0 && plane < kNplane) ? fSnp[plane] : 0.;} inline Float_t GetTglPlane(Int_t plane) const {return (plane >= 0 && plane < kNplane) ? fTgl[plane] : 0.;} - inline Float_t GetTrackLengthPlane(Int_t plane) const; + Float_t GetTrackLengthPlane(Int_t plane) const; //end A.Bercuci void MakeBackupTrack(); diff --git a/TRD/AliTRDtrigger.cxx b/TRD/AliTRDtrigger.cxx index b1b95375eee..48962e47f8a 100644 --- a/TRD/AliTRDtrigger.cxx +++ b/TRD/AliTRDtrigger.cxx @@ -45,7 +45,7 @@ #include "AliTRDmcm.h" #include "AliTRDzmaps.h" #include "AliTRDCalibraFillHisto.h" -#include "Cal/AliTRDCalPIDLQ.h" +#include "Cal/AliTRDCalPID.h" ClassImp(AliTRDtrigger) diff --git a/TRD/Cal/AliTRDCalPID.cxx b/TRD/Cal/AliTRDCalPID.cxx new file mode 100644 index 00000000000..3541e0a879d --- /dev/null +++ b/TRD/Cal/AliTRDCalPID.cxx @@ -0,0 +1,412 @@ +/************************************************************************** + * 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. * + **************************************************************************/ + +/* $Id$ */ + +////////////////////////////////////////////////////////////////////////// +// // +// Container for the distributions of dE/dx and the time bin of the // +// max. cluster for electrons and pions // +// // +// Authors: // +// Prashant Shukla // +// Alex Bercuci // +// // +////////////////////////////////////////////////////////////////////////// + +#include +#include +#include +#include + +#include "AliLog.h" +#include "AliPID.h" +#include "AliESD.h" +#include "AliESDtrack.h" + +#include "AliTRDCalPID.h" +#include "AliTRDcalibDB.h" + +ClassImp(AliTRDCalPID) + +Char_t* AliTRDCalPID::fpartName[AliPID::kSPECIES] = {"electron", "muon", "pion", "kaon", "proton"}; + +Char_t* AliTRDCalPID::fpartSymb[AliPID::kSPECIES] = {"EL", "MU", "PI", "KA", "PR"}; + +Float_t AliTRDCalPID::fTrackMomentum[kNMom] = {0.6, 0.8, 1.0, 1.5, 2.0, 3.0, 4.0, 5.0, 6.0, 8.0, 10.0}; + +Float_t AliTRDCalPID::fTrackSegLength[kNLength] = {3.7, 3.9, 4.2, 5.0}; + + +//_________________________________________________________________________ +AliTRDCalPID::AliTRDCalPID() + :TNamed("pid", "PID for TRD") + ,fMeanChargeRatio(0) + ,fHistdEdx(0x0) + ,fHistTimeBin(0x0) +{ + // + // The Default constructor + // + + Init(); + +} + +//_________________________________________________________________________ +AliTRDCalPID::AliTRDCalPID(const Text_t *name, const Text_t *title) + :TNamed(name,title) + ,fMeanChargeRatio(0) + ,fHistdEdx(0x0) + ,fHistTimeBin(0x0) +{ + // + // The main constructor + // + + Init(); + +} + +//_____________________________________________________________________________ +AliTRDCalPID::AliTRDCalPID(const AliTRDCalPID &c) + :TNamed(c) + ,fMeanChargeRatio(c.fMeanChargeRatio) + ,fHistdEdx(0x0) + ,fHistTimeBin(0x0) +{ + // + // Copy constructor + // + + if (this != &c) ((AliTRDCalPID &) c).Copy(*this); + +} + +//_________________________________________________________________________ +AliTRDCalPID::~AliTRDCalPID() +{ + // + // Destructor + // + + CleanUp(); + +} + +//_________________________________________________________________________ +void AliTRDCalPID::CleanUp() +{ + // + // Delets all newly created objects + // + + if (fHistdEdx) { + delete fHistdEdx; + fHistdEdx = 0x0; + } + + if (fHistTimeBin) { + delete fHistTimeBin; + fHistTimeBin = 0x0; + } +} + +//_____________________________________________________________________________ +AliTRDCalPID &AliTRDCalPID::operator=(const AliTRDCalPID &c) +{ + // + // Assignment operator + // + + if (this != &c) ((AliTRDCalPID &) c).Copy(*this); + return *this; + +} + +//_____________________________________________________________________________ +void AliTRDCalPID::Copy(TObject &c) const +{ + // + // Copy function + // + + AliTRDCalPID& target = (AliTRDCalPID &) c; + + target.CleanUp(); + + target.fMeanChargeRatio = fMeanChargeRatio; + + if (fHistdEdx) { + target.fHistdEdx = (TObjArray*) fHistdEdx->Clone(); + } + if (fHistTimeBin) { + target.fHistTimeBin = (TObjArray*) fHistTimeBin->Clone(); + } + + TObject::Copy(c); + +} + +//_________________________________________________________________________ +void AliTRDCalPID::Init() +{ + // + // Initialization + // + + fHistdEdx = new TObjArray(AliPID::kSPECIES * kNMom/* * kNLength*/); + fHistdEdx->SetOwner(); + fHistTimeBin = new TObjArray(2 * kNMom); + fHistTimeBin->SetOwner(); + + // Initialization of estimator at object instantiation because late + // initialization in function GetProbability() is not working due to + // constantness of this function. + // fEstimator = new AliTRDCalPIDRefMaker(); + + // ADC Gain normalization + fMeanChargeRatio = 1.0; +} + +//_________________________________________________________________________ +Bool_t AliTRDCalPID::LoadLQReferences(Char_t *refFile) +{ + // + // Read the TRD dEdx histograms. + // + + Int_t nTimeBins = 22; + // Get number of time bins from CDB + AliTRDcalibDB *calibration = AliTRDcalibDB::Instance(); + if(!calibration){ + AliWarning(Form("No AliTRDcalibDB available. Using %d time bins.", nTimeBins)); + }else{ + if(calibration->GetRun() > -1) nTimeBins = calibration->GetNumberOfTimeBins(); + else AliWarning(Form("Run number not set. Using %d time bins.", nTimeBins)); + } + + + // Read histogram Root file + TFile *histFile = TFile::Open(refFile, "READ"); + if (!histFile || !histFile->IsOpen()) { + AliError(Form("Opening TRD histgram file %s failed", refFile)); + return kFALSE; + } + gROOT->cd(); + + // Read histograms + for (Int_t iparticle = 0; iparticle < AliPID::kSPECIES; iparticle++){ + for (Int_t imom = 0; imom < kNMom; imom++){ + TH2D* hist = (TH2D*)histFile->Get(Form("h2dEdx%s%02d", fpartSymb[iparticle], imom/*, ilength*/))->Clone(); + hist->Scale(1./hist->Integral()); + fHistdEdx->AddAt(hist, GetHistID(iparticle, imom)); + + if (iparticle != AliPID::kElectron && iparticle != AliPID::kPion) continue; + + TH1F* ht = (TH1F*)histFile->Get(Form("h1MaxTB%s%02d", fpartSymb[iparticle], imom))->Clone(); + if(ht->GetNbinsX() != nTimeBins) AliWarning(Form("The number of time bins %d defined in h1MaxTB%s%02d differs from calibration value of %d. This may lead to erroneous results.", ht->GetNbinsX(), fpartSymb[iparticle], imom, nTimeBins)); + ht->Scale(1./ht->Integral()); + fHistTimeBin->AddAt(ht, ((iparticle==AliPID::kElectron)?0:1)*kNMom + imom); + } + } + + histFile->Close(); + delete histFile; + + // Number of bins and bin size + //TH1F* hist = (TH1F*) fHistdEdx->At(GetHistID(AliPID::kPion, 1)); + //fNbins = hist->GetNbinsX(); + //fBinSize = hist->GetBinWidth(1); + + return kTRUE; + +} + +// //_________________________________________________________________________ +// Double_t AliTRDCalPID::GetMean(Int_t k, Int_t ip) const +// { +// // +// // Gets mean of de/dx dist. of e +// // +// +// AliInfo(Form("Mean for particle = %s and momentum = %.2f is:\n" +// ,fpartName[k] +// ,fTrackMomentum[ip])); +// if (k < 0 || k > AliPID::kSPECIES) { +// return 0; +// } +// +// return ((TH1F*) fHistdEdx->At(GetHistID(k,ip)))->GetMean(); +// +// } +// +// //_________________________________________________________________________ +// Double_t AliTRDCalPID::GetNormalization(Int_t k, Int_t ip) const +// { +// // +// // Gets Normalization of de/dx dist. of e +// // +// +// AliInfo(Form("Normalization for particle = %s and momentum = %.2f is:\n" +// ,fpartName[k] +// ,fTrackMomentum[ip])); +// if (k < 0 || k > AliPID::kSPECIES) { +// return 0; +// } +// +// return ((TH1F*) fHistdEdx->At(GetHistID(k,ip)))->Integral(); +// +// } + +//_________________________________________________________________________ +TH1* AliTRDCalPID::GetHistogram(Int_t k, Int_t ip/*, Int_t il*/) const +{ + // + // Returns one selected dEdx histogram + // + + if (k < 0 || k >= AliPID::kSPECIES) return 0x0; + if(ip<0 || ip>= kNMom ) return 0x0; + + AliInfo(Form("Retrive dEdx histogram for %s of %5.2f GeV/c", fpartName[k], fTrackMomentum[ip])); + + return (TH1*)fHistdEdx->At(GetHistID(k, ip)); + +} + +//_________________________________________________________________________ +TH1* AliTRDCalPID::GetHistogramT(Int_t k, Int_t ip) const +{ + // + // Returns one selected time bin max histogram + // + + if (k < 0 || k >= AliPID::kSPECIES) return 0x0; + if(ip<0 || ip>= kNMom ) return 0x0; + + AliInfo(Form("Retrive MaxTB histogram for %s of %5.2f GeV/c", fpartName[k], fTrackMomentum[ip])); + + return (TH1*)fHistTimeBin->At(((k==AliPID::kElectron)?0:1)*kNMom+ip); +} + + + +//_________________________________________________________________________ +Double_t AliTRDCalPID::GetProbability(Int_t spec, Float_t mom, Float_t *dedx, Float_t length) const +{ + // + // Core function of AliTRDCalPID class for calculating the + // likelihood for species "spec" (see AliTRDtrack::kNspecie) of a + // given momentum "mom" and a given dE/dx (slice "dedx") yield per + // layer + // + + if (spec < 0 || spec >= AliPID::kSPECIES) return 0.; + + //Double_t dedx = dedx1/fMeanChargeRatio; + + // find the interval in momentum and track segment length which applies for this data + Int_t ilength = 1; + while(ilengthfTrackSegLength[ilength]){ + ilength++; + } + Int_t imom = 1; + while(imomfTrackMomentum[imom]) imom++; + + Int_t nbinsx, nbinsy; + TAxis *ax = 0x0, *ay = 0x0; + Double_t LQ1, LQ2; + Double_t mom1 = fTrackMomentum[imom-1], mom2 = fTrackMomentum[imom]; + TH2 *hist = 0x0; + if(!(hist = (TH2D*)fHistdEdx->At(GetHistID(spec, imom-1/*, ilength*/)))){ + AliInfo(Form("Looking for spec(%d) mom(%f) Ex(%f) Ey(%f) length(%f)", spec, mom, dedx[0], dedx[1], length)); + AliError(Form("EHistogram id %d not found in DB.", GetHistID(spec, imom-1))); + return 0.; + } + ax = hist->GetXaxis(); nbinsx = ax->GetNbins(); + ay = hist->GetYaxis(); nbinsy = ay->GetNbins(); + Float_t x = dedx[0]+dedx[1], y = dedx[2]; + Bool_t kX = (x < ax->GetBinUpEdge(nbinsx)); + Bool_t kY = (y < ay->GetBinUpEdge(nbinsy)); + if(kX) + if(kY) LQ1 = hist->GetBinContent( hist->FindBin(x, y)); + //fEstimator->Estimate2D2(hist, x, y); + else LQ1 = hist->GetBinContent(ax->FindBin(x), nbinsy); + else + if(kY) LQ1 = hist->GetBinContent(nbinsx, ay->FindBin(y)); + else LQ1 = hist->GetBinContent(nbinsx, nbinsy); + + + if(!(hist = (TH2D*)fHistdEdx->At(GetHistID(spec, imom/*, ilength*/)))){ + AliInfo(Form("Looking for spec(%d) mom(%f) Ex(%f) Ey(%f) length(%f)", spec, mom, dedx[0], dedx[1], length)); + AliError(Form("EHistogram id %d not found in DB.", GetHistID(spec, imom))); + return LQ1; + } + if(kX) + if(kY) LQ2 = hist->GetBinContent( hist->FindBin(x, y)); + //fEstimator->Estimate2D2(hist, x, y); + else LQ2 = hist->GetBinContent(ax->FindBin(x), nbinsy); + else + if(kY) LQ2 = hist->GetBinContent(nbinsx, ay->FindBin(y)); + else LQ2 = hist->GetBinContent(nbinsx, nbinsy); + + + // return interpolation over momentum binning + return LQ1 + (LQ2 - LQ1)*(mom - mom1)/(mom2 - mom1); + +} + +//_________________________________________________________________________ +Double_t AliTRDCalPID::GetProbabilityT(Int_t spec, Double_t mom, Int_t timbin) const +{ + // + // Gets the Probability of having timbin at a given momentum (mom) + // and particle type (spec) (0 for e) and (2 for pi) + // from the precalculated timbin distributions + // + + if (spec < 0 || spec >= AliPID::kSPECIES) return 0.; + + Int_t iTBin = timbin+1; + + // Everything which is not an electron counts as a pion for time bin max + //if(spec != AliPID::kElectron) spec = AliPID::kPion; + + + + Int_t imom = 1; + while(imomfTrackMomentum[imom]) imom++; + + Double_t mom1 = fTrackMomentum[imom-1], mom2 = fTrackMomentum[imom]; + TH1F *hist = 0x0; + if(!(hist = (TH1F*) fHistTimeBin->At(((spec==AliPID::kElectron)?0:1)*kNMom+imom-1))){ + AliInfo(Form("Looking for spec(%d) mom(%f) timbin(%d)", spec, mom, timbin)); + AliError(Form("THistogram id %d not found in DB.", ((spec==AliPID::kElectron)?0:1)*kNMom+imom-1)); + return 0.; + } + Double_t LQ1 = hist->GetBinContent(iTBin); + + if(!(hist = (TH1F*) fHistTimeBin->At(((spec==AliPID::kElectron)?0:1)*kNMom+imom))){ + AliInfo(Form("Looking for spec(%d) mom(%f) timbin(%d)", spec, mom, timbin)); + AliError(Form("THistogram id %d not found in DB.", ((spec==AliPID::kElectron)?0:1)*kNMom+imom)); + return LQ1; + } + Double_t LQ2 = hist->GetBinContent(iTBin); + + // return interpolation over momentum binning + return LQ1 + (LQ2 - LQ1)*(mom - mom1)/(mom2 - mom1); +} + diff --git a/TRD/Cal/AliTRDCalPID.h b/TRD/Cal/AliTRDCalPID.h new file mode 100644 index 00000000000..5dfdbb0709b --- /dev/null +++ b/TRD/Cal/AliTRDCalPID.h @@ -0,0 +1,77 @@ +#ifndef ALITRDCALPID_H +#define ALITRDCALPID_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// Container for the distributions of dE/dx and the time bin of the // +// max. cluster for electrons and pions // +// // +// Authors: // +// Prashant Shukla // +// Alex Bercuci // +// // +/////////////////////////////////////////////////////////////////////////////// + +#ifndef ROOT_TNamed +#include +#endif + +class TH1; +class TObjArray; +class AliTRDCalPID : public TNamed { +public: + enum { + kNMom = 11, + kNLength = 4 + }; + + AliTRDCalPID(); + AliTRDCalPID(const Text_t *name, const Text_t *title); + AliTRDCalPID(const AliTRDCalPID& pd); + virtual ~AliTRDCalPID(); + AliTRDCalPID& operator=(const AliTRDCalPID &c); + virtual void Copy(TObject &c) const; + + Bool_t LoadLQReferences(Char_t* refFile); + Bool_t LoadNNReferences(Char_t* /*refFile*/) {return kTRUE;} + //void SetMeanChargeRatio(Double_t ratio) { fMeanChargeRatio = ratio; } + + //Double_t GetMeanChargeRatio() const { return fMeanChargeRatio; } + static Double_t GetMomentum(Int_t ip) { return (ip<0 || ip>=kNMom) ? -1. : fTrackMomentum[ip]; } + static Double_t GetLength(Int_t il) { return (il<0 || il>=kNLength) ? -1. : fTrackSegLength[il]; } + //Double_t GetMean(Int_t iType, Int_t ip) const; + //Double_t GetNormalization(Int_t iType, Int_t ip) const; + + TH1* GetHistogram(Int_t iType, Int_t ip/*, Int_t il*/) const; + TH1* GetHistogramT(Int_t iType, Int_t ip) const; + Double_t GetProbability(Int_t spec, Float_t mom, Float_t *dedx, Float_t length) const; + Double_t GetProbabilityT(Int_t spec, Double_t mom, Int_t timbin) const; + + protected: + + void Init(); + inline Int_t GetHistID(Int_t part, Int_t mom/*, Int_t length=0*/) const { return part*kNMom + mom; } + void CleanUp(); + + public: + static Char_t *fpartName[5]; //! Names of particle species + static Char_t *fpartSymb[5]; //! Symbols of particle species + + protected: + static Float_t fTrackMomentum[kNMom]; // Track momenta for which response functions are available + static Float_t fTrackSegLength[kNLength]; // Track segment lengths for which response functions are available + Double_t fMeanChargeRatio; // Ratio of mean charge from real Det. to prob. dist. + TObjArray *fHistdEdx; // Prob. of dEdx for 5 particles and for several momenta + TObjArray *fHistTimeBin; // Prob. of max time bin for 5 particles and for several momenta + + + ClassDef(AliTRDCalPID, 1) // The TRD PID response container class + +}; + +#endif + diff --git a/TRD/Cal/AliTRDCalPIDRefMaker.cxx b/TRD/Cal/AliTRDCalPIDRefMaker.cxx index 35bc773e835..a5d430c3133 100644 --- a/TRD/Cal/AliTRDCalPIDRefMaker.cxx +++ b/TRD/Cal/AliTRDCalPIDRefMaker.cxx @@ -55,7 +55,7 @@ #include "AliESDtrack.h" #include "AliTRDCalPIDRefMaker.h" -#include "AliTRDCalPIDLQ.h" +#include "AliTRDCalPID.h" #include "AliTRDcalibDB.h" #include "AliTRDgeometry.h" #include "AliTRDtrack.h" @@ -178,12 +178,12 @@ Bool_t AliTRDCalPIDRefMaker::BuildLQReferences(Char_t *File, Char_t *dir) // Print statistics header Int_t nPart[AliPID::kSPECIES], nTotPart; printf("P[GeV/c] "); - for(Int_t ispec=0; ispectrackMomentum[jmom]) jmom++; + while(jmomtrackMomentum[jmom]) jmom++; if(TMath::Abs(trackMomentum[jmom-1] - mom) < trackMomentum[jmom-1] * .2) refMom = jmom-1; else if(TMath::Abs(trackMomentum[jmom] - mom) < trackMomentum[jmom] * .2) refMom = jmom; if(refMom<0){ AliInfo(Form("Momentum at plane %d entrance not in momentum window. [@ momentum %3.1f batch %03d event %d track %d]", iPlane, trackMomentum[imom], ibatch, iEvent, iTrack)); continue; } - /*while(jlengtrackSegLength[jleng]) jleng++;*/ + /*while(jlengtrackSegLength[jleng]) jleng++;*/ // this track segment has fulfilled all requierments //nPlanePID++; @@ -517,9 +517,9 @@ Int_t AliTRDCalPIDRefMaker::CheckProdDirTree(Char_t *dir) Int_t iDir; Int_t nDir = Int_t(1.E6); - for(int imom=0; imomChangeDirectory(Form("%3.1fGeV", AliTRDCalPIDLQ::GetMomentum(imom)))){ - AliError(Form("Couldn't find data for momentum %3.1f GeV/c.", AliTRDCalPIDLQ::GetMomentum(imom))); + for(int imom=0; imomChangeDirectory(Form("%3.1fGeV", AliTRDCalPID::GetMomentum(imom)))){ + AliError(Form("Couldn't find data for momentum %3.1f GeV/c.", AliTRDCalPID::GetMomentum(imom))); return 0; } @@ -552,7 +552,7 @@ void AliTRDCalPIDRefMaker::Prepare2D() for(int ispec=0; ispecSetLineColor(color[ispec]); } } @@ -871,13 +871,13 @@ void AliTRDCalPIDRefMaker::SaveReferences(const Int_t mom, const char *fn) if(!kFOUND) fSave = TFile::Open(fn, "RECREATE"); fSave->cd(); - Float_t fmom = AliTRDCalPIDLQ::GetMomentum(mom); + Float_t fmom = AliTRDCalPID::GetMomentum(mom); // save dE/dx references TH2 *h2 = 0x0; for(int ispec=0; ispecClone(Form("h2dEdx%s%d", AliTRDCalPIDLQ::fpartSymb[ispec], mom)); - h2->SetTitle(Form("2D dEdx for particle %s @ %d", AliTRDCalPIDLQ::fpartName[ispec], mom)); + h2 = (TH2D*)fH2dEdx[ispec]->Clone(Form("h2dEdx%s%d", AliTRDCalPID::fpartSymb[ispec], mom)); + h2->SetTitle(Form("2D dEdx for particle %s @ %d", AliTRDCalPID::fpartName[ispec], mom)); h2->GetXaxis()->SetTitle("dE/dx_{TRD}^{amplif} [au]"); h2->GetYaxis()->SetTitle("dE/dx_{TRD}^{drift} [au]"); h2->GetZaxis()->SetTitle("Entries"); diff --git a/TRD/TRDbaseLinkDef.h b/TRD/TRDbaseLinkDef.h index 64f4dcc2785..c466b1246f0 100644 --- a/TRD/TRDbaseLinkDef.h +++ b/TRD/TRDbaseLinkDef.h @@ -36,7 +36,7 @@ #pragma link C++ class AliTRDCalPad+; #pragma link C++ class AliTRDCalDet+; #pragma link C++ class AliTRDCalFEE+; -#pragma link C++ class AliTRDCalPIDLQ+; +#pragma link C++ class AliTRDCalPID+; #pragma link C++ class AliTRDCalPIDRefMaker+; #pragma link C++ class AliTRDCalMonitoring+; diff --git a/TRD/libTRDbase.pkg b/TRD/libTRDbase.pkg index a60cdc33686..9eb38c52e3c 100644 --- a/TRD/libTRDbase.pkg +++ b/TRD/libTRDbase.pkg @@ -19,7 +19,7 @@ SRCS= AliTRDarrayI.cxx \ Cal/AliTRDCalPad.cxx \ Cal/AliTRDCalDet.cxx \ Cal/AliTRDCalFEE.cxx \ - Cal/AliTRDCalPIDLQ.cxx \ + Cal/AliTRDCalPID.cxx \ Cal/AliTRDCalPIDRefMaker.cxx \ Cal/AliTRDCalMonitoring.cxx \ Cal/AliTRDCalChamberStatus.cxx \ -- 2.43.0