36 gSystem->Load(
"libFWCoreFWLite");
43 parser.integerValue(
"maxEvents") = 1000;
44 parser.integerValue(
"outputEvery") = 10;
45 parser.stringValue(
"outputFile") =
"analyzeFWLiteHistograms.root";
49 int maxEvents_ =
parser.integerValue(
"maxEvents");
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());
77 for (
ev.toBegin(); !
ev.atEnd(); ++
ev, ++ievt) {
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)
int main(int argc, char *argv[])
static void enable()
enable automatic library loading