diff --git a/macro/run/run_unpack_online.C b/macro/run/run_unpack_online.C index fbda6452d269e69ebaea409d11d680224c341845..6852a44beebc6b71aeb6ab231070a6d29baf4817 100644 --- a/macro/run/run_unpack_online.C +++ b/macro/run/run_unpack_online.C @@ -368,19 +368,17 @@ std::shared_ptr<CbmTrdUnpackMonitor> GetTrdMonitor(std::string treefilename, boo std::vector<CbmTrdUnpackMonitor::eOtherHistos> otherhistovec = {CbmTrdUnpackMonitor::eOtherHistos::kSpadic_Info_Types, CbmTrdUnpackMonitor::eOtherHistos::kMs_Flags}; - + std::shared_ptr<CbmTrdUnpackMonitor> monitor(nullptr); if (!fasp) { // SPADIC monitor - auto monitor = std::make_shared<CbmTrdUnpackMonitor>(); + monitor = std::make_shared<CbmTrdUnpackMonitor>(); monitor->SetActiveHistos(digihistovec); monitor->SetActiveHistos(rawhistovec); monitor->SetActiveHistos(otherhistovec); monitor->SetWriteToFile(outfilename.data()); } else { // FASP monitoring settings - auto monitor = std::make_shared<CbmTrdUnpackFaspMonitor>(); + monitor = std::make_shared<CbmTrdUnpackFaspMonitor>(); monitor->SetActiveHistos(digihistovec); - filetypepos = outfilename.find(".trd.root"); - outfilename.replace(filetypepos, 10, ".fasp.root"); monitor->SetWriteToFile(outfilename.data()); } return monitor; diff --git a/macro/run/run_unpack_tsa.C b/macro/run/run_unpack_tsa.C index e11c2e9493e72dfcceb8fcc31dfe32a81468a2c9..b77948d2fb215e7ee8215a295d19928df8f30685 100644 --- a/macro/run/run_unpack_tsa.C +++ b/macro/run/run_unpack_tsa.C @@ -383,8 +383,6 @@ std::shared_ptr<CbmTrdUnpackMonitor> GetTrdMonitor(std::string treefilename, boo else { // FASP monitoring settings monitor = std::make_shared<CbmTrdUnpackFaspMonitor>(); monitor->SetActiveHistos(digihistovec); - filetypepos = outfilename.find(".trd.root"); - outfilename.replace(filetypepos, 10, ".fasp.root"); monitor->SetWriteToFile(outfilename.data()); } diff --git a/reco/detectors/trd/unpack/CbmTrdUnpackAlgoBaseR.cxx b/reco/detectors/trd/unpack/CbmTrdUnpackAlgoBaseR.cxx index 521ed7a425408331da2075fd0dc8d583537fbca4..a5f566b0bd5f7f8ffe494600d841d75c7a55c055 100644 --- a/reco/detectors/trd/unpack/CbmTrdUnpackAlgoBaseR.cxx +++ b/reco/detectors/trd/unpack/CbmTrdUnpackAlgoBaseR.cxx @@ -114,7 +114,12 @@ Bool_t CbmTrdUnpackAlgoBaseR::initParSet(CbmTrdParSetDigi* parset) // The monitor needs the ParSetDigi to extract module informations and other stuff if (fMonitor) { LOG(info) << fName << "::initParSet(CbmTrdParSetDigi) - Forwarding ParSetDigi to the monitor"; - initOk &= fMonitor->Init(parset); + CbmTrdParSetAsic* asics(nullptr); + for (auto pair : fParContVec) { + if ((pair.second).get()->IsA() != CbmTrdParSetAsic::Class()) continue; + asics = static_cast<CbmTrdParSetAsic*>((pair.second).get()); + } + initOk &= fMonitor->Init(parset, asics); } return initOk; diff --git a/reco/detectors/trd/unpack/CbmTrdUnpackFaspMonitor.cxx b/reco/detectors/trd/unpack/CbmTrdUnpackFaspMonitor.cxx index f809ea2623913d335b627e3ebfd76c8c30ee0f6b..2175a7f86c1d98aa855abb8bd6c1c177a4638a78 100644 --- a/reco/detectors/trd/unpack/CbmTrdUnpackFaspMonitor.cxx +++ b/reco/detectors/trd/unpack/CbmTrdUnpackFaspMonitor.cxx @@ -61,7 +61,7 @@ void CbmTrdUnpackFaspMonitor::Finish() TDirectory* oldDir = gDirectory; /// (Re-)Create ROOT file to store the histos - TFile histofile(fOutfilename.data(), "RECREATE"); + TFile histofile(fOutfilename.data(), "UPDATE"); nhistos += writeHistosToFile(&fDigiHistoMap, &histofile); nhistos += writeHistosToFile(&fRawHistoMap, &histofile); @@ -91,8 +91,12 @@ Bool_t CbmTrdUnpackFaspMonitor::Init() } // Purge the module list. Remove non-FASP modules - for (auto moduleDef : fModuleDef) { - if (!(std::get<0>(moduleDef.second).size())) fModuleDef.erase(moduleDef.first); + auto it = fModuleDef.begin(); + while (it != fModuleDef.end()) { + size_t nchs = std::get<0>((*it).second).size(); + if (nchs == 0) it = fModuleDef.erase(it); + else + it++; } createHistos(); @@ -108,7 +112,7 @@ void CbmTrdUnpackFaspMonitor::addParam(uint32_t madd, const CbmTrdParSetAsic* as return; } - std::vector<int32_t> faspMapping(NFASPMOD * NFASPCH, -1); + std::vector<int32_t> padToFaspMapping(NFASPMOD * NFASPCH, -1); std::vector<Int_t> add; asics->GetAsicAddresses(&add); for (auto afasp : add) { @@ -116,11 +120,11 @@ void CbmTrdUnpackFaspMonitor::addParam(uint32_t madd, const CbmTrdParSetAsic* as int faspid(afasp % 1000), ich(faspid * 100); for (auto ach : fasp->GetChannelAddresses()) { - faspMapping[ach] = ich; + padToFaspMapping[ach] = ich; ich++; } } - std::get<0>((*moduleDef).second) = faspMapping; + std::get<0>((*moduleDef).second) = padToFaspMapping; } //_________________________________________________________________________ @@ -149,13 +153,11 @@ void CbmTrdUnpackFaspMonitor::createHisto(eDigiHistos kHisto) auto nrows = std::get<2>(moduleDef.second); auto nchs = nrows * ncols; - histoname = "ModuleId_" + std::to_string(modId) + "-"; - histoname += getTypeName(kHisto) + "_"; - histoname += getHistoName(kHisto); + histoname = "Fasp_" + getTypeName(kHisto) + "_" + getHistoName(kHisto); switch (kHisto) { case eDigiHistos::kMap: - newhisto = std::make_shared<TH2I>(histoname.data(), histoname.data(), 2 * ncols, -0.5, (ncols - 0.5), nrows, - -0.5, (nrows - 0.5)); + newhisto = std::make_shared<TH2I>(histoname.data(), Form("%s %d", histoname.data(), modId), 2 * ncols, -0.5, + (ncols - 0.5), nrows, -0.5, (nrows - 0.5)); newhisto->SetXTitle("COL (pad)"); newhisto->SetYTitle("ROW (pad)"); newhisto->SetZTitle("Yield"); @@ -163,28 +165,29 @@ void CbmTrdUnpackFaspMonitor::createHisto(eDigiHistos kHisto) case eDigiHistos::kCharge: newhisto = - std::make_shared<TH2I>(histoname.data(), histoname.data(), 2 * nchs, -0.5, (nchs - 0.5), 4095, 0.5, 4095.5); + std::make_shared<TH2I>(histoname.data(), Form("%s %d", histoname.data(), modId), 2 * nchs, -0.5, + (nchs - 0.5), 4095, 0.5, 4095.5); newhisto->SetXTitle("Pad-Id"); newhisto->SetYTitle("Sgn [ADU]"); newhisto->SetZTitle("Yield"); break; case eDigiHistos::kChannel: - newhisto = std::make_shared<TH2I>(histoname.data(), histoname.data(), NFASPMOD, -0.5, (NFASPMOD - 0.5), NFASPCH, - -0.5, NFASPCH - 0.5); + newhisto = std::make_shared<TH2I>(histoname.data(), Form("%s %d", histoname.data(), modId), NFASPMOD, -0.5, + (NFASPMOD - 0.5), NFASPCH, -0.5, NFASPCH - 0.5); newhisto->SetXTitle("FASP-Id"); newhisto->SetYTitle("FASP-Ch"); newhisto->SetZTitle("Yield"); break; case eDigiHistos::kDigiDeltaT: newhisto = - std::make_shared<TH2I>(histoname.data(), histoname.data(), 2 * nchs, -0.5, (nchs - 0.5), 1000, 0, 1e2); + std::make_shared<TH2I>(histoname.data(), Form("%s %d", histoname.data(), modId), 2 * nchs, -0.5, + (nchs - 0.5), 1000, 0, 1e2); newhisto->SetXTitle("Pad-Id"); newhisto->SetYTitle("Rate_{SGN} [kHz]"); newhisto->SetZTitle("Yield"); break; default: return; } - // printf("AB :: createHisto(%s) row[%d] col[%d]\n", histoname.c_str(), nrows, ncols); LOG(debug) << Class_Name() << "::CreateHisto() HistoDigi " << static_cast<size_t>(kHisto) << " Module " << modId << " initialized as " << histoname.data(); if (newhisto) { addHistoToMap<eDigiHistos>(newhisto, &fDigiHistoMap, modId, kHisto); } diff --git a/reco/detectors/trd/unpack/CbmTrdUnpackFaspMonitor.h b/reco/detectors/trd/unpack/CbmTrdUnpackFaspMonitor.h index 3dce9adbdc251e4447d1eaac79ff9d0bd02ce287..aee51c03526fd2a630d646cbc1a3a5e11b9d961b 100644 --- a/reco/detectors/trd/unpack/CbmTrdUnpackFaspMonitor.h +++ b/reco/detectors/trd/unpack/CbmTrdUnpackFaspMonitor.h @@ -19,8 +19,8 @@ #define CbmTrdUnpackFaspMonitor_H #include "CbmTrdDigi.h" -#include "CbmTrdParModDigi.h" #include "CbmTrdParSetAsic.h" +#include "CbmTrdParModDigi.h" #include "CbmTrdUnpackMonitor.h" #include <MicrosliceDescriptor.hpp> diff --git a/reco/detectors/trd/unpack/CbmTrdUnpackMonitor.cxx b/reco/detectors/trd/unpack/CbmTrdUnpackMonitor.cxx index 1622a51d863031bea89c1199cc709b98967805aa..d804a5c7adba7c079e6812f98223219be7378837 100644 --- a/reco/detectors/trd/unpack/CbmTrdUnpackMonitor.cxx +++ b/reco/detectors/trd/unpack/CbmTrdUnpackMonitor.cxx @@ -107,12 +107,15 @@ void CbmTrdUnpackMonitor::Finish() } // ---- Init ---- -Bool_t CbmTrdUnpackMonitor::Init(CbmTrdParSetDigi* digiParSet) +Bool_t CbmTrdUnpackMonitor::Init(CbmTrdParSetDigi* digiParSet, CbmTrdParSetAsic* asicParSet) { auto modulemap = digiParSet->GetModuleMap(); for (auto modulepair : modulemap) { auto parmoddigi = static_cast<CbmTrdParModDigi*>(modulepair.second); - + if (asicParSet) { + auto asicParMod = static_cast<const CbmTrdParSetAsic*>(asicParSet->GetModuleSet(modulepair.first)); + if (asicParMod->GetAsicType() != Int_t(CbmTrdDigi::eCbmTrdAsicType::kSPADIC)) continue; + } fModuleIdsVec.emplace_back(modulepair.first); fModuleOrientation.emplace(std::pair<std::uint32_t, std::uint8_t>(modulepair.first, parmoddigi->GetOrientation())); diff --git a/reco/detectors/trd/unpack/CbmTrdUnpackMonitor.h b/reco/detectors/trd/unpack/CbmTrdUnpackMonitor.h index f06701d8cd9d95160d0271a5606c6075c05a354b..9ba2c04ece94e473de7d526dd6e0a44a24cc1710 100644 --- a/reco/detectors/trd/unpack/CbmTrdUnpackMonitor.h +++ b/reco/detectors/trd/unpack/CbmTrdUnpackMonitor.h @@ -23,6 +23,7 @@ #include "CbmTrdDigi.h" #include "CbmTrdParSetDigi.h" +#include "CbmTrdParSetAsic.h" #include "CbmTrdRawMessageSpadic.h" #include "CbmTrdSpadic.h" @@ -121,7 +122,7 @@ public: // Runtime functions /** @brief Init all required parameter informations */ - Bool_t Init(CbmTrdParSetDigi* digiParSet); + Bool_t Init(CbmTrdParSetDigi* digiParSet, CbmTrdParSetAsic* asicParSet = nullptr); /** @brief transfer the enums for the histos to be activated to the member vector */ void SetActiveHistos(std::vector<eDigiHistos> vec) { fActiveDigiHistos.swap(vec); }