20 std::string
to_string(
const std::vector<T>& v) {
21 std::stringstream ostr{};
23 for (
auto x: v)ostr<<
x<<
", ";
30 return (
pars.position().dot(parDir) > 0 ? 1 : -1) * (parDir.dot(pos));
41 return StatusCode::SUCCESS;
49 for (
unsigned int sector = 1; sector <= 16; ++sector) {
69 static constexpr std::array<StIndex, 4> layers{StIndex::EI, StIndex::EE, StIndex::EM, StIndex::EO};
71 for (
const StIndex stLayer : layers) {
77 std::unique_ptr<Trk::PlaneSurface> surface = std::make_unique<Trk::PlaneSurface>(trans);
82 <<
" center " <<
Amg::toString(surface->center()) <<
" theta " << surface->normal().theta()
86 surfaces.push_back(std::move(
data));
99 constexpr double xToZRotation = -M_PI_2;
101 for (
const StIndex stationLayer : {StIndex::BI, StIndex::BM, StIndex::BO, StIndex::BE}) {
103 if (stationLayer == StIndex::BE &&
m_sectorMapping.isSmall(sector))
continue;
109 Amg::Vector3D globalPosition = sectorRotation * positionInSector;
113 trans.pretranslate(globalPosition);
114 std::unique_ptr<Trk::PlaneSurface> surface = std::make_unique<Trk::PlaneSurface>(trans);
116 if (msgLvl(MSG::VERBOSE)) {
119 <<
" ref theta " << globalPosition.theta() <<
" phi " << globalPosition.phi() <<
" r "
120 << globalPosition.perp() <<
" pos " <<
Amg::toString(globalPosition)
121 <<
" lpos3d " <<
Amg::toString(surface->transform().inverse() * globalPosition)
125 surfaces.push_back(std::move(
data));
132 if (!cache.candidate->getCaloExtension()) {
133 if (!cache.extensionContainer) {
134 std::unique_ptr<Trk::CaloExtension> caloExtension =
136 if (!caloExtension || !caloExtension->muonEntryLayerIntersection()) {
137 ATH_MSG_VERBOSE(
"Failed to create the calo extension for "<<cache.candidate->toString());
140 cache.candidate->setExtension(caloExtension);
143 *cache.extensionContainer);
145 ATH_MSG_VERBOSE(
"Failed to create the calo extension for "<<cache.candidate->toString());
148 cache.candidate->setExtension(caloExtension);
152 if (!cache.createSystemExtension) {
153 ATH_MSG_VERBOSE(
"No system extension is required for "<<cache.candidate->toString());
157 const Trk::TrackParameters* currentPars = cache.candidate->getCaloExtension()->muonEntryLayerIntersection();
164 std::vector<MuonSystemExtension::Intersection> intersections;
167 std::vector<std::shared_ptr<Trk::TrackParameters> > trackParametersVec;
176 <<
" r " << surface.
center().perp() <<
" z " << surface.
center().z());
178 std::unique_ptr<Trk::TrackParameters> exPars{
m_extrapolator->extrapolate(ctx, *currentPars, surface,
184 ATH_MSG_DEBUG(
"Extrapolated in event "<<ctx.eventID().event_number()<<
" track @ "<<
m_printer->print(*exPars));
195 std::shared_ptr<Trk::TrackParameters> sharedPtr{std::move(exPars)};
196 trackParametersVec.emplace_back(sharedPtr);
198 intersections.emplace_back(sharedPtr, it);
199 constexpr double TenCm = 10. * Gaudi::Units::cm;
200 if(std::hypot(sigma_lx, sigma_ly) < std::max(TenCm, 10. * std::hypot(
Amg::error(*currentPars->covariance(),
Trk::locX),
203 currentPars = sharedPtr.get();
205 ATH_MSG_DEBUG(
"Extrapolation reached at "<<
m_printer->print(*sharedPtr)<<
" has larger uncertainties than "<<
209 ATH_MSG_DEBUG(
"Completed extrapolation: destinations " << surfaces.size() <<
" intersections " << intersections.size());
210 if (intersections.empty()){
211 ATH_MSG_DEBUG(
"No system extensions are made for "<<cache.candidate->toString()
212 <<
" will accept the candidate: "<< (!cache.requireSystemExtension ?
"si":
"no"));
213 return !cache.requireSystemExtension;
215 cache.candidate->setExtension(std::make_unique<MuonSystemExtension>(cache.candidate->getCaloExtension()->muonEntryLayerIntersection(),
216 std::move(intersections)));
220 const SystemExtensionCache& cache)
const {
225 if (
eta < -1.05) regionIndex = DetectorRegionIndex::EndcapC;
226 if (
eta > 1.05) regionIndex = DetectorRegionIndex::EndcapA;
230 std::vector<int> sectors;
234 if (cache.useHitSectors) {
235 const auto map_itr = cache.sectorsWithHits->find(regionIndex);
236 if (map_itr == cache.sectorsWithHits->end()) {
240 std::vector<int>::const_iterator sec_itr = std::find_if(
241 sectors.begin(), sectors.end(), [&map_itr](
const int sector) ->
bool { return map_itr->second.count(sector); });
242 if (sec_itr == sectors.end()) {
244 <<
" in MuonStation " <<
regionName(regionIndex));
249 for (
const int sector : sectors) {
251 surfaces.insert(surfaces.end(), toInsert.begin(), toInsert.end());
255 return std::abs(pathAlongPars(muonEntryPars,s1.surfacePtr->center())) <
256 std::abs(pathAlongPars(muonEntryPars,s2.surfacePtr->center()));
259 if (msgLvl(MSG::VERBOSE)) {
260 for (
auto& s1 : surfaces) {
263 <<
", pathAlongPars "<<pathAlongPars(muonEntryPars,s1.surfacePtr->center())
264 <<std::endl<<(*s1.surfacePtr));
272 SystemExtensionCache& cache)
const{
280 const Trk::TrackParameters* entryPars = cache.candidate->getCaloExtension()->muonEntryLayerIntersection();
281 std::vector<const Trk::TrackStateOnSurface*> cmbParVec{};
284 std::vector<MuonSystemExtension::Intersection> intersections{};
306 if (layerIdx == LayerIndex::BarrelExtended) {
307 regionIdx = DetectorRegionIndex::Barrel;
308 layerIdx = LayerIndex::Inner;
318 SurfaceVec::const_iterator surfItr = std::find_if(refSurfaces.begin(), refSurfaces.end(),
320 return surf.layerIndex == layerIdx;
322 if (surfItr == refSurfaces.end()) {
324 <<
", sector: "<<sector <<
", layer: "<<
layerName(layerIdx)
328 lastSurf = (*surfItr);
337 if (std::abs(pathAlongPars(chPars, chPars.
position() - target.center())) >
350 <<
", sector: "<<sector <<
", layer: "<<
layerName(layerIdx)
351 <<
", region index: "<<
regionName(regionIdx) <<
" to surface "<<std::endl<<target<<std::endl
354 <<
" pathAlongPars "<<pathAlongPars(*msTSOS->
trackParameters(), target.center())
358 intersections.emplace_back(std::move(exPars), lastSurf);
364 if (intersections.empty()) {
365 ATH_MSG_DEBUG(
"Failed to find the intersections for the combined track");
368 cache.candidate->setExtension(std::make_unique<MuonSystemExtension>(entryPars, std::move(intersections)));
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
char data[hepevt_bytes_allocation_ATLAS]
DataModel_detail::const_iterator< DataVector > const_iterator
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
base-class for combined reconstruction output Provides access to MuonType and Author
virtual const Trk::Track * primaryTrack() const
access to primary muon system track, zero if non available
virtual std::string toString() const =0
print content to string
class managing geometry of the chamber layers
MuonChamberLayerDescriptor getDescriptor(int sector, DetRegIdx region, LayerIdx layer) const
Tracking class to hold the extrapolation through calorimeter Layers Both the caloEntryLayerIntersecti...
const TrackParameters * muonEntryLayerIntersection() const
access to intersection with the muon entry layer return nullptr if the intersection failed
virtual const Surface & associatedSurface() const =0
Interface method to get the associated Surface.
const Amg::Vector3D & momentum() const
Access method for the momentum.
const Amg::Vector3D & position() const
Access method for the position.
Abstract Base Class for tracking surfaces.
const Amg::Vector3D & center() const
Returns the center position of the Surface.
represents the track state (measurement, material, fit parameters and quality) at a surface.
const MeasurementBase * measurementOnTrack() const
returns MeasurementBase const overload
const TrackParameters * trackParameters() const
return ptr to trackparameters const overload
const Trk::TrackStates * trackStateOnSurfaces() const
return a pointer to a const DataVector of const TrackStateOnSurfaces.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Amg::Transform3D getTranslateZ3D(const double Z)
: Returns a shift transformation along the z-axis
double error(const Amg::MatrixX &mat, int index)
return diagonal error of the matrix caller should ensure the matrix is symmetric and the index is in ...
Amg::Transform3D getRotateZ3D(double angle)
get a rotation transformation around Z-axis
Eigen::Affine3d Transform3D
bool hasPositiveDiagElems(const AmgSymMatrix(N) &mat)
Returns true if all diagonal elements of the covariance matrix are finite aka sane in the above defin...
Eigen::Matrix< double, 3, 1 > Vector3D
Amg::Transform3D getRotateY3D(double angle)
get a rotation transformation around Y-axis
StIndex
enum to classify the different station layers in the muon spectrometer
const std::string & layerName(LayerIndex index)
convert LayerIndex into a string
DetectorRegionIndex
enum to classify the different layers in the muon spectrometer
constexpr int toInt(const EnumType enumVal)
const std::string & regionName(DetectorRegionIndex index)
convert DetectorRegionIndex into a string
LayerIndex toLayerIndex(ChIndex index)
convert ChIndex into LayerIndex
LayerIndex
enum to classify the different layers in the muon spectrometer
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
ParametersBase< TrackParametersDim, Charged > TrackParameters
void stable_sort(DataModel_detail::iterator< DVL > beg, DataModel_detail::iterator< DVL > end)
Specialization of stable_sort for DataVector/List.
struct containing all information to build a Hough transform for a given chamber index