|
ATLAS Offline Software
|
Go to the documentation of this file.
8 #include "GaudiKernel/SystemOfUnits.h"
22 std::stringstream sstr{};
23 sstr <<
"[x,y,z]=(" <<
v.x() <<
"," <<
v.y() <<
"," <<
v.z()
25 <<
v.eta() <<
"," <<
v.phi() <<
")";
32 ISvcLocator* pSvcLocator)
35 std::unique_ptr<TFile> out_file =
36 std::make_unique<TFile>(
m_outFile.value().c_str(),
"RECREATE");
37 if (!out_file || !out_file->IsOpen() || out_file->IsZombie()) {
40 return StatusCode::FAILURE;
42 out_file->mkdir(
"SinglePads");
43 out_file->mkdir(
"ActiveSurfaces");
47 std::unique_ptr<TGraph>&
graph = id_graph.second;
52 const int lay = is_mm ? mm_helper.
gasGap(
id) : st_helper.
gasGap(
id);
53 const std::string ch_name =
59 TDirectory*
dir = out_file->GetDirectory(
"SinglePads");
60 dir->WriteObject(
graph.get(), ch_name.c_str());
62 const int signed_lay =
layerId(
id);
63 std::unique_ptr<TGraph>& lay_graph =
m_nswLayers[signed_lay];
66 std::string lay_name = std::string{is_mm ?
"MMG" :
"STG"} +
"W" +
69 out_file->WriteObject(lay_graph.get(), lay_name.c_str());
74 dir = out_file->GetDirectory(
"ActiveSurfaces");
76 dir->WriteObject(active_area.get(), lay_name.c_str());
79 return StatusCode::SUCCESS;
86 return StatusCode::SUCCESS;
90 return StatusCode::SUCCESS;
91 const EventContext& ctx = Gaudi::Hive::currentContext();
94 if (!detMgr.isValid()) {
96 return StatusCode::FAILURE;
101 std::unique_ptr<TGraph>& pad_graph = id_graph.second;
103 const int signed_lay =
layerId(
id);
104 std::unique_ptr<TGraph>& wheel_graph =
m_nswLayers[signed_lay];
107 is_mm ? detMgr->getMMReadoutElement(
id) :
nullptr;
109 is_mm ? nullptr : detMgr->getsTgcReadoutElement(
id);
118 if ((is_mm || std::abs(locPos.y()) < 1.
e-3) &&
120 ATH_MSG_ALWAYS(
" Backmapping of the strip number did not work for "
122 << locPos.x() <<
" " << locPos.y() <<
" "
131 pad_graph->SetPoint(pad_graph->GetN(), globPos.x(), globPos.y());
133 wheel_graph->SetPoint(wheel_graph->GetN(), globPos.x(), globPos.y());
165 <<
" does not have strip "
166 <<
strip <<
"... Why?");
172 <<
" does not have strip " <<
strip
179 <<
" does not have strip "
180 <<
strip <<
"... Why?");
183 auto uv_intersects = [&]() {
186 return StatusCode::SUCCESS;
189 if ((ml == 1 &&
gap == 2) || (ml == 2 &&
gap == 4))
190 return StatusCode::SUCCESS;
194 const int u_gap = ml == 1 ? 3 : 1;
195 const int v_gap = ml == 1 ? 4 : 2;
206 global_points(x_id, x_left, x_center, x_right);
207 global_points(u_id, u_left, u_center, u_right);
208 global_points(v_id, v_left, v_center, v_right);
214 std::optional<double> uv_isect =
215 Amg::intersect<3>(v_center, v_dir, u_center, u_dir);
218 ATH_MSG_ERROR(
"Failed to intersect the uv strips for identifiers "
224 return StatusCode::FAILURE;
226 const Amg::Vector3D uv_ipoint = u_center + (*uv_isect) * u_dir;
227 const Amg::Vector2D cen_diff = (uv_ipoint - x_center).block<2, 1>(0, 0);
228 if (cen_diff.dot(cen_diff) > std::numeric_limits<float>::epsilon()) {
235 <<
" intersect at the center of the corresponding x "
236 "strip. But they don't. "
239 <<
" vs." << std::endl
245 std::optional<double> ux_isect =
246 Amg::intersect<3>(u_center, u_dir, x_center, x_dir);
248 ATH_MSG_ERROR(
"Failed to intersect the ux strips for identifiers "
254 return StatusCode::FAILURE;
257 <<
to_string(x_center + (*ux_isect) * x_dir) <<
" "
260 std::optional<double> vx_isect =
261 Amg::intersect<3>(v_center, v_dir, x_center, x_dir);
263 ATH_MSG_ERROR(
"Failed to intersect the vx strips for identifiers "
269 return StatusCode::FAILURE;
272 <<
to_string(x_center + (*vx_isect) * x_dir) <<
" "
275 return StatusCode::SUCCESS;
281 if (!surface_histo) {
289 for (
double x = surf_cent.x() -
d;
x <= surf_cent.x() +
d;
x += 1) {
290 for (
double y = surf_cent.y() -
d;
y <= surf_cent.y() +
d;
y += 1) {
299 surface_histo->Fill(
x,
y);
305 return StatusCode::SUCCESS;
311 for (
const std::string station : {
"MML",
"MMS"}) {
319 bool is_valid{
false};
325 if (!detMgr->getMMReadoutElement(module_id))
327 for (
int i_layer = 1; i_layer <= 4; ++i_layer) {
329 id_helper.
channelID(module_id, ml, i_layer, 10);
332 int signed_layer =
layerId(
id);
334 m_nswLayers[signed_layer] = std::make_unique<TGraph>();
339 "ActiveNSW;x [mm]; y [mm]", 1000, -5001, 5001., 1000,
347 return StatusCode::SUCCESS;
354 int lay = id_helper.
gasGap(
id);
356 return (8 * (
type == sTgcIdHelper::sTgcChannelTypes::Strip) + 4 * (ml - 1) +
363 int lay = id_helper.
gasGap(
id);
364 return (16 + 4 * (ml - 1) + (lay - 1)) * (
eta > 0 ? 1 : -1);
372 for (
const std::string station : {
"STS",
"STL"}) {
381 bool is_valid{
false};
387 if (!detMgr->getsTgcReadoutElement(module_id))
389 for (
int lay = 1; lay <= 4; ++lay) {
391 module_id, ml, lay, sTgcIdHelper::sTgcChannelTypes::Strip, 10);
393 module_id, ml, lay, sTgcIdHelper::sTgcChannelTypes::Wire, 10);
394 for (
const Identifier&
id : {strip_id, wire_id}) {
396 int signed_layer =
layerId(
id);
398 m_nswLayers[signed_layer] = std::make_unique<TGraph>();
403 "ActiveNSW;x [mm]; y [mm]", 1000, -5001, 5001., 1000,
412 return StatusCode::SUCCESS;
def retrieve(aClass, aKey=None)
int multilayer(const Identifier &id) const
static int stationPhiMin()
std::map< int, std::unique_ptr< TH1 > > m_nswActiveAreas
Map showing the active areas of the NSW to show the passivation.
StatusCode initialize() override
bool insideActiveBounds(const Identifier &id, const Amg::Vector2D &locpos, double tol1=0., double tol2=0.) const
boundary check Wrapper Trk::PlaneSurface::insideBounds() taking into account the passivated width
Scalar phi() const
phi method
static int stationPhiMax()
virtual int numberOfStrips(const Identifier &layerId) const override final
number of strips per layer
NSWGeoPlottingAlg(const std::string &name, ISvcLocator *pSvcLocator)
Scalar eta() const
pseudorapidity method
static int stationPhiMin()
int channelNumber(const Amg::Vector2D &pos) const
calculate local channel number, range 1=nstrips like identifiers. Returns -1 if out of range
Eigen::Matrix< double, 2, 1 > Vector2D
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channelType, int channel) const
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_DetectorManagerKey
const MuonChannelDesign * getDesign(const Identifier &id) const
returns the MuonChannelDesign class for the given identifier
const MuonChannelDesign * getDesign(const Identifier &id) const
returns the MuonChannelDesign class for the given identifier
static int multilayerMin()
TGraph * graph(const std::string &graphName, const std::string &tDir="", const std::string &stream="")
Simplify the retrieval of registered TGraphs.
std::map< int, std::unique_ptr< TGraph > > m_nswLayers
Map showing the edges of the 16 layers of the NSW.
def gap(flags, cells_name, *args, **kw)
double hasStereoAngle() const
returns whether the stereo angle is non-zero
virtual const Trk::PlaneSurface & surface() const override
access to chamber surface (phi orientation), uses the first gas gap
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
int multilayer(const Identifier &id) const
virtual bool insideBounds(const Amg::Vector2D &locpos, double tol1=0., double tol2=0.) const override
This method calls the inside() method of the Bounds.
Identifier multilayerID(const Identifier &channeldID) const
static int stationEtaMin()
StatusCode execute() override
static int stationPhiMax()
::StatusCode StatusCode
StatusCode definition for legacy code.
An sTgcReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station c...
int gasGap(const Identifier &id) const override
get the hashes
static int multilayerMax()
virtual const Surface & surface() const =0
Return surface associated with this detector element.
#define ATH_MSG_ALWAYS(x)
static int stationEtaMax()
const std::string & stationNameString(const int &index) const
bool center(int channel, Amg::Vector2D &pos) const
STRIPS ONLY: Returns the center on the strip.
Identifier elementID(int stationName, int stationEta, int stationPhi) const
static int multilayerMax()
virtual int numberOfStrips(const Identifier &layerId) const override final
number of strips per layer
std::string to_string(const DetectorType &type)
StatusCode initialize(bool used=true)
std::map< Identifier, std::unique_ptr< TGraph > > m_nswPads
Map containing each PCB of the NSW seperately.
Eigen::Matrix< double, 3, 1 > Vector3D
Identifier elementID(int stationName, int stationEta, int stationPhi) const
bool rightEdge(int channel, Amg::Vector2D &pos) const
STRIPS ONLY: Returns the right edge of the strip.
int channel(const Identifier &id) const override
int gasGap(const Identifier &id) const override
get the hashes
virtual bool globalToLocal(const Amg::Vector3D &glob, const Amg::Vector3D &mom, Amg::Vector2D &loc) const =0
Specified by each surface type: GlobalToLocal method without dynamic memory allocation - boolean chec...
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
#define ATH_MSG_WARNING(x)
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
An MMReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station con...
Identifier multilayerID(const Identifier &channeldID) const
StatusCode finalize() override
int numberOfMissingBottomStrips() const
Returns the number of missing bottom strips.
Gaudi::Property< std::string > m_outFile
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channel) const
int channelType(const Identifier &id) const
virtual const Amg::Vector3D & center() const =0
Return the center of the element.
int layerId(const Identifier &id) const
static int multilayerMin()
virtual void localToGlobal(const Amg::Vector2D &locp, const Amg::Vector3D &mom, Amg::Vector3D &glob) const =0
Specified by each surface type: LocalToGlobal method without dynamic memory allocation.
StatusCode initMicroMega()
bool leftEdge(int channel, Amg::Vector2D &pos) const
STRIPS ONLY: Returns the left edge of the strip.