Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

TofConverter Class Reference

#include <TofConverter.h>

List of all members.

Public Member Functions

StatusCode convert (TofDigiCol *src, WriteRawEvent *&des)
StatusCode convert (const BufferHolder &src, TofDigiCol *des, LumiDigiCol *des2=0)
StatusCode convert (TofDigiCol *src, WriteRawEvent *&des)
StatusCode convert (const BufferHolder &src, TofDigiCol *des, LumiDigiCol *des2=0)

Static Public Member Functions

void destroy ()
void destroy ()
TofConverterinstance ()
TofConverterinstance ()

Private Member Functions

 TofConverter ()
 TofConverter ()
 ~TofConverter ()
 ~TofConverter ()

Private Attributes

TofBuilder m_builder

Static Private Attributes

TofConverters_instance
TofConverters_instance = 0


Constructor & Destructor Documentation

TofConverter::TofConverter  )  [private]
 

00134 {
00135 }

TofConverter::~TofConverter  )  [private]
 

00138 {
00139 }

TofConverter::TofConverter  )  [private]
 

TofConverter::~TofConverter  )  [private]
 


Member Function Documentation

StatusCode TofConverter::convert TofDigiCol src,
WriteRawEvent *&  des
 

StatusCode TofConverter::convert const BufferHolder src,
TofDigiCol des,
LumiDigiCol des2 = 0
 

StatusCode TofConverter::convert TofDigiCol src,
WriteRawEvent *&  des
 

00129 {
00130    return m_builder.pack(src, des);
00131 }

StatusCode TofConverter::convert const BufferHolder src,
TofDigiCol des,
LumiDigiCol des2 = 0
 

00023 {
00024    uint32_t REId, TEId, TEData, TEOverflow, TETorQ;
00025    uint32_t nbuf = src.nBuf();
00026 
00027    TofDigi* tofDigi;
00028    typedef std::multimap<uint32_t, TofDigi*>::iterator my_iter;
00029    std::multimap<uint32_t, TofDigi*> mapIdData;
00030    my_iter it;
00031 
00032    for (uint32_t i = 0; i < nbuf; ++i) {
00033       uint32_t* buf = src(i);
00034       uint32_t  bufSize = src.bufSize(i);
00035       for (uint32_t j = 0; j < bufSize; ++j) {
00036          m_builder.unPack(buf[j], REId, TEData, TEOverflow, TETorQ);
00037          TEId = m_builder.getTEID( REId);
00038          if ( TEId == 0xFFFFFFFF ) {
00039             uint32_t data_unit = buf[j];
00040             if ( (data_unit >> 25) == 0x7F ) {
00041                tofDigi = new TofDigi(Identifier(0xFFFFFFFF), 0x7FFFFFFF, 0x7FFFFFFF);
00042                tofDigi->setOverflow(data_unit);
00043                des->push_back(tofDigi);
00044             }
00045             continue;
00046          }
00047 
00048          uint32_t count = mapIdData.count(TEId);
00049 
00050          if (count == 0) {
00051             if (TETorQ) {  //Q
00052                tofDigi = new TofDigi(Identifier(TEId), 0x7FFFFFFF, TEData);
00053                tofDigi->setOverflow(0x10 | (TEOverflow<<1));
00054             }
00055             else {  //T
00056                tofDigi = new TofDigi(Identifier(TEId), TEData, 0x7FFFFFFF);
00057                tofDigi->setOverflow(0x20 | TEOverflow);
00058             }
00059             mapIdData.insert(make_pair(TEId, tofDigi));
00060          }
00061          else {
00062             pair<my_iter, my_iter> range = mapIdData.equal_range(TEId);
00063             it = range.first;
00064             tofDigi = it->second;
00065             if (TETorQ) {  //Q
00066                if (tofDigi->getChargeChannel() == 0x7FFFFFFF) {  //matched Q and T, first Q
00067                   tofDigi->setChargeChannel(TEData);
00068                   tofDigi->setOverflow((tofDigi->getOverflow() | (TEOverflow<<1)) & 0xF);
00069                   while ((++it) != range.second) {  //multiT
00070                      tofDigi = it->second;
00071                      tofDigi->setOverflow(tofDigi->getOverflow() & 0xF);
00072                   }
00073                }
00074                else {  //multiQ
00075                   uint32_t flag = (tofDigi->getOverflow() & 0x3C) | 8;
00076                   while (it != range.second) {
00077                      tofDigi = (it++)->second;
00078                      tofDigi->setOverflow((tofDigi->getOverflow()&0x3) | flag);
00079                   }
00080                   tofDigi = new TofDigi(Identifier(TEId), 0x7FFFFFFF, TEData);
00081                   tofDigi->setOverflow(flag | (TEOverflow<<1));
00082                   mapIdData.insert(make_pair(TEId, tofDigi));
00083                }
00084             }
00085             else {  //T
00086                if (tofDigi->getTimeChannel() == 0x7FFFFFFF) {  //matched T and Q, firstT
00087                   tofDigi->setTimeChannel(TEData);
00088                   tofDigi->setOverflow((tofDigi->getOverflow() | TEOverflow) & 0xF);
00089                   while ((++it) != range.second) {  //multiQ
00090                      tofDigi = it->second;
00091                      tofDigi->setOverflow(tofDigi->getOverflow() & 0xF);
00092                   }
00093                }
00094                else {  //multiT
00095                   uint32_t flag = (tofDigi->getOverflow() & 0x3C) | 4;
00096                   while (it != range.second) {
00097                      tofDigi = (it++)->second;
00098                      tofDigi->setOverflow((tofDigi->getOverflow()&0x3) | flag);
00099                   }
00100                   tofDigi = new TofDigi(Identifier(TEId), TEData, 0x7FFFFFFF);
00101                   tofDigi->setOverflow(flag | TEOverflow);
00102                   mapIdData.insert(make_pair(TEId, tofDigi));
00103                }
00104             }
00105          }
00106       }
00107    }
00108 
00109    my_iter end = mapIdData.end();
00110    for (it = mapIdData.begin(); it != end; ++it) {
00111       TEId = it->first;
00112       tofDigi = it->second;
00113       if ( (TEId&0xFFFF7FFF) != 0x20000060 ) {
00114          des->push_back(tofDigi);
00115       }
00116       //zoujh: for luminosity
00117       else {
00118          if (des2 != 0) {
00119             des2->push_back(new LumiDigi(tofDigi));
00120          }
00121          delete tofDigi;
00122       }
00123    }
00124 
00125    return StatusCode::SUCCESS;
00126 }

void TofConverter::destroy  )  [static]
 

void TofConverter::destroy  )  [static]
 

00015 {
00016    if ( s_instance != 0 ) {
00017       delete s_instance;
00018       s_instance = 0;
00019    }
00020 }

TofConverter* TofConverter::instance  )  [static]
 

TofConverter * TofConverter::instance  )  [static]
 

00006 {
00007    if ( s_instance == 0 ) {
00008       s_instance = new TofConverter();
00009    }
00010 
00011    return s_instance;
00012 }


Member Data Documentation

TofBuilder TofConverter::m_builder [private]
 

TofConverter* TofConverter::s_instance [static, private]
 

TofConverter * TofConverter::s_instance = 0 [static, private]
 


The documentation for this class was generated from the following files:
Generated on Wed Feb 2 18:57:41 2011 for BOSS6.5.5 by  doxygen 1.3.9.1