From 975c03942346aeff27897b5c36fc4c329ae781e0 Mon Sep 17 00:00:00 2001 From: Vikas Singhal <vsinghal@gsi.de> Date: Wed, 5 Jul 2023 12:52:25 +0530 Subject: [PATCH] Added mMuCh in mcbm_reco macro and File check in FindHits --- core/base/CbmDigiManager.cxx | 6 +---- macro/beamtime/mcbm2022/mcbm_reco.C | 28 ++++++++++++++++++++++ reco/detectors/much/CbmMuchFindHitsGem.cxx | 4 +++- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/core/base/CbmDigiManager.cxx b/core/base/CbmDigiManager.cxx index c6161434a4..c68d4bc5cd 100644 --- a/core/base/CbmDigiManager.cxx +++ b/core/base/CbmDigiManager.cxx @@ -134,11 +134,7 @@ void CbmDigiManager::SetBranch() // Get system ID and class name from digi class. ECbmModuleId systemId = Digi::GetSystem(); string className = Digi::GetClassName(); - std::cout << "systemId= " << systemId << " className= " << className << std::endl; - // TODO: Remove ugly fix for CbmMuchBeamTimeDigi once class has disappeared. - // VS: CbmMuchBeamTimeDigi may be removed now. 26/06/23 - //if (systemId == ECbmModuleId::kMuch && fUseMuchBeamTimeDigi) className = "CbmMuchBeamTimeDigi"; - if (systemId == ECbmModuleId::kMuch) className = "CbmMuchDigi"; + LOG(info) << "systemId= " << systemId << " className= " << className; // --- Catch branch being already set if (fBranches.find(systemId) != fBranches.end()) { diff --git a/macro/beamtime/mcbm2022/mcbm_reco.C b/macro/beamtime/mcbm2022/mcbm_reco.C index 53a3578972..2f30cb9afc 100644 --- a/macro/beamtime/mcbm2022/mcbm_reco.C +++ b/macro/beamtime/mcbm2022/mcbm_reco.C @@ -375,6 +375,34 @@ Bool_t mcbm_reco(UInt_t uRunId = 2391, // ------------------------------------------------------------------------ } + // ========================================================================= + // === local MUCH Reconstruction === + // ========================================================================= + if (bMUCH) { + TString muchGeoTag; + if (geoSetup->GetGeoTag(ECbmModuleId::kMuch, muchGeoTag)) { + // --- Parameter file name + TString geoTag; + geoSetup->GetGeoTag(ECbmModuleId::kMuch, geoTag); + Int_t muchFlag = 0; + if (geoTag.Contains("mcbm")) muchFlag = 1; + TString sectorFile = gSystem->Getenv("VMCWORKDIR"); + sectorFile += "/parameters/much/much_" + geoTag(0, 4) + "_mcbm_digi_sector.root"; + //sectorFile += "/parameters/much/much_v22j_mcbm_digi_sector.root"; + std::cout << "Using parameter file " << sectorFile << std::endl; + + // --- Initialization of the digi scheme + auto muchGeoScheme = CbmMuchGeoScheme::Instance(); + if (!muchGeoScheme->IsInitialized()) { muchGeoScheme->Init(sectorFile.Data(), muchFlag); } + // --- Hit finder for GEMs + FairTask* muchReco = new CbmMuchFindHitsGem(sectorFile.Data(), muchFlag); + run->AddTask(muchReco); + std::cout << "-I- " << myName << ": Added task " << muchReco->GetName() << " with parameter file " << sectorFile + << std::endl; + } + } + // ------------------------------------------------------------------------ + // ========================================================================= // === local TRD Reconstruction === diff --git a/reco/detectors/much/CbmMuchFindHitsGem.cxx b/reco/detectors/much/CbmMuchFindHitsGem.cxx index 47e4fa8a04..9fdf3861ea 100644 --- a/reco/detectors/much/CbmMuchFindHitsGem.cxx +++ b/reco/detectors/much/CbmMuchFindHitsGem.cxx @@ -123,7 +123,9 @@ InitStatus CbmMuchFindHitsGem::Init() TDirectory* oldDir = gDirectory; TFile* file = new TFile(fDigiFile); - TObjArray* stations = (TObjArray*) file->Get("stations"); + LOG_IF(fatal, !file) << "Could not open file " << fDigiFile; + TObjArray* stations = file->Get<TObjArray>("stations"); + LOG_IF(fatal, !stations) << "TObjArray stations not found in file " << fDigiFile; file->Close(); file->Delete(); /// Restore old global file and folder pointer to avoid messing with FairRoot -- GitLab