The hardware distinguishes between three types of modules in a CBLT block:
To use CBLT groups you must:
The constructor CCAENChain::CCAENChain constructs CBLT groups. The sample code below constructs a geographical cblt group consisting of modules in slots 4,5 and 6, crate 0.
#include <CCAENChain.h> #include <CAENcard.h> #include <vector> ... vector<unsigned long> dummy; CCAENChain* pChain = new CCAENChain(4,6, dummy, 0 true); ...
The constructor CCAENChain::CCAENChain creates three CAENcard objects that are all constructed geographically in slots 4,5, and 6 of crate 0. These are programmed to act as a CBLT group.
The code sample below shows how to construct a CBLT group consisting of three modules at 0x100000, 0x200000, and 0x300000 respectively. The modules are programmed for virtual slots 4,5, and 6.
#include <CCAENChain.h> #include <CAENcard.h> #include <vector> ... vector<unsigned long> bases; bases.push_back(0x100000); bases.push_back(0x200000); bases.push_back(0x300000); CCAENChain* pChain = new CCAENChain(4,6, bases, 0, false); ...
You may gain access to a module in the group either by treating the chain as an array (indexing the chain object returns a pointer to a module), or you can retrieve a vector of CAENcard pointers.
The code fragment below shows how to index the chain to get access to its members.
#include <CCAENChain.h> #include <CAENcard.h> #include <vector> ... CCAENChain* pChain; ... CCAENChain& rChain(*pChain); bool done = false; int index = 0; while (!done) { try { CAENcard* pModule = rChain[index]; InitializeAModule(pModule, index); } catch(CRangeError re) { done = true; } index++; } ...
#include <CCAENChain.h> #include <CAENcard.h> #include <vector> ... CCAENChain* pChain; ... vector<CAENcard*> vCards = pChain->getCards(); int nCards = vCards.size(); for (int i = 0; i < nCards; i++) { InitializeAModule(vCards[i], i); } ...
The detailed functions avialable to you at initialization time are described at the page: . In addtion to these, the CCAENChain::ClearData member clears the data buffers of all cards in the CBLT group.
The sample code below shows you how to read into a user buffer and copy the data into the final buffer. bufpt is assumed to be the DAQWordBufferPtr that points to the final event buffer.
#include <CCAENChain.h> ... CCAENChain* pChain; ... int nMaxBytes = pChain->getMaxBytes(); int nMaxLongs = nMaxBytes/sizeof(unsigned long); unsigned long lBuffer[nMaxLongs]; int nRead = pChain->ReadEvent(lBuffer); unsigned short* pBuffer = (unsigned short*)lBuffer; for(int i =0; i < nRead; i++) { *bufpt = *pBuffer++; ++bufpt; } ...