Skip to content
Snippets Groups Projects
Commit e0b7fd77 authored by Sergei Zharko's avatar Sergei Zharko Committed by Sergey Gorbunov
Browse files

L1: reimplemented counting of stations number inside a magnetic field

parent 1c13fa16
No related branches found
No related tags found
1 merge request!930L1: Updates
......@@ -136,21 +136,22 @@ void L1Algo::ReceiveParameters(L1Parameters&& parameters)
{
fParameters = std::move(parameters);
//int NMvdStations = static_cast<int>(geo[ind++]); // TODO: get rid of NMbdStations (S. Zh.)
int nStationsSts = fParameters.GetNstationsActive(static_cast<L1DetectorID>(1));
fNstationsBeforePipe = fParameters.GetNstationsActive(static_cast<L1DetectorID>(0));
//int NStsStations = static_cast<int>(geo[ind++]); // TODO: get rid of NStsStations (S. Zh.)
fNfieldStations = nStationsSts + fNstationsBeforePipe; // TODO: Provide special getter for it (S.Zharko, 12.05.2022)
if (fTrackingMode == kMcbm) { fNfieldStations = -1; }
LOG(info) << fParameters.ToString(3);
// FIXME: SZh 24.08.2022
// This approach is suitable only for a case, when all the stations inside a magnetic field come right before
// all the stations outside of the field!
fNfieldStations = std::lower_bound(fParameters.GetStations().cbegin(),
fParameters.GetStations().cbegin() + fParameters.GetNstationsActive(),
0, // we are looking for the first zero element
[](const L1Station& s, int edge) { return bool(s.fieldStatus) > edge; })
- fParameters.GetStations().cbegin();
fTrackingLevel = fParameters.GetTrackingLevel();
fGhostSuppression = fParameters.GetGhostSuppression();
fMomentumCutOff = fParameters.GetMomentumCutOff();
LOG(info) << fParameters.ToString(3);
}
/// TODO: Move to L1Hit
......
......@@ -161,6 +161,29 @@ void L1Parameters::CheckConsistency() const
throw std::logic_error(msg.str());
}
/*
* Check magnetic field flags of the stations
*
* In a current version of tracking there are three configurations possible to be proceeded:
* A. All the stations are inside magnetic field
* B. There is no magnetic field in a setup
* C. All the first stations are inside magnetic field, all the last stations are outside the field
* In all the cases the fieldStatus flags should be sorted containing all non-zero elements in the beginning
* (representing stations placed into magnetic field) and all zero elements in the end of z-axis.
*/
bool ifFieldStatusFlagsOk = std::is_sorted(
fStations.cbegin(), fStations.cbegin() + fNstationsActiveTotal,
[&](const L1Station& lhs, const L1Station& rhs) { return bool(lhs.fieldStatus) > bool(rhs.fieldStatus); });
if (!ifFieldStatusFlagsOk) {
std::stringstream msg;
msg << "L1Parameters: invalid object condition: L1 tracking is impossible for a given field configuration:\n";
for (int iSt = 0; iSt < fNstationsActiveTotal; ++iSt) {
msg << "- station ID: " << iSt << ", field status: " << fStations[iSt].fieldStatus << '\n';
}
throw std::logic_error(msg.str());
}
/*
* Check target position SIMD vector
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment