 |
ATLAS Offline Software
|
#include <TrackVisualizationTool.h>
|
struct | PlotLegend |
| Helper struct to administer the markers & colors that are added to the legend. More...
|
|
|
std::unique_ptr< TCanvas > | makeCanvas (const EventContext &ctx, const BoundBox_t &bounds, const AxisLabels_t &axisLabels) const |
| Creates a new TCanvas for drawing. More...
|
|
void | closeSummaryCanvas () const |
| Closes the summary canvas & closes the associated ROOT file. More...
|
|
void | displaySeeds (const EventContext &ctx, const MuonR4::MsTrackSeeder &seederObj, const DisplayView view, const xAOD::MuonSegmentContainer &segments, const MuonR4::MsTrackSeedContainer &seeds, const std::string &extraLabel, PrimitivesVec_t &extPrimitives) const |
| Actual implementation of the display seeds method with the augmentation to define the view. More...
|
|
void | fillTruthSeedPoints (const EventContext &ctx, const MuonR4::MsTrackSeeder &seeder, const DisplayView view, PlotLegend &legend, PrimitivesVec_t &drawPrim) const |
| Add the truth segments to the canvas. More...
|
|
|
SG::ReadHandleKey< xAOD::MuonSegmentContainer > | m_truthSegKey {this, "TruthSegkey", "TruthSegmentsR4"} |
| Key to the truth segment selection to draw the segment parameters. More...
|
|
Gaudi::Property< unsigned > | m_canvasLimit {this, "CanvasLimit", 5000} |
| Maximum canvases to draw. More...
|
|
Gaudi::Property< bool > | m_saveSinglePDFs {this, "saveSinglePDFs", true} |
| If set to true each canvas is saved into a dedicated pdf file. More...
|
|
Gaudi::Property< bool > | m_saveSummaryPDF {this, "saveSummaryPDF", false} |
| If set to true a summary Canvas is created. More...
|
|
Gaudi::Property< std::string > | m_allCanName {this, "AllCanvasName", "AllMsTrackPlots"} |
| Name of the summary canvas & the ROOT file to save the monitoring plots. More...
|
|
Gaudi::Property< std::string > | m_canvasPrefix {this, "CanvasPreFix", "MsTrackValid"} |
| Prefix of the individual canvas file names <MANDATORY>
More...
|
|
Gaudi::Property< unsigned > | m_canvasWidth {this, "CanvasWidth", 800} |
| Canvas dimensions. More...
|
|
Gaudi::Property< unsigned > | m_canvasHeight {this, "CanvasHeight", 600} |
|
Gaudi::Property< std::string > | m_AtlasLabel {this, "AtlasLabel", "Internal"} |
| ATLAS label (Internal / Prelimnary / Simulation) More...
|
|
Gaudi::Property< std::string > | m_sqrtSLabel {this, "SqrtSLabel", "14"} |
| Centre of mass energy label. More...
|
|
Gaudi::Property< std::string > | m_lumiLabel {this, "LumiLabel", ""} |
| Luminosity label. More...
|
|
std::unique_ptr< TCanvas > m_summaryCan | ATLAS_THREAD_SAFE {} |
|
std::unique_ptr< TFile > m_outFile | ATLAS_THREAD_SAFE {} |
|
std::atomic< unsigned int > m_canvCounter | ATLAS_THREAD_SAFE {0} |
|
|
static std::mutex | s_mutex {} |
| Abrivation of the helper struct to determine the Canvas dimensions. More...
|
|
Definition at line 21 of file TrackVisualizationTool.h.
◆ AxisLabels_t
◆ BoundBox_t
◆ Location
Enumeration to toggle whether the segment shall displayed on the barrel/endcap.
Definition at line 84 of file TrackVisualizationTool.h.
◆ DisplayView
◆ ~TrackVisualizationTool()
virtual MuonValR4::TrackVisualizationTool::~TrackVisualizationTool |
( |
| ) |
|
|
virtualdefault |
◆ closeSummaryCanvas()
void MuonValR4::TrackVisualizationTool::closeSummaryCanvas |
( |
| ) |
const |
|
private |
◆ displaySeeds() [1/3]
Actual implementation of the display seeds method with the augmentation to define the view.
- Parameters
-
ctx | EventContext to access store gate & conditions |
seederObj | Configured instance of the track seeder which actually constructed the seeds. |
view | Actual view to display |
segments | Container of all MS segments in the event |
seeds | The constructed track seeds from the event |
extraLabel | Extra label to be put onto the top of the shown canvases |
extPrimitives | Extra TObjects that should be additionally painted onto the Canvases |
First add the truth points
Then we can add the
Draw the sector map
Definition at line 168 of file TrackVisualizationTool.cxx.
176 const unsigned nPrim = extPrimitives.size();
177 PlotLegend
legend{0.005,0.005, 0.6,0.1};
193 using namespace Muon;
195 const auto chIdx =
segment->chamberIndex();
196 const int mColor = msSector->
barrel() ? ColorBarrel : (msSector->
side() > 0 ? ColorEndcapA : ColorEndcapC);
197 const double phi =
segment->direction().phi();
200 if (!seeder.withinBounds(projPos, loc)) {
203 const bool isGood = onSeed(
segment, loc);
204 const int mStyle = stationMarkerSyle(chIdx,
false, isGood);
206 extPrimitives.emplace_back(drawMarker(markerPos, mStyle, mColor));
209 const double r = markerPos.mag() + extraMargin;
210 boundBox[0].expand(-
r,
r);
211 boundBox[1].expand(-
r,
r);
213 boundBox[0].expand(markerPos[0] - extraMargin, markerPos[0] + extraMargin);
214 boundBox[1].expand(markerPos[1] - extraMargin, markerPos[1] + extraMargin);
217 isGood ?
"" :
" (discarded)"));
218 legend.addColor(mColor, msSector->
barrel() ?
"Barrel" : msSector->
side() > 0 ?
"Endcap A" :
"Endcap C");
224 kFullDiamond, kBlack));
225 legend.addMarker(kFullDiamond,
"track seed");
229 for (
unsigned int s = 1;
s<=16 ; ++
s) {
233 const double phi = sectorMap.sectorPhi(
s);
234 const double dPhi = sectorMap.sectorWidth(
s);
236 const int lStyle =
s%2 ? kDashed : kDotted;
237 const double r = boundBox[0].max();
242 auto theLine = std::make_unique<TLine>(0.,0.,
e1.x(),
e1.y());
243 theLine->SetLineStyle(lStyle);
244 extPrimitives.insert(extPrimitives.begin() + nPrim, std::move(theLine));
245 theLine = std::make_unique<TLine>(0.,0.,
e2.x(),
e2.y());
246 theLine->SetLineStyle(lStyle);
247 extPrimitives.insert(extPrimitives.begin() + nPrim, std::move(theLine));
248 theLine = std::make_unique<TLine>(
e1.x(),
e1.y(),
e2.x(),
e2.y());
249 theLine->SetLineStyle(lStyle);
250 extPrimitives.insert(extPrimitives.begin() + nPrim, std::move(theLine));
253 std::tie(
"x [m]",
"y [m]") : std::tie(
"z [m]",
"R [m]"));
255 for (
auto& prim: extPrimitives){
258 legend.legend->SetBorderSize(0);
259 legend.legend->SetNColumns(4);
261 std::stringstream canvasName{};
262 canvasName<<
m_canvasPrefix.value()<<
"_"<<ctx.eventID().event_number()
264 if (!extraLabel.empty()) canvasName<<
"_"<<removeNonAlphaNum(extraLabel);
272 m_outFile->WriteObject(
canvas.get(), canvasName.str().c_str());
◆ displaySeeds() [2/3]
Displays all segments on the representative cylinder in the R-Z & X-Y plane and draws the markers of the successfully built seeds & truth segments.
- Parameters
-
ctx | EventContext to access store gate & conditions |
seederObj | Configured instance of the track seeder which actually constructed the seeds. |
segments | Container of all MS segments in the event |
seeds | The constructed track seeds from the event |
extraLabel | Extra label to be put onto the top of the shown canvases |
Definition at line 140 of file TrackVisualizationTool.cxx.
145 displaySeeds(ctx, seederObj, segments, seeds, extraLabel, PrimitivesVec_t{});
◆ displaySeeds() [3/3]
Displays all segments on the representative cylinder in the R-Z & X-Y plane and draws the markers of the successfully built seeds & truth segments.
- Parameters
-
ctx | EventContext to access store gate & conditions |
seederObj | Configured instance of the track seeder which actually constructed the seeds. |
segments | Container of all MS segments in the event |
extraLabel | Extra label to be put onto the top of the shown canvases |
extPrimitives | Extra TObjects that should be additionally painted onto the Canvases |
Definition at line 147 of file TrackVisualizationTool.cxx.
156 std::lock_guard guard{
s_mutex};
160 unsigned int nPrim = extPrimitives.size();
162 extPrimitives.resize(nPrim);
◆ emptyBounds()
◆ fillTruthSeedPoints()
Add the truth segments to the canvas.
- Parameters
-
ctx | EventContext to access store gate |
seederObj | Configured instance of the track seeder which actually constructed the seeds. |
view | Actual view to display |
legend | Reference to the legend object to add the marker / truth legends |
drawPrim | Reference to the primitives to drawn. The markers are added to this vector |
Definition at line 274 of file TrackVisualizationTool.cxx.
286 bool addedEntry{
false};
288 const auto chIdx =
segment->chamberIndex();
289 const int mStyle = stationMarkerSyle(chIdx,
false,
true);
290 const double phi =
segment->direction().phi();
298 drawPrim.push_back(drawMarker(
viewVector(
phi, projected,
view), mStyle, truthColor, 3));
304 legend.addColor(truthColor,
"truth");
◆ finalize()
StatusCode MuonValR4::TrackVisualizationTool::finalize |
( |
| ) |
|
|
finaloverridevirtual |
◆ initialize()
StatusCode MuonValR4::TrackVisualizationTool::initialize |
( |
| ) |
|
|
finaloverridevirtual |
Definition at line 117 of file TrackVisualizationTool.cxx.
121 return StatusCode::FAILURE;
127 m_outFile = std::make_unique<TFile>( (
m_allCanName +
".root").c_str(),
"RECREATE");
131 gROOT->SetStyle(
"ATLAS");
132 TStyle* plotStyle = gROOT->GetStyle(
"ATLAS");
133 plotStyle->SetOptTitle(0);
134 plotStyle->SetHistLineWidth(1.);
135 plotStyle->SetPalette(kViridis);
138 return StatusCode::SUCCESS;
◆ makeCanvas()
Creates a new TCanvas for drawing.
- Parameters
-
ctx | EventContext to give the canvas a unique name |
bounds | Array determining the x & y axis intervals |
axisLabels | Labels to be shown on the x & y axis |
Definition at line 308 of file TrackVisualizationTool.cxx.
311 std::stringstream canvasName{};
312 canvasName<<
name()<<
"_"<<ctx.eventID().event_number()<<
"_"<<m_canvCounter;
317 frame->GetXaxis()->SetTitle(std::get<0>(axisLabels).c_str());
318 frame->GetYaxis()->SetTitle(std::get<1>(axisLabels).c_str());
◆ viewVector()
Transforms the projected vector into the actual view, if it's xy then an external phi is needed to place the marker.
- Parameters
-
phi | Angle for the xy view - taken from the segment direction |
posOnCylinder | Projection of the segment's position onto the seed cylinder |
view | Actual view to display |
Definition at line 103 of file TrackVisualizationTool.cxx.
108 return Amg::Vector2D{ posOnCylinder[1]*inM, posOnCylinder[0]*inM};
◆ ATLAS_THREAD_SAFE [1/3]
std::unique_ptr<TCanvas> m_summaryCan MuonValR4::TrackVisualizationTool::ATLAS_THREAD_SAFE {} |
|
mutableprivate |
◆ ATLAS_THREAD_SAFE [2/3]
std::unique_ptr<TFile> m_outFile MuonValR4::TrackVisualizationTool::ATLAS_THREAD_SAFE {} |
|
mutableprivate |
◆ ATLAS_THREAD_SAFE [3/3]
std::atomic<unsigned int> m_canvCounter MuonValR4::TrackVisualizationTool::ATLAS_THREAD_SAFE {0} |
|
mutableprivate |
◆ m_allCanName
Gaudi::Property<std::string> MuonValR4::TrackVisualizationTool::m_allCanName {this, "AllCanvasName", "AllMsTrackPlots"} |
|
private |
◆ m_AtlasLabel
Gaudi::Property<std::string> MuonValR4::TrackVisualizationTool::m_AtlasLabel {this, "AtlasLabel", "Internal"} |
|
private |
◆ m_canvasHeight
Gaudi::Property<unsigned> MuonValR4::TrackVisualizationTool::m_canvasHeight {this, "CanvasHeight", 600} |
|
private |
◆ m_canvasLimit
Gaudi::Property<unsigned> MuonValR4::TrackVisualizationTool::m_canvasLimit {this, "CanvasLimit", 5000} |
|
private |
◆ m_canvasPrefix
Gaudi::Property<std::string> MuonValR4::TrackVisualizationTool::m_canvasPrefix {this, "CanvasPreFix", "MsTrackValid"} |
|
private |
◆ m_canvasWidth
Gaudi::Property<unsigned> MuonValR4::TrackVisualizationTool::m_canvasWidth {this, "CanvasWidth", 800} |
|
private |
◆ m_lumiLabel
Gaudi::Property<std::string> MuonValR4::TrackVisualizationTool::m_lumiLabel {this, "LumiLabel", ""} |
|
private |
◆ m_saveSinglePDFs
Gaudi::Property<bool> MuonValR4::TrackVisualizationTool::m_saveSinglePDFs {this, "saveSinglePDFs", true} |
|
private |
◆ m_saveSummaryPDF
Gaudi::Property<bool> MuonValR4::TrackVisualizationTool::m_saveSummaryPDF {this, "saveSummaryPDF", false} |
|
private |
If set to true a summary Canvas is created.
ATTENTION: There can be only one summary PDF in an athena job
Definition at line 146 of file TrackVisualizationTool.h.
◆ m_sqrtSLabel
Gaudi::Property<std::string> MuonValR4::TrackVisualizationTool::m_sqrtSLabel {this, "SqrtSLabel", "14"} |
|
private |
◆ m_truthSegKey
◆ s_mutex
std::mutex MuonValR4::TrackVisualizationTool::s_mutex {} |
|
staticprivate |
The documentation for this class was generated from the following files:
int8_t side() const
Returns the side of the MS-sector 1 -> A side ; -1 -> C side.
A spectrometer sector forms the envelope of all chambers that are placed in the same MS sector & laye...
Scalar phi() const
phi method
std::string find(const std::string &s)
return a remapped string
bool withinBounds(const Amg::Vector2D &projPos, const Location loc) const
Returns whether the expression on the cylinder is within the surface bounds.
double e1(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 1st sampling
Eigen::Matrix< double, 2, 1 > Vector2D
Class describing a MuonSegment.
#define ATH_MSG_VERBOSE(x)
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
const Segment * detailedSegment(const xAOD::MuonSegment &seg)
Helper function to navigate from the xAOD::MuonSegment to the MuonR4::Segment.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
bool barrel() const
Returns whether the sector is placed in the barrel.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
const MuonGMR4::SpectrometerSector * msSector() const
Returns the associated MS sector.
const std::string & layerName(LayerIndex index)
convert LayerIndex into a string
Eigen::Matrix< double, 3, 1 > Vector3D
#define THROW_EXCEPTION(MESSAGE)
double e2(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 2nd sampling
bool dPhi(const xAOD::TauJet &tau, const xAOD::TauTrack &track, float &out)
Helper to simultaneously calculate sin and cos of the same angle.
LayerIndex toLayerIndex(ChIndex index)
convert ChIndex into LayerIndex
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Amg::Vector2D expressOnCylinder(const xAOD::MuonSegment &segment, const Location loc) const
Expresses the segment on the cylinder surface.
bool empty() const noexcept
Returns true if the collection is empty.
Muon::NSW_PadTriggerSegment segment(const NSWL1::PadTrigger &data)