ATLAS Offline Software
VisualizationHelpers.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
5 
7 #include <format>
8 
9 namespace MuonValR4{
10  using namespace MuonR4;
11  using namespace SegmentFit;
12  std::unique_ptr<TEllipse> drawDriftCircle(const Amg::Vector3D& center,
13  const double radius, const int color,
14  const int fillStyle) {
15  auto ellipse = std::make_unique<TEllipse>(center.y(), center.z(), radius);
16  ellipse->SetLineColor(color);
17  ellipse->SetFillStyle(fillStyle);
18  ellipse->SetLineWidth(1);
19  ellipse->SetFillColorAlpha(color, 0.2);
20  return ellipse;
21  }
22 
23  std::unique_ptr<TLatex> drawLabel(const std::string& text,
24  const double xPos, const double yPos,
25  const unsigned int fontSize) {
26  auto tl = std::make_unique<TLatex>(xPos, yPos, text.c_str());
27  tl->SetNDC();
28  tl->SetTextFont(43);
29  tl->SetTextSize(fontSize);
30  return tl;
31  }
32  std::unique_ptr<TBox> drawBox(const Amg::Vector3D& boxCenter,
33  const double boxWidth, const double boxHeight,
34  const int color, const int fillStyle,
35  const int view) {
36  return drawBox(boxCenter[view] - 0.5*boxWidth, boxCenter.z() - 0.5*boxHeight,
37  boxCenter[view] + 0.5*boxWidth, boxCenter.z() + 0.5*boxHeight,
38  color, fillStyle);
39  }
40  std::unique_ptr<TBox> drawBox(const double x1, const double y1,
41  const double x2, const double y2,
42  const int color, const int fillStyle) {
43  auto box = std::make_unique<TBox>(x1,y1,x2,y2);
44  box->SetFillColor(color);
45  box->SetLineColor(color);
46  box->SetFillStyle(fillStyle);
47  box->SetFillColorAlpha(color, 0.8);
48  return box;
49  }
50  std::unique_ptr<TLine> drawLine(const Parameters& pars,
51  const double lowEnd, const double highEnd,
52  const int color, const int lineStyle,
53  const int view) {
54  const auto [pos, dir] = makeLine(pars);
55  const double x1 = (pos + Amg::intersect<3>(pos,dir,Amg::Vector3D::UnitZ(), lowEnd).value_or(0.)* dir)[view];
56  const double x2 = (pos + Amg::intersect<3>(pos,dir,Amg::Vector3D::UnitZ(), highEnd).value_or(0.)* dir)[view];
57  auto seedLine = std::make_unique<TLine>(x1, lowEnd, x2, highEnd);
58  seedLine->SetLineColor(color);
59  seedLine->SetLineWidth(2);
60  seedLine->SetLineStyle(lineStyle);
61  return seedLine;
62  }
63  std::unique_ptr<TLatex> drawAtlasLabel(const double xPos, const double yPos,
64  const std::string& status) {
65  return drawLabel( "#font[72]{ATLAS} "+status, xPos, yPos);
66  }
67  std::unique_ptr<TLatex> drawLumiSqrtS(const double xPos,
68  const double yPos,
69  const std::string_view sqrtS,
70  const std::string_view lumi) {
71  return drawLabel(std::format("#sqrt{{s}}={0} TeV {1}{2}", sqrtS, lumi, lumi.empty() ? "" : "fb^{-1}"), xPos, yPos);
72  }
73 }
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
color
Definition: jFexInputByteStreamTool.cxx:25
MuonR4::SegmentFit::Parameters
AmgVector(toInt(ParamDefs::nPars)) Parameters
Definition: MuonHoughDefs.h:48
vtune_athena.format
format
Definition: vtune_athena.py:14
VisualizationHelpers.h
plotBeamSpotCompare.x2
x2
Definition: plotBeamSpotCompare.py:218
MuonValR4::drawBox
std::unique_ptr< TBox > drawBox(const Amg::Vector3D &boxCenter, const double boxWidth, const double boxHeight, const int color=kGreen+2, const int fillStyle=hollowFilling, const int view=objViewEta)
Creates a box for drawing, e.g strip measurements.
Definition: VisualizationHelpers.cxx:32
MuonValR4::drawLine
std::unique_ptr< TLine > drawLine(const MuonR4::SegmentFit::Parameters &pars, const double lowEnd, const double highEnd, const int color=kRed+1, const int lineStyle=kDashed, const int view=objViewEta)
Definition: VisualizationHelpers.cxx:50
MuonR4::SegmentFit::makeLine
std::pair< Amg::Vector3D, Amg::Vector3D > makeLine(const Parameters &pars)
Returns the parsed parameters into an Eigen line parametrization.
Definition: SegmentFitterEventData.cxx:26
MuonValR4::drawLabel
std::unique_ptr< TLatex > drawLabel(const std::string &text, const double xPos, const double yPos, const unsigned int fontSize=18)
Create a TLatex label,.
Definition: VisualizationHelpers.cxx:23
makeTRTBarrelCans.y1
tuple y1
Definition: makeTRTBarrelCans.py:15
makeTRTBarrelCans.y2
tuple y2
Definition: makeTRTBarrelCans.py:18
beamspotman.dir
string dir
Definition: beamspotman.py:623
MuonValR4
Lightweight algorithm to read xAOD MDT sim hits and (fast-digitised) drift circles from SG and fill a...
Definition: IPatternVisualizationTool.h:23
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
ParticleGun_SamplingFraction.radius
radius
Definition: ParticleGun_SamplingFraction.py:96
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
MuonR4
This header ties the generic definitions in this package.
Definition: HoughEventData.h:16
lumiFormat.lumi
lumi
Definition: lumiFormat.py:106
GeoPrimitivesHelpers.h
makeTransCanvas.text
text
Definition: makeTransCanvas.py:11
MuonValR4::drawDriftCircle
std::unique_ptr< TEllipse > drawDriftCircle(const Amg::Vector3D &center, const double radius, const int color=kViolet, const int fillStyle=hollowFilling)
Create a TEllipse for drawing a drift circle.
Definition: VisualizationHelpers.cxx:12
MuonValR4::drawAtlasLabel
std::unique_ptr< TLatex > drawAtlasLabel(const double xPos, const double yPos, const std::string &status="Internal")
Create a ATLAS label.
Definition: VisualizationHelpers.cxx:63
merge.status
status
Definition: merge.py:17
dqt_zlumi_alleff_HIST.tl
tl
Definition: dqt_zlumi_alleff_HIST.py:73
MuonValR4::drawLumiSqrtS
std::unique_ptr< TLatex > drawLumiSqrtS(const double xPos, const double yPos, const std::string_view sqrtS="14", const std::string_view lumi="")
Create a luminosity sqrtS label.
Definition: VisualizationHelpers.cxx:67
drawFromPickle.view
view
Definition: drawFromPickle.py:294