25 using PrimitivesVec_t = MuonValR4::TrackVisualizationTool::PrimitivesVec_t;
26 constexpr int truthColor = kOrange +2;
28 constexpr int ColorBarrel = kRed;
29 constexpr int ColorEndcapA = kBlue;
30 constexpr int ColorEndcapC = kGreen +2;
31 constexpr double inM = 1./ Gaudi::Units::m;
33 constexpr double extraMargin = 50.*Gaudi::Units::cm * inM;
38 std::unique_ptr<TMarker> drawMarker(
const Amg::Vector2D& pos,
const int mStyle,
const int mColor,
const int mSize = 2) {
39 auto marker = std::make_unique<TMarker>(
pos.x(),
pos.y(), mStyle);
40 marker->SetMarkerColor(mColor);
41 marker->SetMarkerSize(mSize);
46 const bool openMarker,
const bool onSeed) {
52 return onSeed ? (openMarker ? kOpenTriangleUp : kFullTriangleUp)
53 : (openMarker ? kOpenTriangleDown : kFullTriangleDown);
55 return onSeed ? (openMarker ? kOpenCrossX : kFullCrossX)
56 : (openMarker ? kOpenCross : kFullCross);
58 return onSeed ? (openMarker ? kOpenFourTrianglesX: kFullFourTrianglesX)
59 : (openMarker ? kOpenThreeTriangles : kFullThreeTriangles);
74 colors.insert(std::make_pair(
color, std::move(box)));
80 auto tMarker = drawMarker(
Amg::Vector2D{2.*Gaudi::Units::km, 0.}, marker, kBlack);
81 legend->AddEntry(tMarker.get(),
label.c_str(),
"P");
82 markers.insert(std::make_pair(marker, std::move(tMarker)));
87 canvas.add(std::move(
legend));
88 for (
auto&[i, obj] :
colors){
89 canvas.add(std::move(obj));
92 canvas.add(std::move(obj));
100 return Amg::Vector2D{ posOnCylinder[1]*inM, posOnCylinder[0]*inM};
120 return StatusCode::SUCCESS;
126 displaySeeds(ctx, seederObj, segments, seeds, PrimitivesVec_t{});
132 PrimitivesVec_t && extPrimitives)
const {
145 PrimitivesVec_t&& extPrimitives)
const{
163 return std::ranges::any_of(seeds,[segment, loc](
const MsTrackSeed& seed){
164 return seed.location() == loc && std::ranges::find(seed.segments(), segment) != seed.segments().end();
172 bool drawnPoint{
false};
177 using namespace Muon;
180 const int mColor = msSector->
barrel() ? ColorBarrel : (msSector->
side() > 0 ? ColorEndcapA : ColorEndcapC);
182 for (
const auto secProj : {leftOverlap, center, rightOverlap}) {
194 const bool isGood = onSeed(segment, loc);
195 const int mStyle = stationMarkerSyle(chIdx,
false, isGood);
198 extPrimitives.emplace_back(drawMarker(markerPos, mStyle, mColor));
201 const double r = markerPos.mag() + extraMargin;
202 canvas->expandPad(
r,
r);
203 canvas->expandPad(-
r, -
r);
205 canvas->expandPad(markerPos[0] - extraMargin, markerPos[1] - extraMargin);
206 canvas->expandPad(markerPos[0] + extraMargin, markerPos[1] + extraMargin);
209 isGood ?
"" :
" (discarded)"));
210 legend.addColor(mColor, msSector->
barrel() ?
"Barrel" : msSector->
side() > 0 ?
"Endcap A" :
"Endcap C");
221 kFullDiamond, kBlack));
222 legend.addMarker(kFullDiamond,
"track seed");
225 for (
unsigned int s = 1; s<=16 ; ++s) {
232 const int lStyle = s%2 ? kDashed : kDotted;
233 const double r = canvas->corner(Edges::xHigh);
238 auto theLine = std::make_unique<TLine>(0.,0., e1.x(), e1.y());
239 theLine->SetLineStyle(lStyle);
240 extPrimitives.insert(extPrimitives.begin(), std::move(theLine));
241 theLine = std::make_unique<TLine>(0.,0., e2.x(), e2.y());
242 theLine->SetLineStyle(lStyle);
243 extPrimitives.insert(extPrimitives.begin(), std::move(theLine));
244 theLine = std::make_unique<TLine>(e1.x(), e1.y(), e2.x(), e2.y());
245 theLine->SetLineStyle(lStyle);
246 extPrimitives.insert(extPrimitives.begin(), std::move(theLine));
248 legend.fillPrimitives(*canvas);
267 bool addedEntry{
false};
269 const auto chIdx = segment->chamberIndex();
270 const int mStyle = stationMarkerSyle(chIdx,
false,
true);
274 for (
const auto secProj : {leftOverlap, center, rightOverlap}) {
275 if (!sectorMap.
insideSector(segment->sector() + Acts::toUnderlying(secProj),
276 segment->position().phi())){
285 canvas.add(drawMarker(
viewVector(
phi, projected, view), mStyle, truthColor, 3));
292 legend.addColor(truthColor,
"truth");
297 const OptBoundPars_t& parsToExt,
298 const std::string& objName)
const {
305 Acts::ObjVisualization3D visualHelper{};
306 const std::string subDir = std::format(
"./ObjDisplays/{:}/",
m_subDir.value());
319 unsigned fileVersion{0};
320 std::string finalStr{};
321 while (finalStr.empty() || std::filesystem::exists(finalStr)) {
322 finalStr = std::format(
"{:}/{:}_{:}_{:}_{:}.obj", subDir,
323 m_clientToken.preFixName, ctx.eventID().event_number(), ++fileVersion, segStr);
325 visualHelper.write(finalStr);
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
bool empty() const noexcept
Returns true if the collection is empty.
A spectrometer sector forms the envelope of all chambers that are placed in the same MS sector & laye...
int8_t side() const
Returns the side of the MS-sector 1 -> A side ; -1 -> C side.
bool barrel() const
Returns whether the sector is placed in the barrel.
Helper class to group muon sgements that may belong to a muon trajectory.
bool withinBounds(const Amg::Vector2D &projPos, const Location loc) const
Returns whether the expression on the cylinder is within the surface bounds.
Amg::Vector2D expressOnCylinder(const ActsTrk::GeometryContext &gctx, const xAOD::MuonSegment &segment, const Location loc, const SectorProjector proj) const
Expresses the segment on the cylinder surface.
static double projectedPhi(const int sector, const SectorProjector proj)
Returns the projected phi for a given sector and projector.
SectorProjector
Enumeration to select the sector projection.
const MuonGMR4::SpectrometerSector * msSector() const
Returns the associated MS sector.
double sectorPhi(int sector) const
returns the centeral phi position of a sector in radians
double sectorWidth(int sector) const
sector width (with overlap) in radians
bool insideSector(int sector, double phi) const
checks whether the phi position is consistent with sector
::Muon::MuonStationIndex::ChIndex chamberIndex() const
Returns the chamber index.
Amg::Vector3D position() const
Returns the position as Amg::Vector.
std::string label(const std::string &format, int i)
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
This header ties the generic definitions in this package.
std::vector< MsTrackSeed > MsTrackSeedContainer
std::string printID(const xAOD::MuonSegment &seg)
Print the chamber ID of a segment, e.g.
const Segment * detailedSegment(const xAOD::MuonSegment &seg)
Helper function to navigate from the xAOD::MuonSegment to the MuonR4::Segment.
Lightweight algorithm to read xAOD MDT sim hits and (fast-digitised) drift circles from SG and fill a...
void ensureDirectory(const std::string &path)
Ensures that the subdirectory in the path is created.
std::vector< std::unique_ptr< TObject > > clone(const std::vector< std::unique_ptr< TObject > > &cloneMe)
void drawPropagation(const std::vector< Acts::detail::Step > &steps, Acts::ObjVisualization3D &visualHelper, const Acts::ViewConfig &viewConfig=Acts::s_viewLine)
Draws the recorded propagation steps as a polygon line.
constexpr int fullFilling
std::string removeNonAlphaNum(std::string str)
Removes all non-alpha numerical characters from a string.
void drawSegmentMeasurements(const ActsTrk::GeometryContext &gctx, const xAOD::MuonSegment &segment, Acts::ObjVisualization3D &visualHelper, const Acts::ViewConfig &viewConfig=Acts::s_viewSensitive)
Draw all uncalibrated measurements associated to the segment.
void drawSegmentLine(const ActsTrk::GeometryContext &gctx, const xAOD::MuonSegment &segment, Acts::ObjVisualization3D &visualHelper, const Acts::ViewConfig &viewConfig=Acts::s_viewLine, const double standardLength=1.*Gaudi::Units::m)
Draw a segment line inside the obj file.
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.
const std::string & layerName(LayerIndex index)
convert LayerIndex into a string
LayerIndex toLayerIndex(ChIndex index)
convert ChIndex into LayerIndex
LayerIndex
enum to classify the different layers in the muon spectrometer
ChIndex
enum to classify the different chamber layers in the muon spectrometer
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
MuonSegmentContainer_v1 MuonSegmentContainer
Definition of the current "MuonSegment container version".
MuonSegment_v1 MuonSegment
Reference the current persistent version:
Helper to simultaneously calculate sin and cos of the same angle.
#define THROW_EXCEPTION(MESSAGE)