Changeset 11174 for trunk/FACT++/src


Ignore:
Timestamp:
06/24/11 14:17:49 (14 years ago)
Author:
tbretz
Message:
New scheme to transmit the status bits.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/EventBuilderWrapper.h

    r11169 r11174  
    721721    DimDescribedService fDimEventData;
    722722    DimDescribedService fDimFwVersion;
    723     DimDescribedService fDimPllLock;
    724     DimDescribedService fDimDrsEnabled;
     723    //DimDescribedService fDimPllLock;
     724    //DimDescribedService fDimDrsEnabled;
     725    //DimDescribedService fDimTriggerLine;
     726    //DimDescribedService fDimContinousTrigger;
     727    //DimDescribedService fDimSocket;
     728    DimDescribedService fDimStatus;
    725729    DimDescribedService fDimStatistics;
    726730
     
    742746        fDimEventData("FAD_CONTROL/EVENT_DATA", "S:1;I:1;S:1;I:2;S:1;S", ""),
    743747        fDimFwVersion("FAD_CONTROL/FIRMWARE_VERSION", "F:43", ""),
    744         fDimPllLock("FAD_CONTROL/PLL_LOCK", "C:41", ""),
    745         fDimDrsEnabled("FAD_CONTROL/DRS_ENABLED", "C:41", ""),
     748        //fDimPllLock("FAD_CONTROL/PLL_LOCK", "C:41", ""),
     749        //fDimDrsEnabled("FAD_CONTROL/DRS_ENABLED", "C:41", ""),
     750        //fDimTriggerLine("FAD_CONTROL/TRIGGER_LINE", "C:41", ""),
     751        //fDimContinousTrigger("FAD_CONTROL/CONTINOUS_TRIGGER", "C:41", ""),
     752        //fDimBusy("FAD_CONTROL/BUSY", "C:41", ""),
     753        fDimStatus("FAD_CONTROL/STATUS", "S:42", ""),
    746754        fDimStatistics("FAD_CONTROL/STATISTICS", "X:8", ""),
    747755        fDebugStream(false), fDebugRead(false)
     
    13871395    }
    13881396
     1397    template<typename T>
     1398    boost::array<T, 42> CompareBits(const FAD::EventHeader *h, const T *t)
     1399    {
     1400        const int offset = reinterpret_cast<const char *>(t) - reinterpret_cast<const char *>(h);
     1401
     1402        T val;  // All bits 0
     1403        T rc;
     1404
     1405        boost::array<T, 42> vec;
     1406
     1407        bool first = true;
     1408
     1409        for (int i=0; i<40; i++)
     1410        {
     1411            const char *base = reinterpret_cast<const char*>(&fVecHeader[i]);
     1412            const T *ref = reinterpret_cast<const T*>(base+offset);
     1413
     1414            vec[i+2] = *ref;
     1415
     1416            if (gi_NumConnect[i/7]!=7)
     1417                continue;
     1418
     1419            if (first)
     1420            {
     1421                first = false;
     1422                val = *ref;
     1423                rc = ~0;
     1424            }
     1425
     1426            rc |= val^*ref;
     1427        }
     1428
     1429        vec[0] = rc;
     1430        vec[1] = val;
     1431
     1432        return vec;
     1433    }
     1434
    13891435    template<typename T, size_t N>
    13901436    void Update(DimDescribedService &svc, const pair<bool,boost::array<T, N>> &data)
     
    14421488            Print("Run", run);
    14431489        }
    1444 
     1490/*
    14451491        if (old.PLLLCK() != h.PLLLCK())
    14461492        {
     
    14761522            Print("Owf", owf);
    14771523        }
    1478 
     1524*/
    14791525        if (old.IsDcmLocked() != h.IsDcmLocked())
    14801526        {
     
    14941540            Print("Spi", spi);
    14951541        }
    1496 
     1542/*
    14971543        if (old.HasBusy() != h.HasBusy())
    14981544        {
    14991545            const pair<bool, boost::array<uint16_t,43>> bsy = Compare(&h, &h.fStatus, FAD::EventHeader::kBusy);
    1500             Print("Bsy", bsy);
     1546            pair<bool, boost::array<uint8_t,43>> data;
     1547            data.first = bsy.first;
     1548            data.second[0] = bsy.second[1];
     1549            for (int i=0; i<40; i++)
     1550                data.second[i+1] = bsy.second[i+3];
     1551            Update(fDimBusy, data);
    15011552        }
    15021553
     
    15041555        {
    15051556            const pair<bool, boost::array<uint16_t,43>> trg = Compare(&h, &h.fStatus, FAD::EventHeader::kTriggerLine);
    1506             Print("Trg", trg);
     1557            pair<bool, boost::array<uint8_t,43>> data;
     1558            data.first = trg.first;
     1559            data.second[0] = trg.second[1];
     1560            for (int i=0; i<40; i++)
     1561                data.second[i+1] = trg.second[i+3];
     1562            Update(fDimTriggerLine, data);
    15071563        }
    15081564
     
    15101566        {
    15111567            const pair<bool, boost::array<uint16_t,43>> cnt = Compare(&h, &h.fStatus, FAD::EventHeader::kContTrigger);
    1512             Print("Cnt", cnt);
     1568            pair<bool, boost::array<uint8_t,43>> data;
     1569            data.first = cnt.first;
     1570            data.second[0] = cnt.second[1];
     1571            for (int i=0; i<40; i++)
     1572                data.second[i+1] = cnt.second[i+3];
     1573            Update(fDimContinousTrigger, data);
    15131574        }
    15141575
     
    15181579            Print("Sck", sck);
    15191580        }
    1520 
     1581*/
     1582        if (old.fStatus != h.fStatus)
     1583        {
     1584            const boost::array<uint16_t,42> sts = CompareBits(&h, &h.fStatus);
     1585            fDimStatus.setData(const_cast<uint16_t*>(sts.data()), 42*sizeof(uint16_t));
     1586            fDimStatus.updateService();
     1587
     1588            cout << "EMMIT" << endl;
     1589        }
    15211590
    15221591
Note: See TracChangeset for help on using the changeset viewer.