RawDataTofDigiCnv Class Reference

#include <RawDataTofDigiCnv.h>

Inheritance diagram for RawDataTofDigiCnv:

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

 RawDataTofDigiCnv (ISvcLocator *svc)
 ~RawDataTofDigiCnv ()
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.
TofConverterm_cnv
 TofConverter for packing or unpacking data.

Friends

class CnvFactory< RawDataTofDigiCnv >

Detailed Description

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

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

Definition at line 31 of file RawDataTofDigiCnv.cxx.

00031                                                      : 
00032 RawDataBaseCnv(PACKEDRAWEVENT_StorageType, classID(), svc) 
00033 {
00034 }

RawDataTofDigiCnv::~RawDataTofDigiCnv (  )  [protected]

Definition at line 36 of file RawDataTofDigiCnv.cxx.

References TofConverter::destroy().

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


Member Function Documentation

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

Reimplemented from RawDataBaseCnv.

Definition at line 43 of file RawDataTofDigiCnv.cxx.

References CLID_TofDigiCol.

Referenced by PackedRawDataCnvSvc::addConverters().

00044 {
00045    return CLID_TofDigiCol;
00046 }

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

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

Definition at line 109 of file RawDataTofDigiCnv.cxx.

References TofConverter::convert(), IRawDataInputSvc::currentEvent(), calibUtil::ERROR, RAWEVENT::getTofBuf(), EventModel::Digi::LumiDigiCol, m_cnv, m_inputSvc, msgSvc(), EVENT::tofDigi, and EventModel::Digi::TofDigiCol.

00110 {
00111    MsgStream log(msgSvc(), "RawDataTofDigiCnv");
00112 
00113    uint32_t TEId, TEData, TEOverflow, TETorQ;
00114    TofDigi* tofDigi;
00115    // Purpose and Method:  This converter will create an empty TofDigiCol on
00116    //   the TDS.
00117    TofDigiCol *digiCol = new TofDigiCol;
00118    pObj = digiCol;
00119 
00120    //zoujh: for luminosity begin ...................
00121    LumiDigiCol *lumiDigiCol = 0;
00122    DataObject* pLumi;
00123    dataProvider()->findObject("/Event/Digi/LumiDigiCol", pLumi);
00124    if ( pLumi == NULL ) {
00125       lumiDigiCol = new LumiDigiCol;
00126       StatusCode sc = dataProvider()->registerObject("/Event/Digi/LumiDigiCol", lumiDigiCol);
00127       if ( sc.isFailure() ) {
00128          log << MSG::ERROR << "Could not register LumiDigiCol in TDS!" << endreq;
00129       }
00130    }
00131    else {
00132       lumiDigiCol = dynamic_cast<LumiDigiCol*>(pLumi);
00133    }
00134    //zoujh: for luminosity end ^^^^^^^^^^^^^^^^^^^^^
00135     
00136    RAWEVENT* evt = m_inputSvc->currentEvent(); 
00137    if (evt == NULL) {
00138      cout << "RawDataTofDigiCnv::createObj has no event!" << endl; 
00139      return StatusCode::FAILURE;
00140    }
00141 
00142    const BufferHolder& tofBuf = evt->getTofBuf();
00143    const BufferHolder& etfBuf = evt->getEtfBuf();
00144 
00145    return m_cnv->convert(tofBuf, etfBuf, digiCol, lumiDigiCol);
00146 }

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

Convert the transient object to the requested representation.

Reimplemented from RawDataBaseCnv.

Definition at line 148 of file RawDataTofDigiCnv.cxx.

References TofConverter::convert(), PackedRawDataCnvSvc::getRawEvent(), m_cnv, m_RawDataAccess, and EventModel::Digi::TofDigiCol.

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

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

Reimplemented from RawDataBaseCnv.

Definition at line 48 of file RawDataTofDigiCnv.cxx.

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

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

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

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

Reimplemented from RawDataBaseCnv.

Definition at line 46 of file RawDataTofDigiCnv.h.

References PACKEDRAWEVENT_StorageType.

00046                                    {
00047        return PACKEDRAWEVENT_StorageType;
00048    }

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

Reimplemented from RawDataBaseCnv.

Definition at line 50 of file RawDataTofDigiCnv.h.

References PACKEDRAWEVENT_StorageType.

00050                                             {
00051        return PACKEDRAWEVENT_StorageType;
00052    }

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

override the RawDataBaseCnv version

Definition at line 99 of file RawDataTofDigiCnv.cxx.

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

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

Definition at line 34 of file RawDataTofDigiCnv.h.


Member Data Documentation

TofConverter* RawDataTofDigiCnv::m_cnv [private]

TofConverter for packing or unpacking data.

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

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

Define the interface to raw data cnv.

Definition at line 65 of file RawDataTofDigiCnv.h.

Referenced by createRep(), and initialize().


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