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/DstCgemDedx.h"
13#include "RootEventData/TCgemDedx.h"
14#include "RootEventData/TDstEvent.h"
16#include "RootCnvSvc/Dst/DstCnv.h"
17#include "RootCnvSvc/Dst/CgemDedxCnv.h"
18#include "RootCnvSvc/RootAddress.h"
30 MsgStream log(
msgSvc(),
"CgemDedxCnv");
32 m_rootBranchname =
"m_cgemDedxCol";
34 m_adresses.push_back(&m_cgemDedxCol);
41 MsgStream log(
msgSvc(),
"CgemDedxCnv");
42 log << MSG::DEBUG <<
"CgemDedxCnv::TObjectToDataObject" << endreq;
43 StatusCode sc=StatusCode::SUCCESS;
47 refpObject=cgemDedxTdsCol;
51 if (!m_cgemDedxCol)
return sc;
52 TIter cgemDedxIter(m_cgemDedxCol);
54 while ((cgemDedxRoot = (
TCgemDedx*)cgemDedxIter.Next())) {
56 int trackId = cgemDedxRoot->
trackId();
58 int status = cgemDedxRoot->
status();
59 int truncAlg = cgemDedxRoot->
truncAlg();
72 chi[0] = cgemDedxRoot->
chiE();
73 chi[1] = cgemDedxRoot->
chiMu();
74 chi[2] = cgemDedxRoot->
chiPi();
75 chi[3] = cgemDedxRoot->
chiK();
76 chi[4] = cgemDedxRoot->
chiP();
80 double probPH = cgemDedxRoot->
probPH();
81 double normPH = cgemDedxRoot->
normPH();
82 double errorPH = cgemDedxRoot->
errorPH();
83 double twentyPH = cgemDedxRoot->
twentyPH();
116 cgemDedxTdsCol->push_back(cgemDedxTds);
121 delete m_cgemDedxCol;
123 return StatusCode::SUCCESS;
128 MsgStream log(
msgSvc(),
"CgemDedxCnv");
129 log << MSG::DEBUG <<
"CgemDedxCnv::DataObjectToTObject" << endreq;
130 StatusCode sc=StatusCode::SUCCESS;
133 if (!cgemDedxColTds) {
134 log << MSG::ERROR <<
"Could not downcast to CgemDedxCol" << endreq;
135 return StatusCode::FAILURE;
141 log << MSG::ERROR <<
"Could not get DstEvent in TDS " << endreq;
142 return StatusCode::FAILURE;
146 log << MSG::ERROR <<
"CgemDedxCnv:Could not downcast to TDS DstEvent" << endreq;
148 IOpaqueAddress *addr;
154 if (!m_cgemDedxCol)
return sc;
156 DstCgemDedxCol::const_iterator cgemDedxTds;
158 for (cgemDedxTds = cgemDedxColTds->begin(); cgemDedxTds != cgemDedxColTds->end(); cgemDedxTds++) {
159 Int_t trackId = (*cgemDedxTds)->
trackId();
160 Int_t particleId = (*cgemDedxTds)->particleId();
161 Int_t status = (*cgemDedxTds)->status();
162 Int_t truncAlg =(*cgemDedxTds)->truncAlg();
168 Double_t chiE = (*cgemDedxTds)->chi(0);
169 Double_t chiMu = (*cgemDedxTds)->chi(1);
170 Double_t chiPi = (*cgemDedxTds)->chi(2);
171 Double_t chiK = (*cgemDedxTds)->chi(3);
172 Double_t chiP = (*cgemDedxTds)->chi(4);
174 Int_t numGoodHits = (*cgemDedxTds)->numGoodHits();
175 Int_t numTotalHits = (*cgemDedxTds)->numTotalHits();
177 Double_t probPH = (*cgemDedxTds)->probPH();
178 Double_t normPH = (*cgemDedxTds)->normPH();
179 Double_t errorPH = (*cgemDedxTds)->errorPH();
180 Double_t twentyPH =(*cgemDedxTds)->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< DstCgemDedx > DstCgemDedxCol
CgemDedxCnv(ISvcLocator *svc)
virtual StatusCode TObjectToDataObject(DataObject *&obj)
transformation from root
virtual StatusCode DataObjectToTObject(DataObject *obj, RootAddress *addr)
transformation to root
void setNumTotalHits(int numTotalHits)
void setProbPH(double probPH)
void setErrorPH(double errorPH)
void setNormPH(double normPH)
void setParticleId(int particleId)
void setTwentyPH(double twentyPH)
void setTrackId(int trackId)
void setNumGoodHits(int numGoodHits)
void setStatus(int status)
void setTruncAlg(int trunc_alg)
static TDstEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
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.
void setParticleId(const Int_t particleId)
void setChiPi(const Double_t chiPi)
void setTruncAlg(const Int_t trunc_alg)
void setChiK(const Double_t chiK)
void setChiE(const Double_t chiE)
void setChiP(const Double_t chiP)
Double_t twentyPH() const
void setChiMu(const Double_t chiMu)
void setNumTotalHits(const Int_t numTotalHits)
void setStatus(const Int_t status)
void setTwentyPH(const Double_t twentyPH)
void setProbPH(const Double_t probPH)
Int_t numGoodHits() const
void setTrackId(const Int_t trackId)
void setNormPH(const Double_t normPH)
Int_t numTotalHits() const
void setNumGoodHits(const Int_t numGoodHits)
void setErrorPH(const Double_t errorPH)
void clearCgemDedxCol()
clear the whole array
const TObjArray * getCgemDedxCol() const
retrieve the whole TObjArray of Dedx Data
void addCgemDedx(TCgemDedx *Track)
Add a Dedx into the TOF Data collection.
static std::map< const TObject *, const DstCgemDedx * > m_rootCgemDedxMap
_EXTERN_ std::string Event