From 3c6c51cc83850150f6967d1480f7e527878d63a7 Mon Sep 17 00:00:00 2001 From: "se.gorbunov" <se.gorbunov@gsi.de> Date: Tue, 28 Nov 2023 08:32:03 +0000 Subject: [PATCH] Ca: add tolerance to the misalignment --- algo/ca/core/pars/CaInitManager.cxx | 4 ++++ algo/ca/core/pars/CaInitManager.h | 16 +++++++++++++++ algo/ca/core/pars/CaParameters.h | 18 +++++++++++++++++ macro/beamtime/mcbm2022/mcbm_event_reco_L1.C | 4 ++++ macro/beamtime/mcbm2022/mcbm_reco.C | 20 ++++++++++++++----- reco/L1/CbmL1.cxx | 9 +++++++++ reco/L1/CbmL1.h | 10 ++++++++++ reco/L1/CbmL1ReadEvent.cxx | 21 ++++++++++---------- 8 files changed, 87 insertions(+), 15 deletions(-) diff --git a/algo/ca/core/pars/CaInitManager.cxx b/algo/ca/core/pars/CaInitManager.cxx index bfa9af0a71..e792814c42 100644 --- a/algo/ca/core/pars/CaInitManager.cxx +++ b/algo/ca/core/pars/CaInitManager.cxx @@ -85,12 +85,16 @@ void InitManager::ClearSetupInfo() fInitController.SetFlag(EInitKey::kRandomSeed, false); fInitController.SetFlag(EInitKey::kGhostSuppression, false); + fParameters.fMisalignmentX.fill(0.); + fParameters.fMisalignmentY.fill(0.); + fParameters.fDevIsIgnoreHitSearchAreas = false; fParameters.fDevIsUseOfOriginalField = false; fParameters.fDevIsMatchDoubletsViaMc = false; fParameters.fDevIsMatchTripletsViaMc = false; fParameters.fDevIsExtendTracksViaMc = false; fParameters.fDevIsSuppressOverlapHitsViaMc = false; + fParameters.fDevIsParSearchWUsed = false; } // ---------------------------------------------------------------------------------------------------------------------- diff --git a/algo/ca/core/pars/CaInitManager.h b/algo/ca/core/pars/CaInitManager.h index 5834644476..57391e2b69 100644 --- a/algo/ca/core/pars/CaInitManager.h +++ b/algo/ca/core/pars/CaInitManager.h @@ -235,6 +235,22 @@ namespace cbm::algo::ca /// \brief Sets upper-bound cut on max number of triplets per one doublet void SetMaxTripletPerDoublets(unsigned int value) { fParameters.fMaxTripletPerDoublets = value; } + /// \brief Sets misalignment parameters in X direction + /// \param detectorId Index of the detector system + /// \param value Misalignment value + void SetMisalignmentX(EDetectorID detectorId, float value) + { + fParameters.fMisalignmentX[static_cast<int>(detectorId)] = value; + } + + /// \brief Sets misalignment parameters in Y direction + /// \param detectorId Index of the detector system + /// \param value Misalignment value + void SetMisalignmentY(EDetectorID detectorId, float value) + { + fParameters.fMisalignmentY[static_cast<int>(detectorId)] = value; + } + /// \brief Takes parameters object from the init-manager instance /// \return A parameter object Parameters&& TakeParameters(); diff --git a/algo/ca/core/pars/CaParameters.h b/algo/ca/core/pars/CaParameters.h index 26fb064623..2ff1ed7db0 100644 --- a/algo/ca/core/pars/CaParameters.h +++ b/algo/ca/core/pars/CaParameters.h @@ -194,6 +194,15 @@ namespace cbm::algo::ca /// \brief Gets ghost suppression flag int GetGhostSuppression() const { return fGhostSuppression; } + /// \brief Gets default mass + float GetDefaultMass() const { return fDefaultMass; } + + /// \brief Gets misalignment of the detector systems in X + float GetMisalignmentXsq(int iDet) const { return fMisalignmentX[iDet] * fMisalignmentX[iDet]; } + + /// \brief Gets misalignment of the detector systems in Y + float GetMisalignmentYsq(int iDet) const { return fMisalignmentY[iDet] * fMisalignmentY[iDet]; } + /// \brief Class invariant checker void CheckConsistency() const; @@ -286,6 +295,12 @@ namespace cbm::algo::ca int fRandomSeed = 1; ///< random seed float fDefaultMass = constants::phys::MuonMass; + /// misalignment of the detector systems in X + std::array<float, constants::size::MaxNdetectors> fMisalignmentX{0.}; + + /// misalignment of the detector systems in Y + std::array<float, constants::size::MaxNdetectors> fMisalignmentY{0.}; + // *************************** // ** Flags for development ** // *************************** @@ -330,6 +345,9 @@ namespace cbm::algo::ca ar& fRandomSeed; ar& fDefaultMass; + ar& fMisalignmentX; + ar& fMisalignmentY; + ar& fDevIsIgnoreHitSearchAreas; ar& fDevIsUseOfOriginalField; ar& fDevIsMatchDoubletsViaMc; diff --git a/macro/beamtime/mcbm2022/mcbm_event_reco_L1.C b/macro/beamtime/mcbm2022/mcbm_event_reco_L1.C index 4482012a19..b8cc93980d 100644 --- a/macro/beamtime/mcbm2022/mcbm_event_reco_L1.C +++ b/macro/beamtime/mcbm2022/mcbm_event_reco_L1.C @@ -606,6 +606,10 @@ Bool_t mcbm_event_reco_L1(UInt_t uRunId = 2570, l1->SetVerbose(3); run->AddTask(l1); + l1->SetMisalignmentSts(.2, .2); + l1->SetMisalignmentTrd(.2, .2); + l1->SetMisalignmentTof(.2, .2); + CbmL1GlobalTrackFinder* globalTrackFinder = new CbmL1GlobalTrackFinder(); FairTask* globalFindTracks = new CbmL1GlobalFindTracksEvents(globalTrackFinder); run->AddTask(globalFindTracks); diff --git a/macro/beamtime/mcbm2022/mcbm_reco.C b/macro/beamtime/mcbm2022/mcbm_reco.C index 3a3f0cf3a4..df1c01df36 100644 --- a/macro/beamtime/mcbm2022/mcbm_reco.C +++ b/macro/beamtime/mcbm2022/mcbm_reco.C @@ -208,7 +208,7 @@ Bool_t mcbm_reco(UInt_t uRunId = 2391, run->SetGeomFile(geoFile); // Define output file for FairMonitor histograms - TString monitorFile {outFile}; + TString monitorFile{outFile}; monitorFile.ReplaceAll("reco", "reco.monitor"); FairMonitor::GetMonitor()->EnableMonitor(kTRUE, monitorFile); // ------------------------------------------------------------------------ @@ -234,7 +234,7 @@ Bool_t mcbm_reco(UInt_t uRunId = 2391, // Define the basic structure which needs to be filled with information // This structure is stored in the output file and later passed to the // FairRoot framework to do the (miss)alignment - std::map<std::string, TGeoHMatrix>* matrices {nullptr}; + std::map<std::string, TGeoHMatrix>* matrices{nullptr}; // read matrices from disk LOG(info) << "Filename: " << alignmentMatrixFileName; @@ -248,7 +248,9 @@ Bool_t mcbm_reco(UInt_t uRunId = 2391, return kFALSE; } - if (matrices) { run->AddAlignmentMatrices(*matrices); } + if (matrices) { + run->AddAlignmentMatrices(*matrices); + } else { LOG(error) << "Alignment required but no matrices found." << "\n Exiting"; @@ -393,7 +395,9 @@ Bool_t mcbm_reco(UInt_t uRunId = 2391, // --- Initialization of the digi scheme auto muchGeoScheme = CbmMuchGeoScheme::Instance(); - if (!muchGeoScheme->IsInitialized()) { muchGeoScheme->Init(sectorFile.Data(), muchFlag); } + if (!muchGeoScheme->IsInitialized()) { + muchGeoScheme->Init(sectorFile.Data(), muchFlag); + } // --- Hit finder for GEMs FairTask* muchReco = new CbmMuchFindHitsGem(sectorFile.Data(), muchFlag); run->AddTask(muchReco); @@ -523,6 +527,10 @@ Bool_t mcbm_reco(UInt_t uRunId = 2391, CbmL1* l1 = new CbmL1("L1", 0); // <= Disable verbose mode l1->SetMcbmMode(); + l1->SetMisalignmentSts(.2, .2); + l1->SetMisalignmentTrd(.2, .2); + l1->SetMisalignmentTof(.2, .2); + run->AddTask(l1); CbmL1GlobalTrackFinder* globalTrackFinder = new CbmL1GlobalTrackFinder(); @@ -539,7 +547,9 @@ Bool_t mcbm_reco(UInt_t uRunId = 2391, // e.g for RICH: CbmRichMCbmQaReal* qaTask = new CbmRichMCbmQaReal(); Int_t taskId = 1; - if (taskId < 0) { qaTask->SetOutputDir(Form("result_run%d", uRunId)); } + if (taskId < 0) { + qaTask->SetOutputDir(Form("result_run%d", uRunId)); + } else { qaTask->SetOutputDir(Form("result_run%d_%05d", uRunId, taskId)); } diff --git a/reco/L1/CbmL1.cxx b/reco/L1/CbmL1.cxx index 3bc1d19f00..f276e6a1f3 100644 --- a/reco/L1/CbmL1.cxx +++ b/reco/L1/CbmL1.cxx @@ -300,6 +300,15 @@ InitStatus CbmL1::Init() fpTofHits = (TClonesArray*) fairManager->GetObject("TofHit"); } + // misalignment + for (int i = 0; i != static_cast<int>(cbm::algo::ca::EDetectorID::kEND); ++i) { + auto detId = cbm::algo::ca::EDetectorID(i); + fInitManager.SetMisalignmentX(detId, fvMisalignment[detId][0]); + fInitManager.SetMisalignmentY(detId, fvMisalignment[detId][1]); + LOG(info) << "CbmL1: misalignment for " << cbm::ca::kDetName[detId] << " is set to " << fvMisalignment[detId][0] + << " " << fvMisalignment[detId][1]; + } + if (fPerformance) { CbmMCDataManager* mcManager = (CbmMCDataManager*) fairManager->GetObject("MCDataManager"); diff --git a/reco/L1/CbmL1.h b/reco/L1/CbmL1.h index d83f5735c5..e4f8d1b412 100644 --- a/reco/L1/CbmL1.h +++ b/reco/L1/CbmL1.h @@ -255,6 +255,15 @@ class CbmL1 : public FairTask { void SetMcbmMode() { fTrackingMode = ca::Framework::TrackingMode::kMcbm; } void SetGlobalMode() { fTrackingMode = ca::Framework::TrackingMode::kGlobal; } + /// Sets misalignment of the detector + void SetMisalignment(ca::EDetectorID det, float dx, float dy) { fvMisalignment[det] = {dx, dy}; } + + void SetMisalignmentMvd(float dx, float dy) { SetMisalignment(ca::EDetectorID::kMvd, dx, dy); } + void SetMisalignmentSts(float dx, float dy) { SetMisalignment(ca::EDetectorID::kSts, dx, dy); } + void SetMisalignmentMuch(float dx, float dy) { SetMisalignment(ca::EDetectorID::kMuch, dx, dy); } + void SetMisalignmentTrd(float dx, float dy) { SetMisalignment(ca::EDetectorID::kTrd, dx, dy); } + void SetMisalignmentTof(float dx, float dy) { SetMisalignment(ca::EDetectorID::kTof, dx, dy); } + ca::TrackingMonitor fMonitor{}; ///< Tracking monitor // void SetTrackingLevel( Int_t iLevel ){ fTrackingLevel = iLevel; } @@ -465,6 +474,7 @@ class CbmL1 : public FairTask { //std::unique_ptr<CbmCaMCModule> fpMCModule = nullptr; ///< MC-module for tracking + cbm::ca::DetIdArr_t<std::array<float, 2>> fvMisalignment{{0.}}; ///< Misalignment public: // ** Basic data members ** diff --git a/reco/L1/CbmL1ReadEvent.cxx b/reco/L1/CbmL1ReadEvent.cxx index 1752021d7a..a549424edf 100644 --- a/reco/L1/CbmL1ReadEvent.cxx +++ b/reco/L1/CbmL1ReadEvent.cxx @@ -443,8 +443,9 @@ void CbmL1::ReadEvent(CbmEvent* event) h->Position(pos); h->PositionError(err); - th.dx2 = h->GetDx() * h->GetDx(); - th.dy2 = h->GetDy() * h->GetDy(); + th.dx2 = h->GetDx() * h->GetDx() + fpAlgo->GetParameters().GetMisalignmentXsq((int) ca::EDetectorID::kMvd); + th.dy2 = h->GetDy() * h->GetDy() + fpAlgo->GetParameters().GetMisalignmentYsq((int) ca::EDetectorID::kMvd); + ; th.dxy = h->GetDxy(); th.x = pos.X(); @@ -525,8 +526,8 @@ void CbmL1::ReadEvent(CbmEvent* event) th.y = pos.Y(); th.z = pos.Z(); - th.dx2 = h->GetDx() * h->GetDx(); - th.dy2 = h->GetDy() * h->GetDy(); + th.dx2 = h->GetDx() * h->GetDx() + fpAlgo->GetParameters().GetMisalignmentXsq((int) ca::EDetectorID::kSts); + th.dy2 = h->GetDy() * h->GetDy() + fpAlgo->GetParameters().GetMisalignmentYsq((int) ca::EDetectorID::kSts); th.dxy = h->GetDxy(); std::tie(th.rangeX, th.rangeY, th.rangeT) = CbmStsTrackingInterface::Instance()->GetHitRanges(*h); @@ -586,8 +587,8 @@ void CbmL1::ReadEvent(CbmEvent* event) th.y = h->GetY(); th.z = h->GetZ(); - th.dx2 = h->GetDx() * h->GetDx(); - th.dy2 = h->GetDy() * h->GetDy(); + th.dx2 = h->GetDx() * h->GetDx() + fpAlgo->GetParameters().GetMisalignmentXsq((int) ca::EDetectorID::kMuch); + th.dy2 = h->GetDy() * h->GetDy() + fpAlgo->GetParameters().GetMisalignmentYsq((int) ca::EDetectorID::kMuch); th.dxy = 0; /// FIXME: ??? std::tie(th.rangeX, th.rangeY, th.rangeT) = CbmMuchTrackingInterface::Instance()->GetHitRanges(*h); @@ -660,8 +661,8 @@ void CbmL1::ReadEvent(CbmEvent* event) th.y = pos.Y(); th.z = pos.Z(); - th.dx2 = h->GetDx() * h->GetDx(); - th.dy2 = h->GetDy() * h->GetDy(); + th.dx2 = h->GetDx() * h->GetDx() + fpAlgo->GetParameters().GetMisalignmentXsq((int) ca::EDetectorID::kTrd); + th.dy2 = h->GetDy() * h->GetDy() + fpAlgo->GetParameters().GetMisalignmentYsq((int) ca::EDetectorID::kTrd); th.dxy = 0; std::tie(th.rangeX, th.rangeY, th.rangeT) = CbmTrdTrackingInterface::Instance()->GetHitRanges(*h); @@ -714,8 +715,8 @@ void CbmL1::ReadEvent(CbmEvent* event) th.time = h->GetTime(); th.dt2 = h->GetTimeError() * h->GetTimeError(); - th.dx2 = h->GetDx() * h->GetDx(); - th.dy2 = h->GetDy() * h->GetDy(); + th.dx2 = h->GetDx() * h->GetDx() + fpAlgo->GetParameters().GetMisalignmentXsq((int) ca::EDetectorID::kTof); + th.dy2 = h->GetDy() * h->GetDy() + fpAlgo->GetParameters().GetMisalignmentYsq((int) ca::EDetectorID::kTof); th.dxy = h->GetDxy(); // th.iSector = 0; -- GitLab