/************************************************************************** * 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), fClusterMap(0), fP(0.), fParticleSpecie(0), fLayersForPid(0xFFFF) { // Default constructor for(Int_t i=0; ioperator=(source); fNSamples = source.fNSamples; fClusterMap = source.fClusterMap; fP = source.fP; fParticleSpecie = source.fParticleSpecie; fLayersForPid = source.fLayersForPid; for(Int_t i=0; ikMaxSamples){ AliWarning(Form("Too many dE samples,only first %d will be used",kMaxSamples)); fNSamples=kMaxSamples; }else{ fNSamples=nSamples; } for(Int_t i=0; ikMaxSamples){ AliWarning(Form("Too many dx samples,only first %d will be used",kMaxSamples)); fNSamples=kMaxSamples; }else{ fNSamples=nSamples; } for(Int_t i=0; i0) dE/dx values Double_t dedxsamp=GetdEdxSample(il); if(HasPointOnLayer(il) && UseLayerForPid(il) && dedxsamp>mindedx){ dedx[nc]= dedxsamp; nc++; } } if(nc<1) return 0.; Int_t swap; // sort in ascending order do { swap=0; for (Int_t i=0; ikMaxSamples) lastUsed=kMaxSamples; 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[kMaxSamples]; for (Int_t il=0; il0) dE/dx values Double_t dedxsamp=GetdEdxSample(il); if(HasPointOnLayer(il) && UseLayerForPid(il) && dedxsamp>mindedx){ dedx[nc]= dedxsamp; 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(const 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 Float_t dedx = GetdEdxSample(iS); if(dedxGetLandauGausNorm(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; } //______________________________________________________________________ void AliITSdEdxSamples::PrintAll() const{ // print all the infos printf("Particle %d momentum %f GeV/c, number of points %d\n", GetParticleSpecieMC(), fP, GetNumberOfEffectiveSamples()); for(Int_t iLay=0; iLay