 |
ATLAS Offline Software
|
Go to the documentation of this file.
10 #include "GaudiKernel/MsgStream.h"
18 #include "GeoModelKernel/throwExcept.h"
25 m_chid(chid), m_dbData(dbData), m_idHelperSvc(idHelperSvc) {
36 log << MSG::WARNING <<
"MdtIntersectGeometry::intersection() - MdtIntersectGeometry not correctly initialized "
44 double dxdy = std::abs(ldir.y()) > 0.001 ? ldir.x() / ldir.y() : 1000.;
46 double lineAngle = std::atan2(ldir.z(), ldir.y());
58 for (; dit != dit_end; ++dit) {
61 double xint = dxdy * (dit->position().x() - lpos.y()) + lpos.x();
66 double distWall = std::abs(xint) - 0.5 *
tubeLength(detElMl0, detElMl1,
68 intersects.emplace_back(tubeid, dit->dr(), distWall);
70 intersect.setTubeIntersects(std::move(intersects));
77 const int ml,
const int layer,
const int tube)
const {
79 if (ml < 0 || ml > 1){
80 THROW_EXCEPTION(__func__<<
"() got called with ml="<<ml<<
" which is definetly out of range");
82 if (layer < 0 || layer > 3) {
83 THROW_EXCEPTION(__func__<<
"() got called with layer="<<
layer<<
" which is definetly out of range");
86 THROW_EXCEPTION(__func__<<
"() got called with tube="<<
tube<<
" which is definetly out of range");
90 int theTube =
tube + 1;
91 int theLayer =
layer + 1;
125 msg << MSG::WARNING <<
"MdtIntersectGeometry::init() - failed to get readout element for ML0" <<
endmsg;
142 bool goodMl0{
false}, goodMl1{
false};
150 int firstMlIndex = 1;
151 if (goodMl0 && !goodMl1) {
154 }
else if (!goodMl0 && goodMl1) {
159 firstIdml0 = firstIdml1;
161 }
else if (!goodMl0 && !goodMl1) {
162 msg << MSG::WARNING <<
"MdtIntersectGeometry::init() - neither multilayer is good" <<
endmsg;
190 double tubeDist = (secondTubeMl0 - firstTubeMl0).
y();
191 double tubeStage = (firstTubeMl0lay1 - firstTubeMl0).
y();
192 double layDist = (firstTubeMl0lay1 - firstTubeMl0).
z();
194 m_mdtGeometry = std::make_unique<TrkDriftCircleMath::MdtChamberGeometry>(
195 m_chid,
m_idHelperSvc, nml, nlay, ntube0, ntube1, firstTube0, firstTube1, tubeDist, tubeStage, layDist, detElMl0->
center().theta());
198 if (!goodMl0 && goodMl1)
m_mdtGeometry->isSecondMultiLayer(
true);
205 if ((mydetEl->
getStationName()).find(
"BMG") != std::string::npos) {
206 PVConstLink cv = mydetEl->getMaterialGeom();
207 int nGrandchildren = cv->getNChildVols();
208 if (nGrandchildren <= 0)
return;
210 std::vector<int> tubes;
211 geoGetIds([&](
int id) { tubes.push_back(
id); }, &*cv);
212 std::sort(tubes.begin(), tubes.end());
225 if (
it != tubes.end() && *
it == want_id) {
228 it = std::lower_bound(tubes.begin(), tubes.end(), want_id);
229 if (
it != tubes.end() && *
it == want_id) {
238 <<
"), phi(" << phi <<
"), eta(" << eta <<
"), name(" <<
name <<
") and adding multilayerId("
239 << 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 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
IdentifierHash detectorElementHash() const
Returns the IdentifierHash of the detector element.
int stationName(const Identifier &id) const
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
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
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()
void init(const MuonGM::MuonDetectorManager *detMgr, MsgStream &msg)
unsigned int nMDTinStation() const
How many MDT chambers are in the station.
bool is_valid() const
Check if id is in a valid state.
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
#define THROW_EXCEPTION(MESSAGE)
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.
MuonStationIntersect intersection(const MuonGM::MuonDetectorManager *detMgr, const Amg::Vector3D &pos, const Amg::Vector3D &dir) const override
std::optional< double > intersect(const AmgVector(N)&posA, const AmgVector(N)&dirA, const AmgVector(N)&posB, const AmgVector(N)&dirB)
Calculates the point B' along the line B that's closest to a second line A.
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.
double tubeLength(const MuonGM::MdtReadoutElement *detElMl0, const MuonGM::MdtReadoutElement *detElMl1, const int ml, const int layer, const int tube) const
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.
bool isGoodMultilayer(const Identifier &Id) const
Amg::Transform3D m_transform