// ------------------------------------------------------------------ // ----- TGet4v1Rec.h ----- // ----- Created 22/07/2013 by P.-A. Loizeau ----- // ----- Adapted from TGet4v1Rec.h ----- // ----- in RocLib/beamtime/tof-tdctest rev.4862 ----- // ------------------------------------------------------------------ #include "TGet4v1Param.h" #include "Riostream.h" #include using std::cout; using std::endl; TGet4v1Param::TGet4v1Param(): TNamed("", "TGet4v1Param"), numRocs (0), noTrigger (kTRUE), triggerSignal (0), globalTrigger (kFALSE), masterRoc (77777), maxBufferTriggers (10), maxBufferLoops (10), doSorting (kFALSE), bGet4Debug (kFALSE), bTriggerAfterData (kFALSE), iEventNbGap (-1), uEventNbCycle (0), uSyncCycleSize (0), bSuppressedEpochs (kFALSE), bLongTimeHistos (kFALSE), uRocCycleSize (0), uMainSyncCycleSize (0), uNbRocsGet4 (0), uNbGet4 (0), uSilentMode (0), uDebugHistoOn (0), uDebugPrintOn (0), uGet4Print (0), uNbTriggerChan (0), uCoincidenceWinSize(0), b32bReadoutModeGet4v1 (kFALSE), dMaxTot (300000.0), bTotHistoEnable (kFALSE), bDebugHistoEnable (kFALSE), uNbEventsDnlUpdate (1000), uGet4TimeDiffChip1 (0), uGet4TimeDiffChip2 (0), bChannelRateHistoEnable (kFALSE), bChipRateHistoEnable (kFALSE), bRawDataMode (kFALSE), bFreeStreaming (kFALSE), uNbTriggers (0), dDeadTime (0.0), bAllowEventMixing (kFALSE), iMainReferenceTdc (-1), iReference1Channel (-1), iReference2Channel (-1) { // numRocs = 0; for (UInt_t roc=0;roc Blind mode! uDebugHistoOn = 0; // No Online Change - Enable/Disable general debug histograms uDebugPrintOn = 0; // Number of data messages to be printed on screen for debug uGet4Print = 0; // Number of data messages to be printed on screen for debug */ /************* GET4 v1.x debug *******/ /* dMaxTot = 300000.0; // Maximal allowed Tot for 24 bits hit building, in ps bTotHistoEnable = kFALSE; // Enable Tot histograms bDebugHistoEnable = kFALSE; // Enable the time difference, finetime and DNL histograms uNbEventsDnlUpdate = 1000; // Nb of events between 2 updates of the DNL histograms uGet4TimeDiffChip1 = 0; // Index of first chip to be used for time difference histos uGet4TimeDiffChip2 = 0; // Index of first chip to be used for time difference histos bChannelRateHistoEnable = kFALSE; // Enable Rate histograms for each channel bChipRateHistoEnable = kFALSE; // Enable Rate histograms for each chip */ /*************************************/ /*********** free-streaming **********/ /* bRawDataMode = kFALSE; // kFALSE = DABC data format, 1 SYNC/Event, kTRUE = RAW DATA format, all messages bFreeStreaming = kFALSE; // kFALSE = Sync trigger/no trigger, kTRUE= online detection/selection from data */ /*************************************/ for (UInt_t n=0;n not hardware map !) uGet4EdgeInversion[n] = 0; // Edges inversion: affect all channels of a GET4 chip } /* iMainReferenceTdc = -1; // No Online Change - TDC used for the reference signals profiles in Detector classes, -1 disable it iReference1Channel = -1; // No Online Change - Channel used for the 1st reference histogram in Detector classes, -1 disable it iReference2Channel = -1; // No Online Change - Channel used for the 2nd reference histogram in Detector classes, -1 disable it */ } TGet4v1Param::TGet4v1Param(const char* name): TNamed(name, "TGet4v1Param"), numRocs (0), noTrigger (kTRUE), triggerSignal (0), globalTrigger (kFALSE), masterRoc (77777), maxBufferTriggers (10), maxBufferLoops (10), doSorting (kFALSE), bGet4Debug (kFALSE), bTriggerAfterData (kFALSE), iEventNbGap (-1), uEventNbCycle (0), uSyncCycleSize (0), bSuppressedEpochs (kFALSE), bLongTimeHistos (kFALSE), uRocCycleSize (0), uMainSyncCycleSize (0), uNbRocsGet4 (0), uNbGet4 (0), uSilentMode (0), uDebugHistoOn (0), uDebugPrintOn (0), uGet4Print (0), uNbTriggerChan (0), uCoincidenceWinSize(0), b32bReadoutModeGet4v1 (kFALSE), dMaxTot (300000.0), bTotHistoEnable (kFALSE), bDebugHistoEnable (kFALSE), uNbEventsDnlUpdate (1000), uGet4TimeDiffChip1 (0), uGet4TimeDiffChip2 (0), bChannelRateHistoEnable (kFALSE), bChipRateHistoEnable (kFALSE), bRawDataMode (kFALSE), bFreeStreaming (kFALSE), uNbTriggers (0), dDeadTime (0.0), bAllowEventMixing (kFALSE), iMainReferenceTdc (-1), iReference1Channel (-1), iReference2Channel (-1) { // numRocs = 4; for (UInt_t rocid=0;rocid Blind mode! uDebugHistoOn = 0; // No Online Change - Enable/Disable general debug histograms uDebugPrintOn = 0; // Number of data messages to be printed on screen for debug uGet4Print = 0; // Number of data messages to be printed on screen for debug */ /************* GET4 v1.x debug *******/ /* dMaxTot = 300000.0; // Maximal allowed Tot for 24 bits hit building, in ps bTotHistoEnable = kFALSE; // Enable Tot histograms bDebugHistoEnable = kFALSE; // Enable the time difference, finetime and DNL histograms uNbEventsDnlUpdate = 1000; // Nb of events between 2 updates of the DNL histograms uGet4TimeDiffChip1 = 0; // Index of first chip to be used for time difference histos uGet4TimeDiffChip2 = 0; // Index of first chip to be used for time difference histos bChannelRateHistoEnable = kFALSE; // Enable Rate histograms for each channel bChipRateHistoEnable = kFALSE; // Enable Rate histograms for each chip */ /*************************************/ /*********** free-streaming **********/ /* bRawDataMode = kFALSE; // kFALSE = DABC data format, 1 SYNC/Event, kTRUE = RAW DATA format, all messages bFreeStreaming = kFALSE; // kFALSE = Sync trigger/no trigger, kTRUE= online detection/selection from data */ /*************************************/ for (UInt_t n=0;n not hardware map !) uGet4EdgeInversion[n] = 0; // Edges inversion: affect all channels of a GET4 chip } /* iMainReferenceTdc = -1; // No Online Change - TDC used for the reference signals profiles in Detector classes, -1 disable it iReference1Channel = -1; // No Online Change - Channel used for the 1st reference histogram in Detector classes, -1 disable it iReference2Channel = -1; // No Online Change - Channel used for the 2nd reference histogram in Detector classes, -1 disable it */ } TGet4v1Param::~TGet4v1Param() { SetNbRocsGet4(0); SetNbGet4(0); } // Roc functions Bool_t TGet4v1Param::SetConfigRocs() { /* for (UInt_t rocid=0;rocid get4v10::kuMaxRoc) uNbRocsGet4 = get4v10::kuMaxRoc; if (uNbRocsGet4==0) return; for (unsigned n=0;n=0 ? id*get4v10::kuMaxGet4Roc : 0; } void TGet4v1Param::SetNbGet4(UInt_t num) { uNbGet4 = num; if (uNbGet4>get4v10::kuMaxGet4) uNbGet4 = get4v10::kuMaxGet4; if (uNbGet4==0) return; for(UInt_t uGet4Index = 0; uGet4Index < uNbGet4; uGet4Index++) { // No Online Change - Get4 Mapping: there should be always at least 2*nbfeets entries here uGet4Mapping[uGet4Index] = uGet4Index; // Activated Get4 chips (indexes after remapping => not hardware map !) uGet4Active[uGet4Index] = 0; // Edges inversion: affect all channels of a GET4 chip uGet4EdgeInversion[uGet4Index] = 0; } } UInt_t TGet4v1Param::RemapGet4Chip(UInt_t uChip) const { for(UInt_t temp_index = 0; temp_index < uNbGet4; temp_index++) if( uChip == uGet4Mapping[temp_index]) return temp_index; return uNbGet4; } UInt_t TGet4v1Param::RemapGet4Chip(UInt_t roc, UInt_t uChip) const { for(UInt_t temp_index = 0; temp_index < uNbGet4; temp_index++) if( DefineGet4IndexOffset(roc)+uChip == uGet4Mapping[temp_index]) return temp_index; return uNbGet4; } // Data Triggering /** Return -1 if not a main channel for any trigger, trigger number otherwise */ Int_t TGet4v1Param::IsTriggerMainChannel( UInt_t tdc, UInt_t channel ) { for( UInt_t uTrigger = 0; uTrigger < uNbTriggers; uTrigger++) { if( tdc == uMainSelectionTdc[uTrigger] && channel == uMainSelectionChannel[uTrigger]) return uTrigger; } // for( UInt_t uTrigger = 0; uTrigger < uNbTriggers; uTrigger++) return -1; } /** Return -1 if not a secondary channel for any trigger, trigger number otherwise */ Int_t TGet4v1Param::IsTriggerSecChannel( UInt_t tdc, UInt_t channel ) { for( UInt_t uTrigger = 0; uTrigger < uNbTriggers; uTrigger++) { if( 0 < uNbSecondarySelectionCh[uTrigger]) { for(UInt_t uSecondary = 0; uSecondary < uNbSecondarySelectionCh[uTrigger]; uSecondary++) if( tdc == uSecondarySelectionTdc[uTrigger][uSecondary] && channel == uSecondarySelectionChannel[uTrigger][uSecondary] ) return uTrigger; } // if( 0 < uNbSecondarySelectionCh[iTrigger]) } // for( UInt_t uTrigger = 0; uTrigger < uNbTriggers; uTrigger++) return -1; } /** Return secondary channel index if the group (trigger, tdc, channel) match, -1 otherwise */ Int_t TGet4v1Param::GetSecChannelIndex( UInt_t uTrigger, UInt_t tdc, UInt_t channel ) { if( 0 < uNbSecondarySelectionCh[uTrigger]) { for(UInt_t iSecondary = 0; iSecondary < uNbSecondarySelectionCh[uTrigger]; iSecondary++) if( tdc == uSecondarySelectionTdc[uTrigger][iSecondary] && channel == uSecondarySelectionChannel[uTrigger][iSecondary] ) return iSecondary; } // if( 0 < uNbSecondarySelectionCh[uTrigger]) return -1; } Bool_t TGet4v1Param::IsMainOfThisTrigger( UInt_t uTrigger, UInt_t tdc, UInt_t channel ) { if( tdc == uMainSelectionTdc[uTrigger] && channel == uMainSelectionChannel[uTrigger]) return kTRUE; else return kFALSE; } Bool_t TGet4v1Param::IsSecOfThisTrigger( UInt_t uTrigger, UInt_t tdc, UInt_t channel ) { for(UInt_t iSecondary = 0; iSecondary < uNbSecondarySelectionCh[uTrigger]; iSecondary++) if( tdc == uSecondarySelectionTdc[uTrigger][iSecondary] && channel == uSecondarySelectionChannel[uTrigger][iSecondary] ) return kTRUE; return kFALSE; } Bool_t TGet4v1Param::PrintGet4Options() { cout<<"*************************************************"< "; for(UInt_t temp_index = 0; temp_index < uNbRocsGet4; temp_index++) { cout.width(2); cout< "; for(UInt_t temp_index = 0; temp_index < uNbGet4; temp_index++) { cout.width(2); cout< "; for(UInt_t temp_index = 0; temp_index < uNbGet4; temp_index++) { cout.width(2); cout< "; for(UInt_t temp_index = 0; temp_index < uNbGet4; temp_index++) { cout.width(2); cout< "; for(UInt_t temp_index = 0; temp_index < uNbSecondarySelectionCh[uTrigger]; temp_index++) { cout.width(3); cout< "; for(UInt_t temp_index = 0; temp_index < uNbSecondarySelectionCh[uTrigger]; temp_index++) { cout.width(3); cout<