Skip to content

Commit

Permalink
making cutflow and metadata output stream names configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
lawrenceleejr committed Mar 7, 2016
1 parent ff0bd18 commit 7e4d2b6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
18 changes: 12 additions & 6 deletions Root/BasicEventSelection.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ BasicEventSelection :: BasicEventSelection (std::string className) :
// Metadata
m_useMetaData = true;

// Output Stream Names
m_metaDataStreamName = "metadata";
m_cutFlowStreamName = "cutflow";

// Check for duplicated events in Data and MC
m_checkDuplicatesData = false;
m_checkDuplicatesMC = false;
Expand Down Expand Up @@ -124,10 +128,12 @@ EL::StatusCode BasicEventSelection :: setupJob (EL::Job& job)
// let's initialize the algorithm to use the xAODRootAccess package
xAOD::Init("BasicEventSelection").ignore(); // call before opening first file

EL::OutputStream outForCFlow("cutflow");
job.outputAdd ( outForCFlow );
EL::OutputStream outForMetadata("metadata");
job.outputAdd ( outForMetadata );

EL::OutputStream outForCFlow(m_cutFlowStreamName);
if(!job.outputHas(m_cutFlowStreamName) ){job.outputAdd ( outForCFlow );}

EL::OutputStream outForMetadata(m_metaDataStreamName);
if(!job.outputHas(m_metaDataStreamName) ){job.outputAdd ( outForMetadata );}

return EL::StatusCode::SUCCESS;
}
Expand All @@ -145,7 +151,7 @@ EL::StatusCode BasicEventSelection :: histInitialize ()
RETURN_CHECK("xAH::Algorithm::algInitialize()", xAH::Algorithm::algInitialize(), "");

// write the metadata hist to this file so algos downstream can pick up the pointer
TFile *fileMD = wk()->getOutputFile ("metadata");
TFile *fileMD = wk()->getOutputFile (m_metaDataStreamName);
fileMD->cd();

// event counts from meta data
Expand Down Expand Up @@ -350,7 +356,7 @@ EL::StatusCode BasicEventSelection :: initialize ()

// write the cutflows to this file so algos downstream can pick up the pointer
//
TFile *fileCF = wk()->getOutputFile ("cutflow");
TFile *fileCF = wk()->getOutputFile (m_cutFlowStreamName);
fileCF->cd();

// Note: the following code is needed for anyone developing/running in ROOT 6.04.10+
Expand Down
4 changes: 4 additions & 0 deletions xAODAnaHelpers/BasicEventSelection.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ class BasicEventSelection : public xAH::Algorithm
std::string m_derivationName;
bool m_useMetaData;

// Output Stream Names
std::string m_metaDataStreamName;
std::string m_cutFlowStreamName;

/* Check for duplicated events in Data and MC */
bool m_checkDuplicatesData;
bool m_checkDuplicatesMC;
Expand Down

0 comments on commit 7e4d2b6

Please sign in to comment.