forked from zatserkl/DataFormat-v44
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReco.C
More file actions
88 lines (70 loc) · 2.78 KB
/
Reco.C
File metadata and controls
88 lines (70 loc) · 2.78 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// Andriy Zatserklyaniy, April 17, 2014
#include "Reco.h"
#include <TCanvas.h>
#include <TH2.h>
#include <TFile.h>
void plotReco(Int_t event1=0, Int_t event2=-1, TTree* tree=0)
{
Bool_t debug = kFALSE;
if (debug) cout<< "debug in on" <<endl;
if (!tree) tree = (TTree*) gDirectory->Get("r");
if (!tree) {
cout<< "Could not find tree r" <<endl;
return;
}
const RecoEvent* recoEvent = 0;
tree->SetBranchAddress("revent", &recoEvent);
TH2F* hcal[5];
// for (int i=0; i<5; ++i) hcal[i] = new TH2F(Form("hcal%d",i), Form("Cal response for channel %d",i), 200,-200,200, 50,-50,50);
for (int i=0; i<5; ++i) hcal[i] = new TH2F(Form("hcal%d",i), Form("Cal response for channel %d",i), 400,-200,200, 10,-50,50);
TH2F* hcal_i[5];
// for (int i=0; i<5; ++i) hcal_i[i] = new TH2F(Form("hcal%d_i",i), Form("Nevents for Cal response for channel %d",i), 200,-200,200, 50,-50,50);
for (int i=0; i<5; ++i) hcal_i[i] = new TH2F(Form("hcal%d_i",i), Form("Nevents for Cal response for channel %d",i), 400,-200,200, 10,-50,50);
if (event2 < event1) event2 = tree->GetEntries()-1;
for (int ientry=event1; ientry<=event2; ++ientry)
{
if (tree->LoadTree(ientry) < 0) {
cout<< "Could not load event " << ientry <<endl;
break;
}
tree->GetEntry(ientry);
if (false
|| (ientry < 10)
|| (ientry < 10000 && ientry%1000 == 0)
|| (ientry%100000 == 0)
) cout<< "---> processing entry " << ientry <<endl;
for (int itrack=0; itrack<recoEvent->track->GetLast()+1; ++itrack) {
const SuperTrack* superTrack = (const SuperTrack*) recoEvent->track->At(itrack);
if (superTrack->angle > 0.07) continue; // apply cut on the angle between the tracks in the supertrack
for (int ical=0; ical<5; ++ical) {
Float_t adc = recoEvent->a[ical];
if (adc < 100) adc = 0;
// hcal[ical]->Fill(superTrack->tcal, superTrack->vcal, adc);
// hcal_i[ical]->Fill(superTrack->tcal, superTrack->vcal);
hcal[ical]->Fill(superTrack->T(-128.), superTrack->V(-128.), adc);
hcal_i[ical]->Fill(superTrack->T(-128.), superTrack->V(-128.));
}
}
}
//new TCanvas;
//hcal[0]->DrawCopy("colz");
for (int ical=0; ical<5; ++ical) hcal[ical]->Divide(hcal_i[ical]);
new TCanvas;
hcal[0]->Draw("colz");
}
void plotReco(const char* ifname, Int_t event1=0, Int_t event2=-1)
{
Bool_t debug = kFALSE;
if (debug) cout<< "debug in on" <<endl;
TFile* ifile = new TFile(ifname);
if (!ifile) {
cout<< "Could not open file " << ifname <<endl;
return;
}
TTree* tree = (TTree*) gDirectory->Get("r");
if (!tree) {
cout<< "Could not find tree r" <<endl;
return;
}
plotReco(event1, event2, tree);
}