Changeset 10903


Ignore:
Timestamp:
06/03/11 13:34:49 (13 years ago)
Author:
ogrimm
Message:
Added write command for PEBS
Location:
fact/drsdaq
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • fact/drsdaq/DAQReadout.cc

    r274 r10903  
    4646   {"uptime", &DAQReadout::cmd_uptime, false, "", "Get DAQ uptime"},             
    4747   {"update", &DAQReadout::cmd_update, false, "<sec>", "Minimum delay between updates to DIM event service"},             
     48   {"write", &DAQReadout::cmd_write, true, "<chips> <channels>", "Select number of chips and channels to write to disk"},                 
    4849   {"exit", &DAQReadout::cmd_exit, false, "", "Exit program"},
    4950   {"help", &DAQReadout::cmd_help, false, "", "Print help"}};
     
    7980  MinDelay                      = 1;
    8081  RunNumber                     = -1;
     82  ChipsToWrite                  = kNumberOfChipsMax;
     83  ChannelsToWrite               = kNumberOfChannelsMax;
    8184
    8285  // Get configuration data (static needed for c_str() pointers to remain valid after constructor finished)
     
    205208// Get uptime
    206209void DAQReadout::cmd_uptime() {
     210
    207211  time_t ActualT;
    208   time (&ActualT);
     212
     213  time(&ActualT);
    209214  PrintMessage("%02d:%02d:%02d\n", (int) difftime(ActualT, StartTime)/3600, ((int) difftime(ActualT, StartTime)/60)%60, (int) difftime(ActualT, StartTime)%60);
    210215}
     
    212217// Print disk space
    213218void DAQReadout::cmd_disk() {
     219
    214220  PrintMessage("Free disk space (%s) [MB]: %lu\n", fRawDataPath, CheckDisk(fRawDataPath));
    215221}
     
    217223// Print current number of events
    218224void DAQReadout::cmd_events() {
     225
    219226  if(daq_state != active) PrintMessage("DAQ not active\n");
    220227  else PrintMessage("Current number of events: %d (of %d requested)\n", NumEvents, NumEventsRequested);
     
    620627// Set DRS sampling frequency
    621628void DAQReadout::cmd_freq() {   
     629
    622630  if (NParam>=2 && atof(Param[1])) {
    623631    SetDRSFrequency(atof(Param[1]), NParam==2 ? false : true);
     
    628636// Set LED
    629637void DAQReadout::cmd_led() {
     638
    630639  if (Match(Param[1], "on") || Match(Param[1], "off"))
    631640    for (int i=FirstBoard; i<=LastBoard; i++)
     
    719728}
    720729
     730// Select chips and channels to write to disk
     731void DAQReadout::cmd_write() {   
     732
     733  int Chips, Chans;
     734
     735  if (NParam != 3) {
     736        PrintUsage();
     737        return;
     738  }
     739
     740  Chips = atoi(Param[1]);
     741  Chans = atoi(Param[2]);
     742 
     743  if (Chips<1 || Chips>kNumberOfChipsMax || Chans<1 || Chans>kNumberOfChannelsMax) {
     744    PrintMessage("Number of chips or channels out of range\n");
     745        return;
     746  }
     747 
     748  ChipsToWrite = Chips;
     749  ChannelsToWrite = Chans;
     750}
     751
    721752// Adress DRS boards
    722753void DAQReadout::cmd_board() {
     
    9931024 
    9941025  RHeader->NBoards   = NumBoards==0 && daq_runtype==test ? 1 : (LastBoard - FirstBoard) + 1; 
    995   RHeader->NChips    = NumBoards==0 ? kNumberOfChipsMax : GetBoard(0)->GetNumberOfChips();
    996   RHeader->NChannels = NumBoards==0 ? kNumberOfChannelsMax : GetBoard(0)->GetNumberOfChannels();
     1026  RHeader->NChips    = NumBoards==0 ? kNumberOfChipsMax : std::min(GetBoard(0)->GetNumberOfChips(), ChipsToWrite);
     1027  RHeader->NChannels = NumBoards==0 ? kNumberOfChannelsMax : std::min(GetBoard(0)->GetNumberOfChannels(), ChannelsToWrite);
    9971028  RHeader->NBytes    = sizeof(short);
    9981029
  • fact/drsdaq/DAQReadout.h

    r274 r10903  
    1717#include <sys/vfs.h>
    1818#include <sys/time.h>
     19#include <algorithm>
    1920
    2021#include "RawDataCTX.h"
     
    8889    int FirstBoard;
    8990    int LastBoard;
     91        int ChipsToWrite;
     92        int ChannelsToWrite;
     93 
    9094    float *DRSFreq;             // DRS sampling frequency [GHz]
    9195    bool *ACalib;
     
    101105    void cmd_acalib();     void cmd_serial();
    102106    void cmd_trigger();    void cmd_centre();
    103         void cmd_refclk();
     107        void cmd_refclk();         void cmd_write();
    104108    void cmd_wmode();      void cmd_rmode();
    105109    void cmd_dmode();      void cmd_read();
  • fact/drsdaq/History.txt

    r274 r10903  
    7474                        drsdaq is 264.
    757530/7/2010       Published some run-related information as DIM service.
     763/6/2011        Added 'write' command (for PEBS application)
    7677                       
Note: See TracChangeset for help on using the changeset viewer.