Skip to content
Snippets Groups Projects
Commit ebbb46b7 authored by Pierre-Alain Loizeau's avatar Pierre-Alain Loizeau
Browse files

[mBmon] Add Tof unpack par Alias for BMon + related flags and conversions

Needed to have two instances of the CbmMcbm2018TofPar in the same FairRoot Runtime DB manager, which is needed at least for MQ par server
- new CbmMcbm2018BmonPar class as transparent derivation of CbmMcbm2018TofPar
- Control flags in TOF and BMon unpacking code (algo + config)
- Type and pointer conversions in TOF unpack algo to hide the alias class and use only base class internaly
parent 2117fdf6
No related branches found
No related tags found
1 merge request!809Changes to mTOF and mBMON from march 2022 runs
......@@ -168,4 +168,16 @@ private:
ClassDef(CbmMcbm2018TofPar, 1);
};
class CbmMcbm2018BmonPar : public CbmMcbm2018TofPar {
public:
/** Standard constructor **/
CbmMcbm2018BmonPar(const char* name = "CbmMcbm2018BmonPar", const char* title = "Bmon unpacker parameters",
const char* context = "Default")
: CbmMcbm2018TofPar(name, title, context) {};
private:
// just an alias for the Parameter container to allow two instances
ClassDef(CbmMcbm2018BmonPar, 1);
};
#endif // CBMMCBM2018TOFPAR_H
......@@ -15,6 +15,7 @@
#pragma link C++ class CbmTofDigiPar + ;
#pragma link C++ class CbmMcbm2018TofPar + ;
#pragma link C++ class CbmTofGeoHandler + ;
#pragma link C++ class CbmMcbm2018BmonPar + ;
#pragma link C++ class TTrbHeader + ;
#endif
......@@ -58,6 +58,11 @@ void CbmTofContFact::setAllContainers()
FairContainer* beamPars = new FairContainer("CbmMcbm2018TofPar", "TOF at MCBM 2018 Unpack Parameters", "Default");
beamPars->addContext("Default");
containers->Add(beamPars);
FairContainer* beamParsBmon = new FairContainer(
"CbmMcbm2018BmonPar", "BMon at MCBM 2022+ Unpack Parameters, interim for dual instances", "Default");
beamParsBmon->addContext("Default");
containers->Add(beamParsBmon);
}
FairParSet* CbmTofContFact::createContainer(FairContainer* c)
......@@ -77,6 +82,9 @@ FairParSet* CbmTofContFact::createContainer(FairContainer* c)
else if (strcmp(name, "CbmMcbm2018TofPar") == 0) {
p = new CbmMcbm2018TofPar(c->getConcatName().Data(), c->GetTitle(), c->getContext());
}
else if (strcmp(name, "CbmMcbm2018BmonPar") == 0) {
p = new CbmMcbm2018BmonPar(c->getConcatName().Data(), c->GetTitle(), c->getContext());
}
return p;
}
####################################################################################################
[CbmMcbm2018TofPar]
[CbmMcbm2018BmonPar]
//----------------------------------------------------------------------------
NrOfGdpbs: Int_t 4
GdpbIdArray: Int_t \
......
......@@ -17,6 +17,7 @@
CbmBmonUnpackConfig::CbmBmonUnpackConfig(std::string detGeoSetupTag, UInt_t runid)
: CbmTofUnpackConfig(detGeoSetupTag, runid)
{
SetFlagBmonParMode();
}
CbmBmonUnpackConfig::~CbmBmonUnpackConfig() {}
......
......@@ -25,14 +25,21 @@ CbmTofUnpackAlgo::~CbmTofUnpackAlgo() {}
std::vector<std::pair<std::string, std::shared_ptr<FairParGenericSet>>>*
CbmTofUnpackAlgo::GetParContainerRequest(std::string /*geoTag*/, std::uint32_t /*runId*/)
{
// Basepath for default Trd parameter sets (those connected to a geoTag)
// Basepath for default Tof parameter sets (those connected to a geoTag)
std::string basepath = Form("%s", fParFilesBasePath.data());
std::string temppath = "";
// // Get parameter container
temppath = basepath + fParFileName;
LOG(info) << fName << "::GetParContainerRequest - Trying to open file " << temppath;
fParContVec.emplace_back(std::make_pair(temppath, std::make_shared<CbmMcbm2018TofPar>()));
if (fbBmonParMode) {
/// Should be enabled only when both TOF and BMON are used with same RunManagerDb (only MQ for now)
LOG(info) << fName << "::GetParContainerRequest - Requesting CbmMcbm2018BmonPar instead of CbmMcbm2018TofPar";
fParContVec.emplace_back(std::make_pair(temppath, std::make_shared<CbmMcbm2018BmonPar>()));
}
else {
fParContVec.emplace_back(std::make_pair(temppath, std::make_shared<CbmMcbm2018TofPar>()));
}
return &fParContVec;
}
......@@ -44,7 +51,14 @@ Bool_t CbmTofUnpackAlgo::init() { return kTRUE; }
Bool_t CbmTofUnpackAlgo::initParSet(FairParGenericSet* parset)
{
LOG(info) << fName << "::initParSet - for container " << parset->ClassName();
if (parset->IsA() == CbmMcbm2018TofPar::Class()) return initParSet(static_cast<CbmMcbm2018TofPar*>(parset));
if (parset->IsA() == CbmMcbm2018BmonPar::Class()) {
/// Should be the case only if fbBmonParMode is enabled and when both TOF and BMON are used with same
/// RunManagerDb (only MQ for now). CbmMcbm2018BmonPar is an identical derivation of CbmMcbm2018TofPar
return initParSet(dynamic_cast<CbmMcbm2018TofPar*>(parset));
}
else if (parset->IsA() == CbmMcbm2018TofPar::Class()) {
return initParSet(static_cast<CbmMcbm2018TofPar*>(parset));
}
// If we do not know the derived ParSet class we return false
LOG(error)
......
......@@ -72,6 +72,13 @@ public:
*/
void SetFlagEpochCountHack2021(bool bFlagin = true) { fbEpochCountHack2021 = bFlagin; }
/**
* @brief Sets the flag switching to a request of CbmMcbm2018BmonPar. Default is enable.
*
* @param[in] Optional: boolean flag value, default is true
*/
void SetFlagBmonParMode(bool bFlagin = true) { fbBmonParMode = bFlagin; }
/**
* @brief Sets the name of the parameter file to be used.
*
......@@ -194,6 +201,7 @@ private:
/// Control flags
bool fbEpochCountHack2021 = false;
bool fbBmonParMode = false;
std::vector<bool> fvbMaskedComponents = {};
bool fbLastEpochGood = false;
......
......@@ -41,6 +41,11 @@ std::shared_ptr<CbmTofUnpackAlgo> CbmTofUnpackConfig::chooseAlgo()
// Unpacker algo from mcbm 2021 on and hopefully default for a long time.
auto algo = std::make_shared<CbmTofUnpackAlgo>();
LOG(info) << fName << "::chooseAlgo() - selected algo = " << algo->Class_Name();
if (fbBmonParMode) {
LOG(info) << fName << "::chooseAlgo - Setting the new algo in BMon Par mode";
algo->SetFlagBmonParMode(fbBmonParMode);
}
return algo;
LOG(error) << fName
......
......@@ -76,6 +76,13 @@ public:
*/
void SetFlagEpochCountHack2021(bool bFlagin = true) { fbEpochCountHack2021 = bFlagin; }
/**
* @brief Sets the flag switching to a request of CbmMcbm2018BmonPar. Default is enable.
*
* @param[in] Optional: boolean flag value, default is true
*/
void SetFlagBmonParMode(bool bFlagin = true) { fbBmonParMode = bFlagin; }
/**
* @brief Sets the name of the parameter file to be used.
*
......@@ -98,6 +105,7 @@ protected:
private:
/// Control flags
bool fbEpochCountHack2021 = false;
bool fbBmonParMode = false;
/// Parameter file name
std::string fsParFileName = "mTofCriPar.par";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment