Skip to content

Commit

Permalink
Simplify plugin construction using subdirectories
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Mendenhall committed Mar 1, 2016
1 parent 885023e commit a0cd9e2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ROOTUtils/PluginSaver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void PluginSaver::buildPlugins() {
printf("Plugin '%s' missing from input file; skipped.\n", pnm.c_str());
continue;
}
PB->second->makePlugin(this, inflname);
PB->second->makePlugin(this);
}
} else {
/// construct all plugins
Expand Down
2 changes: 1 addition & 1 deletion ROOTUtils/PluginSaver.hh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class PluginBuilder {
public:
/// instantiate plugin SegmentSaver
virtual void makePlugin(OutputManager* pnt, const string& inflName = "") = 0;
virtual void makePlugin(SegmentSaver* pnt) = 0;

SegmentSaver* thePlugin = NULL; ///< instantiated plugin (not memory managed here)
};
Expand Down
8 changes: 6 additions & 2 deletions ROOTUtils/SegmentSaver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,13 @@ OutputManager(nm,pnt), ignoreMissingHistos(false), inflname(inflName), isCalcula
dirIn = fIn->GetDirectory("");
inflAge = fileAge(inflname);
printf("Loading data from %s [%.1f hours old]...\n",inflname.c_str(),inflAge/3600.);
} else { // try sub-directory of parent if file not specified
auto PSS = dynamic_cast<SegmentSaver*>(pnt);
if(PSS && PSS->dirIn) {
dirIn = PSS->dirIn->GetDirectory(nm.c_str());
if(!dirIn) dirIn = PSS->dirIn; // fallback for backwards compatibility prior to subdirectories
}
}
auto PSS = dynamic_cast<SegmentSaver*>(pnt);
if(PSS && PSS->dirIn) dirIn = PSS->dirIn->GetDirectory(nm.c_str());
}

SegmentSaver::~SegmentSaver() {
Expand Down

0 comments on commit a0cd9e2

Please sign in to comment.