15 #include "TStopwatch.h"
36 gSystem->Load(
"libFWCoreFWLite" );
40 std::cout <<
"Usage : " << argv[0] <<
" [parameters.py]" << std::endl;
45 std::cout <<
" ERROR: ParametersSet 'process' is missing in your configuration file" << std::endl;
exit(0);
58 TH1F* muonPt_ = theDir.
make<TH1F>(
"muonPt",
"pt", 100, 0.,300.);
59 TH1F* muonEta_ = theDir.make<TH1F>(
"muonEta",
"eta", 100, -3., 3.);
60 TH1F* muonPhi_ = theDir.make<TH1F>(
"muonPhi",
"phi", 100, -5., 5.);
63 TStopwatch timer; timer.Start();
67 unsigned int nEventsAnalyzed = 0;
68 int maxEvents_( inputHandler_.maxEvents() );
69 for(
unsigned int iFile=0; iFile<inputHandler_.files().size(); ++iFile){
71 TFile* inFile = TFile::Open(inputHandler_.files()[iFile].c_str());
85 if(maxEvents_>0 ? ievt+1>maxEvents_ :
false)
break;
87 if(inputHandler_.reportAfter()!=0 ? (ievt>0 && ievt%inputHandler_.reportAfter()==0) :
false)
88 std::cout <<
" processing event: " << ievt << std::endl;
90 if ( wSelector(
event, wSelectorReturns ) ) {
91 pat::Muon const & wMuon = wSelector.wMuon();
92 muonPt_ ->Fill( wMuon.
pt() );
93 muonEta_->Fill( wMuon.
eta() );
94 muonPhi_->Fill( wMuon.
phi() );
103 if(maxEvents_>0 ? ievt+1>maxEvents_ :
false)
break;
112 double rtime = timer.RealTime();
113 double ctime = timer.CpuTime ();
115 printf(
"Analyzed events: %d \n",nEventsAnalyzed);
116 printf(
"RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime);
117 printf(
"%4.2f events / RealTime second .\n", (
double)nEventsAnalyzed/rtime);
118 printf(
"%4.2f events / CpuTime second .\n", (
double)nEventsAnalyzed/ctime);
T getParameter(std::string const &) const
virtual double eta() const
momentum pseudorapidity
int main(int argc, char **argv)
Event const & toBegin()
Go to the very first Event.
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
boost::shared_ptr< ParameterSet > readPSetsFrom(std::string const &fileOrString)
virtual bool atEnd() const
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
virtual double pt() const
transverse momentum
T * make() const
make new ROOT object
static void enable()
enable automatic library loading
Example class of an EventSelector to apply a simple W Boson selection.
virtual double phi() const
momentum azimuthal angle
Analysis-level muon class.
std::string const & file() const
return output fuke name