diff --git a/macro/run/run_unpack_tsa.C b/macro/run/run_unpack_tsa.C index 444693d290be2bd7f5fc314f8032fc9dbd5d815b..45d3e1f2d16cab2b2cad254e1bcdf79a20c3468b 100644 --- a/macro/run/run_unpack_tsa.C +++ b/macro/run/run_unpack_tsa.C @@ -90,13 +90,14 @@ void run_unpack_tsa(std::string infile = "test.tsa", UInt_t runid = 0, const cha // ---- RICH ---- std::shared_ptr<CbmRichUnpackConfig> richconfig = nullptr; - // richconfig = std::make_shared<CbmRichUnpackConfig>("", runid); + richconfig = std::make_shared<CbmRichUnpackConfig>("", runid); if (richconfig) { richconfig->SetDebugState(); richconfig->SetDoWriteOutput(); std::string parfilesbasepathRich = Form("%s/macro/beamtime/mcbm2021/", srcDir.Data()); richconfig->SetParFilesBasePath(parfilesbasepathRich); - richconfig->SetSystemTimeOffset(0); // [ns] value to be updated + richconfig->SetSystemTimeOffset(256000 - 1200); // [ns] 1 MS and additional correction + if (runid == 1588) richconfig->MaskDiRICH(0x7150); } // ------------- diff --git a/reco/detectors/rich/unpack/CbmRichUnpackAlgo.cxx b/reco/detectors/rich/unpack/CbmRichUnpackAlgo.cxx index 2e7099eab67349119867a9c8c77c91ed0ebc4420..92f82d36eceb1a100bad4ed42e6d28c26a782605 100644 --- a/reco/detectors/rich/unpack/CbmRichUnpackAlgo.cxx +++ b/reco/detectors/rich/unpack/CbmRichUnpackAlgo.cxx @@ -27,7 +27,7 @@ std::vector<std::pair<std::string, std::shared_ptr<FairParGenericSet>>>* std::string temppath = ""; // // Get parameter container - temppath = basepath + "mRichPar.par"; + temppath = basepath + "mRichPar_70.par"; fParContVec.emplace_back(std::make_pair(temppath, std::make_shared<CbmMcbm2018RichPar>())); @@ -227,13 +227,19 @@ void CbmRichUnpackAlgo::processSubSubEvent(CbmRichUnpackAlgoMicrosliceReader& re // this array is used to match raising and falling edges std::vector<double> raisingTime(33, -1.); + // check if DiRICH (SubSubEvId) is masked + bool DiRICH_masked = false; + if (checkMaskedDiRICH(subSubEventId)) { DiRICH_masked = true; } + for (int i = 0; i < nofTimeWords; i++) { - uint32_t word = reader.NextWord(); + uint32_t word = reader.NextWord(); + if (DiRICH_masked) continue; CbmRichUnpackAlgoTdcWordType type = CbmRichUnpackAlgoTdcWordReader::GetTdcWordType(word); if (type == CbmRichUnpackAlgoTdcWordType::TimeData) { if (!wasHeader || !wasEpoch || wasTrailer) { - LOG(error) << getLogHeader(reader) << "illegal position of TDC Time (before header/epoch or after trailer)"; + LOG(error) << getLogHeader(reader) << "DiRICH 0x" << std::hex << subSubEventId << std::dec + << ": illegal position of TDC Time (before header/epoch or after trailer)"; errorInData = true; continue; } @@ -242,7 +248,8 @@ void CbmRichUnpackAlgo::processSubSubEvent(CbmRichUnpackAlgoMicrosliceReader& re } else if (type == CbmRichUnpackAlgoTdcWordType::Epoch) { if (!wasHeader || wasTrailer) { - LOG(error) << getLogHeader(reader) << "illegal position of TDC Epoch (before header or after trailer)"; + LOG(error) << getLogHeader(reader) << "DiRICH 0x" << std::hex << subSubEventId << std::dec + << ": illegal position of TDC Epoch (before header or after trailer)"; errorInData = true; continue; } @@ -252,7 +259,8 @@ void CbmRichUnpackAlgo::processSubSubEvent(CbmRichUnpackAlgoMicrosliceReader& re } else if (type == CbmRichUnpackAlgoTdcWordType::Header) { if (wasEpoch || wasTime || wasTrailer) { - LOG(error) << getLogHeader(reader) << "illegal position of TDC Header (after time/epoch/trailer)"; + LOG(error) << getLogHeader(reader) << "DiRICH 0x" << std::hex << subSubEventId << std::dec + << ": illegal position of TDC Header (after time/epoch/trailer)"; errorInData = true; continue; } @@ -263,7 +271,8 @@ void CbmRichUnpackAlgo::processSubSubEvent(CbmRichUnpackAlgoMicrosliceReader& re } else if (type == CbmRichUnpackAlgoTdcWordType::Trailer) { if (!wasEpoch || !wasTime || !wasHeader) { - LOG(error) << getLogHeader(reader) << "illegal position of TDC Trailer (before time/epoch/header)"; + LOG(error) << getLogHeader(reader) << "DiRICH 0x" << std::hex << subSubEventId << std::dec + << ": illegal position of TDC Trailer (before time/epoch/header)"; errorInData = true; continue; } @@ -425,4 +434,13 @@ void CbmRichUnpackAlgo::writeOutputDigi(Int_t fpgaID, Int_t channel, Double_t ti } } +bool CbmRichUnpackAlgo::checkMaskedDiRICH(Int_t subSubEventId) +{ + for (unsigned int i = 0; i < fMaskedDiRICHes->size(); ++i) { + if (fMaskedDiRICHes->at(i) == subSubEventId) return true; + } + + return false; +} + ClassImp(CbmRichUnpackAlgo) diff --git a/reco/detectors/rich/unpack/CbmRichUnpackAlgo.h b/reco/detectors/rich/unpack/CbmRichUnpackAlgo.h index 014e8882b2b064d840fccfd0017d7a5c6f52b5fe..c6009fcdf4322a9ebb2c65af89e9b71891359073 100644 --- a/reco/detectors/rich/unpack/CbmRichUnpackAlgo.h +++ b/reco/detectors/rich/unpack/CbmRichUnpackAlgo.h @@ -219,6 +219,8 @@ public: virtual std::vector<std::pair<std::string, std::shared_ptr<FairParGenericSet>>>* GetParContainerRequest(std::string geoTag, std::uint32_t runId); + void SetMaskedDiRICHes(std::vector<Int_t>* maskedDiRICHes) { fMaskedDiRICHes = maskedDiRICHes; } + protected: double calculateTime(uint32_t epoch, uint32_t coarse, uint32_t fine); @@ -310,9 +312,13 @@ protected: */ bool unpack(const fles::Timeslice* ts, std::uint16_t icomp, UInt_t imslice); + bool checkMaskedDiRICH(Int_t subSubEventId); + /** @brief Parameters for the unpacking */ CbmMcbm2018RichPar fUnpackPar; + std::vector<Int_t>* fMaskedDiRICHes = nullptr; + double fMbsPrevTimeCh0 = 0.; double fMbsPrevTimeCh1 = 0.; diff --git a/reco/detectors/rich/unpack/CbmRichUnpackConfig.cxx b/reco/detectors/rich/unpack/CbmRichUnpackConfig.cxx index de94c27a96ab9d1cd81ac651651f8aa46adc135c..f7ce79dae6af96b3c777424c54e6bdcbb3669429 100644 --- a/reco/detectors/rich/unpack/CbmRichUnpackConfig.cxx +++ b/reco/detectors/rich/unpack/CbmRichUnpackConfig.cxx @@ -36,6 +36,9 @@ void CbmRichUnpackConfig::InitUnpacker() if (fDoLog) LOG(info) << fName << "::Init - SetParFilesBasePath"; algo->SetParFilesBasePath(fParFilesBasePath); + if (fDoLog) LOG(info) << fName << "::Init - SetMaskedDiRICHes"; + algo->SetMaskedDiRICHes(&fMaskedDiRICHes); + // Initialise the parameter containers required by the unpacker algo. Includes loading the corresponding ascii files auto reqparvec = algo->GetParContainerRequest(fGeoSetupTag, fRunId); initOk &= initParContainers(reqparvec); diff --git a/reco/detectors/rich/unpack/CbmRichUnpackConfig.h b/reco/detectors/rich/unpack/CbmRichUnpackConfig.h index 632226eb98b2e4360f0500049513401f12366192..2641ae6782601cfd3faab6f09d3acaa87938e0eb 100644 --- a/reco/detectors/rich/unpack/CbmRichUnpackConfig.h +++ b/reco/detectors/rich/unpack/CbmRichUnpackConfig.h @@ -68,6 +68,8 @@ public: // Setters + void MaskDiRICH(Int_t DiRICH) { fMaskedDiRICHes.push_back(DiRICH); } + protected: /** * @brief Choose the derived unpacker algorithm to be used for the DAQ output to Digi translation. If algo was already set manually by the user this algorithm is used. @@ -82,6 +84,8 @@ protected: /** @brief RunId of the current run, if not known 0 is a valid runtime case. Used runId based parameter loading. */ UInt_t fRunId = 0; + std::vector<Int_t> fMaskedDiRICHes; + private: ClassDef(CbmRichUnpackConfig, 2) };