Fork me on GitHub

Ticket #270: counter.C

File counter.C, 665 bytes (added by Pavel Demin, 11 years ago)
Line 
1void counter(const char *inputFile)
2{
3 gSystem->Load("libDelphes");
4
5 TChain chain("Delphes");
6 chain.Add(inputFile);
7
8 ExRootTreeReader *treeReader = new ExRootTreeReader(&chain);
9 Long64_t numberOfEntries = treeReader->GetEntries();
10
11 TClonesArray *branchElectron = treeReader->UseBranch("Electron");
12 TClonesArray *branchMuon = treeReader->UseBranch("Muon");
13
14 Int_t entry;
15 Int_t counter[2] = {0, 0};
16
17 for(entry = 0; entry < numberOfEntries; ++entry)
18 {
19 treeReader->ReadEntry(entry);
20 counter[0] += branchElectron->GetEntriesFast();
21 counter[1] += branchMuon->GetEntriesFast();
22 }
23
24 cout << counter[0] << "\t" << counter[1] << endl;
25}