Skip to content
Snippets Groups Projects
Commit 6c71c3b2 authored by Adrian Weber's avatar Adrian Weber
Browse files

correction in digi building to fix loss of major part of digis in vector as...

correction in digi building to fix loss of major part of digis in vector as well as the inclusion of the reference time Stamp for each TS.
parent 7bf0bfc2
No related branches found
No related tags found
1 merge request!414mCBM_mRICH: mrich unpacker correction and ref. TS
......@@ -103,6 +103,10 @@ Bool_t CbmMcbm2018UnpackerAlgoRich::ProcessTs(const fles::Timeslice& /*ts*/)
Bool_t CbmMcbm2018UnpackerAlgoRich::ProcessTs(const fles::Timeslice& ts, size_t component)
{
// Get reference TS time
fdTsStartTime = ts.start_time();
/// Ignore First TS as first MS is typically corrupt
if (0 == ts.index()) { return kTRUE; }
......@@ -508,14 +512,26 @@ void CbmMcbm2018UnpackerAlgoRich::WriteOutputDigi(Int_t fpgaID, Int_t channel, D
Double_t ToTcorr = fbDoToTCorr ? fUnpackPar->GetToTshift(fpgaID, channel) : 0.;
Int_t pixelUID = this->GetPixelUID(fpgaID, channel);
//check ordering
Double_t finalTime = time + (Double_t) MSidx - fdTimeOffsetNs;
uint64_t msRefTS = 0;
if (MSidx >= fdTsStartTime) {
msRefTS = MSidx - fdTsStartTime;
} else {
std::cout<<"MS before TS Start: "<<MSidx<<" "<<fdTsStartTime<<std::endl;
}
Double_t finalTime = time + (Double_t) msRefTS - fdTimeOffsetNs;
// Double_t finalTime = time + (Double_t) MSidx - fdTimeOffsetNs;
if (msRefTS == 0) return; // Problems in data in current version. time is too large
Double_t lastTime = 0.;
if (fDigiVect.size() < 1) { fDigiVect.emplace_back(pixelUID, finalTime, tot - ToTcorr); }
else {
lastTime = fDigiVect[fDigiVect.size() - 1].GetTime();
if (lastTime > finalTime) {
if (fDigiVect[0].GetTime() > finalTime) {
fDigiVect.emplace(fDigiVect.begin(), pixelUID, finalTime, tot - ToTcorr);
} else if (lastTime > finalTime) {
for (int i = fDigiVect.size() - 1; i >= 0; i--) {
lastTime = fDigiVect[i].GetTime();
if (lastTime <= finalTime) {
......
......@@ -348,6 +348,8 @@ public: // histograms
std::map<uint32_t, std::map<Int_t, TH1D*>> fhTotMap;
std::map<uint32_t, TH2D*> fhTot2dMap;
uint64_t fdTsStartTime = 0;
ClassDef(CbmMcbm2018UnpackerAlgoRich, 1);
};
......
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