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(Int_t type )
|
---|
44 | {
|
---|
45 | fType = type ;
|
---|
46 | fNbPixels = 0 ;
|
---|
47 |
|
---|
48 | if (fType == 0 ) // this is MAGIC
|
---|
49 | {
|
---|
50 | fPixels = new TClonesArray ("MNphotPix", 577) ;
|
---|
51 | }
|
---|
52 | else if ( fType == 1 ) // this is CT1
|
---|
53 | {
|
---|
54 | fPixels = new TClonesArray ("MNphotPix", 127) ;
|
---|
55 | }
|
---|
56 |
|
---|
57 | fPixels->Clear() ;
|
---|
58 | }
|
---|
59 |
|
---|
60 | void MNphotEvent::Draw(Option_t* option)
|
---|
61 | {
|
---|
62 | //
|
---|
63 | //
|
---|
64 |
|
---|
65 | MCamDisplay disp(fType) ;
|
---|
66 |
|
---|
67 | for (Int_t i=0; i<fNbPixels; i++)
|
---|
68 | {
|
---|
69 | disp.SetPixelColor( ((MNphotPix *) fPixels->At(i))->GetPixId(),
|
---|
70 | ((MNphotPix *) fPixels->At(i))->GetPhotons()) ;
|
---|
71 | }
|
---|
72 | disp.Draw() ;
|
---|
73 |
|
---|
74 | }
|
---|
75 |
|
---|
76 |
|
---|
77 |
|
---|
78 | Int_t MNphotEvent::GetNbPixels()
|
---|
79 | {
|
---|
80 | return fNbPixels ;
|
---|
81 | }
|
---|
82 |
|
---|
83 | void MNphotEvent::AddPixel(Int_t id, Float_t nph, Float_t err)
|
---|
84 | {
|
---|
85 | TClonesArray &caP = *fPixels ;
|
---|
86 | new ( caP[fNbPixels++] ) MNphotPix( id, nph, err ) ;
|
---|
87 | }
|
---|
88 |
|
---|
89 | void MNphotEvent::Clear()
|
---|
90 | {
|
---|
91 | fNbPixels = 0 ;
|
---|
92 | fPixels->Clear() ;
|
---|
93 | }
|
---|
94 |
|
---|
95 | void MNphotEvent::Print()
|
---|
96 | {
|
---|
97 | cout << "MNphotEvent::Print()"
|
---|
98 | << "Number of Pixels: " << fNbPixels
|
---|
99 | << "(" << fPixels->GetEntries() << ")"
|
---|
100 | << endl ;
|
---|
101 |
|
---|
102 | for (Int_t il=0; il<fPixels->GetEntries(); il++ )
|
---|
103 | {
|
---|
104 | ((MNphotPix *) fPixels->At(il))->Print() ;
|
---|
105 | }
|
---|
106 | }
|
---|
107 |
|
---|