15 #include "TStopwatch.h"
34 gSystem->Load(
"libFWCoreFWLite");
38 std::cout <<
"Usage : " << argv[0] <<
" [parameters.py]" << std::endl;
43 std::cout <<
" ERROR: ParametersSet 'process' is missing in your configuration file" << std::endl;
59 TH1F* muonPt_ = theDir.
make<TH1F>(
"muonPt",
"pt", 100, 0., 300.);
60 TH1F* muonEta_ = theDir.make<TH1F>(
"muonEta",
"eta", 100, -3., 3.);
61 TH1F* muonPhi_ = theDir.make<TH1F>(
"muonPhi",
"phi", 100, -5., 5.);
69 unsigned int nEventsAnalyzed = 0;
70 int maxEvents_(inputHandler_.maxEvents());
71 for (
unsigned int iFile = 0; iFile < inputHandler_.files().size(); ++iFile) {
73 TFile* inFile = TFile::Open(inputHandler_.files()[iFile].c_str());
87 if (maxEvents_ > 0 ? ievt + 1 > maxEvents_ :
false)
90 if (inputHandler_.reportAfter() != 0 ? (ievt > 0 && ievt % inputHandler_.reportAfter() == 0) :
false)
91 std::cout <<
" processing event: " << ievt << std::endl;
93 if (wSelector(
event, wSelectorReturns)) {
94 pat::Muon const& wMuon = wSelector.wMuon();
95 muonPt_->Fill(wMuon.
pt());
96 muonEta_->Fill(wMuon.
eta());
97 muonPhi_->Fill(wMuon.
phi());
106 if (maxEvents_ > 0 ? ievt + 1 > maxEvents_ :
false)
116 double rtime = timer.RealTime();
117 double ctime = timer.CpuTime();
119 printf(
"Analyzed events: %d \n", nEventsAnalyzed);
120 printf(
"RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime);
121 printf(
"%4.2f events / RealTime second .\n", (
double)nEventsAnalyzed / rtime);
122 printf(
"%4.2f events / CpuTime second .\n", (
double)nEventsAnalyzed / ctime);
Event const & toBegin() override
Go to the very first Event.
double pt() const final
transverse momentum
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
static void enable()
enable automatic library loading
std::unique_ptr< edm::ParameterSet > readPSetsFrom(std::string const &fileOrString)
T * make(const Args &...args) const
make new ROOT object
bool atEnd() const override
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
T getParameter(std::string const &) const
double phi() const final
momentum azimuthal angle
Example class of an EventSelector to apply a simple W Boson selection.
Analysis-level muon class.
std::string const & file() const
return output fuke name
double eta() const final
momentum pseudorapidity