#include <MuonAnalysis/MomentumScaleCalibration/plugins/TreeSplitter.cc>
Public Member Functions | |
TreeSplitter (const edm::ParameterSet &) | |
~TreeSplitter () | |
Private Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
virtual void | endJob () |
Private Attributes | |
int32_t | maxEvents_ |
TString | outputFileName_ |
uint32_t | subSampleFirstEvent_ |
uint32_t | subSampleMaxEvents_ |
TString | treeFileName_ |
Description: <one line="" class="" summary>="">
Implementation: <Notes on="" implementation>="">
Definition at line 29 of file TreeSplitter.h.
TreeSplitter::TreeSplitter | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 6 of file TreeSplitter.cc.
: treeFileName_( iConfig.getParameter<std::string>("InputFileName") ), outputFileName_( iConfig.getParameter<std::string>("OutputFileName") ), maxEvents_( iConfig.getParameter<int32_t>("MaxEvents") ), subSampleFirstEvent_( iConfig.getParameter<uint32_t>("SubSampleFirstEvent") ), subSampleMaxEvents_( iConfig.getParameter<uint32_t>("SubSampleMaxEvents") ) { }
TreeSplitter::~TreeSplitter | ( | ) |
Definition at line 15 of file TreeSplitter.cc.
{ }
virtual void TreeSplitter::analyze | ( | const edm::Event & | , |
const edm::EventSetup & | |||
) | [inline, private, virtual] |
void TreeSplitter::endJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 19 of file TreeSplitter.cc.
References gather_cfg::cout, i, maxEvents_, outputFileName_, RootTreeHandler::readTree(), subSampleFirstEvent_, subSampleMaxEvents_, treeFileName_, and RootTreeHandler::writeTree().
{ std::cout << "Reading muon pairs from Root Tree in " << treeFileName_ << std::endl; RootTreeHandler rootTreeHandler; typedef std::vector<std::pair<lorentzVector,lorentzVector> > MuonPairVector; // MuonPairVector savedPair; std::vector<MuonPair> savedPair; rootTreeHandler.readTree(maxEvents_, treeFileName_, &savedPair, 0); // rootTreeHandler.readTree(maxEvents, inputRootTreeFileName_, &savedPair, &(MuScleFitUtils::genPair)); // Loop on all the pairs std::vector<MuonPair> newSavedPair; // MuonPairVector newSavedPair; unsigned int i = 0; // MuonPairVector::iterator it = savedPair.begin(); std::vector<MuonPair>::iterator it = savedPair.begin(); std::cout << "Starting loop on " << savedPair.size() << " muons" << std::endl; uint32_t lastEvent = subSampleFirstEvent_ + subSampleMaxEvents_; for( ; it != savedPair.end(); ++it, ++i ) { // Save only events in the selected range if( i >= subSampleFirstEvent_ && i < lastEvent ) { newSavedPair.push_back(*it); } } rootTreeHandler.writeTree(outputFileName_, &newSavedPair, 0); }
int32_t TreeSplitter::maxEvents_ [private] |
Definition at line 41 of file TreeSplitter.h.
Referenced by endJob().
TString TreeSplitter::outputFileName_ [private] |
Definition at line 40 of file TreeSplitter.h.
Referenced by endJob().
uint32_t TreeSplitter::subSampleFirstEvent_ [private] |
Definition at line 42 of file TreeSplitter.h.
Referenced by endJob().
uint32_t TreeSplitter::subSampleMaxEvents_ [private] |
Definition at line 43 of file TreeSplitter.h.
Referenced by endJob().
TString TreeSplitter::treeFileName_ [private] |
Definition at line 39 of file TreeSplitter.h.
Referenced by endJob().