RawDataEmcDigiCnv Class Reference

#include <RawDataEmcDigiCnv.h>

Inheritance diagram for RawDataEmcDigiCnv:

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

 RawDataEmcDigiCnv (ISvcLocator *svc)
 ~RawDataEmcDigiCnv ()
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.
EmcConverterm_cnv
 Emc converter for unpacking or packing data.

Friends

class CnvFactory< RawDataEmcDigiCnv >

Detailed Description

Definition at line 29 of file RawDataEmcDigiCnv.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

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

Definition at line 33 of file RawDataEmcDigiCnv.cxx.

00033                                                      : 
00034 RawDataBaseCnv(PACKEDRAWEVENT_StorageType, classID(), svc) 
00035 {
00036 }

RawDataEmcDigiCnv::~RawDataEmcDigiCnv (  )  [protected]

Definition at line 37 of file RawDataEmcDigiCnv.cxx.

References EmcConverter::destroy().

00037                                      {
00038    EmcConverter::destroy();
00039 }


Member Function Documentation

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

Reimplemented from RawDataBaseCnv.

Definition at line 43 of file RawDataEmcDigiCnv.cxx.

References CLID_EmcDigiCol.

Referenced by PackedRawDataCnvSvc::addConverters().

00044 {
00045    return CLID_EmcDigiCol;
00046 }

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

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

Definition at line 111 of file RawDataEmcDigiCnv.cxx.

References EmcConverter::convert(), IRawDataInputSvc::currentEvent(), RAWEVENT::getEmcBuf(), m_cnv, m_inputSvc, and msgSvc().

00112 {
00113    MsgStream log(msgSvc(), "RawDataEmcDigiCnv");
00114 
00115    // Purpose and Method:  This converter will create an empty EmcDigiCol on
00116    //   the TDS.
00117    EmcDigiCol *digiCol = new EmcDigiCol;
00118    pObj = digiCol;
00119 
00120    RAWEVENT *evt = m_inputSvc->currentEvent(); 
00121    if (evt == NULL) {
00122      cout << "RawDataEmcDigiCnv::createObj can't get event!" << endl; 
00123      return StatusCode::FAILURE;
00124    }
00125 
00126    const BufferHolder& emcBuf = evt->getEmcBuf();
00127 
00128    return m_cnv->convert(emcBuf, digiCol); 
00129 }

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

Convert the transient object to the requested representation.

Reimplemented from RawDataBaseCnv.

Definition at line 131 of file RawDataEmcDigiCnv.cxx.

References EmcConverter::convert(), EventModel::Digi::EmcDigiCol, PackedRawDataCnvSvc::getRawEvent(), m_cnv, m_RawDataAccess, and msgSvc().

00132 {
00133   // convert PixelRaw in the container into ByteStream
00134   MsgStream log(msgSvc(), "RawDataEmcDigiCnv");
00135 
00136   WriteRawEvent*& re = m_RawDataAccess->getRawEvent(); 
00137   if (re == 0) {
00138     log << " get RawEvent failed !" << endreq;
00139     return StatusCode::FAILURE; 
00140   }
00141 
00142   SmartDataPtr<EmcDigiCol> digiCol(dataProvider(), EventModel::Digi::EmcDigiCol);
00143   if (digiCol == 0) {
00144     log << "no EmcDigiCol found" << endreq;
00145     return StatusCode::FAILURE;
00146   }
00147   /*
00148   else {
00149     log << MSG::INFO << endreq << "Detailed dump of 1st event: " << endreq << endreq;
00150     int ndigi = 0;
00151     EmcDigiCol::const_iterator pEmcDigi = digiCol->begin();
00152     for (pEmcDigi; pEmcDigi!= digiCol->end(); pEmcDigi++) {
00153       log <<MSG::INFO << "Digi " << ndigi++ << " ";
00154       // output the digi proper:  " << digi " no longer works because
00155       // "digi" now returns an integer sort order
00156       (**pEmcDigi).fillStream(log.stream());
00157       log << endreq;
00158     }
00159   }
00160   */
00161 
00162   return m_cnv->convert(digiCol, re);
00163 }

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 RawDataEmcDigiCnv::initialize (  ) 

Reimplemented from RawDataBaseCnv.

Definition at line 48 of file RawDataEmcDigiCnv.cxx.

References calibUtil::ERROR, RawDataBaseCnv::initialize(), EmcConverter::instance(), m_cnv, m_inputSvc, m_RawDataAccess, msgSvc(), IRawDataInputSvc::runMode(), deljobs::string, and Bes_Common::WARNING.

00049 {
00050    std::string PackedRawDataCnvSvc_Name("PackedRawDataCnvSvc");
00051    std::string RawDataInputSvc_Name("RawDataInputSvc");
00052    std::string RawDataEmcDigiCnv_Name("RawDataEmcDigiCnv");
00053    //std::string RawDataProviderSvc_Name("RawDataProviderSvc");
00054 
00055    // for Mutil-thread by tianhl
00056    //ConversionSvc*  pCnvSvc = 0;
00057    SmartIF<IService> pCnvSvc(conversionSvc());
00058    //if (pCnvSvc = dynamic_cast<ConversionSvc*>(conversionSvc())){
00059       if  (isGaudiThreaded(pCnvSvc->name())){
00060          PackedRawDataCnvSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
00061          RawDataInputSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
00062          RawDataEmcDigiCnv_Name += getGaudiThreadIDfromName(pCnvSvc->name());
00063          //RawDataProviderSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
00064       }
00065    //}
00066    // for Mutil-thread by tianhl
00067    MsgStream log(msgSvc(), RawDataEmcDigiCnv_Name.c_str());
00068 
00069    StatusCode sc = RawDataBaseCnv::initialize();
00070    if ( sc.isFailure() ) {
00071       return sc;
00072    }
00073 
00074    // Check RawDataCnvSvc
00075    IService* isvc = 0;
00076    StatusCode status = serviceLocator()->service(PackedRawDataCnvSvc_Name.c_str(), isvc, true);
00077    m_RawDataAccess = dynamic_cast<PackedRawDataCnvSvc*> (isvc); 
00078    if(m_RawDataAccess  == 0 ) {
00079       log<<MSG::ERROR<< "  RawDataCnv: Cant cast to  RawDataCnvSvc " <<endreq; 
00080       return StatusCode::FAILURE ;
00081    }
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    m_inputSvc = dynamic_cast<RawDataInputSvc*> (svc);
00090    if ( m_inputSvc == 0 ) {
00091       log<<MSG::WARNING<< " Cant cast to  RawDataInputSvc " <<endreq;
00092       return StatusCode::FAILURE ;
00093    }
00094 
00095    m_cnv = EmcConverter::instance( m_inputSvc->runMode() );
00096 
00097    return StatusCode::SUCCESS; 
00098 }

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

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

Reimplemented from RawDataBaseCnv.

Definition at line 44 of file RawDataEmcDigiCnv.h.

References PACKEDRAWEVENT_StorageType.

00044                                    {
00045        return PACKEDRAWEVENT_StorageType;
00046    }

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

Reimplemented from RawDataBaseCnv.

Definition at line 48 of file RawDataEmcDigiCnv.h.

References PACKEDRAWEVENT_StorageType.

00048                                             {
00049        return PACKEDRAWEVENT_StorageType;
00050    }

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

override the RawDataBaseCnv version

Definition at line 101 of file RawDataEmcDigiCnv.cxx.

References Bes_Common::DEBUG, and msgSvc().

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

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< RawDataEmcDigiCnv > [friend]

Definition at line 33 of file RawDataEmcDigiCnv.h.


Member Data Documentation

EmcConverter* RawDataEmcDigiCnv::m_cnv [private]

Emc converter for unpacking or packing data.

Definition at line 65 of file RawDataEmcDigiCnv.h.

Referenced by createObj(), createRep(), and initialize().

IRawDataCnvSvc* RawDataBaseCnv::m_CnvSvc [protected, inherited]

Pointer to event conversion service interface.

Definition at line 28 of file RawDataBaseCnv.h.

Referenced by RawDataBaseCnv::finalize().

IRawDataInputSvc* RawDataEmcDigiCnv::m_inputSvc [private]

Definition at line 61 of file RawDataEmcDigiCnv.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* RawDataEmcDigiCnv::m_RawDataAccess [private]

Define the interface to raw data cnv.

Definition at line 63 of file RawDataEmcDigiCnv.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