|
[Rivet-svn] r3125 - in trunk: include/Rivet src/Coreblackhole at projects.hepforge.org blackhole at projects.hepforge.orgSat Jun 4 15:06:10 BST 2011
Author: buckley Date: Sat Jun 4 15:06:09 2011 New Revision: 3125 Log: Ensure that histograms which are *already* converted to DataPointSets don't get stomped on by the improved _normalizeTree Modified: trunk/include/Rivet/RivetAIDA.hh trunk/src/Core/AnalysisHandler.cc Modified: trunk/include/Rivet/RivetAIDA.hh ============================================================================== --- trunk/include/Rivet/RivetAIDA.hh Sat Jun 4 00:40:36 2011 (r3124) +++ trunk/include/Rivet/RivetAIDA.hh Sat Jun 4 15:06:09 2011 (r3125) @@ -49,6 +49,7 @@ } using AIDA::IHistogram1D; + using AIDA::IHistogram2D; using AIDA::IDataPointSet; using AIDA::IDataPoint; using AIDA::IMeasurement; Modified: trunk/src/Core/AnalysisHandler.cc ============================================================================== --- trunk/src/Core/AnalysisHandler.cc Sat Jun 4 00:40:36 2011 (r3124) +++ trunk/src/Core/AnalysisHandler.cc Sat Jun 4 15:06:09 2011 (r3125) @@ -264,14 +264,14 @@ IManagedObject* hobj = tree.find(path); if (hobj) { - // Weird seg fault on SLC4 when trying to dyn cast an IProfile ptr to a IHistogram - // Fix by attempting to cast to IProfile first, only try IHistogram if it fails. - IHistogram1D* histo = 0; - IHistogram2D* histo2 = 0; - IProfile1D* prof = 0; - histo = dynamic_cast<IHistogram1D*>(hobj); - if (!histo) prof = dynamic_cast<IProfile1D*>(hobj); - if (!histo && !prof) histo2 = dynamic_cast<IHistogram2D*>(hobj); + // Try to cast to specific histogram types + const IProfile1D* prof = dynamic_cast<IProfile1D*>(hobj); + const IHistogram1D* histo = dynamic_cast<IHistogram1D*>(hobj); + const IHistogram2D* histo2 = dynamic_cast<IHistogram2D*>(hobj); + if (!(histo || histo2 || prof)) { + MSG_TRACE("Could not find the type of histo for " << path << ": it's probably already a DPS"); + continue; + } // AIDA path mangling const size_t lastslash = path.find_last_of("/"); @@ -285,18 +285,18 @@ IHistogram1D* tmphisto = dynamic_cast<IHistogram1D*>(tree.find(tmppath)); if (tmphisto) datapointsetFactory().create(path, *tmphisto); } - // If it's a profile histo: - else if (prof) { - MSG_TRACE("Converting profile histo " << path << " to DPS"); - IProfile1D* tmpprof = dynamic_cast<IProfile1D*>(tree.find(tmppath)); - if (tmpprof) datapointsetFactory().create(path, *tmpprof); - } // If it's a 2D histo: else if (histo2) { MSG_TRACE("Converting 2D histo " << path << " to DPS"); IHistogram2D* tmphisto2 = dynamic_cast<IHistogram2D*>(tree.find(tmppath)); if (tmphisto2) datapointsetFactory().create(path, *tmphisto2); } + // If it's a profile histo: + else if (prof) { + MSG_TRACE("Converting profile histo " << path << " to DPS"); + IProfile1D* tmpprof = dynamic_cast<IProfile1D*>(tree.find(tmppath)); + if (tmpprof) datapointsetFactory().create(path, *tmpprof); + } tree.rm(tmppath); }
More information about the Rivet-svn mailing list |