20 <<
"Wrong number of arguments! Please specify:" << std::endl
21 <<
" * filepath" << std::endl
22 <<
" * process name" << std::endl;
28 gSystem->Load(
"libFWCoreFWLite");
35 TH1I* noElecs =
new TH1I(
"noElecs",
"N_{Elecs}", 10, 0, 10);
36 TH1F* ptElecs =
new TH1F(
"ptElecs",
"pt_{Elecs}", 100, 0., 300.);
37 TH1F* enElecs =
new TH1F(
"enElecs",
"energy_{Elecs}", 100, 0., 300.);
38 TH1F* etaElecs =
new TH1F(
"etaElecs",
"eta_{Elecs}", 100, -3., 3.);
39 TH1F* phiElecs =
new TH1F(
"phiElecs",
"phi_{Elecs}", 100, -5., 5.);
44 TFile* inFile = TFile::Open(
argv[1]);
45 TTree* events_ =
nullptr;
47 inFile->GetObject(
"Events", events_);
48 if (events_ ==
nullptr) {
51 <<
"Unable to retrieve TTree Events!" << std::endl
52 <<
" Eighter wrong file name or the the tree doesn't exists" << std::endl;
59 sprintf(elecName,
"patElectrons_selectedPatElectrons__%s.obj",
argv[2]);
60 TBranch* elecs_ = events_->GetBranch(elecName);
64 std::vector<pat::Electron>
elecs;
65 int nevt = events_->GetEntries();
68 std::cout <<
"start looping " <<
nevt <<
" events..." << std::endl;
70 for (
int evt = 0; evt <
nevt; ++evt) {
72 elecs_->SetAddress(&
elecs);
74 elecs_->GetEntry(evt);
75 events_->GetEntry(evt, 0);
78 if (evt > 0 && !(evt % 10))
79 std::cout <<
" processing event: " << evt << std::endl;
83 noElecs->Fill(
elecs.size());
98 TFile
outFile(
"analyzeElecs.root",
"recreate");