RawBeamMonBlock Class Reference

#include <RawBeamMonBlock.h>

Inheritance diagram for RawBeamMonBlock:

RawDataBlock List of all members.

Public Member Functions

 RawBeamMonBlock ()
 RawBeamMonBlock (const Int_t *block)
 RawBeamMonBlock (const RawBeamMonBlock &rhs)
virtual ~RawBeamMonBlock ()
RawBeamMonBlockoperator= (const RawBeamMonBlock &rhs)
virtual std::ostream & FormatToOStream (std::ostream &os, Option_t *option="") const
void SetFiltered (bool filtered=true)
std::vector< std::string > GetNames () const
 Return a list of all the device names in this block.
const RawBeamDataoperator[] (std::string device_name) const
int TclkTriggerEvent () const
int TclkTriggerDelay () const

Private Member Functions

void Unpacker () const

Private Attributes

std::map< std::string, RawBeamData * > fDevices
double fEarliest
 no I/O

Detailed Description

Definition at line 35 of file RawBeamMonBlock.h.


Constructor & Destructor Documentation

RawBeamMonBlock::RawBeamMonBlock (  ) 

Definition at line 22 of file RawBeamMonBlock.cxx.

References fDevices, and fEarliest.

00022                                  : RawDataBlock()
00023 {
00024     fEarliest = 0;
00025     fDevices.clear();
00026 }

RawBeamMonBlock::RawBeamMonBlock ( const Int_t *  block  ) 

Definition at line 28 of file RawBeamMonBlock.cxx.

References fDevices, and fEarliest.

00029    : RawDataBlock(block)
00030 {
00031     fEarliest = 0;
00032     fDevices.clear();
00033 }

RawBeamMonBlock::RawBeamMonBlock ( const RawBeamMonBlock rhs  ) 

Definition at line 45 of file RawBeamMonBlock.cxx.

References fDevices, and fEarliest.

00046     : RawDataBlock(rhs)
00047 {
00048     fEarliest = rhs.fEarliest;
00049     fDevices.clear();
00050 }

RawBeamMonBlock::~RawBeamMonBlock (  )  [virtual]

Definition at line 35 of file RawBeamMonBlock.cxx.

References done(), and fDevices.

00036 {
00037     // delete any RawBeamData objects created!
00038     map<string,RawBeamData*>::iterator it, done = fDevices.end();
00039     for (it = fDevices.begin(); it != done; ++it) {
00040       if (it->second) delete it->second;
00041       it->second = 0;
00042     }
00043 }


Member Function Documentation

virtual std::ostream& RawBeamMonBlock::FormatToOStream ( std::ostream &  os,
Option_t *  option = "" 
) const [virtual]

Reimplemented from RawDataBlock.

std::vector< string > RawBeamMonBlock::GetNames (  )  const

Return a list of all the device names in this block.

Definition at line 110 of file RawBeamMonBlock.cxx.

References done(), and fDevices.

Referenced by dump(), BmntImp::Fill(), and BdntImp::Fill().

00111 {
00112     if (0 == fDevices.size()) this->Unpacker();
00113 
00114     vector<string> res;
00115     map<string,RawBeamData*>::iterator it, done = fDevices.end();
00116     for (it=fDevices.begin(); it != done; ++it) {
00117         res.push_back(it->first);
00118     }
00119     return res;
00120 }

RawBeamMonBlock & RawBeamMonBlock::operator= ( const RawBeamMonBlock rhs  ) 

Definition at line 52 of file RawBeamMonBlock.cxx.

References fDevices, fEarliest, and RawDataBlock::operator=().

00053 {
00054     if (this == &rhs) return *this;
00055     RawDataBlock::operator=(rhs);
00056     fEarliest = rhs.fEarliest;
00057     fDevices.clear();
00058     return *this;
00059 }

const RawBeamData* RawBeamMonBlock::operator[] ( std::string  device_name  )  const

Return encapsulated data for one device block. Return 0 on failed device_name lookup. Ownership of the returned RawBeamData is not transfered and is deleted when this is.

void RawBeamMonBlock::SetFiltered ( bool  filtered = true  ) 

By default not all device data in the data block will be accessible. The default is to filter "bad" device data. Normally, this filter does nothing, but in rare cases the Beam Data Process server was given multiple duplicate spills. When this occurs some of the duplicate spills are corrupted by subsequent spill data. The filter will remove access to any devices with timestamps more than 1.0 second from the earliest time stamp. See also BeamDataUtil/BDUniquify to help cut out the duplicate spills. Calling this method with the default argument sets the filter (done by default). Reversed turns off filtering

Definition at line 62 of file RawBeamMonBlock.cxx.

References fDevices, and fEarliest.

00063 {
00064     fEarliest = filter ? 0 : -1;
00065     fDevices.clear();
00066 }

int RawBeamMonBlock::TclkTriggerDelay (  )  const

Return the delay from the above event, in msec, that the ACNET readout was triggered

Definition at line 221 of file RawBeamMonBlock.cxx.

References RawDataBlock::fRawBlock, and pld_indx_clbk_delay.

Referenced by BDEarliest::CalculateEarliest(), BmntImp::Fill(), BdntImp::Fill(), BDSwicPeds::IsPedSpill(), and BeamMonDbuModule::Process().

00222 {
00223     return fRawBlock[pld_indx_clbk_delay];
00224 }

int RawBeamMonBlock::TclkTriggerEvent (  )  const

Return the TCLK event used to trigger this block of ACNET readout

Definition at line 216 of file RawBeamMonBlock.cxx.

References RawDataBlock::fRawBlock, and pld_indx_clbk_event.

Referenced by BeamMonSwicPedsDbuModule::Ana(), BmntImp::Fill(), fill_bdtest(), and BeamMonDbuModule::Process().

00217 {
00218     return fRawBlock[pld_indx_clbk_event];
00219 }

void RawBeamMonBlock::Unpacker (  )  const [private]

Definition at line 68 of file RawBeamMonBlock.cxx.

References done(), fDevices, fEarliest, RawDataBlock::fRawBlock, pld_indx_data_start, pld_indx_num_devices, pld_indx_size, and pld_nvalues_offset.

00069 {
00070     const int* end = fRawBlock + fRawBlock[pld_indx_size];
00071     const int ndevs_tot = fRawBlock[pld_indx_num_devices];
00072 
00073     int ndevs = 0;
00074 
00075     for (int* data = fRawBlock+pld_indx_data_start;
00076          data < end;
00077          data += pld_nvalues_offset + data[pld_nvalues_offset] + 1, ++ndevs) {
00078 
00079       RawBeamData* rbd = new RawBeamData(data);
00080 
00081       if (fEarliest >= 0) {
00082         double t = rbd->GetSeconds() + rbd->GetMsecs()/1000.0;
00083         if (fEarliest < 1 || (t > 1 && t < fEarliest)) fEarliest = t;
00084       }
00085         
00086       string name = rbd->GetName();
00087       fDevices[name] = rbd;
00088     }
00089     assert (ndevs == ndevs_tot);
00090 
00091     if (fEarliest < 0) return;
00092 
00093     // Implement filter - this doesn't touch the underlying data, just
00094     // how it is mapped.
00095     map<string,RawBeamData*> newmap;
00096     map<string,RawBeamData*>::iterator it, done = fDevices.end();
00097     for (it = fDevices.begin(); it != done; ++it) {
00098       double t = it->second->GetSeconds() + it->second->GetMsecs()/1000.0;
00099       if (t - fEarliest > 1.0) {
00100         delete it->second;
00101         it->second = 0;
00102       }
00103       else newmap[it->first] = it->second;
00104     }
00105 
00106     fDevices.clear();
00107     fDevices = newmap;
00108 }


Member Data Documentation

std::map<std::string,RawBeamData*> RawBeamMonBlock::fDevices [mutable, private]

Definition at line 91 of file RawBeamMonBlock.h.

Referenced by GetNames(), operator=(), RawBeamMonBlock(), SetFiltered(), Unpacker(), and ~RawBeamMonBlock().

double RawBeamMonBlock::fEarliest [mutable, private]

no I/O

Definition at line 92 of file RawBeamMonBlock.h.

Referenced by operator=(), RawBeamMonBlock(), SetFiltered(), and Unpacker().


The documentation for this class was generated from the following files:
Generated on Thu Apr 10 23:03:33 2014 for loon by  doxygen 1.4.7