2#include "GaudiKernel/MsgStream.h"
4#include "EventModel/EventModel.h"
5#include "EvtRecEvent/EvtRecObject.h"
6#include "EvtRecEvent/EvtRecPi0.h"
8#include "RootEventData/TEvtRecObject.h"
9#include "RootEventData/TEvtRecPi0.h"
11#include "RootCnvSvc/RootAddress.h"
12#include "RootCnvSvc/EvtRec/EvtRecCnv.h"
13#include "RootCnvSvc/EvtRec/EvtRecPi0Cnv.h"
15#include "CLHEP/Matrix/Vector.h"
16#include "CLHEP/Matrix/SymMatrix.h"
21using CLHEP::HepVector;
22using CLHEP::HepSymMatrix;
34 MsgStream log(
msgSvc(),
"EvtRecPi0Cnv");
35 log << MSG::DEBUG <<
"EvtRecPi0Cnv::TObjectToDataObject" << endreq;
39 refpObject = evtRecPi0Col;
41 if ( ! m_evtRecPi0Col )
return StatusCode::SUCCESS;
43 IDataProviderSvc* dataSvc = 0;
44 StatusCode sc = serviceLocator()->getService(
"EventDataSvc",
45 IDataProviderSvc::interfaceID(), (IInterface*&)dataSvc);
46 if ( sc.isFailure() ) {
47 log << MSG::FATAL <<
"Could not get EventDataSvc in EvtRecPi0Cnv" << endreq;
52 if ( ! evtRecTrackCol) {
53 log << MSG::INFO <<
"Could not find EvtRecTrackCol" << endreq;
57 TIter evtRecPi0Iter(m_evtRecPi0Col);
59 while ( (evtRecPi0Root = (
TEvtRecPi0*)evtRecPi0Iter.Next() ) ) {
72 int hiEnGammatrk=evtRecPi0Root->
hiEnGamma();
73 int loEnGammatrk=evtRecPi0Root->
loEnGamma();
75 dynamic_cast<EvtRecTrack*
>(evtRecTrackCol->containedObject(hiEnGammatrk))
78 dynamic_cast<EvtRecTrack*
>(evtRecTrackCol->containedObject(loEnGammatrk))
82 evtRecPi0Col->push_back(evtRecPi0);
85 delete m_evtRecPi0Col;
87 return StatusCode::SUCCESS;
91 MsgStream log(
msgSvc(),
"EvtRecPi0Cnv");
92 log << MSG::DEBUG <<
"EvtRecPi0Cnv::DataObjectToTObject" << endreq;
95 if ( ! evtRecPi0Col ) {
96 log << MSG::ERROR <<
"Could not downcast to EvtRecPi0Col" << endreq;
97 return StatusCode::FAILURE;
103 log << MSG::ERROR <<
"Could not get EvtRecObject in TDS" << endreq;
104 return StatusCode::FAILURE;
108 log << MSG::ERROR <<
"EvtRecPi0Cnv: Could not downcast to TDS EvtRecObject" << endreq;
111 IOpaqueAddress *addr;
116 if ( ! m_evtRecPi0Col )
return StatusCode::SUCCESS;
118 IDataProviderSvc* dataSvc = 0;
119 StatusCode sc = serviceLocator()->getService(
"EventDataSvc",
120 IDataProviderSvc::interfaceID(), (IInterface*&)dataSvc);
121 if ( sc.isFailure() ) {
122 log << MSG::FATAL <<
"Could not get EventDataSvc in EvtRecPi0Cnv" << endreq;
126 EvtRecTrackCol::iterator evtRecTrackColbegin, evtRecTrackColend;
129 if ( ! evtRecTrackCol) {
130 log << MSG::INFO <<
"Could not find EvtRecTrackCol" << endreq;
133 evtRecTrackColbegin = evtRecTrackCol->begin();
134 evtRecTrackColend = evtRecTrackCol->end();
139 EvtRecPi0Col::const_iterator evtRecPi0 = evtRecPi0Col->begin();
141 for ( ; evtRecPi0 != evtRecPi0Col->end(); evtRecPi0++) {
150 HepLorentzVector hiP4=ptr->
hiPfit();
151 HepLorentzVector loP4=ptr->
loPfit();
164 EvtRecTrackCol::iterator it = find(evtRecTrackColbegin,
170 it = find(evtRecTrackColbegin,
180 return StatusCode::SUCCESS;
ObjectVector< EvtRecPi0 > EvtRecPi0Col
static TEvtRecObject * getWriteObject()
EvtRecPi0Cnv(ISvcLocator *svc)
virtual StatusCode TObjectToDataObject(DataObject *&obj)
transformation from root
virtual StatusCode DataObjectToTObject(DataObject *obj, RootAddress *addr)
transformation to root
void setChisq(const double chisq)
void setLoPfit(const HepLorentzVector &loPfit)
void setLoEnGamma(const EvtRecTrack *trk)
const EvtRecTrack * loEnGamma() const
void setHiPfit(const HepLorentzVector &hiPfit)
HepLorentzVector hiPfit() const
HepLorentzVector loPfit() const
void setUnconMass(const double unconMass)
const EvtRecTrack * hiEnGamma() const
void setHiEnGamma(const EvtRecTrack *trk)
Definition of a Root address, derived from IOpaqueAddress.
EvtRecCnv * getEvtRecCnv()
Base class for all Root Converters.
IDataProviderSvc * m_eds
pointer to eventdataservice
std::vector< void * > m_adresses
each converter knows the corresponding adresses
std::string m_rootBranchname
root branchname (may be concatenated of severals)
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
void addEvtRecPi0(TEvtRecPi0 *pi0)
const TObjArray * getEvtRecPi0Col() const
void setLoPxfit(Double_t loPx)
void setLoPyfit(Double_t loPy)
void setUnconMass(Double_t unconMass)
void setLoEnGamma(Int_t loEnGamma)
void setLoPzfit(Double_t loPz)
void setHiPyfit(Double_t hiPy)
Double_t unconMass() const
void setLoPefit(Double_t loPe)
void setHiPxfit(Double_t hiPx)
void setHiPzfit(Double_t hiPz)
void setChisq(Double_t chisq)
void setHiEnGamma(Int_t hiEnGamma)
void setHiPefit(Double_t hiPe)
static std::map< const TObject *, const EvtRecPi0 * > m_rootEvtRecPi0Map
_EXTERN_ std::string Event
_EXTERN_ std::string EvtRecTrackCol