4#include "GaudiKernel/MsgStream.h"
5#include "GaudiKernel/DataObject.h"
6#include "GaudiKernel/ObjectVector.h"
8#include "TClonesArray.h"
10#include "EventModel/EventModel.h"
11#include "DstEvent/DstEvent.h"
12#include "DstEvent/DstMdcDedx.h"
13#include "RootEventData/TMdcDedx.h"
14#include "RootEventData/TDstEvent.h"
16#include "RootCnvSvc/Dst/DstCnv.h"
17#include "RootCnvSvc/Dst/MdcDedxCnv.h"
18#include "RootCnvSvc/RootAddress.h"
30 MsgStream log(
msgSvc(),
"MdcDedxCnv");
32 m_rootBranchname =
"m_mdcDedxCol";
34 m_adresses.push_back(&m_mdcDedxCol);
41 MsgStream log(
msgSvc(),
"MdcDedxCnv");
42 log << MSG::DEBUG <<
"MdcDedxCnv::TObjectToDataObject" << endreq;
43 StatusCode sc=StatusCode::SUCCESS;
47 refpObject=mdcDedxTdsCol;
51 if (!m_mdcDedxCol)
return sc;
52 TIter mdcDedxIter(m_mdcDedxCol);
54 while ((mdcDedxRoot = (
TMdcDedx*)mdcDedxIter.Next())) {
56 int trackId = mdcDedxRoot->
trackId();
58 int status = mdcDedxRoot->
status();
59 int truncAlg = mdcDedxRoot->
truncAlg();
72 chi[0] = mdcDedxRoot->
chiE();
73 chi[1] = mdcDedxRoot->
chiMu();
74 chi[2] = mdcDedxRoot->
chiPi();
75 chi[3] = mdcDedxRoot->
chiK();
76 chi[4] = mdcDedxRoot->
chiP();
80 double probPH = mdcDedxRoot->
probPH();
81 double normPH = mdcDedxRoot->
normPH();
82 double errorPH = mdcDedxRoot->
errorPH();
83 double twentyPH = mdcDedxRoot->
twentyPH();
116 mdcDedxTdsCol->push_back(mdcDedxTds);
123 return StatusCode::SUCCESS;
128 MsgStream log(
msgSvc(),
"MdcDedxCnv");
129 log << MSG::DEBUG <<
"MdcDedxCnv::DataObjectToTObject" << endreq;
130 StatusCode sc=StatusCode::SUCCESS;
133 if (!mdcDedxColTds) {
134 log << MSG::ERROR <<
"Could not downcast to MdcDedxCol" << endreq;
135 return StatusCode::FAILURE;
141 log << MSG::ERROR <<
"Could not get DstEvent in TDS " << endreq;
142 return StatusCode::FAILURE;
146 log << MSG::ERROR <<
"MdcDedxCnv:Could not downcast to TDS DstEvent" << endreq;
148 IOpaqueAddress *addr;
154 if (!m_mdcDedxCol)
return sc;
156 DstMdcDedxCol::const_iterator mdcDedxTds;
158 for (mdcDedxTds = mdcDedxColTds->begin(); mdcDedxTds != mdcDedxColTds->end(); mdcDedxTds++) {
159 Int_t trackId = (*mdcDedxTds)->
trackId();
160 Int_t particleId = (*mdcDedxTds)->particleId();
161 Int_t status = (*mdcDedxTds)->status();
162 Int_t truncAlg =(*mdcDedxTds)->truncAlg();
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);
174 Int_t numGoodHits = (*mdcDedxTds)->numGoodHits();
175 Int_t numTotalHits = (*mdcDedxTds)->numTotalHits();
177 Double_t probPH = (*mdcDedxTds)->probPH();
178 Double_t normPH = (*mdcDedxTds)->normPH();
179 Double_t errorPH = (*mdcDedxTds)->errorPH();
180 Double_t twentyPH =(*mdcDedxTds)->twentyPH();
184 log << MSG::INFO <<
"check Reconstrunction root"<<
" particle Id is : "<<particleId
185 <<
"track id is : "<<trackId
186 <<
" and status is : "<<status<<endreq;
213 log << MSG::INFO <<
"check Reconstrunction root"<<
" particle Id is : "<<particleId
214 <<
"track id is : "<<trackId
215 <<
" and status is : "<<status<<endreq;
222 return StatusCode::SUCCESS;
ObjectVector< DstMdcDedx > DstMdcDedxCol
static TDstEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
void setTruncAlg(int trunc_alg)
void setStatus(int status)
void setTwentyPH(double twentyPH)
void setNumGoodHits(int numGoodHits)
void setProbPH(double probPH)
void setNormPH(double normPH)
void setParticleId(int particleId)
void setTrackId(int trackId)
void setNumTotalHits(int numTotalHits)
void setErrorPH(double errorPH)
MdcDedxCnv(ISvcLocator *svc)
virtual StatusCode TObjectToDataObject(DataObject *&obj)
transformation from root
virtual StatusCode DataObjectToTObject(DataObject *obj, RootAddress *addr)
transformation to root
Definition of a Root address, derived from IOpaqueAddress.
Base class for all Root Converters.
IDataProviderSvc * m_eds
pointer to eventdataservice
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
const TObjArray * getMdcDedxCol() const
retrieve the whole TObjArray of Dedx Data
void clearMdcDedxCol()
clear the whole array
void addMdcDedx(TMdcDedx *Track)
Add a Dedx into the TOF Data collection.
void setChiP(const Double_t chiP)
void setNormPH(const Double_t normPH)
void setChiE(const Double_t chiE)
void setChiMu(const Double_t chiMu)
Int_t numTotalHits() const
void setChiPi(const Double_t chiPi)
Int_t numGoodHits() const
void setNumTotalHits(const Int_t numTotalHits)
void setParticleId(const Int_t particleId)
void setProbPH(const Double_t probPH)
void setTwentyPH(const Double_t twentyPH)
void setTrackId(const Int_t trackId)
void setStatus(const Int_t status)
void setTruncAlg(const Int_t trunc_alg)
void setChiK(const Double_t chiK)
void setNumGoodHits(const Int_t numGoodHits)
Double_t twentyPH() const
void setErrorPH(const Double_t errorPH)
static std::map< const TObject *, const DstMdcDedx * > m_rootMdcDedxMap
_EXTERN_ std::string Event