BOSS 7.0.6
BESIII Offline Software System
Loading...
Searching...
No Matches
RecMdcHitCnv Class Reference

#include <RecMdcHitCnv.h>

+ Inheritance diagram for RecMdcHitCnv:

Public Member Functions

virtual ~RecMdcHitCnv ()
 
- 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

 RecMdcHitCnv (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< RecMdcHitCnv >
 

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 RecMdcHitCnv.h.

Constructor & Destructor Documentation

◆ ~RecMdcHitCnv()

virtual RecMdcHitCnv::~RecMdcHitCnv ( )
inlinevirtual

Definition at line 25 of file RecMdcHitCnv.h.

25{ };

◆ RecMdcHitCnv()

RecMdcHitCnv::RecMdcHitCnv ( ISvcLocator *  svc)
protected

Definition at line 28 of file RecMdcHitCnv.cxx.

30{
31
32 // Here we associate this converter with the /Event path on the TDS.
33 MsgStream log(msgSvc(), "RecMdcHitCnv");
34 //log << MSG::DEBUG << "Constructor called for " << objType() << endreq;
35 //m_rootTreename ="Rec";
36 m_rootBranchname ="m_recMdcHitCol";
37 //declareObject(EventModel::Recon::RecMdcHitCol, objType(), m_rootTreename, m_rootBranchname);
38 m_adresses.push_back(&m_recMdcHitCol);
39 m_recMdcHitCol=0;
40}
IMessageSvc * msgSvc()
static const CLID & classID()
Definition: RecMdcHitCnv.h:20
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 & RecMdcHitCnv::classID ( )
inlinestatic

Definition at line 20 of file RecMdcHitCnv.h.

21 {
22 return CLID_RecMdcHitCol;
23 }
const CLID & CLID_RecMdcHitCol
Definition: EventModel.cxx:299

◆ DataObjectToTObject()

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

transformation to root

Implements RootEventBaseCnv.

Definition at line 100 of file RecMdcHitCnv.cxx.

100 {
101
102 MsgStream log(msgSvc(), "RecMdcHitCnv");
103 log << MSG::DEBUG << "RecMdcHitCnv::DataObjectToTObject" << endreq;
104
105 RecMdcHitCol * mdcHitColTds=dynamic_cast<RecMdcHitCol *> (obj);
106 if (!mdcHitColTds) {
107 log << MSG::ERROR << "Could not downcast to RecMdcHitCol" << endreq;
108 return StatusCode::FAILURE;
109 }
110
111 DataObject *evt;
112 m_eds->findObject(EventModel::Recon::Event,evt);
113 if (evt==NULL) {
114 log << MSG::ERROR << "Could not get ReconEvent in TDS " << endreq;
115 return StatusCode::FAILURE;
116 }
117
118 ReconEvent * devtTds=dynamic_cast<ReconEvent *> (evt);
119 if (!devtTds) {
120 log << MSG::ERROR << "RecMdcHitCnv:Could not downcast to TDS ReconEvent" << endreq;
121 }
122
123 IOpaqueAddress *addr;
124
125 m_cnvSvc->getRecTrackCnv()->createRep(evt,addr);
127
128 const TObjArray *m_recMdcHitCol = recEvt->getRecMdcHitCol();
129 if (!m_recMdcHitCol) return StatusCode::SUCCESS;
130 recEvt->clearRecMdcHitCol(); //necessary in case there is I/O at the same time since array is static
131
132 RecMdcHitCol::const_iterator recMdcHit;
133 for (recMdcHit = mdcHitColTds->begin(); recMdcHit != mdcHitColTds->end(); recMdcHit++) {
134 Bool_t isGrouped =(*recMdcHit)->isGrouped();
135 Int_t id =(*recMdcHit)->getId();
136 Int_t trackId =(*recMdcHit)->getTrkId();
137 Double_t driftDistLeft =(*recMdcHit)->getDriftDistLeft();
138 Double_t driftDistRight =(*recMdcHit)->getDriftDistRight();
139 Double_t errDriftDistLeft =(*recMdcHit)->getErrDriftDistLeft();
140 Double_t errDriftDistRight =(*recMdcHit)->getErrDriftDistRight();
141 Double_t chisqAdd =(*recMdcHit)->getChisqAdd();
142 Int_t flagLR =(*recMdcHit)->getFlagLR();
143 Int_t stat =(*recMdcHit)->getStat();
144 UInt_t mdcId =(*recMdcHit)->getMdcId().get_value();
145 Double_t tdc =(*recMdcHit)->getTdc();
146 Double_t adc =(*recMdcHit)->getAdc();
147 Double_t driftT =(*recMdcHit)->getDriftT();
148 Double_t doca =(*recMdcHit)->getDoca();
149 Double_t entra =(*recMdcHit)->getEntra();
150 Double_t zhit =(*recMdcHit)->getZhit();
151 Double_t fltLen =(*recMdcHit)->getFltLen();
152
153 TRecMdcHit *recMdcHitRoot = new TRecMdcHit();
154 //m_common.m_recMdcHitMap[(*recMdcHit)] = recMdcHitRoot;
155
156 recMdcHitRoot->setIsGrouped( isGrouped );
157 recMdcHitRoot->setId( id );
158 recMdcHitRoot->setTrkId( trackId );
159 recMdcHitRoot->setDriftDistLeft( driftDistLeft );
160 recMdcHitRoot->setDriftDistRight( driftDistRight );
161 recMdcHitRoot->setErrDriftDistLeft( errDriftDistLeft );
162 recMdcHitRoot->setErrDriftDistRight( errDriftDistRight );
163 log<<MSG::INFO<<" recMdcHitRoot.ddl: "<<recMdcHitRoot->getDriftDistLeft()
164 <<" recMdcHitRoot.erddl: "<<recMdcHitRoot->getErrDriftDistLeft()
165 <<endreq;
166 recMdcHitRoot->setChisqAdd( chisqAdd );
167 recMdcHitRoot->setFlagLR( flagLR );
168 recMdcHitRoot->setStat( stat );
169 recMdcHitRoot->setMdcId( mdcId );
170 recMdcHitRoot->setTdc( tdc );
171 recMdcHitRoot->setAdc( adc );
172 recMdcHitRoot->setDriftT( driftT );
173 recMdcHitRoot->setDoca( doca );
174 recMdcHitRoot->setEntra( entra );
175 recMdcHitRoot->setZhit( zhit );
176 recMdcHitRoot->setFltLen( fltLen );
177
178 recEvt->addRecMdcHit(recMdcHitRoot);
179 }
180 return StatusCode::SUCCESS;
181}
ObjectVector< RecMdcHit > RecMdcHitCol
Definition: RecMdcHit.h:99
static TRecTrackEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
Definition: RecTrackCnv.h:36
RecTrackCnv * getRecTrackCnv()
Definition: RootCnvSvc.h:173
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 setFltLen(Double_t fltLen)
Definition: TRecMdcHit.h:56
void setIsGrouped(Bool_t isGrouped)
Definition: TRecMdcHit.h:39
const Double_t getDriftDistLeft(void) const
Definition: TRecMdcHit.h:22
void setErrDriftDistLeft(Double_t erddl)
Definition: TRecMdcHit.h:44
void setDriftDistLeft(Double_t ddl)
Definition: TRecMdcHit.h:42
void setDriftDistRight(Double_t ddr)
Definition: TRecMdcHit.h:43
const Double_t getErrDriftDistLeft(void) const
Definition: TRecMdcHit.h:24
void setTdc(Double_t tdc)
Definition: TRecMdcHit.h:50
void setAdc(Double_t adc)
Definition: TRecMdcHit.h:51
void setStat(Int_t stat)
Definition: TRecMdcHit.h:48
void setTrkId(Int_t trkid)
Definition: TRecMdcHit.h:41
void setDriftT(Double_t driftT)
Definition: TRecMdcHit.h:52
void setErrDriftDistRight(Double_t erddr)
Definition: TRecMdcHit.h:45
void setZhit(Double_t zhit)
Definition: TRecMdcHit.h:55
void setDoca(Double_t doca)
Definition: TRecMdcHit.h:53
void setEntra(Double_t entra)
Definition: TRecMdcHit.h:54
void setFlagLR(Int_t lr)
Definition: TRecMdcHit.h:47
void setId(Int_t id)
Definition: TRecMdcHit.h:40
void setChisqAdd(Double_t pChisq)
Definition: TRecMdcHit.h:46
void setMdcId(UInt_t mdcid)
Definition: TRecMdcHit.h:49
void addRecMdcHit(TRecMdcHit *Hit)
Add a Rec Mdc Hit into the Mdc data collection.
void clearRecMdcHitCol()
clear the whole array (necessary because of the consts-s)
const TObjArray * getRecMdcHitCol() const
retrieve the whole TObjArray of RecMdcHit Data
_EXTERN_ std::string Event
Definition: EventModel.h:84

◆ TObjectToDataObject()

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

transformation from root

Implements RootEventBaseCnv.

Definition at line 42 of file RecMdcHitCnv.cxx.

42 {
43 // creation of TDS object from root object
44 MsgStream log(msgSvc(), "RecMdcHitCnv");
45 log << MSG::DEBUG << "RecMdcHitCnv::TObjectToDataObject" << endreq;
46
47 // create the TDS location for the RecMdcHit Collection
48 RecMdcHitCol* recMdcHitCol = new RecMdcHitCol;
49 refpObject = recMdcHitCol;
50
51 // now convert
52 if (!m_recMdcHitCol) return StatusCode::SUCCESS;
53 TIter mdcHitIter(m_recMdcHitCol);
54 TRecMdcHit *recMdcHitRoot = 0;
55 while ((recMdcHitRoot = (TRecMdcHit*)mdcHitIter.Next())) {
56 int id = recMdcHitRoot->getId();
57 int trackId = recMdcHitRoot->getTrkId();
58 double driftDistLeft = recMdcHitRoot->getDriftDistLeft();
59 double driftDistRight = recMdcHitRoot->getDriftDistRight();
60 double errDriftDistLeft = recMdcHitRoot->getErrDriftDistLeft();
61 double errDriftDistRight = recMdcHitRoot->getErrDriftDistRight();
62 double chisqAdd = recMdcHitRoot->getChisqAdd();
63 int flagLR = recMdcHitRoot->getFlagLR();
64 int stat = recMdcHitRoot->getStat();
65 long int mdcId(recMdcHitRoot->getMdcId());
66 double tdc = recMdcHitRoot->getTdc();
67 double adc = recMdcHitRoot->getAdc();
68 double driftT = recMdcHitRoot->getDriftT();
69 double doca = recMdcHitRoot->getDoca();
70 double entra = recMdcHitRoot->getEntra();
71 double zhit = recMdcHitRoot->getZhit();
72 double fltLen = recMdcHitRoot->getFltLen();
73
74 RecMdcHit *recMdcHit= new RecMdcHit();
75 m_common.m_rootRecMdcHitMap[recMdcHitRoot] = recMdcHit;
76
77 recMdcHit->setId( id );
78 recMdcHit->setTrkId( trackId );
79 recMdcHit->setDriftDistLeft( driftDistLeft );
80 recMdcHit->setDriftDistRight( driftDistRight );
81 recMdcHit->setErrDriftDistLeft( errDriftDistLeft );
82 recMdcHit->setErrDriftDistRight( errDriftDistRight );
83 recMdcHit->setChisqAdd( chisqAdd );
84 recMdcHit->setFlagLR( flagLR );
85 recMdcHit->setStat( stat );
86 recMdcHit->setMdcId( Identifier(mdcId) );
87 recMdcHit->setTdc( tdc );
88 recMdcHit->setAdc( adc );
89 recMdcHit->setDriftT( driftT );
90 recMdcHit->setDoca( doca );
91 recMdcHit->setEntra( entra );
92 recMdcHit->setZhit( zhit );
93 recMdcHit->setFltLen( fltLen );
94
95 recMdcHitCol->push_back(recMdcHit);
96 }
97 return StatusCode::SUCCESS;
98}
void setMdcId(Identifier mdcid)
Definition: RecMdcHit.h:67
void setErrDriftDistRight(double erddr)
Definition: RecMdcHit.h:63
void setFltLen(double fltLen)
Definition: RecMdcHit.h:74
void setErrDriftDistLeft(double erddl)
Definition: RecMdcHit.h:62
void setDriftDistLeft(double ddl)
Definition: RecMdcHit.h:60
void setDoca(double doca)
Definition: RecMdcHit.h:71
void setStat(int stat)
Definition: RecMdcHit.h:66
void setTdc(double tdc)
Definition: RecMdcHit.h:68
void setAdc(double adc)
Definition: RecMdcHit.h:69
void setFlagLR(int lr)
Definition: RecMdcHit.h:65
void setChisqAdd(double pChisq)
Definition: RecMdcHit.h:64
void setZhit(double zhit)
Definition: RecMdcHit.h:73
void setDriftT(double driftT)
Definition: RecMdcHit.h:70
void setDriftDistRight(double ddr)
Definition: RecMdcHit.h:61
void setTrkId(int trkid)
Definition: RecMdcHit.h:59
void setId(int id)
Definition: RecMdcHit.h:58
void setEntra(double entra)
Definition: RecMdcHit.h:72
const Double_t getDriftT(void) const
Definition: TRecMdcHit.h:32
const Double_t getErrDriftDistRight(void) const
Definition: TRecMdcHit.h:25
const UInt_t getMdcId() const
Definition: TRecMdcHit.h:29
const Double_t getEntra(void) const
Definition: TRecMdcHit.h:34
const Int_t getId(void) const
Definition: TRecMdcHit.h:20
const Double_t getDoca(void) const
Definition: TRecMdcHit.h:33
const Double_t getFltLen(void) const
Definition: TRecMdcHit.h:36
const Int_t getStat(void) const
Definition: TRecMdcHit.h:28
const Double_t getZhit(void) const
Definition: TRecMdcHit.h:35
const Int_t getFlagLR(void) const
Definition: TRecMdcHit.h:27
const Int_t getTrkId(void) const
Definition: TRecMdcHit.h:21
const Double_t getChisqAdd(void) const
Definition: TRecMdcHit.h:26
const Double_t getAdc(void) const
Definition: TRecMdcHit.h:31
const Double_t getTdc(void) const
Definition: TRecMdcHit.h:30
const Double_t getDriftDistRight(void) const
Definition: TRecMdcHit.h:23
static std::map< const TObject *, const RecMdcHit * > m_rootRecMdcHitMap
Definition: commonData.h:206

Friends And Related Function Documentation

◆ CnvFactory< RecMdcHitCnv >

friend class CnvFactory< RecMdcHitCnv >
friend

Definition at line 9 of file RecMdcHitCnv.h.


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