From: prino Date: Wed, 23 Feb 2011 23:19:36 +0000 (+0000) Subject: New class for ITS dE/dx samples X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=9189f38b7a567606419a87721fc23572e37541ec New class for ITS dE/dx samples --- diff --git a/ITS/AliITSdEdxSamples.cxx b/ITS/AliITSdEdxSamples.cxx new file mode 100644 index 00000000000..9254fc984a7 --- /dev/null +++ b/ITS/AliITSdEdxSamples.cxx @@ -0,0 +1,184 @@ +/************************************************************************** + * Copyright(c) 2009-2012, 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$ */ + + + +/////////////////////////////////////////////////////////////////// +// // +// Class to store information for PID with ITS // +// and truncated mean computation methods // +// Origin: F.Prino, Torino, prino@to.infn.it // +// // +/////////////////////////////////////////////////////////////////// + +#include "AliITSPidParams.h" +#include "AliITSdEdxSamples.h" +#include "AliLog.h" +#include + +ClassImp(AliITSdEdxSamples) + +//______________________________________________________________________ +AliITSdEdxSamples::AliITSdEdxSamples():TObject(), + fNSamples(0), + fP(0.), + fParticleSpecie(0) +{ + // Default constructor + + for(Int_t i=0; ifgkMaxSamples){ + AliWarning(Form("Too many dE/dx samples,only first %d will be used",fgkMaxSamples)); + fNSamples=fgkMaxSamples; + }else{ + fNSamples=nSamples; + } + for(Int_t i=0; i0) dE/dx values + if(fdEdxSamples[il]>mindedx){ + dedx[nc]= fdEdxSamples[il]; + nc++; + } + } + if(nc<1) return 0.; + + Int_t swap; // sort in ascending order + do { + swap=0; + for (Int_t i=0; ifgkMaxSamples) lastUsed=fgkMaxSamples; + for(Int_t iw=0; iw0.4 && lastUsed0.) return sumamp/sumweight; + else return 0.; + +} +//______________________________________________________________________ +Double_t AliITSdEdxSamples::GetWeightedMean(Double_t mindedx) const { + // compute generalized mean with k=-2 (used by CMS) + + Int_t nc=0; + Double_t dedx[fgkMaxSamples]; + for (Int_t il=0; il0) dE/dx values + if(fdEdxSamples[il]>mindedx){ + dedx[nc]= fdEdxSamples[il]; + nc++; + } + } + if(nc<1) return 0.; + + Double_t weiSum = 0.; + for (Int_t i=0; i0.) wMean= TMath::Power(weiSum/nc,-0.5); + return wMean; + +} +//______________________________________________________________________ +void AliITSdEdxSamples::GetConditionalProbabilities(AliITSPidParams* pars, Double_t condprob[AliPID::kSPECIES], Double_t mindedx) const { + // compute conditional probablilities + const Int_t nPart = 3; + Double_t itsProb[nPart] = {1,1,1}; // p, K, pi + + for(Int_t iS=0; iS6) iLayer=6; // all extra points are treated as SSD + if(fdEdxSamples[iS]GetLandauGausNorm(dedx,AliPID::kProton,fP,iLayer); + itsProb[0] *= layProb; + + layProb = pars->GetLandauGausNorm(dedx,AliPID::kKaon,fP,iLayer); + if (fP < 0.16) layProb=0.00001; + itsProb[1] *= layProb; + + layProb = pars->GetLandauGausNorm(dedx,AliPID::kPion,fP,iLayer); + itsProb[2] *= layProb; + } + + // Normalise probabilities + Double_t sumProb = 0; + for (Int_t iPart = 0; iPart < nPart; iPart++) { + sumProb += itsProb[iPart]; + } + sumProb += 2*itsProb[2]; // muon and electron cannot be distinguished from pions + + for (Int_t iPart = 0; iPart < nPart; iPart++) { + itsProb[iPart]/=sumProb; + } + + condprob[AliPID::kElectron] = itsProb[2]; + condprob[AliPID::kMuon] = itsProb[2]; + condprob[AliPID::kPion] = itsProb[2]; + condprob[AliPID::kKaon] = itsProb[1]; + condprob[AliPID::kProton] = itsProb[0]; + return; + +} diff --git a/ITS/AliITSdEdxSamples.h b/ITS/AliITSdEdxSamples.h new file mode 100644 index 00000000000..62c60db56ce --- /dev/null +++ b/ITS/AliITSdEdxSamples.h @@ -0,0 +1,71 @@ +#ifndef ALIITSDEDXSAMPLES_H +#define ALIITSDEDXSAMPLES_H +/* Copyright(c) 2009-2012, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +/////////////////////////////////////////////////////////////////// +// // +// Class to store information for PID with ITS // +// and truncated mean computation methods // +// Origin: F.Prino, Torino, prino@to.infn.it // +// // +/////////////////////////////////////////////////////////////////// + +#include +#include "AliPID.h" + +class AliITSPidParams; + +class AliITSdEdxSamples : public TObject { + + public: + AliITSdEdxSamples(); + AliITSdEdxSamples(Int_t nSamples, Double_t* samples, Double_t mom, Int_t specie=0); + virtual ~AliITSdEdxSamples(){}; + + void SetSamples(Int_t nSamples, Double_t* samples); + void SetSamplesAndMomenta(Int_t nSamples, Double_t* samples, Double_t* mom); + void SetMomentum(Double_t mom){ + fP=mom; + } + void SetParticleSpecieMC(Int_t specie){ + fParticleSpecie=specie; + } + + Int_t GetNumberOfSamples() const { + return fNSamples; + } + Double_t GetdEdxSample(Int_t i) const { + if(i