1 | #include "MNphotEvent.h"
|
---|
2 |
|
---|
3 | #include <math.h>
|
---|
4 | #include <TClonesArray.h>
|
---|
5 | #include <TCanvas.h>
|
---|
6 |
|
---|
7 | #include "MCamGeom.h"
|
---|
8 | #include "MCamDisplay.h"
|
---|
9 | #include "MHexagon.h"
|
---|
10 |
|
---|
11 | ClassImp(MNphotPix)
|
---|
12 | ClassImp(MNphotEvent)
|
---|
13 |
|
---|
14 | MNphotPix::MNphotPix(Int_t pix, Float_t phot , Float_t errphot )
|
---|
15 | {
|
---|
16 | // default constructor
|
---|
17 | fPixId = pix ;
|
---|
18 | fPhot = phot ;
|
---|
19 | fErrPhot = errphot ;
|
---|
20 | }
|
---|
21 |
|
---|
22 | void MNphotPix::SetPixelContent(Int_t pix, Float_t phot , Float_t errphot)
|
---|
23 | {
|
---|
24 | fPixId = pix ;
|
---|
25 | fPhot = phot ;
|
---|
26 | fErrPhot = errphot ;
|
---|
27 | }
|
---|
28 |
|
---|
29 | void MNphotPix::Print()
|
---|
30 | {
|
---|
31 | // information about a pixel
|
---|
32 | cout << "MNphotPix: Pixel: "<< fPixId
|
---|
33 | << " Nphot= " << fPhot
|
---|
34 | << " Error(Nphot) = " << fErrPhot
|
---|
35 | << endl ;
|
---|
36 | }
|
---|
37 |
|
---|
38 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
---|
39 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
---|
40 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
---|
41 |
|
---|
42 |
|
---|
43 | MNphotEvent::MNphotEvent(const char *name, const char *title )
|
---|
44 | {
|
---|
45 | // the default constructor
|
---|
46 |
|
---|
47 |
|
---|
48 | *fName = name ? name : "MNphotEvent";
|
---|
49 | *fTitle = name ? name : "(Number of Photon)-Event Information";
|
---|
50 |
|
---|
51 | fType = 0 ;
|
---|
52 | fNbPixels = 0 ;
|
---|
53 |
|
---|
54 | fPixels = new TClonesArray ("MNphotPix", 577) ;
|
---|
55 |
|
---|
56 | fPixels->Clear() ;
|
---|
57 | }
|
---|
58 |
|
---|
59 | void MNphotEvent::Draw(Option_t* option)
|
---|
60 | {
|
---|
61 | //
|
---|
62 | //
|
---|
63 |
|
---|
64 | MCamDisplay *disp = new MCamDisplay(fType) ;
|
---|
65 |
|
---|
66 | disp->Draw( this ) ;
|
---|
67 |
|
---|
68 | // disp->Draw() ;
|
---|
69 |
|
---|
70 | }
|
---|
71 |
|
---|
72 |
|
---|
73 |
|
---|
74 |
|
---|
75 | Int_t MNphotEvent::GetNbPixels()
|
---|
76 | {
|
---|
77 | return fNbPixels ;
|
---|
78 | }
|
---|
79 |
|
---|
80 | void MNphotEvent::AddPixel(Int_t id, Float_t nph, Float_t err)
|
---|
81 | {
|
---|
82 | TClonesArray &caP = *fPixels ;
|
---|
83 | new ( caP[fNbPixels++] ) MNphotPix( id, nph, err ) ;
|
---|
84 | }
|
---|
85 |
|
---|
86 | void MNphotEvent::Clear()
|
---|
87 | {
|
---|
88 | fNbPixels = 0 ;
|
---|
89 | fPixels->Clear() ;
|
---|
90 | }
|
---|
91 |
|
---|
92 | void MNphotEvent::Print()
|
---|
93 | {
|
---|
94 | cout << "MNphotEvent::Print()"
|
---|
95 | << "Number of Pixels: " << fNbPixels
|
---|
96 | << "(" << fPixels->GetEntries() << ")"
|
---|
97 | << endl ;
|
---|
98 |
|
---|
99 | for (Int_t il=0; il<fPixels->GetEntries(); il++ )
|
---|
100 | {
|
---|
101 | ((MNphotPix *) fPixels->At(il))->Print() ;
|
---|
102 | }
|
---|
103 | }
|
---|
104 |
|
---|
105 | Int_t MNphotEvent::GetPixelId(Int_t i )
|
---|
106 | {
|
---|
107 | return ( ( (MNphotPix *) fPixels->At(i))->GetPixId() ) ;
|
---|
108 | }
|
---|
109 |
|
---|
110 | Float_t MNphotEvent::GetPhotons(Int_t i )
|
---|
111 | {
|
---|
112 | return ( ( (MNphotPix *) fPixels->At(i))->GetPhotons() ) ;
|
---|
113 | }
|
---|
114 |
|
---|
115 | Float_t MNphotEvent::GetErrorPhot(Int_t i )
|
---|
116 | {
|
---|
117 | return ( ( (MNphotPix *) fPixels->At(i))->GetErrorPhot() ) ;
|
---|
118 | }
|
---|
119 |
|
---|
120 |
|
---|
121 | Float_t MNphotEvent::GetMinimumPhoton()
|
---|
122 | {
|
---|
123 | if ( fNbPixels <= 0 )
|
---|
124 | return -5. ;
|
---|
125 |
|
---|
126 | Float_t minWert ;
|
---|
127 | minWert = ((MNphotPix *) fPixels->At(0))->GetPhotons() ;
|
---|
128 |
|
---|
129 | Float_t testWert ;
|
---|
130 |
|
---|
131 | for ( Int_t i =0 ; i<fNbPixels ; i++ ) {
|
---|
132 | testWert = ((MNphotPix *) fPixels->At(i))->GetPhotons() ;
|
---|
133 |
|
---|
134 | if ( minWert >= testWert )
|
---|
135 | minWert = testWert ;
|
---|
136 | }
|
---|
137 |
|
---|
138 | return minWert ;
|
---|
139 | }
|
---|
140 |
|
---|
141 | Float_t MNphotEvent::GetMaximumPhoton()
|
---|
142 | {
|
---|
143 | if ( fNbPixels <= 0 )
|
---|
144 | return 50. ;
|
---|
145 |
|
---|
146 | Float_t maxWert ;
|
---|
147 | maxWert = ((MNphotPix *) fPixels->At(0))->GetPhotons() ;
|
---|
148 |
|
---|
149 | Float_t testWert ;
|
---|
150 |
|
---|
151 | for ( Int_t i =0 ; i<fNbPixels ; i++ ) {
|
---|
152 | testWert = ((MNphotPix *) fPixels->At(i))->GetPhotons() ;
|
---|
153 |
|
---|
154 | if ( maxWert <= testWert )
|
---|
155 | maxWert = testWert ;
|
---|
156 | }
|
---|
157 |
|
---|
158 | return maxWert ;
|
---|
159 | }
|
---|
160 |
|
---|