2#include "GaudiKernel/MsgStream.h"
4#include "EventModel/EventModel.h"
5#include "EvtRecEvent/EvtRecObject.h"
6#include "EvtRecEvent/EvtRecEtaToGG.h"
8#include "RootEventData/TEvtRecObject.h"
9#include "RootEventData/TEvtRecEtaToGG.h"
11#include "RootCnvSvc/RootAddress.h"
12#include "RootCnvSvc/EvtRec/EvtRecCnv.h"
13#include "RootCnvSvc/EvtRec/EvtRecEtaToGGCnv.h"
15#include "CLHEP/Matrix/Vector.h"
16#include "CLHEP/Matrix/SymMatrix.h"
21using CLHEP::HepVector;
22using CLHEP::HepSymMatrix;
27 m_rootBranchname =
"m_evtRecEtaToGGCol";
28 m_adresses.push_back(&m_evtRecEtaToGGCol);
29 m_evtRecEtaToGGCol = 0;
34 MsgStream log(
msgSvc(),
"EvtRecEtaToGGCnv");
35 log << MSG::DEBUG <<
"EvtRecEtaToGGCnv::TObjectToDataObject" << endreq;
39 refpObject = evtRecEtaToGGCol;
41 if ( ! m_evtRecEtaToGGCol )
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 EvtRecEtaToGGCnv" << endreq;
52 if ( ! evtRecTrackCol) {
53 log << MSG::INFO <<
"Could not find EvtRecTrackCol" << endreq;
57 TIter evtRecEtaToGGIter(m_evtRecEtaToGGCol);
59 while ( (evtRecEtaToGGRoot = (
TEvtRecEtaToGG*)evtRecEtaToGGIter.Next() ) ) {
67 HepLorentzVector hiP4(evtRecEtaToGGRoot->
hiPxfit(),evtRecEtaToGGRoot->
hiPyfit(),evtRecEtaToGGRoot->
hiPzfit(),evtRecEtaToGGRoot->
hiPefit());
68 HepLorentzVector loP4(evtRecEtaToGGRoot->
loPxfit(),evtRecEtaToGGRoot->
loPyfit(),evtRecEtaToGGRoot->
loPzfit(),evtRecEtaToGGRoot->
loPefit());
72 int hiEnGammatrk=evtRecEtaToGGRoot->
hiEnGamma();
73 int loEnGammatrk=evtRecEtaToGGRoot->
loEnGamma();
75 dynamic_cast<EvtRecTrack*
>(evtRecTrackCol->containedObject(hiEnGammatrk))
78 dynamic_cast<EvtRecTrack*
>(evtRecTrackCol->containedObject(loEnGammatrk))
82 evtRecEtaToGGCol->push_back(evtRecEtaToGG);
85 delete m_evtRecEtaToGGCol;
86 m_evtRecEtaToGGCol = 0;
87 return StatusCode::SUCCESS;
91 MsgStream log(
msgSvc(),
"EvtRecEtaToGGCnv");
92 log << MSG::DEBUG <<
"EvtRecEtaToGGCnv::DataObjectToTObject" << endreq;
95 if ( ! evtRecEtaToGGCol ) {
96 log << MSG::ERROR <<
"Could not downcast to EvtRecEtaToGGCol" << endreq;
97 return StatusCode::FAILURE;
103 log << MSG::ERROR <<
"Could not get EvtRecObject in TDS" << endreq;
104 return StatusCode::FAILURE;
108 log << MSG::ERROR <<
"EvtRecEtaToGGCnv: Could not downcast to TDS EvtRecObject" << endreq;
111 IOpaqueAddress *addr;
116 if ( ! m_evtRecEtaToGGCol )
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 EvtRecEtaToGGCnv" << 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 EvtRecEtaToGGCol::const_iterator evtRecEtaToGG = evtRecEtaToGGCol->begin();
141 for ( ; evtRecEtaToGG != evtRecEtaToGGCol->end(); evtRecEtaToGG++) {
150 HepLorentzVector hiP4=ptr->
hiPfit();
151 HepLorentzVector loP4=ptr->
loPfit();
164 EvtRecTrackCol::iterator it = find(evtRecTrackColbegin,
167 evtRecEtaToGGRoot->
setHiEnGamma(it - evtRecTrackColbegin );
170 it = find(evtRecTrackColbegin,
173 evtRecEtaToGGRoot->
setLoEnGamma(it - evtRecTrackColbegin );
180 return StatusCode::SUCCESS;
ObjectVector< EvtRecEtaToGG > EvtRecEtaToGGCol
static TEvtRecObject * getWriteObject()
virtual StatusCode DataObjectToTObject(DataObject *obj, RootAddress *addr)
transformation to root
EvtRecEtaToGGCnv(ISvcLocator *svc)
virtual StatusCode TObjectToDataObject(DataObject *&obj)
transformation from root
const EvtRecTrack * hiEnGamma() const
HepLorentzVector hiPfit() const
void setLoEnGamma(const EvtRecTrack *trk)
void setHiEnGamma(const EvtRecTrack *trk)
HepLorentzVector loPfit() const
void setUnconMass(const double unconMass)
void setChisq(const double chisq)
void setHiPfit(const HepLorentzVector &hiPfit)
void setLoPfit(const HepLorentzVector &loPfit)
const EvtRecTrack * loEnGamma() const
Definition of a Root address, derived from IOpaqueAddress.
EvtRecCnv * getEvtRecCnv()
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 setHiPyfit(Double_t hiPy)
Double_t unconMass() const
void setHiPxfit(Double_t hiPx)
void setHiPzfit(Double_t hiPz)
void setHiPefit(Double_t hiPe)
void setLoPxfit(Double_t loPx)
void setLoPyfit(Double_t loPy)
void setLoPefit(Double_t loPe)
void setLoEnGamma(Int_t loEnGamma)
void setUnconMass(Double_t unconMass)
void setLoPzfit(Double_t loPz)
void setChisq(Double_t chisq)
void setHiEnGamma(Int_t hiEnGamma)
const TObjArray * getEvtRecEtaToGGCol() const
void clearEvtRecEtaToGGCol()
void addEvtRecEtaToGG(TEvtRecEtaToGG *eta)
static std::map< const TObject *, const EvtRecEtaToGG * > m_rootEvtRecEtaToGGMap
_EXTERN_ std::string Event
_EXTERN_ std::string EvtRecTrackCol