Skip to content

Commit

Permalink
Merge pull request #123 from Mu2e/rrivera/duringPostGR3MiniGlobalRuns2
Browse files Browse the repository at this point in the history
Rrivera/during post gr3 mini global runs2
  • Loading branch information
eflumerf authored Jan 7, 2025
2 parents 1623959 + 9f48392 commit 3fed1b2
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 31 deletions.
49 changes: 22 additions & 27 deletions otsdaq-mu2e/FEInterfaces/CFOFrontEndInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,21 +90,16 @@ class CFOFrontEndInterface : public CFOandDTCCoreVInterface

private:

void initDetachedBufferTest(
uint64_t initialEventWindowTag,
bool saveBinaryDataToFile,
bool saveSubeventHeadersToDataFile, bool doNotResetCounters);
static void detechedBufferTestThread(
std::shared_ptr<CFOFrontEndInterface::DetachedBufferTestThreadStruct> threadStruct);
void initDetachedBufferTest (uint64_t initialEventWindowTag,
bool saveBinaryDataToFile,
bool saveSubeventHeadersToDataFile, bool doNotResetCounters);
static void detechedBufferTestThread (std::shared_ptr<CFOFrontEndInterface::DetachedBufferTestThreadStruct> threadStruct);


void registerFEMacros (void);
void registerFEMacros (void);

// CFOLib::CFO_Registers* thisCFO_;
int timing_chain_first_substep_ = -1;
//int configure_clock_ = 0;

// float average_loopback_;
int timing_chain_first_substep_ = -1;
uint64_t next_starting_event_window_tag_ = 0;

public:

Expand All @@ -113,22 +108,22 @@ class CFOFrontEndInterface : public CFOandDTCCoreVInterface
// void FlashLEDs (__ARGS__);
// void GetFirmwareVersion (__ARGS__);
// void GetStatus (__ARGS__);
void GetCounters (__ARGS__);
void GetCounters (__ARGS__);
// void GetFPGATemperature (__ARGS__);
// void SelectJitterAttenuatorSource (__ARGS__);


void CFOReset (__ARGS__);
void CFOHalt (__ARGS__);
void EnableOrDisableClockMarkers (__ARGS__);
void WriteCFO (__ARGS__);
void ReadCFO (__ARGS__);
void ResetRunplan (__ARGS__);
void CompileRunplan (__ARGS__);
void SetRunplan (__ARGS__);
std::string SetRunplan (const std::string& binFilename);
void LaunchRunplan (__ARGS__);
void CFOReset (__ARGS__);
void CFOHalt (__ARGS__);
void EnableOrDisableClockMarkers (__ARGS__);

void WriteCFO (__ARGS__);
void ReadCFO (__ARGS__);
void ResetRunplan (__ARGS__);
void CompileRunplan (__ARGS__);
void SetRunplan (__ARGS__);
std::string SetRunplan (const std::string& binFilename);
void LaunchRunplan (__ARGS__);
void CompileSetAndLaunchTemplateSuperCycleRunPlan (__ARGS__);
std::string CompileSetAndLaunchTemplateSuperCycleRunPlan (bool enable,
bool useDetachedBufferTest, uint32_t numberOfSuperCycles, uint64_t initialEventWindowTag,
Expand All @@ -139,9 +134,9 @@ class CFOFrontEndInterface : public CFOandDTCCoreVInterface
std::string eventDuration, uint32_t numberOfEventWindowMarkers, uint64_t initialEventWindowTag,
uint64_t eventWindowMode, bool enableClockMarkers, bool saveBinaryDataToFile,
bool saveSubeventHeadersToDataFile, bool doNotResetCounters);
void ConfigureForTimingChain (__ARGS__);
void LoopbackTest (__ARGS__);
void TestMarker (__ARGS__);
void ConfigureForTimingChain (__ARGS__);
void LoopbackTest (__ARGS__);
void TestMarker (__ARGS__);
};

// clang-format on
Expand Down
48 changes: 44 additions & 4 deletions otsdaq-mu2e/FEInterfaces/CFOFrontEndInterfaceImpl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,12 @@ void CFOFrontEndInterface::start(std::string runNumber) // runNumber)
__FE_COUTV__(getIterationIndex());
__FE_COUTV__(getSubIterationIndex());

if(getIterationIndex() == 0 && getSubIterationIndex() == 0)
{
next_starting_event_window_tag_ = 0; //reset next event window tag
__FE_COUTV__(next_starting_event_window_tag_);
}

if(operatingMode_ == CFOandDTCCoreVInterface::CONFIG_MODE_LOOPBACK)
{
__FE_COUT_INFO__ << "Start the loopback!" << __E__;
Expand Down Expand Up @@ -1584,12 +1590,29 @@ std::string CFOFrontEndInterface::SetRunplan(const std::string& binFilename)
//========================================================================
void CFOFrontEndInterface::CompileSetAndLaunchTemplateSuperCycleRunPlan(__ARGS__)
{
uint64_t startTag = __GET_ARG_IN__("Starting Event Window Tag (Default: 0)",uint64_t,-1);
if(startTag == (uint64_t)-1) //if DEFAULT, then continue from next tag position
{
__FE_COUTV__(next_starting_event_window_tag_);
startTag = next_starting_event_window_tag_;
}
//else take user input

__FE_COUTV__(startTag);

uint32_t numberOfCycles = __GET_ARG_IN__("Number of 1.4s super cycle repetitions (0 := infinite)",uint32_t);
__FE_COUTV__(numberOfCycles);

//setup next tag calculation
next_starting_event_window_tag_ += numberOfCycles * numberOfCycles;
__FE_COUTV__(next_starting_event_window_tag_);

__SET_ARG_OUT__("response",
CompileSetAndLaunchTemplateSuperCycleRunPlan(
__GET_ARG_IN__("Enable CFO Run Plan Execution (Default := false)",bool,false),
__GET_ARG_IN__("Use Detached Buffer Test (Default := false)",uint32_t),
__GET_ARG_IN__("Number of 1.4s super cycle repetitions (0 := infinite)",uint32_t),
__GET_ARG_IN__("Starting Event Window Tag (Default: 0)",uint64_t),
numberOfCycles,
startTag,
__GET_ARG_IN__("Enable Clock Markers (Default := false)",bool,false),
__GET_ARG_IN__("For Detached Buffer Test, Save Binary Data to File (Default: false)", bool),
__GET_ARG_IN__("For Detached Buffer Test, Save Subevent Header to Binary File (Default: false)", bool),
Expand Down Expand Up @@ -1712,13 +1735,30 @@ void CFOFrontEndInterface::EnableOrDisableClockMarkers(__ARGS__)
//========================================================================
void CFOFrontEndInterface::CompileSetAndLaunchTemplateFixedWidthRunPlan(__ARGS__)
{
uint64_t startTag = __GET_ARG_IN__("Starting Event Window Tag (Default: 0)",uint64_t,-1);
if(startTag == (uint64_t)-1) //if DEFAULT, then continue from next tag position
{
__FE_COUTV__(next_starting_event_window_tag_);
startTag = next_starting_event_window_tag_;
}
//else take user input

__FE_COUTV__(startTag);

uint32_t numberOfEvents= __GET_ARG_IN__("Number of Event Window Markers to generate (0 := infinite)",uint32_t);
__FE_COUTV__(numberOfEvents);

//setup next tag calculation
next_starting_event_window_tag_ += numberOfEvents;
__FE_COUTV__(next_starting_event_window_tag_);

__SET_ARG_OUT__("response",
CompileSetAndLaunchTemplateFixedWidthRunPlan(
__GET_ARG_IN__("Enable CFO Run Plan Execution (Default := false)",bool,false),
__GET_ARG_IN__("Use Detached Buffer Test (Default := false)",bool),
__GET_ARG_IN__("Fixed-width Event Window Duration (s, ms, us, ns, and clocks allowed) [clocks := 25ns]",std::string),
__GET_ARG_IN__("Number of Event Window Markers to generate (0 := infinite)",uint32_t),
__GET_ARG_IN__("Starting Event Window Tag (Default: 0)",uint64_t),
numberOfEvents,
startTag,
__GET_ARG_IN__("Event Window Mode (Default := 1)", uint64_t, 1),
__GET_ARG_IN__("Enable Clock Markers (Default := false)",bool,false),
__GET_ARG_IN__("For Detached Buffer Test, Save Binary Data to File (Default: false)", bool),
Expand Down
1 change: 1 addition & 0 deletions otsdaq-mu2e/FEInterfaces/DTCFrontEndInterfaceImpl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2316,6 +2316,7 @@ void DTCFrontEndInterface::start(std::string runNumber)
__FE_SS_THROW__;
}

thisDTC_->SoftReset(); //reset counters
return;

// /////////////////////////////
Expand Down
1 change: 1 addition & 0 deletions otsdaq-mu2e/RunInfoPlugins/DBRunInfo_runInfo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ void DBRunInfo::updateRunInfo(unsigned int runNumber, RunInfoVInterface::RunStop
__SS_THROW__;
}

__COUT__ << "done with the run_info database for updating the transition!" << __E__;
} //end updateRunInfo()


Expand Down

0 comments on commit 3fed1b2

Please sign in to comment.