|
ATLAS Offline Software
|
Go to the documentation of this file.
10 #include "GaudiKernel/MsgStream.h"
18 #include "GeoModelHelpers/throwExcept.h"
25 m_chid(chid), m_detMgr(detMgr), m_dbData(dbData), m_idHelperSvc(idHelperSvc) {
35 log << MSG::WARNING <<
"MdtIntersectGeometry::intersection() - MdtIntersectGeometry not correctly initialized "
43 double dxdy = std::abs(ldir.y()) > 0.001 ? ldir.x() / ldir.y() : 1000.;
45 double lineAngle = std::atan2(ldir.z(), ldir.y());
54 for (; dit != dit_end; ++dit) {
57 double xint = dxdy * (dit->position().x() - lpos.y()) + lpos.x();
63 intersects.emplace_back(tubeid, dit->dr(), distWall);
65 intersect.setTubeIntersects(std::move(intersects));
72 if (ml < 0 || ml > 1){
73 THROW_EXCEPTION(__func__<<
"() got called with ml="<<ml<<
" which is definetly out of range");
75 if (layer < 0 || layer > 3) {
76 THROW_EXCEPTION(__func__<<
"() got called with layer="<<
layer<<
" which is definetly out of range");
79 THROW_EXCEPTION(__func__<<
"() got called with tube="<<
tube<<
" which is definetly out of range");
83 int theTube =
tube + 1;
84 int theLayer =
layer + 1;
118 msg << MSG::WARNING <<
"MdtIntersectGeometry::init() - failed to get readout element for ML0" <<
endmsg;
135 bool goodMl0{
false}, goodMl1{
false};
143 int firstMlIndex = 1;
144 if (goodMl0 && !goodMl1) {
147 }
else if (!goodMl0 && goodMl1) {
152 firstIdml0 = firstIdml1;
154 }
else if (!goodMl0 && !goodMl1) {
155 msg << MSG::WARNING <<
"MdtIntersectGeometry::init() - neither multilayer is good" <<
endmsg;
183 double tubeDist = (secondTubeMl0 - firstTubeMl0).
y();
184 double tubeStage = (firstTubeMl0lay1 - firstTubeMl0).
y();
185 double layDist = (firstTubeMl0lay1 - firstTubeMl0).
z();
187 m_mdtGeometry = std::make_unique<TrkDriftCircleMath::MdtChamberGeometry>(
188 m_chid,
m_idHelperSvc, nml, nlay, ntube0, ntube1, firstTube0, firstTube1, tubeDist, tubeStage, layDist,
m_detElMl0->
center().theta());
191 if (!goodMl0 && goodMl1)
m_mdtGeometry->isSecondMultiLayer(
true);
195 if ((mydetEl->
getStationName()).find(
"BMG") != std::string::npos) {
196 PVConstLink cv = mydetEl->getMaterialGeom();
197 int nGrandchildren = cv->getNChildVols();
198 if (nGrandchildren <= 0)
return;
200 std::vector<int> tubes;
201 geoGetIds([&](
int id) { tubes.push_back(
id); }, &*cv);
202 std::sort(tubes.begin(), tubes.end());
215 if (
it != tubes.end() && *
it == want_id) {
218 it = std::lower_bound(tubes.begin(), tubes.end(), want_id);
219 if (
it != tubes.end() && *
it == want_id) {
228 <<
"), phi(" << phi <<
"), eta(" << eta <<
"), name(" <<
name <<
") and adding multilayerId("
229 << deadTubeMLId <<
")." <<
endmsg;
JetConstituentVector::iterator iterator
int multilayer(const Identifier &id) const
Access to components of the ID.
int getNLayers() const
Returns the number of tube layers inside the multilayer.
const MuonGM::MdtReadoutElement * m_detElMl0
const IMuonIdHelperSvc * m_idHelperSvc
singleton-like access to IMessageSvc via open function and helper
std::string find(const std::string &s)
return a remapped string
virtual const Amg::Vector3D & center(const Identifier &) const override final
Return the center of the surface associated with this identifier In the case of silicon it returns th...
virtual Amg::Transform3D GlobalToAmdbLRSTransform() const
std::shared_ptr< TrkDriftCircleMath::MdtChamberGeometry > m_mdtGeometry
int stationName(const Identifier &id) const
#define THROW_EXCEPTION(MSG)
This class provides conversion from CSC RDO data to CSC Digits.
Visitor to collect all IDs under a GeoModel node.
IMessageSvc * getMessageSvc(bool quiet=false)
const MdtCondDbData * m_dbData
Implementation of 2 dimensional vector class.
std::vector< DriftCircle > DCVec
MdtIntersectGeometry(MsgStream &msg, const Identifier &chid, const IMuonIdHelperSvc *idHelperSvc, const MuonGM::MuonDetectorManager *detMgr, const MdtCondDbData *dbData)
const Amg::Transform3D & transform() const
std::vector< Identifier > m_deadTubes
MuonStationIntersect intersection(const Amg::Vector3D &pos, const Amg::Vector3D &dir) const override
const MdtReadoutElement * getMdtReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
const std::string & getStationName() const
std::shared_ptr< const TrkDriftCircleMath::MdtChamberGeometry > mdtChamberGeometry() const
double getActiveTubeLength(const int tubeLayer, const int tube) const
virtual ~MdtIntersectGeometry()
unsigned int nMDTinStation() const
How many MDT chambers are in the station.
void init(MsgStream &msg)
int stationPhi(const Identifier &id) const
std::string print_to_string(Identifier id, const IdContext *context=0) const
or provide the printout in string form
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int tubeLayer, int tube) const
virtual const MdtIdHelper & mdtIdHelper() const =0
access to MdtIdHelper
DCVec::const_iterator DCCit
int stationEta(const Identifier &id) const
Eigen::Matrix< double, 3, 1 > Vector3D
double tubeLength(const int ml, const int layer, const int tube) const
void geoGetIds(FUNCTION f, const GeoGraphNode *node, int depthLimit=1)
Template helper for running the visitor.
Amg::Vector3D tubePos(const Identifier &id) const
Returns the global position of the given tube.
const MuonGM::MdtReadoutElement * m_detElMl1
std::optional< double > intersect(const AmgVector(N)&posA, const AmgVector(N)&dirA, const AmgVector(N)&posB, const AmgVector(N)&dirB)
Calculates the point of closest approach of two lines.
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
std::set< Identifier > m_deadTubesML
Identifier identify() const override final
Returns the ATLAS Identifier of the MuonReadOutElement.
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
void fillDeadTubes(const MuonGM::MdtReadoutElement *mydetEl, MsgStream &msg)
Identifier multilayerID(const Identifier &channeldID) const
static constexpr int maxNTubesPerLayer
The maxNTubesPerLayer represents the absolute maximum of tubes which are built into a single multilay...
std::vector< MuonTubeIntersect > TubeIntersects
int getNtubesperlayer() const
Returns the number of tubes in each tube layer.
const MuonGM::MuonDetectorManager * m_detMgr
bool isGoodMultilayer(const Identifier &Id) const
Amg::Transform3D m_transform