diff --git a/reco/L1/CbmL1.cxx b/reco/L1/CbmL1.cxx index 1e08fe7e065ecd7f20edca477aec3061eeb21170..c1fb50c6bec4479a5e524104ea2014417a6d047d 100644 --- a/reco/L1/CbmL1.cxx +++ b/reco/L1/CbmL1.cxx @@ -455,6 +455,7 @@ InitStatus CbmL1::Init() NMvdStations = (fUseMVD) ? CbmKF::Instance()->vMvdMaterial.size() : 0; NStsStations = CbmStsSetup::Instance()->GetNofStations(); NStation = NMvdStations + NStsStations + NMuchStations + NTrdStations + NTOFStation; + geo.push_back(NStation); geo.push_back(NMvdStations); geo.push_back(NStsStations); @@ -744,6 +745,7 @@ InitStatus CbmL1::Init() } } + // TODO: replace these values to L1Parameters geo.push_back(fTrackingLevel); geo.push_back(fMomentumCutOff); geo.push_back(fGhostSuppression); @@ -773,88 +775,161 @@ InitStatus CbmL1::Init() /******************************************************************************************************************** * EXPERIMENTAL FEATURE: usage of L1InitManager for L1Algo initialization * ********************************************************************************************************************/ + {//L1Algo new init start - // NOTE: The - - // Step 0: Get reference to the L1Algo initialization manager - L1InitManager* initMan = algo->GetL1InitManager(); - - // Step 1: Initialize magnetic field function - // Set magnetic field slices - auto fieldGetterFcn = [](const double(&inPos)[3], double(&outB)[3]) { - CbmKF::Instance()->GetMagneticField()->GetFieldValue(inPos, outB); - }; - initMan->SetFieldFunction(fieldGetterFcn); - - - /// TODO: temporary for tests, must be initialized somewhere in run_reco.C or similar - fActiveTrackingDetectorIDs = {L1DetectorID::kMvd, L1DetectorID::kSts}; + // Step 0: Get reference to the L1Algo initialization manager + L1InitManager* initMan = algo->GetL1InitManager(); - /// Step 2: initialize IDs of detectors active in tracking - initMan->SetActiveDetectorIDs(fActiveTrackingDetectorIDs); + // Step 1: Initialize magnetic field function + // Set magnetic field slices + auto fieldGetterFcn = [](const double(&inPos)[3], double(&outB)[3]) { + CbmKF::Instance()->GetMagneticField()->GetFieldValue(inPos, outB); + }; + initMan->SetFieldFunction(fieldGetterFcn); + // Step 2: Initialize target + auto& target = CbmKF::Instance()->vTargets[0]; + initMan->SetTargetPosition(target.x, target.y, target.z); + + // Step 3: Initialize primary vertex field + initMan->InitTargetField(2.5); - constexpr double PI = 3.14159265358; // TODO: why cmath is not used? - /// Step 2: initialize IDs - initMan->SetStationsNumberCrosscheck(L1DetectorID::kMvd, NMvdStations); - initMan->SetStationsNumberCrosscheck(L1DetectorID::kSts, NStsStations); - initMan->SetStationsNumberCrosscheck(L1DetectorID::kMuch, NMuchStations); + // Step 4: initialize IDs of detectors active in tracking + // TODO: temporary for tests, must be initialized somewhere in run_reco.C or similar + fActiveTrackingDetectorIDs = {L1DetectorID::kMvd, L1DetectorID::kSts}; + initMan->SetActiveDetectorIDs(fActiveTrackingDetectorIDs); + constexpr double PI = 3.14159265358; // TODO: why cmath is not used? - // Setup MVD stations info - for (int iSt = 0; iSt < NMvdStations; ++iSt) { // NOTE: example using in-stack defined objects - CbmMvdDetector* mvdDetector = CbmMvdDetector::Instance(); - CbmMvdStationPar* mvdStationPar = mvdDetector->GetParameterFile(); + // Step 5: initialize number of stations for each detector ID + initMan->SetStationsNumberCrosscheck(L1DetectorID::kMvd, NMvdStations); + initMan->SetStationsNumberCrosscheck(L1DetectorID::kSts, NStsStations); + initMan->SetStationsNumberCrosscheck(L1DetectorID::kMuch, NMuchStations); + initMan->SetStationsNumberCrosscheck(L1DetectorID::kTrd, NTrdStations); + initMan->SetStationsNumberCrosscheck(L1DetectorID::kTof, NTOFStation); - CbmKFTube& t = CbmKF::Instance()->vMvdMaterial[iSt]; - auto stationInfo = L1BaseStationInfo(L1DetectorID::kMvd, iSt); - stationInfo.SetStationType(1); // MVD // TODO: to be exchanged with specific flags (timeInfo, fieldInfo etc.) - stationInfo.SetTimeInfo(0); - stationInfo.SetZ(t.z); - stationInfo.SetMaterial(t.dz, t.RadLength); - stationInfo.SetXmax(t.R); - stationInfo.SetYmax(t.R); - stationInfo.SetRmin(t.r); - stationInfo.SetRmax(t.R); - fscal mvdFrontPhi = 0; - fscal mvdBackPhi = PI / 2.; - fscal mvdFrontSigma = mvdStationPar->GetXRes(iSt) / 10000; - fscal mvdBackSigma = mvdStationPar->GetYRes(iSt) / 10000; - stationInfo.SetFrontBackStripsGeometry(mvdFrontPhi, mvdFrontSigma, mvdBackPhi, mvdBackSigma); - initMan->AddStation(stationInfo); - } + // Step 6: setup station info - // Setup STS stations info - for (int iSt = 0; iSt < NStsStations; ++iSt) { // NOTE: example using smart pointers - auto cbmSts = CbmStsSetup::Instance()->GetStation(iSt); - std::unique_ptr<L1BaseStationInfo> stationInfo(new L1BaseStationInfo(L1DetectorID::kSts, iSt)); - // TODO: replace with std::make_unique, when C++14 is avaliable!!!! - // auto stsStation = std::make_unique<L1BaseStationInfo>(L1DetectorID::kSts, iSt); - stationInfo->SetStationType(0); // STS - stationInfo->SetTimeInfo(0); - - // Setup station geometry and material - stationInfo->SetZ(cbmSts->GetZ()); - double stsXmax = cbmSts->GetXmax(); - double stsYmax = cbmSts->GetYmax(); - stationInfo->SetXmax(stsXmax); - stationInfo->SetYmax(stsYmax); - stationInfo->SetRmin(0); - stationInfo->SetRmax(stsXmax > stsYmax ? stsXmax : stsYmax); - stationInfo->SetMaterial(cbmSts->GetSensorD(), cbmSts->GetRadLength()); - - // Setup strips geometry - // TODO: why fscal instead of double in initialization? - fscal stsFrontPhi = cbmSts->GetSensorRotation() + cbmSts->GetSensorStereoAngle(0) * PI / 180.; - fscal stsBackPhi = cbmSts->GetSensorRotation() + cbmSts->GetSensorStereoAngle(1) * PI / 180.; - fscal stsFrontSigma = cbmSts->GetSensorPitch(0) / sqrt(12); - fscal stsBackSigma = stsFrontSigma; - stationInfo->SetFrontBackStripsGeometry(stsFrontPhi, stsFrontSigma, stsBackPhi, stsBackSigma); - initMan->AddStation(stationInfo); - } - initMan->PrintStations(/*vebosity = */ 1); + // Setup MVD stations info + for (int iSt = 0; iSt < NMvdStations; ++iSt) { // NOTE: example using in-stack defined objects + CbmMvdDetector* mvdDetector = CbmMvdDetector::Instance(); + CbmMvdStationPar* mvdStationPar = mvdDetector->GetParameterFile(); + CbmKFTube& t = CbmKF::Instance()->vMvdMaterial[iSt]; + auto stationInfo = L1BaseStationInfo(L1DetectorID::kMvd, iSt); + stationInfo.SetStationType(1); // MVD // TODO: to be exchanged with specific flags (timeInfo, fieldInfo etc.) + stationInfo.SetTimeInfo(0); + stationInfo.SetZ(t.z); + stationInfo.SetMaterial(t.dz, t.RadLength); + stationInfo.SetXmax(t.R); + stationInfo.SetYmax(t.R); + stationInfo.SetRmin(t.r); + stationInfo.SetRmax(t.R); + fscal mvdFrontPhi = 0; + fscal mvdBackPhi = PI / 2.; + fscal mvdFrontSigma = mvdStationPar->GetXRes(iSt) / 10000; + fscal mvdBackSigma = mvdStationPar->GetYRes(iSt) / 10000; + stationInfo.SetFrontBackStripsGeometry(mvdFrontPhi, mvdFrontSigma, mvdBackPhi, mvdBackSigma); + initMan->AddStation(stationInfo); + } + + // Setup STS stations info + for (int iSt = 0; iSt < NStsStations; ++iSt) { // NOTE: example using smart pointers + auto cbmSts = CbmStsSetup::Instance()->GetStation(iSt); + std::unique_ptr<L1BaseStationInfo> stationInfo(new L1BaseStationInfo(L1DetectorID::kSts, iSt)); + // TODO: replace with std::make_unique, when C++14 is avaliable!!!! + // auto stsStation = std::make_unique<L1BaseStationInfo>(L1DetectorID::kSts, iSt); + stationInfo->SetStationType(0); // STS + stationInfo->SetTimeInfo(1); + + // Setup station geometry and material + stationInfo->SetZ(cbmSts->GetZ()); + double stsXmax = cbmSts->GetXmax(); + double stsYmax = cbmSts->GetYmax(); + stationInfo->SetXmax(stsXmax); + stationInfo->SetYmax(stsYmax); + stationInfo->SetRmin(0); + stationInfo->SetRmax(stsXmax > stsYmax ? stsXmax : stsYmax); + stationInfo->SetMaterial(cbmSts->GetSensorD(), cbmSts->GetRadLength()); + + // Setup strips geometry + // TODO: why fscal instead of double in initialization? + fscal stsFrontPhi = cbmSts->GetSensorRotation() + cbmSts->GetSensorStereoAngle(0) * PI / 180.; + fscal stsBackPhi = cbmSts->GetSensorRotation() + cbmSts->GetSensorStereoAngle(1) * PI / 180.; + fscal stsFrontSigma = cbmSts->GetSensorPitch(0) / sqrt(12); + fscal stsBackSigma = stsFrontSigma; + stationInfo->SetFrontBackStripsGeometry(stsFrontPhi, stsFrontSigma, stsBackPhi, stsBackSigma); + initMan->AddStation(stationInfo); + } + + // Setup MuCh stations info + for (int iSt = 0; iSt < NMuchStations; ++iSt) { + int muchStationID = iSt / 3; + int muchLayerID = iSt % 3; + CbmMuchStation* station = (CbmMuchStation*) fGeoScheme->GetStation(muchStationID); + 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.SetXmax(100.); + stationInfo.SetYmax(100.); + stationInfo.SetRmin(0.); + stationInfo.SetRmax(100.); + fscal muchFrontPhi = 0; + fscal muchBackPhi = PI / 2.; + fscal muchFrontSigma = 0.1; + fscal muchBackSigma = 0.1; + stationInfo.SetFrontBackStripsGeometry(muchFrontPhi, muchFrontSigma, muchBackPhi, muchBackSigma); + initMan->AddStation(stationInfo); + } + + // 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); + CbmTrdParModDigi* module = (CbmTrdParModDigi*) fTrdDigiPar->GetModulePar(trdModuleID); + auto stationInfo = L1BaseStationInfo(L1DetectorID::kTrd, skip); + int stationType = (iSt == 1 || iSt == 3) ? 6 : 3; + stationInfo.SetStationType(stationType); + stationInfo.SetTimeInfo(1); + stationInfo.SetZ(module->GetZ()); + stationInfo.SetMaterial(2. * module->GetSizeZ(), 10.); + stationInfo.SetXmax(module->GetSizeX()); + stationInfo.SetYmax(module->GetSizeY()); + stationInfo.SetRmin(0.); + stationInfo.SetRmax(2. * module->GetSizeX()); // TODO: Why multiplied with 2.? + fscal trdFrontPhi = 0; + fscal trdBackPhi = PI / 2.; + fscal trdFrontSigma = 1.; + fscal trdBackSigma = 1.; + stationInfo.SetFrontBackStripsGeometry(trdFrontPhi, trdFrontSigma, trdBackPhi, trdBackSigma); + } + + // Setup TOF stations info + for (int iSt = 0; iSt < NTOFStation; ++iSt) { + auto stationInfo = L1BaseStationInfo(L1DetectorID::kTof, iSt); + stationInfo.SetStationType(4); + stationInfo.SetTimeInfo(1); + stationInfo.SetZ(TofStationZ[iSt]); + stationInfo.SetMaterial(10., 10.); // TODO: add Tof width dz and rad. len + stationInfo.SetXmax(20.); + stationInfo.SetYmax(20.); + stationInfo.SetRmin(0.); + stationInfo.SetRmax(150.); + fscal tofFrontPhi = 0; + fscal tofBackPhi = PI / 2.; + fscal tofFrontSigma = 1.; + fscal tofBackSigma = 1.; + stationInfo.SetFrontBackStripsGeometry(tofFrontPhi, tofFrontSigma, tofBackPhi, tofBackSigma); + } + + initMan->PrintStations(/*vebosity = */ 1); + } // L1Algo new init: end /******************************************************************************************************************** ********************************************************************************************************************/ diff --git a/reco/L1/L1Algo/L1Algo.cxx b/reco/L1/L1Algo/L1Algo.cxx index f6bcfd58ee5e03b04cd8aa3ca0661f6d50b56eee..207a7b219a707d5cd6dcf4cb8a4430f82b57c7c9 100644 --- a/reco/L1/L1Algo/L1Algo.cxx +++ b/reco/L1/L1Algo/L1Algo.cxx @@ -84,7 +84,6 @@ void L1Algo::Init(const L1Vector<fscal>& geo, const bool UseHitErrors, const Tra // threadNumberToCpuMap[2*i+1] = 15-(i+8); // } - int ind = 0; { L1FieldValue B[3]; @@ -104,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++]); - NStsStations = 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.) fNfieldStations = NStsStations + NMvdStations; @@ -230,26 +229,75 @@ void L1Algo::Init(const L1Vector<fscal>& geo, const bool UseHitErrors, const Tra // NEW INITIALIZATION (BETA) // - - LOG(debug) << "\\"; - LOG(debug) << " \\"; - LOG(debug) << " Original L1Station vector content"; - LOG(debug) << " /"; - LOG(debug) << "/"; - int nStations = fL1InitManager.GetStationsNumber(); + // 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 NfieldStationsNew = NMvdStationsNew + NStsStationsNew; + + // Get field near target + L1FieldValue vtxFieldValueNew = fInitManager.GetTargetFieldValue(); + L1FieldRegion vtxFieldRegionNew = fInitManager.GetTargetFieldRegion(); + + // Fill L1Station array + fInitManager.TransferL1StationArray(fStationsNew); + + + LOG(debug) << "**********************************************************************"; + LOG(debug) << "* New L1Algo initialization cross check (tmp log, to be removed!) *"; + LOG(debug) << "**********************************************************************"; + LOG(debug) << "** Number of stations (origial) **"; + LOG(debug) << "\tTotal: " << NStations; + LOG(debug) << "\tMVD: " << NMvdStations; + LOG(debug) << "\tSTS: " << NStsStations; + LOG(debug) << "\tField: " << fNfieldStations; + LOG(debug) << "** Number of stations (new) **"; + LOG(debug) << "\tTotal: " << NStationsNew; + LOG(debug) << "\tMVD: " << NMvdStationsNew; + LOG(debug) << "\tSTS: " << NStsStationsNew; + LOG(debug) << "\tField: " << NfieldStationsNew; + + LOG(debug) << "** Magnetic field near target (original)**"; + LOG(debug) << "\tField Value: " << vtxFieldValue.x[0] << ' ' << vtxFieldValue.y[0] << ' ' << vtxFieldValue.z[0]; + LOG(debug) << "\tField Region:"; + LOG(debug) << "\t\tcx0: " << vtxFieldRegion.cx0[0]; + LOG(debug) << "\t\tcx1: " << vtxFieldRegion.cx1[0]; + LOG(debug) << "\t\tcx2: " << vtxFieldRegion.cx2[0]; + LOG(debug) << "\t\tcy0: " << vtxFieldRegion.cy0[0]; + LOG(debug) << "\t\tcy1: " << vtxFieldRegion.cy1[0]; + LOG(debug) << "\t\tcy2: " << vtxFieldRegion.cy2[0]; + LOG(debug) << "\t\tcz0: " << vtxFieldRegion.cz0[0]; + LOG(debug) << "\t\tcz1: " << vtxFieldRegion.cz1[0]; + 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 Region:"; + LOG(debug) << "\t\tcx0: " << vtxFieldRegionNew.cx0[0]; + LOG(debug) << "\t\tcx1: " << vtxFieldRegionNew.cx1[0]; + LOG(debug) << "\t\tcx2: " << vtxFieldRegionNew.cx2[0]; + LOG(debug) << "\t\tcy0: " << vtxFieldRegionNew.cy0[0]; + LOG(debug) << "\t\tcy1: " << vtxFieldRegionNew.cy1[0]; + LOG(debug) << "\t\tcy2: " << vtxFieldRegionNew.cy2[0]; + LOG(debug) << "\t\tcz0: " << vtxFieldRegionNew.cz0[0]; + LOG(debug) << "\t\tcz1: " << vtxFieldRegionNew.cz1[0]; + LOG(debug) << "\t\tcz2: " << vtxFieldRegionNew.cz2[0]; + LOG(debug) << "\t\tz0: " << vtxFieldRegionNew.z0[0]; + + LOG(debug) << "** Original L1Station array content **"; + int nStations = fInitManager.GetStationsNumber(); for (const auto& aStation : vStations) { int idx = &aStation - vStations; if (idx == nStations) { break; } LOG(debug) << "Station Global No: " << idx; aStation.Print(); } - LOG(debug) << "\\"; - LOG(debug) << " \\"; - LOG(debug) << " New L1Station vector content"; - LOG(debug) << " /"; - LOG(debug) << "/"; - fL1InitManager.TransferL1StationArray(fStationsNew); - nStations = fL1InitManager.GetStationsNumber(); + LOG(debug) << "** New L1Station array content **"; + nStations = fInitManager.GetStationsNumber(); for (const auto& aStation : fStationsNew) { int idx = &aStation - &fStationsNew.front(); if (idx == nStations) { break; } diff --git a/reco/L1/L1Algo/L1Algo.h b/reco/L1/L1Algo/L1Algo.h index bed6235b04ba1a267078d9e05ab8ddb16df10bc7..28744a52f430cd94103b862fd42839be986ac747 100644 --- a/reco/L1/L1Algo/L1Algo.h +++ b/reco/L1/L1Algo/L1Algo.h @@ -36,7 +36,8 @@ class L1AlgoDraw; //#endif //#define MERGE_CLONES -#define FEATURING_L1ALGO_INIT + +#define FEATURING_L1ALGO_INIT 1 // If defined, new initialization will be used, if not - the old one #include <array> #include <iomanip> @@ -365,12 +366,12 @@ public: // TODO: We should think about, where non-constexpr L1Alog parameters can be modified. At the moment we can create a // L1Parameters object somewhere outside the L1Algo, fill its fields there and then pass it directly to // the L1Algo instance. - L1InitManager* GetL1InitManager() { return &fL1InitManager; } + L1InitManager* GetL1InitManager() { return &fInitManager; } private: /// Object containing L1Parameters. Default consturctor is used L1Parameters fL1Parameters; ///< Object of L1Algo parameters class - L1InitManager fL1InitManager; ///< Object of L1Algo initialization manager 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 5a24814fd00bda53a4ff22badc7414cfce384046..1de28ca6719881d1686f9a0c08ac74306b865884 100644 --- a/reco/L1/L1Algo/L1InitManager.cxx +++ b/reco/L1/L1Algo/L1InitManager.cxx @@ -201,39 +201,61 @@ void L1InitManager::SetStationsNumberCrosscheck(L1DetectorID detectorID, int nSt //----------------------------------------------------------------------------------------------------------------------- // -void L1InitManager::SetReferencePrimaryVertexPoints(double z0, double z1, double z2) +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; + fInitFlags[L1InitManager::kEtargetPos] = true; +} + +//----------------------------------------------------------------------------------------------------------------------- +// +void L1InitManager::InitTargetField(double zStep) { if (fInitFlags[L1InitManager::kEprimaryVertexField]) { - LOG(warn) - << "L1InitManager::SetReferencePrimaryVertexPoints: attempt to redefine reference points for field calculation " - << "near primary vertex. Ignore"; + LOG(warn) << "L1InitManager::InitTargetField: attempt to reinitialize the field value and field region " + << "near target. Ignore"; return; } // Check for field function if (!fInitFlags[L1InitManager::kEfieldFunction]) { - LOG(error) - << "L1InitManager::SetReferencePrimaryVertexPoints: attempt to set reference points for field calculation near " - << "primary vertex before the magnetic field function intialization"; + LOG(error) << "L1InitManager::InitTargetField: attempt to initialze the field value and field region near " + << "target before initializing field function"; assert((fInitFlags[L1InitManager::kEfieldFunction])); } + // Check for target defined + if (!fInitFlags[L1InitManager::kEtargetPos]) { + LOG(error) << "L1InitManager::InitTargetField: attempt to initialize the field value and field region near " + << "target before the target position initialization"; + assert((fInitFlags[L1InitManager::kEtargetPos])); + } + constexpr int numberOfDimensions {3}; constexpr int numberOfReferencePoints {3}; - std::array<double, numberOfReferencePoints> inputZ = {z0, z1, z2}; // tmp array to store input assigned with index + std::array<double, numberOfReferencePoints> inputNodalZ { + fTargetPos[2], fTargetPos[2] + zStep, fTargetPos[2] + 2. * zStep }; std::array<L1FieldValue, numberOfReferencePoints> B = {}; - std::array<fvec, numberOfReferencePoints> z = {z0, z1, z2}; + std::array<fvec, numberOfReferencePoints> z = {}; for (int idx = 0; idx < numberOfReferencePoints; ++idx) { - double point[numberOfDimensions] = {0., 0., inputZ[idx]}; + double point[numberOfDimensions] = {0., 0., inputNodalZ[idx]}; double field[numberOfDimensions] = {}; fFieldFunction(point, field); + z[idx] = inputNodalZ[idx]; B[idx].x = field[0]; B[idx].y = field[1]; B[idx].z = field[2]; } - fPrimaryVertexFieldRegion.Set(B[0], z[0], B[1], z[1], B[2], z[2]); - fPrimaryVertexFieldValue = B[0]; + fTargetFieldRegion.Set(B[0], z[0], B[1], z[1], B[2], z[2]); + fTargetFieldValue = B[0]; fInitFlags[L1InitManager::kEprimaryVertexField] = true; } diff --git a/reco/L1/L1Algo/L1InitManager.h b/reco/L1/L1Algo/L1InitManager.h index df7307d4956f0007279dfd4692469b4f9e48bb8f..8f095d0f17bc1c5e61964402e860dad9abb47855 100644 --- a/reco/L1/L1Algo/L1InitManager.h +++ b/reco/L1/L1Algo/L1InitManager.h @@ -62,6 +62,7 @@ private: kEactiveDetectorIDs, ///< If the detector sequence is set kEstationsNumberCrosscheck, ///< If the crosscheck station numbers were setup kEfieldFunction, ///< If magnetic field getter funciton is set + kEtargetPos, ///< If target position was defined kEprimaryVertexField, ///< If magnetic field value and region defined at primary vertex kEifStationNumbersChecked, ///< If the station number was already checked kEstationsInfo, ///< If all the planned stations were added to the manager @@ -118,10 +119,13 @@ public: int GetStationsNumber() const { return static_cast<int>(fStationsInfo.size()); } /// Gets a number of stations for a particualr detector ID int GetStationsNumber(L1DetectorID detectorID) const; + /// Gets a target position + const std::array<double, 3>& GetTargetPosition() const { return fTargetPos; } + // TODO: define enum of dimensions.... /// Gets a L1FieldRegion object at primary vertex - const L1FieldRegion& GetPrimaryVertexFieldRegion() const { return fPrimaryVertexFieldRegion; } + const L1FieldRegion& GetTargetFieldRegion() const { return fTargetFieldRegion; } /// Gets a L1FieldValue object at primary vertex - const L1FieldValue& GetPrimaryVertexFieldValue() const { return fPrimaryVertexFieldValue; } + const L1FieldValue& GetTargetFieldValue() const { return fTargetFieldValue; } // // SETTERS @@ -133,10 +137,13 @@ public: void SetFieldFunction(const std::function<void(const double (&xyz)[3], double (&B)[3])>& fieldFcn); /// Sets a number of stations for a particular tracking detector ID to provide initialization cross-check void SetStationsNumberCrosscheck(L1DetectorID detectorID, int nStations); - /// Sets z coordinates referecne points in a vicinity of primary vertex to calculate L1FieldValue and L1FieldReference - /// values + /// Sets target poisition + 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 // TODO: Consider posibility for linear approximation - void SetReferencePrimaryVertexPoints(double z0, double z1, double z2); + void InitTargetField(double zStep); private: @@ -150,6 +157,10 @@ private: std::bitset<L1InitManager::kEND> fInitFlags {}; ///< Initialization flags std::set<L1DetectorID> fActiveDetectorIDs {}; ///< Set of tracking detectors, active during this analysis session + /* Target fields */ + + std::array<double, 3> fTargetPos {}; ///< Nominal target position coordinates + /* Stations related fields */ std::set<L1BaseStationInfo> fStationsInfo {}; ///< Set of L1BaseStationInfo objects @@ -162,8 +173,8 @@ private: // NOTE: fTotalNumberOfStations is excess field for logic, but it's imortant to track L1Algo initialization /* Vertex related fields */ - L1FieldValue fPrimaryVertexFieldValue {}; ///> L1FieldValue object at primary vertex - L1FieldRegion fPrimaryVertexFieldRegion {}; ///> L1FieldRegion object at primary vertex + L1FieldValue fTargetFieldValue {}; ///> L1FieldValue object at target + L1FieldRegion fTargetFieldRegion {}; ///> L1FieldRegion object at target }; -#endif // L1InitManager_h +#endif diff --git a/reco/L1/L1Algo/L1Parameters.h b/reco/L1/L1Algo/L1Parameters.h index 3789c2a2f0177d396ceeb9961820305de6d3599f..d8e8ec2baccb1443f732337abaf82648f9d03e41 100644 --- a/reco/L1/L1Algo/L1Parameters.h +++ b/reco/L1/L1Algo/L1Parameters.h @@ -14,14 +14,14 @@ #include <FairLogger.h> -#include <iomanip> -#include <sstream> -#include <string> -#include <unordered_map> +//#include <iomanip> +//#include <sstream> +//#include <string> +//#include <unordered_map> #include "L1Def.h" // For EnumClassHash #include "L1Vector.h" -#include "utils/L1AlgoFunctions.h" +//#include "utils/L1AlgoFunctions.h" //#define L1ALGODEV diff --git a/reco/L1/L1Algo/L1Station.h b/reco/L1/L1Algo/L1Station.h index 2a42c7a8ca19268feb18b528aa4c431cf5b23c11..d626d77cf1a634498be4e3ad9d5f093ef05e9bf9 100644 --- a/reco/L1/L1Algo/L1Station.h +++ b/reco/L1/L1Algo/L1Station.h @@ -10,6 +10,13 @@ #include "L1UMeasurementInfo.h" #include "L1XYMeasurementInfo.h" + +#define L1Station_h_TMP_DEBUG 1 + +#ifdef L1Station_h_TMP_DEBUG +# include <iomanip> +#endif // L1Station_h_TMP_DEBUG + class L1Station { public: @@ -55,6 +62,7 @@ public: void Print() const { +#ifdef L1Station_h_TMP_DEBUG LOG(info) << "==== L1Station object at " << this; LOG(info) << "- L1Station fields:"; LOG(info) << "--- Station type ID: " << type; @@ -94,6 +102,7 @@ public: LOG(info) << "------- sin(phi): " << yInfo.sin_phi[0]; LOG(info) << "------- sigma2: " << yInfo.sigma2[0]; LOG(info) << ""; +#endif // L1Station_h_TMP_DEBUG } } _fvecalignment;