CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
CgemSegmentCnv Class Reference

#include <CgemSegmentCnv.h>

+ Inheritance diagram for CgemSegmentCnv:

Public Member Functions

virtual ~CgemSegmentCnv ()
 
- 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.
 
virtual StatusCode DataObjectToTObject (DataObject *dat, RootAddress *addr)=0
 Do the concrete conversion from TDS to ROOT.
 
virtual StatusCode TObjectToDataObject (DataObject *&dat)=0
 Do the concrete conversion from ROOT to TDS.
 
TObject * getReadObject () const
 get the object to be read
 
- Public Member Functions inherited from Converter< Ty1, Ty2 >
destinationoperator (const source &) const
 

Static Public Member Functions

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

Protected Member Functions

 CgemSegmentCnv (ISvcLocator *svc)
 
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
 
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
 
- Protected Member Functions inherited from Converter< Ty1, Ty2 >
virtual destinationconvert (const source &) const =0
 

Friends

class CnvFactory< CgemSegmentCnv >
 

Additional Inherited Members

- Public Types inherited from Converter< Ty1, Ty2 >
typedef Ty1 source
 
typedef Ty2 destination
 
- Protected Attributes inherited from RootEventBaseCnv
RootCnvSvcm_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

Definition at line 15 of file CgemSegmentCnv.h.

Constructor & Destructor Documentation

◆ ~CgemSegmentCnv()

virtual CgemSegmentCnv::~CgemSegmentCnv ( )
inlinevirtual

Definition at line 25 of file CgemSegmentCnv.h.

25{ };

◆ CgemSegmentCnv()

CgemSegmentCnv::CgemSegmentCnv ( ISvcLocator *  svc)
protected

Definition at line 24 of file CgemSegmentCnv.cxx.

26{
27 // Here we associate this converter with the /Event path on the TDS.
28 MsgStream log(msgSvc(), "CgemSegmentCnv");
29 m_rootBranchname ="m_cgemSegmentCol";
30 m_adresses.push_back(&m_cgemSegmentCol);
31 m_cgemSegmentCol=0;
32}
IMessageSvc * msgSvc()
static const CLID & classID()
Base class for all Root Converters.
std::vector< void * > m_adresses
each converter knows the corresponding adresses
std::string m_rootBranchname
root branchname (may be concatenated of severals)

Member Function Documentation

◆ classID()

static const CLID & CgemSegmentCnv::classID ( )
inlinestatic

Definition at line 20 of file CgemSegmentCnv.h.

21 {
23 }
const CLID & CLID_DstCgemSegmentCol
Definition: EventModel.cxx:309

◆ DataObjectToTObject()

StatusCode CgemSegmentCnv::DataObjectToTObject ( DataObject *  obj,
RootAddress addr 
)
protectedvirtual

transformation to root

Implements RootEventBaseCnv.

Definition at line 94 of file CgemSegmentCnv.cxx.

94 {
95
96 MsgStream log(msgSvc(), "CgemSegmentCnv");
97//myModify
98 log << MSG::INFO << "My Message::CgemSegmentCnv::DataObjectToTObject("<<rootaddr->getTreename()<<")"<<endreq;
99
100 log << MSG::DEBUG << "CgemSegmentCnv::DataObjectToTObject" << endreq;
101 StatusCode sc=StatusCode::SUCCESS;
102
103 DstCgemSegmentCol * cgemSegmentColTds=dynamic_cast<DstCgemSegmentCol *> (obj);
104 if (!cgemSegmentColTds) {
105 log << MSG::ERROR << "Could not downcast to CgemSegmentCol" << endreq;
106//myModify
107 log << MSG::INFO << "My Message::CgemSegmentCnv::DataObjectToTObject("<<rootaddr->getTreename()<<")-finished"<<endreq;
108
109 return StatusCode::FAILURE;
110 }
111
112 DataObject *evt;
113 m_eds->findObject(EventModel::Dst::Event,evt);
114 if (evt==NULL) {
115 log << MSG::ERROR << "Could not get DstEvent in TDS " << endreq;
116//myModify
117 log << MSG::INFO << "My Message::CgemSegmentCnv::DataObjectToTObject("<<rootaddr->getTreename()<<")-finished"<<endreq;
118
119 return StatusCode::FAILURE;
120 }
121 DstEvent * devtTds=dynamic_cast<DstEvent *> (evt);
122 if (!devtTds) {
123 log << MSG::ERROR << "CgemSegmentCnv:Could not downcast to TDS DstEvent" << endreq;
124 }
125 IOpaqueAddress *addr;
126
127//myModify
128 log << MSG::INFO << "My Message::CgemSegmentCnv::DataObjectToTObject("<<rootaddr->getTreename()<<")::DstCnv"<<endreq;
129
130 m_cnvSvc->getDstCnv()->createRep(evt,addr);
132
133 const TObjArray *m_cgemSegmentCol = recEvt->getCgemSegmentCol();
134 if (!m_cgemSegmentCol) return sc;
135 recEvt->clearCgemSegmentCol(); //necessary in case there is I/O at the same time since array is static
136 DstCgemSegmentCol::const_iterator cgemSegmentTds;
137
138 for (cgemSegmentTds = cgemSegmentColTds->begin(); cgemSegmentTds != cgemSegmentColTds->end(); cgemSegmentTds++) {
139 Int_t segmentId = (*cgemSegmentTds)->getsegmentid();
140 Int_t eventId = (*cgemSegmentTds)->geteventid();
141 Int_t match = (*cgemSegmentTds)->getmatch();
142 Int_t clusterId_1 = (*cgemSegmentTds)->getclusterid_1();
143 Int_t clusterId_2 = (*cgemSegmentTds)->getclusterid_2();
144 Int_t clusterId_3 = (*cgemSegmentTds)->getclusterid_3();
145 Double_t helix[5];
146 Double_t helix_err[15];
147 for(int i = 0; i < 5; i++){
148 helix[i] = (*cgemSegmentTds)->gethelix(i);
149 }
150 for(int i = 0; i < 15; i++){
151 helix_err[i] = (*cgemSegmentTds)->gethelix_err(i);
152 }
153
154 TCgemSegment *cgemSegmentRoot = new TCgemSegment();
155
156 cgemSegmentRoot->setsegmentid( segmentId );
157 cgemSegmentRoot->seteventid( eventId );
158 cgemSegmentRoot->setmatch( match );
159 cgemSegmentRoot->setclusterid_1( clusterId_1 );
160 cgemSegmentRoot->setclusterid_2( clusterId_2 );
161 cgemSegmentRoot->setclusterid_3( clusterId_3 );
162 cgemSegmentRoot->sethelix( helix );
163 cgemSegmentRoot->sethelix_err( helix_err );
164
165 recEvt->addCgemSegment(cgemSegmentRoot);
166 }
167
168//myModify
169 log << MSG::INFO << "My Message::CgemSegmentCnv::DataObjectToTObject("<<rootaddr->getTreename()<<")-finished"<<endreq;
170
171 return StatusCode::SUCCESS;
172}
ObjectVector< DstCgemSegment > DstCgemSegmentCol
static TDstEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
Definition: DstCnv.h:36
std::string getTreename() const
Definition: RootAddress.h:27
DstCnv * getDstCnv()
Definition: RootCnvSvc.h:148
RootCnvSvc * m_cnvSvc
IDataProviderSvc * m_eds
pointer to eventdataservice
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
void sethelix(Double_t helix[5])
void setclusterid_3(Int_t clusterid_3)
Definition: TCgemSegment.h:28
void setmatch(Int_t match)
Definition: TCgemSegment.h:30
void setsegmentid(Int_t segmentid)
Definition: TCgemSegment.h:31
void setclusterid_1(Int_t clusterid_1)
Definition: TCgemSegment.h:26
void setclusterid_2(Int_t clusterid_2)
Definition: TCgemSegment.h:27
void seteventid(Int_t eventid)
Definition: TCgemSegment.h:29
void sethelix_err(Double_t helix_err[15])
const TObjArray * getCgemSegmentCol() const
retrieve the whole TObjArray of CgemSegment Data
Definition: TDstEvent.h:64
void clearCgemSegmentCol()
clear the whole array (necessary because of the consts-s)
Definition: TDstEvent.h:73
void addCgemSegment(TCgemSegment *Segment)
Add a segment into the Cgem data collection.
Definition: TDstEvent.cxx:184
_EXTERN_ std::string Event
Definition: EventModel.h:146

◆ TObjectToDataObject()

StatusCode CgemSegmentCnv::TObjectToDataObject ( DataObject *&  obj)
protectedvirtual

transformation from root

Implements RootEventBaseCnv.

Definition at line 34 of file CgemSegmentCnv.cxx.

34 {
35 // creation of TDS object from root object
36 MsgStream log(msgSvc(), "CgemSegmentCnv");
37//myModify
38 log << MSG::INFO << "My Message::CgemSegmentCnv::TObjectToDataObject()"<<endreq;
39
40 log << MSG::DEBUG << "CgemSegmentCnv::TObjectToDataObject" << endreq;
41 StatusCode sc=StatusCode::SUCCESS;
42
43 // create the TDS location for the CgemSegment Collection
44 DstCgemSegmentCol* cgemSegmentTdsCol = new DstCgemSegmentCol;
45 refpObject=cgemSegmentTdsCol;
46
47 // now convert
48 if (!m_cgemSegmentCol) return sc;
49 TIter cgemSegmentIter(m_cgemSegmentCol);
50 TCgemSegment *cgemSegmentRoot = 0;
51 while ((cgemSegmentRoot = (TCgemSegment*)cgemSegmentIter.Next())) {
52
53 int segmentId = cgemSegmentRoot->getsegmentid();
54 int eventId = cgemSegmentRoot->geteventid();
55 int match = cgemSegmentRoot->getmatch();
56 int clusterId_1 = cgemSegmentRoot->getclusterid_1();
57 int clusterId_2 = cgemSegmentRoot->getclusterid_2();
58 int clusterId_3 = cgemSegmentRoot->getclusterid_3();
59 double helix[5];
60 double helix_err[15];
61 for(int i = 0; i < 5; i++){
62 helix[i] = cgemSegmentRoot->gethelix(i);
63 }
64 for(int i = 0; i < 15; i++){
65 helix_err[i] = cgemSegmentRoot->gethelix_err(i);
66 }
67
68
69 log << MSG::INFO << "My Message::CgemSegmentCnv::TObjectToDataObject::charge:"<<endreq;
70
71 DstCgemSegment *cgemSegmentTds = new DstCgemSegment();
72 m_common.m_rootCgemSegmentMap[cgemSegmentRoot] = cgemSegmentTds;
73
74 cgemSegmentTds->setsegmentid( segmentId );
75 cgemSegmentTds->seteventid( eventId );
76 cgemSegmentTds->setmatch( match );
77 cgemSegmentTds->setclusterid_1( clusterId_1 );
78 cgemSegmentTds->setclusterid_2( clusterId_2 );
79 cgemSegmentTds->setclusterid_3( clusterId_3 );
80 cgemSegmentTds->sethelix( helix );
81 cgemSegmentTds->sethelix_err( helix_err );
82
83 cgemSegmentTdsCol->push_back(cgemSegmentTds);
84
85 }
86 delete m_cgemSegmentCol;
87 m_cgemSegmentCol = 0;
88//myModify
89 log << MSG::INFO << "My Message::CgemSegmentCnv::TObjectToDataObject()-finished"<<endreq;
90
91 return StatusCode::SUCCESS;
92}
void setclusterid_2(const int clusterId_2)
void setmatch(const int match)
void setsegmentid(const int segmentId)
void setclusterid_1(const int clusterId_1)
void seteventid(const int eventId)
void setclusterid_3(const int clusterId_3)
void sethelix(double helix[5])
void sethelix_err(double helix_err[15])
Double_t gethelix(Int_t i) const
Definition: TCgemSegment.h:22
Int_t getclusterid_1(void) const
Definition: TCgemSegment.h:16
Int_t geteventid(void) const
Definition: TCgemSegment.h:19
Double_t gethelix_err(Int_t i) const
Definition: TCgemSegment.h:23
Int_t getmatch(void) const
Definition: TCgemSegment.h:20
Int_t getclusterid_3(void) const
Definition: TCgemSegment.h:18
Int_t getclusterid_2(void) const
Definition: TCgemSegment.h:17
Int_t getsegmentid(void) const
Definition: TCgemSegment.h:21
static std::map< const TObject *, const DstCgemSegment * > m_rootCgemSegmentMap
Definition: commonData.h:175

Friends And Related Function Documentation

◆ CnvFactory< CgemSegmentCnv >

friend class CnvFactory< CgemSegmentCnv >
friend

Definition at line 9 of file CgemSegmentCnv.h.


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