1#ifndef RecCgemDedxCnv_CXX
2#define RecCgemDedxCnv_CXX 1
3#include "GaudiKernel/MsgStream.h"
4#include "GaudiKernel/DataObject.h"
5#include "GaudiKernel/ObjectVector.h"
6#include "TClonesArray.h"
7#include "EventModel/EventModel.h"
8#include "ReconEvent/ReconEvent.h"
9#include "CgemRecEvent/RecCgemDedx.h"
11#include "RootEventData/TRecCgemDedx.h"
12#include "RootEventData/TRecTrackEvent.h"
14#include "RootCnvSvc/Rec/RecTrackCnv.h"
15#include "RootCnvSvc/Rec/RecCgemDedxCnv.h"
16#include "RootCnvSvc/RootAddress.h"
32 MsgStream log(
msgSvc(),
"RecCgemDedxCnv");
35 m_rootBranchname =
"m_recCgemDedxCol";
37 m_adresses.push_back(&m_recCgemDedxCol);
43 MsgStream log(
msgSvc(),
"RecCgemDedxCnv");
44 log << MSG::DEBUG <<
"RecCgemDedxCnv::TObjectToDataObject" << endreq;
45 StatusCode sc=StatusCode::SUCCESS;
49 refpObject=recCgemDedxCol;
53 if (!m_recCgemDedxCol)
return sc;
54 TIter dedxIter(m_recCgemDedxCol);
56 while ((recCgemDedxRoot = (
TRecCgemDedx*)dedxIter.Next())) {
57 double dedxHit = recCgemDedxRoot->
dedxHit();
58 double dedxEsat = recCgemDedxRoot->
dedxEsat();
59 double dedxNoRun = recCgemDedxRoot->
dedxNoRun();
60 double dedxMoment = recCgemDedxRoot->
dedxMoment();
62 int trackId = recCgemDedxRoot->
trackId();
63 int particleId = recCgemDedxRoot->
particleId();
64 int status = recCgemDedxRoot->
status();
65 int truncAlg = recCgemDedxRoot->
truncAlg();
76 chi[0] = recCgemDedxRoot->
chiE();
77 chi[1] = recCgemDedxRoot->
chiMu();
78 chi[2] = recCgemDedxRoot->
chiPi();
79 chi[3] = recCgemDedxRoot->
chiK();
80 chi[4] = recCgemDedxRoot->
chiP();
84 double probPH = recCgemDedxRoot->
probPH();
85 double normPH = recCgemDedxRoot->
normPH();
86 double errorPH = recCgemDedxRoot->
errorPH();
87 double twentyPH = recCgemDedxRoot->
twentyPH();
88 double dedxExpect[5],sigmaDedx[5],pidProb[5];
89 for (
int i=0; i<5; i++){
90 dedxExpect[i] = recCgemDedxRoot->
dedxExpect(i);
91 sigmaDedx[i] = recCgemDedxRoot->
sigmaDedx(i);
92 pidProb[i] = recCgemDedxRoot->
pidProb(i);}
129 recCgemDedxCol->push_back(recCgemDedx);
134 delete m_recCgemDedxCol;
135 m_recCgemDedxCol = 0;
137 return StatusCode::SUCCESS;
142 MsgStream log(
msgSvc(),
"RecCgemDedxCnv");
143 log << MSG::DEBUG <<
"RecCgemDedxCnv::DataObjectToTObject" << endreq;
144 StatusCode sc=StatusCode::SUCCESS;
147 if (!recCgemDedxCol) {
148 log << MSG::ERROR <<
"Could not downcast to RecCgemDedxCol" << endreq;
149 return StatusCode::FAILURE;
155 log << MSG::ERROR <<
"Could not get RecEvent in TDS " << endreq;
156 return StatusCode::FAILURE;
160 log << MSG::ERROR <<
"RecCgemDedxCnv:Could not downcast to TDS RecEvent" << endreq;
162 IOpaqueAddress *addr;
168 if (!m_recCgemDedxCol)
return sc;
170 RecCgemDedxCol::const_iterator recCgemDedx;
172 for (recCgemDedx = recCgemDedxCol->begin(); recCgemDedx != recCgemDedxCol->end(); recCgemDedx++) {
173 Int_t trackId = (*recCgemDedx)->
trackId();
174 Int_t particleId = (*recCgemDedx)->particleId();
175 Int_t status = (*recCgemDedx)->status();
176 Int_t truncAlg = (*recCgemDedx)->truncAlg();
180 Double_t dedxHit = (*recCgemDedx)->getDedxHit();
181 Double_t dedxEsat = (*recCgemDedx)->getDedxEsat();
182 Double_t dedxNoRun = (*recCgemDedx)->getDedxNoRun();
183 Double_t dedxMoment = (*recCgemDedx)->getDedxMoment();
186 Double_t chiE = (*recCgemDedx)->chi(0);
187 Double_t chiMu = (*recCgemDedx)->chi(1);
188 Double_t chiPi = (*recCgemDedx)->chi(2);
189 Double_t chiK = (*recCgemDedx)->chi(3);
190 Double_t chiP = (*recCgemDedx)->chi(4);
192 Int_t numGoodHits = (*recCgemDedx)->numGoodHits();
193 Int_t numTotalHits = (*recCgemDedx)->numTotalHits();
195 Double_t probPH = (*recCgemDedx)->probPH();
196 Double_t normPH = (*recCgemDedx)->normPH();
197 Double_t errorPH = (*recCgemDedx)->errorPH();
198 Double_t twentyPH = (*recCgemDedx)->twentyPH();
202 double dedxExpect[5],sigmaDedx[5],pidProb[5],chi[5];
203 for (
int i=0; i<5; i++){
204 chi[i] = (*recCgemDedx)->chi(i);
205 dedxExpect[i] = (*recCgemDedx)->getDedxExpect(i);
206 sigmaDedx[i] = (*recCgemDedx)->getSigmaDedx(i);
207 pidProb[i] = (*recCgemDedx)->getPidProb(i);
218 log << MSG::INFO<<
"check Reconstrunction root"<<
" particle Id is : "<<particleId
219 <<
"track id is : "<<trackId
220 <<
" and status is : "<<status<<endreq;
222 recCgemDedxRoot->
setChiE(chiE);
225 recCgemDedxRoot->
setChiK(chiK);
226 recCgemDedxRoot->
setChiP(chiP);
236 recCgemDedxRoot->
setChi(chi);
247 log << MSG::INFO<<
"check Reconstrunction root"<<
" particle Id is : "<<particleId
248 <<
"track id is : "<<trackId
249 <<
" and status is : "<<status<<endreq;
257 return StatusCode::SUCCESS;
ObjectVector< RecCgemDedx > RecCgemDedxCol
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)
virtual StatusCode TObjectToDataObject(DataObject *&obj)
transformation from root
virtual StatusCode DataObjectToTObject(DataObject *obj, RootAddress *addr)
transformation to root
RecCgemDedxCnv(ISvcLocator *svc)
void setDedxHit(double dedx_hit)
void setDedxExpect(double *dedx_exp)
void setSigmaDedx(double *sigma_dedx)
void setDedxMoment(double dedx_momentum)
void setDedxNoRun(double dedx_norun)
void setPidProb(double *pid_prob)
void setDedxEsat(double dedx_esat)
static TRecTrackEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
Definition of a Root address, derived from IOpaqueAddress.
RecTrackCnv * getRecTrackCnv()
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.
Double_t dedxNoRun() const
void setDedxHit(const Double_t dedx_hit)
void setChiE(const Double_t chiE)
void setChiP(const Double_t chiP)
Double_t dedxEsat() const
void setChiPi(const Double_t chiPi)
Double_t twentyPH() const
void setChiMu(const Double_t chiMu)
void setDedxNoRun(const Double_t dedx_norun)
void setParticleId(const Int_t particleId)
Int_t numGoodHits() const
void setTrackId(const Int_t trackId)
void setNumGoodHits(const Int_t numGoodHits)
void setChiK(const Double_t chiK)
void setTruncAlg(const Int_t trunc_alg)
void setTwentyPH(const Double_t twentyPH)
void setSigmaDedx(double *sigma_dedx)
void setDedxMoment(const Double_t dedx_momentum)
Int_t numTotalHits() const
Double_t dedxExpect(int pid) const
void setStatus(const Int_t status)
void setNumTotalHits(const Int_t numTotalHits)
Double_t dedxMoment() const
Double_t pidProb(int pid) const
Double_t sigmaDedx(int pid) const
void setPidProb(double *pid_prob)
void setErrorPH(const Double_t errorPH)
void setNormPH(const Double_t normPH)
void setDedxEsat(const Double_t dedx_esat)
void setProbPH(const Double_t probPH)
void setDedxExpect(double *dedx_exp)
void clearRecCgemDedxCol()
clear the whole array
void addRecCgemDedx(TRecCgemDedx *Track)
Add a Dedx into the TOF Data collection.
const TObjArray * getRecCgemDedxCol() const
retrieve the whole TObjArray of Dedx Data
static std::map< const TObject *, const RecCgemDedx * > m_rootRecCgemDedxMap
_EXTERN_ std::string Event