diff --git a/reco/L1/CbmL1.cxx b/reco/L1/CbmL1.cxx index 0a1dec0c4073b12247024901224892c628f2e8f1..38a63d8a9b02a132c362f20f1ce4ab3dc8de9014 100644 --- a/reco/L1/CbmL1.cxx +++ b/reco/L1/CbmL1.cxx @@ -34,6 +34,7 @@ #include <boost/filesystem.hpp> // TODO: include of CbmSetup.h creates problems on Mac // #include "CbmSetup.h" +#include "CbmEvent.h" #include "CbmMCDataObject.h" #include "CbmStsFindTracks.h" #include "CbmStsHit.h" @@ -882,14 +883,41 @@ InitStatus CbmL1::Init() void CbmL1::Reconstruct(CbmEvent* event) { static int nevent = 0; + fvSelectedMcEvents.clear(); + int bestMcFile = -1; + int bestMcEvent = -1; + if (fPerformance) { - int nofEvents = fpMcEventList->GetNofEvents(); - for (int iE = 0; iE < nofEvents; iE++) { - int fileId = fpMcEventList->GetFileIdByIndex(iE); - int eventId = fpMcEventList->GetEventIdByIndex(iE); - fvSelectedMcEvents.insert(DFSET::value_type(fileId, eventId)); + if (event) { + CbmMatch* match = event->GetMatch(); + if (!match) { + LOG(error) << "CbmL1: match between reco and MC events missing!! Performance can not be evaluated!!"; + fPerformance = 0; + } + else { + cout << "CbmL1: mc events all " << fpMcEventList->GetNofEvents() << " mc events linked " << match->GetNofLinks() + << std::endl; + for (int iLink = 0; iLink < match->GetNofLinks(); iLink++) { + const CbmLink& link = match->GetLink(iLink); + fvSelectedMcEvents.insert(DFSET::value_type(link.GetFile(), link.GetEntry())); + cout << "CbmL1: linked mc event file " << link.GetFile() << " event " << link.GetEntry() << std::endl; + } + if (match->GetNofLinks() > 1) { + const CbmLink& link = match->GetMatchedLink(); + bestMcFile = link.GetFile(); + bestMcEvent = link.GetEntry(); + } + } + } + else { + int nofEvents = fpMcEventList->GetNofEvents(); + for (int iE = 0; iE < nofEvents; iE++) { + int fileId = fpMcEventList->GetFileIdByIndex(iE); + int eventId = fpMcEventList->GetEventIdByIndex(iE); + fvSelectedMcEvents.insert(DFSET::value_type(fileId, eventId)); + } } } @@ -902,16 +930,19 @@ void CbmL1::Reconstruct(CbmEvent* event) ReadEvent(event); - if (fPerformance) { HitMatch(); // calculate the max number of Hits\mcPoints on continuous(consecutive) stations for (auto it = fvMCTracks.begin(); it != fvMCTracks.end(); ++it) { it->Init(); } + if (bestMcFile >= 0) { // suppress mc tracks from complementary mc events + for (auto it = fvMCTracks.begin(); it != fvMCTracks.end(); ++it) { + if (it->iFile != bestMcFile || it->iEvent != bestMcEvent) { it->SetIsReconstructable(false); } + } + } } - if ((fPerformance) && (fSTAPDataMode < 2)) { InputPerformance(); } // FieldApproxCheck(); diff --git a/reco/L1/CbmL1MCTrack.cxx b/reco/L1/CbmL1MCTrack.cxx index befff96e6c7863b30bad194d998364c4f259db2e..d4df61048e0f883e8b41442653a8238b67d21304 100644 --- a/reco/L1/CbmL1MCTrack.cxx +++ b/reco/L1/CbmL1MCTrack.cxx @@ -78,7 +78,7 @@ void CbmL1MCTrack::Init() CalculateMaxNStaMC(); CalculateMaxNStaHits(); CalculateIsReconstructable(); -} // void CbmL1MCTrack::Init() +} float CbmL1MCTrack::Fraction_MC() diff --git a/reco/L1/CbmL1MCTrack.h b/reco/L1/CbmL1MCTrack.h index 007b07bbd31bf31e5113a29dd8178894761bda30..6dcac4bd72199ad97f644c2d630bcfe00deea5cf 100644 --- a/reco/L1/CbmL1MCTrack.h +++ b/reco/L1/CbmL1MCTrack.h @@ -61,6 +61,8 @@ public: void AddTouchTrack(CbmL1Track* tTr) { tTracks.push_back_no_warning(tTr); } bool IsDisturbed() const { return tTracks.size(); } + void SetIsReconstructable(bool v) { isReconstructable = v; } + friend class CbmL1; double pt() { return sqrt(px * px + py * py); } diff --git a/reco/L1/L1Algo/L1CaTrackFinder.cxx b/reco/L1/L1Algo/L1CaTrackFinder.cxx index ba9d808422f4bc1b0462a7c8638ff227b46e1110..daeb6ad4dc48cd1f8e078f2e908cf0102586dd24 100644 --- a/reco/L1/L1Algo/L1CaTrackFinder.cxx +++ b/reco/L1/L1Algo/L1CaTrackFinder.cxx @@ -62,8 +62,8 @@ void L1Algo::CaTrackFinder() for (int iS = 0; iS < fParameters.GetNstationsActive(); ++iS) { - const L1Station& st = fParameters.GetStation(iS); - int nStationHits = fInputData.GetNhits(iS); + const L1Station& st = fParameters.GetStation(iS); + int nStationHits = fInputData.GetNhits(iS); fscal maxTimeBeforeHit = std::numeric_limits<fscal>::min(); @@ -220,4 +220,4 @@ void L1Algo::CaTrackFinder() auto timerEnd = std::chrono::high_resolution_clock::now(); fCaRecoTime = (double) (std::chrono::duration<double>(timerEnd - timerStart).count()); std::cout << "CaTracker: nSubSlices processed = " << nSubSlices << std::endl; -} \ No newline at end of file +} diff --git a/reco/L1/OffLineInterface/CbmL1StsTrackFinder.h b/reco/L1/OffLineInterface/CbmL1StsTrackFinder.h index d2155623228c5834d79f1c246082208320a98d4f..06b9292860d29a38fef502232006c2edef01b94f 100644 --- a/reco/L1/OffLineInterface/CbmL1StsTrackFinder.h +++ b/reco/L1/OffLineInterface/CbmL1StsTrackFinder.h @@ -37,22 +37,23 @@ public: /** Destructor **/ - virtual ~CbmL1StsTrackFinder(); + ~CbmL1StsTrackFinder(); /** Initialisation **/ - virtual void Init(); + void Init(); /** Track finding algorithm **/ - virtual Int_t DoFind(); + Int_t DoFind(); /** Execute track finding on one event ** @param event Pointer to event object ** @value Number of created tracks **/ - virtual Int_t FindTracks(CbmEvent* event); + Int_t FindTracks(CbmEvent* event); + /// set a default particle mass for the track fit /// it is used during reconstruction