CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
RecCgemClusterCnv Class Reference

#include <RecCgemClusterCnv.h>

+ Inheritance diagram for RecCgemClusterCnv:

Public Member Functions

virtual ~RecCgemClusterCnv ()
 
- Public Member Functions inherited from RootEventBaseCnv
 RootEventBaseCnv (const CLID &clid, ISvcLocator *svc)
 
virtual ~RootEventBaseCnv ()
 
virtual long repSvcType () const
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
void declareObject (const std::string &fullPath, const CLID &clid, const std::string &treename, const std::string &branchname)
 Store TDS path to link a particular converter to an object on the TDS.
 
virtual StatusCode createObj (IOpaqueAddress *addr, DataObject *&dat)
 Convert the persistent object to transient.
 
virtual StatusCode createRep (DataObject *pObject, IOpaqueAddress *&refpAddress)
 Convert the transient object to the requested representation.
 
virtual StatusCode fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the converted object.
 
virtual StatusCode fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the converted object.
 
virtual StatusCode DataObjectToTObject (DataObject *dat, RootAddress *addr)=0
 Do the concrete conversion from TDS to ROOT.
 
virtual StatusCode TObjectToDataObject (DataObject *&dat)=0
 Do the concrete conversion from ROOT to TDS.
 
TObject * getReadObject () const
 get the object to be read
 
- Public Member Functions inherited from Converter< Ty1, Ty2 >
destinationoperator (const source &) const
 

Static Public Member Functions

static const CLID & classID ()
 
- Static Public Member Functions inherited from RootEventBaseCnv
static const unsigned char storageType ()
 Storage type and class ID.
 

Protected Member Functions

 RecCgemClusterCnv (ISvcLocator *svc)
 
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 Do the concrete conversion from TDS to ROOT.
 
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 Do the concrete conversion from ROOT to TDS.
 
- Protected Member Functions inherited from Converter< Ty1, Ty2 >
virtual destinationconvert (const source &) const =0
 

Friends

class CnvFactory< RecCgemClusterCnv >
 

Additional Inherited Members

- Public Types inherited from Converter< Ty1, Ty2 >
typedef Ty1 source
 
typedef Ty2 destination
 
- Protected Attributes inherited from RootEventBaseCnv
RootCnvSvcm_cnvSvc
 
std::vector< RootCnvSvc::Leafm_leaves
 
RootInterfacem_rootInterface
 pointer to the RootInterface
 
IDataProviderSvc * m_eds
 pointer to eventdataservice
 
int m_branchNr
 the branchNr of this converter for writing
 
int m_branchNrDst
 
int m_branchNrMc
 
int m_branchNrRecon
 
int m_branchNrEvtRec
 
int m_branchNrEvtHeader
 
int m_branchNrEvtNavigator
 
TObject * m_objRead
 the object that was read
 
CLID CLID_top
 the CLID of the upper converter if any
 
TArrayS * m_branchNumbers
 array with number of branches for reading
 
std::string m_rootBranchname
 root branchname (may be concatenated of severals)
 
std::string m_rootTreename
 each converter knows it's treename
 
std::string m_currentFileName
 
std::vector< void * > m_adresses
 each converter knows the corresponding adresses
 
RootEvtSelectorm_evtsel
 

Detailed Description

Definition at line 15 of file RecCgemClusterCnv.h.

Constructor & Destructor Documentation

◆ ~RecCgemClusterCnv()

virtual RecCgemClusterCnv::~RecCgemClusterCnv ( )
inlinevirtual

Definition at line 26 of file RecCgemClusterCnv.h.

26{ };

◆ RecCgemClusterCnv()

RecCgemClusterCnv::RecCgemClusterCnv ( ISvcLocator *  svc)
protected

Definition at line 26 of file RecCgemClusterCnv.cxx.

28{
29
30 MsgStream log(msgSvc(),"RecCgemClusterCnv");
31 log << MSG::INFO << " RecCgemClusterCnv ------ " << endreq;
32 m_rootBranchname = "m_recCgemClusterCol";
33 m_adresses.push_back(&m_recCgemClusterCol);
34 m_recCgemClusterCol = 0;
35}
IMessageSvc * msgSvc()
static const CLID & classID()
Base class for all Root Converters.
std::vector< void * > m_adresses
each converter knows the corresponding adresses
std::string m_rootBranchname
root branchname (may be concatenated of severals)

Member Function Documentation

◆ classID()

static const CLID & RecCgemClusterCnv::classID ( )
inlinestatic

Definition at line 21 of file RecCgemClusterCnv.h.

22 {
24 }
const CLID & CLID_RecCgemClusterCol
Definition: EventModel.cxx:424

◆ DataObjectToTObject()

StatusCode RecCgemClusterCnv::DataObjectToTObject ( DataObject *  dat,
RootAddress addr 
)
protectedvirtual

Do the concrete conversion from TDS to ROOT.

Implements RootEventBaseCnv.

Definition at line 86 of file RecCgemClusterCnv.cxx.

87{
88 MsgStream log(msgSvc(), "RecCgemClusterCnv");
89 log << MSG::DEBUG << "RecCgemClusterCnv::DataObjectToTObject" << endreq;
90
91 RecCgemClusterCol * cgemClusterColTds=dynamic_cast<RecCgemClusterCol *> (obj);
92 if (!cgemClusterColTds) {
93 log << MSG::ERROR << "Could not downcast to RecCgemClusterCol" << endreq;
94 return StatusCode::FAILURE;
95 }
96
97 DataObject *evt;
98 m_eds->findObject(EventModel::Recon::Event,evt);
99 if (evt==NULL) {
100 log << MSG::ERROR << "Could not get ReconEvent in TDS " << endreq;
101 return StatusCode::FAILURE;
102 }
103
104 ReconEvent * devtTds=dynamic_cast<ReconEvent *> (evt);
105 if (!devtTds) {
106 log << MSG::ERROR << "RecCgemHitCnv:Could not downcast to TDS ReconEvent" << endreq;
107 }
108
109 IOpaqueAddress *addr;
110
111 m_cnvSvc->getRecTrackCnv()->createRep(evt,addr);
113
114 const TObjArray *m_recCgemClusterCol = recEvt->getRecCgemClusterCol();
115 if (!m_recCgemClusterCol) return StatusCode::SUCCESS;
116 recEvt->clearRecCgemClusterCol();
117
118 RecCgemClusterCol::const_iterator recCgemCluster;
119 for (recCgemCluster = cgemClusterColTds->begin(); recCgemCluster != cgemClusterColTds->end(); recCgemCluster++)
120 {
121 Int_t layerid = (*recCgemCluster)->getlayerid();
122 Int_t sheetid = (*recCgemCluster)->getsheetid();
123 Int_t clusterid = (*recCgemCluster)->getclusterid();
124 Int_t flag = (*recCgemCluster)->getflag();
125 Double_t energydeposit = (*recCgemCluster)->getenergydeposit();
126 Double_t recphi = (*recCgemCluster)->getrecphi();
127 //Double_t recpositiony = (*recCgemCluster)->getrecpositiony();
128 Double_t recv = (*recCgemCluster)->getrecv();
129
130 Int_t trkid = (*recCgemCluster)->getTrkId();
131 Double_t recZ = (*recCgemCluster)->getRecZ();
132 Int_t clusterflag_b = (*recCgemCluster)->getclusterflagb();
133 Int_t clusterflag_e = (*recCgemCluster)->getclusterflage();
134
135 TRecCgemCluster *recCgemClusterRoot = new TRecCgemCluster();
136
137 recCgemClusterRoot->setlayerid(layerid);
138 recCgemClusterRoot->setsheetid(sheetid);
139 recCgemClusterRoot->setclusterid(clusterid);
140 recCgemClusterRoot->setflag(flag);
141 recCgemClusterRoot->setenergydeposit(energydeposit);
142 recCgemClusterRoot->setrecphi(recphi);
143 //recCgemClusterRoot->setrecpositiony(recpositiony);
144 recCgemClusterRoot->setrecv(recv);
145
146 recCgemClusterRoot->setTrkId(trkid);
147 recCgemClusterRoot->setRecZ(recZ);
148 recCgemClusterRoot->setclusterflag(clusterflag_b,clusterflag_e);
149 Int_t stripid[2][2] = {-9999,-9999,-9999,-9999};
150 if(flag==0||flag==1){
151 stripid[flag][0] = clusterflag_b;
152 stripid[flag][1] = clusterflag_e;
153 }else if(flag==2||flag==3){
154 for(RecCgemClusterCol::const_iterator iter = cgemClusterColTds->begin(); iter != cgemClusterColTds->end(); iter++){
155 if((*iter)->getclusterid() == clusterflag_b || (*iter)->getclusterid() == clusterflag_e){
156 Int_t Flag = (*iter)->getflag();
157 if(Flag==0||Flag==1){
158 stripid[Flag][0] = (*iter)->getclusterflagb();
159 stripid[Flag][1] = (*iter)->getclusterflage();
160 }
161 }
162 }
163 }
164 recCgemClusterRoot->setstripid(stripid);
165
166 recEvt->addRecCgemCluster(recCgemClusterRoot);
167 }
168 return StatusCode::SUCCESS;
169}
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
ObjectVector< RecCgemCluster > RecCgemClusterCol
static TRecTrackEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
Definition: RecTrackCnv.h:36
RecTrackCnv * getRecTrackCnv()
Definition: RootCnvSvc.h:166
RootCnvSvc * m_cnvSvc
IDataProviderSvc * m_eds
pointer to eventdataservice
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
void setTrkId(Int_t trkid)
void setclusterflag(Int_t begin, Int_t end)
void setlayerid(Int_t layerid)
void setsheetid(Int_t sheetid)
void setflag(Int_t flag)
void setrecphi(Double_t recphi)
void setRecZ(Double_t recZ)
void setstripid(Int_t type, Int_t i, Int_t value)
void setrecv(Double_t recv)
void setclusterid(Int_t clusterid)
void setenergydeposit(Double_t energydeposit)
void clearRecCgemClusterCol()
clear the whole array(necessary because of the consts-s)
const TObjArray * getRecCgemClusterCol() const
retrive the whole TObjArray of RecCgemCluster Data
void addRecCgemCluster(TRecCgemCluster *Cluster)
Add a Rec Cgem Cluster into the Cgem data collection.
_EXTERN_ std::string Event
Definition: EventModel.h:90

◆ TObjectToDataObject()

StatusCode RecCgemClusterCnv::TObjectToDataObject ( DataObject *&  dat)
protectedvirtual

Do the concrete conversion from ROOT to TDS.

Implements RootEventBaseCnv.

Definition at line 36 of file RecCgemClusterCnv.cxx.

37{
38 MsgStream log(msgSvc(),"RecCgemClusterCnv");
39 log << MSG::DEBUG << "RecCgemClusterCnv::TObjectToDataObject" << endreq;
40
41
42 RecCgemClusterCol* recCgemClusterCol = new RecCgemClusterCol;
43 refpObject = recCgemClusterCol;
44
45
46 //convert//
47 if (!m_recCgemClusterCol) return StatusCode::SUCCESS;
48 TIter cgemClusterIter(m_recCgemClusterCol);
49 TRecCgemCluster *recCgemClusterRoot = 0;
50 while ((recCgemClusterRoot = (TRecCgemCluster*)cgemClusterIter.Next()))
51 {
52 int clusterid = recCgemClusterRoot->getclusterid();
53 int layerid = recCgemClusterRoot->getlayerid();
54 int sheetid = recCgemClusterRoot->getsheetid();
55 int flag = recCgemClusterRoot->getflag();
56 double energydeposit = recCgemClusterRoot->getenergydeposit();
57 double recphi = recCgemClusterRoot->getrecphi();
58 //double recpositiony = recCgemClusterRoot->getrecpositiony();
59 double recv = recCgemClusterRoot->getrecv();
60
61 double recZ = recCgemClusterRoot->getRecZ();
62 int trkid = recCgemClusterRoot->getTrkId();
63 int clusterflag_first = recCgemClusterRoot->getclusterflagb();
64 int clusterflag_second = recCgemClusterRoot->getclusterflage();
65
66 RecCgemCluster* recCgemCluster = new RecCgemCluster();
67 m_common.m_rootRecCgemClusterMap[recCgemClusterRoot] = recCgemCluster;
68
69 recCgemCluster->setclusterid(clusterid);
70 recCgemCluster->setlayerid(layerid);
71 recCgemCluster->setsheetid(sheetid);
72 recCgemCluster->setflag(flag);
73 recCgemCluster->setenergydeposit(energydeposit);
74 recCgemCluster->setrecphi(recphi);
75 //recCgemCluster->setrecpositiony(recpositiony);
76 recCgemCluster->setrecv(recv);
77
78 recCgemCluster->setRecZ(recZ);
79 recCgemCluster->setTrkId(trkid);
80 recCgemCluster->setclusterflag(clusterflag_first,clusterflag_second);
81
82 recCgemClusterCol->push_back(recCgemCluster);
83 }
84 return StatusCode::SUCCESS;
85}
void setsheetid(int sheetid)
void setlayerid(int layerid)
void setclusterid(int clusterid)
void setenergydeposit(double energydeposit)
void setrecv(double recv)
void setRecZ(double recZ)
void setTrkId(int trkid)
void setflag(int flag)
void setclusterflag(int begin, int end)
void setrecphi(double recphi)
Int_t getTrkId(void) const
Int_t getclusterflagb(void) const
Int_t getsheetid(void) const
Double_t getenergydeposit(void) const
Int_t getlayerid(void) const
Double_t getrecphi(void) const
Int_t getflag(void) const
Double_t getRecZ(void) const
Double_t getrecv(void) const
Int_t getclusterid(void) const
Int_t getclusterflage(void) const
static std::map< const TObject *, const RecCgemCluster * > m_rootRecCgemClusterMap
Definition: commonData.h:253

Friends And Related Function Documentation

◆ CnvFactory< RecCgemClusterCnv >

friend class CnvFactory< RecCgemClusterCnv >
friend

Definition at line 9 of file RecCgemClusterCnv.h.


The documentation for this class was generated from the following files: