BOSS 7.0.2
BESIII Offline Software System
Loading...
Searching...
No Matches
RecZddChannelCnv.cxx
Go to the documentation of this file.
1#include "RootCnvSvc/Rec/RecZddChannelCnv.h"
2#include "RootCnvSvc/RootAddress.h"
3#include "RootCnvSvc/Rec/RecTrackCnv.h"
4#include "ZddEvent/RecZddChannel.h"
5#include "RootEventData/TRecTrackEvent.h"
6#include "RootEventData/TRecZddChannel.h"
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
static TRecTrackEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
RecZddChannelCnv(ISvcLocator *svc)
virtual StatusCode DataObjectToTObject(DataObject *obj, RootAddress *addr)
transformation to root
virtual StatusCode TObjectToDataObject(DataObject *&obj)
transformation from root
void setFragments(const std::vector< FragType > &frags)
const std::vector< FragType > & fragments() const
Definition of a Root address, derived from IOpaqueAddress.
IDataProviderSvc * m_eds
pointer to eventdataservice
std::vector< void * > m_adresses
each converter knows the corresponding adresses
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.
void addRecZddChannel(TRecZddChannel *dtag)
static std::map< const TObject *, const RecZddChannel * > m_rootRecZddChannelMap