X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ANALYSIS%2FAliESDpidCuts.cxx;h=2970b5a815b278305ed857de02c2b4be3554007e;hb=1e4ec417458b79766a8e47989ae9e9e7e45cd642;hp=c2f0c23efda4575d8b572b2c047b4ea1d131f21d;hpb=979d80f11c8ba19df203bb4167202a908984bbee;p=u%2Fmrichter%2FAliRoot.git diff --git a/ANALYSIS/AliESDpidCuts.cxx b/ANALYSIS/AliESDpidCuts.cxx index c2f0c23efda..2970b5a815b 100644 --- a/ANALYSIS/AliESDpidCuts.cxx +++ b/ANALYSIS/AliESDpidCuts.cxx @@ -51,8 +51,8 @@ AliESDpidCuts::AliESDpidCuts(const Char_t *name, const Char_t *title): // fESDpid = new AliESDpid; - memset(fCutTPCnSigma, 0, sizeof(Float_t) * 2); - memset(fCutTOFnSigma, 0, sizeof(Float_t) * 2); + memset(fCutTPCnSigma, 0, sizeof(Float_t)* AliPID::kSPECIES * 2); + memset(fCutTOFnSigma, 0, sizeof(Float_t)* AliPID::kSPECIES * 2); memset(fHclusterRatio, 0, sizeof(TH1F *) * 2); memset(fHnSigmaTPC, 0, sizeof(TH1F *) * AliPID::kSPECIES * 2); @@ -126,7 +126,7 @@ Bool_t AliESDpidCuts::IsSelected(TObject *obj){ AliError("Provided object is not AliESDtrack!"); return kFALSE; } - AliESDEvent* evt = trk->GetESDEvent(); + const AliESDEvent* evt = trk->GetESDEvent(); if(!evt){ AliError("No AliESDEvent!"); return kFALSE; @@ -160,7 +160,7 @@ void AliESDpidCuts::Copy(TObject &c) const { } memcpy(target.fCutTPCnSigma, fCutTPCnSigma, sizeof(Float_t) * AliPID::kSPECIES * 2); - memcpy(target.fCutTOFnSigma, fCutTOFnSigma, sizeof(Float_t) * AliPID::kSPECIES); + memcpy(target.fCutTOFnSigma, fCutTOFnSigma, sizeof(Float_t) * AliPID::kSPECIES * 2); AliESDpidCuts::Copy(c); } @@ -170,8 +170,8 @@ Long64_t AliESDpidCuts::Merge(TCollection *coll){ // // Merge Cut objects // - if(coll) return 0; - if(coll->IsEmpty()) return 1; + if(!coll) return 0; + if(coll->IsEmpty()) return 1; if(!HasHistograms()) return 0; TIterator *iter = coll->MakeIterator(); @@ -214,15 +214,15 @@ void AliESDpidCuts::DefineHistograms(Color_t color){ } Char_t hname[256], htitle[256]; for(Int_t imode = 0; imode < 2; imode++){ - sprintf(hname, "fHclusterRatio%s", imode ? "After" : "Before"); - sprintf(htitle, "TPC cluster Ratio %s cuts;Ratio;Entries", imode ? "after" : "before"); + snprintf(hname, 256, "fHclusterRatio%s", imode ? "After" : "Before"); + snprintf(htitle, 256, "TPC cluster Ratio %s cuts;Ratio;Entries", imode ? "after" : "before"); fHclusterRatio[imode] = new TH1F(hname, htitle, 20, 0., 1.); for(Int_t ispec = 0; ispec < AliPID::kSPECIES; ispec++){ - sprintf(hname, "fHnSigma%sTPC%s", AliPID::ParticleName(ispec), imode ? "after" : "before"); - sprintf(htitle, "TPC sigma for %s %s cuts;sigma;Entries", AliPID::ParticleName(ispec), imode ? "after" : "before"); + snprintf(hname, 256, "fHnSigma%sTPC%s", AliPID::ParticleName(ispec), imode ? "after" : "before"); + snprintf(htitle, 256, "TPC sigma for %s %s cuts;sigma;Entries", AliPID::ParticleName(ispec), imode ? "after" : "before"); fHnSigmaTPC[ispec][imode] = new TH1F(hname, htitle, 200, -10., 10.); - sprintf(hname, "fHnSigma%sTOF%s", AliPID::ParticleName(ispec), imode ? "after" : "before"); - sprintf(htitle, "TOF sigma for %s %s cuts;sigma;Entries", AliPID::ParticleName(ispec), imode ? "after" : "before"); + snprintf(hname, 256, "fHnSigma%sTOF%s", AliPID::ParticleName(ispec), imode ? "after" : "before"); + snprintf(htitle, 256, "TOF sigma for %s %s cuts;sigma;Entries", AliPID::ParticleName(ispec), imode ? "after" : "before"); fHnSigmaTOF[ispec][imode] = new TH1F(hname, htitle, 200, -10., 10.); } } @@ -239,8 +239,10 @@ Bool_t AliESDpidCuts::AcceptTrack(const AliESDtrack *track, const AliESDEvent *e kCutNsigmaTOF }; Long64_t cutRequired=0, cutFullfiled = 0; - if(fTOFsigmaCutRequired && event == 0) + if(fTOFsigmaCutRequired && event == 0) { AliError("No event pointer. Need event pointer for T0 for TOF cut"); + return (0); + } Double_t clusterRatio = track->GetTPCNclsF() ? static_cast(track->GetTPCNcls())/static_cast(track->GetTPCNclsF()) : 1.; if(fCutTPCclusterRatio > 0.){ SETBIT(cutRequired, kCutClusterRatioTPC); @@ -262,7 +264,7 @@ Bool_t AliESDpidCuts::AcceptTrack(const AliESDtrack *track, const AliESDEvent *e track->GetIntegratedTimes(times); for(Int_t ispec = 0; ispec < AliPID::kSPECIES; ispec++){ - if(hasTOFpid) nsigmaTOF[ispec] = nsigma = fESDpid->NumberOfSigmasTOF(track,(AliPID::EParticleType)ispec, event->GetT0()); + if(hasTOFpid && event) nsigmaTOF[ispec] = nsigma = fESDpid->NumberOfSigmasTOF(track,(AliPID::EParticleType)ispec, event->GetT0()); if(!(fTOFsigmaCutRequired && 1 << ispec)) continue; SETBIT(cutRequired, kCutNsigmaTOF); if(track->GetOuterParam()->P() >= fMinMomentumTOF){