Changeset 17244


Ignore:
Timestamp:
10/17/13 16:50:07 (11 years ago)
Author:
tbretz
Message:
Added new options and commands to configure file compression; added kZFits as allowed file type.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/fadctrl.cc

    r16979 r17244  
    1818#include "EventBuilderWrapper.h"
    1919
     20#include "../externals/zofits.h"
     21
    2022namespace ba = boost::asio;
    2123namespace bs = boost::system;
     
    843845        case FAD::kDebug:
    844846        case FAD::kFits:
     847        case FAD::kZFits:
    845848        case FAD::kCfitsio:
    846849        case FAD::kRaw:
     
    13021305        return T::GetCurrentState();
    13031306    }
     1307
     1308    // ============================================================================
     1309
     1310    int SetupZFits(const EventImp &evt, const std::function<void(int32_t)> &func)
     1311    {
     1312        if (!CheckEventSize(evt.GetSize(), "SetupZFits", 2))
     1313            return T::kSM_FatalError;
     1314
     1315        func(evt.GetShort());
     1316        return T::GetCurrentState();
     1317    }
     1318
    13041319
    13051320    // ============================================================================
     
    19091924
    19101925
     1926        // --------- Setup compression of FITS files -----------
     1927        T::AddEvent("SET_ZFITS_DEFAULT_NUM_THREADS", "S")
     1928            (bind(&StateMachineFAD::SetupZFits, this, placeholders::_1, zofits::DefaultNumThreads))
     1929            ("Set the number of compression threads to use (+1 for writing)"
     1930             "|num[int]:Number of threads");
     1931        T::AddEvent("SET_ZFITS_DEFAULT_MAX_MEMORY", "S")
     1932            (bind(&StateMachineFAD::SetupZFits, this, placeholders::_1, zofits::DefaultMaxMemory))
     1933            ("Set the maximum amount of memory zfits will use for compression"
     1934             "|mem[int]:Memory in MB");
     1935        T::AddEvent("SET_ZFITS_DEFAULT_NUM_TILES", "S")
     1936            (bind(&StateMachineFAD::SetupZFits, this, placeholders::_1, zofits::DefaultMaxNumTiles))
     1937            ("Set the number of tiles with which the catalog is initialized"
     1938             "|num[int]:Number of tiles");
     1939        T::AddEvent("SET_ZFITS_DEFAULT_ROWS_PER_TILE", "S")
     1940            (bind(&StateMachineFAD::SetupZFits, this, placeholders::_1, zofits::DefaultNumRowsPerTile))
     1941            ("Set the number of rows which are compressed into one tile"
     1942             "|num[int]:Number of rows per tile");
     1943
     1944
    19111945        T::AddEvent("ADD_ADDRESS", "C", FAD::State::kOffline)
    19121946            (bind(&StateMachineFAD::AddAddress, this, placeholders::_1))
     
    19902024        fDebugTx = conf.Get<bool>("debug-tx");
    19912025
     2026        // --------- Setup compression of FITS files -----------
     2027        if (conf.Has("zfits.num-threads"))
     2028            zofits::DefaultNumThreads(conf.Get<int16_t>("zfits.num-threads"));
     2029        if (conf.Has("zfits.max-mem"))
     2030            zofits::DefaultMaxMemory(conf.Get<uint16_t>("zfits.max-mem")*1000);
     2031        if (conf.Has("zfits.num-tiles"))
     2032            zofits::DefaultMaxNumTiles(conf.Get<uint16_t>("zfits.num-tiles"));
     2033        if (conf.Has("zfits.num-rows"))
     2034            zofits::DefaultNumRowsPerTile(conf.Get<uint16_t>("zfits.num-rows"));
     2035
    19922036        // ---------- Setup event builder ---------
    19932037        SetMaxMemory(conf.Get<unsigned int>("max-mem"));
     
    21772221    po::options_description builder("Event builder options");
    21782222    builder.add_options()
    2179         ("max-mem,m",          var<unsigned int>(100), "Maximum memory the event builder thread is allowed to consume for its event buffer")
     2223        ("max-mem",            var<unsigned int>(100), "Maximum memory the event builder thread is allowed to consume for its event buffer")
    21802224        ("event-timeout",      var<uint16_t>(30),      "After how many seconds is an event considered to be timed out? (<=0: disabled)")
    21812225        ("destination-folder", var<string>(""),        "Destination folder (base folder) for the event builder binary data files.")
     2226        ;
     2227
     2228    po::options_description zfits("FITS compression options");
     2229    zfits.add_options()
     2230        ("zfits.num-threads", var<int16_t>(),  "Number of threads to spawn writing compressed FITS files")
     2231        ("zfits.max-mem",     var<uint16_t>(), "Maximum amount of memory to be allocated by FITS compression in MB")
     2232        ("zfits.num-tiles",   var<uint16_t>(), "Maximum number of tiles in the catalog")
     2233        ("zfits.num-rows",    var<uint16_t>(), "Maximum number of rows per tile")
    21822234        ;
    21832235
     
    22162268    conf.AddOptions(connect);
    22172269    conf.AddOptions(builder);
     2270    conf.AddOptions(zfits);
    22182271    conf.AddOptions(runtype);
    22192272}
Note: See TracChangeset for help on using the changeset viewer.