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

#include <MdcDedxCnv.h>

Inheritance diagram for MdcDedxCnv:

Public Member Functions

 MdcDedxCnv (ISvcLocator *svc)
virtual ~MdcDedxCnv ()
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
 MdcDedxCnv (ISvcLocator *svc)
virtual ~MdcDedxCnv ()
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
 MdcDedxCnv (ISvcLocator *svc)
virtual ~MdcDedxCnv ()
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< MdcDedxCnv >

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

◆ MdcDedxCnv() [1/3]

MdcDedxCnv::MdcDedxCnv ( ISvcLocator * svc)

Definition at line 25 of file MdcDedxCnv.cxx.

25 : RootEventBaseCnv( classID(), svc ) {
26 // Here we associate this converter with the /Event path on the TDS.
27 MsgStream log( msgSvc(), "MdcDedxCnv" );
28 // log << MSG::DEBUG << "Constructor called for " << objType() << endmsg;
29 m_rootBranchname = "m_mdcDedxCol";
30 // declareObject(EventModel::Dst::DstDedxCol, objType(), m_rootTreename, m_rootBranchname);
31 m_adresses.push_back( &m_mdcDedxCol );
32 m_mdcDedxCol = 0;
33}
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)

◆ ~MdcDedxCnv() [1/3]

virtual MdcDedxCnv::~MdcDedxCnv ( )
inlinevirtual

Definition at line 22 of file Event/RootCnvSvc/include/RootCnvSvc/Dst/MdcDedxCnv.h.

22{};

◆ MdcDedxCnv() [2/3]

MdcDedxCnv::MdcDedxCnv ( ISvcLocator * svc)

◆ ~MdcDedxCnv() [2/3]

virtual MdcDedxCnv::~MdcDedxCnv ( )
inlinevirtual

◆ MdcDedxCnv() [3/3]

MdcDedxCnv::MdcDedxCnv ( ISvcLocator * svc)

◆ ~MdcDedxCnv() [3/3]

virtual MdcDedxCnv::~MdcDedxCnv ( )
inlinevirtual

Member Function Documentation

◆ classID() [1/3]

const CLID & MdcDedxCnv::classID ( )
inlinestatic

Definition at line 20 of file Event/RootCnvSvc/include/RootCnvSvc/Dst/MdcDedxCnv.h.

20{ return CLID_DstMdcDedxCol; }
const CLID & CLID_DstMdcDedxCol

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

◆ classID() [2/3]

const CLID & MdcDedxCnv::classID ( )
inlinestatic

◆ classID() [3/3]

const CLID & MdcDedxCnv::classID ( )
inlinestatic

◆ DataObjectToTObject() [1/3]

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

transformation to root

Implements RootEventBaseCnv.

Definition at line 123 of file MdcDedxCnv.cxx.

123 {
124
125 MsgStream log( msgSvc(), "MdcDedxCnv" );
126 log << MSG::DEBUG << "MdcDedxCnv::DataObjectToTObject" << endmsg;
127 StatusCode sc = StatusCode::SUCCESS;
128
129 DstMdcDedxCol* mdcDedxColTds = dynamic_cast<DstMdcDedxCol*>( obj );
130 if ( !mdcDedxColTds )
131 {
132 log << MSG::ERROR << "Could not downcast to MdcDedxCol" << endmsg;
133 return StatusCode::FAILURE;
134 }
135
136 DataObject* evt;
137 m_eds->findObject( EventModel::Dst::Event, evt );
138 if ( evt == NULL )
139 {
140 log << MSG::ERROR << "Could not get DstEvent in TDS " << endmsg;
141 return StatusCode::FAILURE;
142 }
143 DstEvent* devtTds = dynamic_cast<DstEvent*>( evt );
144 if ( !devtTds )
145 { log << MSG::ERROR << "MdcDedxCnv:Could not downcast to TDS DstEvent" << endmsg; }
146 IOpaqueAddress* addr;
147
148 m_cnvSvc->getDstCnv()->createRep( evt, addr );
149 TDstEvent* recEvt = m_cnvSvc->getDstCnv()->getWriteObject();
150
151 const TObjArray* m_mdcDedxCol = recEvt->getMdcDedxCol();
152 if ( !m_mdcDedxCol ) return sc;
153 recEvt->clearMdcDedxCol(); // necessary in case there is I/O at the same time since array is
154 // static
155 DstMdcDedxCol::const_iterator mdcDedxTds;
156
157 for ( mdcDedxTds = mdcDedxColTds->begin(); mdcDedxTds != mdcDedxColTds->end(); mdcDedxTds++ )
158 {
159 Int_t trackId = ( *mdcDedxTds )->trackId();
160 Int_t particleId = ( *mdcDedxTds )->particleId();
161 Int_t status = ( *mdcDedxTds )->status();
162 Int_t truncAlg = ( *mdcDedxTds )->truncAlg();
163 /*
164 Double_t pb[5];
165 for (Int_t i = 0; i < 5; i++)
166 pb[i] = (*dedxTds)->prob(i);
167 */
168 Double_t chiE = ( *mdcDedxTds )->chi( 0 );
169 Double_t chiMu = ( *mdcDedxTds )->chi( 1 );
170 Double_t chiPi = ( *mdcDedxTds )->chi( 2 );
171 Double_t chiK = ( *mdcDedxTds )->chi( 3 );
172 Double_t chiP = ( *mdcDedxTds )->chi( 4 );
173
174 Int_t numGoodHits = ( *mdcDedxTds )->numGoodHits();
175 Int_t numTotalHits = ( *mdcDedxTds )->numTotalHits();
176
177 Double_t probPH = ( *mdcDedxTds )->probPH();
178 Double_t normPH = ( *mdcDedxTds )->normPH();
179 Double_t errorPH = ( *mdcDedxTds )->errorPH();
180 Double_t twentyPH = ( *mdcDedxTds )->twentyPH();
181 // Double_t fracErrPH = (*dedxTds)-> fracErrPH();
182 // Double_t minIronPH = (*dedxTds)->minIronPH();
183 // Double_t corrPH = (*dedxTds)->corrPH();
184 log << MSG::INFO << "check Reconstrunction root"
185 << " particle Id is : " << particleId << "track id is : " << trackId
186 << " and status is : " << status << endmsg;
187
188 TMdcDedx* mdcDedxRoot = new TMdcDedx();
189 // m_common.m_mdcDedxMap[(*mdcDedxTds)] = mdcDedxRoot;
190
191 mdcDedxRoot->setTrackId( trackId );
192 mdcDedxRoot->setParticleId( particleId );
193 mdcDedxRoot->setStatus( status );
194 mdcDedxRoot->setTruncAlg( truncAlg );
195 // dedxRoot->setProb(pb);
196 mdcDedxRoot->setChiE( chiE );
197 mdcDedxRoot->setChiMu( chiMu );
198 mdcDedxRoot->setChiPi( chiPi );
199 mdcDedxRoot->setChiK( chiK );
200 mdcDedxRoot->setChiP( chiP );
201
202 mdcDedxRoot->setNumGoodHits( numGoodHits );
203 mdcDedxRoot->setNumTotalHits( numTotalHits );
204
205 mdcDedxRoot->setProbPH( probPH );
206 mdcDedxRoot->setNormPH( normPH );
207 mdcDedxRoot->setErrorPH( errorPH );
208 mdcDedxRoot->setTwentyPH( twentyPH );
209 // dedxRoot->setFracErrPH(fracErrPH);
210 // dedxRoot->setMinIronPH(minIronPH);
211 // dedxRoot->setCorrPH(corrPH);
212 log << MSG::INFO << "check Reconstrunction root"
213 << " particle Id is : " << particleId << "track id is : " << trackId
214 << " and status is : " << status << endmsg;
215
216 recEvt->addMdcDedx( mdcDedxRoot );
217 }
218
219 return StatusCode::SUCCESS;
220}
ObjectVector< DstMdcDedx > DstMdcDedxCol
IDataProviderSvc * m_eds
pointer to eventdataservice
const TObjArray * getMdcDedxCol() const
retrieve the whole TObjArray of Dedx Data
void addMdcDedx(TMdcDedx *Track)
Add a Dedx into the TOF Data collection.
void setNumTotalHits(const Int_t numTotalHits)
void setParticleId(const Int_t particleId)
void setTwentyPH(const Double_t twentyPH)
void setNumGoodHits(const Int_t numGoodHits)
void setErrorPH(const Double_t errorPH)

◆ DataObjectToTObject() [2/3]

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

transformation to root

Implements RootEventBaseCnv.

◆ DataObjectToTObject() [3/3]

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

transformation to root

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [1/3]

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

transformation from root

Implements RootEventBaseCnv.

Definition at line 35 of file MdcDedxCnv.cxx.

35 {
36 // creation of TDS object from root object
37
38 MsgStream log( msgSvc(), "MdcDedxCnv" );
39 log << MSG::DEBUG << "MdcDedxCnv::TObjectToDataObject" << endmsg;
40 StatusCode sc = StatusCode::SUCCESS;
41
42 // create the TDS location for the Dedx Collection
43 DstMdcDedxCol* mdcDedxTdsCol = new DstMdcDedxCol;
44 refpObject = mdcDedxTdsCol;
45
46 // now convert
47 if ( !m_mdcDedxCol ) return sc;
48 TIter mdcDedxIter( m_mdcDedxCol );
49 TMdcDedx* mdcDedxRoot = 0;
50 while ( ( mdcDedxRoot = (TMdcDedx*)mdcDedxIter.Next() ) )
51 {
52
53 int trackId = mdcDedxRoot->trackId();
54 int particleId = mdcDedxRoot->particleId();
55 int status = mdcDedxRoot->status();
56 int truncAlg = mdcDedxRoot->truncAlg();
57 /*
58 double pb[5];
59 for ( int i = 0; i < 5; i++)
60 pb[i] = dedxRoot->prob(i);
61
62 double numSigmaE = dedxRoot->numSigmaE();
63 double numSigmaMu = dedxRoot->numSigmaMu();
64 double numSigmaPi = dedxRoot->numSigmaPi();
65 double numSigmaK = dedxRoot->numSigmaK();
66 double numSigmaP = dedxRoot->numSigmaP();
67 */
68 double chi[5];
69 chi[0] = mdcDedxRoot->chiE();
70 chi[1] = mdcDedxRoot->chiMu();
71 chi[2] = mdcDedxRoot->chiPi();
72 chi[3] = mdcDedxRoot->chiK();
73 chi[4] = mdcDedxRoot->chiP();
74 int numGoodHits = mdcDedxRoot->numGoodHits();
75 int numTotalHits = mdcDedxRoot->numTotalHits();
76
77 double probPH = mdcDedxRoot->probPH();
78 double normPH = mdcDedxRoot->normPH();
79 double errorPH = mdcDedxRoot->errorPH();
80 double twentyPH = mdcDedxRoot->twentyPH();
81 // double fracErrPH = dedxRoot-> fracErrPH();
82 // double minIronPH = dedxRoot->minIronPH();
83 // double corrPH = dedxRoot->corrPH();
84
85 DstMdcDedx* mdcDedxTds = new DstMdcDedx();
86 m_common.m_rootMdcDedxMap[mdcDedxRoot] = mdcDedxTds;
87
88 mdcDedxTds->setTrackId( trackId );
89 mdcDedxTds->setParticleId( particleId );
90 mdcDedxTds->setStatus( status );
91 mdcDedxTds->setTruncAlg( truncAlg );
92 /*
93 dedxTds->setProb(pb);
94 dedxTds->setNumSigmaE(numSigmaE);
95 dedxTds->setNumSigmaMu(numSigmaMu);
96 dedxTds->setNumSigmaPi(numSigmaPi);
97 dedxTds->setNumSigmaK(numSigmaK);
98 dedxTds->setNumSigmaP(numSigmaP);
99 */
100 mdcDedxTds->setChi( chi );
101
102 mdcDedxTds->setNumGoodHits( numGoodHits );
103 mdcDedxTds->setNumTotalHits( numTotalHits );
104
105 mdcDedxTds->setProbPH( probPH );
106 mdcDedxTds->setNormPH( normPH );
107 mdcDedxTds->setErrorPH( errorPH );
108 mdcDedxTds->setTwentyPH( twentyPH );
109 // dedxTds->setFracErrPH(fracErrPH);
110 // dedxTds->setMinIronPH(minIronPH);
111 // dedxTds->setCorrPH(corrPH);
112
113 mdcDedxTdsCol->push_back( mdcDedxTds );
114 // delete dedxTds;
115 // dedxTds = NULL;
116 }
117 // m_dedxCol->Delete();
118 delete m_mdcDedxCol;
119 m_mdcDedxCol = 0;
120 return StatusCode::SUCCESS;
121}

◆ TObjectToDataObject() [2/3]

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

transformation from root

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [3/3]

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

transformation from root

Implements RootEventBaseCnv.

◆ CnvFactory< MdcDedxCnv >

friend class CnvFactory< MdcDedxCnv >
friend

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