13 #include <TTimeStamp.h>
18 #include "RecEventFile.h"
21 #include "DetectorGeometry.h"
23 #include "DetectorGeometry.h"
24 #include "SdRecStation.h"
49 cout <<
"Error in SetRealAspectRatio: canvas is NULL";
56 const Double_t xmin = c->GetUxmin();
57 const Double_t xmax = c->GetUxmax();
58 const Double_t ymin = c->GetUymin();
59 const Double_t ymax = c->GetUymax();
62 const Double_t xlength = xmax - xmin;
63 const Double_t ylength = ymax - ymin;
64 const Double_t ratio = xlength/ylength;
67 const Int_t npx = c->GetWw();
68 const Int_t npy = c->GetWh();
71 const Double_t x1 = c->GetX1();
72 const Double_t y1 = c->GetY1();
73 const Double_t x2 = c->GetX2();
74 const Double_t y2 = c->GetY2();
77 const Double_t xlength2 = x2 - x1;
78 const Double_t ylength2 = y2 - y1;
79 const Double_t ratio2 = xlength2/ylength2;
82 const Int_t bnpx = c->GetWindowWidth();
83 const Int_t bnpy = c->GetWindowHeight();
87 c->SetCanvasSize(TMath::Nint(npy*ratio2), npy);
88 c->SetWindowSize((bnpx-npx)+TMath::Nint(npy*ratio2), bnpy);
92 c->SetCanvasSize(npx, TMath::Nint(npx/ratio2));
93 c->SetWindowSize(bnpx, (bnpy-npy)+TMath::Nint(npx/ratio2));
97 cout <<
"Error in SetRealAspectRatio: axis value " << axis <<
" is neither 1 (resize along x-axis) nor 2 (resize along y-axis).";
106 const Double_t xmin = c->GetUxmin();
107 const Double_t xmax = c->GetUxmax();
108 const Double_t ymin = c->GetUymin();
109 const Double_t ymax = c->GetUymax();
112 const Double_t xlength = xmax - xmin;
113 const Double_t ylength = ymax - ymin;
114 const Double_t ratio = xlength/ylength;
117 const Int_t npx = c->GetWw();
118 const Int_t npy = c->GetWh();
121 const Double_t x1 = c->GetX1();
122 const Double_t y1 = c->GetY1();
123 const Double_t x2 = c->GetX2();
124 const Double_t y2 = c->GetY2();
127 const Double_t xlength2 = x2 - x1;
128 const Double_t ylength2 = y2 - y1;
129 const Double_t ratio2 = xlength2/ylength2;
132 const Int_t bnpx = c->GetWindowWidth();
133 const Int_t bnpy = c->GetWindowHeight();
136 if(
abs(TMath::Nint(npy*ratio2) - npx)<2)
138 cout <<
"Resizing finished successfully." << endl;
143 cout <<
"Resizing failed." << endl;
153 vector<string> v_filename;
154 ifstream fileList (
"./filelist.txt");
156 while (fileList >> filename) {
157 v_filename.push_back(filename);
160 RecEventFile *
file =
new RecEventFile(v_filename);
161 RecEvent* theevent=
new RecEvent();
162 int nevents=file->GetNEvents();
163 cout << nevents << endl;
164 file->SetBuffers(&theevent);
165 DetectorGeometry *geo =
new DetectorGeometry();
166 file->ReadDetectorGeometry(*geo);
169 float distance_before=0;
170 int distance_stadtion_id=0;
172 double station_x[] = {-26348.3,-26493.3,-26607,-26347.7,-26478.8,-26225.9,-26361.8,-26109.3,-26485.5,-26229.1,
173 -25984.7,-26365.4,-26104.7,-26236.9,-26356.2,-26109.9,-26094.2,-25848.3,-25983.3,-25856.8,
174 -26233.4,-25989.5,-27108,-26857.8,-26605.2,-26357.5,-27491,-27223.5,-26981.8,-26737.3,-26484.5,
175 -26231.9,-27608.2,-27358.9,-27108.8,-26859.7,-28479.5,-28231.6,-27980.1,-27728.9,-27488.2,-27229.2,
176 -26980.3,-26733.5,-28357.1,-28113.1,-27850.6,-27609.5,-27356.8,-27113.6,-26853.6,-26609.5,-28464.4,
177 -28238.8,-27983.1,-27739.2,-27481.5,-27232.9,-26985.7,-26735.6,-26478.5,-26233.1,-25986.4,-25733.6,
178 -26044.2,-26603.2,-26241.8,-27548.6,-27168.3,-26797.2,-26416.9,-28481.7,-28104.3,-27737.5,-27368.3,
181 double station_y[] = {15594.1,15519.2,15456.6,15450,15381.8,15378.2,15309.3,15314.2,15230.4,15236.5,15236.1,
182 15167.3,15135.9,15093.5,15020.5,15017.8,15427.1,15157.7,15088.1,15016.8,14946.4,14945.7,
183 15886.9,15898.5,15887.8,15887.6,15669.3,15673.4,15669.7,15659.2,15677.4,15669.4,15444.9,
184 15449.4,15457,15450.6,15244.7,15240.4,15234.7,15242.5,15234.9,15241.5,15229.4,15236,15016.9,
185 15005.2,15018.3,15017.4,15018.5,15021.3,15013.7,15013,14876.1,14856,14833.2,14809.8,14806.9,
186 14799.1,14799.4,14793.5,14798.5,14798.3,14798.2,14796.2,16750.8,16424.2,16432.8,16097,16108,
187 16101.6,16100.4,15781.6,15778,15780.8,15771.9,15451.2,15452.9};
189 for(
int i=0; i<77; i++){
194 TGraph* aera2stations =
new TGraph(77, station_x, station_y);
195 TGraph* corepos_withCuts =
new TGraph();
196 TGraph* corepos_withoutCuts =
new TGraph();
197 TGraph* example_event =
new TGraph();
201 const RdEvent& theradio= theevent->GetRdEvent();
202 const RdRecShower& rshow=theradio.GetRdRecShower();
204 if (!theradio.HasRdStations())
continue ;
205 const std::vector<RdRecStation>& vecRstat=theradio.GetRdStationVector();
206 const SDEvent& sdev=theevent->GetSDEvent();
208 const SdRecShower& sshow= sdev.GetSdRecShower();
209 const TVector3& score=sshow.GetCoreSiteCS();
210 const TVector3& rcore=rshow.GetCoreSiteCS();
211 const TVector3& saxis=sshow.GetAxisSiteCS();
213 double rtheta=TMath::RadToDeg()*rshow.GetZenith();
214 double rphi=TMath::RadToDeg()*rshow.GetAzimuth();
215 double stheta=TMath::RadToDeg()*sshow.GetZenith();
216 double sphi=TMath::RadToDeg()*sshow.GetAzimuth();
218 if (stheta<60 || stheta>84)
221 if(theradio.GetRdRunNumber() == 100785 && theradio.GetRdEventId() == 137009){
222 example_event->SetPoint(1, score.X()/1000, score.Y()/1000);
227 const int minRecLevel=3;
228 const int minCandidateStations=4;
229 const int T4Trigger=2;
230 const int T5Trigger=3;
232 const float minZenithSD=60;
233 const float maxZenithSD=84;
235 if(sdev.GetRecLevel()<minRecLevel ||
236 sdev.GetNumberOfCandidates()<minCandidateStations ||
237 sdev.GetT4Trigger()<T4Trigger || sdev.GetT5Trigger()<T5Trigger ||
238 stheta>maxZenithSD || stheta<minZenithSD ||
239 log10(sshow.GetEnergy()) < 18.5){
240 corepos_withoutCuts->SetPoint(corepos_withoutCuts->GetN(),
241 score.X()/1000, score.Y()/1000);
243 corepos_withCuts->SetPoint(corepos_withCuts->GetN(),
244 score.X()/1000, score.Y()/1000);
247 if (score.Y()/1000 < 1){
248 cout <<
"far event id: Run number, event id" << endl;
249 cout << theradio.GetRdRunNumber() <<
" " << theradio.GetRdEventId() << endl;
261 TFile *f =
new TFile(
"corepositions.root",
"RECREATE");
262 corepos_withoutCuts->Write();
263 corepos_withCuts->Write();
264 aera2stations->Write();
265 example_event->Write();
268 TCanvas canvas(
"c",
"c",-1800,1800);
269 canvas.SetFixedAspectRatio();
270 canvas.SetLeftMargin(0.14);
272 canvas.SetRightMargin(0.14);
273 canvas.SetTopMargin(0.03);
274 canvas.SetBottomMargin(0.1);
292 corepos_withoutCuts->SetMarkerStyle(33);
293 corepos_withoutCuts->SetMarkerColor(38);
294 corepos_withoutCuts->SetMarkerSize(2.);
295 corepos_withoutCuts->SetTitle(
";x / km;y / km");
296 corepos_withoutCuts->GetXaxis()->SetLabelFont(42);
297 corepos_withoutCuts->GetXaxis()->SetLabelOffset(0);
298 corepos_withoutCuts->GetXaxis()->SetLabelSize(0.05);
299 corepos_withoutCuts->GetXaxis()->SetTitleSize(0.055);
300 corepos_withoutCuts->GetXaxis()->SetTitleOffset(0.75);
301 corepos_withoutCuts->GetXaxis()->SetNdivisions(505);
304 corepos_withoutCuts->GetYaxis()->SetLabelFont(42);
305 corepos_withoutCuts->GetYaxis()->SetLabelOffset(0.015);
306 corepos_withoutCuts->GetYaxis()->SetLabelSize(0.05);
307 corepos_withoutCuts->GetYaxis()->SetTitleSize(0.055);
308 corepos_withoutCuts->GetYaxis()->SetTitleOffset(1.15);
309 corepos_withoutCuts->Draw(
"AP");
311 gPad->SetTheta(90.0);
314 corepos_withCuts->SetMarkerStyle(20);
315 corepos_withCuts->SetMarkerColor(kBlack);
316 corepos_withCuts->SetMarkerSize(1.5);
317 corepos_withCuts->Draw(
"p SAMES");
319 aera2stations->SetMarkerStyle(22);
320 aera2stations->SetMarkerColor(TColor::GetColor(
"#d62728"));
321 aera2stations->SetMarkerSize(1.6);
322 aera2stations->Draw(
"p SAMES");
324 example_event->SetMarkerStyle(kFullCross);
325 example_event->SetMarkerColor(TColor::GetColor(
"#ff7f0e"));
326 example_event->SetMarkerSize(3.);
327 example_event->Draw(
"p SAMES");
331 cout <<
"min x and max y for calc. of end points SD border" << endl;
332 cout << gPad->GetUymax() <<
" " << gPad->GetUxmin() << endl;
339 TLine* line =
new TLine(-32.801, 10.624771980074598, -29.62013503, 16.10875224);
340 line->SetLineStyle(9);
341 line->SetLineColor(16);
342 line->SetLineWidth(2);
344 line =
new TLine(-29.62013503, 16.10875224, -30.37781708, 17.31638591);
345 line->SetLineStyle(9);
346 line->SetLineColor(16);
347 line->SetLineWidth(2);
350 line =
new TLine(-30.37781708, 17.31638591, -25.145403613376814, 26.338);
351 line->SetLineStyle(9);
352 line->SetLineColor(16);
353 line->SetLineWidth(2);
358 canvas.SaveAs(
"coredistribution.C");
359 canvas.SaveAs(
"coredistribution.pdf");
bool SetRealAspectRatio(TCanvas *const c, const Int_t axis=1)
Function to resize a canvas so that a 2D histogram or TGraph / TGraph2D are shown in real aspect rati...
int main(int argc, char *argv[])
double abs(const SVector< n, T > &v)