-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathplotSplit.C
More file actions
69 lines (62 loc) · 1.7 KB
/
plotSplit.C
File metadata and controls
69 lines (62 loc) · 1.7 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
TTree *btree;
vector<TH1D *> hwave;
vector<TH1D *> hsplit;
TString tag;
TCanvas *plot1(unsigned iev=0)
{
TString tchan;
if(hwave.size()<iev) {
printf(" %u max is %lu\n", iev, hwave.size());
return NULL;
}
TString canName;
canName.Form("Split-Wave-%i",iev);
TCanvas *can1 = new TCanvas(canName,canName);
hwave[iev]->Draw();
hsplit[iev]->SetLineColor(kRed);
hsplit[iev]->SetFillColor(kRed);
hsplit[iev]->Draw("same");
return can1;
}
void plotSplit(TString fileName = TString("anaRun-run-01_12_2023-file0-500.root"))
{
tag = fileName;
gStyle->SetOptStat(1001101);
TString fullName = TString("myData/") + fileName;
TFile *fin = new TFile(fullName, "readonly");
if (!fin)
{
cout << " didnt find " << fileName << endl;
return;
}
cout << " opened " << fileName << endl;
/* get tbrun */
btree = NULL;
fin->GetObject("RunTree", btree);
if (!btree)
{
printf("TBRun not found \n");
return;
}
Long64_t ntriggers = btree->GetEntriesFast();
printf(" total triggers analyzed %llu \n", ntriggers);
/* get sum histos from file */
TDirectory *splitDir;
fin->GetObject("splitDir",splitDir);
TIter next(splitDir->GetListOfKeys());
TKey *key;
while (TKey *key = (TKey *)next())
{
TClass *cl = gROOT->GetClass(key->GetClassName());
if (!cl->InheritsFrom("TH1D"))
continue;
TH1D *h = (TH1D *)key->ReadObj();
TString hname(h->GetName());
if (hname.Contains("EvSplitWave")) {
hwave.push_back(h);
} else if (hname.Contains("EvSplitPeak")) {
hsplit.push_back(h);
}
}
cout << " number split events " << hsplit.size() << endl;
}