Commit 2735e67c authored by Pierre-Alain Loizeau's avatar Pierre-Alain Loizeau Committed by Volker Friese
Browse files

STS Unpacker: add pulser flag and save pulser digis to opt. vector

parent c3003643
......@@ -33,6 +33,7 @@ CbmMcbm2018StsPar::CbmMcbm2018StsPar(const char* name, const char* title, const
, fuNrOfDpbs(0)
, fiDbpIdArray()
, fiCrobActiveFlag()
, fiFebPulserFlag()
, fiFebModuleIdx()
, fiFebModuleSide()
, fdFebAdcGain()
......@@ -73,6 +74,7 @@ void CbmMcbm2018StsPar::putParams(FairParamList* l)
l->add("DbpIdArray", fiDbpIdArray);
l->add("CrobActiveFlag", fiCrobActiveFlag);
l->add("FebPulserFlag", fiFebPulserFlag);
l->add("FebModuleIdx", fiFebModuleIdx);
l->add("FebModuleSide", fiFebModuleSide);
l->add("FebAdcGain", fdFebAdcGain);
......@@ -107,12 +109,14 @@ Bool_t CbmMcbm2018StsPar::getParams(FairParamList* l)
fiCrobActiveFlag.Set(fuNrOfDpbs * kuNbCrobsPerDpb);
if (!l->fill("CrobActiveFlag", &fiCrobActiveFlag)) return kFALSE;
fiFebPulserFlag.Set(fuNrOfDpbs * kuNbCrobsPerDpb * kuNbFebsPerCrob);
fiFebModuleIdx.Set(fuNrOfDpbs * kuNbCrobsPerDpb * kuNbFebsPerCrob);
fiFebModuleSide.Set(fuNrOfDpbs * kuNbCrobsPerDpb * kuNbFebsPerCrob);
fdFebAdcGain.Set(fuNrOfDpbs * kuNbCrobsPerDpb * kuNbFebsPerCrob);
fdFebAdcBase.Set(fuNrOfDpbs * kuNbCrobsPerDpb * kuNbFebsPerCrob);
fdFebAdcThrGain.Set(fuNrOfDpbs * kuNbCrobsPerDpb * kuNbFebsPerCrob);
fiFebAdcThrOffs.Set(fuNrOfDpbs * kuNbCrobsPerDpb * kuNbFebsPerCrob);
if (!l->fill("FebPulserFlag", &fiFebPulserFlag)) return kFALSE;
if (!l->fill("FebModuleIdx", &fiFebModuleIdx)) return kFALSE;
if (!l->fill("FebModuleSide", &fiFebModuleSide)) return kFALSE;
if (!l->fill("FebAdcGain", &fdFebAdcGain)) return kFALSE;
......@@ -228,7 +232,6 @@ Bool_t CbmMcbm2018StsPar::IsCrobActive(UInt_t uDpbIdx, UInt_t uCrobIdx)
}
Bool_t CbmMcbm2018StsPar::IsFebActive(UInt_t uFebInSystIdx)
{
if (uFebInSystIdx < GetNrOfFebs()) {
return (-1 == fiFebModuleIdx[uFebInSystIdx] ? kFALSE : kTRUE);
} // if( uFebInSystIdx < GetNrOfFebs() )
......@@ -264,6 +267,43 @@ Bool_t CbmMcbm2018StsPar::IsFebActive(UInt_t uDpbIdx, UInt_t uCrobIdx, UInt_t uF
return kFALSE;
} // else of if( uDpbIdx < fuNrOfDpbs )
}
Bool_t CbmMcbm2018StsPar::IsFebPulser(UInt_t uFebInSystIdx)
{
if (uFebInSystIdx < GetNrOfFebs()) {
return (fiFebPulserFlag[uFebInSystIdx] ? kTRUE : kFALSE);
} // if( uFebInSystIdx < GetNrOfFebs() )
else {
LOG(warning) << "CbmMcbm2018StsPar::IsFebPulser => Feb Index out of bound, "
<< "returning default standard FEB!";
return kFALSE;
} // else of if( uFebInSystIdx < GetNrOfFebs() )
}
Bool_t CbmMcbm2018StsPar::IsFebPulser(UInt_t uDpbIdx, UInt_t uCrobIdx, UInt_t uFebIdx)
{
if (uDpbIdx < fuNrOfDpbs) {
if (uCrobIdx < kuNbCrobsPerDpb) {
if (uFebIdx < kuNbFebsPerCrob) {
UInt_t uIdx = (uDpbIdx * kuNbCrobsPerDpb + uCrobIdx) * kuNbFebsPerCrob + uFebIdx;
return IsFebPulser(uIdx);
} // if( uFebIdx < kuNbFebsPerCrob )
else {
LOG(warning) << "CbmMcbm2018StsPar::IsFebPulser => Feb Index out of bound, "
<< "returning default standard FEB!";
return kFALSE;
} // else of if( uFebIdx < kuNbCrobsPerDpb )
} // if( uCrobIdx < kuNbCrobsPerDpb )
else {
LOG(warning) << "CbmMcbm2018StsPar::IsFebPulser => Crob Index out of bound, "
<< "returning default standard FEB!";
return kFALSE;
} // else of if( uCrobIdx < kuNbCrobsPerDpb )
} // if( uDpbIdx < fuNrOfDpbs )
else {
LOG(warning) << "CbmMcbm2018StsPar::IsFebPulser => Dpb Index out of bound, "
<< "returning default standard FEB!";
return kFALSE;
} // else of if( uDpbIdx < fuNrOfDpbs )
}
Int_t CbmMcbm2018StsPar::GetFebModuleIdx(UInt_t uDpbIdx, UInt_t uCrobIdx, UInt_t uFebIdx)
{
if (uDpbIdx < fuNrOfDpbs) {
......
......@@ -82,6 +82,8 @@ public:
Bool_t IsCrobActive(UInt_t uDpbIdx, UInt_t uCrobIdx);
Bool_t IsFebActive(UInt_t uFebInSystIdx);
Bool_t IsFebActive(UInt_t uDpbIdx, UInt_t uCrobIdx, UInt_t uFebIdx);
Bool_t IsFebPulser(UInt_t uFebInSystIdx);
Bool_t IsFebPulser(UInt_t uDpbIdx, UInt_t uCrobIdx, UInt_t uFebIdx);
Int_t GetFebModuleIdx(UInt_t uDpbIdx, UInt_t uCrobIdx, UInt_t uFebIdx);
Int_t GetFebModuleSide(UInt_t uDpbIdx, UInt_t uCrobIdx, UInt_t uFebIdx);
Double_t GetFebAdcGain(UInt_t uDpbIdx, UInt_t uCrobIdx, UInt_t uFebIdx);
......@@ -138,6 +140,8 @@ private:
UInt_t fuNrOfDpbs; // Total number of STS DPBs in system
TArrayI fiDbpIdArray; // Array to hold the unique IDs (equipment ID) for all STS DPBs
TArrayI fiCrobActiveFlag; // Array to hold the active flag for all CROBs, [ NbDpb * kuNbCrobPerDpb ]
TArrayI
fiFebPulserFlag; // Array to hold the pulser flag for all FEBs, [ NbDpb * kuNbCrobPerDpb * kuNbFebsPerCrob ], 1 if pulser, 0 if standard
TArrayI
fiFebModuleIdx; // Index of the STS module for each FEB, [ NbDpb * kuNbCrobPerDpb * kuNbFebsPerCrob ], -1 if inactive
TArrayI
......@@ -148,6 +152,6 @@ private:
TArrayI
fiFebAdcThrOffs; // Thr. offset in Units vs Cal. Thr. for each FEB, [ NbDpb * kuNbCrobPerDpb * kuNbFebsPerCrob ]
ClassDef(CbmMcbm2018StsPar, 1);
ClassDef(CbmMcbm2018StsPar, 2);
};
#endif // CBMMCBM2018STSPAR_H
......@@ -198,6 +198,8 @@ Bool_t CbmMcbm2018UnpackerAlgoSts::InitParameters()
for (UInt_t uFebIdx = 0; uFebIdx < fUnpackPar->GetNbFebsPerCrob(); ++uFebIdx) {
fviFebModuleIdx[uDpb][uCrobIdx][uFebIdx] = fUnpackPar->GetFebModuleIdx(uDpb, uCrobIdx, uFebIdx);
fviFebModuleSide[uDpb][uCrobIdx][uFebIdx] = fUnpackPar->GetFebModuleSide(uDpb, uCrobIdx, uFebIdx);
fvbFebPulser.push_back(fUnpackPar->IsFebPulser(uDpb, uCrobIdx, uFebIdx));
fvdFebAdcGain.push_back(fUnpackPar->GetFebAdcGain(uDpb, uCrobIdx, uFebIdx));
fvdFebAdcOffs.push_back(fUnpackPar->GetFebAdcOffset(uDpb, uCrobIdx, uFebIdx));
......@@ -407,7 +409,14 @@ Bool_t CbmMcbm2018UnpackerAlgoSts::ProcessTs(const fles::Timeslice& ts)
fviFebSide[uFebIdx]);
} // if( 0 == fviFebAddress[ uFebIdx ] || -1 == fviFebSide[ uFebIdx ] )
fDigiVect.emplace_back(fviFebAddress[uFebIdx], uChanInMod, ulTimeInNs, dCalAdc);
/// Catch the pulser digis and either save them to their own output or drop them
if (fbPulserOutput && fvbFebPulser[uFebIdx]) {
fPulserDigiVect.emplace_back(CbmStsDigi(fviFebAddress[uFebIdx], uChanInMod, ulTimeInNs, dCalAdc));
} // if (fvbFebPulser[uFebIdx])
else {
fDigiVect.emplace_back(fviFebAddress[uFebIdx], uChanInMod, ulTimeInNs, dCalAdc);
} // else of if (fvbFebPulser[uFebIdx])
} // for( auto itHitIn = fvmHitsInMs.begin(); itHitIn < fvmHitsInMs.end(); ++itHitIn )
/// Clear the buffer of hits
......@@ -427,6 +436,12 @@ Bool_t CbmMcbm2018UnpackerAlgoSts::ProcessTs(const fles::Timeslice& ts)
std::sort(fDigiVect.begin(), fDigiVect.end(),
[](const CbmStsDigi& a, const CbmStsDigi& b) -> bool { return a.GetTime() < b.GetTime(); });
/// Sort the buffers of pulser hits due to the time offsets applied
if (fbPulserOutput) {
std::sort(fPulserDigiVect.begin(), fPulserDigiVect.end(),
[](const CbmStsDigi& a, const CbmStsDigi& b) -> bool { return a.GetTime() < b.GetTime(); });
}
/// Fill plots if in monitor mode
if (fbMonitorMode) {
if (kFALSE == FillHistograms()) {
......@@ -1216,6 +1231,11 @@ Bool_t CbmMcbm2018UnpackerAlgoSts::FillHistograms()
for (auto itHit = fDigiVect.begin(); itHit != fDigiVect.end(); ++itHit) {
fhDigisTimeInRun->Fill(itHit->GetTime() * 1e-9);
} // for( auto itHit = fDigiVect.begin(); itHit != fDigiVect.end(); ++itHit)
if (fbPulserOutput) {
for (auto itHit = fPulserDigiVect.begin(); itHit != fPulserDigiVect.end(); ++itHit) {
fhDigisTimeInRun->Fill(itHit->GetTime() * 1e-9);
} // for( auto itHit = fPulserDigiVect.begin(); itHit != fPulserDigiVect.end(); ++itHit)
}
return kTRUE;
}
Bool_t CbmMcbm2018UnpackerAlgoSts::ResetHistograms()
......
......@@ -54,6 +54,9 @@ public:
Bool_t InitParameters();
std::vector<CbmStsDigi>& GetPulserVector() { return fPulserDigiVect; }
void ClearPulserVector() { fPulserDigiVect.clear(); }
Bool_t ProcessTs(const fles::Timeslice& ts);
Bool_t ProcessTs(const fles::Timeslice& ts, size_t /*component*/) { return ProcessTs(ts); }
Bool_t ProcessMs(const fles::Timeslice& ts, size_t uMsCompIdx, size_t uMsIdx);
......@@ -75,6 +78,8 @@ public:
inline void SetVectCapInc(Double_t dIncFact) { fdCapacityIncFactor = dIncFact; }
void SeparatePulserOutput(Bool_t bFlagIn) { fbPulserOutput = bFlagIn; }
private:
/// Control flags
Bool_t fbMonitorMode; //! Switch ON the filling of a minimal set of histograms
......@@ -82,6 +87,7 @@ private:
std::vector<Bool_t> fvbMaskedComponents;
/// => Quick and dirty hack for binning FW!!!
Bool_t fbBinningFw = kFALSE;
Bool_t fbPulserOutput = kTRUE; //! If ON a separate output vector of digi is used for the pulser
/// Settings from parameter file
CbmMcbm2018StsPar* fUnpackPar; //!
......@@ -102,6 +108,7 @@ private:
fviFebModuleSide; //! STS module side for each FEB, [ NbDpb ][ NbCrobPerDpb ][ NbFebsPerCrob ], 0 = P, 1 = N, -1 if inactive
std::vector<std::vector<std::vector<Int_t>>>
fviFebType; //! FEB type, [ NbDpb ][ NbCrobPerDpb ][ NbFebsPerCrob ], 0 = A, 1 = B, -1 if inactive
std::vector<bool> fvbFebPulser = {}; //! Pulser flag for each FEB, [ NbDpb * NbCrobPerDpb * NbFebsPerCrob ]
std::vector<Int_t> fviFebAddress; //! STS address for each FEB, [ NbDpb * NbCrobPerDpb * NbFebsPerCrob ]
std::vector<Int_t> fviFebSide; //! Module side for each FEB, [ NbDpb * NbCrobPerDpb * NbFebsPerCrob ]
std::vector<Double_t> fvdFebAdcGain; //! ADC gain in e-/b, [ NbDpb * NbCrobPerDpb * NbFebsPerCrob ]
......@@ -146,6 +153,9 @@ private:
std::vector<stsxyter::FinalHit>
fvmHitsInMs; //! All hits (time in bins, ADC in bins, asic, channel) in last MS, sorted with "<" operator
/// Pulser Digis output, needed as STS reco does not accept Digis without a valid STS address
std::vector<CbmStsDigi> fPulserDigiVect = {};
/// Duplicate hits suppression
static const UInt_t kuMaxTsMsbDiffDuplicates = 8;
std::vector<std::vector<UShort_t>> fvvusLastTsChan; //! TS of last hit message for each channel, [ AsicIdx ][ Chan ]
......
......@@ -67,6 +67,12 @@ Bool_t CbmMcbm2018UnpackerTaskSts::Init()
fpvDigiSts = &(fUnpackerAlgo->GetVector());
ioman->RegisterAny("StsDigi", fpvDigiSts, fbWriteOutput);
if (fbPulserOutput) {
/// Get address of pulser vector from algo
fpvPulserDigiSts = &(fUnpackerAlgo->GetPulserVector());
ioman->RegisterAny("StsDigiPulser", fpvPulserDigiSts, fbWriteOutput);
}
/// Get address of error vector from algo
fpvErrorSts = &(fUnpackerAlgo->GetErrorVector());
ioman->RegisterAny("CbmStsError", fpvErrorSts, fbWriteOutput);
......@@ -194,6 +200,7 @@ void CbmMcbm2018UnpackerTaskSts::Reset()
{
fUnpackerAlgo->ClearVector();
fUnpackerAlgo->ClearErrorVector();
if (fbPulserOutput) { fUnpackerAlgo->ClearPulserVector(); }
}
void CbmMcbm2018UnpackerTaskSts::Finish()
......@@ -252,5 +259,10 @@ void CbmMcbm2018UnpackerTaskSts::SetAdcCut(UInt_t uAdc) { fUnpackerAlgo->SetAdcC
void CbmMcbm2018UnpackerTaskSts::SetBinningFwFlag(Bool_t bEnable) { fUnpackerAlgo->SetBinningFwFlag(bEnable); }
void CbmMcbm2018UnpackerTaskSts::SeparatePulserOutput(Bool_t bFlagIn)
{
fbPulserOutput = bFlagIn;
fUnpackerAlgo->SeparatePulserOutput(fbPulserOutput);
}
ClassImp(CbmMcbm2018UnpackerTaskSts)
......@@ -65,12 +65,14 @@ public:
/// Task settings
void SetWriteOutputFlag(Bool_t bFlagIn) { fbWriteOutput = bFlagIn; }
void SeparatePulserOutput(Bool_t bFlagIn);
private:
/// Control flags
Bool_t fbMonitorMode; //! Switch ON the filling of a minimal set of histograms
Bool_t fbDebugMonitorMode; //! Switch ON the filling of a additional set of histograms
Bool_t fbWriteOutput; //! If ON the output TClonesArray of digi is written to disk
Bool_t fbMonitorMode; //! Switch ON the filling of a minimal set of histograms
Bool_t fbDebugMonitorMode; //! Switch ON the filling of a additional set of histograms
Bool_t fbWriteOutput; //! If ON the output TClonesArray of digi is written to disk
Bool_t fbPulserOutput = kTRUE; //! If ON a separate output vector of digi is used for the pulser
/// Temporary storage of user parameters
std::vector<FebChanMask> fvChanMasks;
......@@ -80,6 +82,7 @@ private:
/// Output vectors
std::vector<CbmStsDigi>* fpvDigiSts = nullptr;
std::vector<CbmStsDigi>* fpvPulserDigiSts = nullptr;
std::vector<CbmErrorMessage>* fpvErrorSts = nullptr;
/// Processing algo
......
......@@ -26,6 +26,7 @@ GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/beamtime/mcbm2019/MonitorM
GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/beamtime/mcbm2019/MonitorTof.C ) # CbmMcbm2018MonitorTaskTof + CbmMcbm2018MonitorAlgoTof
GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/beamtime/mcbm2019/MonitorRich.C ) # CbmMcbm2018UnpackerTaskRich.h in monitor mode
GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/beamtime/mcbm2019/MonitorPsd.C ) # CbmMcbm2018MonitorTaskPsd + CbmMcbm2018MonitorAlgoPsd
GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/beamtime/mcbm2019/unpack_pulser_mcbm.C ) # Unpackers + Pulser check
## Define tests + dependencies
Set(testname mcbm_convert_2019)
......@@ -69,19 +70,19 @@ Set_Tests_Properties(${testname} PROPERTIES PASS_REGULAR_EXPRESSION "Test Passed
set_tests_properties(${testname} PROPERTIES FIXTURES_REQUIRED ${fixture_unpacked})
set_tests_properties(${testname} PROPERTIES DEPENDS mcbm_check_stsdigis_2019)
Set(testname mcbm_check_pulser_2019)
Add_Test(${testname} ${CBMROOT_BINARY_DIR}/macro/beamtime/mcbm2019/check_pulser.sh 399 )
Set_Tests_Properties(${testname} PROPERTIES TIMEOUT "600")
Set_Tests_Properties(${testname} PROPERTIES PASS_REGULAR_EXPRESSION "Test Passed;All ok")
set_tests_properties(${testname} PROPERTIES FIXTURES_REQUIRED ${fixture_unpacked})
set_tests_properties(${testname} PROPERTIES DEPENDS mcbm_check_muchdigis_2019)
#Set(testname mcbm_check_pulser_2019)
#Add_Test(${testname} ${CBMROOT_BINARY_DIR}/macro/beamtime/mcbm2019/check_pulser.sh 399 )
#Set_Tests_Properties(${testname} PROPERTIES TIMEOUT "600")
#Set_Tests_Properties(${testname} PROPERTIES PASS_REGULAR_EXPRESSION "Test Passed;All ok")
#set_tests_properties(${testname} PROPERTIES FIXTURES_REQUIRED ${fixture_unpacked})
#set_tests_properties(${testname} PROPERTIES DEPENDS mcbm_check_muchdigis_2019)
Set(testname mcbm_build_event_2019)
Add_Test(${testname} ${CBMROOT_BINARY_DIR}/macro/beamtime/mcbm2019/build_events.sh \"data/unp_mcbm_399.root\" 399 )
Set_Tests_Properties(${testname} PROPERTIES TIMEOUT "600")
Set_Tests_Properties(${testname} PROPERTIES PASS_REGULAR_EXPRESSION "Test Passed;All ok")
set_tests_properties(${testname} PROPERTIES FIXTURES_REQUIRED ${fixture_unpacked})
set_tests_properties(${testname} PROPERTIES DEPENDS mcbm_check_pulser_2019)
set_tests_properties(${testname} PROPERTIES DEPENDS mcbm_check_muchdigis_2019)
Set(fixture_built_evt fixture_done_${testname})
set_tests_properties(${testname} PROPERTIES FIXTURES_SETUP ${fixture_built_evt})
......@@ -128,4 +129,10 @@ Set_Tests_Properties(${testname} PROPERTIES TIMEOUT "600")
Set_Tests_Properties(${testname} PROPERTIES PASS_REGULAR_EXPRESSION "Test Passed;All ok")
set_tests_properties(${testname} PROPERTIES DEPENDS mcbm_monirich_2019)
### Unpack + pulser check, needed as STS unpacker now needs a special flag to store the pulser digis in the standard out
Set(testname mcbm_unpack_pulser_2019)
Add_Test(${testname} ${CBMROOT_BINARY_DIR}/macro/beamtime/mcbm2019/unpack_pulser_mcbm.sh \"${CBMROOT_SOURCE_DIR}/input/mcbm_run399_first20Ts.tsa\" 399 )
Set_Tests_Properties(${testname} PROPERTIES TIMEOUT "600")
Set_Tests_Properties(${testname} PROPERTIES PASS_REGULAR_EXPRESSION "Test Passed;All ok")
set_tests_properties(${testname} PROPERTIES DEPENDS mcbm_monipsd_2019)
#####################
......@@ -59,6 +59,7 @@ void check_pulser(UInt_t uRunId = 0, Int_t nrEvents = 0, TString sDir = "data")
pulserChecker->SetRichOffsetSearchRange(1000);
pulserChecker->SetPsdOffsetSearchRange(5000);
if (0 < uRunId) pulserChecker->SetOutFilename(Form("data/HistosPulserCheck_%03u.root", uRunId));
pulserChecker->SetStsAddress(0x11E004E2);
fRun->AddTask(pulserChecker);
// ----- Parameter database --------------------------------------------
......
......@@ -14,11 +14,9 @@
// In order to call later Finish, we make this global
FairRunOnline* run = NULL;
void unpack_pulser_mcbm(UInt_t uRunId = 0, TString sHostname = "localhost", UInt_t nrEvents = 0,
TString outDir = "data", Int_t iServerRefreshRate = 100, Int_t iServerHttpPort = 8080)
void unpack_pulser_mcbm(TString inFile = "", UInt_t uRunId = 0, UInt_t nrEvents = 0, TString outDir = "data",
TString inDir = "")
{
if (uRunId < 353 && 0 != uRunId) return kFALSE;
TString srcDir = gSystem->Getenv("VMCWORKDIR");
// --- Specify number of events to be produced.
......@@ -26,8 +24,8 @@ void unpack_pulser_mcbm(UInt_t uRunId = 0, TString sHostname = "localhost", UInt
Int_t nEvents = -1;
// --- Specify output file name (this is just an example)
TString runId = TString::Format("%03u", uRunId);
TString outFile = outDir + "/unp_mcbm_" + runId + ".root";
TString parFile = outDir + "/unp_mcbm_params_" + runId + ".root";
TString outFile = outDir + "/unp_pulser_" + runId + ".root";
TString parFile = outDir + "/unp_pulser_params_" + runId + ".root";
// --- Set log output levels
FairLogger::GetLogger();
......@@ -44,7 +42,11 @@ void unpack_pulser_mcbm(UInt_t uRunId = 0, TString sHostname = "localhost", UInt
TObjString* parStsFileName = new TObjString(paramFileSts);
parFileList->Add(parStsFileName);
TString paramFileMuch = paramDir + "mMuchPar.par";
TString paramFileMuch = paramDir + "mMuchPar.par";
/// Special parameter files for runs 353-374 (November19) and 380-408 (December19)
if (uRunId >= 353 && uRunId <= 374) paramFileMuch = paramDir + "mMuchPar_Nov19.par";
else if (374 < uRunId)
paramFileMuch = paramDir + "mMuchPar_Dec19.par";
TObjString* parMuchFileName = new TObjString(paramFileMuch);
parFileList->Add(parMuchFileName);
......@@ -75,11 +77,11 @@ void unpack_pulser_mcbm(UInt_t uRunId = 0, TString sHostname = "localhost", UInt
std::cout << std::endl;
std::cout << ">>> unpack_tsa: Initialising..." << std::endl;
CbmMcbm2018UnpackerTaskSts* unpacker_sts = new CbmMcbm2018UnpackerTaskSts();
CbmMcbm2018UnpackerTaskMuch* unpacker_much = new CbmMcbm2018UnpackerTaskMuch();
CbmMcbm2018UnpackerTaskTof* unpacker_tof = new CbmMcbm2018UnpackerTaskTof();
CbmMcbm2018UnpackerTaskRich* unpacker_rich = new CbmMcbm2018UnpackerTaskRich();
CbmMcbm2018UnpackerTaskPsd* unpacker_psd = new CbmMcbm2018UnpackerTaskPsd();
CbmMcbm2018UnpackerTaskSts* unpacker_sts = new CbmMcbm2018UnpackerTaskSts();
CbmMcbm2018UnpackerTaskMuch* unpacker_much = new CbmMcbm2018UnpackerTaskMuch();
CbmMcbm2018UnpackerTaskTof* unpacker_tof = new CbmMcbm2018UnpackerTaskTof();
CbmMcbm2018UnpackerTaskRich2020* unpacker_rich = new CbmMcbm2018UnpackerTaskRich2020();
CbmMcbm2018UnpackerTaskPsd* unpacker_psd = new CbmMcbm2018UnpackerTaskPsd();
unpacker_sts->SetMonitorMode();
unpacker_much->SetMonitorMode();
......@@ -100,8 +102,18 @@ void unpack_pulser_mcbm(UInt_t uRunId = 0, TString sHostname = "localhost", UInt
unpacker_psd->SetWriteOutputFlag(kFALSE);
unpacker_sts->SetAdcCut(3);
unpacker_sts->SeparatePulserOutput(kFALSE);
unpacker_tof->SetSeparateArrayT0();
// ------------------------------ //
// Enable Asic type for MUCH data.
// fFlag = 0 ==> Asic type 2.0 (20) ---> December 2018 and March 2019 Data
// fFlag = 1 ==> Asic type 2.1 (21) ---> December 2019 Data
// This is to correct the channel fliping problem in smx 2.1 chip
Int_t fFlag = 1;
unpacker_much->EnableAsicType(fFlag);
// ------------------------------ //
switch (uRunId) {
/*
case 159:
......@@ -182,75 +194,89 @@ void unpack_pulser_mcbm(UInt_t uRunId = 0, TString sHostname = "localhost", UInt
break;
} // 159
*/
case 384: {
/// General System offsets (= offsets between sub-systems)
//unpacker_sts ->SetTimeOffsetNs( -1750 ); // Run 384
//unpacker_much->SetTimeOffsetNs( -1750 ); // Run 384
//unpacker_tof ->SetTimeOffsetNs( 40 ); // Run 384
//unpacker_rich->SetTimeOffsetNs( -273 ); // Run 384
/// ASIC specific offsets (= offsets inside sub-system)
unpacker_much->SetTimeOffsetNsAsic(0, 2429.0); // Run 384, DPB 0 ASIC 0
unpacker_much->SetTimeOffsetNsAsic(1, 2417.0); // Run 384, DPB 0 ASIC 1
unpacker_much->SetTimeOffsetNsAsic(2, 2418.0); // Run 384, DPB 0 ASIC 2
unpacker_much->SetTimeOffsetNsAsic(3, 0.0); // Run 384, DPB 0 ASIC 3
unpacker_much->SetTimeOffsetNsAsic(4, 2404.0); // Run 384, DPB 0 ASIC 4
unpacker_much->SetTimeOffsetNsAsic(5, 2415.0); // Run 384, DPB 0 ASIC 5
unpacker_much->SetTimeOffsetNsAsic(6, -772.7); // Run 384, DPB 1 ASIC 0
unpacker_much->SetTimeOffsetNsAsic(7, -779.3); // Run 384, DPB 1 ASIC 1
unpacker_much->SetTimeOffsetNsAsic(8, 0.0); // Run 384, DPB 1 ASIC 2
unpacker_much->SetTimeOffsetNsAsic(9, -806.6); // Run 384, DPB 1 ASIC 3
unpacker_much->SetTimeOffsetNsAsic(10, -784.2); // Run 384, DPB 1 ASIC 4
unpacker_much->SetTimeOffsetNsAsic(11, -786.4); // Run 384, DPB 1 ASIC 5
unpacker_much->SetTimeOffsetNsAsic(12, -788.9); // Run 384, DPB 2 ASIC 0
unpacker_much->SetTimeOffsetNsAsic(13, 0.0); // Run 384, DPB 2 ASIC 1
unpacker_much->SetTimeOffsetNsAsic(14, 0.0); // Run 384, DPB 2 ASIC 2
unpacker_much->SetTimeOffsetNsAsic(15, -785.9); // Run 384, DPB 2 ASIC 3
unpacker_much->SetTimeOffsetNsAsic(16, -784.5); // Run 384, DPB 2 ASIC 4
unpacker_much->SetTimeOffsetNsAsic(17, -775.6); // Run 384, DPB 2 ASIC 5
unpacker_much->SetTimeOffsetNsAsic(18, 2404.0); // Run 384, DPB 3 ASIC 0
unpacker_much->SetTimeOffsetNsAsic(19, 2400.0); // Run 384, DPB 3 ASIC 1
unpacker_much->SetTimeOffsetNsAsic(20, 2413.0); // Run 384, DPB 3 ASIC 2
unpacker_much->SetTimeOffsetNsAsic(21, 2407.0); // Run 384, DPB 3 ASIC 3
unpacker_much->SetTimeOffsetNsAsic(22, 0.0); // Run 384, DPB 3 ASIC 4
unpacker_much->SetTimeOffsetNsAsic(23, 0.0); // Run 384, DPB 3 ASIC 5
unpacker_much->SetTimeOffsetNsAsic(24, 2377.0); // Run 384, DPB 4 ASIC 0
unpacker_much->SetTimeOffsetNsAsic(25, 2375.0); // Run 384, DPB 4 ASIC 1
unpacker_much->SetTimeOffsetNsAsic(26, 2378.0); // Run 384, DPB 4 ASIC 2
unpacker_much->SetTimeOffsetNsAsic(27, 2394.0); // Run 384, DPB 4 ASIC 3
unpacker_much->SetTimeOffsetNsAsic(28, 2401.0); // Run 384, DPB 4 ASIC 4
unpacker_much->SetTimeOffsetNsAsic(29, 2405.0); // Run 384, DPB 4 ASIC 5
unpacker_much->SetTimeOffsetNsAsic(30, 5575.0); // Run 384, DPB 5 ASIC 0
unpacker_much->SetTimeOffsetNsAsic(31, 5599.0); // Run 384, DPB 5 ASIC 1
unpacker_much->SetTimeOffsetNsAsic(32, 5597.0); // Run 384, DPB 5 ASIC 2
unpacker_much->SetTimeOffsetNsAsic(33, 5583.0); // Run 384, DPB 5 ASIC 3
unpacker_much->SetTimeOffsetNsAsic(34, 0.0); // Run 384, DPB 5 ASIC 4
unpacker_much->SetTimeOffsetNsAsic(35, 0.0); // Run 384, DPB 5 ASIC 5
unpacker_psd->SetTimeOffsetNs(-180.0);
break;
} // 384
case 365: {
unpacker_psd->SetTimeOffsetNs(-1007.0);
break;
}
default: break;
} // switch( uRunId )
// --- Source task
CbmMcbm2018Source* source = new CbmMcbm2018Source();
/*
TString inFile = Form( "/scratch/mcbm_data/mcbm_all/data/%3u_pn02_0000.tsa;", uRunId );
inFile += Form( "/scratch/mcbm_data/mcbm_all/data/%3u_pn04_0000.tsa;", uRunId );
inFile += Form( "/scratch/mcbm_data/mcbm_all/data/%3u_pn05_0000.tsa;", uRunId );
inFile += Form( "/scratch/mcbm_data/mcbm_all/data/%3u_pn06_0000.tsa;", uRunId );
inFile += Form( "/scratch/mcbm_data/mcbm_all/data/%3u_pn08_0000.tsa;", uRunId );
inFile += Form( "/scratch/mcbm_data/mcbm_all/data/%3u_pn10_0000.tsa;", uRunId );
inFile += Form( "/scratch/mcbm_data/mcbm_all/data/%3u_pn11_0000.tsa;", uRunId );
inFile += Form( "/scratch/mcbm_data/mcbm_all/data/%3u_pn12_0000.tsa;", uRunId );
inFile += Form( "/scratch/mcbm_data/mcbm_all/data/%3u_pn13_0000.tsa;", uRunId );
inFile += Form( "/scratch/mcbm_data/mcbm_all/data/%3u_pn15_0000.tsa", uRunId );
*/
/*
TString inFile = Form( "/scratch/mcbm_data/mcbm_all/data/%3u_pn02_0003.tsa;", uRunId );
inFile += Form( "/scratch/mcbm_data/mcbm_all/data/%3u_pn04_0003.tsa;", uRunId );
inFile += Form( "/scratch/mcbm_data/mcbm_all/data/%3u_pn05_0003.tsa;", uRunId );
inFile += Form( "/scratch/mcbm_data/mcbm_all/data/%3u_pn06_0003.tsa;", uRunId );
inFile += Form( "/scratch/mcbm_data/mcbm_all/data/%3u_pn08_0003.tsa;", uRunId );
inFile += Form( "/scratch/mcbm_data/mcbm_all/data/%3u_pn10_0003.tsa;", uRunId );
inFile += Form( "/scratch/mcbm_data/mcbm_all/data/%3u_pn11_0003.tsa;", uRunId );
inFile += Form( "/scratch/mcbm_data/mcbm_all/data/%3u_pn12_0003.tsa;", uRunId );
inFile += Form( "/scratch/mcbm_data/mcbm_all/data/%3u_pn13_0003.tsa;", uRunId );
inFile += Form( "/scratch/mcbm_data/mcbm_all/data/%3u_pn15_0003.tsa", uRunId );
*/
TString inFile = Form("/scratch/mcbm_data/mcbm_all/data/%3u_pn02_*.tsa;", uRunId);
inFile += Form("/scratch/mcbm_data/mcbm_all/data/%3u_pn04_*.tsa;", uRunId);
inFile += Form("/scratch/mcbm_data/mcbm_all/data/%3u_pn05_*.tsa;", uRunId);
inFile += Form("/scratch/mcbm_data/mcbm_all/data/%3u_pn06_*.tsa;", uRunId);
inFile += Form("/scratch/mcbm_data/mcbm_all/data/%3u_pn08_*.tsa;", uRunId);
inFile += Form("/scratch/mcbm_data/mcbm_all/data/%3u_pn10_*.tsa;", uRunId);
inFile += Form("/scratch/mcbm_data/mcbm_all/data/%3u_pn11_*.tsa;", uRunId);
inFile += Form("/scratch/mcbm_data/mcbm_all/data/%3u_pn12_*.tsa;", uRunId);
inFile += Form("/scratch/mcbm_data/mcbm_all/data/%3u_pn13_*.tsa;", uRunId);
inFile += Form("/scratch/mcbm_data/mcbm_all/data/%3u_pn15_*.tsa", uRunId);
if (0 < uRunId) { source->SetFileName(inFile); } // if( "" != inFile )
else {
source->SetHostName(sHostname);
source->SetSubscriberHwm(10);
} // else of if( "" != inFile )
source->SetWriteOutputFlag(kFALSE); // For writing TS metadata
source->SetFileName(inFile);
// source->SetInputDir(inDir);
// source->AddUnpacker(unpacker_sts, 0x10, ECbmModuleId::kSts );//STS xyter
source->AddUnpacker(unpacker_sts, 0x10, ECbmModuleId::kSts); //STS xyter
source->AddUnpacker(unpacker_much, 0x40, ECbmModuleId::kMuch); //MUCH xyter
source->AddUnpacker(unpacker_tof, 0x60, ECbmModuleId::kTof); //gDPB A & B & C
source->AddUnpacker(unpacker_tof, 0x90, ECbmModuleId::kTof); //gDPB T0 A & B
// source->AddUnpacker(unpacker_rich, 0x30, ECbmModuleId::kRich );//RICH trb
source->AddUnpacker(unpacker_psd, 0x80, ECbmModuleId::kPsd); //PSD
source->AddUnpacker(unpacker_rich, 0x30, ECbmModuleId::kRich); //RICH trb
source->AddUnpacker(unpacker_psd, 0x80, ECbmModuleId::kPsd); //PSD
// --- RootFileSink to avoid crash with old versions of FairRoot (< 18.4.6)
FairRootFileSink* sink = new FairRootFileSink(outFile);
// --- Run
run = new FairRunOnline(source);
run->ActivateHttpServer(iServerRefreshRate,
iServerHttpPort); // refresh each 100 events
/// To avoid the server sucking all Histos from gROOT when no output file is used
/// ===> Need to explicitely add the canvases to the server in the task!
run->GetHttpServer()->GetSniffer()->SetScanGlobalDir(kFALSE);
run->SetSink(sink); /// Needed for FairRoot < 18.4.6
run->SetAutoFinish(kFALSE);
CbmMcbm2019CheckPulser* pulserChecker = new CbmMcbm2019CheckPulser();
pulserChecker->SetT0PulserTotLimits(184, 191);
pulserChecker->SetStsPulserAdcLimits(31, 0);
pulserChecker->SetMuchPulseradcLimits(5, 25); /// mCBM 2019
pulserChecker->SetMuchPulserAdcLimits(5, 25); /// mCBM 2019
pulserChecker->SetTofPulserTotLimits(184, 191);
pulserChecker->SetRichPulserTotLimits(1, 0);
pulserChecker->SetPsdPulserAdcLimits(0, 70000);
......@@ -258,11 +284,11 @@ void unpack_pulser_mcbm(UInt_t uRunId = 0, TString sHostname = "localhost", UInt
pulserChecker->SetMuchOffsetSearchRange(5000);
pulserChecker->SetTofOffsetSearchRange(500);
pulserChecker->SetRichOffsetSearchRange(1000);
// pulserChecker->SetPsdOffsetSearchRange( 500 );
pulserChecker->SetPsdOffsetSearchRange(250);
pulserChecker->SetPsdOffsetSearchRange(5000);
if (0 < uRunId) pulserChecker->SetOutFilename(Form("data/HistosPulserCheck_%03u.root", uRunId));
/// mCBM 2019
pulserChecker->SetStsAddress(0x11E004E2);
pulserChecker->SetMuchAsic(9);
pulserChecker->SetMuchChanRange(63);
......@@ -283,7 +309,7 @@ void unpack_pulser_mcbm(UInt_t uRunId = 0, TString sHostname = "localhost", UInt
timer.Start();
std::cout << ">>> unpack_tsa_mcbm: Starting run..." << std::endl;
if (0 == nrEvents) {
run->Run(nEvents, 0); // run until end of input file
run->Run(-1, 0); // run until end of input file
}
else {
run->Run(0, nrEvents); // process N Events
......
......@@ -33,6 +33,7 @@ If(DEFINED ENV{RAW_DATA_PATH} )
GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/beamtime/mcbm2020/MonitorTof.C ) # CbmMcbm2018MonitorTaskTof + CbmMcbm2018MonitorAlgoTof
GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/beamtime/mcbm2020/MonitorRich.C ) # CbmMcbm2018UnpackerTaskRich.h in monitor mode
GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/beamtime/mcbm2020/MonitorPsd.C ) # CbmMcbm2018MonitorTaskPsd + CbmMcbm2018MonitorAlgoPsd
GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/beamtime/mcbm2020/unpack_pulser_mcbm.C ) # Unpackers + Pulser check
## Run only if raw data files present
ForEach(RUN 759 760 761 762 811 812 819 824 831 856 )
......@@ -65,19 +66,19 @@ If(DEFINED ENV{RAW_DATA_PATH} )
#### Make this test run alone to try to avoid memory errors on test machines
set_tests_properties(${testname} PROPERTIES RUN_SERIAL true )
Set(testname mcbm_check_pulser_2020_${RUN})
Add_Test(${testname} ${CBMROOT_BINARY_DIR}/macro/beamtime/mcbm2020/check_pulser.sh ${RUN} )
Set_Tests_Properties(${testname} PROPERTIES TIMEOUT "300")
Set_Tests_Properties(${testname} PROPERTIES PASS_REGULAR_EXPRESSION "Test Passed;All ok")
set_tests_properties(${testname} PROPERTIES FIXTURES_REQUIRED ${fixture_unpacked_${RUN}})
set_tests_properties(${testname} PROPERTIES DEPENDS mcbm_check_timing_2020_${RUN})
# Set(testname mcbm_check_pulser_2020_${RUN})
# Add_Test(${testname} ${CBMROOT_BINARY_DIR}/macro/beamtime/mcbm2020/check_pulser.sh ${RUN} )
# Set_Tests_Properties(${testname} PROPERTIES TIMEOUT "300")
# Set_Tests_Properties(${testname} PROPERTIES PASS_REGULAR_EXPRESSION "Test Passed;All ok")
# set_tests_properties(${testname} PROPERTIES FIXTURES_REQUIRED ${fixture_unpacked_${RUN}})
# set_tests_properties(${testname} PROPERTIES DEPENDS mcbm_check_timing_2020_${RUN})
Set(testname mcbm_build_event_2020_${RUN})
Add_Test(${testname} ${CBMROOT_BINARY_DIR}/macro/beamtime/mcbm2020/build_events.sh \"data/unp_mcbm_${RUN}.root\" ${RUN} )
Set_Tests_Properties(${testname} PROPERTIES TIMEOUT "600")
Set_Tests_Properties(${testname} PROPERTIES PASS_REGULAR_EXPRESSION "Test Passed;All ok")
set_tests_properties(${testname} PROPERTIES FIXTURES_REQUIRED ${fixture_unpacked_${RUN}})
set_tests_properties(${testname} PROPERTIES DEPENDS mcbm_check_pulser_2020_${RUN})
set_tests_properties(${testname} PROPERTIES DEPENDS mcbm_check_timing_2020_${RUN})
Set(fixture_built_evt_${RUN} fixture_done_${testname})
set_tests_properties(${testname} PROPERTIES FIXTURES_SETUP ${fixture_built_evt_${RUN}})
......@@ -202,6 +203,13 @@ If(DEFINED ENV{RAW_DATA_PATH} )