diff --git a/fles/mcbm2018/CbmMcbm2018Source.cxx b/fles/mcbm2018/CbmMcbm2018Source.cxx index d7619d28b56c16149f036a1a379d4eabd80ef707..151d39ebb05b4659f85271c969b2fb42acf2f8c9 100644 --- a/fles/mcbm2018/CbmMcbm2018Source.cxx +++ b/fles/mcbm2018/CbmMcbm2018Source.cxx @@ -118,74 +118,65 @@ Bool_t CbmMcbm2018Source::Init() { fbWriteOutput); /// Single spill unpacking - if (0 <= fiUnpSpillIdxStart) - { - switch( fuFlagSpillStart ) - { - case 0: - { + if (0 <= fiUnpSpillIdxStart) { + switch (fuFlagSpillStart) { + case 0: { /// 0 = Break begin - if( fvuSpillBreakBegTs.size() - 1 <= fiUnpSpillIdxStop ) - { + if (fvuSpillBreakBegTs.size() - 1 <= fiUnpSpillIdxStop) { LOG(warning) << "Chosen last spill index larger than spills contained in chosen spill start vector: " << fiUnpSpillIdxStop << " VS " << fvuSpillBreakBegTs.size() - 1; - if( fiUnpSpillIdxStart < fvuSpillBreakBegTs.size() - 1 ) - { - fiUnpSpillIdxStop = fvuSpillBreakBegTs.size() - 2; - LOG(warning) << "Using last possible spill instead as final one"; - } // if( fiUnpSpillIdxStart < fvuSpillBreakBegTs.size() - 1 ) - else LOG(fatal) << "Start index also too large, exiting"; - } // if( fvuSpillBreakBegTs.size() - 1 <= fiUnpSpillIdxStop ) - - fuSpillBegTs = fvuSpillBreakBegTs[ fiUnpSpillIdxStart ]; //! - fuSpillEndTs = fvuSpillBreakBegTs[ fiUnpSpillIdxStop + 1 ]; //! + if (fiUnpSpillIdxStart < fvuSpillBreakBegTs.size() - 1) { + fiUnpSpillIdxStop = fvuSpillBreakBegTs.size() - 2; + LOG(warning) << "Using last possible spill instead as final one"; + } // if( fiUnpSpillIdxStart < fvuSpillBreakBegTs.size() - 1 ) + else + LOG(fatal) << "Start index also too large, exiting"; + } // if( fvuSpillBreakBegTs.size() - 1 <= fiUnpSpillIdxStop ) + + fuSpillBegTs = fvuSpillBreakBegTs[fiUnpSpillIdxStart]; //! + fuSpillEndTs = fvuSpillBreakBegTs[fiUnpSpillIdxStop + 1]; //! break; } - case 1: - { + case 1: { /// 1 = Break middle - if( fvuSpillBreakMidTs.size() - 1 <= fiUnpSpillIdxStop ) - { + if (fvuSpillBreakMidTs.size() - 1 <= fiUnpSpillIdxStop) { LOG(warning) << "Chosen last spill index larger than spills contained in chosen spill start vector: " << fiUnpSpillIdxStop << " VS " << fvuSpillBreakMidTs.size() - 1; - if( fiUnpSpillIdxStart < fvuSpillBreakMidTs.size() - 1 ) - { - fiUnpSpillIdxStop = fvuSpillBreakMidTs.size() - 2; - LOG(warning) << "Using last possible spill instead as final one"; - } // if( fiUnpSpillIdxStart < fvuSpillBreakMidTs.size() - 1 ) - else LOG(fatal) << "Start index also too large, exiting"; - } // if( fvuSpillBreakMidTs.size() - 1 <= fiUnpSpillIdxStop ) - - fuSpillBegTs = fvuSpillBreakMidTs[ fiUnpSpillIdxStart ]; //! - fuSpillEndTs = fvuSpillBreakMidTs[ fiUnpSpillIdxStop + 1 ]; //! + if (fiUnpSpillIdxStart < fvuSpillBreakMidTs.size() - 1) { + fiUnpSpillIdxStop = fvuSpillBreakMidTs.size() - 2; + LOG(warning) << "Using last possible spill instead as final one"; + } // if( fiUnpSpillIdxStart < fvuSpillBreakMidTs.size() - 1 ) + else + LOG(fatal) << "Start index also too large, exiting"; + } // if( fvuSpillBreakMidTs.size() - 1 <= fiUnpSpillIdxStop ) + + fuSpillBegTs = fvuSpillBreakMidTs[fiUnpSpillIdxStart]; //! + fuSpillEndTs = fvuSpillBreakMidTs[fiUnpSpillIdxStop + 1]; //! break; } - case 2: - { + case 2: { /// 2 = Break end - if( fvuSpillBreakEndTs.size() - 1 <= fiUnpSpillIdxStop ) - { + if (fvuSpillBreakEndTs.size() - 1 <= fiUnpSpillIdxStop) { LOG(warning) << "Chosen last spill index larger than spills contained in chosen spill start vector: " << fiUnpSpillIdxStop << " VS " << fvuSpillBreakEndTs.size() - 1; - if( fiUnpSpillIdxStart < fvuSpillBreakEndTs.size() - 1 ) - { - fiUnpSpillIdxStop = fvuSpillBreakEndTs.size() - 2; - LOG(warning) << "Using last possible spill instead as final one"; - } // if( fiUnpSpillIdxStart < fvuSpillBreakEndTs.size() - 1 ) - else LOG(fatal) << "Start index also too large, exiting"; - } // if( fvuSpillBreakEndTs.size() - 1 <= fiUnpSpillIdxStop ) - - fuSpillBegTs = fvuSpillBreakEndTs[ fiUnpSpillIdxStart ]; //! - fuSpillEndTs = fvuSpillBreakEndTs[ fiUnpSpillIdxStop + 1 ]; //! + if (fiUnpSpillIdxStart < fvuSpillBreakEndTs.size() - 1) { + fiUnpSpillIdxStop = fvuSpillBreakEndTs.size() - 2; + LOG(warning) << "Using last possible spill instead as final one"; + } // if( fiUnpSpillIdxStart < fvuSpillBreakEndTs.size() - 1 ) + else + LOG(fatal) << "Start index also too large, exiting"; + } // if( fvuSpillBreakEndTs.size() - 1 <= fiUnpSpillIdxStop ) + + fuSpillBegTs = fvuSpillBreakEndTs[fiUnpSpillIdxStart]; //! + fuSpillEndTs = fvuSpillBreakEndTs[fiUnpSpillIdxStop + 1]; //! break; } - default: - { + default: { LOG(fatal) << "Unknown spill start point option: " << fuFlagSpillStart; break; } } // switch( fuFlagSpillStart ) - } // if (0 <= fiUnpSpillIdxStart) + } // if (0 <= fiUnpSpillIdxStart) return kTRUE; } @@ -328,40 +319,35 @@ Int_t CbmMcbm2018Source::FillBuffer() { auto msLength = msDescB.idx - msDescA.idx; fTSLength = msLength * nMsInTs; fTSOverlappLength = msLength * (ts.num_microslices(0) - nMsInTs); - LOG(info) - << "CbmMcbm2018Source::FillBuffer() - TS 1 - Calculated " - << "TimesliceMetaData information from microslices Metadata -> " - << "MS length found to be " << msLength << " ns, TS length " - << fTSLength << " ns, and TS overlap length " - << fTSOverlappLength << " ns"; - } else { + LOG(info) << "CbmMcbm2018Source::FillBuffer() - TS 1 - Calculated " + << "TimesliceMetaData information from microslices Metadata -> " + << "MS length found to be " << msLength << " ns, TS length " << fTSLength + << " ns, and TS overlap length " << fTSOverlappLength << " ns"; + } + else { LOG(warning) << "CbmMcbm2018Source::FillBuffer() - TS 1 - Calculate " "TimesliceMetaData information - single microslice timeslices -> " "TS duration can not be calculated with the given method. Hence, " "TimesliceMetaData duration values are filled with 0"; } - } // if( 1 == fTSCounter ) + } // if( 1 == fTSCounter ) - if (0 <= fiUnpSpillIdxStart ) - { - if (tsIndex < fuSpillBegTs) - { + if (0 <= fiUnpSpillIdxStart) { + if (tsIndex < fuSpillBegTs) { /// Jump all TS until reaching the first TS in the spill we want to unpack continue; - } // if (tsIndex < fuSpillBegTs) - else if(fuSpillEndTs <= tsIndex) - { + } // if (tsIndex < fuSpillBegTs) + else if (fuSpillEndTs <= tsIndex) { /// Stop when reaching the first TS in the next spill return 1; - } // else if - } // if (0 <= fiUnpSpillIdxStart) + } // else if + } // if (0 <= fiUnpSpillIdxStart) /// Apply TS throttling as set by user (default = 1 => no throttling) if (0 == tsIndex % fuTsReduction) { - for (auto itUnp = fUnpackersToRun.begin(); itUnp != fUnpackersToRun.end(); - ++itUnp) { + for (auto itUnp = fUnpackersToRun.begin(); itUnp != fUnpackersToRun.end(); ++itUnp) { (*itUnp)->DoUnpack(ts, 0); } // for( auto itUnp = fUnpackersToRun.begin(); itUnp != fUnpackersToRun.end(); ++ itUnp ) } // if( 0 == tsIndex % fuTsReduction ) diff --git a/fles/mcbm2018/CbmMcbm2018Source.h b/fles/mcbm2018/CbmMcbm2018Source.h index 9d89d04c999b7db6c7d84fdde0680ac78e460fdb..b78341b13e8085dee1b2b95438f10ef44d89acbb 100644 --- a/fles/mcbm2018/CbmMcbm2018Source.h +++ b/fles/mcbm2018/CbmMcbm2018Source.h @@ -77,26 +77,31 @@ public: fuTsReduction = uTsReduction; } - void UnpackSingleSpill( Int_t uSpillIdx, UInt_t uSpillStart = 1 ) { - fiUnpSpillIdxStart = uSpillIdx; - fiUnpSpillIdxStop = uSpillIdx; - fuFlagSpillStart = uSpillStart; + void UnpackSingleSpill(Int_t uSpillIdx, UInt_t uSpillStart = 1) + { + fiUnpSpillIdxStart = uSpillIdx; + fiUnpSpillIdxStop = uSpillIdx; + fuFlagSpillStart = uSpillStart; } - void UnpackSelectSpills( Int_t uSpillIdxStart, Int_t uSpillIdxStop, UInt_t uSpillStart = 1 ) { - fiUnpSpillIdxStart = uSpillIdxStart; - fiUnpSpillIdxStop = uSpillIdxStop; - fuFlagSpillStart = uSpillStart; + void UnpackSelectSpills(Int_t uSpillIdxStart, Int_t uSpillIdxStop, UInt_t uSpillStart = 1) + { + fiUnpSpillIdxStart = uSpillIdxStart; + fiUnpSpillIdxStop = uSpillIdxStop; + fuFlagSpillStart = uSpillStart; } - void LoadTsListSpillBreakBegin( std::vector< ULong64_t > vTsBeg ) { - fvuSpillBreakBegTs.assign( vTsBeg.begin(), vTsBeg.end() ); + void LoadTsListSpillBreakBegin(std::vector<ULong64_t> vTsBeg) + { + fvuSpillBreakBegTs.assign(vTsBeg.begin(), vTsBeg.end()); } - void LoadTsListSpillBreakEnd( std::vector< ULong64_t > vTsEnd ) { - fvuSpillBreakEndTs.assign( vTsEnd.begin(), vTsEnd.end() ); + void LoadTsListSpillBreakEnd(std::vector<ULong64_t> vTsEnd) + { + fvuSpillBreakEndTs.assign(vTsEnd.begin(), vTsEnd.end()); } - void LoadTsListSpillBreakMiddle( std::vector< ULong64_t > vTsMid ) { - fvuSpillBreakMidTs.assign( vTsMid.begin(), vTsMid.end() ); + void LoadTsListSpillBreakMiddle(std::vector<ULong64_t> vTsMid) + { + fvuSpillBreakMidTs.assign(vTsMid.begin(), vTsMid.end()); } void SetSubscriberHwm(UInt_t val = 1) { fuSubscriberHwm = val; } @@ -133,9 +138,9 @@ private: UInt_t fuSpillBegTs = 0; //! UInt_t fuSpillEndTs = 0; //! - std::vector< ULong64_t > fvuSpillBreakBegTs = {}; //! - std::vector< ULong64_t > fvuSpillBreakEndTs = {}; //! - std::vector< ULong64_t > fvuSpillBreakMidTs = {}; //! + std::vector<ULong64_t> fvuSpillBreakBegTs = {}; //! + std::vector<ULong64_t> fvuSpillBreakEndTs = {}; //! + std::vector<ULong64_t> fvuSpillBreakMidTs = {}; //! std::unique_ptr<fles::TimesliceSource> fSource; //! diff --git a/fles/mcbm2018/tasks/CbmMcbmSpillFindAlgo.cxx b/fles/mcbm2018/tasks/CbmMcbmSpillFindAlgo.cxx index 96a0e6f4d9e33f0a2a48ae773b3a14f92247812a..0e97224ad02e4663d0ce9e5f7bcc196883bc652f 100644 --- a/fles/mcbm2018/tasks/CbmMcbmSpillFindAlgo.cxx +++ b/fles/mcbm2018/tasks/CbmMcbmSpillFindAlgo.cxx @@ -36,9 +36,7 @@ // ------------------------------------------------------------------------- CbmMcbmSpillFindAlgo::CbmMcbmSpillFindAlgo() : CbmStar2019Algo() {} -CbmMcbmSpillFindAlgo::~CbmMcbmSpillFindAlgo() -{ -} +CbmMcbmSpillFindAlgo::~CbmMcbmSpillFindAlgo() {} // ------------------------------------------------------------------------- Bool_t CbmMcbmSpillFindAlgo::Init() @@ -52,55 +50,54 @@ void CbmMcbmSpillFindAlgo::Finish() { /// If Spill is On, add a fake spill break to have the last spill /// If Spill is Off, add a fake spill break end so that all modes include last spill - if (fbSpillOn) - { - fvuSpillBreakBegTs.push_back( fulCurrentTsIdx + 1 ); - fvuSpillBreakEndTs.push_back( fulCurrentTsIdx + 1 ); - } // if (fbSpillOn) - else fvuSpillBreakEndTs.push_back( fulCurrentTsIdx + 1 ); + if (fbSpillOn) { + fvuSpillBreakBegTs.push_back(fulCurrentTsIdx + 1); + fvuSpillBreakEndTs.push_back(fulCurrentTsIdx + 1); + } // if (fbSpillOn) + else + fvuSpillBreakEndTs.push_back(fulCurrentTsIdx + 1); /// Fill the vector of spill break middle points - std::vector< ULong64_t >::iterator itBreakBeg = fvuSpillBreakBegTs.begin(); - std::vector< ULong64_t >::iterator itBreakEnd = fvuSpillBreakEndTs.begin(); + std::vector<ULong64_t>::iterator itBreakBeg = fvuSpillBreakBegTs.begin(); + std::vector<ULong64_t>::iterator itBreakEnd = fvuSpillBreakEndTs.begin(); - if( itBreakBeg != fvuSpillBreakBegTs.end() && itBreakEnd != fvuSpillBreakEndTs.end() && *itBreakEnd < *itBreakBeg ) { + if (itBreakBeg != fvuSpillBreakBegTs.end() && itBreakEnd != fvuSpillBreakEndTs.end() && *itBreakEnd < *itBreakBeg) { fvuSpillBreakMidTs.push_back((*itBreakEnd + fulFirstTsIdx) / 2); ++itBreakEnd; } // if( itBreakBeg != fvuSpillBreakBegTs.end() && itBreakEnd != fvuSpillBreakEndTs.end() && *itBreakEnd < *itBreakBeg ) - while( itBreakBeg != fvuSpillBreakBegTs.end() && itBreakEnd != fvuSpillBreakEndTs.end() ) { + while (itBreakBeg != fvuSpillBreakBegTs.end() && itBreakEnd != fvuSpillBreakEndTs.end()) { fvuSpillBreakMidTs.push_back((*itBreakBeg + *itBreakEnd) / 2); ++itBreakBeg; ++itBreakEnd; } // while( itBreakBeg != fvuSpillBreakBegTs.end() && itBreakEnd != fvuSpillBreakEndTs.end() ) - if( itBreakBeg != fvuSpillBreakBegTs.end() ) { - fvuSpillBreakMidTs.push_back((*itBreakBeg + fulCurrentTsIdx) / 2); + if (itBreakBeg != fvuSpillBreakBegTs.end()) { + fvuSpillBreakMidTs.push_back((*itBreakBeg + fulCurrentTsIdx) / 2); ++itBreakBeg; - } // if( itBreakBeg != fvuSpillBreakBegTs.end() ) + } // if( itBreakBeg != fvuSpillBreakBegTs.end() ) - if( itBreakBeg != fvuSpillBreakBegTs.end() || itBreakEnd != fvuSpillBreakEndTs.end() ) { - LOG(warning) << "Size of spill breaks beginning or end did not match: " - << fvuSpillBreakBegTs.size() << " VS " << fvuSpillBreakEndTs.size(); + if (itBreakBeg != fvuSpillBreakBegTs.end() || itBreakEnd != fvuSpillBreakEndTs.end()) { + LOG(warning) << "Size of spill breaks beginning or end did not match: " << fvuSpillBreakBegTs.size() << " VS " + << fvuSpillBreakEndTs.size(); } // if( itBreakBeg != fvuSpillBreakBegTs.end() || itBreakEnd != fvuSpillBreakEndTs.end() ) LOG(info) << "**********************************************"; LOG(info) << "TS index for beginning of spill breaks:"; for (ULong64_t uBeg : fvuSpillBreakBegTs) { - LOG(info)<< Form( "%9llu", uBeg ); + LOG(info) << Form("%9llu", uBeg); } // for (ULong64_t uBeg : fvuSpillBreakBegTs) LOG(info) << "**********************************************"; LOG(info) << "TS index for ending of spill breaks:"; for (ULong64_t uEnd : fvuSpillBreakEndTs) { - LOG(info)<< Form( "%9llu", uEnd ); + LOG(info) << Form("%9llu", uEnd); } // for (ULong64_t uBeg : fvuSpillBreakBegTs) LOG(info) << "**********************************************"; LOG(info) << "TS index for middle of spill breaks:"; for (ULong64_t uMid : fvuSpillBreakMidTs) { - LOG(info)<< Form( "%9llu", uMid ); + LOG(info) << Form("%9llu", uMid); } // for (ULong64_t uBeg : fvuSpillBreakBegTs) LOG(info) << "**********************************************"; - } // ------------------------------------------------------------------------- @@ -186,8 +183,7 @@ Bool_t CbmMcbmSpillFindAlgo::ProcessTs(const fles::Timeslice& ts) { fulCurrentTsIdx = ts.index(); fdTsStartTime = static_cast<Double_t>(ts.descriptor(0, 0).idx); - if( fulCurrentTsIdx < fulFirstTsIdx ) - fulFirstTsIdx = fulCurrentTsIdx; + if (fulCurrentTsIdx < fulFirstTsIdx) fulFirstTsIdx = fulCurrentTsIdx; /// Ignore First TS as first MS is typically corrupt if (0 == fulCurrentTsIdx) return kTRUE; @@ -223,7 +219,7 @@ Bool_t CbmMcbmSpillFindAlgo::ProcessTs(const fles::Timeslice& ts) return kFALSE; } // if( kFALSE == ProcessMs( ts, uMsCompIdx, fuMsIndex ) ) } // for( UInt_t uMsCompIdx = 0; uMsCompIdx < fvMsComponentsList.size(); ++uMsCompIdx ) - } // for( fuMsIndex = 0; fuMsIndex < uNbMsLoop; fuMsIndex ++ ) + } // for( fuMsIndex = 0; fuMsIndex < uNbMsLoop; fuMsIndex ++ ) /// Fill plots if in monitor mode if (fbMonitorMode) { @@ -309,30 +305,27 @@ Bool_t CbmMcbmSpillFindAlgo::ProcessMs(const fles::Timeslice& ts, size_t uMsComp if (fbSpillOn && fuCountsLastInterval < fuOffSpillCountLimit) { fbSpillOn = kFALSE; fuCurrentSpillIdx++; - fdStartTimeSpill = fdMsTime; - if( 0 < fvuSpillBreakBegTs.size() ) - { - fhSpillDuration->Fill( fulCurrentTsIdx - fvuSpillBreakBegTs.back() ); - } // if( 0 < fvuSpillBreakBegTs.size() ) - fvuSpillBreakBegTs.push_back( fulCurrentTsIdx ); + fdStartTimeSpill = fdMsTime; + if (0 < fvuSpillBreakBegTs.size()) { + fhSpillDuration->Fill(fulCurrentTsIdx - fvuSpillBreakBegTs.back()); + } // if( 0 < fvuSpillBreakBegTs.size() ) + fvuSpillBreakBegTs.push_back(fulCurrentTsIdx); } // if( fbSpillOn && fuCountsLastInterval < fuOffSpillCountLimit ) else if (!fbSpillOn && fuOffSpillCountLimit < fuCountsLastInterval) { fbSpillOn = kTRUE; - if( 0 < fvuSpillBreakBegTs.size() ) - { - fhSpillBreakDuration->Fill( fuCurrentSpillIdx, fulCurrentTsIdx - fvuSpillBreakBegTs.back() ); - } // if( 0 < fvuSpillBreakBegTs.size() ) - if( 0 < fvuSpillBreakEndTs.size() ) - { - fhHitsPerSpill->Fill( fuCurrentSpillIdx, fuCountsLastSpill ); - fhSpillDuration->Fill( fuCurrentSpillIdx, fulCurrentTsIdx - fvuSpillBreakEndTs.back() ); - } // if( 0 < fvuSpillBreakEndTs.size() ) - fvuSpillBreakEndTs.push_back( fulCurrentTsIdx ); + if (0 < fvuSpillBreakBegTs.size()) { + fhSpillBreakDuration->Fill(fuCurrentSpillIdx, fulCurrentTsIdx - fvuSpillBreakBegTs.back()); + } // if( 0 < fvuSpillBreakBegTs.size() ) + if (0 < fvuSpillBreakEndTs.size()) { + fhHitsPerSpill->Fill(fuCurrentSpillIdx, fuCountsLastSpill); + fhSpillDuration->Fill(fuCurrentSpillIdx, fulCurrentTsIdx - fvuSpillBreakEndTs.back()); + } // if( 0 < fvuSpillBreakEndTs.size() ) + fvuSpillBreakEndTs.push_back(fulCurrentTsIdx); fuCountsLastSpill = 0; } // else if (fuOffSpillCountLimit < fuCountsLastInterval) fuCountsLastInterval = 0; - fdLastSecondTime = fdMsTime; + fdLastSecondTime = fdMsTime; } // if( fdSpillCheckInterval < fdMsTime - fdLastSecondTime ) } // if( 0 == fuCurrDpbIdx ) @@ -361,9 +354,7 @@ Bool_t CbmMcbmSpillFindAlgo::ProcessMs(const fles::Timeslice& ts, size_t uMsComp uint64_t ulData = static_cast<uint64_t>(pInBuff[uIdx]); /// Catch the Epoch cycle block which is always the first 64b of the MS - if (0 == uIdx) { - continue; - } // if( 0 == uIdx ) + if (0 == uIdx) { continue; } // if( 0 == uIdx ) gdpbv100::Message mess(ulData); /// Get message type @@ -395,7 +386,7 @@ Bool_t CbmMcbmSpillFindAlgo::ProcessMs(const fles::Timeslice& ts, size_t uMsComp fuCountsLastSpill++; ulNbHitsTs++; } // if (0 != fuGet4Nr || uTot < fuMinTotPulser || fuMaxTotPulser < uTot) { - } // else of if( getGdpbHitIs24b() ) + } // else of if( getGdpbHitIs24b() ) break; } // case gdpbv100::MSG_HIT: case gdpbv100::MSG_EPOCH: { @@ -418,7 +409,7 @@ Bool_t CbmMcbmSpillFindAlgo::ProcessMs(const fles::Timeslice& ts, size_t uMsComp << " not included in Get4 unpacker."; } // switch( mess.getMessageType() ) } // for (uint32_t uIdx = 0; uIdx < uNbMessages; uIdx ++) - fhHitsEvo->Fill( fdTsStartTime*1e-9, ulNbHitsTs ); + fhHitsEvo->Fill(fdTsStartTime * 1e-9, ulNbHitsTs); /// Fill histograms FillHistograms(); @@ -440,11 +431,11 @@ Bool_t CbmMcbmSpillFindAlgo::CreateHistograms() // double * dBinsLog = GenerateLogBinArray( 4, 9, 1, iNbBinsLog ); /*******************************************************************/ - fhHitsEvo = new TH1I("hHitsEvo", "Hit count evo; Time [s]; Hits Count []", fuHistoryHistoSize * 50, 0., - fuHistoryHistoSize); - fhHitsPerSpill = new TH1I("hHitsPerSpill", "Hit count per spill; Spill; Hits Count []", 2000, 0., 2000); + fhHitsEvo = + new TH1I("hHitsEvo", "Hit count evo; Time [s]; Hits Count []", fuHistoryHistoSize * 50, 0., fuHistoryHistoSize); + fhHitsPerSpill = new TH1I("hHitsPerSpill", "Hit count per spill; Spill; Hits Count []", 2000, 0., 2000); fhSpillBreakDuration = new TH1I("hSpillBreakDuration", "Spill break duration; Spill; Duration [TS]", 2000, 0., 2000); - fhSpillDuration = new TH1I("hSpillDuration", "Spill duration; Spill; Duration [TS]", 2000, 0., 2000); + fhSpillDuration = new TH1I("hSpillDuration", "Spill duration; Spill; Duration [TS]", 2000, 0., 2000); /// Add pointers to the vector with all histo for access by steering class AddHistoToVector(fhHitsEvo, sFolder); @@ -463,7 +454,7 @@ Bool_t CbmMcbmSpillFindAlgo::CreateHistograms() Double_t h = 10; /*******************************************************************/ -/* + /* /// Map of hits over T0 detector and same vs time in run fcHitMaps = new TCanvas("cHitMaps", "Hit maps", w, h); fcHitMaps->Divide(2); @@ -488,14 +479,10 @@ Bool_t CbmMcbmSpillFindAlgo::CreateHistograms() return kTRUE; } -Bool_t CbmMcbmSpillFindAlgo::FillHistograms() -{ - - return kTRUE; -} +Bool_t CbmMcbmSpillFindAlgo::FillHistograms() { return kTRUE; } Bool_t CbmMcbmSpillFindAlgo::ResetHistograms(Bool_t bResetTime) { - fuCurrentSpillIdx = 0; + fuCurrentSpillIdx = 0; fhHitsEvo->Reset(); fhHitsPerSpill->Reset(); fhSpillBreakDuration->Reset(); diff --git a/fles/mcbm2018/tasks/CbmMcbmSpillFindAlgo.h b/fles/mcbm2018/tasks/CbmMcbmSpillFindAlgo.h index 21dcbca9bb12f5baa229c351e01b7309ebad7521..f056431e52ddc328b468bd59731dd8ef236eb718 100644 --- a/fles/mcbm2018/tasks/CbmMcbmSpillFindAlgo.h +++ b/fles/mcbm2018/tasks/CbmMcbmSpillFindAlgo.h @@ -88,9 +88,9 @@ private: UInt_t fuNrOfChannelsPerGdpb = 0; //! Number of channels per GDPB /// User settings: Data correction parameters - UInt_t fuMinTotPulser = 90; - UInt_t fuMaxTotPulser = 100; - UInt_t fuOffSpillCountLimit = 100; + UInt_t fuMinTotPulser = 90; + UInt_t fuMaxTotPulser = 100; + UInt_t fuOffSpillCountLimit = 100; Double_t fdSpillCheckInterval = 0.5; /// Constants @@ -100,7 +100,7 @@ private: /// Running indices /// TS/MS info - ULong64_t fulFirstTsIdx = 9999999999999; //! First TS index, forward point set ~30 years... + ULong64_t fulFirstTsIdx = 9999999999999; //! First TS index, forward point set ~30 years... ULong64_t fulCurrentTsIdx = 0; ULong64_t fulCurrentMsIdx = 0; Double_t fdTsStartTime = -1.0; //! Time in ns of current TS from the index of the first MS first component @@ -115,25 +115,26 @@ private: UInt_t fuCurrDpbIdx = 0; //! Index of the DPB from which the MS currently unpacked is coming Int_t fiRunStartDateTimeSec = -1; //! Start of run time since "epoch" in s, for the plots with date as X axis Int_t fiBinSizeDatePlots = -1; //! Bin size in s for the plots with date as X axis - UInt_t fuGet4Id = 0; //! running number (0 to fuNrOfGet4PerGdpb) of the Get4 chip of a unique GDPB for current message + UInt_t fuGet4Id = + 0; //! running number (0 to fuNrOfGet4PerGdpb) of the Get4 chip of a unique GDPB for current message UInt_t fuGet4Nr = 0; //! running number (0 to fuNrOfGet4) of the Get4 chip in the system for current message /// Starting state book-keeping - Double_t fdStartTime = -1.0; //! Time of first valid hit (epoch available), used as reference for evolution plots - Double_t fdStartTimeMsSz = 0.0; //! Time of first microslice, used as reference for evolution plots + Double_t fdStartTime = -1.0; //! Time of first valid hit (epoch available), used as reference for evolution plots + Double_t fdStartTimeMsSz = 0.0; //! Time of first microslice, used as reference for evolution plots std::chrono::steady_clock::time_point ftStartTimeUnix = std::chrono::steady_clock:: - now(); //! Time of run Start from UNIX system, used as reference for long evolution plots against reception time + now(); //! Time of run Start from UNIX system, used as reference for long evolution plots against reception time /// Spill detection - Bool_t fbSpillOn = kTRUE; - UInt_t fuCurrentSpillIdx = 0; - Double_t fdStartTimeSpill = -1.0; - Double_t fdLastSecondTime = -1.0; - UInt_t fuCountsLastInterval = 0; - UInt_t fuCountsLastSpill = 0; - std::vector< ULong64_t > fvuSpillBreakBegTs = {}; - std::vector< ULong64_t > fvuSpillBreakEndTs = {}; - std::vector< ULong64_t > fvuSpillBreakMidTs = {}; + Bool_t fbSpillOn = kTRUE; + UInt_t fuCurrentSpillIdx = 0; + Double_t fdStartTimeSpill = -1.0; + Double_t fdLastSecondTime = -1.0; + UInt_t fuCountsLastInterval = 0; + UInt_t fuCountsLastSpill = 0; + std::vector<ULong64_t> fvuSpillBreakBegTs = {}; + std::vector<ULong64_t> fvuSpillBreakEndTs = {}; + std::vector<ULong64_t> fvuSpillBreakMidTs = {}; /// Histograms related variables UInt_t fuHistoryHistoSize = 3600; /** Size in seconds of the evolution histograms **/ diff --git a/macro/beamtime/mcbm2020/find_spills.C b/macro/beamtime/mcbm2020/find_spills.C index 388fce1e95796cbe1bc60b805e8155b58ec5193e..64d4b952b885fb7f2b00d950802f652019b9122d 100644 --- a/macro/beamtime/mcbm2020/find_spills.C +++ b/macro/beamtime/mcbm2020/find_spills.C @@ -7,12 +7,8 @@ // In order to call later Finish, we make this global FairRunOnline* run = NULL; -Bool_t find_spills(TString inFile = "", - UInt_t uRunId = 0, - TString sOutDir = "data", - TString sHostname = "localhost", - Int_t iServerHttpPort = 8080, - Int_t iServerRefreshRate = 100) +Bool_t find_spills(TString inFile = "", UInt_t uRunId = 0, TString sOutDir = "data", TString sHostname = "localhost", + Int_t iServerHttpPort = 8080, Int_t iServerRefreshRate = 100) { TString srcDir = gSystem->Getenv("VMCWORKDIR"); @@ -49,18 +45,15 @@ Bool_t find_spills(TString inFile = "", CbmMcbmSpillFindTask* spill_finder_t0 = new CbmMcbmSpillFindTask(); spill_finder_t0->SetIgnoreOverlapMs(); - if (0 < uRunId) - spill_finder_t0->SetHistoFilename( Form("data/HistosSpillFinder_%03u.root", uRunId)); - spill_finder_t0->SetPulserTotLimits(180, 210); // for runs > 86 - spill_finder_t0->SetSpillCheckIntervalSec( 0.05 ); // ~every 4 TS - spill_finder_t0->SetSpillThreshold( 40 ); // ~10 hits per TS + if (0 < uRunId) spill_finder_t0->SetHistoFilename(Form("data/HistosSpillFinder_%03u.root", uRunId)); + spill_finder_t0->SetPulserTotLimits(180, 210); // for runs > 86 + spill_finder_t0->SetSpillCheckIntervalSec(0.05); // ~every 4 TS + spill_finder_t0->SetSpillThreshold(40); // ~10 hits per TS // --- Source task CbmMcbm2018Source* source = new CbmMcbm2018Source(); - if ("" != inFile) { - source->SetFileName(inFile); - } // if( "" != inFile ) + if ("" != inFile) { source->SetFileName(inFile); } // if( "" != inFile ) else { source->SetHostName(sHostname); } // else of if( "" != inFile ) @@ -98,16 +91,14 @@ Bool_t find_spills(TString inFile = "", timer.Stop(); - std::cout << "Processed " << std::dec << source->GetTsCount() << " timeslices" - << std::endl; + std::cout << "Processed " << std::dec << source->GetTsCount() << " timeslices" << std::endl; // --- End-of-run info Double_t rtime = timer.RealTime(); Double_t ctime = timer.CpuTime(); std::cout << std::endl << std::endl; std::cout << ">>> SpillFinder: Macro finished successfully." << std::endl; - std::cout << ">>> SpillFinder: Real time " << rtime << " s, CPU time " << ctime - << " s" << std::endl; + std::cout << ">>> SpillFinder: Real time " << rtime << " s, CPU time " << ctime << " s" << std::endl; std::cout << std::endl; /// --- Screen output for automatic tests diff --git a/macro/beamtime/mcbm2020/mcbm_tof_tracking_kronos.C b/macro/beamtime/mcbm2020/mcbm_tof_tracking_kronos.C index 8f81e6d4c116edafc87b4371139e6d24a6be01cb..846216de0d1487aa8a6d5cfbe6208dde1ddbc12d 100644 --- a/macro/beamtime/mcbm2020/mcbm_tof_tracking_kronos.C +++ b/macro/beamtime/mcbm2020/mcbm_tof_tracking_kronos.C @@ -54,5 +54,6 @@ Bool_t mcbm_tof_tracking_kronos(UInt_t uRunIdx = 28, if (uRunId < 692 && 0 != uRunId) return kFALSE; - return mcbm_tof_tracking(uRunId, bEventWin, iTrackMode, iCalOpt, nTimeslices, sInpDir, sOutDir, cCalId, iUnpFileIndex); + return mcbm_tof_tracking(uRunId, bEventWin, iTrackMode, iCalOpt, nTimeslices, sInpDir, sOutDir, cCalId, + iUnpFileIndex); } diff --git a/macro/beamtime/mcbm2020/unpack_tsa_mcbm.C b/macro/beamtime/mcbm2020/unpack_tsa_mcbm.C index 0a8e4b6f6a788a37c5649e50c739622612515577..0be424de00f88c9f00f66d6b36f66b6141cf67bb 100644 --- a/macro/beamtime/mcbm2020/unpack_tsa_mcbm.C +++ b/macro/beamtime/mcbm2020/unpack_tsa_mcbm.C @@ -29,11 +29,10 @@ Bool_t unpack_tsa_mcbm(TString inFile = "", TString runId = TString::Format("%03u", uRunId); TString outFile = sOutDir + "/unp_mcbm_" + runId; TString parFile = sOutDir + "/unp_mcbm_params_" + runId; - if( 0 <= iSpillIndex ) - { - outFile += TString::Format("_%02i", iSpillIndex); - parFile += TString::Format("_%02i", iSpillIndex); - } // if( 0 <= iSpillIndex ) + if (0 <= iSpillIndex) { + outFile += TString::Format("_%02i", iSpillIndex); + parFile += TString::Format("_%02i", iSpillIndex); + } // if( 0 <= iSpillIndex ) outFile += ".root"; parFile += ".root"; @@ -611,26 +610,33 @@ Bool_t unpack_tsa_mcbm(TString inFile = "", source->AddUnpacker(unpacker_psd, 0x80, ECbmModuleId::kPsd); // PSD source->UnpackSelectSpills(iSpillIndex * iSpillnumber, iSpillIndex * iSpillnumber + iSpillnumber - 1, uSpillLimType); + /// Disable clang formatting around vectors initialization by lists + /* clang-format off */ switch (uRunId) { case 831: { - source->LoadTsListSpillBreakBegin( - std::vector< ULong64_t >( { 1, 933, 1941, 2949, 4349, 5357, 6365, 7373, 8773, 9781, 10789, 11801, - 13197, 14209, 15217, 16225, 17625, 18633, 19645, 20653, 22053, 23061, 24069, 25077, - 26473, 27481, 28493, 29501, 30897, 31905, 32913, 33921, 35321, 36329, 37337, 38345, - 39745, 40753, 41761, 42769, 44169, 45177, 46185, 47193, 48593 } )); - source->LoadTsListSpillBreakMiddle( - std::vector< ULong64_t >( { 111, 1081, 2087, 3299, 4495, 5503, 6513, 7721, 8921, 9927, 10935, 12149, - 13347, 14355, 15363, 16573, 17773, 18781, 19791, 21001, 22199, 23209, 24215, 25423, - 26619, 27629, 28637, 29847, 31045, 32051, 33059, 34275, 35469, 36475, 37483, 38693, - 39889, 40899, 41907, 43117, 44315, 45323, 46333, 47543, 48689 } )); - source->LoadTsListSpillBreakEnd( - std::vector< ULong64_t >( { 221, 1229, 2233, 3649, 4641, 5649, 6661, 8069, 9069, 10073, 11081, 12497, - 13497, 14501, 15509, 16921, 17921, 18929, 19937, 21349, 22345, 23357, 24361, 25769, - 26765, 27777, 28781, 30193, 31193, 32197, 33205, 34629, 35617, 36621, 37629, 39041, - 40033, 41045, 42053, 43465, 44461, 45469, 46481, 47893, 48786 } )); + source->LoadTsListSpillBreakBegin(std::vector<ULong64_t>( + { 1, 933, 1941, 2949, 4349, 5357, 6365, 7373, 8773, 9781, + 10789, 11801, 13197, 14209, 15217, 16225, 17625, 18633, 19645, 20653, + 22053, 23061, 24069, 25077, 26473, 27481, 28493, 29501, 30897, 31905, + 32913, 33921, 35321, 36329, 37337, 38345, 39745, 40753, 41761, 42769, + 44169, 45177, 46185, 47193, 48593})); + source->LoadTsListSpillBreakMiddle(std::vector<ULong64_t>( + { 111, 1081, 2087, 3299, 4495, 5503, 6513, 7721, 8921, 9927, + 10935, 12149, 13347, 14355, 15363, 16573, 17773, 18781, 19791, 21001, + 22199, 23209, 24215, 25423, 26619, 27629, 28637, 29847, 31045, 32051, + 33059, 34275, 35469, 36475, 37483, 38693, 39889, 40899, 41907, 43117, + 44315, 45323, 46333, 47543, 48689})); + source->LoadTsListSpillBreakEnd(std::vector<ULong64_t>( + { 221, 1229, 2233, 3649, 4641, 5649, 6661, 8069, 9069, 10073, + 11081, 12497, 13497, 14501, 15509, 16921, 17921, 18929, 19937, 21349, + 22345, 23357, 24361, 25769, 26765, 27777, 28781, 30193, 31193, 32197, + 33205, 34629, 35617, 36621, 37629, 39041, 40033, 41045, 42053, 43465, + 44461, 45469, 46481, 47893, 48786})); break; - } // case 831 - } // switch (uRunId) + } // case 831 + } // switch (uRunId) + /// Re-enable clang formatting after vectors initialization by lists + /* clang-format on */ // --- Event header FairEventHeader* event = new FairEventHeader();