1 |
|
---|
2 | //------------------------------------------------------------------------------
|
---|
3 |
|
---|
4 | void AnalyseEvents(ExRootTreeReader *treeReader)
|
---|
5 | {
|
---|
6 | TClonesArray *branchM1 = treeReader->UseBranch("Match");
|
---|
7 | TClonesArray *branchM2 = treeReader->UseBranch("Matching.Match");
|
---|
8 |
|
---|
9 | Long64_t allEntries = treeReader->GetEntries();
|
---|
10 |
|
---|
11 | cout << "** Chain contains " << allEntries << " events" << endl;
|
---|
12 |
|
---|
13 | ExRootGenMatch *match;
|
---|
14 |
|
---|
15 | // Loop over all events
|
---|
16 | for(entry = 0; entry < allEntries; ++entry)
|
---|
17 | {
|
---|
18 | // Load selected branches with data from specified event
|
---|
19 | treeReader->ReadEntry(entry);
|
---|
20 |
|
---|
21 | nclus = -1;
|
---|
22 | if(branchM1->GetEntriesFast() > 0)
|
---|
23 | {
|
---|
24 | match = (ExRootGenMatch*) branchM1->At(0);
|
---|
25 | nclus = match->Nclus;
|
---|
26 | }
|
---|
27 |
|
---|
28 | // Analyse missing ET
|
---|
29 | if(nclus != branchM2->GetEntriesFast())
|
---|
30 | {
|
---|
31 | cout << entry << "\t" << nclus << "\t" << branchM2->GetEntriesFast() << endl;
|
---|
32 | }
|
---|
33 | }
|
---|
34 | }
|
---|
35 |
|
---|
36 | //------------------------------------------------------------------------------
|
---|
37 |
|
---|
38 | void Example()
|
---|
39 | {
|
---|
40 | TChain *chain1 = new TChain("Match");
|
---|
41 | TChain *chain2 = new TChain("Matching");
|
---|
42 | chain1->Add("../../eventtree_nclus.root");
|
---|
43 | chain2->Add("MatchingTree.root");
|
---|
44 | chain1->AddFriend(chain2, "Matching");
|
---|
45 |
|
---|
46 | ExRootTreeReader *treeReader = new ExRootTreeReader(chain1);
|
---|
47 | ExRootResult *result = new ExRootResult();
|
---|
48 |
|
---|
49 | AnalyseEvents(treeReader);
|
---|
50 |
|
---|
51 | cout << "** Exiting..." << endl;
|
---|
52 |
|
---|
53 | delete treeReader;
|
---|
54 | delete chain1;
|
---|
55 | delete chain2;
|
---|
56 | }
|
---|
57 |
|
---|
58 | //------------------------------------------------------------------------------
|
---|
59 |
|
---|