Commit d0469421 authored by Adrian A. Weber's avatar Adrian A. Weber Committed by Pierre-Alain Loizeau
Browse files

add mRICH time offset correction and add masking of DiRICH boards to avoid the...

add mRICH time offset correction and add masking of DiRICH boards to avoid the error messages. Error messages tells you now, which board has a problem.
parent e939afdf
......@@ -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);
}
// -------------
......
......@@ -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)
......@@ -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.;
......
......@@ -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);
......
......@@ -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)
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment