/*-------------------------------------------------------------------------------*/ /* MessageCoorExecuter.cpp 7-Oct-99 28-Oct-99 Coor Command Parsing split onto separate files */ /*-------------------------------------------------------------------------------*/ #include "stdafx.h" #include #include "GlobalConstants.h" #include "CustomDataTypes.h" #include "MessageCommand.h" #include "MessageCoorExecuter.h" #include "HandleCommandFiles.h" #include "CommandFileMaster.h" #include "L1fw.h" #include "L2fw.h" #include "L1FW_MasterCommandFiles.h" #include "HandleConsole.h" #include "UtilsStrings.h" #include /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::L1FW_Configure ( CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; CString osMaster_Command_File ; Custom_Structure_Master xCustom ; //\\// CMessageCoorPrinter::L1FW_Configure ( _poCoorCommandLine ) ; //execute the dedicated Master Command File osMaster_Command_File = osL1FW_Configure_MCF ; if ( CommandFileMaster ( osMaster_Command_File, &xCustom, NULL ) != Ok ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; } // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::Initialize ( CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; CString osMaster_Command_File ; Custom_Structure_Master xCustom ; //\\// CMessageCoorPrinter::Initialize ( _poCoorCommandLine ) ; //execute the PRE-INIT AUXI command file osMaster_Command_File = osL1FW_Init_Pre_Auxi_MCF ; if ( CommandFileMaster ( osMaster_Command_File, &xCustom, NULL ) != Ok ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; goto Abort ; } //Create the L1FW Card Objects if needed //record the location of this L1fw object in the static variable for that effect if ( CL1fw::mg_poL1fw == NULL ) CL1fw::mg_poL1fw = new CL1fw () ; // Initialize the L1 FW if ( CL1fw::mg_poL1fw ->Initialize () != Ok ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; goto Abort ; } //Create the L2FW Card Objects if needed //record the location of this L2fw object in the static variable for that effect if ( CL2fw::mg_poL2fw == NULL ) CL2fw::mg_poL2fw = new CL2fw () ; // Initialize the L2 FW if ( CL2fw::mg_poL2fw ->Initialize () != Ok ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; goto Abort ; } //execute the POST-INIT AUXI command file osMaster_Command_File = osL1FW_Init_Post_Auxi_MCF ; if ( CommandFileMaster ( osMaster_Command_File, &xCustom, NULL ) != Ok ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; goto Abort ; } Abort: // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::SCL_Initialize ( CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; CString osMaster_Command_File ; Custom_Structure_Master xCustom ; //\\// CMessageCoorPrinter::SCL_Initialize ( _poCoorCommandLine ) ; //execute the dedicated Master Command File osMaster_Command_File = osL1FW_Init_SCL_MCF ; if ( CommandFileMaster ( osMaster_Command_File, &xCustom, NULL ) != Ok ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; } // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::StartRun ( const unsigned long _uiRunNumber, EItemPolarity* _pubListItemPolarity, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; CString osMaster_Command_File ; Custom_Structure_Master xCustom ; //\\// CMessageCoorPrinter::StartRun ( _uiRunNumber, _pubListItemPolarity, _poCoorCommandLine ) ; strcpy ( sReplyText, "" ) ; //Perform an implicit SCL Initialize osMaster_Command_File = osL1FW_Init_SCL_MCF ; if ( CommandFileMaster ( osMaster_Command_File, &xCustom, NULL ) != Ok ) { eReturnStatus = Reply_Bad ; strcat ( sReplyText, "" ) ; } // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::StopRun ( const unsigned long _uiRunNumber, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; //\\// CMessageCoorPrinter::StopRun ( _uiRunNumber, _poCoorCommandLine ) ; strcpy ( sReplyText, "" ) ; // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::PauseRun ( CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; //\\// CMessageCoorPrinter::PauseRun ( _poCoorCommandLine ) ; strcpy ( sReplyText, "" ) ; // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::ResumeRun ( CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; //\\// CMessageCoorPrinter::ResumeRun ( _poCoorCommandLine ) ; strcpy ( sReplyText, "" ) ; // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::L1fwPause ( CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; //\\// CMessageCoorPrinter::L1fwPause ( _poCoorCommandLine ) ; // verify there is a level 1 framework object if ( CL1fw::mg_poL1fw == NULL ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; } // go do it else { // Assert the Glogal Disable to Pause the Framework if ( CL1fw::mg_poL1fw->poHelpFunct->L1fw_Pause() != Ok ) eReturnStatus = Reply_Bad ; //remember the current framework pause/resume state CL1fw::mg_poL1fw->eL1FwPaused = Asserted ; } // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::L1fwResume ( CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; //\\// CMessageCoorPrinter::L1fwResume ( _poCoorCommandLine ) ; // verify there is a level 1 framework object if ( CL1fw::mg_poL1fw == NULL ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; } // go do it else { // De-Assert the Glogal Disable to Resume Triggering if ( CL1fw::mg_poL1fw->poHelpFunct->L1fw_Resume() != Ok ) eReturnStatus = Reply_Bad ; //remember the current framework pause/resume state CL1fw::mg_poL1fw->eL1FwPaused = Negated ; } // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::BeginStore ( const unsigned long _uiStoreNumber, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; //\\// CMessageCoorPrinter::BeginStore ( _uiStoreNumber, _poCoorCommandLine ) ; strcpy ( sReplyText, "" ) ; // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::EndStore ( const unsigned long _uiStoreNumber, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; //\\// CMessageCoorPrinter::EndStore ( _uiStoreNumber, _poCoorCommandLine ) ; strcpy ( sReplyText, "" ) ; // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::ExpoGroupAndOrList ( const unsigned int _uiExpoGroupNum, EItemPolarity* _pubListItemPolarity, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; ESuccess eStatus = Ok ; //\\// CMessageCoorPrinter::ExpoGroupAndOrList ( _uiExpoGroupNum, _pubListItemPolarity, _poCoorCommandLine ) ; // verify there is a level 1 framework object if ( CL1fw::mg_poL1fw == NULL ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; } // go do it else { // Assert the Glogal Disable to Pause the Framework (only if we were not paused already) if ( CL1fw::mg_poL1fw->eL1FwPaused == Negated ) if ( CL1fw::mg_poL1fw->poHelpFunct->L1fw_Pause() != Ok ) eReturnStatus = Reply_Bad ; // program the first half of the andor terms if ( CL1fw::mg_poL1fw->apoEgFiredAonm[eAoTerm_0_127] != NULL ) { //prepare the change eStatus = CL1fw::mg_poL1fw->apoEgFiredAonm[eAoTerm_0_127] ->f_okPreProgOneOutputAllInput ( _uiExpoGroupNum, (OneAonmOutputProgr*) &_pubListItemPolarity[0] ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; //apply the change eStatus = CL1fw::mg_poL1fw->apoEgFiredAonm[eAoTerm_0_127] ->f_okWriteProgOneOutputAllInput ( _uiExpoGroupNum ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; //Also program the copy that goes to the Per Bunch Scalers eStatus = CL1fw::mg_poL1fw->apoEgFiredAonm[eAoTerm_0_127] ->f_okPreProgOneOutputAllInput ( _uiExpoGroupNum + KiAonmChanOffsetForPbsCopy, (OneAonmOutputProgr*) &_pubListItemPolarity[0] ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; eStatus = CL1fw::mg_poL1fw->apoEgFiredAonm[eAoTerm_0_127] ->f_okWriteProgOneOutputAllInput ( _uiExpoGroupNum + KiAonmChanOffsetForPbsCopy ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; } // program the second half of the andor terms if ( CL1fw::mg_poL1fw->apoEgFiredAonm[eAoTerm_128_255] != NULL ) { //prepare the change eStatus = CL1fw::mg_poL1fw->apoEgFiredAonm[eAoTerm_128_255] ->f_okPreProgOneOutputAllInput ( _uiExpoGroupNum, (OneAonmOutputProgr*) &_pubListItemPolarity[128] ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; //apply the change eStatus = CL1fw::mg_poL1fw->apoEgFiredAonm[eAoTerm_128_255] ->f_okWriteProgOneOutputAllInput ( _uiExpoGroupNum ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; //Also program the copy that goes to the Per Bunch Scalers eStatus = CL1fw::mg_poL1fw->apoEgFiredAonm[eAoTerm_128_255] ->f_okPreProgOneOutputAllInput ( _uiExpoGroupNum + KiAonmChanOffsetForPbsCopy, (OneAonmOutputProgr*) &_pubListItemPolarity[128] ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; eStatus = CL1fw::mg_poL1fw->apoEgFiredAonm[eAoTerm_128_255] ->f_okWriteProgOneOutputAllInput ( _uiExpoGroupNum + KiAonmChanOffsetForPbsCopy ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; } // De-Assert the Glogal Disable to Resume Triggering (only if we were not paused already) if ( CL1fw::mg_poL1fw->eL1FwPaused == Negated ) if ( CL1fw::mg_poL1fw->poHelpFunct->L1fw_Resume() != Ok ) eReturnStatus = Reply_Bad ; if ( eReturnStatus == Reply_Bad ) strcpy ( sReplyText, "" ) ; // we need to remember a global list of all andor terms used (for monitoring purposes) for ( int iAoTermNum = 0 ; iAoTermNum < KiL1fwTotAoTerm ; iAoTermNum++ ) if ( _pubListItemPolarity[iAoTermNum] != ItemNotPresent ) CL1fw::mg_poL1fw->aeGlobalAoTermUsed[iAoTermNum] = Obey ; // we need to remember a global list of all Exposure Groups used (for monitoring purposes) CL1fw::mg_poL1fw->xGlobalExpGrpList.aeRequirement[_uiExpoGroupNum] = Obey ; } // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::ExpoGroupGeoSectList ( const unsigned int _uiExpoGroupNum, EItemPolarity* _pubListItemPolarity, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; ESuccess eStatus = Ok ; unsigned int uiGeoSectNum ; unsigned int uiExpoGroupNum ; //\\// CMessageCoorPrinter::ExpoGroupGeoSectList ( _uiExpoGroupNum, _pubListItemPolarity, _poCoorCommandLine ) ; // verify there is a level 1 framework object if ( CL1fw::mg_poL1fw == NULL ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; } // go do it else { // we need to remember the programming of GeoSectList for each Exp Group. CL1fw::mg_poL1fw->axExpGroupGeoSectList[_uiExpoGroupNum] = * (OneFomOutputProgr*) _pubListItemPolarity ; // we need to remember a global list of all Exposure Groups used (for monitoring purposes) CL1fw::mg_poL1fw->xGlobalExpGrpList.aeRequirement[_uiExpoGroupNum] = Obey ; //always digitize Geo Sect 127 //for L2Fw to know when at least one SpTrg is accepted // Removed 16-June-2000 Coor is now doing it. // CL1fw::mg_poL1fw->axExpGroupGeoSectList[_uiExpoGroupNum].aeRequirement[127] = Obey ; // update the list of all geographic sections currently allocated // note: we rebuild from scratch instead of just adding the new GeoSects // to protect against the case where this is a change of Exposure group definition for ( uiGeoSectNum = 0 ; uiGeoSectNum < KiL1fwTotGeoSect ; uiGeoSectNum++ ) { CL1fw::mg_poL1fw->xAllocatedGeoSectList.aeRequirement[uiGeoSectNum] = Ignore ; for ( uiExpoGroupNum = 0 ; uiExpoGroupNum < eTotExpGroup ; uiExpoGroupNum++ ) { if ( CL1fw::mg_poL1fw->axExpGroupGeoSectList[uiExpoGroupNum].aeRequirement[uiGeoSectNum] == Obey ) { CL1fw::mg_poL1fw->xAllocatedGeoSectList.aeRequirement[uiGeoSectNum] = Obey ; break ; } } } // Assert the Glogal Disable to Pause the Framework (only if we were not paused already) if ( CL1fw::mg_poL1fw->eL1FwPaused == Negated ) if ( CL1fw::mg_poL1fw->poHelpFunct->L1fw_Pause() != Ok ) eReturnStatus = Reply_Bad ; // Program the lookup of Geographic Section L1 Busy into Exposure Group Front-End Busy if ( CL1fw::mg_poL1fw->poFeBzFom != NULL ) { //prepare the change eStatus = CL1fw::mg_poL1fw->poFeBzFom ->f_okPreProgOneOutputAllInput ( _uiExpoGroupNum, &CL1fw::mg_poL1fw->axExpGroupGeoSectList[_uiExpoGroupNum] ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; //apply the change eStatus = CL1fw::mg_poL1fw->poFeBzFom ->f_okWriteProgOneOutputAllInput ( _uiExpoGroupNum ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; //Also program the copy that goes to the Per Bunch Scalers eStatus = CL1fw::mg_poL1fw->poFeBzFom ->f_okPreProgOneOutputAllInput ( _uiExpoGroupNum + KiFomChanOffsetForPbsCopy, &CL1fw::mg_poL1fw->axExpGroupGeoSectList[_uiExpoGroupNum] ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; eStatus = CL1fw::mg_poL1fw->poFeBzFom ->f_okWriteProgOneOutputAllInput ( _uiExpoGroupNum + KiFomChanOffsetForPbsCopy ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; } // De-Assert the Glogal Disable to Resume Triggering (only if we were not paused already) if ( CL1fw::mg_poL1fw->eL1FwPaused == Negated ) if ( CL1fw::mg_poL1fw->poHelpFunct->L1fw_Resume() != Ok ) eReturnStatus = Reply_Bad ; // Update the Geo Sect L2 Busy And-Or Network Modules if ( CL2fw::mg_poL2fw->apoL2Bad[eGeoSect_0_63] != NULL ) { for ( uiGeoSectNum = 0 ; uiGeoSectNum < KiFomTotGeoSectPerCard ; uiGeoSectNum++ ) // note KiFomTotGeoSectPerCard is a good parameter for this purpose, despite its name { if ( CL1fw::mg_poL1fw->xAllocatedGeoSectList.aeRequirement[uiGeoSectNum] == Obey ) eStatus = CL2fw::mg_poL2fw->apoL2Bad[eGeoSect_0_63]->f_okChannelEnable ( uiGeoSectNum % KiFomTotGeoSectPerCard, eFeBusyEnable ) ; else eStatus = CL2fw::mg_poL2fw->apoL2Bad[eGeoSect_0_63]->f_okChannelEnable ( uiGeoSectNum % KiFomTotGeoSectPerCard, eFeBusyDisable ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; } } if ( CL2fw::mg_poL2fw->apoL2Bad[eGeoSect_64_127] != NULL ) { for ( uiGeoSectNum = KiFomTotGeoSectPerCard ; uiGeoSectNum < KiL1fwTotGeoSect ; uiGeoSectNum++ ) { if ( CL1fw::mg_poL1fw->xAllocatedGeoSectList.aeRequirement[uiGeoSectNum] == Obey ) eStatus = CL2fw::mg_poL2fw->apoL2Bad[eGeoSect_64_127]->f_okChannelEnable ( uiGeoSectNum % KiFomTotGeoSectPerCard, eFeBusyEnable ) ; else eStatus = CL2fw::mg_poL2fw->apoL2Bad[eGeoSect_64_127]->f_okChannelEnable ( uiGeoSectNum % KiFomTotGeoSectPerCard, eFeBusyDisable ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; } } if ( eReturnStatus == Reply_Bad ) strcpy ( sReplyText, "" ) ; } // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::ExpoGroupDeallocate ( const unsigned int _uiExpoGroupNum, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; ESuccess eStatus = Ok ; unsigned int uiGeoSectNum ; unsigned int uiExpoGroupNum ; //\\// CMessageCoorPrinter::ExpoGroupDeallocate ( _uiExpoGroupNum, _poCoorCommandLine ) ; // verify there is a level 1 framework object if ( CL1fw::mg_poL1fw == NULL ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; } // go do it else { // we need to remember the programming of GeoSectList for each Exp Group. // so clear this Exposure group CL1fw::mg_poL1fw->axExpGroupGeoSectList[_uiExpoGroupNum] = * (OneFomOutputProgr*) CL1fw::mg_poL1fw->paubListCleared ; // we need to remember a global list of all Exposure Groups used (for monitoring purposes) // so clear this Exposure group CL1fw::mg_poL1fw->xGlobalExpGrpList.aeRequirement[_uiExpoGroupNum] = Ignore ; // update the list of all geographic sections currently allocated // note: we rebuild from scratch instead of just removing these GeoSects // because they may still be used in other Exposure group definitions for ( uiGeoSectNum = 0 ; uiGeoSectNum < KiL1fwTotGeoSect ; uiGeoSectNum++ ) { CL1fw::mg_poL1fw->xAllocatedGeoSectList.aeRequirement[uiGeoSectNum] = Ignore ; for ( uiExpoGroupNum = 0 ; uiExpoGroupNum < eTotExpGroup ; uiExpoGroupNum++ ) { if ( CL1fw::mg_poL1fw->axExpGroupGeoSectList[uiExpoGroupNum].aeRequirement[uiGeoSectNum] == Obey ) { CL1fw::mg_poL1fw->xAllocatedGeoSectList.aeRequirement[uiGeoSectNum] = Obey ; break ; } } } // Assert the Glogal Disable to Pause the Framework (only if we were not paused already) if ( CL1fw::mg_poL1fw->eL1FwPaused == Negated ) if ( CL1fw::mg_poL1fw->poHelpFunct->L1fw_Pause() != Ok ) eReturnStatus = Reply_Bad ; // Program the lookup of Geographic Section L1 Busy into Exposure Group Front-End Busy // i.e. clear this Exposure group if ( CL1fw::mg_poL1fw->poFeBzFom != NULL ) { //prepare the change eStatus = CL1fw::mg_poL1fw->poFeBzFom ->f_okPreProgOneOutputAllInput ( _uiExpoGroupNum, &CL1fw::mg_poL1fw->axExpGroupGeoSectList[_uiExpoGroupNum] ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; //apply the change eStatus = CL1fw::mg_poL1fw->poFeBzFom ->f_okWriteProgOneOutputAllInput ( _uiExpoGroupNum ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; //Also program the copy that goes to the Per Bunch Scalers eStatus = CL1fw::mg_poL1fw->poFeBzFom ->f_okPreProgOneOutputAllInput ( _uiExpoGroupNum + KiFomChanOffsetForPbsCopy, &CL1fw::mg_poL1fw->axExpGroupGeoSectList[_uiExpoGroupNum] ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; eStatus = CL1fw::mg_poL1fw->poFeBzFom ->f_okWriteProgOneOutputAllInput ( _uiExpoGroupNum + KiFomChanOffsetForPbsCopy ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; } // De-Assert the Glogal Disable to Resume Triggering (only if we were not paused already) if ( CL1fw::mg_poL1fw->eL1FwPaused == Negated ) if ( CL1fw::mg_poL1fw->poHelpFunct->L1fw_Resume() != Ok ) eReturnStatus = Reply_Bad ; // Update the Geo Sect L2 Busy And-Or Network Modules if ( CL2fw::mg_poL2fw->apoL2Bad[eGeoSect_0_63] != NULL ) { for ( uiGeoSectNum = 0 ; uiGeoSectNum < KiFomTotGeoSectPerCard ; uiGeoSectNum++ ) // note KiFomTotGeoSectPerCard is a good parameter for this purpose, despite its name { if ( CL1fw::mg_poL1fw->xAllocatedGeoSectList.aeRequirement[uiGeoSectNum] == Obey ) eStatus = CL2fw::mg_poL2fw->apoL2Bad[eGeoSect_0_63]->f_okChannelEnable ( uiGeoSectNum % KiFomTotGeoSectPerCard, eFeBusyDisable ) ; else eStatus = CL2fw::mg_poL2fw->apoL2Bad[eGeoSect_0_63]->f_okChannelEnable ( uiGeoSectNum % KiFomTotGeoSectPerCard, eFeBusyDisable ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; } } if ( CL2fw::mg_poL2fw->apoL2Bad[eGeoSect_64_127] != NULL ) { for ( uiGeoSectNum = KiFomTotGeoSectPerCard ; uiGeoSectNum < KiL1fwTotGeoSect ; uiGeoSectNum++ ) { if ( CL1fw::mg_poL1fw->xAllocatedGeoSectList.aeRequirement[uiGeoSectNum] == Obey ) eStatus = CL2fw::mg_poL2fw->apoL2Bad[eGeoSect_64_127]->f_okChannelEnable ( uiGeoSectNum % KiFomTotGeoSectPerCard, eFeBusyDisable ) ; else eStatus = CL2fw::mg_poL2fw->apoL2Bad[eGeoSect_64_127]->f_okChannelEnable ( uiGeoSectNum % KiFomTotGeoSectPerCard, eFeBusyDisable ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; } } if ( eReturnStatus == Reply_Bad ) strcpy ( sReplyText, "" ) ; } // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::SpecTrigAndOrList ( const unsigned int _uiSpTrgNum, EItemPolarity* _pubListItemPolarity, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; ESuccess eStatus = Ok ; unsigned long ulRelSpTrgNum ; unsigned long ulAonmCardNum ; //\\// CMessageCoorPrinter::SpecTrigAndOrList( _uiSpTrgNum, _pubListItemPolarity, _poCoorCommandLine ) ; // locate the proper card index and relative object number ulAonmCardNum = _uiSpTrgNum / KiAonmTotSpTrgPerCard ; ulRelSpTrgNum = _uiSpTrgNum % KiAonmTotSpTrgPerCard ; // verify there is a level 1 framework object if ( CL1fw::mg_poL1fw == NULL ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; } // go do it else { // Assert the Glogal Disable to Pause the Framework (only if we were not paused already) if ( CL1fw::mg_poL1fw->eL1FwPaused == Negated ) if ( CL1fw::mg_poL1fw->poHelpFunct->L1fw_Pause() != Ok ) eReturnStatus = Reply_Bad ; // program the first half of the andor terms if ( CL1fw::mg_poL1fw->apoAoFiredAonm[eAoTerm_0_127][ulAonmCardNum] != NULL ) { //prepare the change eStatus = CL1fw::mg_poL1fw->apoAoFiredAonm[eAoTerm_0_127][ulAonmCardNum] ->f_okPreProgOneOutputAllInput ( ulRelSpTrgNum, (OneAonmOutputProgr*) &_pubListItemPolarity[0] ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; //apply the change eStatus = CL1fw::mg_poL1fw->apoAoFiredAonm[eAoTerm_0_127][ulAonmCardNum] ->f_okWriteProgOneOutputAllInput ( ulRelSpTrgNum ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; } // program the second half of the andor terms if ( CL1fw::mg_poL1fw->apoAoFiredAonm[eAoTerm_128_255][ulAonmCardNum] != NULL ) { //prepare the change eStatus = CL1fw::mg_poL1fw->apoAoFiredAonm[eAoTerm_128_255][ulAonmCardNum] ->f_okPreProgOneOutputAllInput ( ulRelSpTrgNum, (OneAonmOutputProgr*) &_pubListItemPolarity[128] ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; //apply the change eStatus = CL1fw::mg_poL1fw->apoAoFiredAonm[eAoTerm_128_255][ulAonmCardNum] ->f_okWriteProgOneOutputAllInput ( ulRelSpTrgNum ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; } // De-Assert the Glogal Disable to Resume Triggering (only if we were not paused already) if ( CL1fw::mg_poL1fw->eL1FwPaused == Negated ) if ( CL1fw::mg_poL1fw->poHelpFunct->L1fw_Resume() != Ok ) eReturnStatus = Reply_Bad ; if ( eReturnStatus == Reply_Bad ) strcpy ( sReplyText, "" ) ; // we need to remember a global list of all andor terms used (for monitoring purposes) for ( int iAoTermNum = 0 ; iAoTermNum < KiL1fwTotAoTerm ; iAoTermNum++ ) if ( _pubListItemPolarity[iAoTermNum] != ItemNotPresent ) CL1fw::mg_poL1fw->aeGlobalAoTermUsed[iAoTermNum] = Obey ; } // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::SpecTrigL1Qualifier ( const unsigned int _uiSpTrgNum, EItemPolarity* _pubListItemPolarity, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; ESuccess eStatus = Ok ; //\\// CMessageCoorPrinter::SpecTrigL1Qualifier ( _uiSpTrgNum, _pubListItemPolarity, _poCoorCommandLine ) ; strcpy ( sReplyText, "" ) ; // verify there is a level 1 framework object if ( CL1fw::mg_poL1fw == NULL ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; } // go do it else { } // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::SpecTrigExpoGroup ( const unsigned int _uiSpTrgNum, const unsigned int _uiExpGroupNum, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; ESuccess eStatus = Ok ; unsigned long ulRelSpTrgNum ; unsigned long ulTdmCardNum ; unsigned long ulFomCardNum ; unsigned long ulRelGeoSectNum ; unsigned long ulFomPPChannelNum ; unsigned long ulAonmCardNum ; //\\// CMessageCoorPrinter::SpecTrigExpoGroup ( _uiSpTrgNum, _uiExpGroupNum, _poCoorCommandLine ) ; // verify there is a level 1 framework object if ( CL1fw::mg_poL1fw == NULL ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; } // go do it else { // locate the proper card index and relative object number ulTdmCardNum = _uiSpTrgNum / KiTdmTotSpTrgPerCard ; ulRelSpTrgNum = _uiSpTrgNum % KiTdmTotSpTrgPerCard ; if ( CL1fw::mg_poL1fw->apoTdm[ulTdmCardNum]->f_okSpTrgSelectEgFeBz != NULL ) { // tell the specific trigger to listen to this Exposure group And-Or signal eStatus = CL1fw::mg_poL1fw->apoTdm[ulTdmCardNum]->f_okSpTrgSelectEgFired ( ulRelSpTrgNum, (EExposureGroup) _uiExpGroupNum ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; // tell the specific trigger to listen to this Exposure group front-end busy signal eStatus = CL1fw::mg_poL1fw->apoTdm[ulTdmCardNum]->f_okSpTrgSelectEgFeBz ( ulRelSpTrgNum, (EExposureGroup) _uiExpGroupNum ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; } // Assert the Glogal Disable to Pause the Framework (only if we were not paused already) if ( CL1fw::mg_poL1fw->eL1FwPaused == Negated ) if ( CL1fw::mg_poL1fw->poHelpFunct->L1fw_Pause() != Ok ) eReturnStatus = Reply_Bad ; // We need also to add this specific trigger to // - all the geographic section start digitize FOMs // - all the geographic section L2 Accept FOMs // - all the geographic section L2 Reject FOMs for ( int iGeoSectNum = 0 ; iGeoSectNum < KiL1fwTotGeoSect ; iGeoSectNum++ ) { // note: we reprogram the GeoSect even if this SpTrg does not digitize it, // to protect against the unlikely case where this is a change of Exposure group if ( CL1fw::mg_poL1fw->axExpGroupGeoSectList[_uiExpGroupNum].aeRequirement[iGeoSectNum] == Obey ) CL1fw::mg_poL1fw->axGeoSectSpTrgList[iGeoSectNum].aeRequirement[_uiSpTrgNum] = Obey ; else CL1fw::mg_poL1fw->axGeoSectSpTrgList[iGeoSectNum].aeRequirement[_uiSpTrgNum] = Ignore ; // locate the proper card index and relative object number ulFomCardNum = iGeoSectNum / KiFomTotGeoSectPerCard ; ulRelGeoSectNum = iGeoSectNum % KiFomTotGeoSectPerCard ; // geographic section start digitize FOMs if ( CL1fw::mg_poL1fw->apoOutputFom[ulFomCardNum] != NULL ) { //prepare the change eStatus = CL1fw::mg_poL1fw->apoOutputFom[ulFomCardNum] ->f_okPreProgOneOutputAllInput ( ulRelGeoSectNum, &CL1fw::mg_poL1fw->axGeoSectSpTrgList[iGeoSectNum] ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; //apply the change eStatus = CL1fw::mg_poL1fw->apoOutputFom[ulFomCardNum] ->f_okWriteProgOneOutputAllInput ( ulRelGeoSectNum ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; } // geographic section L2 Accept FOMs if ( CL2fw::mg_poL2fw->apoAcceptFom[ulFomCardNum] != NULL ) { //prepare the change eStatus = CL2fw::mg_poL2fw->apoAcceptFom[ulFomCardNum] ->f_okPreProgOneOutputAllInput ( ulRelGeoSectNum, &CL1fw::mg_poL1fw->axGeoSectSpTrgList[iGeoSectNum] ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; //apply the change eStatus = CL2fw::mg_poL2fw->apoAcceptFom[ulFomCardNum] ->f_okWriteProgOneOutputAllInput ( ulRelGeoSectNum ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; } // geographic section L2 Reject FOMs if ( CL2fw::mg_poL2fw->apoRejectFom[ulFomCardNum] != NULL ) { //prepare the change eStatus = CL2fw::mg_poL2fw->apoRejectFom[ulFomCardNum] ->f_okPreProgOneOutputAllInput ( ulRelGeoSectNum, &CL1fw::mg_poL1fw->axGeoSectSpTrgList[iGeoSectNum] ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; //apply the change eStatus = CL2fw::mg_poL2fw->apoRejectFom[ulFomCardNum] ->f_okWriteProgOneOutputAllInput ( ulRelGeoSectNum ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; } } // add this trigger to the global list of all allocated triggers CL1fw::mg_poL1fw->xGlobalSpTrgList.aeRequirement[_uiSpTrgNum] = Obey ; // also program the FOM++ if ( CL1fw::mg_poL1fw->poL1QualFomPP != NULL ) { // program the Global L1 Accept aka L1 Trigger Strobe for ( ulFomPPChannelNum = KiFomPP_MinFpga_L1TrigSrobe ; ulFomPPChannelNum <= KiFomPP_MaxFpga_L1TrigSrobe ; ulFomPPChannelNum ++ ) { //prepare the change eStatus = CL1fw::mg_poL1fw->poL1QualFomPP ->f_okPreProgOneOutputAllInput ( ulFomPPChannelNum, (OneFomOutputProgr*) &CL1fw::mg_poL1fw->xGlobalSpTrgList ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; //apply the change eStatus = CL1fw::mg_poL1fw->poL1QualFomPP ->f_okWriteProgOneOutputAllInput ( ulFomPPChannelNum ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; } // program the skip Next One Beam Crossing resources for ( ulFomPPChannelNum = KiFomPP_MinFpga_SkipNextOneBeamX ; ulFomPPChannelNum <= KiFomPP_MaxFpga_SkipNextOneBeamX ; ulFomPPChannelNum ++ ) { //prepare the change eStatus = CL1fw::mg_poL1fw->poL1QualFomPP ->f_okPreProgOneOutputAllInput ( ulFomPPChannelNum, (OneFomOutputProgr*) &CL1fw::mg_poL1fw->xGlobalSpTrgList ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; //apply the change eStatus = CL1fw::mg_poL1fw->poL1QualFomPP ->f_okWriteProgOneOutputAllInput ( ulFomPPChannelNum ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; } // program the skip Next N Beam Crossings resources for ( ulFomPPChannelNum = KiFomPP_MinFpga_SkipNextNBeamX ; ulFomPPChannelNum <= KiFomPP_MaxFpga_SkipNextNBeamX ; ulFomPPChannelNum ++ ) { //prepare the change eStatus = CL1fw::mg_poL1fw->poL1QualFomPP ->f_okPreProgOneOutputAllInput ( ulFomPPChannelNum , (OneFomOutputProgr*) &CL1fw::mg_poL1fw->xGlobalSpTrgList ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; //apply the change eStatus = CL1fw::mg_poL1fw->poL1QualFomPP ->f_okWriteProgOneOutputAllInput ( ulFomPPChannelNum ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; } } // now program the L2FW Accept and Reject AONMs // locate the proper card index and relative object number ulAonmCardNum = _uiSpTrgNum / KiAonmTotSpTrgPerCard ; ulRelSpTrgNum = _uiSpTrgNum % KiAonmTotSpTrgPerCard ; // Specific Trigger L2 Accept AONM if ( CL2fw::mg_poL2fw->apoAcceptAonm[ulAonmCardNum] != NULL ) { eStatus = CL2fw::mg_poL2fw->apoAcceptAonm[ulAonmCardNum]->ProgrL2Accept( ulRelSpTrgNum ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; } // Specific Trigger L2 Reject AONM if ( CL2fw::mg_poL2fw->apoRejectAonm[ulAonmCardNum] != NULL ) { eStatus = CL2fw::mg_poL2fw->apoRejectAonm[ulAonmCardNum]->ProgrL2Reject( ulRelSpTrgNum ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; } // De-Assert the Glogal Disable to Resume Triggering (only if we were not paused already) if ( CL1fw::mg_poL1fw->eL1FwPaused == Negated ) if ( CL1fw::mg_poL1fw->poHelpFunct->L1fw_Resume() != Ok ) eReturnStatus = Reply_Bad ; //verify overall success if ( eReturnStatus == Reply_Bad ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; } } // we need to remember the Exp Group programming of this specific trigger CL1fw::mg_poL1fw->aeSpTrgExpGroup[_uiSpTrgNum] = (EExposureGroup) _uiExpGroupNum ; // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::SpecTrigCoorEnable ( const unsigned int _uiSpTrgNum, const EDisableEnable _eNewEnableState , CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; ESuccess eStatus = Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; unsigned long ulRelSpTrgNum ; unsigned long ulTdmCardNum ; //\\// CMessageCoorPrinter::SpecTrigCoorEnable ( _uiSpTrgNum, _eNewEnableState , _poCoorCommandLine ) ; // locate the proper card index and relative object number ulTdmCardNum = _uiSpTrgNum / KiTdmTotSpTrgPerCard ; ulRelSpTrgNum = _uiSpTrgNum % KiTdmTotSpTrgPerCard ; // verify there is a level 1 framework object if ( CL1fw::mg_poL1fw == NULL ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; } // go do it else { if ( CL1fw::mg_poL1fw->apoTdm[ulTdmCardNum] != NULL ) eStatus = CL1fw::mg_poL1fw->apoTdm[ulTdmCardNum]->f_okSpTrgCoorEnable ( ulRelSpTrgNum, _eNewEnableState ) ; if ( eStatus != Ok ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; } } // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::SpecTrigObeyFeBusy ( const unsigned int _uiSpTrgNum, const EIgnoreObey _eNewObeyState, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; ESuccess eStatus = Ok ; unsigned long ulRelSpTrgNum ; unsigned long ulTdmCardNum ; EExposureGroup eExpGroupNum ; //\\// CMessageCoorPrinter::SpecTrigObeyFeBusy ( _uiSpTrgNum, _eNewObeyState , _poCoorCommandLine ) ; // locate the proper card index and relative object number ulTdmCardNum = _uiSpTrgNum / KiTdmTotSpTrgPerCard ; ulRelSpTrgNum = _uiSpTrgNum % KiTdmTotSpTrgPerCard ; // verify there is a level 1 framework object if ( CL1fw::mg_poL1fw == NULL ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; } // go do it else { switch ( _eNewObeyState ) { case Obey : eExpGroupNum = CL1fw::mg_poL1fw->aeSpTrgExpGroup[_uiSpTrgNum] ; break ; // recover programmed Exp Group case Ignore : eExpGroupNum = eExpGroup_None ; break ; } if ( CL1fw::mg_poL1fw->apoTdm[ulTdmCardNum] != NULL ) eStatus = CL1fw::mg_poL1fw->apoTdm[ulTdmCardNum]->f_okSpTrgSelectEgFeBz ( ulRelSpTrgNum, eExpGroupNum ) ; if ( eStatus != Ok ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; } } // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::SpecTrigObeyCorrDis ( const unsigned int _uiSpTrgNum, const EIgnoreObey _eNewObeyState, const unsigned long _ulDisableNum, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; ESuccess eStatus = Ok ; unsigned long ulRelSpTrgNum ; unsigned long ulTdmCardNum ; //\\// CMessageCoorPrinter::SpecTrigObeyCorrDis ( _uiSpTrgNum, _eNewObeyState , _ulDisableNum, _poCoorCommandLine ) ; // locate the proper card index and relative object number ulTdmCardNum = _uiSpTrgNum / KiTdmTotSpTrgPerCard ; ulRelSpTrgNum = _uiSpTrgNum % KiTdmTotSpTrgPerCard ; // verify there is a level 1 framework object if ( CL1fw::mg_poL1fw == NULL ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; } // go do it else { if ( CL1fw::mg_poL1fw->apoTdm[ulTdmCardNum] != NULL ) eStatus = CL1fw::mg_poL1fw->apoTdm[ulTdmCardNum]->f_okSpTrgObeyCorrGlobalDis ( ulRelSpTrgNum, (ECorrGlobalDis)_ulDisableNum, _eNewObeyState ) ; if ( eStatus != Ok ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; } } // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::SpecTrigObeyDeCorrDis ( const unsigned int _uiSpTrgNum, const EIgnoreObey _eNewObeyState, const unsigned long _ulDisableNum, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; ESuccess eStatus = Ok ; unsigned long ulRelSpTrgNum ; unsigned long ulTdmCardNum ; //\\// CMessageCoorPrinter::SpecTrigObeyDeCorrDis ( _uiSpTrgNum, _eNewObeyState , _ulDisableNum, _poCoorCommandLine ) ; // locate the proper card index and relative object number ulTdmCardNum = _uiSpTrgNum / KiTdmTotSpTrgPerCard ; ulRelSpTrgNum = _uiSpTrgNum % KiTdmTotSpTrgPerCard ; // verify there is a level 1 framework object if ( CL1fw::mg_poL1fw == NULL ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; } // go do it else { if ( CL1fw::mg_poL1fw->apoTdm[ulTdmCardNum] != NULL ) eStatus = CL1fw::mg_poL1fw->apoTdm[ulTdmCardNum]->f_okSpTrgObeyDeCorrGlobalDis ( ulRelSpTrgNum, (EDeCorrGlobalDis)_ulDisableNum, _eNewObeyState ) ; if ( eStatus != Ok ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; } } // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::SpecTrigObeyIndivDis ( const unsigned int _uiSpTrgNum, const EIgnoreObey _eNewObeyState, const unsigned long _ulDisableNum, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; ESuccess eStatus = Ok ; unsigned long ulRelSpTrgNum ; unsigned long ulTdmCardNum ; //\\// CMessageCoorPrinter::SpecTrigObeyIndivDis ( _uiSpTrgNum, _eNewObeyState , _ulDisableNum, _poCoorCommandLine ) ; // locate the proper card index and relative object number ulTdmCardNum = _uiSpTrgNum / KiTdmTotSpTrgPerCard ; ulRelSpTrgNum = _uiSpTrgNum % KiTdmTotSpTrgPerCard ; // verify there is a level 1 framework object if ( CL1fw::mg_poL1fw == NULL ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; } // go do it else { if ( CL1fw::mg_poL1fw->apoTdm[ulTdmCardNum] != NULL ) eStatus = CL1fw::mg_poL1fw->apoTdm[ulTdmCardNum]->f_okSpTrgObeyIndivDis ( ulRelSpTrgNum, (EIndividualDis)_ulDisableNum, _eNewObeyState ) ; if ( eStatus != Ok ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; } } // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::SpecTrigAutoDisable ( const unsigned int _uiSpTrgNum, const EIgnoreObey _eNewObeyState, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; ESuccess eStatus = Ok ; unsigned long ulRelSpTrgNum ; unsigned long ulTdmCardNum ; //\\// CMessageCoorPrinter::SpecTrigAutoDisable ( _uiSpTrgNum, _eNewObeyState , _poCoorCommandLine ) ; // locate the proper card index and relative object number ulTdmCardNum = _uiSpTrgNum / KiTdmTotSpTrgPerCard ; ulRelSpTrgNum = _uiSpTrgNum % KiTdmTotSpTrgPerCard ; // verify there is a level 1 framework object if ( CL1fw::mg_poL1fw == NULL ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; } // go do it else { if ( CL1fw::mg_poL1fw->apoTdm[ulTdmCardNum] != NULL ) { eStatus = CL1fw::mg_poL1fw->apoTdm[ulTdmCardNum]->f_okSpTrgObeyAutoDis ( ulRelSpTrgNum, _eNewObeyState ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; eStatus = CL1fw::mg_poL1fw->apoTdm[ulTdmCardNum]->f_okSpTrgReEnable ( ulRelSpTrgNum ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; } if ( eStatus != Ok ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; } } // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::SpecTrigPrescale ( const unsigned int _uiSpTrgNum, const unsigned long _ulNewPrescaleRatio, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; ESuccess eStatus = Ok ; unsigned long ulRelSpTrgNum ; unsigned long ulTdmCardNum ; //\\// CMessageCoorPrinter::SpecTrigPrescale ( _uiSpTrgNum, _ulNewPrescaleRatio, _poCoorCommandLine ) ; // locate the proper card index and relative object number ulTdmCardNum = _uiSpTrgNum / KiTdmTotSpTrgPerCard ; ulRelSpTrgNum = _uiSpTrgNum % KiTdmTotSpTrgPerCard ; // verify there is a level 1 framework object if ( CL1fw::mg_poL1fw == NULL ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; } // go do it else { unsigned long ulNumCircShiftBits = 64 ; unsigned long ulAfterBurner = 1 ; double flAchievedRatio = 1.0 ; for ( int iTryNumShiftBits = 1 ; iTryNumShiftBits <= 64 ; iTryNumShiftBits++ ) { unsigned long ulTryAfterBurner ; double flTryRatio ; // we will end up with // flTryRatio = 64 * ulTryAfterBurner / iTryNumShiftBits // to determine the closest ulTryAfterBurner we do // ulTryAfterBurner = nearest integer ( iTryNumShiftBits * _ulNewPrescaleRatio / 64 ) // then we compute the effective flTryRatio // and see if got closer than before to the desired _ulNewPrescaleRatio. // Also try both upper and lower nearest integers (dumb brute force approach). ulTryAfterBurner = unsigned long ( floor ( double(iTryNumShiftBits) * double(_ulNewPrescaleRatio) / 64.0 ) ) ; flTryRatio = double(ulTryAfterBurner) / double(iTryNumShiftBits) * 64.0 ; if ( ( fabs( flTryRatio - double(_ulNewPrescaleRatio) ) < fabs( flAchievedRatio - double(_ulNewPrescaleRatio) ) ) && ( ulTryAfterBurner % 3 != 0 ) && ( ulTryAfterBurner % 53 != 0 ) && ( ulTryAfterBurner <= 1<<24 ) ) { ulNumCircShiftBits = iTryNumShiftBits ; ulAfterBurner = ulTryAfterBurner ; flAchievedRatio = flTryRatio ; } ulTryAfterBurner += 1 ; flTryRatio = double(ulTryAfterBurner) / double(iTryNumShiftBits) * 64.0 ; if ( ( fabs( flTryRatio - double(_ulNewPrescaleRatio) ) < fabs( flAchievedRatio - double(_ulNewPrescaleRatio) ) ) && ( ulTryAfterBurner % 3 != 0 ) && ( ulTryAfterBurner % 53 != 0 ) && ( ulTryAfterBurner <= 1<<24 ) ) { ulNumCircShiftBits = iTryNumShiftBits ; ulAfterBurner = ulTryAfterBurner ; flAchievedRatio = flTryRatio ; } } CConsoleAccess::WriteLine ( (CString) " Picked CircBits: " + I_to_A (ulNumCircShiftBits ) + " /AfterBurner: " + I_to_A (ulAfterBurner) + " Makes PrescRatio: " + F_to_A (flAchievedRatio,2) ) ; if ( CL1fw::mg_poL1fw->apoTdm[ulTdmCardNum] != NULL ) eStatus = CL1fw::mg_poL1fw->apoTdm[ulTdmCardNum]->f_okSpTrgPrescaleRatio ( ulRelSpTrgNum, ulNumCircShiftBits, ulAfterBurner ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; /*** This could be improved by looking if the prescaler was already enabled ***/ // Enable Prescaler control if ( CL1fw::mg_poL1fw->apoTdm[ulTdmCardNum] != NULL ) eStatus = CL1fw::mg_poL1fw->apoTdm[ulTdmCardNum]->f_okSpTrgObeyPrescaler ( ulRelSpTrgNum ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; if ( eStatus != Ok ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; } } // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::SpecTrigReEnable ( const unsigned int _uiSpTrgNum, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; ESuccess eStatus = Ok ; unsigned long ulRelSpTrgNum ; unsigned long ulTdmCardNum ; //\\// CMessageCoorPrinter::SpecTrigReEnable ( _uiSpTrgNum, _poCoorCommandLine ) ; // locate the proper card index and relative object number ulTdmCardNum = _uiSpTrgNum / KiTdmTotSpTrgPerCard ; ulRelSpTrgNum = _uiSpTrgNum % KiTdmTotSpTrgPerCard ; // verify there is a level 1 framework object if ( CL1fw::mg_poL1fw == NULL ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; } // go do it else { if ( CL1fw::mg_poL1fw->apoTdm[ulTdmCardNum] != NULL ) eStatus = CL1fw::mg_poL1fw->apoTdm[ulTdmCardNum]->f_okSpTrgReEnable ( ulRelSpTrgNum ) ; if ( eStatus != Ok ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; } } // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::SpecTrigDeallocate ( const unsigned int _uiSpTrgNum, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; ESuccess eStatus = Ok ; unsigned long ulRelSpTrgNum ; unsigned long ulTdmCardNum ; unsigned long ulAonmCardNum ; unsigned long ulFomCardNum ; unsigned long ulRelGeoSectNum ; //\\// CMessageCoorPrinter::SpecTrigDeallocate ( _uiSpTrgNum, _poCoorCommandLine ) ; // verify there is a level 1 framework object if ( CL1fw::mg_poL1fw == NULL ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; } // go do it else { // re-initialize the TDM programming ///////////////////////////////////// // locate the proper card index and relative object number ulTdmCardNum = _uiSpTrgNum / KiTdmTotSpTrgPerCard ; ulRelSpTrgNum = _uiSpTrgNum % KiTdmTotSpTrgPerCard ; if ( CL1fw::mg_poL1fw->apoTdm[ulTdmCardNum] != NULL ) eStatus = CL1fw::mg_poL1fw->apoTdm[ulTdmCardNum]->f_okSpTrgInitialize ( ulRelSpTrgNum ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; // Assert the Glogal Disable to Pause the Framework (only if we were not paused already) if ( CL1fw::mg_poL1fw->eL1FwPaused == Negated ) if ( CL1fw::mg_poL1fw->poHelpFunct->L1fw_Pause() != Ok ) eReturnStatus = Reply_Bad ; // re-initialize the Andor Term Programming //////////////////////////////////////////// // locate the proper card index and relative object number ulAonmCardNum = _uiSpTrgNum / KiAonmTotSpTrgPerCard ; ulRelSpTrgNum = _uiSpTrgNum % KiAonmTotSpTrgPerCard ; // *** NOTE the method below relies on the fact that m_axSpTrgProgr // *** has not been modified since L1FwCardAONM::Initiliaze // program the first half of the andor terms if ( CL1fw::mg_poL1fw->apoAoFiredAonm[eAoTerm_0_127][ulAonmCardNum] != NULL ) { //prepare the change eStatus = CL1fw::mg_poL1fw->apoAoFiredAonm[eAoTerm_0_127][ulAonmCardNum] ->f_okPreProgOneOutputAllInput ( ulRelSpTrgNum, &CL1fw::mg_poL1fw->apoAoFiredAonm[eAoTerm_0_127][ulAonmCardNum]->m_axSpTrgProgr[ulRelSpTrgNum] ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; //apply the change eStatus = CL1fw::mg_poL1fw->apoAoFiredAonm[eAoTerm_0_127][ulAonmCardNum] ->f_okWriteProgOneOutputAllInput ( ulRelSpTrgNum ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; } // program the second half of the andor terms if ( CL1fw::mg_poL1fw->apoAoFiredAonm[eAoTerm_128_255][ulAonmCardNum] != NULL ) { //prepare the change eStatus = CL1fw::mg_poL1fw->apoAoFiredAonm[eAoTerm_128_255][ulAonmCardNum] ->f_okPreProgOneOutputAllInput ( ulRelSpTrgNum, &CL1fw::mg_poL1fw->apoAoFiredAonm[eAoTerm_128_255][ulAonmCardNum]->m_axSpTrgProgr[ulRelSpTrgNum] ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; //apply the change eStatus = CL1fw::mg_poL1fw->apoAoFiredAonm[eAoTerm_128_255][ulAonmCardNum] ->f_okWriteProgOneOutputAllInput ( ulRelSpTrgNum ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; } // We need to remove this specific trigger to all the geographic section start digitize FOMs ///////////////////////////////////////////////////////////////////////////////////////////// for ( int iGeoSectNum = 0 ; iGeoSectNum < KiL1fwTotGeoSect ; iGeoSectNum++ ) { CL1fw::mg_poL1fw->axGeoSectSpTrgList[iGeoSectNum].aeRequirement[_uiSpTrgNum] = Ignore ; // locate the proper card index and relative object number ulFomCardNum = iGeoSectNum / KiFomTotGeoSectPerCard ; ulRelGeoSectNum = iGeoSectNum % KiFomTotGeoSectPerCard ; if ( CL1fw::mg_poL1fw->apoOutputFom[ulFomCardNum] != NULL ) { //prepare the change eStatus = CL1fw::mg_poL1fw->apoOutputFom[ulFomCardNum] ->f_okPreProgOneOutputAllInput ( ulRelGeoSectNum, (OneFomOutputProgr*) &CL1fw::mg_poL1fw->axGeoSectSpTrgList[iGeoSectNum] ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; //apply the change eStatus = CL1fw::mg_poL1fw->apoOutputFom[ulFomCardNum] ->f_okWriteProgOneOutputAllInput ( ulRelGeoSectNum ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; } } // also remove this specific trigger from the FOM++ /////////////////////////////////////////////////// CL1fw::mg_poL1fw->xGlobalSpTrgList.aeRequirement[_uiSpTrgNum] = Ignore ; if ( CL1fw::mg_poL1fw->poL1QualFomPP != NULL ) { // program the Global L1 Accept aka L1 Trigger Strobe for ( int ulFomPPChannelNum = KiFomPP_MinFpga_L1TrigSrobe ; ulFomPPChannelNum <= KiFomPP_MaxFpga_L1TrigSrobe ; ulFomPPChannelNum ++ ) { //prepare the change eStatus = CL1fw::mg_poL1fw->poL1QualFomPP ->f_okPreProgOneOutputAllInput ( ulFomPPChannelNum , (OneFomOutputProgr*) &CL1fw::mg_poL1fw->xGlobalSpTrgList ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; //apply the change eStatus = CL1fw::mg_poL1fw->poL1QualFomPP ->f_okWriteProgOneOutputAllInput ( ulFomPPChannelNum ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; } // program the skip Next One Beam Crossing resources for ( ulFomPPChannelNum = KiFomPP_MinFpga_SkipNextOneBeamX ; ulFomPPChannelNum <= KiFomPP_MaxFpga_SkipNextOneBeamX ; ulFomPPChannelNum ++ ) { //prepare the change eStatus = CL1fw::mg_poL1fw->poL1QualFomPP ->f_okPreProgOneOutputAllInput ( ulFomPPChannelNum , (OneFomOutputProgr*) &CL1fw::mg_poL1fw->xGlobalSpTrgList ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; //apply the change eStatus = CL1fw::mg_poL1fw->poL1QualFomPP ->f_okWriteProgOneOutputAllInput ( ulFomPPChannelNum ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; } // program the skip Next N Beam Crossings resources for ( ulFomPPChannelNum = KiFomPP_MinFpga_SkipNextNBeamX ; ulFomPPChannelNum <= KiFomPP_MaxFpga_SkipNextNBeamX ; ulFomPPChannelNum ++ ) { //prepare the change eStatus = CL1fw::mg_poL1fw->poL1QualFomPP ->f_okPreProgOneOutputAllInput ( ulFomPPChannelNum , (OneFomOutputProgr*) &CL1fw::mg_poL1fw->xGlobalSpTrgList ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; //apply the change eStatus = CL1fw::mg_poL1fw->poL1QualFomPP ->f_okWriteProgOneOutputAllInput ( ulFomPPChannelNum ) ; if ( eStatus != Ok ) eReturnStatus = Reply_Bad ; } } // De-Assert the Glogal Disable to Resume Triggering (only if we were not paused already) if ( CL1fw::mg_poL1fw->eL1FwPaused == Negated ) if ( CL1fw::mg_poL1fw->poHelpFunct->L1fw_Resume() != Ok ) eReturnStatus = Reply_Bad ; //verify overall success if ( eReturnStatus == Reply_Bad ) { eReturnStatus = Reply_Bad ; strcpy ( sReplyText, "" ) ; } } // clear the Exp Group programming of this specific trigger CL1fw::mg_poL1fw->aeSpTrgExpGroup[_uiSpTrgNum] = eExpGroup_None ; // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::RefSetEMEt ( const unsigned int _uiRefSetNum, TAllTriggerTowers* _xTT, const double _fdThreshold, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; //\\// CMessageCoorPrinter::RefSetEMEt ( _uiRefSetNum, _xTT, _fdThreshold, _poCoorCommandLine ) ; strcpy ( sReplyText, "" ) ; // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::RefSetHDVeto ( const unsigned int _uiRefSetNum, TAllTriggerTowers* _xTT, const double _fdThreshold, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; //\\// CMessageCoorPrinter::RefSetHDVeto ( _uiRefSetNum, _xTT, _fdThreshold, _poCoorCommandLine ) ; strcpy ( sReplyText, "" ) ; // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::RefSetTOTEt ( const unsigned int _uiRefSetNum, TAllTriggerTowers* _xTT, const double _fdThreshold, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; //\\// CMessageCoorPrinter::RefSetTOTEt ( _uiRefSetNum, _xTT, _fdThreshold, _poCoorCommandLine ) ; strcpy ( sReplyText, "" ) ; // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::RefSetLgTile ( const unsigned int _uiRefSetNum, TAllTriggerTowers* _xTT, const double _fdThreshold, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; //\\// CMessageCoorPrinter::RefSetLgTile ( _uiRefSetNum, _xTT, _fdThreshold, _poCoorCommandLine ) ; strcpy ( sReplyText, "" ) ; // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::RefSetEMEtDeallocate ( const unsigned int _uiRefSetNum, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; //\\// CMessageCoorPrinter::RefSetEMEtDeallocate ( _uiRefSetNum, _poCoorCommandLine ) ; strcpy ( sReplyText, "" ) ; // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::RefSetHDVetoDeallocate ( const unsigned int _uiRefSetNum, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; //\\// CMessageCoorPrinter::RefSetHDVetoDeallocate ( _uiRefSetNum, _poCoorCommandLine ) ; strcpy ( sReplyText, "" ) ; // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::RefSetTOTEtDeallocate ( const unsigned int _uiRefSetNum, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; //\\// CMessageCoorPrinter::RefSetTOTEtDeallocate ( _uiRefSetNum, _poCoorCommandLine ) ; strcpy ( sReplyText, "" ) ; // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::RefSetLgTileDeallocate ( const unsigned int _uiRefSetNum, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; //\\// CMessageCoorPrinter::RefSetLgTileDeallocate ( _uiRefSetNum, _poCoorCommandLine ) ; strcpy ( sReplyText, "" ) ; // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::ThresholdCountEMEt ( const unsigned int _uiRefSetNum, const unsigned int _uiComparatorNum, const unsigned int _uiThreshold, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; //\\// CMessageCoorPrinter::ThresholdCountEMEt ( _uiRefSetNum, _uiComparatorNum, _uiThreshold, _poCoorCommandLine ) ; strcpy ( sReplyText, "" ) ; // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::ThresholdCountTOTEt ( const unsigned int _uiRefSetNum, const unsigned int _uiComparatorNum, const unsigned int _uiThreshold, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; //\\// CMessageCoorPrinter::ThresholdCountTOTEt ( _uiRefSetNum, _uiComparatorNum, _uiThreshold, _poCoorCommandLine ) ; strcpy ( sReplyText, "" ) ; // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::ThresholdEnergyEMEt ( const unsigned int _uiComparatorNum, const double _fdThreshold, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; //\\// CMessageCoorPrinter::ThresholdEnergyEMEt ( _uiComparatorNum, _fdThreshold, _poCoorCommandLine ) ; strcpy ( sReplyText, "" ) ; // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::ThresholdEnergyHDEt ( const unsigned int _uiComparatorNum, const double _fdThreshold, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; //\\// CMessageCoorPrinter::ThresholdEnergyHDEt ( _uiComparatorNum, _fdThreshold, _poCoorCommandLine ) ; strcpy ( sReplyText, "" ) ; // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::ThresholdEnergyTOTEt ( const unsigned int _uiComparatorNum, const double _fdThreshold, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; //\\// CMessageCoorPrinter::ThresholdEnergyTOTEt ( _uiComparatorNum, _fdThreshold, _poCoorCommandLine ) ; strcpy ( sReplyText, "" ) ; // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; } /*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/ ECoorMessageStatus CMessageCoorExecuter::ThresholdEnergyMissPt ( const unsigned int _uiComparatorNum, const double _fdThreshold, CMessageCommandLine* _poCoorCommandLine ) { ECoorMessageStatus eReturnStatus = Reply_Ok ; char sReplyText[KiMaxLengthReplyTextToCoor] = "" ; //\\// CMessageCoorPrinter::ThresholdEnergyMissPt ( _uiComparatorNum, _fdThreshold, _poCoorCommandLine ) ; strcpy ( sReplyText, "" ) ; // append success/error to reply text if ( _poCoorCommandLine != NULL ) _poCoorCommandLine->AppendReplyText ( sReplyText ) ; if ( eReturnStatus == Ok ) CConsoleAccess::WriteLine ( sReplyText ) ; else CConsoleAccess::ErrorLine ( sReplyText ) ; return eReturnStatus ; }