diff --git a/reco/L1/CbmL1.cxx b/reco/L1/CbmL1.cxx index ec5af950fd4821a0cf0cb98b6a6b3983fc1b131b..1d85bdef907c2138b1f576a7cbce93b6b8d1e0cb 100644 --- a/reco/L1/CbmL1.cxx +++ b/reco/L1/CbmL1.cxx @@ -884,14 +884,6 @@ void CbmL1::Reconstruct(CbmEvent* event) static int nevent = 0; fvSelectedMcEvents.clear(); - // TODO: move these values to CbmL1Parameters namespace (S.Zharko) - bool areDataLeft = true; // whole TS processed? - float TsStart = 0; // starting time of sub-TS - float TsLength = 10000; // length of sub-TS - float TsOverlap = 15; // min length of overlap region - int FstHitinTs = 0; // 1st hit index in TS - - // TODO: Refactor this part, check usage --------------------------------- int nStsHits = (fUseSTS && fpStsHits ? fpStsHits->GetEntriesFast() : 0); @@ -905,7 +897,6 @@ void CbmL1::Reconstruct(CbmEvent* event) SortHits.push_back(std::pair<double, int>(t, j)); } std::sort(SortHits.begin(), SortHits.end()); - if (SortHits.size() > 0) TsStart = SortHits[0].first; ///reco TS start time is set to smallest hit time fvSortedStsHitsIndexes.clear(); fvSortedStsHitsIndexes.reserve(SortHits.size()); for (unsigned int i = 0; i < SortHits.size(); i++) { @@ -930,11 +921,6 @@ void CbmL1::Reconstruct(CbmEvent* event) fvSelectedMcEvents.insert(DFSET::value_type(fileId, eventId)); } } - else { - Int_t iFile = FairRunAna::Instance()->GetEventHeader()->GetInputFileId(); - Int_t iEvent = FairRunAna::Instance()->GetEventHeader()->GetMCEntryNumber(); - fvSelectedMcEvents.insert(DFSET::value_type(iFile, iEvent)); - } if (fVerbose > 1) { cout << "\nCbmL1::Exec event " << ++nevent << " ...\n\n"; } #ifdef _OPENMP @@ -960,133 +946,67 @@ void CbmL1::Reconstruct(CbmEvent* event) fTrackingTime = 0; - - while (areDataLeft) { - if (event) { - areDataLeft = false; - TsStart = 0; - TsLength = 2000000000; // TODO: Why this number was selected? (S.Zharko) - TsOverlap = 0; - FstHitinTs = 0; - } - - - // ----- Read data from branches and send data from IODataManager to L1Algo ---------------------------------------- - ReadEvent(TsStart, TsLength, TsOverlap, FstHitinTs, areDataLeft, event); + // ----- Read data from branches and send data from IODataManager to L1Algo ---------------------------------------- + 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 (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 ((fPerformance) && (fSTAPDataMode < 2)) { InputPerformance(); } - - // FieldApproxCheck(); - // FieldIntegralCheck(); - - // TODO: Remove code below (S.Zharko) - // for (unsigned int iH = 0; iH < (*fpAlgo->vHits).size(); ++iH) { - // #ifdef USE_EVENT_NUMBER - // L1Hit& h = const_cast<L1Hit&>((*fpAlgo->vHits)[iH]); - // h.n = -1; - // #endif - // if (fvExternalHits[iH].mcPointIds.size() == 0) continue; - // #ifdef USE_EVENT_NUMBER - // const CbmL1MCPoint& mcp = fvMCPoints[fvExternalHits[iH].mcPointIds[0]]; - // h.n = mcp.event; - // #endif - // } - - if (fVerbose > 1) { cout << "L1 Track finder..." << endl; } - fpAlgo->CaTrackFinder(); - // IdealTrackFinder(); - fTrackingTime += fpAlgo->fCaRecoTime; - - if (fVerbose > 1) { cout << "L1 Track finder ok" << endl; } - - // save reconstructed tracks - int trackFirstHit = 0; - - float TsStart_new = TsStart + TsLength - TsOverlap; + if ((fPerformance) && (fSTAPDataMode < 2)) { InputPerformance(); } - for (L1Vector<L1Track>::iterator it = fpAlgo->fRecoTracks.begin(); it != fpAlgo->fRecoTracks.end(); it++) { + // FieldApproxCheck(); + // FieldIntegralCheck(); - CbmL1Track t; + if (fVerbose > 1) { cout << "L1 Track finder..." << endl; } + fpAlgo->CaTrackFinder(); + // IdealTrackFinder(); + fTrackingTime += fpAlgo->fCaRecoTime; - for (int i = 0; i < L1TrackPar::kNparTr; i++) { - t.T[i] = it->TFirst[i]; - t.TLast[i] = it->TLast[i]; - t.Tpv[i] = it->Tpv[i]; - } + if (fVerbose > 1) { cout << "L1 Track finder ok" << endl; } - for (int i = 0; i < L1TrackPar::kNparCov; i++) { - t.C[i] = it->CFirst[i]; - t.CLast[i] = it->CLast[i]; - t.Cpv[i] = it->Cpv[i]; - } + // save reconstructed tracks + int trackFirstHit = 0; - t.chi2 = it->chi2; - t.NDF = it->NDF; - t.Hits.clear(); - t.mass = fpAlgo->fDefaultMass; // pion mass - t.is_electron = 0; - t.SetId(vRTracksCur.size()); - - bool isTrackInOverlap = 0; - - for (int i = 0; i < it->NHits; i++) { - int caHitId = fpAlgo->fRecoHits[trackFirstHit + i]; - int cbmHitID = fpAlgo->GetInputData().GetHit(caHitId).ID; - double time = fpAlgo->GetInputData().GetHit(caHitId).t; - t.Hits.push_back(cbmHitID); - if (time >= (TsStart + TsLength - TsOverlap)) { - isTrackInOverlap = 1; - if (TsStart_new > time) { TsStart_new = time; } - } - } - trackFirstHit += it->NHits; + for (L1Vector<L1Track>::iterator it = fpAlgo->fRecoTracks.begin(); it != fpAlgo->fRecoTracks.end(); + trackFirstHit += it->NHits, it++) { - // Discard tracks from overlap region - if (isTrackInOverlap == 1) { continue; } + CbmL1Track t; - vRTracksCur.push_back(t); + for (int i = 0; i < L1TrackPar::kNparTr; i++) { + t.T[i] = it->TFirst[i]; + t.TLast[i] = it->TLast[i]; + t.Tpv[i] = it->Tpv[i]; } - for (int i = 0; i < nStsHits; ++i) { - - CbmStsHit* sh = L1_DYNAMIC_CAST<CbmStsHit*>(fpStsHits->At(fvSortedStsHitsIndexes[i])); - float time = sh->GetTime(); - - if (TsStart_new <= time) { - FstHitinTs = i; - break; - } + for (int i = 0; i < L1TrackPar::kNparCov; i++) { + t.C[i] = it->CFirst[i]; + t.CLast[i] = it->CLast[i]; + t.Cpv[i] = it->Cpv[i]; } - TsStart = TsStart_new; ///Set new TS strat to earliest discarted track - - LOG(debug) << "CA Track Finder: " << fpAlgo->fCaRecoTime << " s/sub-ts" << endl; + t.chi2 = it->chi2; + t.NDF = it->NDF; + t.Hits.clear(); + t.mass = fpAlgo->fDefaultMass; // pion mass + t.is_electron = 0; + t.SetId(vRTracksCur.size()); + + for (int i = 0; i < it->NHits; i++) { + int caHitId = fpAlgo->fRecoHits[trackFirstHit + i]; + int cbmHitID = fpAlgo->GetInputData().GetHit(caHitId).ID; + t.Hits.push_back(cbmHitID); + } + vRTracksCur.push_back(t); } + LOG(debug) << "CA Track Finder: " << fpAlgo->fCaRecoTime << " s/sub-ts" << endl; - if (fPerformance) { - - float start = 0; - float end = 10000000000.f; - int fHit = 0; - bool stop = 0; - - ReadEvent(start, end, start, fHit, stop, event); - HitMatch(); - // calculate the max number of Hits\mcPoints on continuous(consecutive) stations - - for (L1Vector<CbmL1MCTrack>::iterator it = fvMCTracks.begin(); it != fvMCTracks.end(); ++it) - it->Init(); - } // // if (fSTAPDataMode % 2 == 1) { // 1,3 // WriteSTAPAlgoData(); @@ -1128,7 +1048,6 @@ void CbmL1::Reconstruct(CbmEvent* event) // output performance if (fPerformance) { if (fVerbose > 1) { cout << "Performance..." << endl; } - //HitMatch(); TrackMatch(); } diff --git a/reco/L1/CbmL1.h b/reco/L1/CbmL1.h index a9c08f25b75704fe9c07936200489b101f14c7c5..c82075d7703453db376a5b1ddb12f809cdf39533 100644 --- a/reco/L1/CbmL1.h +++ b/reco/L1/CbmL1.h @@ -343,14 +343,8 @@ private: /// Read information about hits, mcPoints and mcTracks into L1 classes /// Repacks data from the external TClonesArray objects to the internal L1 arrays - /// \param TsStart Reference to the time slice start time - /// \param TsLength Reference to the time slice length - /// \param TsOverlap Reference to the time slice overlap length (does not used at the moment) - /// \param FstHitinTs Index of the first hit in the time-slice - /// \param areDataLeft Flag: true - data were left after reading the sub-timeslice /// \param event Pointer to the current CbmEvent object - void ReadEvent(float& TsStart, float& TsLength, float& TsOverlap, int& FstHitinTs, bool& areDataLeft, - CbmEvent* event = NULL); + void ReadEvent(CbmEvent* event = NULL); /// Converts data from generic FairMCPoint based class to the CbmL1MCPoint /// \param MC Pointer to a target CbmL1MCPoint object diff --git a/reco/L1/CbmL1Performance.cxx b/reco/L1/CbmL1Performance.cxx index 717216a3808549bfb69d0f5996d6846e7e126c6f..9feb4cb4eba1636bcc18e9f7d815e6a355cfed53 100644 --- a/reco/L1/CbmL1Performance.cxx +++ b/reco/L1/CbmL1Performance.cxx @@ -1457,6 +1457,7 @@ void CbmL1::TrackFitPerformance() // last TRD point do { + break; // only produce these plots in debug mode if (!fpTrdPoints) break; const CbmL1MCTrack& mcTrack = *(it->GetMCTracks()[0]); int nTrdPoints = fpTrdPoints->Size(mcTrack.iFile, mcTrack.iEvent); @@ -1481,6 +1482,7 @@ void CbmL1::TrackFitPerformance() // last TOF point do { + // only produce these plots in debug mode if (!fpTofPoints) break; const CbmL1MCTrack& mcTrack = *(it->GetMCTracks()[0]); int nTofPoints = fpTofPoints->Size(mcTrack.iFile, mcTrack.iEvent); diff --git a/reco/L1/CbmL1ReadEvent.cxx b/reco/L1/CbmL1ReadEvent.cxx index 0fce653a9c985a0555ad3147ddab7eea1b635b88..95c4f62365e232d2b6c32791a191cc578f3b8b66 100644 --- a/reco/L1/CbmL1ReadEvent.cxx +++ b/reco/L1/CbmL1ReadEvent.cxx @@ -322,16 +322,12 @@ int CbmL1::MatchHitWithMc<L1DetectorID::kTof>(int iHit) const // --------------------------------------------------------------------------------------------------------------------- // -void CbmL1::ReadEvent(float& TsStart, float& TsLength, float& /*TsOverlap*/, int& FstHitinTs, bool& areDataLeft, - CbmEvent* event) +void CbmL1::ReadEvent(CbmEvent* event) { static int nCalls = 0; if (fVerbose >= 10) cout << "ReadEvent: start." << endl; - areDataLeft = false; // no data left after reading the sub-timeslice - - // clear arrays for next event fvMCPoints.clear(); /* <CbmL1MCPoint> */ fvMCTracks.clear(); /* <CbmL1MCTrack> */ @@ -754,9 +750,7 @@ void CbmL1::ReadEvent(float& TsStart, float& TsLength, float& /*TsOverlap*/, int int firstDetStrip = NStrips; - if (event) FstHitinTs = 0; - - for (Int_t j = FstHitinTs; j < nEntSts; j++) { + for (Int_t j = 0; j < nEntSts; j++) { Int_t hitIndex = 0; hitIndex = (event ? event->GetIndex(ECbmDataType::kStsHit, j) : j); @@ -792,14 +786,6 @@ void CbmL1::ReadEvent(float& TsStart, float& TsLength, float& /*TsOverlap*/, int th.id = nMvdHits + hitIndex; - /// stop if reco TS ends and many hits left - if (!event) { - if ((th.time > (TsStart + TsLength)) && ((nEntSts - hitIndex) > 300)) { - areDataLeft = true; // there are unprocessed data left in the time slice - break; - } - } - TVector3 pos, err; h->Position(pos); h->PositionError(err); diff --git a/reco/L1/L1Algo/L1CaTrackFinder.cxx b/reco/L1/L1Algo/L1CaTrackFinder.cxx index 6f65227f3027e27ac88cafc7ffcbf3c07c6d9699..e5a33fb6e866e7f84c422a1f1d7baa10abc29f62 100644 --- a/reco/L1/L1Algo/L1CaTrackFinder.cxx +++ b/reco/L1/L1Algo/L1CaTrackFinder.cxx @@ -96,9 +96,12 @@ void L1Algo::CaTrackFinder() // cut data into sub-timeslices and process them one by one bool areDataLeft = true; // is the whole TS processed + int nSubSlices = 0; while (areDataLeft) { + nSubSlices++; + // select the sub-slice hits fSliceHitIds.clear(); @@ -187,4 +190,5 @@ 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