diff --git a/core/base/utils/CbmMcbmUtils.cxx b/core/base/utils/CbmMcbmUtils.cxx index e99e9f04d752e82296cf61f162d2dd42a0dffd62..a39a0aa18e5df280a8597d8e08704648eee59fb9 100644 --- a/core/base/utils/CbmMcbmUtils.cxx +++ b/core/base/utils/CbmMcbmUtils.cxx @@ -43,9 +43,9 @@ namespace cbm /// Lambda Benchmark Gold runs: 2454 - 2497 = 16/06/2022 - 18/06/2022 sSetupName = "mcbm_beam_2022_06_16_gold"; } - else if (2497 < ulRunId) { + else if (2610 < ulRunId) { /// Future runs, exception there to force implementation and support from users side - throw(std::invalid_argument("RunId bigger than latest run mapped (2497, mCBM 2022)! Please complete the map!")); + throw(std::invalid_argument("RunId bigger than latest run mapped (2610, mCBM 2022)! Please complete the map!")); } return sSetupName; diff --git a/macro/beamtime/mcbm2022/mMuChNoisyChannelMarch2022.txt b/macro/beamtime/mcbm2022/mMuChNoisyChannelMarch2022.txt new file mode 100644 index 0000000000000000000000000000000000000000..3df2b5bcb42cc317401ea3d5646f4bad09785a0f --- /dev/null +++ b/macro/beamtime/mcbm2022/mMuChNoisyChannelMarch2022.txt @@ -0,0 +1,178 @@ +44302340 +1703940 +27066372 +1343492 +1310724 +177963012 +161251332 +185991172 +186056708 +186253316 +186417156 +144670724 +186286084 +153026564 +178159620 +144703492 +144736260 +26869764 +1933316 +10092548 +59736068 +35487748 +51970068 +43941892 +35586052 +59801604 +51314692 +52068356 +18481156 +144801796 +145162244 +144769028 +161644548 +153223172 +51445764 +68026372 +51347460 +51412996 +59834372 +59867140 +44171268 +85622804 +161611780 +59408420 +161218564 +153354244 +153157636 +161742852 +186220548 +94273540 +51281924 +51478532 +59670532 +68124676 +59768836 +68059140 +59899908 +59637764 +169410564 +153092100 +177831940 +186777604 +144637956 +161710084 +153059332 +161447940 +51249156 +68091908 +59703300 +186187780 +177897476 +9207844 +43745284 +27000836 +9109508 +884740 +1867780 +17825796 +1802244 +18972676 +27328516 +1671172 +1376260 +42860548 +1409028 +9666564 +1605636 +51544068 +59965444 +161546244 +1572868 +1441796 +60293124 +1507332 +9699332 +1474564 +169672708 +161284100 +186548228 +178094084 +186449924 +177930244 +153190404 +186384388 +153518084 +153255940 +169607172 +178028548 +186482692 +161677316 +153124868 +153485316 +145063940 +186318852 +153288708 +186515460 +178192388 +9764868 +9797636 +60227588 +51740676 +51773444 +169508868 +169476100 +177995780 +169639940 +178126852 +145031172 +169443332 +161349636 +145391620 +178061316 +186351620 +153321476 +153550852 +145096708 +153387012 +186810372 +178520068 +186646532 +186843140 +169541636 +177864708 +161480708 +178356228 +186875908 +145129476 +169902084 +169967620 +186580996 +178225156 +170000388 +186679300 +169836548 +186613764 +60260356 +170164228 +170033156 +9732100 +60194820 +18022404 +51806212 +85622788 +917508 +51838980 +60129300 +52035604 +52068372 +60162068 +52101140 +118620180 +118489108 +126910484 +60358676 +169869316 +161775620 +786468 +25821220 diff --git a/macro/run/run_unpack_tsa.C b/macro/run/run_unpack_tsa.C index 8561750b8cb8b8100417f06eda310c74ceb197b5..e54cb426b3076683dd08fd2b7289706be7c187fe 100644 --- a/macro/run/run_unpack_tsa.C +++ b/macro/run/run_unpack_tsa.C @@ -271,6 +271,11 @@ void run_unpack_tsa(std::vector<std::string> infile = {"test.tsa"}, UInt_t runid // muchconfig->SetMinAdcCut(1, 1); // muchconfig->MaskNoisyChannel(3, 56); + //List of noisy channels *.txt file based on CbmMuchAddress is placed at the same location as par files + // + std::string NoisyChannelFilePath = parfilesbasepathMuch + "mMuChNoisyChannelMarch2022.txt"; + LOG(info) << "Noisy Channel File Name : " << NoisyChannelFilePath; + muchconfig->SetNoisyChannelFile(NoisyChannelFilePath); } // ------------- @@ -539,7 +544,7 @@ void run_unpack_tsa(std::vector<std::string> infile = {"test.tsa"}, UInt_t runid stsconfig.reset(); muchconfig.reset(); trd1Dconfig.reset(); - trdfasp2dconfig.reset(); + //trdfasp2dconfig.reset(); tofconfig.reset(); richconfig.reset(); psdconfig.reset(); diff --git a/reco/detectors/much/unpack/CbmMuchUnpackAlgo.cxx b/reco/detectors/much/unpack/CbmMuchUnpackAlgo.cxx index c21d67978c5ee0c480f10e3e4fe686a9f5a3a1b2..d75320f09512cb2915db299e7aa12aab8c27ece6 100644 --- a/reco/detectors/much/unpack/CbmMuchUnpackAlgo.cxx +++ b/reco/detectors/much/unpack/CbmMuchUnpackAlgo.cxx @@ -65,7 +65,14 @@ uint64_t CbmMuchUnpackAlgo::getFullTimeStamp(const uint16_t usRawTs) } // ---- init -Bool_t CbmMuchUnpackAlgo::init() { return kTRUE; } +Bool_t CbmMuchUnpackAlgo::init() { + LOG(debug) << " Below are the list of addresses of noisy channels "; + for (auto it = fInactiveChannels.begin(); it != + fInactiveChannels.end(); ++it) + LOG(debug) << " " << *it; + + return kTRUE; + } // ---- initDpbIdIndexMap ---- void CbmMuchUnpackAlgo::initDpbIdIndexMap(CbmMuchUnpackPar* parset) @@ -356,6 +363,7 @@ void CbmMuchUnpackAlgo::loopMsMessages(const uint8_t* msContent, const uint32_t } } } + } // ---- MaskNoisyChannel ---- @@ -532,6 +540,16 @@ void CbmMuchUnpackAlgo::processHitInfo(const stsxyter::Message& mess) if (usChan > 127) LOG(debug) << "ERROR !!! Channel in hit message is out of range " << usChan; // uFebIdx is FEB position in the GEM and RPC const uint32_t address = CreateMuchAddress(fuCurrDpbIdx, uFebIdx, usChan); + + // Masking Noisy Channel. If Address is part of Inactive Channel List + if (fInactiveChannels.count(address)) { + //Counting number of hits fall on noisy channel + fMaskedNoisyHitsFromCbmMuchAddress++; + return; + } + + + //const uint32_t address = CreateMuchAddress(fuCurrDpbIdx, uFebIdx, uChanInFeb); LOG(debug) << "Created Much Address = " << address << " from fuCurrDpbIdx " << fuCurrDpbIdx << " Feb Id " << uFebIdx << " Channnel Id " << uChanInFeb; @@ -979,6 +997,8 @@ bool CbmMuchUnpackAlgo::unpack(const fles::Timeslice* ts, std::uint16_t icomp, U fMonitor->FillVectorSize(ts->index(), fOutputVec.size()); //fMonitor->DrawCanvases(); } + + std::cout << "Total Number of Masked Addresses " << fMaskedNoisyHitsFromCbmMuchAddress << std::endl; return true; } diff --git a/reco/detectors/much/unpack/CbmMuchUnpackAlgo.h b/reco/detectors/much/unpack/CbmMuchUnpackAlgo.h index 32a19adacb866559268b28e469595a1e2eb365a3..01488c6b599842885946bcd1b320ff727440cfab 100644 --- a/reco/detectors/much/unpack/CbmMuchUnpackAlgo.h +++ b/reco/detectors/much/unpack/CbmMuchUnpackAlgo.h @@ -35,6 +35,7 @@ #include <cstdint> #include <memory> #include <utility> +#include <set> class CbmMuchUnpackAlgo : public CbmRecoUnpackAlgo<CbmMuchDigi, CbmMuchDigi, CbmErrorMessage> { public: @@ -101,6 +102,7 @@ public: */ void SetParFileName(std::string sNewName) { fParFileName = sNewName; } + void SetInactiveChannel(uint32_t channel){ fInactiveChannels.insert(channel);} protected: /** @@ -331,6 +333,10 @@ protected: /** @brief Current µSlice time */ uint64_t fMsStartTime = 0; + std::set<uint32_t> fInactiveChannels = {}; + + uint64_t fMaskedNoisyHitsFromCbmMuchAddress = 0; + private: CbmMuchUnpackPar* fUnpackPar = nullptr; //! For static/inline mapping functions uint64_t fuSkippMessNoValidAddress = 0; diff --git a/reco/detectors/much/unpack/CbmMuchUnpackConfig.cxx b/reco/detectors/much/unpack/CbmMuchUnpackConfig.cxx index eb87f455f197d550247f1ea6f38e3f2a031dfcf0..a40bcfd6d9e5e8551f37809a48189f0615bcfd85 100644 --- a/reco/detectors/much/unpack/CbmMuchUnpackConfig.cxx +++ b/reco/detectors/much/unpack/CbmMuchUnpackConfig.cxx @@ -37,6 +37,19 @@ void CbmMuchUnpackConfig::InitAlgo() // Set the flags for duplicate digis rejections fAlgo->SetDuplicatesRejection(fbRejectDuplicateDigis, fbDupliWithoutAdc); + + // --- Read list of inactive channels + if (!fInactiveChannelFileName.IsNull()) { + LOG(info) << GetName() << ": Reading inactive channels from " << fInactiveChannelFileName; + auto result = ReadInactiveChannels(); + if (!result.second) { + LOG(error) << GetName() << ": Error in reading from file! Task will be inactive."; + return; + } + //LOG(info) << GetName() << ": " << std::get<0>(result) << " lines read from file, " << fInactiveChannels.size() + // << " channels set inactive"; + } + if (fMonitor) { fAlgo->SetMonitor(fMonitor); } @@ -46,6 +59,7 @@ void CbmMuchUnpackConfig::InitAlgo() // Mask the noisy channels set by the user for (auto chmask : fvChanMasks) fAlgo->MaskNoisyChannel(chmask.uFeb, chmask.uChan, chmask.bMasked); + } // ---- chooseAlgo ---- @@ -70,4 +84,28 @@ std::shared_ptr<CbmMuchUnpackAlgo> CbmMuchUnpackConfig::chooseAlgo() } +// ----- Read list of inactive channels --------------------------------- +std::pair<size_t, bool> CbmMuchUnpackConfig::ReadInactiveChannels() +{ + + if (fInactiveChannelFileName.IsNull()) return std::make_pair(0, true); + + FILE* channelFile = fopen(fInactiveChannelFileName.Data(), "r"); + if (channelFile == nullptr) return std::make_pair(0, false); + + size_t nLines = 0; + uint32_t channel = 0; + while (fscanf(channelFile, "%u", &channel) == 1) { + fAlgo->SetInactiveChannel(channel); + nLines++; + } + bool success = feof(channelFile); + + fclose(channelFile); + LOG(info) << " Number of Noisy Channels in CbmAddress Format : " << nLines; + return std::make_pair(nLines, success); +} +// -------------------------------------------------------------------------- + + ClassImp(CbmMuchUnpackConfig) diff --git a/reco/detectors/much/unpack/CbmMuchUnpackConfig.h b/reco/detectors/much/unpack/CbmMuchUnpackConfig.h index cc6454696fd64adf13e23469de15e47e99bc4246..0dc96ec9de4a13beaa9c70f678f14e6f5b995ae1 100644 --- a/reco/detectors/much/unpack/CbmMuchUnpackConfig.h +++ b/reco/detectors/much/unpack/CbmMuchUnpackConfig.h @@ -73,6 +73,12 @@ public: { fvChanMasks.emplace_back(FebChanMaskReco {uFeb, uChan, bMasked}); } + + /** + * @brief Read Inactive Channel list based on CbmMuchAddress from a file. + */ + + virtual std::pair<size_t, bool> ReadInactiveChannels(); // Setters /** @@ -110,6 +116,7 @@ public: void SetParFileName(std::string sNewName) { fsParFileName = sNewName; } void LoadParFileName() { fAlgo->SetParFileName(fsParFileName); } + void SetNoisyChannelFile(TString fileName) { fInactiveChannelFileName = fileName; } protected: /** @@ -142,7 +149,8 @@ protected: /// Parameter file name std::string fsParFileName = "mMuchPar.par"; - + TString fInactiveChannelFileName = ""; + private: ClassDef(CbmMuchUnpackConfig, 2) };