-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.cc
More file actions
59 lines (49 loc) · 1.94 KB
/
example.cc
File metadata and controls
59 lines (49 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*******************************************************************************
*
* Filename : example.cc
* Description : Simple example for reading contents of bprime Kit ntuple
* Author : Yi-Mu "Enoch" Chen [ ensc@hep1.phys.ntu.edu.tw ]
*
*******************************************************************************/
#include <iostream>
#include <string.h>
#include "TTree.h"
#include "TChain.h"
// Files that must be manually added!
#include "format.h"
#include "checkEvtTool.h"
using namespace std;
void example()
{
bool debug = true;
checkEvtTool checkEvt; //or checkEvtTool checkEvt( debug );
// Supports multiple File input
checkEvt.addJson( "Cert_254833_13TeV_PromptReco_Collisions15_JSON.txt" );
checkEvt.addJson( "Cert_246908-254879_13TeV_PromptReco_Collisions15_JSON.txt" );
checkEvt.makeJsonMap();
TChain* root = new TChain( "bprimeKit/root" );
root->Add( "bprimeKit_ntuples.root" );
EvtInfoBranches EvtInfo ;
EvtInfo.Register( root );
JetInfoBranches jetInfo ;
jetInfo.Register( root, "JetInfo" );
JetInfoBranches wjetInfo;
wjetInfo.Register( root, "AK8BosonJetInfo" );
for( int entry = 0; entry < root->GetEntries() ; ++entry ) { //Loop over all events
root->GetEntry( entry );
// Golden JSON File check!
if( !checkEvt.isGoodEvt( EvtInfo.RunNo, EvtInfo.LumiNo ) ) {
continue;
}
for( int i = 0 ; i < jetInfo.Size ; i++ ) { // Loop over all jets in "JetInfo" collection
cout << jetInfo.Pt[i] << endl;
}
for( int i = 0 ; i < wjetInfo.Size; ++i ) { // Loop over all jets in "AK8BosonJetInfo" collections
for( int j = 0 ; j < wjetInfo.NSubjets[i] ; ++j ) { // Loop over all subjets for jet i
auto SubjetMass = *( wjetInfo.SubjetMass );
cout << SubjetMass[ wjetInfo.SubjetsIdxStart[i] + j ] << endl ;
}
}
}
checkEvt.saveJson( "Cert_246908-254833-254879_13TeV_PromptReco_Collisions15_JSON.txt" );
}