Initializing the TDC

The CAENV1x90 is a complex TDC, however very likely you will only need a few of its modes operation. You will need to set the following parameters in a way that makes sense for your experiment:

In trigger matching mode, you will also need to set a few additional parameters:

The remainder of this page assumes that you are setting up the TDC in trigger matching mode. In this mode, hits are reported if they occur within a programmable matching interval (window) of the trigger. To set up the TDC properly, it is important to understand the trigger matching window parameters. These are described in the TDC hardware manual on page 15. They are summarized as well in the figure below:

matchwin.gif

In our case, we will set up the TDC with a 2usec match window that ends exactly at the trigger time.

We will set the other module parameters as follows:

Setting up the TDC in this way will involve calling the following member functions on the TDC object:

See:

Initializing the module in the traditional readout skeleton

To initialize the module in the traditional readout skeleton, you must add code to the initevt() function. This code is added after the module creation shown in Constructing a module.. The code below shows the construction of the module along with the additional code needed to initialize the module as specified:

void
initevt ()
{
   ...
   if(!pModule) {
      pModule= new CCAENV1x90(3,
                              0,
                              0xee000000);
   }

   // Initialization takes place every time initevt is called:

      // Set the trigger matching mode and associated parameters:

   pModule->TriggerMatchMode();         // (1)
   pModule->SetWindowWidth(2*40);       // (2)
   pModule->SetWindowOffset(-2*40);     // (3)
   pModule->SetExtraSearchMargin(1);    // (4)
   pModule->SetRejectMargin(1);         // (5)
   pModule->EnableTriggerTimeSubtraction(); // (6)

      // Set detection and resolution stuff:

   pModule->SetEdgeDetectMode(CCAENV1x90::EdgeMode_Leading); // (7)
   pModule->SetIndividualLSB(CCAENV1x90::Res_100ps);         // (8)
   pModule->SetDoubleHitResolution(CCAENV1x90::DT_5ns);      // (9)

     // Manage the event format:

   pModule->EnableTDCEncapsulation();                       // (10)
   pModule->SetMaxHitsPerEvent(CCAENV1x90::HITS_UNLIMITED); // (11)
   pModule->EnableErrorMark();                              // (12)
   pModule->SetErrorEnables(CCAENV1x90::ERR_VERNIER     |
                            CCAENV1x90::ERR_COARSE      |
                            CCAENV1x90::ERR_SELECT      |
                            CCAENV1x90::ERR_L1PARITY    |
                            CCAENV1x90::ERR_TFIFOPARITY |
                            CCAENV1x90::ERR_MATCHERROR  |
                            CCAENV1x90::ERR_RFIFOPARITY |
                            CCAENV1x90::ERR_RDOSTATE    |
                            CCAENV1x90::ERR_SUPPARITY   |
                            CCAENV1x90::ERR_CTLPARITY   |
                            CCAENV1x90::ERR_JTAGPARITY);   // (13)
   pModule->EnableAllChannels();                           // (14)

  1. Sets the module into trigger match mode (as opposed to continuous storage mode.
  2. Set the matching window width to 2*(40 ticks/microsecond) = 2usec wide.
  3. Set the window offset so that the match window starts -2usec relative to the trigger, and therefore ends at the trigger.
  4. Adds a 25ns extra search margin to the window.
  5. Specifies the reject margin prior to the window to be 25ns.
  6. Specifies that all times will be relative to the window start.
  7. Tells the module to detect leading edges of pulses on the inputs.
  8. Tells the module that the LSB of each time represents 100ps. This is the best resolution possible for an 1190, the 1290 can go down to CCAENV1x90::Res_25ps.
  9. Sets the peak to peak resolution at 5ns. The best the module can do.
  10. Requests TDC Chip headers and trailers (See figures 6.2 and 6.4 in the module manual.
  11. Requests no limit on the number of hits from each TDC chip.
  12. Requests the insertion of an error mark in the event in case an error was detected (see figure 6.5 of the hardware manual).
  13. Enables all error reporting on the board.
  14. Enable all tdc channels.

Back Constructing a module. Next Reading out events. Top Introduction

Initializing the module in the production readout

skeleton

The production readout code to initialize the module will live in the EventSegment's Initialize member function:

void v1x90segment::Initialize()
{
      // Set the trigger matching mode and associated parameters:

   m_TDC.TriggerMatchMode();         // (1)
   m_TDC.SetWindowWidth(2*40);       // (2)
   m_TDC.SetWindowOffset(-2*40);     // (3)
   m_TDC.SetExtraSearchMargin(1);    // (4)
   m_TDC.SetRejectMargin(1);         // (5)
   m_TDC.EnableTriggerTimeSubtraction(); // (6)

      // Set detection and resolution stuff:

   m_TDC.SetEdgeDetectMode(CCAENV1x90::EdgeMode_Leading); // (7)
   m_TDC.SetIndividualLSB(CCAENV1x90::Res_100ps);         // (8)
   m_TDC.SetDoubleHitResolution(CCAENV1x90::DT_5ns);      // (9)

     // Manage the event format:

   m_TDC.EnableTDCEncapsulation();                       // (10)
   m_TDC.SetMaxHitsPerEvent(CCAENV1x90::HITS_UNLIMITED); // (11)
   m_TDC.EnableErrorMark();                              // (12)
   m_TDC.SetErrorEnables(CCAENV1x90::ERR_VERNIER     |
                            CCAENV1x90::ERR_COARSE      |
                            CCAENV1x90::ERR_SELECT      |
                            CCAENV1x90::ERR_L1PARITY    |
                            CCAENV1x90::ERR_TFIFOPARITY |
                            CCAENV1x90::ERR_MATCHERROR  |
                            CCAENV1x90::ERR_RFIFOPARITY |
                            CCAENV1x90::ERR_RDOSTATE    |
                            CCAENV1x90::ERR_SUPPARITY   |
                            CCAENV1x90::ERR_CTLPARITY   |
                            CCAENV1x90::ERR_JTAGPARITY);   // (13)
   m_TDC.EnableAllChannels();                           // (14)
}

  1. Sets the module into trigger match mode (as opposed to continuous storage mode.
  2. Set the matching window width to 2*(40 ticks/microsecond) = 2usec wide.
  3. Set the window offset so that the match window starts -2usec relative to the trigger, and therefore ends at the trigger.
  4. Adds a 25ns extra search margin to the window.
  5. Specifies the reject margin prior to the window to be 25ns.
  6. Specifies that all times will be relative to the window start.
  7. Tells the module to detect leading edges of pulses on the inputs.
  8. Tells the module that the LSB of each time represents 100ps. This is the best resolution possible for an 1190, the 1290 can go down to CCAENV1x90::Res_25ps.
  9. Sets the peak to peak resolution at 5ns. The best the module can do.
  10. Requests TDC Chip headers and trailers (See figures 6.2 and 6.4 in the module manual.
  11. Requests no limit on the number of hits from each TDC chip.
  12. Requests the insertion of an error mark in the event in case an error was detected (see figure 6.5 of the hardware manual).
  13. Enables all error reporting on the board.
  14. Enable all tdc channels.

Back Constructing a module. Next Reading out events. Top Introduction


Generated on Wed Sep 17 08:38:10 2008 for NSCL Device support. by  doxygen 1.5.1