From 8820ee3c73f2e4fa1a36c996b0ca811648c47f89 Mon Sep 17 00:00:00 2001 From: mfloris Date: Mon, 7 Apr 2014 12:16:42 +0200 Subject: [PATCH] Fixed bug in AliParticleYield constructors The PDG database was updated after searching for some particles which may not originally be present. There was no protection for non-existing particles in TDatabasePDG. Both isses have been fixed. --- PWGLF/ThermalFits/AliParticleYield.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/PWGLF/ThermalFits/AliParticleYield.cxx b/PWGLF/ThermalFits/AliParticleYield.cxx index a86344a83d4..fa50beb63c5 100644 --- a/PWGLF/ThermalFits/AliParticleYield.cxx +++ b/PWGLF/ThermalFits/AliParticleYield.cxx @@ -12,6 +12,7 @@ #include "TTree.h" #include "TDirectory.h" #include "TEventList.h" +#include "TCut.h" using std::endl; using std::left; @@ -73,8 +74,10 @@ fTag(tag) { // Constructor - fPartName = TDatabasePDG::Instance()->GetParticle(fPdgCode)->GetName(); AliPDG::AddParticlesToPdgDataBase(); // Make sure that ALICE-defined particles were added to the PDG DB + TParticlePDG * part = TDatabasePDG::Instance()->GetParticle(fPdgCode); + if(!part) AliError(Form("No particle with PDG code %d in the database", fPdgCode)); + else fPartName = part->GetName(); } AliParticleYield::AliParticleYield(Int_t pdg, Int_t system, Float_t sqrts, Float_t value, Float_t stat, Float_t syst, Float_t normPos, Float_t normNeg, Float_t ymin, Float_t ymax, Int_t status, Int_t type, TString centr, Int_t isSum, TString tag): @@ -99,8 +102,10 @@ fTag(tag) { // Constructor - fPartName = TDatabasePDG::Instance()->GetParticle(fPdgCode)->GetName(); AliPDG::AddParticlesToPdgDataBase(); // Make sure that ALICE-defined particles were added to the PDG DB + TParticlePDG * part = TDatabasePDG::Instance()->GetParticle(fPdgCode); + if(!part) AliError(Form("No particle with PDG code %d in the database", fPdgCode)); + else fPartName = part->GetName(); } -- 2.43.0