BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
TofDigiCnv Class Reference

#include <TofDigiCnv.h>

Inheritance diagram for TofDigiCnv:

Public Member Functions

virtual ~TofDigiCnv ()
 TofDigiCnv (ISvcLocator *svc)
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
virtual ~TofDigiCnv ()
 TofDigiCnv (ISvcLocator *svc)
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
virtual ~TofDigiCnv ()
 TofDigiCnv (ISvcLocator *svc)
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
Public Member Functions inherited from RootEventBaseCnv
 RootEventBaseCnv (const CLID &clid, ISvcLocator *svc)
virtual ~RootEventBaseCnv ()
virtual long repSvcType () const
virtual StatusCode initialize ()
virtual StatusCode finalize ()
void declareObject (const std::string &fullPath, const CLID &clid, const std::string &treename, const std::string &branchname)
 Store TDS path to link a particular converter to an object on the TDS.
virtual StatusCode createObj (IOpaqueAddress *addr, DataObject *&dat)
 Convert the persistent object to transient.
virtual StatusCode createRep (DataObject *pObject, IOpaqueAddress *&refpAddress)
 Convert the transient object to the requested representation.
virtual StatusCode fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the converted object.
virtual StatusCode fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the converted object.
TObject * getReadObject () const
 get the object to be read
 RootEventBaseCnv (const CLID &clid, ISvcLocator *svc)
virtual ~RootEventBaseCnv ()
virtual long repSvcType () const
virtual StatusCode initialize ()
virtual StatusCode finalize ()
void declareObject (const std::string &fullPath, const CLID &clid, const std::string &treename, const std::string &branchname)
 Store TDS path to link a particular converter to an object on the TDS.
virtual StatusCode createObj (IOpaqueAddress *addr, DataObject *&dat)
 Convert the persistent object to transient.
virtual StatusCode createRep (DataObject *pObject, IOpaqueAddress *&refpAddress)
 Convert the transient object to the requested representation.
virtual StatusCode fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the converted object.
virtual StatusCode fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the converted object.
TObject * getReadObject () const
 get the object to be read
 RootEventBaseCnv (const CLID &clid, ISvcLocator *svc)
virtual ~RootEventBaseCnv ()
virtual long repSvcType () const
virtual StatusCode initialize ()
virtual StatusCode finalize ()
void declareObject (const std::string &fullPath, const CLID &clid, const std::string &treename, const std::string &branchname)
 Store TDS path to link a particular converter to an object on the TDS.
virtual StatusCode createObj (IOpaqueAddress *addr, DataObject *&dat)
 Convert the persistent object to transient.
virtual StatusCode createRep (DataObject *pObject, IOpaqueAddress *&refpAddress)
 Convert the transient object to the requested representation.
virtual StatusCode fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the converted object.
virtual StatusCode fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the converted object.
TObject * getReadObject () const
 get the object to be read
Public Member Functions inherited from Converter< Ty1, Ty2 >
destinationoperator (const source &) const
destinationoperator (const source &) const
destinationoperator (const source &) const

Static Public Member Functions

static const CLID & classID ()
static const CLID & classID ()
static const CLID & classID ()
Static Public Member Functions inherited from RootEventBaseCnv
static const unsigned char storageType ()
 Storage type and class ID.
static const unsigned char storageType ()
 Storage type and class ID.
static const unsigned char storageType ()
 Storage type and class ID.

Friends

class CnvFactory< TofDigiCnv >

Additional Inherited Members

Public Types inherited from Converter< Ty1, Ty2 >
typedef Ty1 source
typedef Ty2 destination
typedef Ty1 source
typedef Ty2 destination
typedef Ty1 source
typedef Ty2 destination
Protected Member Functions inherited from Converter< Ty1, Ty2 >
virtual destinationconvert (const source &) const =0
virtual destinationconvert (const source &) const =0
virtual destinationconvert (const source &) const =0
Protected Attributes inherited from RootEventBaseCnv
IRootCnvSvcm_cnvSvc
std::vector< RootCnvSvc::Leafm_leaves
RootInterfacem_rootInterface
 pointer to the RootInterface
IDataProviderSvc * m_eds
 pointer to eventdataservice
int m_branchNr
 the branchNr of this converter for writing
int m_branchNrDst
int m_branchNrMc
int m_branchNrRecon
int m_branchNrEvtRec
int m_branchNrEvtHeader
int m_branchNrEvtNavigator
TObject * m_objRead
 the object that was read
CLID CLID_top
 the CLID of the upper converter if any
TArrayS * m_branchNumbers
 array with number of branches for reading
std::string m_rootBranchname
 root branchname (may be concatenated of severals)
std::string m_rootTreename
 each converter knows it's treename
std::string m_currentFileName
std::vector< void * > m_adresses
 each converter knows the corresponding adresses
RootEvtSelectorm_evtsel

Detailed Description

Constructor & Destructor Documentation

◆ ~TofDigiCnv() [1/3]

virtual TofDigiCnv::~TofDigiCnv ( )
inlinevirtual

Definition at line 21 of file Event/RootCnvSvc/include/RootCnvSvc/Digi/TofDigiCnv.h.

21{};

◆ TofDigiCnv() [1/3]

TofDigiCnv::TofDigiCnv ( ISvcLocator * svc)

Definition at line 24 of file TofDigiCnv.cxx.

24 : RootEventBaseCnv( classID(), svc ) {
25 // Here we associate this converter with the /Event path on the TDS.
26 MsgStream log( msgSvc(), "TofDigiCnv" );
27 // log << MSG::DEBUG << "Constructor called for " << objType() << endmsg;
28 m_rootBranchname = "m_tofDigiCol";
29 // declareObject(EventModel::Digi::TofDigiCol, objType(), m_rootTreename, m_rootBranchname);
30 m_adresses.push_back( &m_tofDigiCol );
31 m_tofDigiCol = 0;
32}
IMessageSvc * msgSvc()
std::vector< void * > m_adresses
each converter knows the corresponding adresses
std::string m_rootBranchname
root branchname (may be concatenated of severals)
RootEventBaseCnv(const CLID &clid, ISvcLocator *svc)

◆ ~TofDigiCnv() [2/3]

virtual TofDigiCnv::~TofDigiCnv ( )
inlinevirtual

◆ TofDigiCnv() [2/3]

TofDigiCnv::TofDigiCnv ( ISvcLocator * svc)

◆ ~TofDigiCnv() [3/3]

virtual TofDigiCnv::~TofDigiCnv ( )
inlinevirtual

◆ TofDigiCnv() [3/3]

TofDigiCnv::TofDigiCnv ( ISvcLocator * svc)

Member Function Documentation

◆ classID() [1/3]

const CLID & TofDigiCnv::classID ( )
inlinestatic

Definition at line 19 of file Event/RootCnvSvc/include/RootCnvSvc/Digi/TofDigiCnv.h.

19{ return CLID_TofDigiCol; }
const CLID & CLID_TofDigiCol

Referenced by RootCnvSvc::createConverter(), and TofDigiCnv().

◆ classID() [2/3]

const CLID & TofDigiCnv::classID ( )
inlinestatic

◆ classID() [3/3]

const CLID & TofDigiCnv::classID ( )
inlinestatic

◆ DataObjectToTObject() [1/3]

StatusCode TofDigiCnv::DataObjectToTObject ( DataObject * obj,
RootAddress * addr )
virtual

transformation to root

Implements RootEventBaseCnv.

Definition at line 73 of file TofDigiCnv.cxx.

73 {
74
75 MsgStream log( msgSvc(), "TofDigiCnv" );
76 log << MSG::DEBUG << "TofDigiCnv::DataObjectToTObject" << endmsg;
77 StatusCode sc = StatusCode::SUCCESS;
78
79 TofDigiCol* tofDigiColTds = dynamic_cast<TofDigiCol*>( obj );
80 if ( !tofDigiColTds )
81 {
82 log << MSG::ERROR << "Could not downcast to TofDigiCol" << endmsg;
83 return StatusCode::FAILURE;
84 }
85
86 DataObject* evt;
87 m_eds->findObject( EventModel::Digi::Event, evt );
88 if ( evt == NULL )
89 {
90 log << MSG::ERROR << "Could not get DigiEvent in TDS " << endmsg;
91 return StatusCode::FAILURE;
92 }
93 DigiEvent* devtTds = dynamic_cast<DigiEvent*>( evt );
94 if ( !devtTds )
95 { log << MSG::ERROR << "TofDigiCnv:Could not downcast to TDS DigiEvent" << endmsg; }
96 IOpaqueAddress* addr;
97
98 m_cnvSvc->getDigiCnv()->createRep( evt, addr );
99
100 TDigiEvent* recEvt = m_cnvSvc->getDigiCnv()->getWriteObject();
101
102 const TObjArray* m_tofDigiCol = recEvt->getTofDigiCol();
103 if ( !m_tofDigiCol ) return sc;
104 recEvt->clearTofDigiCol(); // necessary in case there is I/O at the same time since array is
105 // static
106 TofDigiCol::const_iterator tofDigiTds;
107
108 for ( tofDigiTds = tofDigiColTds->begin(); tofDigiTds != tofDigiColTds->end(); tofDigiTds++ )
109 {
110 UInt_t overflow = ( *tofDigiTds )->getOverflow();
111 UInt_t time = ( *tofDigiTds )->getTimeChannel();
112 UInt_t charge = ( *tofDigiTds )->getChargeChannel();
113 UInt_t id = ( *tofDigiTds )->getIntId();
114 Int_t trackIndex = ( *tofDigiTds )->getTrackIndex();
115
116 TTofDigi* tofDigiRoot = new TTofDigi();
117 // m_common.m_tofDigiMap[(*tofDigiTds)] = tofDigiRoot;
118
119 tofDigiRoot->initialize( id, time, charge );
120 tofDigiRoot->setOverflow( overflow );
121 tofDigiRoot->setTrackIndex( trackIndex );
122
123 recEvt->addTofDigi( tofDigiRoot );
124 }
125
126 return StatusCode::SUCCESS;
127}
Double_t time
IDataProviderSvc * m_eds
pointer to eventdataservice
void addTofDigi(TTofDigi *digi)
Add a TofDigi into the TOF Data collection.
const TObjArray * getTofDigiCol() const
retrieve the whole TObjArray of TofDigi Data
void initialize(UInt_t id, UInt_t time=0, UInt_t charge=0)
Definition TRawData.cxx:30
void setTrackIndex(const int trackIndex)
Definition TRawData.cxx:37
void setOverflow(const UInt_t overflow)
Definition TTofDigi.cxx:32

◆ DataObjectToTObject() [2/3]

virtual StatusCode TofDigiCnv::DataObjectToTObject ( DataObject * obj,
RootAddress * addr )
virtual

transformation to root

Implements RootEventBaseCnv.

◆ DataObjectToTObject() [3/3]

virtual StatusCode TofDigiCnv::DataObjectToTObject ( DataObject * obj,
RootAddress * addr )
virtual

transformation to root

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [1/3]

StatusCode TofDigiCnv::TObjectToDataObject ( DataObject *& obj)
virtual

transformation from root

Implements RootEventBaseCnv.

Definition at line 34 of file TofDigiCnv.cxx.

34 {
35 // creation of TDS object from root object
36
37 MsgStream log( msgSvc(), "TofDigiCnv" );
38 log << MSG::DEBUG << "TofDigiCnv::TObjectToDataObject" << endmsg;
39 StatusCode sc = StatusCode::SUCCESS;
40
41 // create the TDS location for the TofDigi Collection
42 TofDigiCol* tofDigiTdsCol = new TofDigiCol;
43 refpObject = tofDigiTdsCol;
44
45 // now convert
46 if ( !m_tofDigiCol ) return sc;
47 TIter tofDigiIter( m_tofDigiCol );
48 TTofDigi* tofDigiRoot = 0;
49 while ( ( tofDigiRoot = (TTofDigi*)tofDigiIter.Next() ) )
50 {
51 unsigned int id = tofDigiRoot->getIntId();
52 unsigned int time = tofDigiRoot->getTimeChannel();
53 unsigned int charge = tofDigiRoot->getChargeChannel();
54 unsigned int overflow = tofDigiRoot->getOverflow();
55 int trackIndex = tofDigiRoot->getTrackIndex();
56
57 TofDigi* tofDigiTds = new TofDigi( id );
58 m_common.m_rootTofDigiMap[tofDigiRoot] = tofDigiTds;
59
60 tofDigiTds->setTimeChannel( time );
61 tofDigiTds->setChargeChannel( charge );
62 tofDigiTds->setOverflow( overflow );
63 tofDigiTds->setTrackIndex( trackIndex );
64
65 tofDigiTdsCol->push_back( tofDigiTds );
66 }
67 // m_tofDigiCol->Delete(); // wensp add 2005/12/30
68 delete m_tofDigiCol;
69 m_tofDigiCol = 0;
70 return StatusCode::SUCCESS;
71}
void setTrackIndex(const int trackIndex)
Definition RawData.cxx:29
void setChargeChannel(const unsigned int chargeChannel)
Definition RawData.cxx:24
void setTimeChannel(const unsigned int timeChannel)
Definition RawData.cxx:21
UInt_t getIntId() const
Definition TRawData.cxx:42
int getTrackIndex() const
Definition TRawData.cxx:39
UInt_t getChargeChannel() const
Definition TRawData.cxx:48
UInt_t getTimeChannel() const
Definition TRawData.cxx:45
UInt_t getOverflow() const
Definition TTofDigi.cxx:35

◆ TObjectToDataObject() [2/3]

virtual StatusCode TofDigiCnv::TObjectToDataObject ( DataObject *& obj)
virtual

transformation from root

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [3/3]

virtual StatusCode TofDigiCnv::TObjectToDataObject ( DataObject *& obj)
virtual

transformation from root

Implements RootEventBaseCnv.

◆ CnvFactory< TofDigiCnv >

friend class CnvFactory< TofDigiCnv >
friend

The documentation for this class was generated from the following files: