1 | #include "MHEvent.h"
|
---|
2 |
|
---|
3 | #include <TStyle.h>
|
---|
4 | #include <TCanvas.h>
|
---|
5 |
|
---|
6 | #include "MLog.h"
|
---|
7 | #include "MLogManip.h"
|
---|
8 |
|
---|
9 | #include "MMcEvt.hxx"
|
---|
10 |
|
---|
11 | #include "MHCamera.h"
|
---|
12 | #include "MParList.h"
|
---|
13 | #include "MTaskList.h"
|
---|
14 | #include "MPedestalCam.h"
|
---|
15 | #include "MPedestalPix.h"
|
---|
16 | #include "MParList.h"
|
---|
17 | #include "MCerPhotEvt.h"
|
---|
18 | #include "MRawEvtHeader.h"
|
---|
19 | #include "MRawRunHeader.h"
|
---|
20 |
|
---|
21 | MHEvent::~MHEvent()
|
---|
22 | {
|
---|
23 | if (fHist)
|
---|
24 | delete fHist;
|
---|
25 | }
|
---|
26 |
|
---|
27 | Bool_t MHEvent::SetupFill(const MParList *plist)
|
---|
28 | {
|
---|
29 | MTaskList *tlist = (MTaskList*)plist->FindObject("MTaskList");
|
---|
30 |
|
---|
31 | fImgCleanStd = (MImgCleanStd*)tlist->FindObject("MImgCleanStd");
|
---|
32 | fMcEvt = (MMcEvt*)plist->FindObject("MMcEvt");
|
---|
33 |
|
---|
34 | fRawEvtData = (MRawEvtData*)plist->FindObject("MRawEvtData");
|
---|
35 | if (!fRawEvtData)
|
---|
36 | *fLog << warn << "MRawEvtData not found..." << endl;
|
---|
37 |
|
---|
38 | fRawRunHeader = (MRawRunHeader*)plist->FindObject("MRawRunHeader");
|
---|
39 | if (!fRawRunHeader)
|
---|
40 | *fLog << warn << dbginf << "MRawRunHeader not found..." << endl;
|
---|
41 |
|
---|
42 | fRawEvtHeader = (MRawEvtHeader*)plist->FindObject("MRawEvtHeader");
|
---|
43 | if (!fRawEvtHeader)
|
---|
44 | *fLog << warn << dbginf << "MRawEvtHeader not found..." << endl;
|
---|
45 |
|
---|
46 | MGeomCam *cam = (MGeomCam*)plist->FindObject("MGeomCam");
|
---|
47 | if (!cam)
|
---|
48 | {
|
---|
49 | *fLog << err << GetDescriptor() << ": No MGeomCam found... aborting." << endl;
|
---|
50 | return kFALSE;
|
---|
51 | }
|
---|
52 |
|
---|
53 | if (fHist)
|
---|
54 | delete (fHist);
|
---|
55 |
|
---|
56 | fHist = new MHCamera(*cam);
|
---|
57 | fHist->AddNotify(fClone);
|
---|
58 |
|
---|
59 | switch (fType)
|
---|
60 | {
|
---|
61 | case kEvtSignal:
|
---|
62 | fHist->SetName("Signal");
|
---|
63 | fHist->SetYTitle("S [au]");
|
---|
64 | break;
|
---|
65 | case kEvtPedestal:
|
---|
66 | fHist->SetName("Pedestal");
|
---|
67 | fHist->SetYTitle("P [au]");
|
---|
68 | break;
|
---|
69 | case kEvtPedestalRMS:
|
---|
70 | fHist->SetName("Pedestal RMS");
|
---|
71 | fHist->SetYTitle("\\sigma_{P} [au]");
|
---|
72 | break;
|
---|
73 | case kEvtRelativeSignal:
|
---|
74 | fHist->SetName("Signal/PedRMS");
|
---|
75 | fHist->SetYTitle("S/P_{rms}");
|
---|
76 | break;
|
---|
77 | case kEvtCleaningLevels:
|
---|
78 | fHist->SetName("CleanLevels");
|
---|
79 | fHist->SetYTitle("L");
|
---|
80 | if (!fImgCleanStd)
|
---|
81 | return kFALSE;
|
---|
82 | break;
|
---|
83 | }
|
---|
84 |
|
---|
85 | return kTRUE;
|
---|
86 | }
|
---|
87 |
|
---|
88 | Bool_t MHEvent::Fill(const MParContainer *par, const Stat_t weight=1)
|
---|
89 | {
|
---|
90 | if (fHist->IsFreezed())
|
---|
91 | return kTRUE;
|
---|
92 |
|
---|
93 | if (!par)
|
---|
94 | return kFALSE;
|
---|
95 |
|
---|
96 | if (fRawEvtData)
|
---|
97 | fRawEvtData->Copy(fClone);
|
---|
98 |
|
---|
99 | switch (fType)
|
---|
100 | {
|
---|
101 | case kEvtSignal:
|
---|
102 | case kEvtPedestal:
|
---|
103 | fHist->SetCamContent(*(MCamEvent*)par, 0);
|
---|
104 | break;
|
---|
105 | case kEvtPedestalRMS:
|
---|
106 | fHist->SetCamContent(*(MCamEvent*)par, 0);
|
---|
107 | break;
|
---|
108 | case kEvtRelativeSignal:
|
---|
109 | case kEvtCleaningLevels:
|
---|
110 | fHist->SetCamContent(*(MCamEvent*)par, 0);
|
---|
111 | break;
|
---|
112 | }
|
---|
113 |
|
---|
114 | TString s;
|
---|
115 | if (fRawEvtHeader)
|
---|
116 | {
|
---|
117 | s += "Event #";
|
---|
118 | s += fRawEvtHeader->GetDAQEvtNumber();
|
---|
119 | }
|
---|
120 | if (fRawEvtHeader && fRawRunHeader)
|
---|
121 | s += " of ";
|
---|
122 |
|
---|
123 | if (fRawRunHeader)
|
---|
124 | {
|
---|
125 | s += "Run #";
|
---|
126 | s += fRawRunHeader->GetNumEvents();
|
---|
127 | }
|
---|
128 |
|
---|
129 | if (fMcEvt)
|
---|
130 | {
|
---|
131 | TString txt;// = "#splitline{";
|
---|
132 |
|
---|
133 | switch (fMcEvt->GetPartId())
|
---|
134 | {
|
---|
135 | case kGAMMA:
|
---|
136 | txt += "Gamma: ";
|
---|
137 | break;
|
---|
138 | case kPROTON:
|
---|
139 | txt += "Proton: ";
|
---|
140 | break;
|
---|
141 | case kHELIUM:
|
---|
142 | txt += "Helium: ";
|
---|
143 | break;
|
---|
144 | default:
|
---|
145 | s += "Particle Id#";
|
---|
146 | s += fMcEvt->GetPartId();
|
---|
147 | s += ": ";
|
---|
148 | }
|
---|
149 |
|
---|
150 | s.Insert(0, txt);
|
---|
151 |
|
---|
152 | //s += "}{";
|
---|
153 | s += " E=";
|
---|
154 | if (fMcEvt->GetEnergy()>1000)
|
---|
155 | txt += Form("%.1fTeV", fMcEvt->GetEnergy()/1000);
|
---|
156 | else
|
---|
157 | txt += Form("%dGeV", fMcEvt->GetEnergy()+.5);
|
---|
158 | s += " r=";
|
---|
159 | s += (int)(fMcEvt->GetImpact()/100+.5);
|
---|
160 | s += "m ZA=";
|
---|
161 | s += (int)(fMcEvt->GetTheta()*180/TMath::Pi()+.5);
|
---|
162 | s += "° ";
|
---|
163 | s += fMcEvt->GetPhotElfromShower();
|
---|
164 | s += "PhEl";
|
---|
165 | //s += "}";
|
---|
166 | }
|
---|
167 |
|
---|
168 | gPad=NULL;
|
---|
169 | fHist->SetTitle(s);
|
---|
170 |
|
---|
171 | return kTRUE;
|
---|
172 | }
|
---|
173 |
|
---|
174 | void MHEvent::Draw(Option_t *)
|
---|
175 | {
|
---|
176 | if (!fHist)
|
---|
177 | {
|
---|
178 | *fLog << warn << "MHEvent::Draw - fHist==NULL not initialized." << endl;
|
---|
179 | return;
|
---|
180 | }
|
---|
181 |
|
---|
182 | TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
|
---|
183 | pad->SetBorderMode(0);
|
---|
184 |
|
---|
185 | pad->Divide(1,1);
|
---|
186 |
|
---|
187 | pad->cd(1);
|
---|
188 | gPad->SetBorderMode(0);
|
---|
189 | gPad->Divide(1,1);
|
---|
190 | gPad->cd(1);
|
---|
191 | gPad->SetBorderMode(0);
|
---|
192 | fHist->Draw();
|
---|
193 | }
|
---|