1 |
khahn |
1.1 |
#include <iostream>
|
2 |
|
|
#include <vector>
|
3 |
|
|
//#include <utility>
|
4 |
|
|
#include <algorithm>
|
5 |
|
|
using namespace std;
|
6 |
|
|
|
7 |
|
|
#include <TFile.h>
|
8 |
|
|
#include <TTree.h>
|
9 |
|
|
|
10 |
|
|
#include "InfoStruct.h"
|
11 |
|
|
#include "KinematicsStruct.h"
|
12 |
|
|
#include "Angles.h"
|
13 |
|
|
|
14 |
|
|
int main(int argc ,char ** argv) {
|
15 |
|
|
|
16 |
|
|
const char * fname = argv[1];
|
17 |
|
|
const char * ofname = argv[2];
|
18 |
|
|
|
19 |
|
|
cout << "fname: " << fname << endl;
|
20 |
|
|
|
21 |
|
|
std::vector<std::pair<unsigned,unsigned> > runevtvec;
|
22 |
|
|
|
23 |
|
|
KinematicsStruct kin;
|
24 |
|
|
InfoStruct info;
|
25 |
|
|
Angles angles;
|
26 |
|
|
|
27 |
|
|
TFile * f = new TFile(fname);
|
28 |
|
|
TTree * nt = (TTree*)(f->Get("zznt"));
|
29 |
|
|
int ent = nt->GetEntries();
|
30 |
|
|
cout << "ent: " << ent << endl;
|
31 |
|
|
nt->Print();
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
TFile * of = new TFile(ofname, "RECREATE");
|
35 |
|
|
TTree * tt = new TTree("zznt", "zznt");
|
36 |
|
|
tt->Branch("info", &info, VARLIST_INFO);
|
37 |
|
|
tt->Branch("kinematics", &kin, VARLIST_KINEMATICS);
|
38 |
|
|
tt->Branch("angles", &angles, VARLIST_ANGLES);
|
39 |
|
|
|
40 |
|
|
nt->SetBranchAddress("info", &info);
|
41 |
|
|
nt->SetBranchAddress("kinematics", &kin);
|
42 |
|
|
nt->SetBranchAddress("angles", &angles);
|
43 |
|
|
|
44 |
|
|
|
45 |
|
|
|
46 |
|
|
for( int i=0; i<ent; i++ ) {
|
47 |
|
|
nt->GetEntry(i);
|
48 |
|
|
// skip duplicates
|
49 |
|
|
std::pair<unsigned,unsigned> tmppair(info.run,info.evt);
|
50 |
|
|
if( find( runevtvec.begin(), runevtvec.end(), tmppair ) != runevtvec.end() ) {
|
51 |
|
|
continue;
|
52 |
|
|
}
|
53 |
|
|
cout << "entry: " << i << endl;
|
54 |
|
|
runevtvec.push_back(tmppair);
|
55 |
|
|
tt->Fill();
|
56 |
|
|
}
|
57 |
|
|
|
58 |
|
|
tt->Write();
|
59 |
|
|
of->Close();
|
60 |
|
|
|
61 |
|
|
}
|