diff --git a/reco/L1/CbmCaMCModule.h b/reco/L1/CbmCaMCModule.h index ba885d05fb0936446721e7fb0f05965842776f37..c83315b159e5b9e5087830409b99ee6f88df3743 100644 --- a/reco/L1/CbmCaMCModule.h +++ b/reco/L1/CbmCaMCModule.h @@ -65,7 +65,10 @@ namespace cbm::ca /// @brief Constructor /// @param verbosity Verbosity level /// @param perfMode Performance mode (defines cut on number of consecutive stations with hit or point) - MCModule(int verb = 0, int perfMode = 3) : fVerbose(verb), fPerformanceMode(perfMode) {} + MCModule(int verb = 0, int perfMode = 1) : fVerbose(verb), fPerformanceMode(perfMode) + { + LOG(info) << "cbm::ca::MCModule: performance mode = " << fPerformanceMode; + } /// @brief Destructor ~MCModule() = default; @@ -292,31 +295,16 @@ int cbm::ca::MCModule::MatchHitWithMc(int iHitExt) return iPoint; } - if constexpr (L1DetectorID::kTof == DetID) { - for (int iLink = 0; iLink < pHitMatch->GetNofLinks(); ++iLink) { - const auto& link = pHitMatch->GetLink(iLink); - if (link.GetIndex() > -1) { - int iPointExt = link.GetIndex(); - int iEvent = link.GetEntry(); - int iFile = link.GetFile(); - iPoint = fpMCData->FindInternalPointIndex(DetID, iPointExt, iEvent, iFile); - } - else { - return -1; - } - } // iLink - } - else { - if (pHitMatch->GetNofLinks() > 0) { - const auto& link = pHitMatch->GetMatchedLink(); - if (link.GetIndex() > -1) { - int index = link.GetIndex(); - int event = link.GetEntry(); - int file = link.GetFile(); - iPoint = fpMCData->FindInternalPointIndex(DetID, index, event, file); - } + if (pHitMatch->GetNofLinks() > 0) { + const auto& link = pHitMatch->GetMatchedLink(); + if (link.GetIndex() > -1) { + int index = link.GetIndex(); + int event = link.GetEntry(); + int file = link.GetFile(); + iPoint = fpMCData->FindInternalPointIndex(DetID, index, event, file); } } + return iPoint; } @@ -389,10 +377,7 @@ std::optional<::ca::tools::MCPoint> cbm::ca::MCModule::FillMCPoint(int iExtId, i // // ----- Get station index int iStLoc = fvpDetInterface[DetID]->GetTrackingStationIndex(pExtPoint); int stationID = fpParameters->GetStationIndexActive(iStLoc, DetID); - - if constexpr (L1DetectorID::kTof != DetID) { // ???? - if (stationID == -1) { return std::nullopt; } // Skip points from inactive stations - } + if (stationID == -1) { return std::nullopt; } // Skip points from inactive stations // Update point time with event time time += fpMCEventList->GetEventTime(iEvent, iFile); diff --git a/reco/L1/CbmL1.h b/reco/L1/CbmL1.h index b3e751dbe64a2ff9a03d9a13c7033b3bbd30d4e3..f2283fb1b386edd8124ba81d6ac0668affa2f761 100644 --- a/reco/L1/CbmL1.h +++ b/reco/L1/CbmL1.h @@ -718,33 +718,15 @@ int CbmL1::MatchHitWithMc(int iHitExt) const assert(pHitMatch); int iPointInt = -1; - if constexpr (L1DetectorID::kTof == DetID) { - for (int iLink = 0; iLink < pHitMatch->GetNofLinks(); ++iLink) { - const auto& link = pHitMatch->GetLink(iLink); - if (link.GetIndex() > -1) { - int iPointExt = link.GetIndex(); - int iEvent = link.GetEntry(); - int iFile = link.GetFile(); - auto itPoint = fmMCPointsLinksMap.find(CbmL1LinkKey(iPointExt + indexShift, iEvent, iFile)); - if (itPoint == fmMCPointsLinksMap.cend()) { continue; } - iPointInt = itPoint->second; - } - else { - return -1; - } - } // iLink - } - else { - if (pHitMatch->GetNofLinks() > 0) { - const auto& link = pHitMatch->GetMatchedLink(); - if (link.GetIndex() > -1) { - int iPointExt = link.GetIndex(); - int iEvent = link.GetEntry(); - int iFile = link.GetFile(); - auto itPoint = fmMCPointsLinksMap.find(CbmL1LinkKey(iPointExt + indexShift, iEvent, iFile)); - if (itPoint == fmMCPointsLinksMap.cend()) { return -1; } - iPointInt = itPoint->second; - } + if (pHitMatch->GetNofLinks() > 0) { + const auto& link = pHitMatch->GetMatchedLink(); + if (link.GetIndex() > -1) { + int iPointExt = link.GetIndex(); + int iEvent = link.GetEntry(); + int iFile = link.GetFile(); + auto itPoint = fmMCPointsLinksMap.find(CbmL1LinkKey(iPointExt + indexShift, iEvent, iFile)); + if (itPoint == fmMCPointsLinksMap.cend()) { return -1; } + iPointInt = itPoint->second; } } return iPointInt; diff --git a/reco/L1/qa/CbmCaOutputQa.cxx b/reco/L1/qa/CbmCaOutputQa.cxx index abb6e8b7ed5017becb156be1bf59424a66f117ba..455fc6024947819ec0c4b2826b9963815d4b237a 100644 --- a/reco/L1/qa/CbmCaOutputQa.cxx +++ b/reco/L1/qa/CbmCaOutputQa.cxx @@ -40,6 +40,8 @@ OutputQa::OutputQa(int verbose, bool isMCUsed) : CbmQaTask("CbmCaOutputQa", verb AddTrackType(ETrackType::kPrim); AddTrackType(ETrackType::kPrimFast); AddTrackType(ETrackType::kPrimLongFast); + AddTrackType(ETrackType::kPrimLong); + AddTrackType(ETrackType::kSec); AddTrackType(ETrackType::kSecFast); AddTrackType(ETrackType::kPrimE); @@ -122,12 +124,11 @@ void OutputQa::FillHistograms() if (isPrimary) { FillRecoTrack(ETrackType::kPrim, iTrkReco); - if (mcTrk.GetP() > CbmL1Constants::MinFastMom) { - FillRecoTrack(ETrackType::kPrimFast, iTrkReco); - if (mcTrk.GetTotNofStationsWithHit() == fpParameters->GetNstationsActive()) { - FillRecoTrack(ETrackType::kPrimLongFast, iTrkReco); - } - } + bool bFast = mcTrk.GetP() > CbmL1Constants::MinFastMom; + bool bLong = mcTrk.GetTotNofStationsWithHit() == fpParameters->GetNstationsActive(); + if (bFast) { FillRecoTrack(ETrackType::kPrimFast, iTrkReco); } + if (bLong) { FillRecoTrack(ETrackType::kPrimLong, iTrkReco); } + if (bLong && bFast) { FillRecoTrack(ETrackType::kPrimLongFast, iTrkReco); } } else { FillRecoTrack(ETrackType::kSec, iTrkReco); @@ -217,12 +218,11 @@ void OutputQa::FillHistograms() FillMCTrack(ETrackType::kAll, iTrkMC); if (isPrimary) { FillMCTrack(ETrackType::kPrim, iTrkMC); - if (mcTrk.GetP() > CbmL1Constants::MinFastMom) { - FillMCTrack(ETrackType::kPrimFast, iTrkMC); - if (mcTrk.GetTotNofStationsWithHit() == fpParameters->GetNstationsActive()) { - FillMCTrack(ETrackType::kPrimLongFast, iTrkMC); - } - } + bool bFast = mcTrk.GetP() > CbmL1Constants::MinFastMom; + bool bLong = mcTrk.GetTotNofStationsWithHit() == fpParameters->GetNstationsActive(); + if (bFast) { FillMCTrack(ETrackType::kPrimFast, iTrkMC); } + if (bLong) { FillMCTrack(ETrackType::kPrimLong, iTrkMC); } + if (bLong && bFast) { FillMCTrack(ETrackType::kPrimLongFast, iTrkMC); } } else { FillMCTrack(ETrackType::kSec, iTrkMC); @@ -509,9 +509,11 @@ InitStatus OutputQa::InitHistograms() LOG(info) << i << ' ' << fvpTrackHistograms[i].get() << ' ' << fvbTrackTypeOn[i]; } + // TODO: Replace these parameters into the AddTrackType method!!! RegisterTrackQa("all", "all", ETrackType::kAll); if (IsMCUsed()) { RegisterTrackQa("prim_long_fast", "primary long fast", ETrackType::kPrimLongFast); + RegisterTrackQa("prim_long", "primary long", ETrackType::kPrimLong); RegisterTrackQa("ghost", "ghost", ETrackType::kGhost, true); RegisterTrackQa("prim", "primary", ETrackType::kPrim); RegisterTrackQa("prim_fast", "primary fast", ETrackType::kPrimFast); @@ -554,6 +556,20 @@ InitStatus OutputQa::InitHistograms() RegisterTrackQa("sec_pbar", "secondary #bar{p}", ETrackType::kSecPBAR); } + // Init default track types for the summary table + if (!fmSummaryTableEntries.size()) { + // clang-format off + fmSummaryTableEntries = { + ETrackType::kPrimLongFast, + ETrackType::kPrimLong, + ETrackType::kPrimFast, + ETrackType::kAll, + ETrackType::kPrim, + ETrackType::kSec + }; + // clang-format on + } + return kSUCCESS; } @@ -565,6 +581,7 @@ bool OutputQa::Check() if (IsMCUsed()) { fpMCModule->Finish(); + // TODO: Add cuts on entries from fmSummaryTableEntries int nRows = std::count_if(fvbTrackTypeOn.begin(), fvbTrackTypeOn.end(), [](const auto& f) { return f == true; }); CbmQaTable* aTable = MakeQaObject<CbmQaTable>("summary_table", "Tracking summary table", nRows + 1, 9); int iRow = 0; diff --git a/reco/L1/qa/CbmCaOutputQa.h b/reco/L1/qa/CbmCaOutputQa.h index afa5c54f0ead843d6e50671ed4fe53d81824645e..d795b7d5e1d4f72c704328e5de12e8077b7cf9e9 100644 --- a/reco/L1/qa/CbmCaOutputQa.h +++ b/reco/L1/qa/CbmCaOutputQa.h @@ -31,6 +31,7 @@ namespace cbm::ca enum ETrackType { kPrimLongFast, ///< primary long tracks (all stations in set) + kPrimLong, ///< long primary kAll, ///< all tracks kGhost, ///< ghost tracks (no MC is used) kPrim, ///< primary @@ -167,6 +168,13 @@ namespace cbm::ca /// @param mode Performance mode (1 is default: TODO - test) void SetPerformanceMode(int mode) { fPerformanceMode = mode; } + /// @brief Set track type list for summary table + /// @param trackTypes A of track type set + void SetTrackTypeListForSummary(std::set<ETrackType>&& trackTypes) + { + fmSummaryTableEntries = std::move(trackTypes); + } + ClassDef(OutputQa, 0); protected: @@ -260,6 +268,8 @@ namespace cbm::ca ::ca::Monitor<EMonitorKey> fMonitor {"Output tracking QA"}; + std::set<ETrackType> fmSummaryTableEntries; ///< Which track types should be listed in the summary table + // ************************* // ** List of histograms ** // *************************