BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
TestSiliconClassTransform.C
Go to the documentation of this file.
1/*
2 * This macro for testing configurations of the Forward Silicon detector
3 * which have some module transformations in an 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: 27.01.2022
10 * Updated: 09.02.2022 (Transforms added)
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 Silicon
57 TClonesArray* fSiliconMCPoints_Array = new TClonesArray("");
58 TString fSiliconMCPoints_FileName = "$VMCWORKDIR/macro/run/bmnsim";
59 fSiliconMCPoints_FileName += file_prefix;
60 fSiliconMCPoints_FileName += ".root";
61 TFile* fSiliconMCPoints_File = new TFile(fSiliconMCPoints_FileName, "READ");
62 TTree* fSiliconMCPoints_Tree = (TTree*)fSiliconMCPoints_File->Get("bmndata");
63 fSiliconMCPoints_Tree->GetBranch("SiliconPoint")->SetAutoDelete(kTRUE);
64 fSiliconMCPoints_Tree->SetBranchAddress("SiliconPoint", &fSiliconMCPoints_Array);
65 Int_t NEvents_fSiliconMCPoints = fSiliconMCPoints_Tree->GetEntries();
66
67 // Input hits for Silicon
68 TClonesArray* fSiliconHits_Array = new TClonesArray("");
69 TString fSiliconHits_FileName = "$VMCWORKDIR/macro/run/bmndst";
70 fSiliconHits_FileName += file_prefix;
71 fSiliconHits_FileName += ".root";
72 TFile* fSiliconHits_File = new TFile(fSiliconHits_FileName, "READ");
73 TTree* fSiliconHits_Tree = (TTree*)fSiliconHits_File->Get("bmndata");
74 fSiliconHits_Tree->GetBranch("BmnSiliconHit")->SetAutoDelete(kTRUE);
75 fSiliconHits_Tree->SetBranchAddress("BmnSiliconHit", &fSiliconHits_Array);
76 Int_t NEvents_fSiliconHits = fSiliconHits_Tree->GetEntries();
77
78 //------------------------------------------------------------------------------
79
80 Double_t scale_coeff = 1;
81 Double_t xmin_view = -40.0 * scale_coeff;
82 Double_t xmax_view = +40.0 * scale_coeff;
83 Double_t ymin_view = -40.0 * scale_coeff;
84 Double_t ymax_view = +40.0 * scale_coeff;
85 Double_t zmin_view = -10.0 * scale_coeff; // was -100
86 Double_t zmax_view = +100.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/silicon/XMLConfigs/";
127 // gPathDetectorConfig += "/macro/detectors/silicon/";
128
129 // gPathDetectorConfig += "SiliconRun8_mods_6_10_14_18.xml";
130 // gPathDetectorConfig += "SiliconRun8_3stations.xml";
131 // gPathDetectorConfig += "SiliconRun8_mods_10_14rot_18.xml";
132 // gPathDetectorConfig += "SiliconRun8_mods_6_10_14_18.xml";
133 gPathDetectorConfig += "SiliconRun9.xml";
134 // gPathDetectorConfig += "Silicon_Test.xml";
135
136 // Current configuration
137 gStationSet = new BmnSiliconStationSet(gPathDetectorConfig);
138
139 // Current transform configuration
141 gTransfClass->LoadFromXMLFile(gPathDetectorConfig);
142
143 // Selecting modules to visualize -------------------------------------------
144 gConfig_visual.resize(gStationSet->GetNStations()); // quantity of stations
145 for (Int_t istation = 0; istation < gConfig_visual.size(); ++istation) {
146 gConfig_visual[istation].resize(gStationSet->GetStation(istation)->GetNModules(), false); // default: inactive
147 }
148
149 for (Int_t istation = 0; istation < gStationSet->GetNStations(); ++istation) {
150 for (Int_t imodule = 0; imodule < gStationSet->GetStation(istation)->GetNModules(); ++imodule) {
151 gConfig_visual[istation][imodule] = true;
152 }
153 }
154
155 // gConfig_visual[0][0] = true;
156 // gConfig_visual[0][1] = true;
157 // gConfig_visual[0][2] = true;
158 // gConfig_visual[0][3] = true;
159 // gConfig_visual[1][0] = true;
160 // gConfig_visual[2][0] = true;
161 // gConfig_visual[3][0] = true;
162 // gConfig_visual[4][0] = true;
163 // gConfig_visual[4][1] = true;
164 // gConfig_visual[5][0] = true;
165 // gConfig_visual[5][1] = true;
166 // gConfig_visual[6][0] = true;
167 // gConfig_visual[6][1] = true;
168 // gConfig_visual[7][0] = true;
169 // gConfig_visual[7][1] = true;
170 // gConfig_visual[8][0] = true;
171 // gConfig_visual[8][1] = true;
172 // gConfig_visual[9][0] = true;
173 // gConfig_visual[9][1] = true;
174
175 // Printing the info about the visual status of modules
176 if (1) {
177 cout << "Info about the visual status of modules:\n";
178 for (Int_t istation = 0; istation < gConfig_visual.size(); ++istation) {
179 for (Int_t imodule = 0; imodule < gConfig_visual[istation].size(); ++imodule) {
180 cout << "det[" << istation << "][" << imodule << "] = " << gConfig_visual[istation][imodule] << "\n";
181 }
182 }
183 cout << "\n";
184 }
185 //--------------------------------------------------------------------------
186
187 planeXY_canv->cd();
188 planeXY_h2->Draw();
189
190 planeZX_canv->cd();
191 planeZX_h2->Draw();
192
193 planeZY_canv->cd();
194 planeZY_h2->Draw();
195
196 XYZview_canv->cd();
197 XYZview_h3->Draw();
198
199 for (Int_t istation = 0; istation < gStationSet->GetNStations(); ++istation) {
200
201 for (Int_t imodule = 0; imodule < gStationSet->GetStation(istation)->GetNModules(); ++imodule) {
202
203 Bool_t visual_status = gConfig_visual[istation][imodule];
204
205 if (visual_status == true) {
206
207 BmnSiliconModule* module = gStationSet->GetStation(istation)->GetModule(imodule);
208
209 // parameters of the current module in local coordinates
210 Double_t xmin_module = module->GetXMinModule();
211 Double_t xmax_module = module->GetXMaxModule();
212 Double_t ymin_module = module->GetYMinModule();
213 Double_t ymax_module = module->GetYMaxModule();
214 Double_t z_start_pos_module =
215 gStationSet->GetStation(istation)->GetModule(imodule)->GetZStartModulePosition();
216 Double_t z_reg_module = gStationSet->GetStation(istation)->GetModule(imodule)->GetZPositionRegistered();
217
218 // print parameters of the module
219 if (1) {
220 cout << " station[" << istation << "], module[" << imodule << "]:\n";
221 cout << " xloc_module(min:max) = ( " << xmin_module << " : " << xmax_module << ")\n";
222 cout << " yloc_module(min:max) = ( " << ymin_module << " : " << ymax_module << ")\n";
223 cout << " zloc_start_pos_module = " << z_start_pos_module << "\n";
224 cout << " zloc_reg_module = " << z_reg_module << "\n";
225 cout << "\n";
226 }
227
228 vector<Plane3D::Point> module_borders;
229 vector<Plane3D::Point> tmodule_borders; // transformed
230 vector<Plane3D::Point> rtmodule_borders; // inverse transformed
231
232 Double_t x_p0 = xmin_module;
233 Double_t y_p0 = ymin_module;
234
235 Double_t x_p1 = xmin_module;
236 Double_t y_p1 = ymax_module;
237
238 Double_t x_p2 = xmax_module;
239 Double_t y_p2 = ymax_module;
240
241 Double_t x_p3 = xmax_module;
242 Double_t y_p3 = ymin_module;
243
244 module_borders.push_back(Plane3D::Point(-x_p0, y_p0, z_reg_module)); // x converted to global
245 module_borders.push_back(Plane3D::Point(-x_p1, y_p1, z_reg_module)); // x converted to global
246 module_borders.push_back(Plane3D::Point(-x_p2, y_p2, z_reg_module)); // x converted to global
247 module_borders.push_back(Plane3D::Point(-x_p3, y_p3, z_reg_module)); // x converted to global
248
249 for (Int_t ipoint = 0; ipoint < module_borders.size(); ++ipoint) {
250 tmodule_borders.push_back(gTransfClass->ApplyTransforms(module_borders[ipoint], istation, imodule));
251 // tmodule_borders.push_back(module_borders[ipoint]);
252 }
253
254 // DrawPointsAndLines(module_borders, "#cc0000", 20, 1.0, 1.0, false, true, true);
255 DrawPointsAndLines(tmodule_borders, "#00cc00", 20, 1.0, 1.0, false, true, true);
256 // DrawPointsAndLines(rtmodule_borders, "#0000cc", 20, 1.0, 1.0, true, true, true);
257
258 // DrawPointsAndLines3D(module_borders, "#cc0000", 20, 0.5, 1.0, false, true, true);
259 DrawPointsAndLines3D(tmodule_borders, "#00cc00", 20, 0.5, 1.0, false, true, true);
260 // DrawPointsAndLines3D(rtmodule_borders, "#0000cc", 20, 0.5, 1.0, true, true, true);
261 }
262 }
263 };
264 // DrawBranchPoints(fSiliconMCPoints_Tree, fSiliconMCPoints_Array, 0, NEvents_fSiliconMCPoints);
265 // DrawBranchHits(fSiliconHits_Tree, fSiliconHits_Array, 0, NEvents_fSiliconMCPoints);
266
267 DrawBranchPoints(fSiliconMCPoints_Tree, fSiliconMCPoints_Array, 0, 1);
268 DrawBranchHits(fSiliconHits_Tree, fSiliconHits_Array, 0, 1);
269
270 // delete gTransfClass;
271 delete gStationSet;
272
273 cout << "It's the end" << "\n";
274 // gApplication->Terminate();
275}
276//------------------------------------------------------------------------------
277
278void DrawPointsAndLines(vector<Plane3D::Point> points,
279 TString hexcolor,
280 Int_t marker_style,
281 Double_t marker_size,
282 Double_t line_size,
283 Bool_t isPointDraw,
284 Bool_t isLinesDraw,
285 Bool_t isCloseLine)
286{
287 // Drawing the points as the markers ----------------------------------------
288 for (Int_t ipoint = 0; ipoint < points.size(); ++ipoint) {
289
290 // XY-plane -------------------------------------------------------------
291 // Markers on the XY plane
292 {
293 TMarker* marker = new TMarker(points[ipoint].X(), points[ipoint].Y(), marker_style);
294 marker->SetMarkerSize(marker_size);
295 marker->SetMarkerColor(TColor::GetColor(hexcolor));
296 planeXY_canv->cd();
297 if (isPointDraw)
298 marker->Draw();
299
300 // Lines between points on XY plane
301 Double_t x1, y1, x2, y2;
302 if (ipoint != points.size() - 1) {
303 x1 = points[ipoint].X();
304 y1 = points[ipoint].Y();
305 x2 = points[ipoint + 1].X();
306 y2 = points[ipoint + 1].Y();
307 } else {
308 if (isCloseLine) {
309 x1 = points[ipoint].X();
310 y1 = points[ipoint].Y();
311 x2 = points[0].X();
312 y2 = points[0].Y();
313 }
314 }
315 TLine* line = new TLine(x1, y1, x2, y2);
316 line->SetLineColor(TColor::GetColor(hexcolor));
317 line->SetLineWidth(line_size);
318 planeXY_canv->cd();
319 if (isLinesDraw)
320 line->Draw();
321 }
322 //----------------------------------------------------------------------
323
324 // ZX-plane -------------------------------------------------------------
325 // Markers on the ZX plane
326 {
327 TMarker* marker = new TMarker(points[ipoint].Z(), points[ipoint].X(), marker_style);
328 marker->SetMarkerSize(marker_size);
329 marker->SetMarkerColor(TColor::GetColor(hexcolor));
330 planeZX_canv->cd();
331 if (isPointDraw)
332 marker->Draw();
333
334 // Lines between points on ZX plane
335 Double_t z1, x1, z2, x2;
336 if (ipoint != points.size() - 1) {
337 z1 = points[ipoint].Z();
338 x1 = points[ipoint].X();
339 z2 = points[ipoint + 1].Z();
340 x2 = points[ipoint + 1].X();
341 } else {
342 if (isCloseLine) {
343 z1 = points[ipoint].Z();
344 x1 = points[ipoint].X();
345 z2 = points[0].Z();
346 x2 = points[0].X();
347 }
348 }
349 TLine* line = new TLine(z1, x1, z2, x2);
350 line->SetLineColor(TColor::GetColor(hexcolor));
351 line->SetLineWidth(line_size);
352 planeZX_canv->cd();
353 if (isLinesDraw)
354 line->Draw();
355 }
356 //----------------------------------------------------------------------
357
358 // ZY-plane -------------------------------------------------------------
359 // Markers on the XY plane
360 {
361 TMarker* marker = new TMarker(points[ipoint].Z(), points[ipoint].Y(), marker_style);
362 marker->SetMarkerSize(marker_size);
363 marker->SetMarkerColor(TColor::GetColor(hexcolor));
364 planeZY_canv->cd();
365 if (isPointDraw)
366 marker->Draw();
367
368 // Lines between points on XY plane
369 Double_t z1, y1, z2, y2;
370 if (ipoint != points.size() - 1) {
371 z1 = points[ipoint].Z();
372 y1 = points[ipoint].Y();
373 z2 = points[ipoint + 1].Z();
374 y2 = points[ipoint + 1].Y();
375 } else {
376 if (isCloseLine) {
377 z1 = points[ipoint].Z();
378 y1 = points[ipoint].Y();
379 z2 = points[0].Z();
380 y2 = points[0].Y();
381 }
382 }
383 TLine* line = new TLine(z1, y1, z2, y2);
384 line->SetLineColor(TColor::GetColor(hexcolor));
385 line->SetLineWidth(line_size);
386 planeZY_canv->cd();
387 if (isLinesDraw)
388 line->Draw();
389 }
390 //----------------------------------------------------------------------
391 }
392}
393
394void DrawPointsAndLines3D(vector<Plane3D::Point> points,
395 TString hexcolor,
396 Int_t marker_style,
397 Double_t marker_size,
398 Double_t line_size,
399 Bool_t isPointDraw,
400 Bool_t isLinesDraw,
401 Bool_t isCloseLine)
402{
403
404 // system coord XYZ---->ZXY
405
406 // points as the markers ----------------------------------------
407 TPolyMarker3D* markers = new TPolyMarker3D(points.size());
408 markers->SetMarkerColor(TColor::GetColor(hexcolor));
409 markers->SetMarkerStyle(marker_style);
410 markers->SetMarkerSize(marker_size);
411
412 // lines between points
413 TPolyLine3D* lines = new TPolyLine3D(points.size());
414 lines->SetLineColor(TColor::GetColor(hexcolor));
415 lines->SetLineWidth(line_size);
416
417 for (Int_t ipoint = 0; ipoint < points.size(); ++ipoint) {
418
419 markers->SetPoint(ipoint, points[ipoint].Z(), points[ipoint].X(), points[ipoint].Y());
420
421 if (ipoint != points.size() - 1) {
422 lines->SetPoint(ipoint, points[ipoint].Z(), points[ipoint].X(), points[ipoint].Y());
423 } else {
424 lines->SetPoint(ipoint, points[ipoint].Z(), points[ipoint].X(), points[ipoint].Y());
425 if (isCloseLine) {
426 lines->SetPoint(ipoint + 1, points[0].Z(), points[0].X(), points[0].Y());
427 }
428 }
429 }
430
431 XYZview_canv->cd();
432 if (isPointDraw)
433 markers->Draw();
434 if (isLinesDraw)
435 lines->Draw();
436}
437
438void DrawBranchPoints(TTree* points_tree, TClonesArray* points_array, Int_t first_event, Int_t last_event)
439{
440
441 vector<Plane3D::Point> tracks;
442 vector<Plane3D::Point> points;
443
444 for (Int_t ievent = first_event; ievent < last_event; ++ievent) {
445
446 points_tree->GetEntry(ievent);
447
448 Int_t npoints = points_array->GetEntries();
449
450 Int_t trackIdPrev = -1;
451 tracks.clear();
452
453 for (Int_t ipoint = 0; ipoint < npoints; ++ipoint) {
454
455 BmnSiliconPoint* mc_point = (BmnSiliconPoint*)points_array->At(ipoint);
456
457 Double_t x = ((FairMCPoint*)mc_point)->GetX();
458 Double_t y = ((FairMCPoint*)mc_point)->GetY();
459 Double_t z = ((FairMCPoint*)mc_point)->GetZ();
460
461 Double_t px = ((FairMCPoint*)mc_point)->GetPx();
462 Double_t py = ((FairMCPoint*)mc_point)->GetPy();
463 Double_t pz = ((FairMCPoint*)mc_point)->GetPz();
464
465 Int_t trackId = mc_point->GetTrackID();
466
467 Int_t station_num = mc_point->GetStation();
468 Int_t module_num = mc_point->GetModule();
469
470 // cout << "station_num = " << station_num << "\n";
471 // cout << "module_num = " << module_num << "\n";
472
473 // needs to determine point ownership using local positions
474 Plane3D::Point loc_point(x, y, z);
475 Plane3D::Point loc_direct(px + x, py + y, pz + z);
476 if (station_num < gStationSet->GetNStations()) {
477 if (module_num < gStationSet->GetStation(station_num)->GetNModules()) {
478 loc_point = gTransfClass->ApplyInverseTransforms(loc_point, station_num, module_num);
479 loc_direct = gTransfClass->ApplyInverseTransforms(loc_direct, station_num, module_num);
480 }
481 }
482 Double_t xloc = loc_point.X();
483 Double_t yloc = loc_point.Y();
484 Double_t zloc = loc_point.Z();
485
486 Double_t pxloc = loc_direct.X() - loc_point.X();
487 Double_t pyloc = loc_direct.Y() - loc_point.Y();
488 Double_t pzloc = loc_direct.Z() - loc_point.Z();
489
490 if (0) {
491 cout << "ipoint = " << ipoint << "\n";
492 cout << " x = " << x << "\n";
493 cout << " y = " << y << "\n";
494 cout << " z = " << z << "\n";
495 cout << " px = " << px << "\n";
496 cout << " py = " << py << "\n";
497 cout << " pz = " << pz << "\n";
498 cout << "\n";
499 cout << " xloc = " << xloc << "\n";
500 cout << " yloc = " << yloc << "\n";
501 cout << " zloc = " << zloc << "\n";
502 cout << " pxloc = " << pxloc << "\n";
503 cout << " pyloc = " << pyloc << "\n";
504 cout << " pzloc = " << pzloc << "\n";
505 cout << "\n";
506 }
507
508 Int_t current_station_num = -1;
509 Int_t current_module_num = -1;
510 Bool_t visual_status = false;
511 current_station_num = gStationSet->GetPointStationOwnership(-xloc, yloc, zloc);
512 // current_station_num = gStationSet->GetPointStationOwnership(zloc);
513
514 if (current_station_num >= 0)
515 current_module_num =
516 gStationSet->GetStation(current_station_num)->GetPointModuleOwnership(-xloc, yloc, zloc);
517 if (current_station_num >= 0 && current_module_num >= 0)
518 visual_status = gConfig_visual[current_station_num][current_module_num];
519
520 TString point_color;
521 if (visual_status == true)
522 point_color = "#cc0000";
523 else
524 point_color = "#999999";
525
526 if (trackId != trackIdPrev) {
527 DrawPointsAndLines(tracks, "#ffbcad", 6, 1.0, 1.0, false, true, false);
528 DrawPointsAndLines3D(tracks, "#ffbcad", 6, 1.0, 1.0, false, true, false);
529 tracks.clear();
530 }
531 trackIdPrev = trackId;
532
533 tracks.push_back(Plane3D::Point(x, y, z));
534 points.push_back(Plane3D::Point(x, y, z));
535
536 DrawPointsAndLines(points, point_color, 20, 0.4, 1.0, true, false, false);
537 DrawPointsAndLines3D(points, point_color, 20, 0.4, 1.0, true, false, false);
538 points.clear();
539
540 // drawing directions of mc-points
541 vector<Plane3D::Point> direct_points;
542 direct_points.push_back(Plane3D::Point(x, y, z));
543 direct_points.push_back(Plane3D::Point(x + px * 10, y + py * 10, z + pz * 10)); // 10x scaling
544 DrawPointsAndLines(direct_points, point_color, 20, 0.4, 0.5, false, true, false);
545 DrawPointsAndLines3D(direct_points, point_color, 20, 0.4, 0.5, false, true, false);
546 direct_points.clear();
547 }
548 }
549}
550
551void DrawBranchHits(TTree* points_tree, TClonesArray* points_array, Int_t first_event, Int_t last_event)
552{
553
554 vector<Plane3D::Point> points;
555
556 for (Int_t ievent = first_event; ievent < last_event; ++ievent) {
557
558 points_tree->GetEntry(ievent);
559
560 Int_t npoints = points_array->GetEntries();
561
562 for (Int_t ihit = 0; ihit < npoints; ++ihit) {
563
564 BmnSiliconHit* hit = (BmnSiliconHit*)points_array->At(ihit);
565
566 Double_t x = hit->GetX();
567 Double_t y = hit->GetY();
568 Double_t z = hit->GetZ();
569
570 Int_t station_num = hit->GetStation();
571 Int_t module_num = hit->GetModule();
572
573 // needs to determine hit ownership using local positions
574 Plane3D::Point loc_hit(x, y, z);
575 if (station_num < gStationSet->GetNStations()) {
576 if (module_num < gStationSet->GetStation(station_num)->GetNModules()) {
577 loc_hit = gTransfClass->ApplyInverseTransforms(loc_hit, station_num, module_num);
578 }
579 }
580 Double_t xloc = loc_hit.X();
581 Double_t yloc = loc_hit.Y();
582 Double_t zloc = loc_hit.Z();
583
584 Int_t current_station_num = -1;
585 Int_t current_module_num = -1;
586 Bool_t visual_status = false;
587 current_station_num = gStationSet->GetPointStationOwnership(-xloc, yloc, zloc);
588 // current_station_num = gStationSet->GetPointStationOwnership(zloc);
589
590 if (current_station_num >= 0)
591 current_module_num =
592 gStationSet->GetStation(current_station_num)->GetPointModuleOwnership(-xloc, yloc, zloc);
593 if (current_station_num >= 0 && current_module_num >= 0)
594 visual_status = gConfig_visual[current_station_num][current_module_num];
595
596 TString point_color;
597 if (visual_status == true)
598 point_color = "#0000cc";
599 else
600 point_color = "#ccccff";
601
602 points.push_back(Plane3D::Point(x, y, z));
603
604 DrawPointsAndLines(points, point_color, 6, 1.0, 1.0, true, false, false);
605 DrawPointsAndLines3D(points, point_color, 6, 1.0, 1.0, true, false, false);
606 points.clear();
607 }
608 }
609}
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
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 TestSiliconClassTransform()
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