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