RawDataMdcDigiCnv Class Reference

#include <RawDataMdcDigiCnv.h>

Inheritance diagram for RawDataMdcDigiCnv:

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

 RawDataMdcDigiCnv (ISvcLocator *svc)
 ~RawDataMdcDigiCnv ()
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.
MdcConverterm_cnv
 MdcConverter for packing or unpacking data.
int m_runFrom
int m_runTo

Friends

class CnvFactory< RawDataMdcDigiCnv >

Detailed Description

Definition at line 30 of file RawDataMdcDigiCnv.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

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

Definition at line 32 of file RawDataMdcDigiCnv.cxx.

References m_runFrom, and m_runTo.

00032                                                      : 
00033 RawDataBaseCnv(PACKEDRAWEVENT_StorageType, classID(), svc) 
00034 {
00035    PropertyMgr m_propMgr;
00036    m_propMgr.declareProperty("ExWireFromRun", m_runFrom = 0 );  
00037    m_propMgr.declareProperty("ExWireToRun",   m_runTo = 999999);
00038 
00039    IJobOptionsSvc* jobSvc; 
00040    serviceLocator()->service("JobOptionsSvc", jobSvc);
00041    jobSvc->setMyProperties("RawDataMdcDigiCnv", &m_propMgr);
00042 }

RawDataMdcDigiCnv::~RawDataMdcDigiCnv (  )  [protected]

Definition at line 44 of file RawDataMdcDigiCnv.cxx.

References MdcConverter::destroy().

00045 {
00046    MdcConverter::destroy();
00047 }


Member Function Documentation

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

Reimplemented from RawDataBaseCnv.

Definition at line 51 of file RawDataMdcDigiCnv.cxx.

References CLID_MdcDigiCol.

Referenced by PackedRawDataCnvSvc::addConverters().

00052 {
00053    return CLID_MdcDigiCol;
00054 }

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

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

Definition at line 120 of file RawDataMdcDigiCnv.cxx.

References MdcConverter::convert(), IRawDataInputSvc::currentEvent(), RAWEVENT::eventHeader(), RAWEVENT::getMdcBuf(), m_cnv, m_inputSvc, EventModel::Digi::MdcDigiCol, and MdcConverter::setRunId().

00121 {
00122   //MsgStream log(msgSvc(), "RawDataMdcDigiCnv");
00123 
00124   // Purpose and Method:  This converter will create an empty MdcDigiCol on
00125   //   the TDS.
00126   MdcDigiCol *digiCol = new MdcDigiCol;
00127   pObj = digiCol;
00128 
00129   RAWEVENT* evt = m_inputSvc->currentEvent(); 
00130 
00131   if (evt == NULL) {
00132     //log << MSG::ERROR << "RawDataMdcDigiCnv::createObj has event!" << endreq; 
00133     return StatusCode::FAILURE;
00134   }
00135 
00136   int runId = evt->eventHeader().run_number();
00137   m_cnv->setRunId(runId);
00138 
00139   const BufferHolder& mdcBuf = evt->getMdcBuf();
00140 
00141   return m_cnv->convert(mdcBuf, digiCol);
00142 }

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

Convert the transient object to the requested representation.

Reimplemented from RawDataBaseCnv.

Definition at line 144 of file RawDataMdcDigiCnv.cxx.

References MdcConverter::convert(), PackedRawDataCnvSvc::getRawEvent(), m_cnv, m_RawDataAccess, and EventModel::Digi::MdcDigiCol.

00145 {
00146   // convert PixelRaw in the container into ByteStream
00147   MsgStream log(messageService(), "RawDataMdcDigiCnv");
00148 
00149   WriteRawEvent*& re = m_RawDataAccess->getRawEvent(); 
00150   if (re == 0) {
00151     log << " get RawEvent failed !" << endreq;
00152     return StatusCode::FAILURE; 
00153   }
00154 
00155   SmartDataPtr<MdcDigiCol> digiCol(dataProvider(), EventModel::Digi::MdcDigiCol);
00156   if (digiCol == 0) {
00157     log << "no MdcDigiCol found" << endreq;
00158     return StatusCode::FAILURE;
00159   }
00160   /*
00161   else {
00162     log << MSG::DEBUG << endreq << "Detailed dump of 1st event: " << endreq << endreq;
00163     int ndigi = 0;
00164     MdcDigiCol::const_iterator pMdcDigi = digiCol->begin();
00165     for (pMdcDigi; pMdcDigi!= digiCol->end(); pMdcDigi++) {
00166       log <<MSG::INFO << "Digi " << ndigi++ << " ";
00167       // output the digi proper:  " << digi " no longer works because
00168       // "digi" now returns an integer sort order
00169       (**pMdcDigi).fillStream(log.stream());
00170       log << endreq;
00171     }
00172   }
00173   */
00174 
00175   return m_cnv->convert(digiCol, re);
00176 }

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

Reimplemented from RawDataBaseCnv.

Definition at line 56 of file RawDataMdcDigiCnv.cxx.

References calibUtil::ERROR, MdcConverter::init(), RawDataBaseCnv::initialize(), MdcConverter::instance(), m_cnv, m_inputSvc, m_RawDataAccess, m_runFrom, m_runTo, IRawDataInputSvc::runMode(), deljobs::string, and Bes_Common::WARNING.

00057 {
00058    std::string PackedRawDataCnvSvc_Name("PackedRawDataCnvSvc");
00059    std::string RawDataInputSvc_Name("RawDataInputSvc");
00060    std::string RawDataMdcDigiCnv_Name("RawDataMdcDigiCnv");
00061 
00062    // for Mutil-thread by tianhl
00063    //ConversionSvc*  pCnvSvc = 0;
00064    //if (pCnvSvc = dynamic_cast<ConversionSvc*>(conversionSvc())){
00065    SmartIF<IService> pCnvSvc(conversionSvc());   
00066    if  (isGaudiThreaded(pCnvSvc->name())){
00067          PackedRawDataCnvSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
00068          RawDataInputSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
00069          RawDataMdcDigiCnv_Name += getGaudiThreadIDfromName(pCnvSvc->name());
00070       }
00071    //}
00072 
00073 
00074    StatusCode sc = RawDataBaseCnv::initialize();
00075    if ( sc.isFailure() ) {
00076       return sc;
00077    }
00078 
00079    MsgStream log(messageService(), RawDataMdcDigiCnv_Name.c_str());
00080 
00081    // Check RawDataCnvSvc
00082    IService* isvc = 0;
00083    StatusCode status = serviceLocator()->service(PackedRawDataCnvSvc_Name.c_str(), isvc, true);
00084    m_RawDataAccess = dynamic_cast<PackedRawDataCnvSvc*> (isvc); 
00085    if(m_RawDataAccess  == 0 ) {
00086       log<<MSG::ERROR<< "  RawDataMdcCnv: Cant cast to  RawDataCnvSvc " <<endreq; 
00087       return StatusCode::FAILURE ;
00088    }
00089 
00090    IService* svc ;
00091    sc = serviceLocator()->getService(RawDataInputSvc_Name.c_str(), svc);
00092    //if ( sc.isFailure() ) {
00093    //   log<<MSG::WARNING << " Cant get RawDataInputSvc " <<endreq;
00094    //   return sc ;
00095    //}
00096    m_inputSvc = dynamic_cast<RawDataInputSvc*> (svc);
00097    if(m_inputSvc == 0 ) {
00098       log<<MSG::WARNING<< " Cant cast to  RawDataInputSvc " <<endreq;
00099       return StatusCode::FAILURE ;
00100    }
00101 
00102    m_cnv = MdcConverter::instance( m_inputSvc->runMode() );
00103 
00104    m_cnv->init(m_runFrom, m_runTo);
00105 
00106    return StatusCode::SUCCESS; 
00107 }

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

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

Reimplemented from RawDataBaseCnv.

Definition at line 46 of file RawDataMdcDigiCnv.h.

References PACKEDRAWEVENT_StorageType.

00046                                    {
00047           return PACKEDRAWEVENT_StorageType;
00048    }

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

Reimplemented from RawDataBaseCnv.

Definition at line 50 of file RawDataMdcDigiCnv.h.

References PACKEDRAWEVENT_StorageType.

00050                                             {
00051        return PACKEDRAWEVENT_StorageType;
00052    }

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

override the RawDataBaseCnv version

Definition at line 110 of file RawDataMdcDigiCnv.cxx.

00110                                                                                {
00111     // Purpose and Method:  This method does nothing other than announce it has
00112     //   been called.
00113 
00114     //MsgStream log(msgSvc(), "RawDataMdcDigiCnv");
00115     //log << MSG::DEBUG << "RawDataMdcDigiCnv::updateObj" << endreq;
00116     return Converter::updateObj(pAddr, pObj);
00117 }

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

Definition at line 34 of file RawDataMdcDigiCnv.h.


Member Data Documentation

MdcConverter* RawDataMdcDigiCnv::m_cnv [private]

MdcConverter for packing or unpacking data.

Definition at line 67 of file RawDataMdcDigiCnv.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* RawDataMdcDigiCnv::m_inputSvc [private]

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

Define the interface to raw data cnv.

Definition at line 65 of file RawDataMdcDigiCnv.h.

Referenced by createRep(), and initialize().

int RawDataMdcDigiCnv::m_runFrom [private]

Definition at line 69 of file RawDataMdcDigiCnv.h.

Referenced by initialize(), and RawDataMdcDigiCnv().

int RawDataMdcDigiCnv::m_runTo [private]

Definition at line 70 of file RawDataMdcDigiCnv.h.

Referenced by initialize(), and RawDataMdcDigiCnv().


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