11 #include "TEfficiency.h"
14 TChain *all =
new TChain(treename.c_str());
16 for (
int i = 0;
i < filecount; ++
i)
21 temp = name+
string(s.str())+extension;
22 all->Add(temp.c_str());
28 double signal = truthTree->GetEntries();
29 signal*=(1-.012)*(1-.002)*(1-.011);
30 int background = recoTree->GetEntries();
31 background-=(int) signal;
32 cout<<
"For "<<truthTree->GetEntries()<<
" truth conversions, I found "<<background<<
" background events"<<endl;
56 unsigned passedpTEtaQ;
57 unsigned passedCluster;
60 unsigned passedPhoton;
62 int sum_totalTracks=-1*
signal;
63 int sum_passedpTEtaQ=-1*
signal;
64 int sum_passedCluster=-1*
signal;
65 int sum_passedPair=-1*
signal;
66 int sum_passedVtx=-1*
signal;
67 int sum_passedPhoton=-1*
signal;
69 _treeBackground->SetBranchAddress(
"total", &totalTracks);
70 _treeBackground->SetBranchAddress(
"tracksPEQ", &passedpTEtaQ);
71 _treeBackground->SetBranchAddress(
"tracks_clus", &passedCluster);
72 _treeBackground->SetBranchAddress(
"pairs", &passedPair);
73 _treeBackground->SetBranchAddress(
"vtx", &passedVtx);
74 _treeBackground->SetBranchAddress(
"photon", &passedPhoton);
76 for(
unsigned i=0;
i<_treeBackground->GetEntries();
i++){
77 _treeBackground->GetEntry(
i);
78 sum_totalTracks+=totalTracks;
79 sum_passedpTEtaQ+=passedpTEtaQ;
80 sum_passedCluster+=passedCluster;
81 sum_passedPair+=passedPair;
82 sum_passedVtx+=passedVtx;
83 sum_passedPhoton+=passedPhoton;
85 cout<<
"Did RecoConversionEval with "<<sum_totalTracks<<
" total tracks\n\t";
86 cout<<1-(float)sum_passedpTEtaQ/sum_totalTracks<<
"+/-"<<sqrt((
float)sum_passedpTEtaQ)/sum_totalTracks<<
" of tracks were rejected by pTEtaQ\n\t";
87 cout<<1-(float)sum_passedCluster/sum_passedpTEtaQ<<
"+/-"<<sqrt((
float)sum_passedCluster)/sum_passedpTEtaQ<<
" of remaining tracks were rejected by cluster\n\t";
88 cout<<1-(float)sum_passedPair/sum_passedCluster<<
"+/-"<<sqrt((
float)sum_passedPair)/sum_passedCluster<<
" of pairs were rejected by pair cuts\n\t";
89 cout<<1-(float)sum_passedVtx/sum_passedPair<<
"+/-"<<sqrt((
float)sum_passedVtx)/sum_passedPair<<
" of vtx were rejected by vtx cuts\n\t";
90 cout<<1-(float)sum_passedPhoton/sum_passedVtx<<
"+/-"<<sqrt((
float)sum_passedPhoton)/sum_passedVtx<<
" of photons were rejected by photon cuts\n";
91 cout<<sum_passedPhoton<<
" background events remain with "<<signal<<
" signal events\n";
100 float _b_vtx_radius ;
101 float _b_tvtx_radius ;
102 float _b_cluster_prob ;
104 float _b_tphoton_pT ;
106 _signalCutTree->SetBranchAddress(
"track_deta", &_b_track_deta);
107 _signalCutTree->SetBranchAddress(
"track_dlayer",&_b_track_dlayer);
109 _signalCutTree->SetBranchAddress(
"track_pT", &_b_track_pT);
111 _signalCutTree->SetBranchAddress(
"vtx_radius", &_b_vtx_radius);
114 _signalCutTree->SetBranchAddress(
"cluster_prob", &_b_cluster_prob);
115 _signalCutTree->SetBranchAddress(
"photon_m", &_b_photon_m);
116 _signalCutTree->SetBranchAddress(
"photon_pT", &_b_photon_pT);
117 _signalCutTree->SetBranchAddress(
"tphoton_pT", &_b_tphoton_pT);
118 unsigned pT=0, cluster=0,
eta=0, photon=0,rsignal=0;
120 TH1F *rate_plot =
new TH1F(
"rateplot",
"",60,0,15);
123 for(
unsigned i=0;
i<_signalCutTree->GetEntries();
i++){
124 _signalCutTree->GetEntry(
i);
125 if(_b_track_pT<.6) pT++;
126 else if (_b_cluster_prob<0) cluster++;
127 else if (_b_track_deta>.0082)
eta++;
128 else if (TMath::Abs(_b_track_dlayer)<=9&&_b_vtx_radius>1.84){
129 if(_b_photon_m<.27||_b_photon_m>8.||_b_photon_pT<.039) photon++;
132 rate_plot->Fill(_b_tphoton_pT);
134 cout<<
"pT cut "<<pT<<
" events\n";
135 cout<<
"cluster cut "<<cluster<<
" events\n";
136 cout<<
"eta cut "<<
eta<<
" events\n";
137 cout<<
"photon cut "<<photon<<
" events\n";
138 rate_plot->Scale(1./6e5);
145 string treePath =
"/sphenix/user/vassalli/minBiasPythia/conversionembededminBiasanalysis";
146 string truthTreePath =
"/sphenix/user/vassalli/minBiasPythia/conversionembededminBiasTruthanalysis";
147 string embedPath =
"/sphenix/user/vassalli/RecoConversionTests/conversionembededonlineanalysis";
148 string treeExtension =
".root";
149 unsigned int nFiles=100;
150 TFile *out_file =
new TFile(
"minBiasplots.root",
"RECREATE");
151 TChain *embed_truth_ttree =
handleFile(embedPath,treeExtension,
"cutTreeSignal",nFiles);
152 TChain *embed_reco_ttree =
handleFile(embedPath,treeExtension,
"recoBackground",nFiles);
153 TChain *cut_tree =
new TChain(
"recoBackground");
154 TChain *back_tree =
new TChain(
"recoSignal");
155 TChain *truth_ttree =
new TChain(
"cutTreeSignal");
156 string filename =
"/sphenix/user/vassalli/minBiasConversion/conversionanaout.root";
157 back_tree->Add(filename.c_str());
158 cut_tree->Add(filename.c_str());
159 filename =
"/sphenix/user/vassalli/minBiasConversion/conversiontruthanaout.root";
160 truth_ttree->Add(filename.c_str());