10 using namespace MuonR4;
13 std::vector<std::unique_ptr<TObject>>
clone(
const std::vector<std::unique_ptr<TObject>>& cloneMe) {
14 std::vector<std::unique_ptr<TObject>> cloned{};
15 for (
auto& obj : cloneMe) {
16 cloned.emplace_back(obj->Clone());
21 const double radius,
const int color,
22 const int fillStyle) {
23 auto ellipse = std::make_unique<TEllipse>(center.y(), center.z(), radius);
24 ellipse->SetLineColor(
color);
25 ellipse->SetFillStyle(fillStyle);
26 ellipse->SetLineWidth(1);
27 ellipse->SetFillColorAlpha(
color, 0.2);
31 const int color,
const int lineStyle,
const int view){
32 constexpr double arrowLength = 2.*Gaudi::Units::cm;
33 const Amg::Vector3D end = start + (arrowLength / std::hypot(dir[view], dir.z()) ) * dir;
34 auto arrow = std::make_unique<TArrow>(start[view], start.z(), end[view], end.z(),0.01);
35 arrow->SetLineColor(
color);
36 arrow->SetLineWidth(2);
37 arrow->SetLineStyle(lineStyle);
40 std::unique_ptr<TLatex>
drawLabel(
const std::string& text,
41 const double xPos,
const double yPos,
42 const double textSize,
45 auto tl = std::make_unique<TLatex>(xPos, yPos, text.c_str());
50 tl->SetTextSize(textSize);
51 tl->SetTextColor(
color);
55 const double boxWidth,
const double boxHeight,
56 const int color,
const int fillStyle,
58 return drawBox(boxCenter[view] - 0.5*boxWidth, boxCenter.z() - 0.5*boxHeight,
59 boxCenter[view] + 0.5*boxWidth, boxCenter.z() + 0.5*boxHeight,
62 std::unique_ptr<TBox>
drawBox(
const double x1,
const double y1,
63 const double x2,
const double y2,
64 const int color,
const int fillStyle) {
65 auto box = std::make_unique<TBox>(x1,y1,x2,y2);
66 box->SetFillColor(
color);
67 box->SetLineColor(
color);
68 box->SetFillStyle(fillStyle);
69 box->SetFillColorAlpha(
color, 0.8);
73 const double lowEnd,
const double highEnd,
74 const int color,
const int lineStyle,
76 const auto [pos, dir] =
makeLine(pars);
78 pos +
Amg::intersect<3>(pos,dir,Amg::Vector3D::UnitZ(), highEnd).value_or(0.)* dir,
79 color, lineStyle, view);
83 const int color,
const int lineStyle,
85 const double x1 = lowEnd[view];
86 const double y1 = lowEnd[
Amg::z];
87 const double x2 = highEnd[view];
88 const double y2 = highEnd[
Amg::z];
90 auto seedLine = std::make_unique<TLine>(x1, y1, x2, y2);
91 seedLine->SetLineColor(
color);
92 seedLine->SetLineWidth(2);
93 seedLine->SetLineStyle(lineStyle);
98 const std::string& status) {
99 return drawLabel(
"#font[72]{ATLAS} "+status, xPos, yPos);
103 const std::string_view sqrtS,
104 const std::string_view lumi) {
105 return drawLabel(std::format(
"#sqrt{{s}}={0} TeV {1}{2}", sqrtS, lumi, lumi.empty() ?
"" :
"fb^{-1}"), xPos, yPos);
std::optional< double > intersect(const AmgVector(N)&posA, const AmgVector(N)&dirA, const AmgVector(N)&posB, const AmgVector(N)&dirB)
Calculates the point B' along the line B that's closest to a second line A.
Eigen::Matrix< double, 3, 1 > Vector3D
std::pair< Amg::Vector3D, Amg::Vector3D > makeLine(const Parameters &pars)
Returns the parsed parameters into an Eigen line parametrization.
Acts::Experimental::CompositeSpacePointLineFitter::ParamVec_t Parameters
Lightweight algorithm to read xAOD MDT sim hits and (fast-digitised) drift circles from SG and fill a...
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)
Draws a line from the segment fit parameters.
std::unique_ptr< TLatex > drawLabel(const std::string &text, const double xPos, const double yPos, const double textSize=18, const bool useNDC=true, const int color=kBlack)
Create a TLatex label,.
std::vector< std::unique_ptr< TObject > > clone(const std::vector< std::unique_ptr< TObject > > &cloneMe)
std::unique_ptr< TEllipse > drawDriftCircle(const Amg::Vector3D ¢er, const double radius, const int color=kViolet, const int fillStyle=hollowFilling)
Create a TEllipse for drawing a drift circle.
std::unique_ptr< TArrow > drawArrow(const Amg::Vector3D &start, const Amg::Vector3D &dir, const int color=kRed+1, const int lineStyle=kDashed, const int view=objViewEta)
Draw an arror between two endpoints in the y-z or the x-z plane.
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.
std::unique_ptr< TLatex > drawAtlasLabel(const double xPos, const double yPos, const std::string &status="Internal")
Create a ATLAS label.
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.