00001 #include "TGet4v1Rec.h" 00002 00003 #include "TLatex.h" 00004 00005 TGet4v1Rec::TGet4v1Rec() 00006 { 00007 fRocId = 0; 00008 00009 fAUXch = 0; 00010 fMsgTypes = 0; 00011 fSysTypes = 0; 00012 fSysUserTypes = 0; 00013 fTrigger_All = 0; 00014 fTrigger_All_100 = 0; 00015 fTrigger_All_us = 0; 00016 fTrigger_All_ms = 0; 00017 fTrigger_All_s = 0; 00018 fTriggerWind = 0; // time window to assign hits to event 00019 fAUXWind = 0; // time window to assign AUX to event 00020 fEvntMultipl = 0; // event multiplicity in time window after trigger signal 00021 00022 fLastTm = 0; // 00023 fLastTriggerTm = 0; 00024 00025 for (int n=0;n<MAX_AUX;n++) fLastAuxTm[n] = 0; 00026 for (int n=0;n<MAX_SYNC;n++) { 00027 fLastSyncTm[n] = 0; 00028 fLastSyncId[n] = 0; 00029 } 00030 fStartSyncTm = 0; 00031 fStopSyncTm = 0; 00032 00033 for (int aux=0;aux<MAX_AUX;aux++) 00034 fAUXt[aux] = 0; // time distribution of aux signals 00035 for (int n=0;n<MAX_SYNC;n++) 00036 { 00037 fSYNCt[n] = 0; // time distribution of sync signals 00038 fSyncLongT[n] = 0; // time distribution of sync signals 00039 } 00040 fALLt = 0; 00041 fDATAt = 0; 00042 fERRORt = 0; 00043 fSLOWCt = 0; 00044 fSelfTriggT = 0; 00045 fEPOCHt = 0; 00046 fAllSelectedT = 0; 00047 00048 // Long duration time distribution (1 min. bin, 10 days length) 00049 fAllLongT = 0; 00050 fDataLongT = 0; 00051 fErrorLongT = 0; 00052 fSlowCLongT = 0; 00053 fSelfTriggLongT = 0; 00054 fEpochLongT = 0; 00055 fAllEpoch2LongT = 0; 00056 fAllSelLongT = 0; 00057 00058 fUnprocessedMsg.clear(); 00059 00060 fDabcSeparator=-1; 00061 00062 bIgnoreData = kFALSE; 00063 fIgnoreCnt = 0; 00064 fIgnoreTime = 0; // time when ignore message was generated 00065 fCollectTime = 0; // time when collect message was generated 00066 00068 /*************************************/ 00069 00070 /* Modified part */ 00071 00072 // Epochs 00073 fuCurrEpoch = 0; // current epoch on the roc 00074 fuEpochCycle = 0; // Number of time the epoch counter cycled 00075 for( Int_t iGet4 = 0; iGet4 < MAX_GET4_PER_ROC; iGet4++) 00076 { 00077 fEPOCH2t[iGet4] = 0; 00078 fuCurrEpoch2[iGet4] = 0; // current epoch2 for each get4 chip 00079 fuEpoch2Cycle[iGet4] = 0; // Number of time the epoch2 counter cycled 00080 fiEpochShift[iGet4] = 0; 00081 fuNbShiftedEpochs[iGet4] = 0; 00082 fEpochShiftsDuration[iGet4] = 0; 00083 fuEpochWithData[iGet4] = 0; // Data flag for suppressed epoch mode 00084 fEpSuppBuffer[iGet4].clear(); // temp buffer in supp epoch mode to wait for epoch message 00085 } 00086 fDistribEpochs = 0; 00087 fDistribEpochs2 = 0; 00088 fEpochShiftsPerChip = 0; 00089 fEpochShiftsDurationPerChip = 0; 00090 00091 // Buffers 00092 fbBufferWithLastFullEpoch = kFALSE; 00093 fPrevEpochsBuffer[0].clear(); // buffer of all ROC messages in current epoch and previous one 00094 fPrevEpochsBuffer[1].clear(); // buffer of all ROC messages in current epoch and previous one 00095 fbEpochSinceTrigger = kFALSE; 00096 for( Int_t iGet4 = 0; iGet4 < MAX_GET4_PER_ROC; iGet4++) 00097 { 00098 fbBufferWithLastFullEpoch2[iGet4] = kFALSE; 00099 fPrevEpochs2Buffer[iGet4][0].clear(); // buffer of all get4 messages in current epoch and previous one 00100 fPrevEpochs2Buffer[iGet4][1].clear(); // buffer of all get4 messages in current epoch and previous one 00101 bLookInPreviousEpoch[iGet4] = kFALSE; 00102 bLookInNextEpoch[iGet4] = kFALSE; 00103 fbEpoch2SinceTrigger[iGet4]= kFALSE; 00104 00105 for( Int_t iGet4Chan = 0; iGet4Chan < NB_CHAN_GET4; iGet4Chan++) 00106 { 00107 fSelectedT[iGet4][iGet4Chan] = 0; 00108 fTrigger_Get4Channel[iGet4][iGet4Chan] = 0; 00109 fTriggerMs_Get4Channel[iGet4][iGet4Chan] = 0; 00110 fTriggerS_Get4Channel[iGet4][iGet4Chan] = 0; 00111 fbDllFlag[iGet4][iGet4Chan] = kFALSE; 00112 00113 fbDataTimeOut[iGet4][iGet4Chan] = kFALSE; 00114 fbDataFallingOut[iGet4][iGet4Chan] = kFALSE; 00115 00116 fLastExtMess[iGet4][iGet4Chan].Clear(); 00117 } // for( Int_t iGet4Chan = 0; iGet4Chan < NB_CHAN_GET4; iGet4Chan++) 00118 fGet4V1HitsDistanceNs[iGet4] = 0; 00119 fGet4V1HitsDistanceUs[iGet4] = 0; 00120 fGet4V1HitsDistanceMs[iGet4] = 0; 00121 fGet4V1HitsDistanceS[iGet4] = 0; 00122 } // for( Int_t iGet4 = 0; iGet4 < MAX_GET4_PER_ROC; iGet4++) 00123 fb24bitsReadoutDetected = kFALSE; 00124 fb32bitsReadoutDetected = kFALSE; 00125 00126 // HitsSelection 00127 fbSelectionRocDone = kTRUE; 00128 for( Int_t iGet4 = 0; iGet4 < MAX_GET4_PER_ROC; iGet4++) 00129 { 00130 fbSelectionDone[iGet4] = kTRUE; 00131 } 00132 00133 // Triggering on data themselves 00134 fDataSelfTriggerPerEvent = 0; 00135 fDataSelfTrigDistanceNs = 0; 00136 fDataSelfTrigDistanceUs = 0; 00137 fDataSelfTrigDistanceMs = 0; 00138 fDataSelfTrigDistanceS = 0; 00139 for( Int_t iTrigger = 0; iTrigger < MAX_DATA_TRIGG; iTrigger++) 00140 { 00141 fuDataSelfTriggerCount[iTrigger] = 0; 00142 fdLastFullTimeSelfTrigger[iTrigger] = 0; 00143 fextMessLastMainChannel[iTrigger].Clear(); 00144 fdLastFullTimeMainChannelTot[iTrigger] = 0; 00145 for( Int_t iSecTriggerChan = 0; iSecTriggerChan < MAX_SEC_TRIG; iSecTriggerChan++) 00146 { 00147 fdLastFullTimeSecChannel[iTrigger][iSecTriggerChan] = 0; 00148 fdLastFullTimeSecChannelTot[iTrigger][iSecTriggerChan] = 0; 00149 } 00150 } 00151 00152 // Event statistics 00153 fNbEventsPerMbsEvent = 0; 00154 fNbNotEmptyEventsPerMbsEvent = 0; 00155 fChannelsMapping = 0; 00156 fChannelInputMessCount = 0; 00157 fChannelMultiplicity = 0; 00158 fdRateEvolutionBinSize = 0; 00159 for( Int_t iGet4 = 0; iGet4 < MAX_GET4_PER_ROC; iGet4++) 00160 { 00161 fuNbHitsChipEpoch[iGet4] = 0; 00162 fChipRateEvolution[iGet4] = 0; 00163 for( Int_t iGet4Chan = 0; iGet4Chan < NB_CHAN_GET4; iGet4Chan++) 00164 { 00165 fChannelRateEvolution[iGet4][iGet4Chan] = 0; 00166 } // for( Int_t iGet4Chan = 0; iGet4Chan < NB_CHAN_GET4; iGet4Chan++) 00167 } // for( Int_t iGet4 = 0; iGet4 < MAX_GET4_PER_ROC; iGet4++) 00168 00169 } 00170 00171 ULong64_t TGet4v1Rec::GetFullEpochNumber() 00172 { 00173 return (ULong64_t)(fuCurrEpoch) + 00174 ( (ULong64_t)(MAIN_EPOCH_CYCLE_SIZE) +1)*(ULong64_t)(fuEpochCycle); 00175 } 00176 ULong64_t TGet4v1Rec::GetFullEpoch2Number( UInt_t uGet4Id) 00177 { 00178 return (ULong64_t)(fuCurrEpoch2[uGet4Id]) + 00179 ( (ULong64_t)(GET4_EPOCH_CYCLE_SIZE) +1)*(ULong64_t)(fuEpoch2Cycle[uGet4Id]); 00180 } 00181 00182 // Functions to overcome the 32 bit limit in epoch number as input to 00183 // GetMessageFullTime function 00184 00185 ULong64_t TGet4v1Rec::GetSuperCycleEpOffset( ) 00186 { 00187 // Nb of epoch lost by MessageTime function due to 32b limit 00188 // ULong64_t ulNb32bCycles = GetFullEpochNumber() / ( 0x100000000ULL ); 00189 ULong64_t ulNb32bCycles = GetFullEpochNumber() >> 32; 00190 if( 0 < ulNb32bCycles) 00191 return (ULong64_t)( ulNb32bCycles * ( 0x100000000ULL ) )<<14; // epoch nb lost due to 32 bit limit, shifted in ns 00192 else return 0; 00193 } 00194 ULong64_t TGet4v1Rec::GetSuperCycleEp2Offset( UInt_t uGet4Id) 00195 { 00196 // Nb of epoch lost by MessageTime function due to 32b limit 00197 // ULong64_t ulNb32bCycles = GetFullEpoch2Number( uGet4Id) / ( 0x100000000ULL ); 00198 ULong64_t ulNb32bCycles = GetFullEpoch2Number( uGet4Id) >> 32; 00199 if( 0 < ulNb32bCycles) 00200 return (ULong64_t)( ulNb32bCycles * ( 0x100000000ULL ) )* // epoch nb lost due to 32 bit limit 00201 (ULong64_t)( GET4_EPOCH_IN_PS / 1000 ); // Get4 epoch in ns 00202 return 0; 00203 } 00204 Double_t TGet4v1Rec::GetSuperCycleEp2OffsetD( UInt_t uGet4Id) 00205 { 00206 // Nb of epoch lost by MessageTime function due to 32b limit 00207 // ULong64_t ulNb32bCycles = GetFullEpoch2Number( uGet4Id) / ( 0x100000000ULL ); 00208 ULong64_t ulNb32bCycles = GetFullEpoch2Number( uGet4Id) >> 32; 00209 if( 0 < ulNb32bCycles) 00210 return (Double_t)( ulNb32bCycles * ( 0x100000000ULL ) )* // epoch nb lost due to 32 bit limit 00211 (Double_t)( GET4_EPOCH_IN_PS) / 1000.0 ; // Get4 epoch in ns 00212 return 0.0; 00213 }