BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
TestVSPConfig_Visual.C
Go to the documentation of this file.
1/*
2 * Macro:
3 * Visual test of your VSP configuration, including:
4 * - view of selected station
5 * - views of each layer in the selected station
6 * - positions, rotations, dead zones, strip numbering order, strip angle inclination,
7 * strip borders, etc...
8 *
9 * Press <SHIFT>+<LEFT_MOUSE_BUTTON> to add and draw points in the station
10 * Press <C> to clear the area of the station
11 *
12 * Author: D. Baranov
13 * Created: 16.07.2024
14 */
15
16#include "Rtypes.h"
17
18R__ADD_INCLUDE_PATH($VMCWORKDIR)
19
20#include <fstream>
21#include <vector>
22
23using namespace TMath;
24using namespace std;
25
26class BmnVSPStation;
27
29
32
33vector<TMarker*> g_points_marker;
34
35// Enable the ability to add points by pressing keyboard and mouse buttons
37
38// Enable drawing points on the canvas of separate layers
40
41// Print information about added points and reconstructed hits
43
44void DrawCreatedStationFront(BmnVSPStation* station, vector<TLorentzVector>& points);
45void RecognizeModuleNumFromPointAndDrawIt(TCanvas* station_front_canv);
46void DrawCreatedStationTop(BmnVSPStation* station, vector<TLorentzVector>& points);
47//------------------------------------------------------------------------------
48
50{
51
52 // Enable transparency OpenGL via gStyle
53 // gStyle->SetCanvasPreferGL(1);
54
55 // Select the current configuration
56 TString gPathDetectorConfig = gSystem->Getenv("VMCWORKDIR");
57 gPathDetectorConfig += "/parameters/vsp/XMLConfigs/";
58
59 gPathDetectorConfig += "VSP_Run9.xml";
60
61 BmnVSPStationSet* StationSet = new BmnVSPStationSet(gPathDetectorConfig);
62
63 // Select the current station to be shown
64 Int_t currentStationNumber = 0;
65
66 // Define a set of test points if required
67 vector<TLorentzVector> test_points;
68 // TLorentzVector test_point;
69 // test_point.SetXYZT(0, 0, 0, 0);
70 // test_points.push_back(test_point);
71
72 Int_t station_num = -1;
73 Int_t module_num = -1;
74
75 if ((currentStationNumber >= 0) && (currentStationNumber < StationSet->GetNStations())) {
76 station_num = currentStationNumber;
77 }
78
79 if (station_num != -1) {
80 BmnVSPStation* station = StationSet->GetVSPStation(station_num);
81
82 DrawCreatedStationFront(station, test_points);
83 DrawCreatedStationTop(station, test_points);
84 } else {
85 cout << "Current station number is incorrect!!!\n";
86 }
87
88 // delete StationSet;
89
90 cout << "It's the end" << "\n";
91 // gApplication->Terminate();
92}
93
94void DrawCreatedStationFront(BmnVSPStation* station, vector<TLorentzVector>& points)
95{
96
97 TString description_text = "";
98 description_text += "FRONT: station ";
99 description_text += station->GetStationNumber();
100 description_text += ", xpos = ";
101 description_text += station->GetXPosition();
102 description_text += ", ypos = ";
103 description_text += station->GetYPosition();
104 description_text += ", zpos = ";
105 description_text += station->GetZPosition();
106 TCanvas* station_front_canv = new TCanvas("station_front_canv", description_text, 10, 10, 1000, 1000);
107 station_front_canv->SetGrid();
108
110 Double_t XSize = station->GetXSize();
111 Double_t YSize = station->GetYSize();
112 Double_t ZSize = station->GetZSize();
119 Double_t XPosition = station->GetXPosition();
120 Double_t YPosition = station->GetYPosition();
121 Double_t ZPosition = station->GetZPosition();
122 Int_t NModules = station->GetNModules();
123
124 Double_t* XShiftsOfModules = new Double_t[NModules];
125 Double_t* YShiftsOfModules = new Double_t[NModules];
126 Double_t* ZShiftsOfModules = new Double_t[NModules];
127 Double_t maxXShift = 0.0;
128 Double_t maxYShift = 0.0;
129 Double_t maxZShift = 0.0;
130 for (Int_t iModule = 0; iModule < NModules; ++iModule) {
131 XShiftsOfModules[iModule] = station->GetXShiftOfModule(iModule);
132 YShiftsOfModules[iModule] = station->GetYShiftOfModule(iModule);
133 ZShiftsOfModules[iModule] = station->GetZShiftOfModule(iModule);
134
135 if (fabs(XShiftsOfModules[iModule]) > maxXShift)
136 maxXShift = fabs(XShiftsOfModules[iModule]);
137 if (fabs(YShiftsOfModules[iModule]) > maxYShift)
138 maxYShift = fabs(YShiftsOfModules[iModule]);
139 if (fabs(ZShiftsOfModules[iModule]) > maxZShift)
140 maxZShift = fabs(ZShiftsOfModules[iModule]);
141 }
142
143 if (1) {
144 cout << "StationNumber = " << StationNumber << "\n";
145 cout << " XSize = " << XSize << "\n";
146 cout << " YSize = " << YSize << "\n";
147 cout << " ZSize = " << ZSize << "\n";
148 cout << "\n";
149 cout << " XMinStation = " << XMinStation << "\n";
150 cout << " XMaxStation = " << XMaxStation << "\n";
151 cout << " YMinStation = " << YMinStation << "\n";
152 cout << " YMaxStation = " << YMaxStation << "\n";
153 cout << " ZMinStation = " << ZMinStation << "\n";
154 cout << " ZMaxStation = " << ZMaxStation << "\n";
155 cout << "\n";
156 cout << " XPosition = " << XPosition << "\n";
157 cout << " YPosition = " << YPosition << "\n";
158 cout << " ZPosition = " << ZPosition << "\n";
159 cout << "\n";
160 cout << " NModules = " << NModules << "\n";
161 for (Int_t iModule = 0; iModule < NModules; ++iModule) {
162 cout << " XShiftsOfModules[" << iModule << "] = " << XShiftsOfModules[iModule] << "\n";
163 cout << " YShiftsOfModules[" << iModule << "] = " << YShiftsOfModules[iModule] << "\n";
164 cout << " ZShiftsOfModules[" << iModule << "] = " << ZShiftsOfModules[iModule] << "\n";
165
166 BmnVSPModule* module = station->GetModule(iModule);
167
168 Double_t XModuleSize = module->GetXSize();
169 Double_t YModuleSize = module->GetYSize();
170 Double_t XMinModule = module->GetXMinModule();
171 Double_t XMaxModule = module->GetXMaxModule();
172 Double_t YMinModule = module->GetYMinModule();
173 Double_t YMaxModule = module->GetYMaxModule();
174
175 cout << " XModuleSize = " << XModuleSize << "\n";
176 cout << " YModuleSize = " << YModuleSize << "\n";
177 cout << " XMinModule = " << XMinModule << "\n";
178 cout << " XMaxModule = " << XMaxModule << "\n";
179 cout << " YMinModule = " << YMinModule << "\n";
180 cout << " YMaxModule = " << YMaxModule << "\n";
181 cout << "\n";
182
183 Int_t NLayers = module->GetNStripLayers();
184 for (Int_t iLayer = 0; iLayer < NLayers; ++iLayer) {
185 BmnVSPLayer layer = module->GetStripLayer(iLayer);
186
187 Double_t stripAngleDeg = layer.GetAngleDeg();
188 Double_t pitch = layer.GetPitch();
189 Double_t XLayerSize = layer.GetXSize();
190 Double_t YLayerSize = layer.GetYSize();
191 Double_t XMinLayer = layer.GetXMinLayer();
192 Double_t XMaxLayer = layer.GetXMaxLayer();
193 Double_t YMinLayer = layer.GetYMinLayer();
194 Double_t YMaxLayer = layer.GetYMaxLayer();
195 StripLayerType layerType = layer.GetType();
196 Double_t xLeftBorderLayer = layer.GetXLeftStripBorderPoint();
197 Double_t xRightBorderLayer = layer.GetXRightStripBorderPoint();
198 Double_t yLeftBorderLayer = layer.GetYLeftStripBorderPoint();
199 Double_t yRightBorderLayer = layer.GetYRightStripBorderPoint();
200 StripNumberingDirection stripDirection = layer.GetStripNumberingOrder();
201
202 cout << " Layer[" << iLayer << "]:\n";
203 cout << " stripAngleDeg = " << stripAngleDeg << "\n";
204 cout << " pitch = " << pitch << "\n";
205 cout << "\n";
206 cout << " XLayerSize = " << XLayerSize << "\n";
207 cout << " YLayerSize = " << YLayerSize << "\n";
208 cout << "\n";
209 cout << " XMinLayer = " << XMinLayer << "\n";
210 cout << " XMaxLayer = " << XMaxLayer << "\n";
211 cout << " YMinLayer = " << YMinLayer << "\n";
212 cout << " YMaxLayer = " << YMaxLayer << "\n";
213 cout << "\n";
214 if (layerType == StripLayerType::LowerStripLayer) {
215 cout << " layerType = " << "lower" << "\n";
216 }
217 if (layerType == StripLayerType::UpperStripLayer) {
218 cout << " layerType = " << "upper" << "\n";
219 }
220 cout << "\n";
221 cout << " xLeftBorderLayer = " << xLeftBorderLayer << "\n";
222 cout << " xRightBorderLayer = " << xRightBorderLayer << "\n";
223 cout << " yLeftBorderLayer = " << yLeftBorderLayer << "\n";
224 cout << " yRightBorderLayer = " << yRightBorderLayer << "\n";
225 if (stripDirection == StripNumberingDirection::LeftToRight) {
226 cout << " stripDirection = " << "LeftToRight" << "\n";
227 }
228 if (stripDirection == StripNumberingDirection::RightToLeft) {
229 cout << " stripDirection = " << "RightToLeft" << "\n";
230 }
231 cout << "\n";
232
233 vector<DeadZoneOfStripLayer> deadZones = layer.GetDeadZones();
234
235 for (Int_t idead = 0; idead < deadZones.size(); ++idead) {
236 cout << " DeadZone[" << idead << "]:\n";
237
238 Int_t NDeadPoints = deadZones[idead].GetNPoints();
239
240 for (Int_t ip = 0; ip < NDeadPoints; ++ip) {
241 cout << " (x,y) = ( " << deadZones[idead].GetXPoint(ip) << ", "
242 << deadZones[idead].GetYPoint(ip) << " )\n";
243 }
244 cout << "\n";
245 }
246 }
247 }
248 cout << "-----------------------------------------------------------\n";
249 }
250
251 BmnVSPModule** Modules = new BmnVSPModule*[NModules];
252 for (Int_t imod = 0; imod < NModules; imod++) {
253 Modules[imod] = station->GetModule(imod);
254 }
255
256 // histo limits
257 Double_t xmin = XMinStation - XSize * 0.3;
258 Double_t xmax = XMaxStation + XSize * 0.3;
259 Double_t ymin = YMinStation - YSize * 0.3;
260 Double_t ymax = YMaxStation + YSize * 0.3;
261
262 // gStyle->SetOptStat(0);
263 TH2F* station_front_2dhist = new TH2F("station_front_2dhist", description_text, 100, xmin, xmax, 100, ymin, ymax);
264 station_front_2dhist->GetXaxis()->SetTitle("+x (classical)");
265 station_front_2dhist->GetYaxis()->SetTitle("+y");
266 station_front_2dhist->SetStats(0);
267 station_front_canv->cd();
268 station_front_2dhist->Draw();
269
270 TPolyLine** bordersOfModules = new TPolyLine*[NModules];
271
272 for (Int_t im = 0; im < NModules; im++) {
273
274 // local module borders -------------------------------------------------
275 Double_t x_min_module = Modules[im]->GetXMinModule();
276 Double_t x_max_module = Modules[im]->GetXMaxModule();
277 Double_t y_min_module = Modules[im]->GetYMinModule();
278 Double_t y_max_module = Modules[im]->GetYMaxModule();
279
280 Double_t x_module_border_points[5] = {x_min_module, x_min_module, x_max_module, x_max_module, x_min_module};
281 Double_t y_module_border_points[5] = {y_min_module, y_max_module, y_max_module, y_min_module, y_min_module};
282
283 // if we have the rotation of the station
284 if (std::fabs(Modules[im]->GetModuleRotationAngleDeg()) >= std::numeric_limits<double>::epsilon()) {
285 Double_t x_p0 = Modules[im]->ConvertLocalToRotatedX(x_min_module, y_min_module);
286 Double_t y_p0 = Modules[im]->ConvertLocalToRotatedY(x_min_module, y_min_module);
287
288 Double_t x_p1 = Modules[im]->ConvertLocalToRotatedX(x_min_module, y_max_module);
289 Double_t y_p1 = Modules[im]->ConvertLocalToRotatedY(x_min_module, y_max_module);
290
291 Double_t x_p2 = Modules[im]->ConvertLocalToRotatedX(x_max_module, y_max_module);
292 Double_t y_p2 = Modules[im]->ConvertLocalToRotatedY(x_max_module, y_max_module);
293
294 Double_t x_p3 = Modules[im]->ConvertLocalToRotatedX(x_max_module, y_min_module);
295 Double_t y_p3 = Modules[im]->ConvertLocalToRotatedY(x_max_module, y_min_module);
296
297 x_module_border_points[0] = x_p0;
298 x_module_border_points[1] = x_p1;
299 x_module_border_points[2] = x_p2;
300 x_module_border_points[3] = x_p3;
301 x_module_border_points[4] = x_p0;
302
303 y_module_border_points[0] = y_p0;
304 y_module_border_points[1] = y_p1;
305 y_module_border_points[2] = y_p2;
306 y_module_border_points[3] = y_p3;
307 y_module_border_points[4] = y_p0;
308 }
309
310 bordersOfModules[im] = new TPolyLine(5, x_module_border_points, y_module_border_points);
311 bordersOfModules[im]->SetLineColor(TColor::GetColor("#000000"));
312 bordersOfModules[im]->SetLineStyle(2);
313 bordersOfModules[im]->SetLineWidth(1);
314 bordersOfModules[im]->SetFillColor(TColor::GetColor("#cafced"));
315 bordersOfModules[im]->SetFillStyle(0); // 0 - not filled, 1001 - solid
316
317 station_front_canv->cd();
318 // bordersOfModules[im]->Draw("l");
319 //----------------------------------------------------------------------
320
321 // layers ---------------------------------------------------------------
322 Int_t NLayers = Modules[im]->GetNStripLayers();
323
324 for (Int_t ilayer = 0; ilayer < NLayers; ++ilayer) {
325
326 // Separate canvas for current layer
327 description_text = "";
328 description_text += "FRONT: station ";
329 description_text += station->GetStationNumber();
330 description_text += ", module = ";
331 description_text += im;
332 description_text += ", layer = ";
333 description_text += ilayer;
334 TCanvas* layer_canv =
335 new TCanvas(TString(TString("layer_canv_") += ilayer) += im, description_text, 10, 10, 1000, 1000);
336 layer_canv->SetGrid();
337
338 // TH2F *layer_2dhist = new TH2F(TString(TString("layer_2dhist_")+=ilayer)+=im, description_text, 100,
339 // -range_size, range_size, 100, -range_size, range_size);
340 TH2F* layer_2dhist = new TH2F(TString(TString("layer_2dhist_") += ilayer) += im, description_text, 100,
341 xmin, xmax, 100, ymin, ymax);
342 layer_2dhist->GetXaxis()->SetTitle("+x (classical)");
343 layer_2dhist->GetYaxis()->SetTitle("+y");
344 layer_2dhist->SetStats(0);
345 layer_canv->cd();
346 layer_2dhist->Draw();
347 //------------------------------------------------------------------
348
349 BmnVSPLayer layer = Modules[im]->GetStripLayer(ilayer);
350
351 Double_t x_min_layer = layer.GetXMinLayer();
352 Double_t x_max_layer = layer.GetXMaxLayer();
353 Double_t y_min_layer = layer.GetYMinLayer();
354 Double_t y_max_layer = layer.GetYMaxLayer();
355
356 TPolyLine* bordersOfLayer = nullptr;
357
358 Double_t x_layer_border_points[5] = {x_min_layer, x_min_layer, x_max_layer, x_max_layer, x_min_layer};
359 Double_t y_layer_border_points[5] = {y_min_layer, y_max_layer, y_max_layer, y_min_layer, y_min_layer};
360
361 // if we have the rotation of the station
362 if (std::fabs(Modules[im]->GetModuleRotationAngleDeg()) >= std::numeric_limits<double>::epsilon()) {
363 Double_t x_p0 = Modules[im]->ConvertLocalToRotatedX(x_min_layer, y_min_layer);
364 Double_t y_p0 = Modules[im]->ConvertLocalToRotatedY(x_min_layer, y_min_layer);
365
366 Double_t x_p1 = Modules[im]->ConvertLocalToRotatedX(x_min_layer, y_max_layer);
367 Double_t y_p1 = Modules[im]->ConvertLocalToRotatedY(x_min_layer, y_max_layer);
368
369 Double_t x_p2 = Modules[im]->ConvertLocalToRotatedX(x_max_layer, y_max_layer);
370 Double_t y_p2 = Modules[im]->ConvertLocalToRotatedY(x_max_layer, y_max_layer);
371
372 Double_t x_p3 = Modules[im]->ConvertLocalToRotatedX(x_max_layer, y_min_layer);
373 Double_t y_p3 = Modules[im]->ConvertLocalToRotatedY(x_max_layer, y_min_layer);
374
375 x_layer_border_points[0] = x_p0;
376 x_layer_border_points[1] = x_p1;
377 x_layer_border_points[2] = x_p2;
378 x_layer_border_points[3] = x_p3;
379 x_layer_border_points[4] = x_p0;
380
381 y_layer_border_points[0] = y_p0;
382 y_layer_border_points[1] = y_p1;
383 y_layer_border_points[2] = y_p2;
384 y_layer_border_points[3] = y_p3;
385 y_layer_border_points[4] = y_p0;
386 }
387
388 bordersOfLayer = new TPolyLine(5, x_layer_border_points, y_layer_border_points);
389 bordersOfLayer->SetLineColorAlpha(TColor::GetColor("#009900"), 0.3);
390 bordersOfLayer->SetLineStyle(1);
391 bordersOfLayer->SetLineWidth(1);
392 // bordersOfLayer->SetFillColor(TColor::GetColor("#cafced"));
393 bordersOfLayer->SetFillColorAlpha(TColor::GetColor("#cccccc"), 0.3);
394 bordersOfLayer->SetFillStyle(1001); // 0 - not filled, 1001 - solid
395
396 station_front_canv->cd();
397 bordersOfLayer->Draw("f");
398 bordersOfLayer->Draw("l");
399
400 layer_canv->cd();
401 bordersOfLayer->Draw("f");
402
403 // layer dead zones--------------------------------------------------
404 vector<DeadZoneOfStripLayer> DeadZones = layer.GetDeadZones();
405 Int_t NDeadZones = DeadZones.size();
406
407 TPolyLine* dead_zones_polylines = new TPolyLine[NDeadZones];
408
409 for (Int_t izone = 0; izone < NDeadZones; ++izone) {
410 DeadZoneOfStripLayer dead_zone = DeadZones[izone];
411
412 for (Int_t ipoint = 0; ipoint < dead_zone.GetNPoints(); ++ipoint) {
413 Double_t x = dead_zone.GetXPoint(ipoint);
414 Double_t y = dead_zone.GetYPoint(ipoint);
415
416 // if we have the rotation of the station
417 if (std::fabs(Modules[im]->GetModuleRotationAngleDeg()) >= std::numeric_limits<double>::epsilon()) {
418 Double_t x_p = Modules[im]->ConvertLocalToRotatedX(x, y);
419 Double_t y_p = Modules[im]->ConvertLocalToRotatedY(x, y);
420 x = x_p;
421 y = y_p;
422 }
423
424 dead_zones_polylines[izone].SetNextPoint(x, y);
425 if (ipoint == dead_zone.GetNPoints() - 1) {
426 dead_zones_polylines[izone].SetNextPoint(dead_zones_polylines->GetX()[0],
427 dead_zones_polylines->GetY()[0]);
428 }
429 }
430
431 dead_zones_polylines[izone].SetFillStyle(1001);
432 dead_zones_polylines[izone].SetLineColorAlpha(TColor::GetColor("#ff0000"), 0.3);
433 dead_zones_polylines[izone].SetFillColorAlpha(TColor::GetColor("#ffc7c7"), 0.3);
434 dead_zones_polylines[izone].SetLineWidth(1);
435
436 station_front_canv->cd();
437 dead_zones_polylines[izone].Draw("f");
438 dead_zones_polylines[izone].Draw("");
439
440 layer_canv->cd();
441 dead_zones_polylines[izone].Draw("f");
442 dead_zones_polylines[izone].Draw("");
443 }
444 //------------------------------------------------------------------
445
446 // strip borders ----------------------------------------------------
447 Double_t x_left_border = layer.GetXLeftStripBorderPoint();
448 Double_t y_left_border = layer.GetYLeftStripBorderPoint();
449 Double_t x_right_border = layer.GetXRightStripBorderPoint();
450 Double_t y_right_border = layer.GetYRightStripBorderPoint();
451
452 StripNumberingDirection strip_direction = layer.GetStripNumberingOrder();
453
454 Double_t strip_angle_deg = layer.GetAngleDeg();
455 Double_t x_shift_up_left = Tan(strip_angle_deg * DegToRad()) * (y_max_layer - y_left_border);
456 Double_t x_shift_down_left = Tan(strip_angle_deg * DegToRad()) * (y_left_border - y_min_layer);
457 Double_t x_shift_up_right = Tan(strip_angle_deg * DegToRad()) * (y_max_layer - y_right_border);
458 Double_t x_shift_down_right = Tan(strip_angle_deg * DegToRad()) * (y_right_border - y_min_layer);
459
460 // left strip line
461 Double_t x1_left_strip_line = x_left_border - x_shift_down_left;
462 Double_t y1_left_strip_line = y_min_layer;
463 Double_t x2_left_strip_line = x_left_border + x_shift_up_left;
464 Double_t y2_left_strip_line = y_max_layer;
465 if (std::fabs(Modules[im]->GetModuleRotationAngleDeg()) >= std::numeric_limits<double>::epsilon()) {
466 Double_t x1_p = Modules[im]->ConvertLocalToRotatedX(x1_left_strip_line, y1_left_strip_line);
467 Double_t y1_p = Modules[im]->ConvertLocalToRotatedY(x1_left_strip_line, y1_left_strip_line);
468 Double_t x2_p = Modules[im]->ConvertLocalToRotatedX(x2_left_strip_line, y2_left_strip_line);
469 Double_t y2_p = Modules[im]->ConvertLocalToRotatedY(x2_left_strip_line, y2_left_strip_line);
470 x1_left_strip_line = x1_p;
471 y1_left_strip_line = y1_p;
472 x2_left_strip_line = x2_p;
473 y2_left_strip_line = y2_p;
474 }
475 TLine* left_strip_line = new TLine();
476 left_strip_line->SetX1(x1_left_strip_line);
477 left_strip_line->SetY1(y1_left_strip_line);
478 left_strip_line->SetX2(x2_left_strip_line);
479 left_strip_line->SetY2(y2_left_strip_line);
480 left_strip_line->SetLineColor(TColor::GetColor("#033cc0"));
481 left_strip_line->Draw();
482
483 // right strip line
484 Double_t x1_right_strip_line = x_right_border - x_shift_down_right;
485 Double_t y1_right_strip_line = y_min_layer;
486 Double_t x2_right_strip_line = x_right_border + x_shift_up_right;
487 Double_t y2_right_strip_line = y_max_layer;
488 if (std::fabs(Modules[im]->GetModuleRotationAngleDeg()) >= std::numeric_limits<double>::epsilon()) {
489 Double_t x1_p = Modules[im]->ConvertLocalToRotatedX(x1_right_strip_line, y1_right_strip_line);
490 Double_t y1_p = Modules[im]->ConvertLocalToRotatedY(x1_right_strip_line, y1_right_strip_line);
491 Double_t x2_p = Modules[im]->ConvertLocalToRotatedX(x2_right_strip_line, y2_right_strip_line);
492 Double_t y2_p = Modules[im]->ConvertLocalToRotatedY(x2_right_strip_line, y2_right_strip_line);
493 x1_right_strip_line = x1_p;
494 y1_right_strip_line = y1_p;
495 x2_right_strip_line = x2_p;
496 y2_right_strip_line = y2_p;
497 }
498 TLine* right_strip_line = new TLine();
499 right_strip_line->SetX1(x1_right_strip_line);
500 right_strip_line->SetY1(y1_right_strip_line);
501 right_strip_line->SetX2(x2_right_strip_line);
502 right_strip_line->SetY2(y2_right_strip_line);
503 right_strip_line->SetLineColor(TColor::GetColor("#033cc0"));
504 right_strip_line->Draw();
505
506 // left border marker
507 Double_t x_left_border_marker = x_left_border;
508 Double_t y_left_border_marker = y_left_border;
509 if (std::fabs(Modules[im]->GetModuleRotationAngleDeg()) >= std::numeric_limits<double>::epsilon()) {
510 Double_t x_p = Modules[im]->ConvertLocalToRotatedX(x_left_border, y_left_border);
511 Double_t y_p = Modules[im]->ConvertLocalToRotatedY(x_left_border, y_left_border);
512 x_left_border_marker = x_p;
513 y_left_border_marker = y_p;
514 }
515 TMarker* left_border_marker = new TMarker(x_left_border_marker, y_left_border_marker, 20);
516 left_border_marker->SetMarkerSize(1.2);
517 left_border_marker->SetMarkerColor(TColor::GetColor("#ff0000"));
518 left_border_marker->Draw();
519
520 // right border marker
521 Double_t x_right_border_marker = x_right_border;
522 Double_t y_right_border_marker = y_right_border;
523 if (std::fabs(Modules[im]->GetModuleRotationAngleDeg()) >= std::numeric_limits<double>::epsilon()) {
524 Double_t x_p = Modules[im]->ConvertLocalToRotatedX(x_right_border, y_right_border);
525 Double_t y_p = Modules[im]->ConvertLocalToRotatedY(x_right_border, y_right_border);
526 x_right_border_marker = x_p;
527 y_right_border_marker = y_p;
528 }
529 TMarker* right_border_marker = new TMarker(x_right_border_marker, y_right_border_marker, 20);
530 right_border_marker->SetMarkerSize(1.2);
531 right_border_marker->SetMarkerColor(TColor::GetColor("#ff0000"));
532 right_border_marker->Draw();
533
534 // strip numbering direction
535 TArrow* strip_direction_arrow = new TArrow();
536 if (strip_direction == LeftToRight) {
537 strip_direction_arrow->SetX1(x_left_border_marker);
538 strip_direction_arrow->SetY1(y_left_border_marker);
539
540 // finding arrow ending
541 Double_t x_arrend = x_left_border + layer.GetXSize();
542 Double_t y_arrend = y_left_border;
543 if (std::fabs(Modules[im]->GetModuleRotationAngleDeg()) >= std::numeric_limits<double>::epsilon()) {
544 Double_t x_p = Modules[im]->ConvertLocalToRotatedX(x_arrend, y_arrend);
545 Double_t y_p = Modules[im]->ConvertLocalToRotatedY(x_arrend, y_arrend);
546 x_arrend = x_p;
547 y_arrend = y_p;
548 }
549 strip_direction_arrow->SetX2(x_arrend);
550 strip_direction_arrow->SetY2(y_arrend);
551 } else {
552 strip_direction_arrow->SetX1(x_right_border_marker);
553 strip_direction_arrow->SetY1(y_right_border_marker);
554
555 // finding arrow ending
556 Double_t x_arrend = x_right_border - layer.GetXSize();
557 Double_t y_arrend = y_right_border;
558 if (std::fabs(Modules[im]->GetModuleRotationAngleDeg()) >= std::numeric_limits<double>::epsilon()) {
559 Double_t x_p = Modules[im]->ConvertLocalToRotatedX(x_arrend, y_arrend);
560 Double_t y_p = Modules[im]->ConvertLocalToRotatedY(x_arrend, y_arrend);
561 x_arrend = x_p;
562 y_arrend = y_p;
563 }
564 strip_direction_arrow->SetX2(x_arrend);
565 strip_direction_arrow->SetY2(y_arrend);
566 }
567 strip_direction_arrow->SetArrowSize(0.02);
568 strip_direction_arrow->SetLineColor(TColor::GetColor("#f4a900"));
569 strip_direction_arrow->SetFillColor(TColor::GetColor("#f4a900"));
570 strip_direction_arrow->SetLineWidth(1);
571 strip_direction_arrow->Draw("|>");
572 //------------------------------------------------------------------
573
574 // center line of a layer------------------------------------------------
575 Double_t x_center_layer = (x_min_layer + x_max_layer) * 0.5;
576 Double_t y_center_layer = (y_min_layer + y_max_layer) * 0.5;
577
578 Double_t x1_center_vline = x_center_layer;
579 Double_t y1_center_vline = y_max_layer;
580 Double_t x2_center_vline = x_center_layer;
581 Double_t y2_center_vline = y_min_layer;
582
583 Double_t x1_center_hline = x_min_layer;
584 Double_t y1_center_hline = y_center_layer;
585 Double_t x2_center_hline = x_max_layer;
586 Double_t y2_center_hline = y_center_layer;
587
588 if (std::fabs(Modules[im]->GetModuleRotationAngleDeg()) >= std::numeric_limits<double>::epsilon()) {
589 Double_t x1_vline_p = Modules[im]->ConvertLocalToRotatedX(x_center_layer, y_max_layer);
590 Double_t y1_vline_p = Modules[im]->ConvertLocalToRotatedY(x_center_layer, y_max_layer);
591 Double_t x2_vline_p = Modules[im]->ConvertLocalToRotatedX(x_center_layer, y_min_layer);
592 Double_t y2_vline_p = Modules[im]->ConvertLocalToRotatedY(x_center_layer, y_min_layer);
593 Double_t x1_hline_p = Modules[im]->ConvertLocalToRotatedX(x1_center_hline, y1_center_hline);
594 Double_t y1_hline_p = Modules[im]->ConvertLocalToRotatedY(x1_center_hline, y1_center_hline);
595 Double_t x2_hline_p = Modules[im]->ConvertLocalToRotatedX(x2_center_hline, y2_center_hline);
596 Double_t y2_hline_p = Modules[im]->ConvertLocalToRotatedY(x2_center_hline, y2_center_hline);
597 x1_center_vline = x1_vline_p;
598 y1_center_vline = y1_vline_p;
599 x2_center_vline = x2_vline_p;
600 y2_center_vline = y2_vline_p;
601 x1_center_hline = x1_hline_p;
602 y1_center_hline = y1_hline_p;
603 x2_center_hline = x2_hline_p;
604 y2_center_hline = y2_hline_p;
605 }
606
607 TLine* vert_center_layer_line =
608 new TLine(x1_center_vline, y1_center_vline, x2_center_vline, y2_center_vline);
609 TLine* horiz_center_layer_line =
610 new TLine(x1_center_hline, y1_center_hline, x2_center_hline, y2_center_hline);
611 vert_center_layer_line->SetLineColor(TColor::GetColor("#00ccff"));
612 horiz_center_layer_line->SetLineColor(TColor::GetColor("#00ccff"));
613
614 layer_canv->cd();
615 vert_center_layer_line->Draw();
616 horiz_center_layer_line->Draw();
617 //------------------------------------------------------------------
618
619 // strip angle slope of a layer -------------------------------------
620 strip_angle_deg = layer.GetAngleDeg();
621 Double_t strip_angle_rad = strip_angle_deg * TMath::Pi() / 180;
622 Double_t vert_leg = fabs(y_center_layer - y_max_layer);
623 Double_t hor_leg = vert_leg * Tan(strip_angle_rad);
624 Double_t x_edge_layer = x_center_layer + hor_leg;
625 Double_t y_edge_layer = y_max_layer;
626
627 Double_t x1_slope_line = x_center_layer;
628 Double_t y1_slope_line = y_center_layer;
629 Double_t x2_slope_line = x_edge_layer;
630 Double_t y2_slope_line = y_edge_layer;
631
632 if (std::fabs(Modules[im]->GetModuleRotationAngleDeg()) >= std::numeric_limits<double>::epsilon()) {
633 Double_t x1_line_p = Modules[im]->ConvertLocalToRotatedX(x1_slope_line, y1_slope_line);
634 Double_t y1_line_p = Modules[im]->ConvertLocalToRotatedY(x1_slope_line, y1_slope_line);
635 Double_t x2_line_p = Modules[im]->ConvertLocalToRotatedX(x2_slope_line, y2_slope_line);
636 Double_t y2_line_p = Modules[im]->ConvertLocalToRotatedY(x2_slope_line, y2_slope_line);
637
638 x1_slope_line = x1_line_p;
639 y1_slope_line = y1_line_p;
640 x2_slope_line = x2_line_p;
641 y2_slope_line = y2_line_p;
642 }
643
644 TLine* strip_slope_layer_line = new TLine(x1_slope_line, y1_slope_line, x2_slope_line, y2_slope_line);
645 strip_slope_layer_line->SetLineColor(TColor::GetColor("#00ff33"));
646
647 layer_canv->cd();
648 strip_slope_layer_line->Draw();
649 //------------------------------------------------------------------
650
651 // Нарисовать точку на слое, по которой мы определяем в какой станции находимся
652 // draw a point in the layer ----------------------------------------
653 TMarker* mark_point_front = new TMarker[points.size()];
654 for (int ip = 0; ip < points.size(); ip++) {
655 mark_point_front[ip].SetX(points.at(ip).X());
656 mark_point_front[ip].SetY(points.at(ip).Y());
657 mark_point_front[ip].SetMarkerStyle(5);
658 mark_point_front[ip].SetMarkerSize(1.0);
659 mark_point_front[ip].SetMarkerColor(TColor::GetColor("#0000ff"));
660
661 layer_canv->cd();
662 mark_point_front[ip].Draw();
663 }
664 //------------------------------------------------------------------
665 }
666 //----------------------------------------------------------------------
667 }
668
669 // Нарисовать точку на станции, по которой мы определяем в какой станции находимся и какую рисовать
670 // draw a point in the station ----------------------------------------------
671 TMarker* mark_point_front = new TMarker[points.size()];
672 for (int ip = 0; ip < points.size(); ip++) {
673 mark_point_front[ip].SetX(points.at(ip).X());
674 mark_point_front[ip].SetY(points.at(ip).Y());
675 mark_point_front[ip].SetMarkerStyle(5);
676 mark_point_front[ip].SetMarkerSize(1.0);
677 mark_point_front[ip].SetMarkerColor(TColor::GetColor("#0000ff"));
678
679 station_front_canv->cd();
680 mark_point_front[ip].Draw();
681 }
682 //--------------------------------------------------------------------------
683
684 station_front_canv->cd();
685 TPaveText* notice_pt = new TPaveText(0.08, 0.91, 0.93, 0.94, "nbNDC");
686 notice_pt->AddText("Press <SHIFT+LeftMouseClick>: to add a new point; <C>: to clear the area");
687 notice_pt->SetTextColor(kRed);
688 notice_pt->Draw();
689
690 g_current_station = station;
691
693 station_front_canv->AddExec("ex", "RecognizeModuleNumFromPointAndDrawIt(station_front_canv)");
694 // station_front_canv->AddExec("ex", "RecognizeModuleNumFromPointAndDrawIt()");
695 }
696}
697//------------------------------------------------------------------------------
698
700{
701 // void RecognizeModuleNumFromPointAndDrawIt() {
702
703 Int_t event = gPad->GetEvent();
704 Int_t eventX = gPad->GetEventX();
705 Int_t eventY = gPad->GetEventY();
706 TObject* object = gPad->GetSelected();
707
708 // if(event == kButtonDown) {
709 if (event == kButton1Shift) { // mouse click with shift button
710 Double_t x = gPad->AbsPixeltoX(eventX);
711 Double_t y = gPad->AbsPixeltoY(eventY);
712
713 // which module does the current point belong to?
714 Int_t module_num = -1;
715 Double_t z_current_pos = 0.0;
716 for (Int_t imod = 0; imod < g_current_station->GetNModules(); ++imod) {
717 BmnVSPModule* module = g_current_station->GetModule(imod);
718 Double_t module_zpos = module->GetZStartModulePosition();
719 module_num = g_current_station->GetPointModuleOwnership(x, y, module_zpos);
720 z_current_pos = module_zpos;
721 if (module_num != -1)
722 break;
723 }
724
725 cout << "\n-------------------------------------------------------------\n";
726
727 if (module_num != -1) {
728
729 cout << " point ( " << x << " : " << y << " ) is in:\n";
730 cout << " module = " << module_num << "\n";
731
732 BmnVSPModule* module = g_current_station->GetModule(module_num);
733 Int_t NLayers = module->GetNStripLayers();
734
735 for (Int_t ilayer = 0; ilayer < NLayers; ++ilayer) {
736
737 BmnVSPLayer layer = module->GetStripLayer(ilayer);
738
739 Double_t xloc = module->ConvertRotatedToLocalX(x, y);
740 Double_t yloc = module->ConvertRotatedToLocalY(x, y);
741
742 if (layer.IsPointInsideStripLayer(xloc, yloc)) {
743 cout << " layer[" << ilayer << "] : ";
744 if (layer.GetType() == LowerStripLayer)
745 cout << "LowerStripLayer";
746 if (layer.GetType() == UpperStripLayer)
747 cout << "UpperStripLayer";
748 cout << ", angle = " << layer.GetAngleDeg();
749 cout << ", pitch = " << layer.GetPitch();
750 cout << ", nstrips = " << layer.GetNStrips();
751 cout << ", sizes = (" << layer.GetXSize() << " x " << layer.GetYSize() << ")";
752 cout << ", strip_pos = " << layer.ConvertPointToStripPosition(xloc, yloc);
753 cout << "\n";
754 }
755 }
756
757 } else {
758 cout << " point ( " << x << " : " << y << " ) is out of any modules!!!\n";
759 }
760
761 TMarker* point_marker = new TMarker(x, y, 2);
762 point_marker->SetMarkerSize(1.0);
763 point_marker->SetMarkerColor(TColor::GetColor("#ff0000"));
764
765 g_points_marker.push_back(point_marker);
766
767 station_front_canv->cd();
768 g_points_marker[g_points_marker.size() - 1]->Draw();
769
770 // other canvas drawing
772 TSeqCollection* collect = gROOT->GetListOfCanvases();
773 Int_t nentries = collect->GetEntries();
774 for (Int_t ie = 0; ie < nentries; ++ie) {
775 TObject* obj = collect->At(ie);
776 if (TString(obj->GetName()).Contains("layer_canv_")) {
777 ((TCanvas*)obj)->cd();
778 point_marker->Draw();
779 ((TCanvas*)obj)->Update();
780 }
781 }
782 }
783
784 if (module_num != -1) {
785
786 g_current_station->AddPointToStation(x, y, z_current_pos, 0.0, 0.0, 1.0, 1.0, 0);
787 g_current_station->ProcessPointsInStation();
788
789 if (g_hits_marker) {
790 delete[] g_hits_marker;
791
792 g_hits_marker = 0;
793 g_n_hits_marker = 0;
794 }
795
796 Int_t NModules = g_current_station->GetNModules();
797
799 cout << "\n Number of intersection points:\n";
800
801 for (Int_t im = 0; im < NModules; ++im) {
802 BmnVSPModule* module = g_current_station->GetModule(im);
803 Int_t NHits = module->GetNIntersectionPoints();
804 g_n_hits_marker += NHits;
805
807 cout << " in module[" << im << "] : " << NHits << "\n";
808 }
809
811 cout << " in all modules : " << g_n_hits_marker << "\n\n";
812
813 if (g_n_hits_marker == 0)
814 return;
815
817 Int_t hit_marker_cnt = 0;
818
820 cout << " Intersection points:\n";
821
822 for (Int_t im = 0; im < NModules; ++im) {
823
825 cout << " module[" << im << "]:\n";
826
827 BmnVSPModule* module = g_current_station->GetModule(im);
828
829 Int_t NHits = module->GetNIntersectionPoints();
830
831 for (Int_t ihit = 0; ihit < NHits; ++ihit) {
832
833 Double_t x_hit = module->GetIntersectionPointX(ihit);
834 Double_t y_hit = module->GetIntersectionPointY(ihit);
835 Double_t z_hit = module->GetZPositionRegistered();
836
838 cout << " hit[" << ihit << "] = ( " << x_hit << " : " << y_hit << " : " << z_hit << " ) "
839 << "\n";
840
841 // which layers?
842 Int_t NLayers = module->GetNStripLayers();
843 for (Int_t ilayer = 0; ilayer < NLayers; ++ilayer) {
844 BmnVSPLayer layer = module->GetStripLayer(ilayer);
845 if (layer.IsPointInsideStripLayer(x_hit, y_hit)) {
847 cout << " layer[" << ilayer << "] : ";
848 if (layer.GetType() == LowerStripLayer)
849 cout << "LowerStripLayer";
850 if (layer.GetType() == UpperStripLayer)
851 cout << "UpperStripLayer";
852 cout << ", angle = " << layer.GetAngleDeg();
853 cout << ", pitch = " << layer.GetPitch();
854 cout << ", nstrips = " << layer.GetNStrips();
855 cout << ", sizes = (" << layer.GetXSize() << " x " << layer.GetYSize() << ")";
857 cout << "\n";
858 }
859 }
860
862 cout << "\n";
863
864 g_hits_marker[hit_marker_cnt].SetX(x_hit);
865 g_hits_marker[hit_marker_cnt].SetY(y_hit);
866 g_hits_marker[hit_marker_cnt].SetMarkerSize(1.0);
867 g_hits_marker[hit_marker_cnt].SetMarkerStyle(5);
868 g_hits_marker[hit_marker_cnt].SetMarkerColor(TColor::GetColor("#009900"));
869
870 station_front_canv->cd();
871 g_hits_marker[hit_marker_cnt].Draw();
872
873 // other canvas drawing
875 TSeqCollection* collect = gROOT->GetListOfCanvases();
876 Int_t nentries = collect->GetEntries();
877 for (Int_t ie = 0; ie < nentries; ++ie) {
878 TObject* obj = collect->At(ie);
879 if (TString(obj->GetName()).Contains("layer_canv_")) {
880
881 Int_t NLayers = module->GetNStripLayers();
882
883 for (Int_t ilayer = 0; ilayer < NLayers; ++ilayer) {
884
885 BmnVSPLayer layer = module->GetStripLayer(ilayer);
886
887 if (layer.IsPointInsideStripLayer(x_hit, y_hit)) {
888 TString laymod = "";
889 laymod += ilayer;
890 laymod += im;
891
892 if (TString(obj->GetName()).Contains(laymod)) {
893 ((TCanvas*)obj)->cd();
894 g_hits_marker[hit_marker_cnt].Draw();
895 ((TCanvas*)obj)->Update();
896 }
897 }
898 }
899 }
900 }
901 }
902
903 hit_marker_cnt++;
904 }
905 cout << "\n";
906 }
907 }
908 cout << "-------------------------------------------------------------\n";
909 }
910
911 if (event == kKeyPress) {
912 cout << "key button was pressed\n";
913 cout << "px = " << eventX << "\n";
914 cout << "py = " << (char)eventY << "\n";
915
916 if (eventX == (int)'c') {
917
918 g_current_station->Reset();
919
920 if (g_hits_marker != 0) {
921 delete[] g_hits_marker;
922 g_hits_marker = 0;
923 g_n_hits_marker = 0;
924 }
925
926 for (Int_t i = 0; i < g_points_marker.size(); ++i) {
927 g_points_marker[i]->Delete();
928 }
929 g_points_marker.clear();
930
931 station_front_canv->Update();
932
933 // other canvas drawing
935 TSeqCollection* collect = gROOT->GetListOfCanvases();
936 Int_t nentries = collect->GetEntries();
937 for (Int_t ie = 0; ie < nentries; ++ie) {
938 TObject* obj = collect->At(ie);
939 if (TString(obj->GetName()).Contains("layer_canv_")) {
940 ((TCanvas*)obj)->Update();
941 }
942 }
943 }
944 }
945 }
946
947 /*if(object) {
948 if(object->InheritsFrom("TMarker")) {
949 TMarker *marker = (TMarker*)object;
950 //cout << "marker (x,y) = ( " << marker->GetX() << " : " << marker->GetY() << " )\n";
951 }
952 }*/
953}
954
955void DrawCreatedStationTop(BmnVSPStation* station, vector<TLorentzVector>& points)
956{
957
958 TString description_text = "";
959 description_text += "TOP: station ";
960 description_text += station->GetStationNumber();
961 description_text += ", xpos = ";
962 description_text += station->GetXPosition();
963 description_text += ", ypos = ";
964 description_text += station->GetYPosition();
965 description_text += ", zpos = ";
966 description_text += station->GetZPosition();
967 TCanvas* station_top_canv = new TCanvas("station_top_canv", description_text, 10, 10, 1000, 1000);
968 station_top_canv->SetGrid();
969
971 Double_t XSize = station->GetXSize();
972 Double_t YSize = station->GetYSize();
973 Double_t ZSize = station->GetZSize();
980 Double_t XPosition = station->GetXPosition();
981 Double_t YPosition = station->GetYPosition();
982 Double_t ZPosition = station->GetZPosition();
983 Int_t NModules = station->GetNModules();
984
985 Double_t* XShiftsOfModules = new Double_t[NModules];
986 Double_t* YShiftsOfModules = new Double_t[NModules];
987 Double_t* ZShiftsOfModules = new Double_t[NModules];
988 Double_t maxXShift = 0.0;
989 Double_t maxYShift = 0.0;
990 Double_t maxZShift = 0.0;
991 for (Int_t iModule = 0; iModule < NModules; ++iModule) {
992 XShiftsOfModules[iModule] = station->GetXShiftOfModule(iModule);
993 YShiftsOfModules[iModule] = station->GetYShiftOfModule(iModule);
994 ZShiftsOfModules[iModule] = station->GetZShiftOfModule(iModule);
995
996 if (fabs(XShiftsOfModules[iModule]) > maxXShift)
997 maxXShift = fabs(XShiftsOfModules[iModule]);
998 if (fabs(YShiftsOfModules[iModule]) > maxYShift)
999 maxYShift = fabs(YShiftsOfModules[iModule]);
1000 if (fabs(ZShiftsOfModules[iModule]) > maxZShift)
1001 maxZShift = fabs(ZShiftsOfModules[iModule]);
1002 }
1003
1004 BmnVSPModule** Modules = new BmnVSPModule*[NModules];
1005 for (Int_t imod = 0; imod < NModules; imod++) {
1006 Modules[imod] = station->GetModule(imod);
1007 }
1008
1009 // Double_t xrange_size = XSize + fabs(XPosition) + maxXShift;
1010 // xrange_size *= 0.5 + 0.1;
1011
1012 Double_t xmin = XMinStation - XSize * 0.3;
1013 Double_t xmax = XMaxStation + XSize * 0.3;
1014 Double_t zmin = ZMinStation - ZSize * 5.0;
1015 Double_t zmax = ZMaxStation + ZSize * 5.0;
1016
1017 // TH2F *station_top_2dhist = new TH2F("station_top_2dhist", description_text, 100, -xrange_size, xrange_size, 100,
1018 // ZPosition-xrange_size*0.5, ZPosition+xrange_size*0.5);
1019 TH2F* station_top_2dhist = new TH2F("station_top_2dhist", description_text, 100, xmin, xmax, 100, zmin, zmax);
1020 station_top_2dhist->GetXaxis()->SetTitle("+x (classical)");
1021 station_top_2dhist->GetYaxis()->SetTitle("+z");
1022 station_top_2dhist->SetStats(0);
1023 station_top_2dhist->Draw();
1024
1025 TBox** modules_box = new TBox*[NModules];
1026
1027 TPolyLine** bordersOfModules = new TPolyLine*[NModules];
1028
1029 for (Int_t im = 0; im < NModules; im++) {
1030
1031 // module borders -------------------------------------------------------
1032 Double_t x_min_module = Modules[im]->GetXMinModule();
1033 Double_t x_max_module = Modules[im]->GetXMaxModule();
1034 Double_t y_min_module = Modules[im]->GetYMinModule();
1035 Double_t y_max_module = Modules[im]->GetYMaxModule();
1036 Double_t z_min_module = Modules[im]->GetZStartModulePosition();
1037 Double_t z_max_module = Modules[im]->GetZStartModulePosition() + Modules[im]->GetModuleThickness();
1038
1039 Double_t x_module_border_points[5] = {x_min_module, x_min_module, x_max_module, x_max_module, x_min_module};
1040 Double_t y_module_border_points[5] = {y_min_module, y_max_module, y_max_module, y_min_module, y_min_module};
1041
1042 // if we have the rotation of the station
1043 if (std::fabs(Modules[im]->GetModuleRotationAngleDeg()) >= std::numeric_limits<double>::epsilon()) {
1044 Double_t x_p0 = Modules[im]->ConvertLocalToRotatedX(x_min_module, y_min_module);
1045 Double_t x_p1 = Modules[im]->ConvertLocalToRotatedX(x_min_module, y_max_module);
1046 Double_t x_p2 = Modules[im]->ConvertLocalToRotatedX(x_max_module, y_max_module);
1047 Double_t x_p3 = Modules[im]->ConvertLocalToRotatedX(x_max_module, y_min_module);
1048 x_module_border_points[0] = x_p0;
1049 x_module_border_points[1] = x_p1;
1050 x_module_border_points[2] = x_p2;
1051 x_module_border_points[3] = x_p3;
1052 x_module_border_points[4] = x_p0;
1053 }
1054
1055 TPolyLine* frontBorders = new TPolyLine(5);
1056 frontBorders->SetPoint(0, x_module_border_points[0], z_min_module);
1057 for (Int_t ip = 1; ip < 4; ip++)
1058 frontBorders->SetNextPoint(x_module_border_points[ip], z_min_module);
1059 frontBorders->SetNextPoint(x_module_border_points[0], z_min_module);
1060 frontBorders->SetLineStyle(1);
1061 frontBorders->SetLineWidth(1);
1062 frontBorders->SetFillStyle(0); // 0 - not filled, 1001 - solid
1063
1064 TPolyLine* backBorders = new TPolyLine(5);
1065 ;
1066 backBorders->SetPoint(0, x_module_border_points[0], z_max_module);
1067 for (Int_t ip = 1; ip < 4; ip++)
1068 backBorders->SetNextPoint(x_module_border_points[ip], z_max_module);
1069 backBorders->SetNextPoint(x_module_border_points[0], z_max_module);
1070 backBorders->SetLineStyle(1);
1071 backBorders->SetLineWidth(1);
1072 backBorders->SetFillStyle(0); // 0 - not filled, 1001 - solid
1073
1074 station_top_canv->cd();
1075 frontBorders->Draw("l");
1076 backBorders->Draw("l");
1077 //----------------------------------------------------------------------
1078 }
1079
1080 TMarker* mark_point_top = new TMarker[points.size()];
1081 for (int ip = 0; ip < points.size(); ip++) {
1082 mark_point_top[ip].SetX(points.at(ip).X());
1083 mark_point_top[ip].SetY(points.at(ip).Z());
1084 mark_point_top[ip].SetMarkerStyle(5);
1085 mark_point_top[ip].SetMarkerSize(1.0);
1086 mark_point_top[ip].SetMarkerColor(TColor::GetColor("#0000ff"));
1087 mark_point_top[ip].Draw();
1088 }
1089}
kKeyPress
kButton1Shift
friend F32vec4 fabs(const F32vec4 &a)
Definition P4_F32vec4.h:52
int i
Definition P4_F32vec4.h:22
bool Bool_t
int Int_t
double Double_t
#define R__ADD_INCLUDE_PATH(PATH)
kRed
#define gROOT
R__EXTERN TSystem * gSystem
#define gPad
StripNumberingDirection
@ RightToLeft
@ LeftToRight
StripLayerType
@ UpperStripLayer
@ LowerStripLayer
Double_t GetXSize()
Definition BmnVSPLayer.h:53
Double_t GetYLeftStripBorderPoint()
Definition BmnVSPLayer.h:70
StripLayerType GetType()
Definition BmnVSPLayer.h:49
Double_t GetXLeftStripBorderPoint()
Definition BmnVSPLayer.h:69
Double_t GetXMaxLayer()
Definition BmnVSPLayer.h:56
Double_t ConvertPointToStripPosition(Double_t x, Double_t y)
Double_t GetXMinLayer()
Definition BmnVSPLayer.h:55
vector< DeadZoneOfStripLayer > GetDeadZones()
Definition BmnVSPLayer.h:81
Double_t GetYMaxLayer()
Definition BmnVSPLayer.h:58
Double_t GetAngleDeg()
Definition BmnVSPLayer.h:51
Double_t GetYSize()
Definition BmnVSPLayer.h:54
Double_t GetXRightStripBorderPoint()
Definition BmnVSPLayer.h:71
Int_t GetNStrips()
Double_t GetYRightStripBorderPoint()
Definition BmnVSPLayer.h:72
Double_t GetYMinLayer()
Definition BmnVSPLayer.h:57
StripNumberingDirection GetStripNumberingOrder()
Definition BmnVSPLayer.h:68
Bool_t IsPointInsideStripLayer(Double_t x, Double_t y)
Double_t GetPitch()
Definition BmnVSPLayer.h:50
Double_t GetYMinModule()
Double_t GetXMinModule()
Double_t GetYMaxModule()
Int_t GetNStripLayers()
BmnVSPLayer & GetStripLayer(Int_t num)
Double_t GetModuleThickness()
Double_t GetZStartModulePosition()
Double_t GetXMaxModule()
BmnVSPStation * GetVSPStation(Int_t station_num)
Double_t GetYMaxStation()
Double_t GetZMaxStation()
Double_t XPosition
Int_t GetNModules()
Double_t GetXMaxStation()
Double_t GetYPosition()
Double_t GetXShiftOfModule(Int_t module_num)
BmnVSPModule ** Modules
Double_t ZMinStation
Double_t GetXMinStation()
Double_t GetZShiftOfModule(Int_t module_num)
Double_t XMinStation
Double_t YMinStation
BmnVSPModule * GetModule(Int_t module_num)
Double_t ZPosition
Double_t YPosition
Double_t GetZPosition()
Double_t GetXPosition()
Double_t GetYShiftOfModule(Int_t module_num)
Double_t GetZSize()
Double_t GetYSize()
Double_t GetXSize()
Double_t ZMaxStation
Int_t GetStationNumber()
Double_t GetZMinStation()
Double_t XMaxStation
Double_t YMaxStation
Double_t GetYMinStation()
Double_t GetXPoint(Int_t index)
Double_t GetYPoint(Int_t index)
virtual void SetArrowSize(Float_t arrowsize=0.05)
void Draw(Option_t *option="") override
virtual void SetFillColor(Color_t fcolor)
virtual void SetFillColorAlpha(Color_t fcolor, Float_t falpha)
virtual void SetFillStyle(Style_t fstyle)
virtual void SetLineStyle(Style_t lstyle)
virtual void SetLineWidth(Width_t lwidth)
virtual void SetLineColorAlpha(Color_t lcolor, Float_t lalpha)
virtual void SetLineColor(Color_t lcolor)
virtual void SetMarkerColor(Color_t mcolor=1)
virtual void SetMarkerStyle(Style_t mstyle=1)
virtual void SetMarkerSize(Size_t msize=1)
virtual void SetTextColor(Color_t tcolor=1)
TVirtualPad * cd(Int_t subpadnumber=0) override
void Update() override
virtual Int_t GetEntries() const
static Int_t GetColor(const char *hexcolor)
TAxis * GetXaxis()
TAxis * GetYaxis()
void Draw(Option_t *option="") override
virtual void SetStats(Bool_t stats=kTRUE)
virtual void SetY2(Double_t y2)
virtual void SetX2(Double_t x2)
virtual void SetX1(Double_t x1)
virtual void SetY1(Double_t y1)
virtual void SetX(Double_t x)
void Draw(Option_t *option="") override
virtual void SetY(Double_t y)
virtual void SetTitle(const char *title="")
virtual const char * GetName() const
virtual void Draw(Option_t *option="")
void AddExec(const char *name, const char *command) override
void SetGrid(Int_t valuex=1, Int_t valuey=1) override
virtual TText * AddText(const char *label)
void Draw(Option_t *option="") override
Double_t * GetX() const
virtual void SetPoint(Int_t point, Double_t x, Double_t y)
Double_t * GetY() const
void Draw(Option_t *option="") override
virtual Int_t SetNextPoint(Double_t x, Double_t y)
virtual TObject * At(Int_t idx) const=0
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Int_t g_n_hits_marker
Bool_t g_ShowIntersectionPointInfo
TMarker * g_hits_marker
vector< TMarker * > g_points_marker
Bool_t g_EnableAddingPoints
Bool_t g_DrawOnSeparateLayers
void TestVSPConfig_Visual()
void DrawCreatedStationFront(BmnVSPStation *station, vector< TLorentzVector > &points)
void DrawCreatedStationTop(BmnVSPStation *station, vector< TLorentzVector > &points)
void RecognizeModuleNumFromPointAndDrawIt(TCanvas *station_front_canv)
constexpr Double_t DegToRad()
constexpr Double_t Pi()
Double_t Tan(Double_t)
Definition json.hpp:4446