|
[Rivet-svn] r3124 - in trunk: . include/LWH src/Coreblackhole at projects.hepforge.org blackhole at projects.hepforge.orgSat Jun 4 00:40:37 BST 2011
Author: buckley Date: Sat Jun 4 00:40:36 2011 New Revision: 3124 Log: Adding auto conversion of Histogram2D to DataPointSets in the AnalysisHandler _normalizeTree method. Modified: trunk/ChangeLog trunk/include/LWH/AIDataPointSetFactory.h trunk/src/Core/AnalysisHandler.cc Modified: trunk/ChangeLog ============================================================================== --- trunk/ChangeLog Thu Jun 2 23:45:53 2011 (r3123) +++ trunk/ChangeLog Sat Jun 4 00:40:36 2011 (r3124) @@ -1,3 +1,8 @@ +2011-06-04 Andy Buckley <andy at insectnation.org> + + * Adding auto conversion of Histogram2D to DataPointSets in the + AnalysisHandler _normalizeTree method. + 2011-06-03 Andy Buckley <andy at insectnation.org> * Adding a file-weight feature to the Run object, which will Modified: trunk/include/LWH/AIDataPointSetFactory.h ============================================================================== --- trunk/include/LWH/AIDataPointSetFactory.h Thu Jun 2 23:45:53 2011 (r3123) +++ trunk/include/LWH/AIDataPointSetFactory.h Sat Jun 4 00:40:36 2011 (r3124) @@ -10,6 +10,7 @@ class IDataPointSet; class IHistogram1D; +class IHistogram2D; class IProfile1D; class IDataPointSetFactory { @@ -91,6 +92,8 @@ virtual bool destroy(IDataPointSet *) = 0; virtual IDataPointSet * create(const std::string &, const IHistogram1D &, const std::string & = "") = 0; + virtual IDataPointSet * create(const std::string &, const IHistogram2D &, + const std::string & = "") = 0; virtual IDataPointSet * create(const std::string &, const IProfile1D &, const std::string & = "") = 0; Modified: trunk/src/Core/AnalysisHandler.cc ============================================================================== --- trunk/src/Core/AnalysisHandler.cc Thu Jun 2 23:45:53 2011 (r3123) +++ trunk/src/Core/AnalysisHandler.cc Sat Jun 4 00:40:36 2011 (r3124) @@ -267,37 +267,37 @@ // 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; - IProfile1D* prof = dynamic_cast<IProfile1D*>(hobj); - if (!prof) histo = dynamic_cast<IHistogram1D*>(hobj); + 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); + + // AIDA path mangling + const size_t lastslash = path.find_last_of("/"); + const string basename = path.substr(lastslash+1, path.length() - (lastslash+1)); + const string tmppath = tmpdir + "/" + basename; // If it's a normal histo: + tree.mv(path, tmpdir); if (histo) { MSG_TRACE("Converting histo " << path << " to DPS"); - tree.mv(path, tmpdir); - const size_t lastslash = path.find_last_of("/"); - const string basename = path.substr(lastslash+1, path.length() - (lastslash+1)); - const string tmppath = tmpdir + "/" + basename; IHistogram1D* tmphisto = dynamic_cast<IHistogram1D*>(tree.find(tmppath)); - if (tmphisto) { - //MSG_TRACE("Temp histo " << tmppath << " exists"); - datapointsetFactory().create(path, *tmphisto); - } - tree.rm(tmppath); + if (tmphisto) datapointsetFactory().create(path, *tmphisto); } // If it's a profile histo: else if (prof) { MSG_TRACE("Converting profile histo " << path << " to DPS"); - tree.mv(path, tmpdir); - const size_t lastslash = path.find_last_of("/"); - const string basename = path.substr(lastslash+1, path.length() - (lastslash+1)); - const string tmppath = tmpdir + "/" + basename; IProfile1D* tmpprof = dynamic_cast<IProfile1D*>(tree.find(tmppath)); - if (tmpprof) { - //MSG_TRACE("Temp profile histo " << tmppath << " exists"); - datapointsetFactory().create(path, *tmpprof); - } - tree.rm(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); + } + tree.rm(tmppath); }
More information about the Rivet-svn mailing list |