CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
CgemMcHitCnv Class Reference

#include <CgemMcHitCnv.h>

+ Inheritance diagram for CgemMcHitCnv:

Public Member Functions

virtual ~CgemMcHitCnv ()
 
virtual ~CgemMcHitCnv ()
 
virtual ~CgemMcHitCnv ()
 
- 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
 
 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
 
 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
 
destinationoperator (const source &) const
 

Static Public Member Functions

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

Protected Member Functions

 CgemMcHitCnv (ISvcLocator *svc)
 
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
 
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
 
 CgemMcHitCnv (ISvcLocator *svc)
 
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
 
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
 
 CgemMcHitCnv (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
 
virtual destinationconvert (const source &) const =0
 

Friends

class CnvFactory< CgemMcHitCnv >
 

Additional Inherited Members

- Public Types inherited from Converter< Ty1, Ty2 >
typedef Ty1 source
 
typedef Ty2 destination
 
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

Constructor & Destructor Documentation

◆ ~CgemMcHitCnv() [1/3]

virtual CgemMcHitCnv::~CgemMcHitCnv ( )
inlinevirtual

◆ CgemMcHitCnv() [1/3]

CgemMcHitCnv::CgemMcHitCnv ( ISvcLocator *  svc)
protected

Definition at line 25 of file bak_RootCnvSvc-04-01-14/src/Mc/CgemMcHitCnv.cxx.

27{
28 // Here we associate this converter with the /Event path on the TDS.
29 MsgStream log(msgSvc(), "CgemMcHitCnv");
30 //log << MSG::DEBUG << "Constructor called for " << objType() << endreq;
31 m_rootBranchname ="m_cgemMcHitCol";
32 //declareObject(EventModel::MC::CgemMcHitCol, objType(), m_rootTreename, m_rootBranchname);
33 m_adresses.push_back(&m_cgemMcHitCol);
34 m_cgemMcHitCol=0;
35}
std::vector< void * > m_adresses
each converter knows the corresponding adresses
std::string m_rootBranchname
root branchname (may be concatenated of severals)

◆ ~CgemMcHitCnv() [2/3]

virtual CgemMcHitCnv::~CgemMcHitCnv ( )
inlinevirtual

◆ CgemMcHitCnv() [2/3]

CgemMcHitCnv::CgemMcHitCnv ( ISvcLocator *  svc)
protected

◆ ~CgemMcHitCnv() [3/3]

virtual CgemMcHitCnv::~CgemMcHitCnv ( )
inlinevirtual

◆ CgemMcHitCnv() [3/3]

CgemMcHitCnv::CgemMcHitCnv ( ISvcLocator *  svc)
protected

Member Function Documentation

◆ classID() [1/3]

static const CLID & CgemMcHitCnv::classID ( )
inlinestatic

Definition at line 24 of file Event/RootCnvSvc/bak_RootCnvSvc-04-01-14/RootCnvSvc/Mc/CgemMcHitCnv.h.

25 {
26 return CLID_CgemMcHitCol;
27 }
const CLID & CLID_CgemMcHitCol
Definition: EventModel.cxx:249

◆ classID() [2/3]

static const CLID & CgemMcHitCnv::classID ( )
inlinestatic

◆ classID() [3/3]

static const CLID & CgemMcHitCnv::classID ( )
inlinestatic

Definition at line 24 of file InstallArea/include/RootCnvSvc/RootCnvSvc/Mc/CgemMcHitCnv.h.

25 {
26 return CLID_CgemMcHitCol;
27 }

◆ DataObjectToTObject() [1/3]

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

transformation to root

Implements RootEventBaseCnv.

Definition at line 119 of file bak_RootCnvSvc-04-01-14/src/Mc/CgemMcHitCnv.cxx.

119 {
120
121 MsgStream log(msgSvc(), "CgemMcHitCnv");
122 log << MSG::DEBUG << "CgemMcHitCnv::DataObjectToTObject" << endreq;
123 StatusCode sc=StatusCode::SUCCESS;
124
125 CgemMcHitCol * cgemMcHitCnvTds=dynamic_cast<CgemMcHitCol *> (obj);
126 if (!cgemMcHitCnvTds) {
127 log << MSG::ERROR << "Could not downcast to CgemMcHitCol" << endreq;
128 return StatusCode::FAILURE;
129 }
130
131 DataObject *evt;
132 m_eds->findObject(EventModel::MC::Event,evt);
133 if (evt==NULL) {
134 log << MSG::ERROR << "Could not get McEvent in TDS " << endreq;
135 return StatusCode::FAILURE;
136 }
137 McEvent * devtTds=dynamic_cast<McEvent *> (evt);
138 if (!devtTds) {
139 log << MSG::ERROR << "CgemMcHitCnv:Could not downcast to TDS McEvent" << endreq;
140 }
141 IOpaqueAddress *addr;
142
143 m_cnvSvc->getMcCnv()->createRep(evt,addr);
145
146 const TObjArray *m_cgemMcHitCol = McEvt->getCgemMcHitCol();
147 if (!m_cgemMcHitCol) return sc;
148 McEvt->clearCgemMcHitCol(); //necessary in case there is I/O at the same time since array is static
149 CgemMcHitCol::const_iterator cgemMcTds;
150
151 for (cgemMcTds = cgemMcHitCnvTds->begin(); cgemMcTds != cgemMcHitCnvTds->end(); cgemMcTds++)
152 {
153 unsigned int ID_track = (*cgemMcTds)->GetTrackID ();
154 unsigned int ID_layer = (*cgemMcTds)->GetLayerID ();
155 //Add by sunxh
156 unsigned int pdg_code = (*cgemMcTds)->GetPDGCode ();
157 unsigned int ID_parent = (*cgemMcTds)->GetParentID ();
158 //end
159 double E_deposit = (*cgemMcTds)->GetTotalEnergyDeposit ();
160 double XYZ_pre_x = (*cgemMcTds)->GetPositionXOfPrePoint ();
161 double XYZ_pre_y = (*cgemMcTds)->GetPositionYOfPrePoint ();
162 double XYZ_pre_z = (*cgemMcTds)->GetPositionZOfPrePoint ();
163 double XYZ_post_x = (*cgemMcTds)->GetPositionXOfPostPoint ();
164 double XYZ_post_y = (*cgemMcTds)->GetPositionYOfPostPoint ();
165 double XYZ_post_z = (*cgemMcTds)->GetPositionZOfPostPoint ();
166 double P_pre_x = (*cgemMcTds)->GetMomentumXOfPrePoint ();
167 double P_pre_y = (*cgemMcTds)->GetMomentumYOfPrePoint ();
168 double P_pre_z = (*cgemMcTds)->GetMomentumZOfPrePoint ();
169 double P_post_x = (*cgemMcTds)->GetMomentumXOfPostPoint ();
170 double P_post_y = (*cgemMcTds)->GetMomentumYOfPostPoint ();
171 double P_post_z = (*cgemMcTds)->GetMomentumZOfPostPoint ();
172 //Add by sunxh
173 TArrayI ID_Identifier = (*cgemMcTds)->GetIdentifier ();
174 //end
175 string creatorProcess = (*cgemMcTds)->GetCreatorProcess();
176
177 //log << MSG::INFO << "My Message::CgemMcHitCnv::DataObjectToTObject::idMSB="<<idMSB<<" idLSB="<<idLSB<<",trackID="<<trackIndex<<",edep="<<depositEnergy <<" x="<<xPosition<<" y="<<yPosition<<" z="<<zPosition<< endreq;
178
179 TCgemMc *cgemMcRoot = new TCgemMc();
180 //m_common.m_cgemMcHitMap[(*cgemMcTds)] = cgemMcRoot;
181
182 cgemMcRoot->SetTrackID ( ID_track );
183 cgemMcRoot->SetLayerID ( ID_layer );
184 cgemMcRoot->SetPDGCode ( pdg_code );
185 cgemMcRoot->SetParentID ( ID_parent );
186 cgemMcRoot->SetTotalEnergyDeposit ( E_deposit );
187 cgemMcRoot->SetPositionXOfPrePoint ( XYZ_pre_x );
188 cgemMcRoot->SetPositionYOfPrePoint ( XYZ_pre_y );
189 cgemMcRoot->SetPositionZOfPrePoint ( XYZ_pre_z );
190 cgemMcRoot->SetPositionXOfPostPoint ( XYZ_post_x );
191 cgemMcRoot->SetPositionYOfPostPoint ( XYZ_post_y );
192 cgemMcRoot->SetPositionZOfPostPoint ( XYZ_post_z );
193 cgemMcRoot->SetMomentumXOfPrePoint ( P_pre_x );
194 cgemMcRoot->SetMomentumYOfPrePoint ( P_pre_y );
195 cgemMcRoot->SetMomentumZOfPrePoint ( P_pre_z );
196 cgemMcRoot->SetMomentumXOfPostPoint ( P_post_x );
197 cgemMcRoot->SetMomentumYOfPostPoint ( P_post_y );
198 cgemMcRoot->SetMomentumZOfPostPoint ( P_post_z );
199 //Add by sunxh
200 int tmp[2000];
201 for(int j = 0; j < ID_Identifier.GetSize(); j++){
202 tmp[j] = ID_Identifier.GetAt(j);
203 }
204 cgemMcRoot->AddIdentifier(tmp, ID_Identifier.GetSize());
205 //end
206 cgemMcRoot->SetCreatorProcess(creatorProcess);
207 McEvt->addCgemMc(cgemMcRoot);
208 }
209
210 return StatusCode::SUCCESS;
211}
static TMcEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
void AddIdentifier(Int_t f_ID_Identifier[2000], Int_t N_dim)
void addCgemMc(TCgemMc *mcHit)
Cgem.
ObjectVector< CgemMcHit > CgemMcHitCol

◆ DataObjectToTObject() [2/3]

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

transformation to root

Implements RootEventBaseCnv.

◆ DataObjectToTObject() [3/3]

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

transformation to root

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [1/3]

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

transformation from root

Implements RootEventBaseCnv.

Definition at line 37 of file bak_RootCnvSvc-04-01-14/src/Mc/CgemMcHitCnv.cxx.

37 {
38 // creation of TDS object from root object
39
40 MsgStream log(msgSvc(), "CgemMcHitCnv");
41 log << MSG::DEBUG << "CgemMcHitCnv::TObjectToDataObject" << endreq;
42 StatusCode sc=StatusCode::SUCCESS;
43
44 // create the TDS location for the CgemMc Collection
45 CgemMcHitCol* cgemMcTdsCol = new CgemMcHitCol;
46 refpObject=cgemMcTdsCol;
47
48
49 // now convert
50 if (!m_cgemMcHitCol) return sc;
51 TIter cgemMcIter(m_cgemMcHitCol);
52 TCgemMc *cgemMcRoot = 0;
53 while ((cgemMcRoot = (TCgemMc*)cgemMcIter.Next()))
54 {
55 unsigned int ID_track = cgemMcRoot->GetTrackID ();
56 unsigned int ID_layer = cgemMcRoot->GetLayerID ();
57 //Add by sunxh
58 unsigned int pdg_code = cgemMcRoot->GetPDGCode ();
59 unsigned int ID_parent = cgemMcRoot->GetParentID ();
60 //end
61 double E_deposit = cgemMcRoot->GetTotalEnergyDeposit ();
62 double XYZ_pre_x = cgemMcRoot->GetPositionXOfPrePoint ();
63 double XYZ_pre_y = cgemMcRoot->GetPositionYOfPrePoint ();
64 double XYZ_pre_z = cgemMcRoot->GetPositionZOfPrePoint ();
65 double XYZ_post_x = cgemMcRoot->GetPositionXOfPostPoint ();
66 double XYZ_post_y = cgemMcRoot->GetPositionYOfPostPoint ();
67 double XYZ_post_z = cgemMcRoot->GetPositionZOfPostPoint ();
68 double P_pre_x = cgemMcRoot->GetMomentumXOfPrePoint ();
69 double P_pre_y = cgemMcRoot->GetMomentumYOfPrePoint ();
70 double P_pre_z = cgemMcRoot->GetMomentumZOfPrePoint ();
71 double P_post_x = cgemMcRoot->GetMomentumXOfPostPoint ();
72 double P_post_y = cgemMcRoot->GetMomentumYOfPostPoint ();
73 double P_post_z = cgemMcRoot->GetMomentumZOfPostPoint ();
74 //Add by sunxh
75 TArrayI ID_Identifier = cgemMcRoot->GetIdentifier ();
76 //end
77 TString creatorProcess = cgemMcRoot->GetCreatorProcess();
78
79 //log << MSG::INFO << "My Message::CgemMcHitCnv::TObjectToDataObject::idMSB="<<idMSB<<" idLSB="<<idLSB<<",trackID="<<trackIndex<<",edep="<<depositEnergy <<" x="<<xPosition<<" y="<<yPosition<<" z="<<zPosition<< endreq;
80
81 CgemMcHit *cgemMcTds = new CgemMcHit;
82 m_common.m_rootCgemMcHitMap[cgemMcRoot] = cgemMcTds;
83
84 cgemMcTds->SetTrackID ( ID_track );
85 cgemMcTds->SetLayerID ( ID_layer );
86 //Add by sunxh
87 cgemMcTds->SetPDGCode ( pdg_code );
88 cgemMcTds->SetParentID ( ID_parent );
89 //end
90 cgemMcTds->SetTotalEnergyDeposit ( E_deposit );
91 cgemMcTds->SetPositionXOfPrePoint ( XYZ_pre_x );
92 cgemMcTds->SetPositionYOfPrePoint ( XYZ_pre_y );
93 cgemMcTds->SetPositionZOfPrePoint ( XYZ_pre_z );
94 cgemMcTds->SetPositionXOfPostPoint ( XYZ_post_x );
95 cgemMcTds->SetPositionYOfPostPoint ( XYZ_post_y );
96 cgemMcTds->SetPositionZOfPostPoint ( XYZ_post_z );
97 cgemMcTds->SetMomentumXOfPrePoint ( P_pre_x );
98 cgemMcTds->SetMomentumYOfPrePoint ( P_pre_y );
99 cgemMcTds->SetMomentumZOfPrePoint ( P_pre_z );
100 cgemMcTds->SetMomentumXOfPostPoint ( P_post_x );
101 cgemMcTds->SetMomentumYOfPostPoint ( P_post_y );
102 cgemMcTds->SetMomentumZOfPostPoint ( P_post_z );
103 cgemMcTds->SetCreatorProcess ( creatorProcess.Data());
104 //Add by sunxh
105 int tmp[2000];
106 for(int j = 0; j < ID_Identifier.GetSize(); j++){
107 tmp[j] = ID_Identifier.GetAt(j);
108 }
109 cgemMcTds->AddIdentifier(tmp, ID_Identifier.GetSize());
110 //end
111 cgemMcTdsCol->push_back(cgemMcTds);
112 }
113 //m_cgemMcHitCol->Delete(); // wensp add 2005/12/30
114 delete m_cgemMcHitCol;
115 m_cgemMcHitCol = 0;
116 return StatusCode::SUCCESS;
117}
static std::map< const TObject *, const CgemMcHit * > m_rootCgemMcHitMap

◆ TObjectToDataObject() [2/3]

virtual StatusCode CgemMcHitCnv::TObjectToDataObject ( DataObject *&  obj)
protectedvirtual

transformation from root

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [3/3]

virtual StatusCode CgemMcHitCnv::TObjectToDataObject ( DataObject *&  obj)
protectedvirtual

transformation from root

Implements RootEventBaseCnv.

Friends And Related Function Documentation

◆ CnvFactory< CgemMcHitCnv >


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