 |
ATLAS Offline Software
|
Go to the documentation of this file.
24 constexpr
int truthColor = kOrange +2;
26 constexpr
int ColorBarrel = kRed;
27 constexpr
int ColorEndcapA = kBlue;
28 constexpr
int ColorEndcapC = kGreen +2;
33 std::unique_ptr<TMarker> drawMarker(
const Amg::Vector2D&
pos,
const int mStyle,
const int mColor,
const int mSize = 2) {
34 auto marker = std::make_unique<TMarker>(
pos.x(),
pos.y(), mStyle);
35 marker->SetMarkerColor(mColor);
36 marker->SetMarkerSize(mSize);
41 const bool openMarker,
const bool onSeed) {
47 return onSeed ? (openMarker ? kOpenTriangleUp : kFullTriangleUp)
48 : (openMarker ? kOpenTriangleDown : kFullTriangleDown);
50 return onSeed ? (openMarker ? kOpenCrossX : kFullCrossX)
51 : (openMarker ? kOpenCross : kFullCross);
53 return onSeed ? (openMarker ? kOpenFourTrianglesX: kFullFourTrianglesX)
54 : (openMarker ? kOpenThreeTriangles : kFullThreeTriangles);
59 std::string removeNonAlphaNum(std::string
str) {
60 str.erase(std::remove_if(
str.begin(),
str.end(),
61 [](
const unsigned char c){
62 return !std::isalnum(c);
76 colors.insert(std::make_pair(
color, std::move(box)));
83 legend->AddEntry(tMarker.get(),
label.c_str(),
"P");
94 if (!m_outFile)
return;
108 return Amg::Vector2D{ posOnCylinder[1]*inM, posOnCylinder[0]*inM};
115 return StatusCode::SUCCESS;
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;
144 const std::string& extraLabel)
const {
145 displaySeeds(ctx, seederObj, segments, seeds, extraLabel, PrimitivesVec_t{});
151 const std::string& extraLabel,
152 PrimitivesVec_t && extPrimitives)
const {
156 std::lock_guard guard{
s_mutex};
160 unsigned int nPrim = extPrimitives.size();
162 extPrimitives.resize(nPrim);
173 const std::string& extraLabel,
174 PrimitivesVec_t& extPrimitives)
const{
176 const unsigned nPrim = extPrimitives.size();
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();
198 for (
const Location loc : {Barrel, Endcap}) {
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());
278 PrimitivesVec_t& drawPrim)
const {
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();
293 for (
const Location loc : {Barrel, Endcap}) {
298 drawPrim.push_back(drawMarker(
viewVector(
phi, projected,
view), mStyle, truthColor, 3));
304 legend.addColor(truthColor,
"truth");
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());
constexpr int fullFilling
LayerIndex
enum to classify the different layers in the muon spectrometer
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
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.
Class describing a MuonSegment.
#define ATH_MSG_VERBOSE(x)
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Location
Enum defining whether the seed is made in the endcap / barrel.
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.
::StatusCode StatusCode
StatusCode definition for legacy code.
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.
Lightweight algorithm to read xAOD MDT sim hits and (fast-digitised) drift circles from SG and fill a...
const std::string & layerName(LayerIndex index)
convert LayerIndex into a string
Helper class to group muon sgements that may belong to a muon trajectory.
Eigen::Matrix< double, 3, 1 > Vector3D
#define THROW_EXCEPTION(MESSAGE)
This header ties the generic definitions in this package.
double e2(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 2nd sampling
std::vector< MsTrackSeed > MsTrackSeedContainer
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
ChIndex
enum to classify the different chamber layers in the muon spectrometer
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)