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 18 of file RawBeamMonBlock.cxx.

References fDevices, and fEarliest.

00018                                  : RawDataBlock()
00019 {
00020     fEarliest = 0;
00021     fDevices.clear();
00022 }

RawBeamMonBlock::RawBeamMonBlock ( const Int_t *  block  ) 

Definition at line 24 of file RawBeamMonBlock.cxx.

References fDevices, and fEarliest.

00025    : RawDataBlock(block)
00026 {
00027     fEarliest = 0;
00028     fDevices.clear();
00029 }

RawBeamMonBlock::RawBeamMonBlock ( const RawBeamMonBlock rhs  ) 

Definition at line 41 of file RawBeamMonBlock.cxx.

References fDevices, and fEarliest.

00042     : RawDataBlock(rhs)
00043 {
00044     fEarliest = rhs.fEarliest;
00045     fDevices.clear();
00046 }

RawBeamMonBlock::~RawBeamMonBlock (  )  [virtual]

Definition at line 31 of file RawBeamMonBlock.cxx.

References done(), and fDevices.

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


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 106 of file RawBeamMonBlock.cxx.

References done(), and fDevices.

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

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

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

Definition at line 48 of file RawBeamMonBlock.cxx.

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

00049 {
00050     if (this == &rhs) return *this;
00051     RawDataBlock::operator=(rhs);
00052     fEarliest = rhs.fEarliest;
00053     fDevices.clear();
00054     return *this;
00055 }

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 58 of file RawBeamMonBlock.cxx.

References fDevices, and fEarliest.

00059 {
00060     fEarliest = filter ? 0 : -1;
00061     fDevices.clear();
00062 }

int RawBeamMonBlock::TclkTriggerDelay (  )  const

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

Definition at line 161 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().

00162 {
00163     return fRawBlock[pld_indx_clbk_delay];
00164 }

int RawBeamMonBlock::TclkTriggerEvent (  )  const

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

Definition at line 156 of file RawBeamMonBlock.cxx.

References RawDataBlock::fRawBlock, and pld_indx_clbk_event.

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

00157 {
00158     return fRawBlock[pld_indx_clbk_event];
00159 }

void RawBeamMonBlock::Unpacker (  )  const [private]

Definition at line 64 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.

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


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 Fri May 24 22:04:33 2013 for loon by  doxygen 1.4.7