36 gSystem->Load(
"libFWCoreFWLite");
45 parser.
stringValue(
"outputFile") =
"analyzeFWLiteHistograms.root";
50 unsigned int outputEvery_ = parser.
integerValue(
"outputEvery");
52 std::vector<std::string> inputFiles_ = parser.
stringVector(
"inputFiles");
57 TH1F* muonPt_ = dir.
make<TH1F>(
"muonPt",
"pt", 100, 0., 300.);
58 TH1F* muonEta_ = dir.
make<TH1F>(
"muonEta",
"eta", 100, -3., 3.);
59 TH1F* muonPhi_ = dir.
make<TH1F>(
"muonPhi",
"phi", 100, -5., 5.);
60 TH1F* mumuMass_ = dir.
make<TH1F>(
"mumuMass",
"mass", 90, 30., 120.);
64 for (
unsigned int iFile = 0; iFile < inputFiles_.size(); ++iFile) {
66 TFile* inFile = TFile::Open(inputFiles_[iFile].c_str());
80 if (maxEvents_ > 0 ? ievt + 1 > maxEvents_ :
false)
83 if (outputEvery_ != 0 ? (ievt > 0 && ievt % outputEvery_ == 0) :
false)
84 std::cout <<
" processing event: " << ievt << std::endl;
91 for (std::vector<Muon>::const_iterator mu1 = muons->begin(); mu1 != muons->end(); ++mu1) {
92 muonPt_->Fill(mu1->pt());
93 muonEta_->Fill(mu1->eta());
94 muonPhi_->Fill(mu1->phi());
95 if (mu1->pt() > 20 && fabs(mu1->eta()) < 2.1) {
96 for (std::vector<Muon>::const_iterator mu2 = muons->begin(); mu2 != muons->end(); ++mu2) {
98 if (mu1->charge() * mu2->charge() < 0) {
99 if (mu2->pt() > 20 && fabs(mu2->eta()) < 2.1) {
100 mumuMass_->Fill((mu1->p4() + mu2->p4()).
mass());
113 if (maxEvents_ > 0 ? ievt + 1 > maxEvents_ :
false)
Event const & toBegin() override
Go to the very first Event.
std::string & stringValue(std::string key)
void parseArguments(int argc, char **argv, bool allowArgs=false)
int & integerValue(std::string key)
static void enable()
enable automatic library loading
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
SVec & stringVector(std::string key)