• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

beamtime/gsi-aug12/get4v10/go4/GET4V10/TGet4v1Param.cxx (r4864/r3846)

Go to the documentation of this file.
00001 #include "TGet4v1Param.h"
00002 
00003 #include "TGo4Version.h"
00004 #if __GO4BUILDVERSION__ > 40502
00005 #include "go4iostream.h"
00006 #else
00007 #include "Riostream.h"
00008 #endif
00009 
00010 
00011 
00012 TGet4v1Param::TGet4v1Param() : TGo4Parameter()
00013 {
00014    numRocs = 0;
00015    for (int roc=0;roc<MAX_ROC;roc++) {
00016       activeRoc[roc] = kFALSE;
00017       timeScale[roc] = 1.0;
00018       timeShift[roc] = 0;
00019       uGet4RocsMapping[roc] = 0;
00020    }
00021    noTrigger = kTRUE;  // ignore trigger window and take all messages with initial event division
00022    triggerSignal = 0; // 0 .. 3 is AUXs, 10-11 is SYNCs
00023    globalTrigger = kFALSE; // true for selecting messages under global corrected time window, false for using separate windows for each roc
00024    masterRoc = 77777; // id number of ROC which is time/trigger reference, big number is disable master roc
00025    maxBufferTriggers=10;
00026    maxBufferLoops=10;
00027    doSorting = kFALSE;  // perform time sorting of messages
00028    bGet4Debug = kFALSE;
00029 
00030    bTriggerAfterData = kFALSE;
00031 
00033    iEventNbGap    = -1;      // -1 = check Off, Gap in event nember between get4 events
00034    uSyncCycleSize = 0;       // No Online Change - Size of the synchronization cycle in epochs
00035    uRocCycleSize  = 0;       // No Online Change - Size of roc epoch counter cycle in epochs
00036    uMainSyncCycleSize = 0;   // No Online Change - Size of the synchronization cycle in Main clock (250MHz) epochs
00037    uNbRocsGet4 = 0;          // No Online Change - Nb of Rocs "GET4" in setup
00038    uNbGet4 = 0;             // No Online Change - Total Nb of active FEET boards in setup
00039    uSilentMode = 0;          // Remove all printouts => Blind mode!
00040    uDebugHistoOn = 0;        // No Online Change - Enable/Disable general debug histograms
00041    uDebugPrintOn = 0;        // Number of data messages to be printed on screen for debug
00042    uGet4Print = 0;           // Number of data messages to be printed on screen for debug
00043 
00044    /************* GET4 v1.x debug *******/
00045    bTotHistoEnable    = kFALSE;         // Enable Tot histograms
00046    bDebugHistoEnable  = kFALSE;       // Enable the time difference, finetime and DNL histograms
00047    uNbEventsDnlUpdate = 1000;      // Nb of events between 2 updates of the DNL histograms
00048    uGet4TimeDiffChip1 = 0;   // Index of first chip to be used for time difference histos
00049    uGet4TimeDiffChip2 = 0;   // Index of first chip to be used for time difference histos
00050    /*************************************/
00051 
00052    for (int n=0;n<MAX_GET4;n++) {
00053       uGet4Mapping[n] = 0; // No Online Change - Get4 Mapping: there should be always at least 2*nbfeets entries here
00054       uGet4Active[n] = 0; // Activated Get4 chips (indexes after remapping => not hardware map !)
00055       uGet4EdgeInversion[n] = 0;   // Edges inversion: affect all channels of a GET4 chip
00056    }
00057 }
00058 
00059 
00060 
00061 TGet4v1Param::TGet4v1Param(const char* name) : TGo4Parameter(name)
00062 {
00063    numRocs = 4;
00064    for (UInt_t rocid=0;rocid<MAX_ROC; rocid++) {
00065       if(rocid<numRocs)
00066          activeRoc[rocid]=kTRUE;
00067       else
00068          activeRoc[rocid]=kFALSE;
00069 
00070       timeScale[rocid]=1.0;
00071       timeShift[rocid]=0;
00072    }
00073 
00074    globalTrigger = true;
00075    
00076    // use AUX2 as default trigger signal, while it is external trigger input for ROC
00077    triggerSignal = 2;
00078    noTrigger = kFALSE;
00079    masterRoc = 0;
00080    maxBufferTriggers=10;
00081    maxBufferLoops=10;
00082    doSorting = kTRUE;
00083    bGet4Debug = kFALSE;
00084 
00085    bTriggerAfterData = kFALSE;
00086 
00088    iEventNbGap    = -1;      // -1 = check Off, Gap in event nember between get4 events
00089    uSyncCycleSize = 0;       // No Online Change - Size of the synchronization cycle in epochs
00090    uRocCycleSize  = 0;       // No Online Change - Size of roc epoch counter cycle in epochs
00091    uMainSyncCycleSize = 0;   // No Online Change - Size of the synchronization cycle in Main clock (250MHz) epochs
00092    uNbRocsGet4 = 0;          // No Online Change - Nb of Rocs "GET4" in setup
00093    uNbGet4 = 0;             // No Online Change - Total Nb of active FEET boards in setup
00094    uSilentMode = 0;          // Remove all printouts => Blind mode!
00095    uDebugHistoOn = 0;        // No Online Change - Enable/Disable general debug histograms
00096    uDebugPrintOn = 0;        // Number of data messages to be printed on screen for debug
00097    uGet4Print = 0;           // Number of data messages to be printed on screen for debug
00098 
00099    /************* GET4 v1.x debug *******/
00100    dMaxTot            = 300000.0;  // Maximal allowed Tot for 24 bits hit building, in ps
00101    bTotHistoEnable    = kFALSE;         // Enable Tot histograms
00102    bDebugHistoEnable  = kFALSE;       // Enable the time difference, finetime and DNL histograms
00103    uNbEventsDnlUpdate = 1000;      // Nb of events between 2 updates of the DNL histograms
00104    uGet4TimeDiffChip1 = 0;   // Index of first chip to be used for time difference histos
00105    uGet4TimeDiffChip2 = 0;   // Index of first chip to be used for time difference histos
00106    /*************************************/
00107 
00108    for (int n=0;n<MAX_GET4;n++) {
00109       uGet4Mapping[n] = 0; // No Online Change - Get4 Mapping: there should be always at least 2*nbfeets entries here
00110       uGet4Active[n] = 0; // Activated Get4 chips (indexes after remapping => not hardware map !)
00111       uGet4EdgeInversion[n] = 0;   // Edges inversion: affect all channels of a GET4 chip
00112    }
00113 }
00114 
00115 TGet4v1Param::~TGet4v1Param()
00116 {
00117    SetNbRocsGet4(0);
00118 
00119    SetNbGet4(0);
00120 }
00121 
00122 Bool_t TGet4v1Param::UpdateFrom(TGo4Parameter* rhs)
00123 {
00124    cout <<"TGet4v1Param::UpdateFrom" << endl;
00125    if(!TGo4Parameter::UpdateFrom(rhs)) return kFALSE;
00126    for (UInt_t rocid=0;rocid<MAX_ROC; rocid++) {
00127       if(rocid>=numRocs) activeRoc[rocid]=kFALSE;
00128    }
00129    return SetConfigRocs();
00130 }
00131 
00132 
00133 Bool_t TGet4v1Param::SetConfigRocs()
00134 {
00135    /*
00136    for (UInt_t rocid=0;rocid<MAX_ROC; rocid++)
00137    {
00138       TGet4v1Event::ConfigRocs[rocid] = rocid < numRocs ? (UInt_t) activeRoc[rocid] : 0;
00139       cout <<"TGet4v1Param::SetConfigRocs sets rocid " << rocid << " to active:" << TGet4v1Event::ConfigRocs[rocid] << endl;
00140    }
00141    */
00142    return kTRUE;
00143 }
00144 
00145 void TGet4v1Param::SetNbRocsGet4(UInt_t num)
00146 {
00147    uNbRocsGet4 = num;
00148 
00149    if (uNbRocsGet4 > MAX_ROC) uNbRocsGet4 = MAX_ROC;
00150 
00151    if (uNbRocsGet4==0) return;
00152    for (unsigned n=0;n<uNbRocsGet4;n++)
00153       uGet4RocsMapping[n] = n;
00154 }
00155 
00156 Int_t TGet4v1Param::FindGet4RocId(UInt_t rocid) const
00157 {
00158    for(Int_t iGet4Roc=0; iGet4Roc < (Int_t)uNbRocsGet4; iGet4Roc++)
00159       if(rocid == uGet4RocsMapping[iGet4Roc]) return iGet4Roc;
00160 
00161    return -1;
00162 }
00163 
00164 UInt_t TGet4v1Param::DefineGet4IndexOffset(UInt_t rocid) const
00165 {
00166    Int_t id = FindGet4RocId(rocid);
00167    return id>=0 ? id*MAX_GET4_PER_ROC : 0;
00168 }
00169 
00170 void TGet4v1Param::SetNbGet4(UInt_t num)
00171 {
00172 
00173    uNbGet4  = num;
00174    if (uNbGet4>MAX_GET4) uNbGet4 = MAX_GET4;
00175 
00176    if (uNbGet4==0) return;
00177 
00178    for(UInt_t uGet4Index = 0; uGet4Index < uNbGet4; uGet4Index++) {
00179       // No Online Change - Get4 Mapping: there should be always at least 2*nbfeets entries here
00180       uGet4Mapping[uGet4Index]       = uGet4Index;
00181       // Activated Get4 chips (indexes after remapping => not hardware map !)
00182       uGet4Active[uGet4Index]        = 0;
00183       // Edges inversion: affect all channels of a GET4 chip
00184       uGet4EdgeInversion[uGet4Index] = 0;
00185    }
00186 }
00187 
00188 UInt_t TGet4v1Param::RemapGet4Chip(UInt_t uChip) const
00189 {
00190    for(UInt_t temp_index = 0; temp_index < uNbGet4; temp_index++)
00191       if( uChip == uGet4Mapping[temp_index]) return temp_index;
00192    return uNbGet4;
00193 }
00194 UInt_t TGet4v1Param::RemapGet4Chip(UInt_t roc, UInt_t uChip) const
00195 {
00196    for(UInt_t temp_index = 0; temp_index < uNbGet4; temp_index++)
00197       if( DefineGet4IndexOffset(roc)+uChip == uGet4Mapping[temp_index]) return temp_index;
00198    return uNbGet4;
00199 }
00200 
00201 Bool_t TGet4v1Param::PrintGet4Options()
00202 {
00203    cout<<"*************************************************"<<endl;
00204    cout<<"       Option values"<<endl;
00205    cout<<"Trigger after data:      "<<bTriggerAfterData<<endl;
00206    cout<<"Event index gap:         "<<iEventNbGap<<endl;
00207    cout<<"Sync cycle size:         "<<uSyncCycleSize<<" Epochs (1 synch + "<<(uSyncCycleSize-1)<<" Unsynched)"<<endl;
00208    cout<<"Sync cycle size (Main):  "<<uMainSyncCycleSize<<" Epochs (1 synch + "<<(uMainSyncCycleSize-1)<<" Unsynched)"<<endl;
00209    cout<<"Nb ROC-GET4   :          "<<uNbRocsGet4<<endl;
00210    cout<<"Rocs Mapping  :  |-      ";
00211    for(UInt_t temp_index = 0; temp_index < uNbRocsGet4; temp_index++)
00212    {
00213       cout.width(2);
00214       cout<<uGet4RocsMapping[temp_index]<<" ";
00215    }
00216    cout<<endl<<"                 |->     ";
00217    for(UInt_t temp_index = 0; temp_index < uNbRocsGet4; temp_index++)
00218    {
00219       cout.width(2);
00220       cout<<temp_index<<" ";
00221    }
00222    cout<<endl;
00223    cout<<"Nb GET4 chips:           "<<uNbGet4<<endl;
00224    cout<<"Get4 Mapping  :  |-      ";
00225    for(UInt_t temp_index = 0; temp_index < uNbGet4; temp_index++)
00226    {
00227       cout.width(2);
00228       cout<<uGet4Mapping[temp_index]<<" ";
00229    }
00230    cout<<endl<<"                 |->     ";
00231    for(UInt_t temp_index = 0; temp_index < uNbGet4; temp_index++)
00232    {
00233       cout.width(2);
00234       cout<<temp_index<<" ";
00235    }
00236    cout<<endl;
00237    cout<<"Get4 Activated:  |-      ";
00238    for(UInt_t temp_index = 0; temp_index < uNbGet4; temp_index++)
00239    {
00240       cout.width(2);
00241       cout<<temp_index<<" ";
00242    }
00243    cout<<endl<<"                 |->     ";
00244    for(UInt_t temp_index = 0; temp_index < uNbGet4; temp_index++)
00245    {
00246       cout.width(2);
00247       cout<<uGet4Active[temp_index]<<" ";
00248    }
00249    cout<<endl;
00250    cout<<"Get4 Inversion:  |-      ";
00251    for(UInt_t temp_index = 0; temp_index < uNbGet4; temp_index++)
00252    {
00253       cout.width(2);
00254       cout<<temp_index<<" ";
00255    }
00256    cout<<endl<<"                 |->     ";
00257    for(UInt_t temp_index = 0; temp_index < uNbGet4; temp_index++)
00258    {
00259       cout.width(2);
00260       cout<<uGet4EdgeInversion[temp_index]<<" ";
00261    }
00262    cout<<endl;
00263    cout<<"Nb Get4 message printed: "<<uGet4Print<<endl;
00264    if( 1 == uSilentMode )
00265       cout<<"Silent Mode                 :    ON "<<endl;
00266       else cout<<"Silent Mode                 :    OFF"<<endl;
00267    if( 1 == uDebugHistoOn )
00268       cout<<"Debug Histograms:                ON "<<endl;
00269       else cout<<"Debug Histograms:                OFF"<<endl;
00270    if( 1 == uDebugPrintOn )
00271       cout<<"Debug Printout:                  ON "<<endl;
00272       else cout<<"Debug Printout:                  OFF"<<endl;
00273    cout<<"Chips used for time diff: "<<uGet4TimeDiffChip1<<" and "<<uGet4TimeDiffChip2<<endl;
00274    cout<<"*************************************************"<<endl;
00275 
00276    /************* GET4 v1.0 *************/
00277    cout<<"       Get4 v1.0 Option values"<<endl;
00278    if( kTRUE == b32bReadoutModeGet4v1 )
00279       cout<<"Readout Mode:                    32 bits "<<endl;
00280       else cout<<"Readout Mode:                    24 bit"<<endl;
00281    cout<<"*************************************************"<<endl;
00282    /*************************************/
00283 
00284    /*********** free-streaming **********/
00285    if( kTRUE == bFreeStreaming )
00286    {
00287       cout<<"       Free-streaming Option values"<<endl;
00288       cout<<"Nb Get4 message printed: "<<uGet4Print<<endl;
00289       cout<<"Tdc main trigger chan:   "<<uMainSelectionTdc<<endl;
00290       cout<<"Channel main trigger:    "<<uMainSelectionChannel<<endl;
00291       if( 0 < uNbSecondarySelectionCh)
00292       {
00293          cout<<"Sec. trigger chans: |-      ";
00294          for(UInt_t temp_index = 0; temp_index < uNbSecondarySelectionCh; temp_index++)
00295          {
00296             cout.width(3);
00297             cout<<temp_index<<" ";
00298          }
00299          cout<<endl<<" TDC                |->     ";
00300          for(UInt_t temp_index = 0; temp_index < uNbSecondarySelectionCh; temp_index++)
00301          {
00302             cout.width(3);
00303             cout<<uSecondarySelectionTdc[temp_index]<<" ";
00304          }
00305          cout<<endl<<" Channel            |->     ";
00306          for(UInt_t temp_index = 0; temp_index < uNbSecondarySelectionCh; temp_index++)
00307          {
00308             cout.width(3);
00309             cout<<uSecondarySelectionChannel[temp_index]<<" ";
00310          }
00311          cout<<endl;
00312       }
00313       cout<<"Channel main trigger:    "<<uMainSelectionChannel<<endl;
00314       cout<<"Coincidenc Window start: "<<dCoincidenceWindowStart<<" ns relative to main channel hits"<<endl;
00315       cout<<"Coincidenc Window stop:  "<<dCoincidenceWindowStop<<" ns relative to main channel hits"<<endl;
00316       if( kTRUE == bAllowEventMixing )
00317          cout<<"Event mixing/superpos.:  ON"<<endl;
00318          else cout<<"Event mixing/superpos.:  OFF"<<endl;
00319       cout<<"*************************************************"<<endl;
00320    }
00321 
00322    return kTRUE;
00323 }

Generated on Tue Dec 10 2013 04:52:19 for ROCsoft by  doxygen 1.7.1