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