CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
RecZddChannelCnv.cxx
Go to the documentation of this file.
7
9 : RootEventBaseCnv(classID(), svc)
10{
11 m_rootBranchname = "m_recZddChannelCol";
12 m_adresses.push_back(&m_recZddChannelCol);
13 m_recZddChannelCol = 0;
14}
15
16StatusCode RecZddChannelCnv::TObjectToDataObject(DataObject*& refpObject)
17{
18 MsgStream log(msgSvc(), "RecZddChannelCnv");
19 log << MSG::DEBUG << "RecZddChannelCnv::TObjectToDataObject" << endreq;
20
22 refpObject = zddCol;
23
24 if ( ! m_recZddChannelCol ) return StatusCode::SUCCESS;
25
26 // convert
27 TIter zddIter(m_recZddChannelCol);
28 TRecZddChannel* zddRoot = 0;
29 while ( (zddRoot = (TRecZddChannel*)zddIter.Next()) ) {
30 RecZddChannel* zddTDS = new RecZddChannel;
31 m_common.m_rootRecZddChannelMap[zddRoot] = zddTDS;
32
33 // settings
34 zddTDS->setChannelId(zddRoot->channelId());
35 zddTDS->setScanCode(zddRoot->scanCode());
36 zddTDS->setBaseLine(zddRoot->baseLine());
37 zddTDS->setPhase(zddRoot->phase());
38 zddTDS->setFragments(zddRoot->fragments());
39
40 zddCol->push_back(zddTDS);
41 }
42
43 delete m_recZddChannelCol;
44 m_recZddChannelCol = 0;
45
46 return StatusCode::SUCCESS;
47}
48
49StatusCode RecZddChannelCnv::DataObjectToTObject(DataObject* obj, RootAddress* rootaddr)
50{
51 MsgStream log(msgSvc(), "RecZddChannelCnv");
52 log << MSG::DEBUG << "RecZddChannelCnv::DataObjectToTObject" << endreq;
53
54 RecZddChannelCol* zddCol = dynamic_cast<RecZddChannelCol*>(obj);
55 if ( ! zddCol ) {
56 log << MSG::ERROR << "Could not downcast to RecZddChannelCol" << endreq;
57 return StatusCode::FAILURE;
58 }
59
60 DataObject* evt;
61 m_eds->findObject(EventModel::Recon::Event, evt);
62 if ( evt == NULL ) {
63 log << MSG::ERROR << "Could not get ReconEvent in TDS" << endreq;
64 return StatusCode::FAILURE;
65 }
66 IOpaqueAddress *addr;
67 m_cnvSvc->getRecTrackCnv()->createRep(evt, addr);
69
70 const TObjArray* m_recZddChannelCol = recEvt->getRecZddChannelCol();
71 if ( ! m_recZddChannelCol ) return StatusCode::SUCCESS;
72
73 //convert
74 recEvt->clearRecZddChannelCol();
75 RecZddChannelCol::const_iterator zdd = zddCol->begin();
76
77 for ( ; zdd != zddCol->end(); ++zdd ) {
78 RecZddChannel* pzdd = *zdd;
79 TRecZddChannel* zddRoot = new TRecZddChannel();
80
81 zddRoot->setChannelId(pzdd->channelId());
82 zddRoot->setBaseLine(pzdd->baseLine());
83 zddRoot->setPhase(pzdd->phase());
84 zddRoot->setFragments(pzdd->fragments());
85
86 recEvt->addRecZddChannel(zddRoot);
87 }
88
89 return StatusCode::SUCCESS;
90}
ObjectVector< RecZddChannel > RecZddChannelCol
IMessageSvc * msgSvc()
static TRecTrackEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
Definition RecTrackCnv.h:36
RecZddChannelCnv(ISvcLocator *svc)
virtual StatusCode DataObjectToTObject(DataObject *obj, RootAddress *addr)
transformation to root
virtual StatusCode TObjectToDataObject(DataObject *&obj)
transformation from root
void setBaseLine(int baseLine)
void setPhase(int phase)
void setScanCode(int scanCode)
int phase() const
int baseLine() const
int channelId() const
void setFragments(const std::vector< FragType > &frags)
void setChannelId(int chId)
const std::vector< FragType > & fragments() const
Definition of a Root address, derived from IOpaqueAddress.
Definition RootAddress.h:21
RecTrackCnv * getRecTrackCnv()
Definition RootCnvSvc.h:166
Base class for all Root Converters.
std::vector< void * > m_adresses
each converter knows the corresponding adresses
RootCnvSvc * m_cnvSvc
IDataProviderSvc * m_eds
pointer to eventdataservice
std::string m_rootBranchname
root branchname (may be concatenated of severals)
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
const TObjArray * getRecZddChannelCol() const
void addRecZddChannel(TRecZddChannel *dtag)
void clearRecZddChannelCol()
Int_t baseLine() const
void setPhase(int phase)
void setFragments(const Fragments &frags)
Int_t channelId() const
Int_t phase() const
void setBaseLine(int baseLine)
void setChannelId(int chId)
const Fragments & fragments() const
Int_t scanCode() const
static std::map< const TObject *, const RecZddChannel * > m_rootRecZddChannelMap
Definition commonData.h:311
_EXTERN_ std::string Event
Definition EventModel.h:90