-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmapView.C
More file actions
113 lines (99 loc) · 3.17 KB
/
mapView.C
File metadata and controls
113 lines (99 loc) · 3.17 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
void mapView(TString name = "baconTest")
{
TString fname = name + TString(".root");
TFile *fin = new TFile(fname,"READONLY");
if(!fin) {
cout << name << " not found " << endl;
return;
}
cout << " file " << fin->GetName() << " opened " << endl;
TDirectory *dir=NULL;
fin->GetObject("OpticalMap",dir);
if(!dir) {
cout << " OpticalMap dir not found " << endl;
return;
}
//dir->ls();
TTree *ltree;
TLArEvent *lev = new TLArEvent();
fin->GetObject("LTree",ltree);
ltree->SetBranchAddress("LArEvent",&lev);
ltree->GetListOfBranches()->ls();
TFile *fout = new TFile("mapView.root","RECREATE");
TH1D* hPrimR= new TH1D("PrimR","",200,0,250);
TH2D* hPrimXY= new TH2D("PrimXY","",400,-20,20,200,-250,250);
hPrimXY->SetMarkerStyle(7);
TH1D* hPrimZ= new TH1D("PrimZ","",200,-300,300);
cout << " LTree has " << ltree->GetEntries() << endl;
for(Long64_t iev=0; iev< ltree->GetEntries() ; ++ iev) {
ltree->GetEntry(iev);
hPrimR->Fill( lev->primaryVertex.Perp() );
hPrimZ->Fill( lev->primaryVertex.Z() );
hPrimXY->Fill( lev->primaryVertex.X(),lev->primaryVertex.Y() );
}
gStyle->SetOptStat(11);
TCanvas *pcan = new TCanvas("PrimVertex","PrimVertex");
pcan->SetLogz();
pcan->Divide(2,2);
pcan->cd(1); hPrimXY->Draw("contz");
pcan->cd(2); hPrimR->Draw();
pcan->cd(3); hPrimZ->Draw();
//
TH2D* PMTMapRZ[2];
TH2D* SipmMapRZ[6];
TH1D* SipmMapEDep[6];
dir->GetObject("PMTMap0RZ",PMTMapRZ[0]);
dir->ls();
for(int i=0; i<2; ++i ) {
dir->GetObject(Form("PMTMap%iRZ",i),PMTMapRZ[i]);
PMTMapRZ[i]->GetYaxis()->SetTitle(" Z (mm) ");
PMTMapRZ[i]->GetXaxis()->SetTitle(" R (mm) ");
PMTMapRZ[i]->SetMarkerStyle(7);
PMTMapRZ[i]->SetMarkerSize(.2);
cout << PMTMapRZ[i]->GetName() << " has " << PMTMapRZ[i]->GetEntries() << endl;
}
TString sipmName;
for(int i=0; i<6; ++i ) {
dir->GetObject(Form("SipmMap%iRZ",i),SipmMapRZ[i]);
sipmName.Form("SipmMap%iEDep",i);
dir->GetObject(sipmName,SipmMapEDep[i]);
SipmMapRZ[i]->GetYaxis()->SetTitle(" Z (mm) ");
SipmMapRZ[i]->GetXaxis()->SetTitle(" R (mm) ");
SipmMapRZ[i]->SetMarkerStyle(7);
SipmMapRZ[i]->SetMarkerSize(.2);
cout << SipmMapRZ[i]->GetName() << " has " << SipmMapRZ[i]->GetEntries() << endl;
if(SipmMapEDep[i]) cout << SipmMapEDep[i]->GetName() << " has " << SipmMapEDep[i]->GetEntries() << endl;
}
TString ctitle;
ctitle.Form("PmtMap%s",name.Data());
TCanvas *can = new TCanvas(ctitle,ctitle);
gStyle->SetOptLogz();
can->Divide(1,2);
for(int i=0; i<2; ++i ) {
can->cd(i+1);
PMTMapRZ[i]->Draw("contz");
}
ctitle.Form("SipmMap%s",name.Data());
TCanvas *scan = new TCanvas(ctitle,ctitle);
gStyle->SetOptLogz();
scan->Divide(2, 3);
for (int i = 0; i < 6; ++i)
{
scan->cd(i + 1);
SipmMapRZ[i]->Draw("contz");
}
scan->Print(".pdf");
ctitle.Form("SipmEDep%s",name.Data());
gStyle->SetOptLogy();
TCanvas *edcan = new TCanvas(ctitle,ctitle);
edcan->Divide(2, 3);
for (int i = 0; i < 6; ++i)
{
edcan->cd(i + 1);
SipmMapEDep[i]->GetXaxis()->SetTitle(" photon energy (eV) ");
SipmMapEDep[i]->Draw("");
}
edcan->Print(".pdf");
fout->ls();
fout->Write();
}