BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
TestSiBTClassTransform.C
Go to the documentation of this file.
1/*
2 * This macro for testing configurations of the SiBT
3 * detector which have some module transformations in an XML-parameter file.
4 *
5 * It allows you to analyze MC-points and Hits and find their ownership to
6 * modules in various visual projections.
7 *
8 * Author: Baranov D.
9 * Created: 06.12.2021
10 *
11 */
12#include "Rtypes.h"
13
14R__ADD_INCLUDE_PATH($VMCWORKDIR)
15
16#include "Math/Transform3D.h"
17#include "TBox.h"
18#include "TCanvas.h"
19#include "TClonesArray.h"
20#include "TFile.h"
21#include "TFrame.h"
22#include "TH1F.h"
23#include "TH2F.h"
24#include "TPad.h"
25#include "TRandom.h"
26#include "TTree.h"
27#include "macro/run/bmnloadlibs.C"
28
29#include <fstream>
30#include <iostream>
31#include <vector>
32
33using namespace ROOT::Math;
34using namespace std;
35
36// Global variables
41
44vector<vector<Bool_t>> gConfig_visual; // [station][module] = bool (active/inactive)
45
46// function declaration
47void DrawPointsAndLines(vector<Plane3D::Point> points,
48 TString hexcolor,
49 Int_t marker_style,
50 Double_t marker_size,
51 Double_t line_size,
52 Bool_t isPointDraw,
53 Bool_t isLinesDraw,
54 Bool_t isCloseLine);
55void DrawPointsAndLines3D(vector<Plane3D::Point> points,
56 TString hexcolor,
57 Int_t marker_style,
58 Double_t marker_size,
59 Double_t line_size,
60 Bool_t isPointDraw,
61 Bool_t isLinesDraw,
62 Bool_t isCloseLine);
63void DrawBranchPoints(TTree* points_tree, TClonesArray* points_array, Int_t first_event, Int_t last_event);
64void DrawBranchHits(TTree* points_tree, TClonesArray* points_array, Int_t first_event, Int_t last_event);
65
67{
68
69 // ---- Load libraries --------------------------------------------------
70#if ROOT_VERSION_CODE < ROOT_VERSION(5, 99, 99)
71 gROOT->LoadMacro("$VMCWORKDIR/macro/run/bmnloadlibs.C");
72#endif
73 bmnloadlibs(); // load BmnRoot libraries
74 // -------------------------------------------------------------------------
75
76 //------------------------------------------------------------------------------
77 TString file_prefix = "";
78 // file_prefix = "_CC_4gev_b0_16fm";
79
80 // Input MC-points for SiBT (called SiBTPoint)
81 TClonesArray* fSiBTMCPoints_Array = new TClonesArray("");
82 TString fSiBTMCPoints_FileName = "$VMCWORKDIR/macro/run/bmnsim";
83 fSiBTMCPoints_FileName += file_prefix;
84 fSiBTMCPoints_FileName += ".root";
85 TFile* fSiBTMCPoints_File = new TFile(fSiBTMCPoints_FileName, "READ");
86 TTree* fSiBTMCPoints_Tree = (TTree*)fSiBTMCPoints_File->Get("bmndata");
87 fSiBTMCPoints_Tree->GetBranch("SiBTPoint")->SetAutoDelete(kTRUE);
88 fSiBTMCPoints_Tree->SetBranchAddress("SiBTPoint", &fSiBTMCPoints_Array);
89 Int_t NEvents_fSiBTMCPoints = fSiBTMCPoints_Tree->GetEntries();
90
91 // Input hits for SiBT
92 TClonesArray* fSiBTHits_Array = new TClonesArray("");
93 TString fSiBTHits_FileName = "$VMCWORKDIR/macro/run/bmndst";
94 fSiBTHits_FileName += file_prefix;
95 fSiBTHits_FileName += ".root";
96 TFile* fSiBTHits_File = new TFile(fSiBTHits_FileName, "READ");
97 TTree* fSiBTHits_Tree = (TTree*)fSiBTHits_File->Get("bmndata");
98 fSiBTHits_Tree->GetBranch("BmnSiBTHit")->SetAutoDelete(kTRUE);
99 fSiBTHits_Tree->SetBranchAddress("BmnSiBTHit", &fSiBTHits_Array);
100 Int_t NEvents_fSiBTHits = fSiBTHits_Tree->GetEntries();
101
102 //------------------------------------------------------------------------------
103
104 // axis ranges
105 Double_t scale_coeff = 1;
106 Double_t xmin_view = -10.0 * scale_coeff;
107 Double_t xmax_view = +10.0 * scale_coeff;
108 Double_t ymin_view = -10.0 * scale_coeff;
109 Double_t ymax_view = +10.0 * scale_coeff;
110 Double_t zmin_view = -450.0 * scale_coeff; // was -100
111 Double_t zmax_view = +0.0 * scale_coeff;
112 // Double_t zmin_view = -100.0*scale_coeff; //was -100
113 // Double_t zmax_view = +300.0*scale_coeff;
114
115 // XY plane
116 planeXY_canv = new TCanvas("planeXY_canv", "planeXY_canv", 10, 10, 900, 900);
117 planeXY_canv->SetGrid();
118 TH2D* planeXY_h2 =
119 new TH2D("planeXY_h2", "planeXY_h2 (to the target(back))", 10, xmin_view, xmax_view, 10, ymin_view, ymax_view);
120 planeXY_h2->GetXaxis()->SetTitle("X(global)");
121 planeXY_h2->GetYaxis()->SetTitle("Y(global)");
122
123 // ZX plane
124 planeZX_canv = new TCanvas("planeZX_canv", "planeZX_canv", 1000, 10, 900, 900);
125 planeZX_canv->SetGrid();
126 TH2D* planeZX_h2 = new TH2D("planeZX_h2", "planeZX_h2(top)", 10, zmin_view, zmax_view, 10, xmin_view, xmax_view);
127 planeZX_h2->GetXaxis()->SetTitle("Z(global)");
128 planeZX_h2->GetYaxis()->SetTitle("X(global)");
129
130 // ZY plane
131 planeZY_canv = new TCanvas("planeZY_canv", "planeZY_canv", 1800, 10, 900, 900);
132 planeZY_canv->SetGrid();
133 TH2D* planeZY_h2 = new TH2D("planeZY_h2", "planeZY_h2(side)", 10, zmin_view, zmax_view, 10, ymin_view, ymax_view);
134 planeZY_h2->GetXaxis()->SetTitle("Z(global)");
135 planeZY_h2->GetYaxis()->SetTitle("Y(global)");
136
137 // 3D view (y and z - swapped)
138 XYZview_canv = new TCanvas("XYZview_canv", "XYZview_canv", 2900, 10, 900, 900);
139 // XYZview_canv->SetGrid();
140 TH3D* XYZview_h3 = new TH3D("XYZview_h3", "XYZview_h3", 10, zmin_view, zmax_view, 10, xmin_view, xmax_view, 10,
141 ymin_view, ymax_view);
142 XYZview_h3->GetXaxis()->SetTitle("Z");
143 XYZview_h3->GetYaxis()->SetTitle("X");
144 XYZview_h3->GetZaxis()->SetTitle("Y");
145
146 //------------------------------------------------------------------------------
147
148 // Set the path to an XML-config. file
149 TString gPathDetectorConfig = gSystem->Getenv("VMCWORKDIR");
150 gPathDetectorConfig += "/parameters/SiBT/XMLConfigs/";
151
152 gPathDetectorConfig += "SiBTRun8.xml";
153
154 // Current configuration
155 gStationSet = new BmnSiBTStationSet(gPathDetectorConfig);
156
157 // Current transform configuration
159 gTransfClass->LoadFromXMLFile(gPathDetectorConfig);
160
161 // Selecting modules to visualize -------------------------------------------
162 gConfig_visual.resize(gStationSet->GetNStations()); // quantity of stations
163 for (Int_t istation = 0; istation < gConfig_visual.size(); ++istation) {
164 gConfig_visual[istation].resize(gStationSet->GetStation(istation)->GetNModules(), false); // default: inactive
165 }
166
167 for (Int_t istation = 0; istation < gStationSet->GetNStations(); ++istation) {
168 for (Int_t imodule = 0; imodule < gStationSet->GetStation(istation)->GetNModules(); ++imodule) {
169 gConfig_visual[istation][imodule] = true;
170 }
171 }
172
173 // Set a visualization flag for each module
174 // gConfig_visual[0][0] = true;
175 // gConfig_visual[0][1] = true;
176
177 // gConfig_visual[1][0] = true;
178 // gConfig_visual[1][1] = true;
179
180 // Printing the info about the visual status of modules
181 if (1) {
182 cout << "Info about the visual status of modules:\n";
183 for (Int_t istation = 0; istation < gConfig_visual.size(); ++istation) {
184 for (Int_t imodule = 0; imodule < gConfig_visual[istation].size(); ++imodule) {
185 cout << "det[" << istation << "][" << imodule << "] = " << gConfig_visual[istation][imodule] << "\n";
186 }
187 }
188 cout << "\n";
189 }
190 //--------------------------------------------------------------------------
191
192 planeXY_canv->cd();
193 planeXY_h2->Draw();
194
195 planeZX_canv->cd();
196 planeZX_h2->Draw();
197
198 planeZY_canv->cd();
199 planeZY_h2->Draw();
200
201 XYZview_canv->cd();
202 XYZview_h3->Draw();
203
204 for (Int_t istation = 0; istation < gStationSet->GetNStations(); ++istation) {
205
206 for (Int_t imodule = 0; imodule < gStationSet->GetStation(istation)->GetNModules(); ++imodule) {
207
208 Bool_t visual_status = gConfig_visual[istation][imodule];
209
210 if (visual_status == true) {
211
212 BmnSiBTModule* module = gStationSet->GetStation(istation)->GetModule(imodule);
213
214 // parameters of the current module in local coordinates
215 Double_t xmin_module = module->GetXMinModule();
216 Double_t xmax_module = module->GetXMaxModule();
217 Double_t ymin_module = module->GetYMinModule();
218 Double_t ymax_module = module->GetYMaxModule();
219 Double_t z_start_pos_module =
220 gStationSet->GetStation(istation)->GetModule(imodule)->GetZStartModulePosition();
221 Double_t z_reg_module = gStationSet->GetStation(istation)->GetModule(imodule)->GetZPositionRegistered();
222
223 // print parameters of the module
224 if (1) {
225 cout << " station[" << istation << "], module[" << imodule << "]:\n";
226 cout << " xloc_module(min:max) = ( " << xmin_module << " : " << xmax_module << ")\n";
227 cout << " yloc_module(min:max) = ( " << ymin_module << " : " << ymax_module << ")\n";
228 cout << " zloc_start_pos_module = " << z_start_pos_module << "\n";
229 cout << " zloc_reg_module = " << z_reg_module << "\n";
230 cout << "\n";
231 }
232
233 vector<Plane3D::Point> module_borders;
234 vector<Plane3D::Point> tmodule_borders; // transformed
235 vector<Plane3D::Point> rtmodule_borders; // inverse transformed
236
237 module_borders.push_back(
238 Plane3D::Point(-xmin_module, ymin_module, z_reg_module)); // x converted to global
239 module_borders.push_back(
240 Plane3D::Point(-xmin_module, ymax_module, z_reg_module)); // x converted to global
241 module_borders.push_back(
242 Plane3D::Point(-xmax_module, ymax_module, z_reg_module)); // x converted to global
243 module_borders.push_back(
244 Plane3D::Point(-xmax_module, ymin_module, z_reg_module)); // x converted to global
245
246 for (Int_t ipoint = 0; ipoint < module_borders.size(); ++ipoint) {
247 tmodule_borders.push_back(gTransfClass->ApplyTransforms(module_borders[ipoint], istation, imodule));
248 }
249
250 // DrawPointsAndLines(module_borders, "#cc0000", 20, 1.0, 1.0, false, true, true);
251 DrawPointsAndLines(tmodule_borders, "#00cc00", 20, 1.0, 1.0, false, true, true);
252 // DrawPointsAndLines(rtmodule_borders, "#0000cc", 20, 1.0, 1.0, true, true, true);
253
254 // DrawPointsAndLines3D(module_borders, "#cc0000", 20, 0.5, 1.0, false, true, true);
255 DrawPointsAndLines3D(tmodule_borders, "#00cc00", 20, 0.5, 1.0, true, true, true);
256 // DrawPointsAndLines3D(rtmodule_borders, "#0000cc", 20, 0.5, 1.0, true, true, true);
257 }
258 }
259 }
260
261 // What we want to add on our module planes
262
263 // DrawBranchPoints(fSiBTMCPoints_Tree, fSiBTMCPoints_Array, 0, NEvents_fSiBTMCPoints);
264 // DrawBranchHits(fSiBTHits_Tree, fSiBTHits_Array, 0, NEvents_fSiBTMCPoints);
265
266 DrawBranchPoints(fSiBTMCPoints_Tree, fSiBTMCPoints_Array, 0, 1);
267 DrawBranchHits(fSiBTHits_Tree, fSiBTHits_Array, 0, 1);
268
269 delete gTransfClass;
270 delete gStationSet;
271
272 cout << "It's the end" << "\n";
273 // gApplication->Terminate();
274}
275//------------------------------------------------------------------------------
276
277void DrawPointsAndLines(vector<Plane3D::Point> points,
278 TString hexcolor,
279 Int_t marker_style,
280 Double_t marker_size,
281 Double_t line_size,
282 Bool_t isPointDraw,
283 Bool_t isLinesDraw,
284 Bool_t isCloseLine)
285{
286 // Drawing the points as the markers ----------------------------------------
287 for (Int_t ipoint = 0; ipoint < points.size(); ++ipoint) {
288
289 // XY-plane -------------------------------------------------------------
290 // Markers on the XY plane
291 {
292 TMarker* marker = new TMarker(points[ipoint].X(), points[ipoint].Y(), marker_style);
293 marker->SetMarkerSize(marker_size);
294 marker->SetMarkerColor(TColor::GetColor(hexcolor));
295 planeXY_canv->cd();
296 if (isPointDraw)
297 marker->Draw();
298
299 // Lines between points on XY plane
300 Double_t x1, y1, x2, y2;
301 if (ipoint != points.size() - 1) {
302 x1 = points[ipoint].X();
303 y1 = points[ipoint].Y();
304 x2 = points[ipoint + 1].X();
305 y2 = points[ipoint + 1].Y();
306 } else {
307 if (isCloseLine) {
308 x1 = points[ipoint].X();
309 y1 = points[ipoint].Y();
310 x2 = points[0].X();
311 y2 = points[0].Y();
312 }
313 }
314 TLine* line = new TLine(x1, y1, x2, y2);
315 line->SetLineColor(TColor::GetColor(hexcolor));
316 line->SetLineWidth(line_size);
317 planeXY_canv->cd();
318 if (isLinesDraw)
319 line->Draw();
320 }
321 //----------------------------------------------------------------------
322
323 // ZX-plane -------------------------------------------------------------
324 // Markers on the ZX plane
325 {
326 TMarker* marker = new TMarker(points[ipoint].Z(), points[ipoint].X(), marker_style);
327 marker->SetMarkerSize(marker_size);
328 marker->SetMarkerColor(TColor::GetColor(hexcolor));
329 planeZX_canv->cd();
330 if (isPointDraw)
331 marker->Draw();
332
333 // Lines between points on ZX plane
334 Double_t z1, x1, z2, x2;
335 if (ipoint != points.size() - 1) {
336 z1 = points[ipoint].Z();
337 x1 = points[ipoint].X();
338 z2 = points[ipoint + 1].Z();
339 x2 = points[ipoint + 1].X();
340 } else {
341 if (isCloseLine) {
342 z1 = points[ipoint].Z();
343 x1 = points[ipoint].X();
344 z2 = points[0].Z();
345 x2 = points[0].X();
346 }
347 }
348 TLine* line = new TLine(z1, x1, z2, x2);
349 line->SetLineColor(TColor::GetColor(hexcolor));
350 line->SetLineWidth(line_size);
351 planeZX_canv->cd();
352 if (isLinesDraw)
353 line->Draw();
354 }
355 //----------------------------------------------------------------------
356
357 // ZY-plane -------------------------------------------------------------
358 // Markers on the XY plane
359 {
360 TMarker* marker = new TMarker(points[ipoint].Z(), points[ipoint].Y(), marker_style);
361 marker->SetMarkerSize(marker_size);
362 marker->SetMarkerColor(TColor::GetColor(hexcolor));
363 planeZY_canv->cd();
364 if (isPointDraw)
365 marker->Draw();
366
367 // Lines between points on XY plane
368 Double_t z1, y1, z2, y2;
369 if (ipoint != points.size() - 1) {
370 z1 = points[ipoint].Z();
371 y1 = points[ipoint].Y();
372 z2 = points[ipoint + 1].Z();
373 y2 = points[ipoint + 1].Y();
374 } else {
375 if (isCloseLine) {
376 z1 = points[ipoint].Z();
377 y1 = points[ipoint].Y();
378 z2 = points[0].Z();
379 y2 = points[0].Y();
380 }
381 }
382 TLine* line = new TLine(z1, y1, z2, y2);
383 line->SetLineColor(TColor::GetColor(hexcolor));
384 line->SetLineWidth(line_size);
385 planeZY_canv->cd();
386 if (isLinesDraw)
387 line->Draw();
388 }
389 //----------------------------------------------------------------------
390 }
391}
392
393void DrawPointsAndLines3D(vector<Plane3D::Point> points,
394 TString hexcolor,
395 Int_t marker_style,
396 Double_t marker_size,
397 Double_t line_size,
398 Bool_t isPointDraw,
399 Bool_t isLinesDraw,
400 Bool_t isCloseLine)
401{
402
403 // system coord XYZ---->ZXY
404
405 // points as the markers ----------------------------------------
406 TPolyMarker3D* markers = new TPolyMarker3D(points.size());
407 markers->SetMarkerColor(TColor::GetColor(hexcolor));
408 markers->SetMarkerStyle(marker_style);
409 markers->SetMarkerSize(marker_size);
410
411 // lines between points
412 TPolyLine3D* lines = new TPolyLine3D(points.size());
413 lines->SetLineColor(TColor::GetColor(hexcolor));
414 lines->SetLineWidth(line_size);
415
416 for (Int_t ipoint = 0; ipoint < points.size(); ++ipoint) {
417
418 markers->SetPoint(ipoint, points[ipoint].Z(), points[ipoint].X(), points[ipoint].Y());
419
420 if (ipoint != points.size() - 1) {
421 lines->SetPoint(ipoint, points[ipoint].Z(), points[ipoint].X(), points[ipoint].Y());
422 } else {
423 lines->SetPoint(ipoint, points[ipoint].Z(), points[ipoint].X(), points[ipoint].Y());
424 if (isCloseLine) {
425 lines->SetPoint(ipoint + 1, points[0].Z(), points[0].X(), points[0].Y());
426 }
427 }
428 }
429
430 XYZview_canv->cd();
431 if (isPointDraw)
432 markers->Draw();
433 if (isLinesDraw)
434 lines->Draw();
435}
436
437void DrawBranchPoints(TTree* points_tree, TClonesArray* points_array, Int_t first_event, Int_t last_event)
438{
439
440 vector<Plane3D::Point> tracks;
441 vector<Plane3D::Point> points;
442
443 for (Int_t ievent = first_event; ievent < last_event; ++ievent) {
444
445 points_tree->GetEntry(ievent);
446
447 Int_t npoints = points_array->GetEntries();
448
449 Int_t trackIdPrev = -1;
450 tracks.clear();
451
452 for (Int_t ipoint = 0; ipoint < npoints; ++ipoint) {
453
454 BmnSiBTPoint* mc_point = (BmnSiBTPoint*)points_array->At(ipoint);
455
456 Double_t x = ((FairMCPoint*)mc_point)->GetX();
457 Double_t y = ((FairMCPoint*)mc_point)->GetY();
458 Double_t z = ((FairMCPoint*)mc_point)->GetZ();
459
460 Double_t px = ((FairMCPoint*)mc_point)->GetPx();
461 Double_t py = ((FairMCPoint*)mc_point)->GetPy();
462 Double_t pz = ((FairMCPoint*)mc_point)->GetPz();
463
464 Int_t trackId = mc_point->GetTrackID();
465
466 Int_t station_num = mc_point->GetStation();
467 Int_t module_num = mc_point->GetModule();
468
469 // needs to determine point ownership using local positions
470 Plane3D::Point loc_point(x, y, z);
471 Plane3D::Point loc_direct(px + x, py + y, pz + z);
472 if (station_num < gStationSet->GetNStations()) {
473 if (module_num < gStationSet->GetStation(station_num)->GetNModules()) {
474 loc_point = gTransfClass->ApplyInverseTransforms(loc_point, station_num, module_num);
475 loc_direct = gTransfClass->ApplyInverseTransforms(loc_direct, station_num, module_num);
476 }
477 }
478 Double_t xloc = loc_point.X();
479 Double_t yloc = loc_point.Y();
480 Double_t zloc = loc_point.Z();
481
482 Double_t pxloc = loc_direct.X() - loc_point.X();
483 Double_t pyloc = loc_direct.Y() - loc_point.Y();
484 Double_t pzloc = loc_direct.Z() - loc_point.Z();
485
486 cout << "ipoint = " << ipoint << "\n";
487 cout << " x = " << x << "\n";
488 cout << " y = " << y << "\n";
489 cout << " z = " << z << "\n";
490 cout << " px = " << px << "\n";
491 cout << " py = " << py << "\n";
492 cout << " pz = " << pz << "\n";
493 cout << "\n";
494 cout << " xloc = " << xloc << "\n";
495 cout << " yloc = " << yloc << "\n";
496 cout << " zloc = " << zloc << "\n";
497 cout << " pxloc = " << pxloc << "\n";
498 cout << " pyloc = " << pyloc << "\n";
499 cout << " pzloc = " << pzloc << "\n";
500 cout << "\n";
501
502 Int_t current_station_num = -1;
503 Int_t current_module_num = -1;
504 Bool_t visual_status = false;
505 current_station_num = gStationSet->GetPointStationOwnership(-xloc, yloc, zloc);
506
507 if (current_station_num >= 0)
508 current_module_num =
509 gStationSet->GetStation(current_station_num)->GetPointModuleOwnership(-xloc, yloc, zloc);
510 if (current_station_num >= 0 && current_module_num >= 0)
511 visual_status = gConfig_visual[current_station_num][current_module_num];
512
513 cout << " current_station_num(point) = " << current_station_num << "\n";
514 cout << " current_module_num(point) = " << current_module_num << "\n";
515
516 TString point_color;
517 if (visual_status == true)
518 point_color = "#cc0000";
519 else
520 point_color = "#999999";
521
522 if (trackId != trackIdPrev) {
523 DrawPointsAndLines(tracks, "#ffbcad", 6, 1.0, 1.0, false, true, false);
524 DrawPointsAndLines3D(tracks, "#ffbcad", 6, 1.0, 1.0, false, true, false);
525 tracks.clear();
526 }
527 trackIdPrev = trackId;
528
529 tracks.push_back(Plane3D::Point(x, y, z));
530 points.push_back(Plane3D::Point(x, y, z));
531
532 DrawPointsAndLines(points, point_color, 20, 0.4, 1.0, true, false, false);
533 DrawPointsAndLines3D(points, point_color, 20, 0.4, 1.0, true, false, false);
534 points.clear();
535
536 // drawing directions of mc-points
537 vector<Plane3D::Point> direct_points;
538 direct_points.push_back(Plane3D::Point(x, y, z));
539 direct_points.push_back(Plane3D::Point(x + px * 10, y + py * 10, z + pz * 10)); // 10x scaling
540 DrawPointsAndLines(direct_points, point_color, 20, 0.4, 1.0, false, true, false);
541 DrawPointsAndLines3D(direct_points, point_color, 20, 0.4, 1.0, false, true, false);
542 direct_points.clear();
543 }
544 }
545}
546
547void DrawBranchHits(TTree* points_tree, TClonesArray* points_array, Int_t first_event, Int_t last_event)
548{
549
550 vector<Plane3D::Point> points;
551
552 for (Int_t ievent = first_event; ievent < last_event; ++ievent) {
553
554 points_tree->GetEntry(ievent);
555
556 Int_t npoints = points_array->GetEntries();
557
558 for (Int_t ihit = 0; ihit < npoints; ++ihit) {
559
560 BmnSiBTHit* hit = (BmnSiBTHit*)points_array->At(ihit);
561
562 Double_t x = hit->GetX();
563 Double_t y = hit->GetY();
564 Double_t z = hit->GetZ();
565
566 Int_t station_num = hit->GetStation();
567 Int_t module_num = hit->GetModule();
568
569 // needs to determine hit ownership using local positions
570 Plane3D::Point loc_hit(x, y, z);
571 if (station_num < gStationSet->GetNStations()) {
572 if (module_num < gStationSet->GetStation(station_num)->GetNModules()) {
573 loc_hit = gTransfClass->ApplyInverseTransforms(loc_hit, station_num, module_num);
574 }
575 }
576 Double_t xloc = loc_hit.X();
577 Double_t yloc = loc_hit.Y();
578 Double_t zloc = loc_hit.Z();
579
580 Int_t current_station_num = -1;
581 Int_t current_module_num = -1;
582 Bool_t visual_status = false;
583 current_station_num = gStationSet->GetPointStationOwnership(-xloc, yloc, zloc);
584
585 if (current_station_num >= 0)
586 current_module_num =
587 gStationSet->GetStation(current_station_num)->GetPointModuleOwnership(-xloc, yloc, zloc);
588 if (current_station_num >= 0 && current_module_num >= 0)
589 visual_status = gConfig_visual[current_station_num][current_module_num];
590
591 TString point_color;
592 if (visual_status == true)
593 point_color = "#0000cc";
594 else
595 point_color = "#ccccff";
596
597 points.push_back(Plane3D::Point(x, y, z));
598
599 DrawPointsAndLines(points, point_color, 6, 1.0, 1.0, true, false, false);
600 DrawPointsAndLines3D(points, point_color, 6, 1.0, 1.0, true, false, false);
601 points.clear();
602 }
603 }
604}
bool Bool_t
int Int_t
double Double_t
constexpr Bool_t kTRUE
#define R__ADD_INCLUDE_PATH(PATH)
#define gROOT
R__EXTERN TSystem * gSystem
Int_t GetModule()
Definition BmnHit.h:36
Short_t GetStation() const
Definition BmnHit.h:35
Int_t GetModule() const
Int_t GetStation() const
PositionVector3D< Cartesian3D< T >, DefaultCoordinateSystemTag > Point
virtual void SetLineWidth(Width_t lwidth)
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 SetAutoDelete(bool autodel=true)
static Int_t GetColor(const char *hexcolor)
T * Get(const char *namecycle)
TAxis * GetZaxis()
TAxis * GetXaxis()
TAxis * GetYaxis()
void Draw(Option_t *option="") override
void Draw(Option_t *option="") override
virtual void SetTitle(const char *title="")
Int_t GetEntries() const override
TObject * At(Int_t idx) const override
virtual void Draw(Option_t *option="")
virtual void SetPoint(Int_t point, Double_t x, Double_t y, Double_t z)
void Draw(Option_t *option="") override
void SetPoint(Int_t n, Double_t x, Double_t y, Double_t z)
void Draw(Option_t *option="") override
virtual TBranch * GetBranch(const char *name)
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
virtual Long64_t GetEntries() const
Int_t SetBranchAddress(const char *bname, T **add, TBranch **ptr=nullptr)
void TestSiBTClassTransform()
void DrawBranchHits(TTree *points_tree, TClonesArray *points_array, Int_t first_event, Int_t last_event)
void DrawPointsAndLines(vector< Plane3D::Point > points, TString hexcolor, Int_t marker_style, Double_t marker_size, Double_t line_size, Bool_t isPointDraw, Bool_t isLinesDraw, Bool_t isCloseLine)
void DrawPointsAndLines3D(vector< Plane3D::Point > points, TString hexcolor, Int_t marker_style, Double_t marker_size, Double_t line_size, Bool_t isPointDraw, Bool_t isLinesDraw, Bool_t isCloseLine)
void DrawBranchPoints(TTree *points_tree, TClonesArray *points_array, Int_t first_event, Int_t last_event)
TCanvas * planeXY_canv
vector< vector< Bool_t > > gConfig_visual
TCanvas * XYZview_canv
TCanvas * planeZX_canv
TCanvas * planeZY_canv
Definition json.hpp:4446