From 4a239646c6398aeb2f9101edbb758d823a2120b8 Mon Sep 17 00:00:00 2001 From: "s.zharko@gsi.de" <s.zharko@gsi.de> Date: Mon, 7 Feb 2022 19:34:46 +0100 Subject: [PATCH] New init for L1Algo: updates, clang-formatted --- reco/L1/CbmL1.cxx | 38 +++++++++++++++++--------------- reco/L1/L1Algo/L1Algo.cxx | 22 +++++++++--------- reco/L1/L1Algo/L1Algo.h | 4 ++-- reco/L1/L1Algo/L1InitManager.cxx | 14 ++++++------ reco/L1/L1Algo/L1InitManager.h | 6 ++--- reco/L1/L1Algo/L1Station.h | 6 ++--- 6 files changed, 46 insertions(+), 44 deletions(-) diff --git a/reco/L1/CbmL1.cxx b/reco/L1/CbmL1.cxx index c1fb50c6be..7d1ff1efe9 100644 --- a/reco/L1/CbmL1.cxx +++ b/reco/L1/CbmL1.cxx @@ -775,7 +775,7 @@ InitStatus CbmL1::Init() /******************************************************************************************************************** * EXPERIMENTAL FEATURE: usage of L1InitManager for L1Algo initialization * ********************************************************************************************************************/ - {//L1Algo new init start + { //L1Algo new init start // Step 0: Get reference to the L1Algo initialization manager L1InitManager* initMan = algo->GetL1InitManager(); @@ -788,15 +788,15 @@ InitStatus CbmL1::Init() initMan->SetFieldFunction(fieldGetterFcn); // Step 2: Initialize target - auto& target = CbmKF::Instance()->vTargets[0]; + auto& target = CbmKF::Instance()->vTargets[0]; initMan->SetTargetPosition(target.x, target.y, target.z); - + // Step 3: Initialize primary vertex field initMan->InitTargetField(2.5); // Step 4: initialize IDs of detectors active in tracking - // TODO: temporary for tests, must be initialized somewhere in run_reco.C or similar + // TODO: temporary for tests, must be initialized somewhere in run_reco.C or similar fActiveTrackingDetectorIDs = {L1DetectorID::kMvd, L1DetectorID::kSts}; initMan->SetActiveDetectorIDs(fActiveTrackingDetectorIDs); @@ -806,10 +806,10 @@ InitStatus CbmL1::Init() initMan->SetStationsNumberCrosscheck(L1DetectorID::kMvd, NMvdStations); initMan->SetStationsNumberCrosscheck(L1DetectorID::kSts, NStsStations); initMan->SetStationsNumberCrosscheck(L1DetectorID::kMuch, NMuchStations); - initMan->SetStationsNumberCrosscheck(L1DetectorID::kTrd, NTrdStations); + initMan->SetStationsNumberCrosscheck(L1DetectorID::kTrd, NTrdStations); initMan->SetStationsNumberCrosscheck(L1DetectorID::kTof, NTOFStation); - // Step 6: setup station info + // Step 6: setup station info // Setup MVD stations info for (int iSt = 0; iSt < NMvdStations; ++iSt) { // NOTE: example using in-stack defined objects @@ -865,16 +865,16 @@ InitStatus CbmL1::Init() // Setup MuCh stations info for (int iSt = 0; iSt < NMuchStations; ++iSt) { - int muchStationID = iSt / 3; - int muchLayerID = iSt % 3; + int muchStationID = iSt / 3; + int muchLayerID = iSt % 3; CbmMuchStation* station = (CbmMuchStation*) fGeoScheme->GetStation(muchStationID); - CbmMuchLayer* layer = station->GetLayer(muchLayerID); + CbmMuchLayer* layer = station->GetLayer(muchLayerID); auto stationInfo = L1BaseStationInfo(L1DetectorID::kMuch, iSt); stationInfo.SetStationType(2); // MVD // TODO: to be exchanged with specific flags (timeInfo, fieldInfo etc.) stationInfo.SetTimeInfo(1); stationInfo.SetZ(layer->GetZ()); - stationInfo.SetMaterial(layer->GetDz(), 0); // TODO: Why rad len is 0????? + stationInfo.SetMaterial(layer->GetDz(), 0); // TODO: Why rad len is 0????? stationInfo.SetXmax(100.); stationInfo.SetYmax(100.); stationInfo.SetRmin(0.); @@ -889,12 +889,14 @@ InitStatus CbmL1::Init() // Setup TRD stations info for (int iSt = 0; iSt < NTrdStations; ++iSt) { - int skip = iSt; // temporary solution to remove TRD with id == 1 wrom mCBM - if ((fTrackingMode == L1Algo::TrackingMode::kMcbm) && (fMissingHits)) {if (iSt > 0) {skip++;}} - int trdModuleID = fTrdDigiPar->GetModuleId(skip); + int skip = iSt; // temporary solution to remove TRD with id == 1 wrom mCBM + if ((fTrackingMode == L1Algo::TrackingMode::kMcbm) && (fMissingHits)) { + if (iSt > 0) { skip++; } + } + int trdModuleID = fTrdDigiPar->GetModuleId(skip); CbmTrdParModDigi* module = (CbmTrdParModDigi*) fTrdDigiPar->GetModulePar(trdModuleID); - auto stationInfo = L1BaseStationInfo(L1DetectorID::kTrd, skip); - int stationType = (iSt == 1 || iSt == 3) ? 6 : 3; + auto stationInfo = L1BaseStationInfo(L1DetectorID::kTrd, skip); + int stationType = (iSt == 1 || iSt == 3) ? 6 : 3; stationInfo.SetStationType(stationType); stationInfo.SetTimeInfo(1); stationInfo.SetZ(module->GetZ()); @@ -902,7 +904,7 @@ InitStatus CbmL1::Init() stationInfo.SetXmax(module->GetSizeX()); stationInfo.SetYmax(module->GetSizeY()); stationInfo.SetRmin(0.); - stationInfo.SetRmax(2. * module->GetSizeX()); // TODO: Why multiplied with 2.? + stationInfo.SetRmax(2. * module->GetSizeX()); // TODO: Why multiplied with 2.? fscal trdFrontPhi = 0; fscal trdBackPhi = PI / 2.; fscal trdFrontSigma = 1.; @@ -916,7 +918,7 @@ InitStatus CbmL1::Init() stationInfo.SetStationType(4); stationInfo.SetTimeInfo(1); stationInfo.SetZ(TofStationZ[iSt]); - stationInfo.SetMaterial(10., 10.); // TODO: add Tof width dz and rad. len + stationInfo.SetMaterial(10., 10.); // TODO: add Tof width dz and rad. len stationInfo.SetXmax(20.); stationInfo.SetYmax(20.); stationInfo.SetRmin(0.); @@ -929,7 +931,7 @@ InitStatus CbmL1::Init() } initMan->PrintStations(/*vebosity = */ 1); - } // L1Algo new init: end + } // L1Algo new init: end /******************************************************************************************************************** ********************************************************************************************************************/ diff --git a/reco/L1/L1Algo/L1Algo.cxx b/reco/L1/L1Algo/L1Algo.cxx index 207a7b219a..9cce9ea106 100644 --- a/reco/L1/L1Algo/L1Algo.cxx +++ b/reco/L1/L1Algo/L1Algo.cxx @@ -103,8 +103,8 @@ void L1Algo::Init(const L1Vector<fscal>& geo, const bool UseHitErrors, const Tra } //vStations.clear(); NStations = static_cast<int>(geo[ind++]); - NMvdStations = static_cast<int>(geo[ind++]); // TODO: get rid of NMbdStations (S. Zh.) - NStsStations = static_cast<int>(geo[ind++]); // TODO: get rid of NStsStations (S. Zh.) + NMvdStations = static_cast<int>(geo[ind++]); // TODO: get rid of NMbdStations (S. Zh.) + NStsStations = static_cast<int>(geo[ind++]); // TODO: get rid of NStsStations (S. Zh.) fNfieldStations = NStsStations + NMvdStations; @@ -229,20 +229,20 @@ void L1Algo::Init(const L1Vector<fscal>& geo, const bool UseHitErrors, const Tra // NEW INITIALIZATION (BETA) // - // Get number of stations + // Get number of stations int NStationsNew = fInitManager.GetStationsNumber(); // TODO: we must to get rid of station specification in the L1Algo - int NMvdStationsNew = fInitManager.GetStationsNumber(static_cast<L1DetectorID>(0)); - int NStsStationsNew = fInitManager.GetStationsNumber(static_cast<L1DetectorID>(1)); + int NMvdStationsNew = fInitManager.GetStationsNumber(static_cast<L1DetectorID>(0)); + int NStsStationsNew = fInitManager.GetStationsNumber(static_cast<L1DetectorID>(1)); int NfieldStationsNew = NMvdStationsNew + NStsStationsNew; - + // Get field near target - L1FieldValue vtxFieldValueNew = fInitManager.GetTargetFieldValue(); + L1FieldValue vtxFieldValueNew = fInitManager.GetTargetFieldValue(); L1FieldRegion vtxFieldRegionNew = fInitManager.GetTargetFieldRegion(); - // Fill L1Station array + // Fill L1Station array fInitManager.TransferL1StationArray(fStationsNew); - + LOG(debug) << "**********************************************************************"; LOG(debug) << "* New L1Algo initialization cross check (tmp log, to be removed!) *"; @@ -272,10 +272,10 @@ void L1Algo::Init(const L1Vector<fscal>& geo, const bool UseHitErrors, const Tra LOG(debug) << "\t\tcz2: " << vtxFieldRegion.cz2[0]; LOG(debug) << "\t\tz0: " << vtxFieldRegion.z0[0]; - LOG(debug) << "** Magnetic field near target (new)**"; - LOG(debug) << "\tField Value: " << vtxFieldValueNew.x[0] << ' ' << vtxFieldValueNew.y[0] << ' ' << vtxFieldValueNew.z[0]; + LOG(debug) << "\tField Value: " << vtxFieldValueNew.x[0] << ' ' << vtxFieldValueNew.y[0] << ' ' + << vtxFieldValueNew.z[0]; LOG(debug) << "\tField Region:"; LOG(debug) << "\t\tcx0: " << vtxFieldRegionNew.cx0[0]; LOG(debug) << "\t\tcx1: " << vtxFieldRegionNew.cx1[0]; diff --git a/reco/L1/L1Algo/L1Algo.h b/reco/L1/L1Algo/L1Algo.h index 28744a52f4..9c4069f186 100644 --- a/reco/L1/L1Algo/L1Algo.h +++ b/reco/L1/L1Algo/L1Algo.h @@ -37,7 +37,7 @@ class L1AlgoDraw; //#define MERGE_CLONES -#define FEATURING_L1ALGO_INIT 1 // If defined, new initialization will be used, if not - the old one +#define FEATURING_L1ALGO_INIT 1 // If defined, new initialization will be used, if not - the old one #include <array> #include <iomanip> @@ -370,7 +370,7 @@ public: private: /// Object containing L1Parameters. Default consturctor is used - L1Parameters fL1Parameters; ///< Object of L1Algo parameters class + L1Parameters fL1Parameters; ///< Object of L1Algo parameters class L1InitManager fInitManager; ///< Object of L1Algo initialization manager class /// ================================= FUNCTIONAL PART ================================= diff --git a/reco/L1/L1Algo/L1InitManager.cxx b/reco/L1/L1Algo/L1InitManager.cxx index 1de28ca671..d91106d217 100644 --- a/reco/L1/L1Algo/L1InitManager.cxx +++ b/reco/L1/L1Algo/L1InitManager.cxx @@ -202,15 +202,15 @@ void L1InitManager::SetStationsNumberCrosscheck(L1DetectorID detectorID, int nSt //----------------------------------------------------------------------------------------------------------------------- // void L1InitManager::SetTargetPosition(double x, double y, double z) -{ +{ if (fInitFlags[L1InitManager::kEtargetPos]) { LOG(warn) << "L1InitManager::SetTargetPosition: attempt to reinitialize the target position. Ignore"; return; } - fTargetPos[0] = x; - fTargetPos[1] = y; - fTargetPos[2] = z; + fTargetPos[0] = x; + fTargetPos[1] = y; + fTargetPos[2] = z; fInitFlags[L1InitManager::kEtargetPos] = true; } @@ -241,15 +241,15 @@ void L1InitManager::InitTargetField(double zStep) constexpr int numberOfDimensions {3}; constexpr int numberOfReferencePoints {3}; - std::array<double, numberOfReferencePoints> inputNodalZ { - fTargetPos[2], fTargetPos[2] + zStep, fTargetPos[2] + 2. * zStep }; + std::array<double, numberOfReferencePoints> inputNodalZ {fTargetPos[2], fTargetPos[2] + zStep, + fTargetPos[2] + 2. * zStep}; std::array<L1FieldValue, numberOfReferencePoints> B = {}; std::array<fvec, numberOfReferencePoints> z = {}; for (int idx = 0; idx < numberOfReferencePoints; ++idx) { double point[numberOfDimensions] = {0., 0., inputNodalZ[idx]}; double field[numberOfDimensions] = {}; fFieldFunction(point, field); - z[idx] = inputNodalZ[idx]; + z[idx] = inputNodalZ[idx]; B[idx].x = field[0]; B[idx].y = field[1]; B[idx].z = field[2]; diff --git a/reco/L1/L1Algo/L1InitManager.h b/reco/L1/L1Algo/L1InitManager.h index 8f095d0f17..dbf042b7ae 100644 --- a/reco/L1/L1Algo/L1InitManager.h +++ b/reco/L1/L1Algo/L1InitManager.h @@ -121,7 +121,7 @@ public: int GetStationsNumber(L1DetectorID detectorID) const; /// Gets a target position const std::array<double, 3>& GetTargetPosition() const { return fTargetPos; } - // TODO: define enum of dimensions.... + // TODO: define enum of dimensions.... /// Gets a L1FieldRegion object at primary vertex const L1FieldRegion& GetTargetFieldRegion() const { return fTargetFieldRegion; } /// Gets a L1FieldValue object at primary vertex @@ -141,7 +141,7 @@ public: void SetTargetPosition(double x, double y, double z); /// Calculates L1FieldValue and L1FieldReference values for a selected step in z coordinate from the target position - /// \param zStep step between nodal points + /// \param zStep step between nodal points // TODO: Consider posibility for linear approximation void InitTargetField(double zStep); @@ -177,4 +177,4 @@ private: L1FieldRegion fTargetFieldRegion {}; ///> L1FieldRegion object at target }; -#endif +#endif diff --git a/reco/L1/L1Algo/L1Station.h b/reco/L1/L1Algo/L1Station.h index d626d77cf1..1daa7bb1d6 100644 --- a/reco/L1/L1Algo/L1Station.h +++ b/reco/L1/L1Algo/L1Station.h @@ -14,8 +14,8 @@ #define L1Station_h_TMP_DEBUG 1 #ifdef L1Station_h_TMP_DEBUG -# include <iomanip> -#endif // L1Station_h_TMP_DEBUG +#include <iomanip> +#endif // L1Station_h_TMP_DEBUG class L1Station { @@ -102,7 +102,7 @@ public: LOG(info) << "------- sin(phi): " << yInfo.sin_phi[0]; LOG(info) << "------- sigma2: " << yInfo.sigma2[0]; LOG(info) << ""; -#endif // L1Station_h_TMP_DEBUG +#endif // L1Station_h_TMP_DEBUG } } _fvecalignment; -- GitLab