-
Notifications
You must be signed in to change notification settings - Fork 0
/
NeutralsMatching.cpp
69 lines (55 loc) · 2.14 KB
/
NeutralsMatching.cpp
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
60
61
62
63
64
65
66
67
68
69
#include "TTree.h"
#include "TMath.h"
#include "TFile.h"
#include "TH1.h"
#include "TCanvas.h"
#include <utility>
#include <iostream>
#include <vector>
#include "TH2.h"
#include <string>
#include "TString.h"
#include "TGraph.h"
#include "TLegend.h"
#include "NeutralsClass.h"
#include "NeutralsClass.cpp"
int main(int argc, char **argv){
TFile* file = TFile::Open(argv[1]);
std::string outname = argv[2];
std::cout << outname << std::endl;
TTree* gentree = (TTree*)file->Get("gen_tree");
TTree* tracktree= (TTree*)file->Get("tracks_tree");
TTree* mcttree = (TTree*)file->Get("mct_tree");
TTree* candtree= (TTree*)file->Get("cand_tree");
NeutralsClass track,gen,mct,cand;
track.Init(tracktree);
gen.Init(gentree);
mct.Init(mcttree);
cand.Init(candtree);
int i, j,k;
for(i=0;i<gen.fChain->GetEntries();i++){
gen.fChain->GetEntry(i);
mct.fChain->GetEntry(i);
cand.fChain->GetEntry(i);
std::cout << "_________EVENT" << gen.event << std::endl;
for(int g =0; g<gen.pt->size();g++){
// for(j=0;j<mct.fChain->GetEntries();j++){
// mct.fChain->GetEntry(j);}
for(int p=0; p<mct.pt->size();p++){
// for(k=0;k<cand.fChain->GetEntries();k++){
// cand.fChain->GetEntry(k);}
for(int c =0; c<cand.pt->size();c++){
if(gen.event == mct.event && mct.event == cand.event){
if(gen.label->at(g) == mct.label->at(p)){
if(mct.label->at(p) == cand.label->at(c) && mct.plabel->at(p) == cand.plabel->at(c)){
std:: cout <<"cand" << c << "____ pt phi eta " << std::endl;
std::cout << "______________" << cand.pt->at(c) << " " << cand.phi->at(c) << " " << cand.eta->at(c) << std::endl;
if(mct.PId->at(p)== 4) std::cout << "sim photon____" << mct.pt->at(p) << " " << mct.phi->at(p) << " " << mct.eta->at(p) << std::endl;
if(mct.PId->at(p)== 2) std::cout << "sim electron__" << mct.pt->at(p) << " " << mct.phi->at(p) << " " << mct.eta->at(p) << std::endl;
std::cout << "gen photon____" << gen.pt->at(g) << " " << gen.phi->at(g) << " " << gen.eta->at(g) << std::endl;
}
}
}
}}
}}
}