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

#include <RecCgemHitCnv.h>

+ Inheritance diagram for RecCgemHitCnv:

Public Member Functions

virtual ~RecCgemHitCnv ()
 
- 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

 RecCgemHitCnv (ISvcLocator *svc)
 
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
 
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
 
- Protected Member Functions inherited from Converter< Ty1, Ty2 >
virtual destinationconvert (const source &) const =0
 

Friends

class CnvFactory< RecCgemHitCnv >
 

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 RecCgemHitCnv.h.

Constructor & Destructor Documentation

◆ ~RecCgemHitCnv()

virtual RecCgemHitCnv::~RecCgemHitCnv ( )
inlinevirtual

Definition at line 25 of file RecCgemHitCnv.h.

25{ };

◆ RecCgemHitCnv()

RecCgemHitCnv::RecCgemHitCnv ( ISvcLocator *  svc)
protected

Definition at line 28 of file RecCgemHitCnv.cxx.

30{
31
32 // Here we associate this converter with the /Event path on the TDS.
33 MsgStream log(msgSvc(), "RecCgemHitCnv");
34 //log << MSG::DEBUG << "Constructor called for " << objType() << endreq;
35 //m_rootTreename ="Rec";
36 m_rootBranchname ="m_recCgemHitCol";
37 //declareObject(EventModel::Recon::RecCgemHitCol, objType(), m_rootTreename, m_rootBranchname);
38 m_adresses.push_back(&m_recCgemHitCol);
39 m_recCgemHitCol=0;
40}
IMessageSvc * msgSvc()
static const CLID & classID()
Definition: RecCgemHitCnv.h:20
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 & RecCgemHitCnv::classID ( )
inlinestatic

Definition at line 20 of file RecCgemHitCnv.h.

21 {
22 return CLID_RecCgemHitCol;
23 }
const CLID & CLID_RecCgemHitCol
Definition: EventModel.cxx:405

◆ DataObjectToTObject()

StatusCode RecCgemHitCnv::DataObjectToTObject ( DataObject *  obj,
RootAddress addr 
)
protectedvirtual

transformation to root

Implements RootEventBaseCnv.

Definition at line 91 of file RecCgemHitCnv.cxx.

91 {
92
93 MsgStream log(msgSvc(), "RecCgemHitCnv");
94 log << MSG::DEBUG << "RecCgemHitCnv::DataObjectToTObject" << endreq;
95
96 RecCgemHitCol * cgemHitColTds=dynamic_cast<RecCgemHitCol *> (obj);
97 if (!cgemHitColTds) {
98 log << MSG::ERROR << "Could not downcast to RecCgemHitCol" << endreq;
99 return StatusCode::FAILURE;
100 }
101
102 DataObject *evt;
103 m_eds->findObject(EventModel::Recon::Event,evt);
104 if (evt==NULL) {
105 log << MSG::ERROR << "Could not get ReconEvent in TDS " << endreq;
106 return StatusCode::FAILURE;
107 }
108
109 ReconEvent * devtTds=dynamic_cast<ReconEvent *> (evt);
110 if (!devtTds) {
111 log << MSG::ERROR << "RecCgemHitCnv:Could not downcast to TDS ReconEvent" << endreq;
112 }
113
114 IOpaqueAddress *addr;
115
116 m_cnvSvc->getRecTrackCnv()->createRep(evt,addr);
118
119 const TObjArray *m_recCgemHitCol = recEvt->getRecCgemHitCol();
120 if (!m_recCgemHitCol) return StatusCode::SUCCESS;
121 recEvt->clearRecCgemHitCol(); //necessary in case there is I/O at the same time since array is static
122
123 RecCgemHitCol::const_iterator recCgemHit;
124 for (recCgemHit = cgemHitColTds->begin(); recCgemHit != cgemHitColTds->end(); recCgemHit++) {
125 Bool_t isGrouped =(*recCgemHit)->isGrouped();
126 Int_t id =(*recCgemHit)->getId();
127 Int_t trackId =(*recCgemHit)->getTrkId();
128 Double_t chisqAdd =(*recCgemHit)->getChisqAdd();
129 Int_t stat =(*recCgemHit)->getStat();
130// UInt_t cgemIdMSB =(*recCgemHit)->getCgemId().get_valueMSB();
131// UInt_t cgemIdLSB =(*recCgemHit)->getCgemId().get_valueLSB();
132 UInt_t cgemId =(*recCgemHit)->getCgemId().get_value();
133 Double_t tdc =(*recCgemHit)->getTdc();
134 Double_t adc =(*recCgemHit)->getAdc();
135 Double_t doca =(*recCgemHit)->getDoca();
136 Double_t entra =(*recCgemHit)->getEntra();
137 Double_t zhit =(*recCgemHit)->getZhit();
138 Double_t fltLen =(*recCgemHit)->getFltLen();
139
140 TRecCgemHit *recCgemHitRoot = new TRecCgemHit();
141 //m_common.m_recCgemHitMap[(*recCgemHit)] = recCgemHitRoot;
142
143 recCgemHitRoot->setIsGrouped( isGrouped );
144 recCgemHitRoot->setId( id );
145 recCgemHitRoot->setTrkId( trackId );
146 recCgemHitRoot->setChisqAdd( chisqAdd );
147 recCgemHitRoot->setStat( stat );
148// recCgemHitRoot->setCgemIdMSB( cgemIdMSB );
149// recCgemHitRoot->setCgemIdLSB( cgemIdLSB );
150 recCgemHitRoot->setCgemId( cgemId );
151 recCgemHitRoot->setTdc( tdc );
152 recCgemHitRoot->setAdc( adc );
153 recCgemHitRoot->setDoca( doca );
154 recCgemHitRoot->setEntra( entra );
155 recCgemHitRoot->setZhit( zhit );
156 recCgemHitRoot->setFltLen( fltLen );
157
158 recEvt->addRecCgemHit(recCgemHitRoot);
159 }
160 return StatusCode::SUCCESS;
161}
ObjectVector< RecCgemHit > RecCgemHitCol
Definition: RecCgemHit.h:81
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 setChisqAdd(Double_t pChisq)
Definition: TRecCgemHit.h:38
void setZhit(Double_t zhit)
Definition: TRecCgemHit.h:47
void setTdc(Double_t tdc)
Definition: TRecCgemHit.h:43
void setCgemId(UInt_t cgemid)
Definition: TRecCgemHit.h:42
void setFltLen(Double_t fltLen)
Definition: TRecCgemHit.h:48
void setEntra(Double_t entra)
Definition: TRecCgemHit.h:46
void setDoca(Double_t doca)
Definition: TRecCgemHit.h:45
void setIsGrouped(Bool_t isGrouped)
Definition: TRecCgemHit.h:35
void setStat(Int_t stat)
Definition: TRecCgemHit.h:39
void setTrkId(Int_t trkid)
Definition: TRecCgemHit.h:37
void setId(Int_t id)
Definition: TRecCgemHit.h:36
void setAdc(Double_t adc)
Definition: TRecCgemHit.h:44
const TObjArray * getRecCgemHitCol() const
retrieve the whole TObjArray of RecCgemHit Data
void addRecCgemHit(TRecCgemHit *Hit)
Add a Rec Cgem Hit into the Cgem data collection.
void clearRecCgemHitCol()
clear the whole array (necessary because of the consts-s)
_EXTERN_ std::string Event
Definition: EventModel.h:90

◆ TObjectToDataObject()

StatusCode RecCgemHitCnv::TObjectToDataObject ( DataObject *&  obj)
protectedvirtual

transformation from root

Implements RootEventBaseCnv.

Definition at line 42 of file RecCgemHitCnv.cxx.

42 {
43 // creation of TDS object from root object
44 MsgStream log(msgSvc(), "RecCgemHitCnv");
45 log << MSG::DEBUG << "RecCgemHitCnv::TObjectToDataObject" << endreq;
46
47 // create the TDS location for the RecCgemHit Collection
48 RecCgemHitCol* recCgemHitCol = new RecCgemHitCol;
49 refpObject = recCgemHitCol;
50
51 // now convert
52 if (!m_recCgemHitCol) return StatusCode::SUCCESS;
53 TIter cgemHitIter(m_recCgemHitCol);
54 TRecCgemHit *recCgemHitRoot = 0;
55 while ((recCgemHitRoot = (TRecCgemHit*)cgemHitIter.Next())) {
56 int id = recCgemHitRoot->getId();
57 int trackId = recCgemHitRoot->getTrkId();
58 double chisqAdd = recCgemHitRoot->getChisqAdd();
59 int stat = recCgemHitRoot->getStat();
60// unsigned int cgemIdMSB=recCgemHitRoot->getCgemIdMSB();
61// unsigned int cgemIdLSB=recCgemHitRoot->getCgemIdLSB();
62 unsigned int cgemId=recCgemHitRoot->getCgemId();
63 double tdc = recCgemHitRoot->getTdc();
64 double adc = recCgemHitRoot->getAdc();
65 double doca = recCgemHitRoot->getDoca();
66 double entra = recCgemHitRoot->getEntra();
67 double zhit = recCgemHitRoot->getZhit();
68 double fltLen = recCgemHitRoot->getFltLen();
69
70 RecCgemHit *recCgemHit= new RecCgemHit();
71 m_common.m_rootRecCgemHitMap[recCgemHitRoot] = recCgemHit;
72
73 recCgemHit->setId( id );
74 recCgemHit->setTrkId( trackId );
75 recCgemHit->setChisqAdd( chisqAdd );
76 recCgemHit->setStat( stat );
77// recCgemHit->setCgemId( Identifier64(cgemIdMSB,cgemIdLSB) );
78 recCgemHit->setCgemId( Identifier(cgemId) );
79 recCgemHit->setTdc( tdc );
80 recCgemHit->setAdc( adc );
81 recCgemHit->setDoca( doca );
82 recCgemHit->setEntra( entra );
83 recCgemHit->setZhit( zhit );
84 recCgemHit->setFltLen( fltLen );
85
86 recCgemHitCol->push_back(recCgemHit);
87 }
88 return StatusCode::SUCCESS;
89}
void setDoca(double doca)
Definition: RecCgemHit.h:59
void setAdc(double adc)
Definition: RecCgemHit.h:58
void setStat(int stat)
Definition: RecCgemHit.h:55
void setTrkId(int trkid)
Definition: RecCgemHit.h:53
void setChisqAdd(double pChisq)
Definition: RecCgemHit.h:54
void setEntra(double entra)
Definition: RecCgemHit.h:60
void setCgemId(Identifier cgemid)
Definition: RecCgemHit.h:56
void setTdc(double tdc)
Definition: RecCgemHit.h:57
void setId(int id)
Definition: RecCgemHit.h:52
void setZhit(double zhit)
Definition: RecCgemHit.h:61
void setFltLen(double fltLen)
Definition: RecCgemHit.h:62
const Double_t getChisqAdd(void) const
Definition: TRecCgemHit.h:22
const Double_t getEntra(void) const
Definition: TRecCgemHit.h:30
const Double_t getZhit(void) const
Definition: TRecCgemHit.h:31
const Int_t getId(void) const
Definition: TRecCgemHit.h:20
const Int_t getStat(void) const
Definition: TRecCgemHit.h:23
const Double_t getAdc(void) const
Definition: TRecCgemHit.h:28
const Double_t getDoca(void) const
Definition: TRecCgemHit.h:29
const UInt_t getCgemId() const
Definition: TRecCgemHit.h:26
const Double_t getFltLen(void) const
Definition: TRecCgemHit.h:32
const Int_t getTrkId(void) const
Definition: TRecCgemHit.h:21
const Double_t getTdc(void) const
Definition: TRecCgemHit.h:27
static std::map< const TObject *, const RecCgemHit * > m_rootRecCgemHitMap
Definition: commonData.h:250

Friends And Related Function Documentation

◆ CnvFactory< RecCgemHitCnv >

friend class CnvFactory< RecCgemHitCnv >
friend

Definition at line 9 of file RecCgemHitCnv.h.


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