1 | #include "MCollArea.h"
|
---|
2 |
|
---|
3 | #include <MLog.h>
|
---|
4 | #include <TH2.h>
|
---|
5 |
|
---|
6 | ClassImp(MCollArea)
|
---|
7 |
|
---|
8 |
|
---|
9 |
|
---|
10 | MCollArea::MCollArea(const char *name, const char *title)
|
---|
11 | {
|
---|
12 | //
|
---|
13 | // default constructor
|
---|
14 | //
|
---|
15 |
|
---|
16 | // initialize the histogram for the distribution r vs E
|
---|
17 | //
|
---|
18 | // we set the energy range from 1 Gev to 10000 GeV (in log 5 orders
|
---|
19 | // of magnitude) and for each order we take 10 subdivision --> 50 xbins
|
---|
20 | //
|
---|
21 | // we set the radius range from 0 m to 500 m with 10 m bin --> 50 ybins
|
---|
22 |
|
---|
23 |
|
---|
24 | *fName = name ? name : "MCollArea";
|
---|
25 | *fTitle = title ? title : "Data to Calculate Coll-Area";
|
---|
26 |
|
---|
27 |
|
---|
28 | fHistAll = new TH2D("collAreaAll", "all showers - Radius vs log(E) distribution",
|
---|
29 | 50, 0., 5.,
|
---|
30 | 50, 0., 500. ) ;
|
---|
31 |
|
---|
32 | fHistSel = new TH2D("collAreaSel", "selected showers - Radius vs log(E) distribution",
|
---|
33 | 50, 0., 5.,
|
---|
34 | 50, 0., 500. ) ;
|
---|
35 |
|
---|
36 | fHistColl = new TH1D("collArea", "Collection Area",
|
---|
37 | 50, 0., 5.) ;
|
---|
38 |
|
---|
39 | }
|
---|
40 |
|
---|
41 | MCollArea::~MCollArea()
|
---|
42 | {
|
---|
43 | delete fHistAll ;
|
---|
44 | delete fHistSel ;
|
---|
45 | delete fHistColl ;
|
---|
46 | }
|
---|
47 |
|
---|
48 | void MCollArea::FillAll(Float_t log10E, Float_t radius)
|
---|
49 | {
|
---|
50 | fHistAll->Fill(log10E, radius ) ;
|
---|
51 | }
|
---|
52 |
|
---|
53 | void MCollArea::FillSel(Float_t log10E, Float_t radius)
|
---|
54 | {
|
---|
55 | fHistSel->Fill(log10E, radius ) ;
|
---|
56 | }
|
---|
57 |
|
---|
58 | void MCollArea::DrawAll()
|
---|
59 | {
|
---|
60 | fHistAll->Draw() ;
|
---|
61 | }
|
---|
62 |
|
---|
63 | void MCollArea::DrawSel()
|
---|
64 | {
|
---|
65 | fHistSel->Draw() ;
|
---|
66 | }
|
---|
67 |
|
---|
68 | void MCollArea::Draw(Option_t* option)
|
---|
69 | {
|
---|
70 | fHistColl->Draw(option) ;
|
---|
71 | }
|
---|
72 |
|
---|
73 | void MCollArea::CalculateEffi()
|
---|
74 | {
|
---|
75 | // first of all calculate the efficency
|
---|
76 | // do it here by hand to get the right error of efficency
|
---|
77 |
|
---|
78 | Int_t iBinx = ( (TAxis *) fHistSel->GetXaxis())->GetNbins() ;
|
---|
79 | Int_t iBiny = ( (TAxis *) fHistSel->GetYaxis())->GetNbins() ;
|
---|
80 |
|
---|
81 | Float_t N, Nall ;
|
---|
82 | Double_t effi, error ;
|
---|
83 | for (Int_t ix=1; ix<=iBiny; ix++ )
|
---|
84 | {
|
---|
85 | for (Int_t iy=1; iy<=iBiny; iy++ )
|
---|
86 | {
|
---|
87 | effi = error = 0. ;
|
---|
88 |
|
---|
89 | N = fHistSel->GetCellContent(ix, iy) ;
|
---|
90 | Nall = fHistAll->GetCellContent(ix, iy) ;
|
---|
91 |
|
---|
92 | if ( Nall > 0 ) {
|
---|
93 | effi = N / Nall ;
|
---|
94 | error = sqrt ( Nall + Nall * N - N * N - N ) / (Nall * Nall ) ;
|
---|
95 |
|
---|
96 | cout << ix << " " << iy
|
---|
97 | << " N " << N
|
---|
98 | << " Nall " << Nall
|
---|
99 | << " effi " << effi
|
---|
100 | << " error " << error
|
---|
101 | << endl ;
|
---|
102 |
|
---|
103 | fHistSel->SetCellContent(ix, iy, effi) ;
|
---|
104 | fHistSel->SetCellError(ix, iy, error) ;
|
---|
105 | }
|
---|
106 | else
|
---|
107 | cout << ix << " " << iy << endl ;
|
---|
108 |
|
---|
109 |
|
---|
110 |
|
---|
111 |
|
---|
112 | }
|
---|
113 | }
|
---|
114 |
|
---|
115 | //
|
---|
116 | // now calculate the Collection area for different
|
---|
117 | // energies
|
---|
118 | //
|
---|
119 |
|
---|
120 |
|
---|
121 | Double_t r1, r2, eff, errEff, A, errA, collA ;
|
---|
122 |
|
---|
123 | for (Int_t ix=1; ix<=iBiny; ix++ )
|
---|
124 | {
|
---|
125 | A = errA = collA = errEff = 0. ;
|
---|
126 |
|
---|
127 | for (Int_t iy=1; iy<=iBiny; iy++ )
|
---|
128 | {
|
---|
129 | r1 = ( (TAxis *) fHistSel->GetYaxis())->GetBinLowEdge(iy) ;
|
---|
130 | r2 = ( (TAxis *) fHistSel->GetYaxis())->GetBinLowEdge(iy+1) ;
|
---|
131 | A = 3.141592654 * ( r2*r2 - r1*r1 ) ;
|
---|
132 | eff = fHistSel->GetCellContent(ix, iy) ;
|
---|
133 | errEff = fHistSel->GetCellError(ix, iy) ;
|
---|
134 | collA += eff * A ;
|
---|
135 |
|
---|
136 | errA += ( A * A ) * errEff * errEff ;
|
---|
137 | }
|
---|
138 |
|
---|
139 | errA = sqrt( errA ) ;
|
---|
140 |
|
---|
141 | cout << ix << " --> " << A
|
---|
142 | << endl ;
|
---|
143 |
|
---|
144 | fHistColl->SetBinContent(ix, collA ) ;
|
---|
145 | fHistColl->SetBinError(ix, errA ) ;
|
---|
146 |
|
---|
147 |
|
---|
148 | }
|
---|
149 | }
|
---|