ATLAS Offline Software
Loading...
Searching...
No Matches
MdtMultiChamberGeometry.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include <algorithm>
8#include <iostream>
9#include <iterator>
10
12
13namespace TrkDriftCircleMath {
14
15 MdtMultiChamberGeometry::MdtMultiChamberGeometry(const std::vector<MdtChamberGeometry>& chambers) : m_chambers(chambers) {
16 m_validGeometry = std::find_if(m_chambers.begin(), m_chambers.end(),
17 [](const MdtChamberGeometry& geo) { return !geo.validGeometry(); }) == m_chambers.end();
18 }
19
22 DCVec crossedTubes;
23 crossedTubes.reserve(60);
24 if (!m_validGeometry) {
25 std::cout << " >>>>> invalid geometry <<<<< " << std::endl;
26 return crossedTubes;
27 }
28
29 for (const MdtChamberGeometry& it : m_chambers) { it.tubesPassedByLine(line, ml, crossedTubes); }
30
31 std::stable_sort(crossedTubes.begin(), crossedTubes.end(), SortDcsByY());
32
33 return crossedTubes;
34 }
35
36 void MdtMultiChamberGeometry::print(MsgStream& msg) const {
37 for (const MdtChamberGeometry& it : m_chambers) { it.print(msg); }
38 }
39
40 unsigned int MdtMultiChamberGeometry::nlay() const { return m_chambers.empty() ? 0 : m_chambers[0].nlay(); }
41
42 LocVec2D MdtMultiChamberGeometry::tubePosition(unsigned int ml, unsigned int lay, unsigned int tube) const {
43 std::vector<MdtChamberGeometry>::const_iterator it = m_chambers.begin();
44 if (it->validId(ml, lay, tube))
45 return it->tubePosition(ml, lay, tube);
46 else
47 return it->tubePosition(1, 0, 0);
48 }
49} // namespace TrkDriftCircleMath
Implementation of 2 dimensional vector class.
Definition LocVec2D.h:16
DCVec tubesPassedByLine(const Line &line, int ml) const
LocVec2D tubePosition(unsigned int ml, unsigned int lay, unsigned int tube) const override
Function object to check whether two Segments are sub/super sets or different.
std::vector< DriftCircle > DCVec
void stable_sort(DataModel_detail::iterator< DVL > beg, DataModel_detail::iterator< DVL > end)
Specialization of stable_sort for DataVector/List.
MsgStream & msg
Definition testRead.cxx:32