Commit 0f57474d authored by Sergey Zharko's avatar Sergey Zharko
Browse files

codeformat bugfix

parent f66d29a7
......@@ -610,8 +610,8 @@ void CbmL1::ReadEvent(L1AlgoInputData* fData_, float& TsStart, float& TsLength,
CbmStsHit* mh = L1_DYNAMIC_CAST<CbmStsHit*>(listStsHits->At(hitIndexSort));
th.ExtIndex = hitIndexSort;
th.Det = 1;
int stIdx = algo->GetInitManager()
->GetStationIndexActive(CbmStsSetup::Instance()->GetStationNumber(mh->GetAddress()), L1DetectorID::kSts);
int stIdx = algo->GetInitManager()->GetStationIndexActive(
CbmStsSetup::Instance()->GetStationNumber(mh->GetAddress()), L1DetectorID::kSts);
if (stIdx == -1) continue;
......
......@@ -64,13 +64,13 @@ void L1InitManager::AddStation(const L1BaseStationInfo& inStation)
<< ")";
L1MASSERT(0, insertionResult.second, aStream.str().c_str());
}
int index = fStationsInfo.size() - 1 +
(fNstationsGeometry[fNstationsGeometry.size() - 1] - fNstationsActive[fNstationsActive.size() - 1]);
int index = fStationsInfo.size() - 1
+ (fNstationsGeometry[fNstationsGeometry.size() - 1] - fNstationsActive[fNstationsActive.size() - 1]);
fActiveStationGlobalIDs[index] = fStationsInfo.size() - 1;
}
else {
int index = fStationsInfo.size() +
(fNstationsGeometry[fNstationsGeometry.size() - 1] - fNstationsActive[fNstationsActive.size() - 1]);
int index = fStationsInfo.size()
+ (fNstationsGeometry[fNstationsGeometry.size() - 1] - fNstationsActive[fNstationsActive.size() - 1]);
fActiveStationGlobalIDs[index] = -1;
fNstationsActive[static_cast<L1DetectorID_t>(inStation.GetDetectorID())]--;
fNstationsActive[fNstationsActive.size() - 1]--;
......@@ -233,11 +233,11 @@ void L1InitManager::SetNstations(L1DetectorID detectorID, int nStations)
if (nStations) {
fNstationsGeometry[static_cast<L1DetectorID_t>(detectorID)] = nStations;
fNstationsActive[static_cast<L1DetectorID_t>(detectorID)] = nStations;
}
}
else {
// TODO: Probably it is better to replace fatal with warn and remove the detectorID from active detectors (S.Zharko)
LOG(fatal) << "L1InitManager::SetNstations: attempt to initialize zero stations for active detector: "
<< static_cast<L1DetectorID_t>(detectorID);
LOG(fatal) << "L1InitManager::SetNstations: attempt to initialize zero stations for active detector: "
<< static_cast<L1DetectorID_t>(detectorID);
}
}
......@@ -254,7 +254,8 @@ void L1InitManager::SetNstations(L1DetectorID detectorID, int nStations)
fInitController.SetFlag(EInitKey::kStationsNumberCrosscheck, ifInitialized);
}
if (fInitController.GetFlag(EInitKey::kStationsNumberCrosscheck)) {
fNstationsGeometry[L1Parameters::kMaxNdetectors] = std::accumulate(fNstationsGeometry.begin(), fNstationsGeometry.end() - 1, 0);
fNstationsGeometry[L1Parameters::kMaxNdetectors] =
std::accumulate(fNstationsGeometry.begin(), fNstationsGeometry.end() - 1, 0);
fNstationsActive[L1Parameters::kMaxNdetectors] = fNstationsGeometry[L1Parameters::kMaxNdetectors];
}
}
......@@ -353,8 +354,8 @@ void L1InitManager::CheckStationsInfoInit()
//
// loop over active detectors
for (auto itemDetector : fActiveDetectorIDs) {
auto selectDetector = [&itemDetector](const L1BaseStationInfo& station) {
return station.GetDetectorID() == itemDetector;
auto selectDetector = [&itemDetector](const L1BaseStationInfo& station) {
return station.GetDetectorID() == itemDetector;
};
int nStationsExpected = GetNstationsActive(itemDetector);
int nStations = std::count_if(fStationsInfo.begin(), fStationsInfo.end(), selectDetector);
......@@ -373,8 +374,9 @@ void L1InitManager::CheckStationsInfoInit()
int nStationsTotal = fNstationsGeometry[fNstationsGeometry.size() - 1];
if (nStationsTotal > L1Parameters::kMaxNstations) {
std::stringstream aStream;
aStream << "Actual total number of registered stations in geometry (" << nStationsTotal << ") is larger then possible ("
<< L1Parameters::kMaxNstations << "). Please, select another set of active tracking detectors or recompile the code with enlarged"
aStream << "Actual total number of registered stations in geometry (" << nStationsTotal
<< ") is larger then possible (" << L1Parameters::kMaxNstations
<< "). Please, select another set of active tracking detectors or recompile the code with enlarged"
<< " L1Parameters::kMaxNstations value";
// TODO: We have to provide an instruction of how to increase the kMaxNstations
// number keeping the code consistent (S.Zharko)
......
......@@ -19,18 +19,19 @@
#include "L1Vector.h"
//#include <string>
#include <type_traits>
#include <array>
#include <bitset>
#include <memory> //unique_ptr
#include <numeric>
#include <set>
#include <type_traits>
/// Forward declaration of the tracking detectors scoped enumeration. Concrete realization of this enumeration must be
/// determined in the concrete setup class (i.e. CbmL1/BmnL1)
enum class L1DetectorID;
/// Underlying
/// Underlying
using L1DetectorID_t = std::underlying_type_t<L1DetectorID>;
/// Initialization manager for L1Algo
......@@ -141,17 +142,25 @@ public:
/// Gets total number of active stations
int GetNstationsActive() const { return fNstationsActive[fNstationsActive.size() - 1]; }
/// Gets number of active stations for given detector ID
int GetNstationsActive(L1DetectorID detectorID) const { return fNstationsActive[static_cast<L1DetectorID_t>(detectorID)]; }
int GetNstationsActive(L1DetectorID detectorID) const
{
return fNstationsActive[static_cast<L1DetectorID_t>(detectorID)];
}
/// Gets total number of stations, provided by setup geometry
int GetNstationsGeometry() const { return fNstationsGeometry[fNstationsGeometry.size() - 1]; }
/// Gets number of stations, provided by setup geometry for given detector ID
int GetNstationsGeometry(L1DetectorID detectorID) const { return fNstationsGeometry[static_cast<L1DetectorID_t>(detectorID)]; }
int GetNstationsGeometry(L1DetectorID detectorID) const
{
return fNstationsGeometry[static_cast<L1DetectorID_t>(detectorID)];
}
/// Calculates global index of station among geometry (accounts for inactive stations)
/// \param localIndex index of the detector subsystem module/station/layer provided by detector subsystem experts
/// \param detectorID ID of the detector subsystem
__attribute__((always_inline)) int GetStationIndexGeometry(int localIndex, L1DetectorID detectorID) const
__attribute__((always_inline)) int GetStationIndexGeometry(int localIndex, L1DetectorID detectorID) const
{
return localIndex + std::accumulate(fNstationsGeometry.cbegin(), fNstationsGeometry.cbegin() + static_cast<int>(detectorID), 0);
return localIndex
+ std::accumulate(fNstationsGeometry.cbegin(), fNstationsGeometry.cbegin() + static_cast<int>(detectorID),
0);
}
/// Calculates global index of station used by track finder
/// \param localIndex index of the detector subsystem module/station/layer provided by detector subsystem experts
......@@ -231,7 +240,7 @@ private:
/* Stations related fields */
std::set<L1BaseStationInfo> fStationsInfo {}; ///< Set of L1BaseStationInfo objects
/// Numbers of stations, which are active in tracking. Index of an array element (except the last one) corresponds to a given
/// L1DetectorID of the detector subystem. The last array element corresponds to the total number of stations.
std::array<int, L1Parameters::kMaxNdetectors + 1> fNstationsActive {};
......@@ -239,12 +248,12 @@ private:
/// L1DetectorID of the detector subystem. The last array element corresponds to the total number of stations.
std::array<int, L1Parameters::kMaxNdetectors + 1> fNstationsGeometry {};
/// Map of the actual detector indeces to the active detector indeces
/// The vector maps actual station index (which is defined by ) to the index of station in tracking. If the station is inactive,
/// The vector maps actual station index (which is defined by ) to the index of station in tracking. If the station is inactive,
/// its index is equal to -1. Example: let stations 1 and 4 be inactive. Then:
/// actual index: 0 1 2 3 4 5 6 7 8 9 0 0 0 0
/// active index: 0 -1 1 2 -1 3 4 5 6 7 0 0 0 0
std::array<int, L1Parameters::kMaxNstations> fActiveStationGlobalIDs {};
/// active index: 0 -1 1 2 -1 3 4 5 6 7 0 0 0 0
std::array<int, L1Parameters::kMaxNstations> fActiveStationGlobalIDs {};
/// A function which returns magnetic field vector B in a radius-vector xyz
L1FieldFunction_t fFieldFunction {[](const double (&)[3], double (&)[3]) {}};
// NOTE: Stations of daetectors which will not be assigned as active, will not be included in the tracking!!!!!!!
......
......@@ -186,7 +186,8 @@ void CbmL1PFFitter::Fit(vector<CbmStsTrack>& Tracks, vector<int>& pidHypo)
posy = hit->GetY();
posz = hit->GetZ();
// ista = hit->GetStationNr();
ista = CbmL1::Instance()->algo->GetInitManager()->GetStationIndexActive(hit->GetStationNr(), L1DetectorID::kMvd);
ista =
CbmL1::Instance()->algo->GetInitManager()->GetStationIndexActive(hit->GetStationNr(), L1DetectorID::kMvd);
if (ista == -1) continue;
}
else {
......@@ -199,7 +200,8 @@ void CbmL1PFFitter::Fit(vector<CbmStsTrack>& Tracks, vector<int>& pidHypo)
posz = hit->GetZ();
// ista = CbmStsSetup::Instance()->GetStationNumber(hit->GetAddress())
// + NMvdStations; //hit->GetStationNr() - 1 + NMvdStations;
ista = CbmL1::Instance()->algo->GetInitManager()->GetStationIndexActive(CbmStsSetup::Instance()->GetStationNumber(hit->GetAddress()), L1DetectorID::kSts);
ista = CbmL1::Instance()->algo->GetInitManager()->GetStationIndexActive(
CbmStsSetup::Instance()->GetStationNumber(hit->GetAddress()), L1DetectorID::kSts);
if (ista == -1) continue;
}
w[ista][iVec] = 1.f;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment