RawDataHltRawCnv Class Reference

#include <RawDataHltRawCnv.h>

Inheritance diagram for RawDataHltRawCnv:

RawDataBaseCnv Converter< Ty1, Ty2 > List of all members.

Public Types

typedef Ty1 source
typedef Ty2 destination

Public Member Functions

StatusCode initialize ()
virtual long repSvcType () const
StatusCode createObj (IOpaqueAddress *pAddr, DataObject *&pObj)
virtual StatusCode updateObj (IOpaqueAddress *, DataObject *)
 override the RawDataBaseCnv version
virtual StatusCode createRep (DataObject *pObj, IOpaqueAddress *&pAddr)
 Convert the transient object to the requested representation.
virtual StatusCode finalize ()
void declareObject (const std::string &fullPath, const CLID &clid, const std::string &bank, long par=0)
 Store TDS path to link a particular converter to an object on the TDS.
virtual StatusCode fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the converted object.
virtual StatusCode updateRep (IOpaqueAddress *pAddress, DataObject *pObject)
 Update the converted representation of a transient object.
virtual StatusCode updateRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Update the references of an already converted object.
destinationoperator (const source &) const

Static Public Member Functions

static const CLID & classID ()
static const unsigned char storageType ()

Protected Member Functions

 RawDataHltRawCnv (ISvcLocator *svc)
 ~RawDataHltRawCnv ()
virtual destinationconvert (const source &) const =0

Protected Attributes

IRawDataCnvSvcm_CnvSvc
 Pointer to event conversion service interface.
std::vector< IRawDataCnvSvc::Leafm_leaves
 Leaf objects giving the locations of the objects in the data store.

Private Attributes

IRawDataInputSvcm_inputSvc
PackedRawDataCnvSvcm_RawDataAccess
 Define the interface to raw data cnv.
HltBuilder m_hltBuilder
 HltBuilder for packing or unpacking data.

Friends

class CnvFactory< RawDataHltRawCnv >

Detailed Description

Definition at line 32 of file RawDataHltRawCnv.h.


Member Typedef Documentation

template<class Ty1, class Ty2>
typedef Ty2 Converter< Ty1, Ty2 >::destination [inherited]

Definition at line 19 of file Converter.h.

template<class Ty1, class Ty2>
typedef Ty1 Converter< Ty1, Ty2 >::source [inherited]

Definition at line 18 of file Converter.h.


Constructor & Destructor Documentation

RawDataHltRawCnv::RawDataHltRawCnv ( ISvcLocator *  svc  )  [protected]

Definition at line 31 of file RawDataHltRawCnv.cxx.

00031                                                    : 
00032 RawDataBaseCnv(PACKEDRAWEVENT_StorageType, classID(), svc) 
00033 {
00034     //init();
00035 }

RawDataHltRawCnv::~RawDataHltRawCnv (  )  [protected]

Definition at line 36 of file RawDataHltRawCnv.cxx.

00036                                    {
00037 }


Member Function Documentation

const CLID & RawDataHltRawCnv::classID (  )  [static]

Reimplemented from RawDataBaseCnv.

Definition at line 41 of file RawDataHltRawCnv.cxx.

References CLID_HltRawCol.

Referenced by PackedRawDataCnvSvc::addConverters().

00042 {
00043    return CLID_HltRawCol;
00044 }

template<class Ty1, class Ty2>
virtual destination* Converter< Ty1, Ty2 >::convert ( const source  )  const [protected, pure virtual, inherited]

StatusCode RawDataHltRawCnv::createObj ( IOpaqueAddress *  pAddr,
DataObject *&  pObj 
)

Definition at line 110 of file RawDataHltRawCnv.cxx.

References BufferHolder::bufSize(), HltID::convert(), IRawDataInputSvc::currentEvent(), RAWEVENT::getHltBuf(), HltBuilder::getTEID(), EventModel::Hlt::HltRawCol, genRecEmupikp::i, HltID::is_number(), ganga-rec::j, m_hltBuilder, m_inputSvc, BufferHolder::nBuf(), RawData::setChargeChannel(), HltRaw::setIntChannel(), and HltBuilder::unPack().

00111 {
00112    //MsgStream log(msgSvc(), "RawDataHltRawCnv");
00113    RawDataAddress *pEFAddr;
00114    uint32_t TEData[2];
00115    
00116    // Purpose and Method:  This converter will create an empty HltRawCol on
00117    //   the TDS.
00118    HltRawCol *digiCol = new HltRawCol;
00119    pObj = digiCol;
00120 
00121    RAWEVENT *evt = m_inputSvc->currentEvent(); 
00122    if (evt == NULL) {
00123      cout << "RawDataHltRawCnv::createObj can't get event!" << endl; 
00124      return StatusCode::FAILURE;
00125    }
00126 
00127    int digiId = 0;
00128    const BufferHolder& hltBuf = evt->getHltBuf();
00129    uint32_t nbuf = hltBuf.nBuf();
00130    
00131    uint32_t REId = 0, TEId = 0;
00132    uint32_t nmdc=0,ntof=0,nemc=0,nmuc=0;
00133    for (uint32_t i = 0; i < nbuf; i++) {
00134      uint32_t* buf = hltBuf(i);
00135      uint32_t bufSize = hltBuf.bufSize(i);
00136      for (uint32_t j = 0; j < bufSize; j++, digiId++) {
00137 
00138         m_hltBuilder.unPack(buf[j], digiId, REId, TEData[0], TEData[1]);
00139         TEId = m_hltBuilder.getTEID(REId);
00140         if ( TEId == 0xFFFFFFFF ) continue;
00141 
00142 //       log << MSG::NIL << "HLT digit No: " << digiId << "="<<std::hex<<buf[j]
00143 //         <<"===>"<<TEId<<" : "<<TEData[0]<<","<<TEData[1]<<std::dec<<endreq;
00144        for (uint32_t k=0; k< 2;k++){
00145          // Create new track
00146          if(k==0||(k==1&&TEData[k])){
00147            if(k==1) TEId+=1;
00148            if(HltID::is_number(HltID::convert(TEId))) {
00149              nmdc=TEData[k]&0xFF;
00150              ntof=(TEData[k]>>8)&0xFF;
00151              nemc=(TEData[k]>>16)&0xFF;
00152              nmuc=(TEData[k]>>24)&0xFF;
00153              //log << MSG::INFO << "number=" << std::hex <<TEData[k] <<std::dec<< endreq;
00154            }
00155            HltRaw* hltRaw = new HltRaw(HltID::convert(TEId,nmdc,ntof,nemc,nmuc));
00156            hltRaw->setIntChannel(TEData[k]);
00157            //hltRaw->setFloatChannel(TEData[k]);
00158            hltRaw->setChargeChannel(TEData[k]);
00159 
00160            digiCol->push_back ( hltRaw );
00161          }
00162        }
00163      }
00164    }
00165    return StatusCode::SUCCESS; 
00166 }

StatusCode RawDataHltRawCnv::createRep ( DataObject *  pObj,
IOpaqueAddress *&  pAddr 
) [virtual]

Convert the transient object to the requested representation.

Reimplemented from RawDataBaseCnv.

Definition at line 168 of file RawDataHltRawCnv.cxx.

References PackedRawDataCnvSvc::getRawEvent(), EventModel::Hlt::HltRawCol, m_hltBuilder, m_RawDataAccess, and HltBuilder::pack().

00169 {
00170     // convert PixelRaw in the container into ByteStream
00171     //MsgStream log(messageService(), "RawDataHltRawCnv");
00172 
00173     WriteRawEvent*& re = m_RawDataAccess->getRawEvent(); 
00174     if(re == 0) {
00175       //log << " get RawEvent failed !" << endreq;
00176       return StatusCode::FAILURE; 
00177     }
00178 
00179     SmartDataPtr<HltRawCol> digiCol(dataProvider(), EventModel::Hlt::HltRawCol);
00180     if (digiCol == 0) {
00181         //log << "no HltRawCol found" << endreq;
00182         return StatusCode::FAILURE;
00183     }
00184     /*
00185     else {
00186         log << MSG::INFO << endreq << "Detailed dump of 1st event: " << endreq << endreq;
00187         int ndigi = 0;
00188         HltRawCol::const_iterator pHltRaw = digiCol->begin();
00189         for (pHltRaw; pHltRaw!= digiCol->end(); pHltRaw++) {
00190             log <<MSG::INFO << "Raw " << ndigi++ << " ";
00191             // output the digi proper:  " << digi " no longer works because
00192             // "digi" now returns an integer sort order
00193             (**pHltRaw).fillStream(log.stream());
00194             log << endreq;
00195         }
00196     }
00197     */
00198     return m_hltBuilder.pack(digiCol, re);
00199 }

void RawDataBaseCnv::declareObject ( const std::string fullPath,
const CLID &  clid,
const std::string bank,
long  par = 0 
) [inherited]

Store TDS path to link a particular converter to an object on the TDS.

Definition at line 81 of file RawDataBaseCnv.cxx.

00082                                                                       {
00083     // Purpose and Method:  Save the path on the TDS, in the m_leaves vector, 
00084     //   corresponding to the DataObject that the converter handles.
00085     // m_leaves.push_back(IRawDataCnvSvc::Leaf(path, cl, bank, par));
00086 }

StatusCode RawDataBaseCnv::fillRepRefs ( IOpaqueAddress *  pAddress,
DataObject *  pObject 
) [virtual, inherited]

Resolve the references of the converted object.

Definition at line 29 of file RawDataBaseCnv.cxx.

00030                                                  {
00031     // Purpose and Method:  Resolve the references of the converted object.
00032     //     It is expected that derived classes will override this method.
00033     return StatusCode::SUCCESS;
00034 }

StatusCode RawDataBaseCnv::finalize (  )  [virtual, inherited]

Definition at line 73 of file RawDataBaseCnv.cxx.

References RawDataBaseCnv::m_CnvSvc.

00073                                       {
00074     if ( m_CnvSvc )     {
00075         m_CnvSvc->release();
00076         m_CnvSvc = 0;
00077     }
00078     return Converter::finalize();
00079 }

StatusCode RawDataHltRawCnv::initialize (  ) 

Reimplemented from RawDataBaseCnv.

Definition at line 46 of file RawDataHltRawCnv.cxx.

References calibUtil::ERROR, Bes_Common::INFO, RawDataBaseCnv::initialize(), m_inputSvc, m_RawDataAccess, deljobs::string, and Bes_Common::WARNING.

00047 {
00048     std::string PackedRawDataCnvSvc_Name("PackedRawDataCnvSvc");
00049     std::string RawDataInputSvc_Name("RawDataInputSvc");
00050     std::string RawDataHltRawCnv_Name("RawDataHltRawCnv");
00051     
00052     // for Mutil-thread by tianhl
00053     //ConversionSvc*  pCnvSvc = 0;
00054     //if (pCnvSvc = dynamic_cast<ConversionSvc*>(conversionSvc())){
00055     SmartIF<IService> pCnvSvc(conversionSvc());  
00056     if  (isGaudiThreaded(pCnvSvc->name())){
00057         PackedRawDataCnvSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
00058         RawDataInputSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
00059         RawDataHltRawCnv_Name += getGaudiThreadIDfromName(pCnvSvc->name());
00060       }
00061     //}
00062     
00063    MsgStream log(messageService(), RawDataHltRawCnv_Name.c_str());
00064    StatusCode sc = RawDataBaseCnv::initialize();
00065    if (StatusCode::SUCCESS != sc) {
00066      
00067      return sc;
00068    }
00069 
00070    // Check RawDataCnvSvc
00071    IService* isvc = 0;
00072    StatusCode status = serviceLocator()->service(PackedRawDataCnvSvc_Name.c_str(), isvc, true);
00073 
00074    m_RawDataAccess = dynamic_cast<PackedRawDataCnvSvc*> (isvc); 
00075     if(m_RawDataAccess  == 0 ) {
00076       log<<MSG::ERROR<< "  RawDataCnv: Cant cast to  RawDataCnvSvc " <<endreq; 
00077       return StatusCode::FAILURE ;
00078    }
00079    
00080    if(m_RawDataAccess)
00081         log << MSG::INFO << "RawDataCnvSvc retrieved "<< endreq;
00082 
00083     IService* svc ;
00084     sc = serviceLocator()->getService(RawDataInputSvc_Name.c_str(), svc);
00085     if(sc != StatusCode::SUCCESS ) {
00086         log<<MSG::WARNING << " Cant get RawDataInputSvc " <<endreq;
00087         return sc ;
00088     }
00089  
00090     m_inputSvc = dynamic_cast<RawDataInputSvc*> (svc);
00091     if(m_inputSvc == 0 ) {
00092         log<<MSG::WARNING<< " Cant cast to  RawDataInputSvc " <<endreq;
00093         return StatusCode::FAILURE ;
00094     }
00095  
00096    return StatusCode::SUCCESS; 
00097 }

template<class Ty1, class Ty2>
destination* Converter< Ty1, Ty2 >::operator ( const source  )  const [inline, inherited]

virtual long RawDataHltRawCnv::repSvcType (  )  const [inline, virtual]

Reimplemented from RawDataBaseCnv.

Definition at line 47 of file RawDataHltRawCnv.h.

References PACKEDRAWEVENT_StorageType.

00047                                    {
00048        return PACKEDRAWEVENT_StorageType;
00049    }

static const unsigned char RawDataHltRawCnv::storageType (  )  [inline, static]

Reimplemented from RawDataBaseCnv.

Definition at line 51 of file RawDataHltRawCnv.h.

References PACKEDRAWEVENT_StorageType.

00051                                             {
00052        return PACKEDRAWEVENT_StorageType;
00053    }

StatusCode RawDataHltRawCnv::updateObj ( IOpaqueAddress *  ,
DataObject *   
) [virtual]

override the RawDataBaseCnv version

Definition at line 100 of file RawDataHltRawCnv.cxx.

00100                                                                               {
00101     // Purpose and Method:  This method does nothing other than announce it has
00102     //   been called.
00103 
00104     //MsgStream log(msgSvc(), "RawDataHltRawCnv");
00105     //log << MSG::DEBUG << "RawDataHltRawCnv::updateObj" << endreq;
00106     return Converter::updateObj(pAddr, pObj);
00107 }

StatusCode RawDataBaseCnv::updateRep ( IOpaqueAddress *  pAddress,
DataObject *  pObject 
) [virtual, inherited]

Update the converted representation of a transient object.

Definition at line 36 of file RawDataBaseCnv.cxx.

00037                                               {
00038     // Purpose and Method:  Update the converted representation of a transient 
00039     //     object.  It is expected that derived classes will override this.
00040     return StatusCode::SUCCESS;
00041 }

StatusCode RawDataBaseCnv::updateRepRefs ( IOpaqueAddress *  pAddress,
DataObject *  pObject 
) [virtual, inherited]

Update the references of an already converted object.

Definition at line 43 of file RawDataBaseCnv.cxx.

00044                                                 {
00045     // Purpose and Method:  Update the references of an already converted object.
00046     //   It is expected that derived classes will override this method.
00047     return StatusCode::SUCCESS;
00048 }


Friends And Related Function Documentation

friend class CnvFactory< RawDataHltRawCnv > [friend]

Definition at line 36 of file RawDataHltRawCnv.h.


Member Data Documentation

IRawDataCnvSvc* RawDataBaseCnv::m_CnvSvc [protected, inherited]

Pointer to event conversion service interface.

Definition at line 28 of file RawDataBaseCnv.h.

Referenced by RawDataBaseCnv::finalize().

HltBuilder RawDataHltRawCnv::m_hltBuilder [private]

HltBuilder for packing or unpacking data.

Definition at line 68 of file RawDataHltRawCnv.h.

Referenced by createObj(), and createRep().

IRawDataInputSvc* RawDataHltRawCnv::m_inputSvc [private]

Definition at line 64 of file RawDataHltRawCnv.h.

Referenced by createObj(), and initialize().

std::vector<IRawDataCnvSvc::Leaf> RawDataBaseCnv::m_leaves [protected, inherited]

Leaf objects giving the locations of the objects in the data store.

Definition at line 30 of file RawDataBaseCnv.h.

PackedRawDataCnvSvc* RawDataHltRawCnv::m_RawDataAccess [private]

Define the interface to raw data cnv.

Definition at line 66 of file RawDataHltRawCnv.h.

Referenced by createRep(), and initialize().


Generated on Tue Nov 29 23:20:45 2016 for BOSS_7.0.2 by  doxygen 1.4.7