diff --git a/algo/ca/core/pars/CaConfigReader.cxx b/algo/ca/core/pars/CaConfigReader.cxx index 07d325b8acafd7ef7ac23a2d8c41117d6f36644b..bcf12b183b03071ee519bf3ab05db6b59286e467 100644 --- a/algo/ca/core/pars/CaConfigReader.cxx +++ b/algo/ca/core/pars/CaConfigReader.cxx @@ -360,7 +360,7 @@ Iteration ConfigReader::ReadSingleCAIteration(const YAML::Node& node, const Iter iter.SetElectronFlag(node["is_electron"].as<bool>(defaultIter.GetElectronFlag())); iter.SetTrackFromTripletsFlag(node["is_track_from_triplets"].as<bool>(defaultIter.GetTrackFromTripletsFlag())); iter.SetExtendTracksFlag(node["is_extend_tracks"].as<bool>(defaultIter.GetExtendTracksFlag())); - iter.SetJumpedFlag(node["is_jumped"].as<bool>(defaultIter.GetJumpedFlag())); + iter.SetMaxStationGap(node["max_station_gap"].as<int>(defaultIter.GetMaxStationGap())); iter.SetMinNhits(node["min_n_hits"].as<int>(defaultIter.GetMinNhits())); iter.SetMinNhitsStation0(node["min_n_hits_station_0"].as<int>(defaultIter.GetMinNhitsStation0())); } diff --git a/algo/ca/core/pars/CaIteration.cxx b/algo/ca/core/pars/CaIteration.cxx index eec6d882b8393e090f61eab24dc9f2be5c7be01a..1ce9b0c2b116ccf520a3b2914d8c9581987ca812 100644 --- a/algo/ca/core/pars/CaIteration.cxx +++ b/algo/ca/core/pars/CaIteration.cxx @@ -88,7 +88,7 @@ std::string Iteration::ToTableFromVector(const Vector<Iteration>& vIterations) PutRow("Is electron ", [&](const Iteration& i) { msg << i.GetElectronFlag(); }); PutRow("If tracks created from triplets ", [&](const Iteration& i) { msg << i.GetTrackFromTripletsFlag(); }); PutRow("If tracks extended with unused hits", [&](const Iteration& i) { msg << i.GetExtendTracksFlag(); }); - PutRow("If triplets jump over one station ", [&](const Iteration& i) { msg << i.GetJumpedFlag(); }); + PutRow("Triplets can jump over <=n stations", [&](const Iteration& i) { msg << i.GetMaxStationGap(); }); PutRow("Min number of hits ", [&](const Iteration& i) { msg << i.GetMinNhits(); }); PutRow("Min number of hits on station 0 ", [&](const Iteration& i) { msg << i.GetMinNhitsStation0(); }); PutRow("Track chi2 cut ", [&](const Iteration& i) { msg << i.GetTrackChi2Cut(); }); diff --git a/algo/ca/core/pars/CaIteration.h b/algo/ca/core/pars/CaIteration.h index c9afecd5a2bf1415dce2390099e4476858bba6b9..5512083087e1d470a892155ea3eb0921f6def191 100644 --- a/algo/ca/core/pars/CaIteration.h +++ b/algo/ca/core/pars/CaIteration.h @@ -69,8 +69,8 @@ namespace cbm::algo::ca /// \brief Gets station index of the first station used in tracking int GetFirstStationIndex() const { return fFirstStationIndex; } - /// \brief Gets flag: true - triplets are built skipping one station - bool GetJumpedFlag() const { return fIsJumped; } + /// \brief Gets flag: true - triplets are also built with skipping <= GetMaxStationGap stations + int GetMaxStationGap() const { return fMaxStationGap; } /// \brief Gets correction for accounting overlaping and iff z float GetMaxDZ() const { return fMaxDZ; } @@ -141,8 +141,8 @@ namespace cbm::algo::ca /// \brief Sets index of first station used in tracking void SetFirstStationIndex(int index) { fFirstStationIndex = index; } - /// \brief Sets flag: true - triplets are built from hits .... TODO - void SetJumpedFlag(bool flag) { fIsJumped = flag; } + /// \brief Sets flag: true - triplets are built also skipping <= GetMaxStationGap stations + void SetMaxStationGap(int nSkipped) { fMaxStationGap = nSkipped; } /// \brief Sets correction for accounting overlaping and iff z void SetMaxDZ(float input) { fMaxDZ = input; } @@ -236,7 +236,7 @@ namespace cbm::algo::ca bool fIsPrimary = false; ///< Flag: true - only primary tracks are searched for bool fIsElectron = false; ///< Flag: true - only electrons are searched for bool fIsExtendTracks = false; ///< Flag: true - extends track candidates with unused hits - bool fIsJumped = false; ///< Flag: true - find triplets with skip station + int fMaxStationGap = 0; ///< Flag: true - find triplets with fMaxStationGap missing stations /// @brief Flag to select triplets on the iteration as tracks @@ -274,7 +274,7 @@ namespace cbm::algo::ca ar& fIsPrimary; ar& fIsElectron; ar& fIsExtendTracks; - ar& fIsJumped; + ar& fMaxStationGap; ar& fIsTrackFromTriplets; } }; diff --git a/algo/ca/core/tracking/CaTrackFinderWindow.cxx b/algo/ca/core/tracking/CaTrackFinderWindow.cxx index 23e44ab5bf6470d3355c1ff0b701842098b18011..73c1a6869c8d4cc8e252302d24a155ad5a279e4a 100644 --- a/algo/ca/core/tracking/CaTrackFinderWindow.cxx +++ b/algo/ca/core/tracking/CaTrackFinderWindow.cxx @@ -314,32 +314,27 @@ void TrackFinderWindow::CaTrackFinderSlice() frAlgo.fMonitorData.StartTimer(ETimer::TripletConstruction); - ca::TripletConstructor constructor1(&frAlgo); - ca::TripletConstructor constructor2(&frAlgo); - ca::TripletConstructor constructor3(&frAlgo); + ca::TripletConstructor constructor(&frAlgo); + + // indices of the two neighbouring station, taking into account allowed gaps + std::vector<std::pair<int, int>> staPattern; + for (int gap = 0; gap <= frAlgo.fpCurrentIteration->GetMaxStationGap(); gap++) { + for (int i = 0; i <= gap; i++) { + staPattern.push_back(std::make_pair(1 + i, 2 + gap)); + } + } for (int istal = frAlgo.GetParameters().GetNstationsActive() - 2; istal >= frAlgo.fFirstCAstation; istal--) { // start with downstream chambers Tindex nGridEntriesL = frAlgo.vGrid[istal].GetEntries().size(); - for (Tindex iel = 0; iel < nGridEntriesL; ++iel) { ca::HitIndex_t ihitl = frAlgo.vGrid[istal].GetEntries()[iel].GetObjectId(); - constructor1.CreateTripletsForHit(istal, istal + 1, istal + 2, ihitl); - - if (frAlgo.fpCurrentIteration->GetJumpedFlag()) { - constructor2.CreateTripletsForHit(istal, istal + 1, istal + 3, ihitl); - constructor3.CreateTripletsForHit(istal, istal + 2, istal + 3, ihitl); + auto oldSize = frAlgo.fTriplets[istal].size(); + for (auto& pattern : staPattern) { + constructor.CreateTripletsForHit(istal, istal + pattern.first, istal + pattern.second, ihitl); + frAlgo.fTriplets[istal].insert(frAlgo.fTriplets[istal].end(), constructor.GetTriplets().begin(), + constructor.GetTriplets().end()); } - - auto oldSize = frAlgo.fTriplets[istal].size(); - - frAlgo.fTriplets[istal].insert(frAlgo.fTriplets[istal].end(), constructor1.GetTriplets().begin(), - constructor1.GetTriplets().end()); - frAlgo.fTriplets[istal].insert(frAlgo.fTriplets[istal].end(), constructor2.GetTriplets().begin(), - constructor2.GetTriplets().end()); - frAlgo.fTriplets[istal].insert(frAlgo.fTriplets[istal].end(), constructor3.GetTriplets().begin(), - constructor3.GetTriplets().end()); - frAlgo.fHitFirstTriplet[ihitl] = frAlgo.PackTripletId(istal, oldSize); frAlgo.fHitNtriplets[ihitl] = frAlgo.fTriplets[istal].size() - oldSize; } @@ -368,7 +363,8 @@ void TrackFinderWindow::CaTrackFinderSlice() unsigned int neighTriplet = frAlgo.TripletId2Triplet(neighLocation); if (nNeighbours > 0) { - assert((int) neighStation == istal + 1 || (int) neighStation == istal + 2); + assert((int) neighStation >= istal + 1 + && (int) neighStation <= istal + 1 + frAlgo.fpCurrentIteration->GetMaxStationGap()); } unsigned char level = 0; diff --git a/macro/L1/configs/ca_params_global.yaml b/macro/L1/configs/ca_params_global.yaml index faf1ca01265bd79677ac581422d6f78105e6b468..21ccb193a7e5a7df3deea7b8007ea62d507277a3 100644 --- a/macro/L1/configs/ca_params_global.yaml +++ b/macro/L1/configs/ca_params_global.yaml @@ -81,7 +81,7 @@ ca: is_extend_tracks: true is_primary: false is_electron: false - is_jumped: false + max_station_gap: 0 is_track_from_triplets: false - name: "FastPrim" @@ -133,7 +133,7 @@ ca: target_pos_sigma_x: 5. target_pos_sigma_y: 5. is_primary: true - is_jumped: true + max_station_gap: 1 - name: "AllPrimJump" base_iteration: "Default" @@ -143,7 +143,7 @@ ca: target_pos_sigma_x: 5. target_pos_sigma_y: 5. is_primary: true - is_jumped: true + max_station_gap: 1 - name: "AllSecJump" base_iteration: "Default" diff --git a/macro/L1/configs/ca_params_mcbm.yaml b/macro/L1/configs/ca_params_mcbm.yaml index 4cb3acbb007ac3789768c7e13f9cc3825fa67f2f..e7c6069a85a1e922aea4392ef84655a25eb03817 100644 --- a/macro/L1/configs/ca_params_mcbm.yaml +++ b/macro/L1/configs/ca_params_mcbm.yaml @@ -83,7 +83,7 @@ ca: is_extend_tracks: false is_primary: false is_electron: false - is_jumped: false + max_station_gap: 0 is_track_from_triplets: false - name: "FastPrim" @@ -133,7 +133,7 @@ ca: target_pos_sigma_x: 5. target_pos_sigma_y: 5. is_primary: true - is_jumped: true + max_station_gap: 2 - name: "AllPrimJump" base_iteration: "Default" @@ -143,7 +143,7 @@ ca: target_pos_sigma_x: 5. target_pos_sigma_y: 5. is_primary: true - is_jumped: true + max_station_gap: 2 - name: "AllSecJump" base_iteration: "Default" diff --git a/macro/L1/configs/ca_params_sts.yaml b/macro/L1/configs/ca_params_sts.yaml index 7350f5cd7e34a997dd90b8a6e5cba4ff85654291..a07925ea189790a1f21cf731ced1f3f917aaa28d 100644 --- a/macro/L1/configs/ca_params_sts.yaml +++ b/macro/L1/configs/ca_params_sts.yaml @@ -80,7 +80,7 @@ ca: is_extend_tracks: true is_primary: false is_electron: false - is_jumped: false + max_station_gap: 0 is_track_from_triplets: false - name: "FastPrim" @@ -132,7 +132,7 @@ ca: target_pos_sigma_x: 5. target_pos_sigma_y: 5. is_primary: true - is_jumped: true + max_station_gap: 1 - name: "AllPrimJump" base_iteration: "Default" @@ -142,7 +142,7 @@ ca: target_pos_sigma_x: 5. target_pos_sigma_y: 5. is_primary: true - is_jumped: true + max_station_gap: 1 - name: "AllSecJump" base_iteration: "Default" diff --git a/reco/L1/L1Algo/L1ConfigExample.yaml b/reco/L1/L1Algo/L1ConfigExample.yaml index dccfe35a95653a7e5e2895d1d5130323e0f18bb3..ff6f2f50d60dd4df7c1b35c47cfc3a127ea25e4b 100644 --- a/reco/L1/L1Algo/L1ConfigExample.yaml +++ b/reco/L1/L1Algo/L1ConfigExample.yaml @@ -29,7 +29,7 @@ l1: target_pos_sigma_y: 1. # cm is_primary: true is_electron: false - is_jumped: false + max_station_gap: 0 if_extend_tracks: true if_suppress_ghost: false is_track_from_triplets: false @@ -51,7 +51,7 @@ l1: target_pos_sigma_y: 1. # cm is_primary: true is_electron: false - is_jumped: false + max_station_gap: 0 if_extend_tracks: true if_suppress_ghost: false is_track_from_triplets: false @@ -73,7 +73,7 @@ l1: target_pos_sigma_y: 5. # cm is_primary: true is_electron: false - is_jumped: true + max_station_gap: 1 if_extend_tracks: true if_suppress_ghost: true is_track_from_triplets: false @@ -95,7 +95,7 @@ l1: target_pos_sigma_y: 10. # cm is_primary: false is_electron: false - is_jumped: false + max_station_gap: 0 if_extend_tracks: true if_suppress_ghost: true is_track_from_triplets: false