RawDataMucMcHitCnv Class Reference

#include <RawDataMucMcHitCnv.h>

Inheritance diagram for RawDataMucMcHitCnv:

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

 RawDataMucMcHitCnv (ISvcLocator *svc)
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.
MucMcHitBuilder m_mucMcHitBuilder
 MucMcHitder for packing or unpacking data.

Friends

class CnvFactory< RawDataMucMcHitCnv >

Detailed Description

Definition at line 32 of file RawDataMucMcHitCnv.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

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

Definition at line 38 of file RawDataMucMcHitCnv.cxx.

00038                                                        : 
00039 RawDataBaseCnv(PACKEDRAWEVENT_StorageType, classID(), svc) 
00040 {
00041   //init();
00042 }


Member Function Documentation

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

Reimplemented from RawDataBaseCnv.

Definition at line 46 of file RawDataMucMcHitCnv.cxx.

References CLID_MucMcHitCol.

Referenced by PackedRawDataCnvSvc::addConverters().

00047 {
00048   return CLID_MucMcHitCol;
00049 }

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

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

Definition at line 116 of file RawDataMucMcHitCnv.cxx.

References MucID::channel_id(), IRawDataInputSvc::currentEvent(), MucTruth_t::gapId, RAWEVENT::getMucTruth(), iter(), m_inputSvc, m_mucMcHitBuilder, MucMcHitBuilder::m_pxCoeff, MucMcHitBuilder::m_pyCoeff, MucMcHitBuilder::m_pzCoeff, MucMcHitBuilder::m_xCoeff, MucMcHitBuilder::m_yCoeff, MucMcHitBuilder::m_zCoeff, EventModel::MC::MucMcHitCol, MucTruth_t::partId, MucTruth_t::px, MucTruth_t::py, MucTruth_t::pz, MucTruth_t::segId, MucTruth_t::stripId, MucTruth_t::trackIndex, MucMcHitBuilder::unPack(), MucTruth_t::x, MucTruth_t::y, and MucTruth_t::z.

00117 {
00118   //MsgStream log(msgSvc(), "RawDataMucMcHitCnv");
00119 
00120   //This converter will create an empty MucMcHitCol on the TDS
00121   MucMcHitCol *mucMcHitCol = new MucMcHitCol;
00122   pObj = mucMcHitCol;
00123    
00124   RAWEVENT *evt = m_inputSvc->currentEvent(); 
00125   if (evt == NULL) {
00126       //log << MSG::ERROR << "RawDataCnv has no event!" << endreq; 
00127       return StatusCode::FAILURE;
00128   }
00129   
00130   assert((evt->getMucTruth().size()%7) == 0);
00131 
00132   MucMcHit* mucMcHit;
00133   MucTruth_t m_MucTruth;
00134 
00135   std::vector<uint32_t>::const_iterator iter = evt->getMucTruth().begin();
00136   std::vector<uint32_t>::const_iterator eiter = evt->getMucTruth().end();
00137 
00138   for (int mucMcHitId = 0; iter != eiter; mucMcHitId++) {
00139     //retrieve the MucTruth data
00140     m_mucMcHitBuilder.unPack(iter, eiter, m_MucTruth);
00141     //construct the identifier
00142     const Identifier ident = MucID::channel_id
00143       (m_MucTruth.partId, m_MucTruth.segId, m_MucTruth.gapId, m_MucTruth.stripId);
00144     //construct the MucMcHit
00145     mucMcHit = new MucMcHit(ident, m_MucTruth.trackIndex%1000,
00146                        m_MucTruth.x/(m_mucMcHitBuilder.m_xCoeff*1.0),
00147                        m_MucTruth.y/(m_mucMcHitBuilder.m_yCoeff*1.0),
00148                        m_MucTruth.z/(m_mucMcHitBuilder.m_zCoeff*1.0),
00149                        m_MucTruth.px/(m_mucMcHitBuilder.m_pxCoeff*1.0),
00150                        m_MucTruth.py/(m_mucMcHitBuilder.m_pyCoeff*1.0),
00151                        m_MucTruth.pz/(m_mucMcHitBuilder.m_pzCoeff*1.0)  );
00152     // And add the stuff to the container
00153     mucMcHitCol->push_back(mucMcHit);
00154   }
00155 
00156   return StatusCode::SUCCESS; 
00157 
00158 }

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

Convert the transient object to the requested representation.

Reimplemented from RawDataBaseCnv.

Definition at line 160 of file RawDataMucMcHitCnv.cxx.

References PackedRawDataCnvSvc::getRawEvent(), m_mucMcHitBuilder, m_RawDataAccess, EventModel::MC::MucMcHitCol, and MucMcHitBuilder::pack().

00161 {
00162    // convert PixelRaw in the container into ByteStream
00163   //MsgStream log(messageService(), "RawDataMucMcHitCnv");
00164   
00165   WriteRawEvent*& re = m_RawDataAccess->getRawEvent(); 
00166   
00167   if (re == 0) {
00168      //log << " get RawEvent failed !" << endreq;
00169      return StatusCode::FAILURE; 
00170   }
00171 
00172   SmartDataPtr<MucMcHitCol> mcHitCol(dataProvider(), EventModel::MC::MucMcHitCol);
00173 
00174   if (mcHitCol == 0) {
00175      //log << "no MucMcHitCol found" << endreq;
00176      return StatusCode::FAILURE;
00177   }
00178   
00179   StatusCode sc = m_mucMcHitBuilder.pack(mcHitCol, re);
00180 
00181   return sc; 
00182 
00183 }

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

Reimplemented from RawDataBaseCnv.

Definition at line 51 of file RawDataMucMcHitCnv.cxx.

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

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

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

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

Reimplemented from RawDataBaseCnv.

Definition at line 46 of file RawDataMucMcHitCnv.h.

References PACKEDRAWEVENT_StorageType.

00046                                    {
00047       return PACKEDRAWEVENT_StorageType;
00048    }

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

Reimplemented from RawDataBaseCnv.

Definition at line 50 of file RawDataMucMcHitCnv.h.

References PACKEDRAWEVENT_StorageType.

00050                                             {
00051       return PACKEDRAWEVENT_StorageType;
00052    }

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

override the RawDataBaseCnv version

Definition at line 106 of file RawDataMucMcHitCnv.cxx.

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

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

Definition at line 36 of file RawDataMucMcHitCnv.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().

IRawDataInputSvc* RawDataMucMcHitCnv::m_inputSvc [private]

Definition at line 64 of file RawDataMucMcHitCnv.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.

MucMcHitBuilder RawDataMucMcHitCnv::m_mucMcHitBuilder [private]

MucMcHitder for packing or unpacking data.

Definition at line 68 of file RawDataMucMcHitCnv.h.

Referenced by createObj(), and createRep().

PackedRawDataCnvSvc* RawDataMucMcHitCnv::m_RawDataAccess [private]

Define the interface to raw data cnv.

Definition at line 66 of file RawDataMucMcHitCnv.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