#include <ExtTrackCnv.h>
Inheritance diagram for ExtTrackCnv:
Public Types | |
typedef Ty2 | destination |
typedef Ty2 | destination |
typedef Ty1 | source |
typedef Ty1 | source |
Public Member Functions | |
virtual StatusCode | createObj (IOpaqueAddress *addr, DataObject *&dat) |
Convert the persistent object to transient. | |
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 | createRep (DataObject *pObject, IOpaqueAddress *&refpAddress) |
Convert the transient object to the requested representation. | |
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. | |
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 | fillObjRefs (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 | fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject) |
Resolve the references of the converted object. | |
virtual StatusCode | fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject) |
Resolve the references of the converted object. | |
virtual StatusCode | finalize () |
virtual StatusCode | finalize () |
TObject * | getReadObject () const |
get the object to be read | |
TObject * | getReadObject () const |
get the object to be read | |
virtual StatusCode | initialize () |
virtual StatusCode | initialize () |
destination * | operator (const source &) const |
destination * | operator (const source &) const |
virtual long | repSvcType () const |
virtual long | repSvcType () const |
virtual | ~ExtTrackCnv () |
virtual | ~ExtTrackCnv () |
Static Public Member Functions | |
const CLID & | classID () |
const CLID & | classID () |
const unsigned char | storageType () |
Storage type and class ID. | |
const unsigned char | storageType () |
Storage type and class ID. | |
Protected Member Functions | |
virtual destination * | convert (const source &) const =0 |
virtual destination * | convert (const source &) const =0 |
virtual StatusCode | DataObjectToTObject (DataObject *obj, RootAddress *addr) |
transformation to root | |
virtual StatusCode | DataObjectToTObject (DataObject *obj, RootAddress *addr) |
transformation to root | |
ExtTrackCnv (ISvcLocator *svc) | |
ExtTrackCnv (ISvcLocator *svc) | |
virtual StatusCode | TObjectToDataObject (DataObject *&obj) |
transformation from root | |
virtual StatusCode | TObjectToDataObject (DataObject *&obj) |
transformation from root | |
Protected Attributes | |
CLID | CLID_top |
the CLID of the upper converter if any | |
std::vector< void * > | m_adresses |
each converter knows the corresponding adresses | |
std::vector< void * > | m_adresses |
each converter knows the corresponding adresses | |
int | m_branchNr |
the branchNr of this converter for writing | |
int | m_branchNrDst |
int | m_branchNrEvtHeader |
int | m_branchNrEvtRec |
int | m_branchNrMc |
int | m_branchNrRecon |
TArrayS * | m_branchNumbers |
array with number of branches for reading | |
TArrayS * | m_branchNumbers |
array with number of branches for reading | |
RootCnvSvc * | m_cnvSvc |
RootCnvSvc * | m_cnvSvc |
std::string | m_currentFileName |
IDataProviderSvc * | m_eds |
pointer to eventdataservice | |
IDataProviderSvc * | m_eds |
pointer to eventdataservice | |
RootEvtSelector * | m_evtsel |
RootEvtSelector * | m_evtsel |
std::vector< RootCnvSvc::Leaf > | m_leaves |
std::vector< RootCnvSvc::Leaf > | m_leaves |
TObject * | m_objRead |
the object that was read | |
TObject * | m_objRead |
the object that was read | |
std::string | m_rootBranchname |
root branchname (may be concatenated of severals) | |
RootInterface * | m_rootInterface |
pointer to the RootInterface | |
RootInterface * | m_rootInterface |
pointer to the RootInterface | |
std::string | m_rootTreename |
each converter knows it's treename | |
Private Attributes | |
commonData | m_common |
relational maps | |
TObjArray * | m_extTrackCol |
root object to be read | |
TObjArray * | m_extTrackCol |
root object to be read | |
Friends | |
class | CnvFactory<ExtTrackCnv> |
|
|
|
|
|
|
|
|
|
00025 { };
|
|
00039 : RootEventBaseCnv(classID(), svc) 00040 { 00041 // Here we associate this converter with the /Event path on the TDS. 00042 MsgStream log(msgSvc(), "ExtTrackCnv"); 00043 // log << MSG::DEBUG << "Constructor called for " << objType() << endreq; 00044 m_rootBranchname ="m_extTrackCol"; 00045 //declareObject(EventModel::Dst::DstExtTrackCol, objType(), m_rootTreename, m_rootBranchname); 00046 m_adresses.push_back(&m_extTrackCol); 00047 m_extTrackCol=0; 00048 }
|
|
00025 { };
|
|
|
|
00021 {
00022 return CLID_DstExtTrackCol;
00023 }
|
|
00021 {
00022 return CLID_DstExtTrackCol;
00023 }
|
|
|
|
|
|
Convert the persistent object to transient.
|
|
Convert the persistent object to transient.
Reimplemented in EventCnv, and EventCnv. 00157 { 00158 // transform ROOT object to TDS object 00159 MsgStream log(msgSvc(), "RootEventBaseCnv"); 00160 log << MSG::DEBUG << "RootEventBaseCnv::createObj with clid " <<addr->clID()<< endreq; 00161 StatusCode sc; 00162 00163 // add 2005-11-29 00164 // log<<MSG::INFO<<"######### RootEventBaseCnv ::createObj begin of createObj: m_branchNumbers "<<m_branchNumbers->GetSize()<<"###############"<<endreq; 00165 00166 RootAddress *raddr=dynamic_cast<RootAddress *>(addr); 00167 if (!raddr) { 00168 log << MSG::ERROR << "Could not downcast to Root address" << endreq; 00169 return StatusCode::FAILURE; 00170 } 00171 00172 static int temp =0; //control the begin of each files 2005-12-01 00173 static int entryN =0; //control the event number of each files 2005-21-01 00174 static int brN =0; //control munber of branch of the tree; 00175 int lastBrn = brN; 00176 //lastBrn = brN; 00177 static int branchN=0; 00178 static bool isSet=true; 00179 00180 static int entryBefore = 0; 00181 static bool addEntryEachFile = true; 00182 00183 00184 if(m_rootInterface->getENDFILE() || (temp >0 && temp < branchN)){ // if the file has get the end:y the go to next file to create a new tree 00185 00186 if(m_rootInterface->getENDFILE() ) { 00187 entryN = 0; 00188 } 00189 00190 temp++; 00191 00192 delete m_branchNumbers; 00193 m_branchNumbers = new TArrayS(0); 00194 00195 if(temp == branchN) { 00196 temp =0; 00197 } 00198 } 00199 00200 if(m_rootInterface->getENDFILE()) addEntryEachFile = true; 00201 // the 2nd method 00202 if(m_evtsel->getRecId() - entryBefore == 0) { // first event in this file 00203 delete m_branchNumbers; 00204 m_branchNumbers = new TArrayS(0); 00205 } 00206 00207 //new method to initialize the branchNumber 00208 if(m_currentFileName=="") m_currentFileName = m_rootInterface->getCurrentFileName(); 00209 if(!(m_currentFileName == m_rootInterface->getCurrentFileName())){ 00210 m_currentFileName = m_rootInterface->getCurrentFileName(); 00211 delete m_branchNumbers; 00212 m_branchNumbers = new TArrayS(0); 00213 } 00214 //---------------------------------------- 00215 00216 00217 if (m_branchNumbers->GetSize()<=0) { 00218 if(isSet) brN++; 00219 int branchNumber; 00220 for (int nb=0;nb<raddr->getNrBranches();nb++) { 00221 sc=m_rootInterface->setBranchAddress(raddr->getTreename().c_str(),raddr->getBranchname(nb).c_str(),m_adresses[nb],branchNumber); 00222 if (!sc.isSuccess()) 00223 { 00224 if(isSet) brN--; //liangyt: if fail to retrieve this branch, this will be not a effective branch. 00225 //entryN++; //liangyt: this is the second method 00226 if(temp>0) temp--; //temp > 0 means recording effective branch number. 00227 return sc; 00228 } 00229 m_branchNumbers->Set(nb+1); 00230 m_branchNumbers->AddAt(branchNumber,nb); 00231 00232 } 00233 } 00234 00236 if(addEntryEachFile&&(m_evtsel->getRecId()>entryBefore)){ // for a new file, add entry for ONLY one time. 00237 entryBefore += m_rootInterface->getEntries(); 00238 addEntryEachFile = false; 00239 } 00240 00241 if(lastBrn == brN && isSet ){ 00242 branchN = brN; 00243 isSet=false; 00244 } 00245 00246 if(isSet==false) log << MSG::INFO <<" 1st method set event as : "<<int(entryN/branchN)<<endreq; 00247 if(isSet==false) raddr->setEntryNr(int(entryN/branchN));//former method, keep it to be backup. 00248 if(m_evtsel) log << MSG::INFO <<" event id = "<<m_evtsel->getRecId()<<endreq; 00249 00250 int eventID = 0; 00251 if(entryBefore > m_evtsel->getRecId()) 00252 eventID = m_evtsel->getRecId() + m_rootInterface->getEntries() - entryBefore; 00253 else if(entryBefore == m_evtsel->getRecId()) eventID = 0; 00254 else log << MSG::ERROR <<"eventId error!!!"<<endreq; 00255 00256 log << MSG::INFO <<" 2nd method set event as : "<<eventID<<endreq; 00257 if(m_evtsel) raddr->setEntryNr(eventID); 00258 // read branch 00259 00260 if (m_branchNumbers->GetSize()>0) { 00261 int nbtot=0,nb; 00262 for (int ib=0;ib<m_branchNumbers->GetSize();ib++) { 00263 //sc=m_rootInterface->getBranchEntry(m_branchNumbers->At(ib),raddr->getEntryNr(),nb); 00264 //change to get branch entry with addr(set address for each entry) liangyt 00265 sc=m_rootInterface->getBranchEntry(m_branchNumbers->At(ib),raddr->getEntryNr(),m_adresses[ib],nb); 00266 if (sc.isFailure()) { 00267 log << MSG::ERROR << "Could not read branch " << raddr->getBranchname(nb) << endreq; 00268 return sc; 00269 } 00270 nbtot+=nb; 00271 } 00272 } 00273 00274 else { // get ROOT object 00275 if (CLID_top) { 00276 IConverter *p=conversionSvc()->converter(CLID_top); 00277 RootEventBaseCnv *cnv=dynamic_cast<RootEventBaseCnv *>(p); 00278 if (!cnv) { 00279 log << MSG::ERROR << "Could not downcast to RootEventBaseCnv " << endreq; 00280 return StatusCode::FAILURE; 00281 } 00282 m_objRead=cnv->getReadObject(); 00283 } 00284 } 00285 00286 //do concrete transformation in derived converter 00287 sc = TObjectToDataObject(refpObject); 00288 if (sc.isFailure()) { 00289 log << MSG::ERROR << "Could not transform object" << endreq; 00290 return sc; 00291 } 00292 00293 // verify if we have to register 00294 IRegistry* ent = addr->registry(); 00295 if ( ent == 0) { 00296 sc=m_eds->registerObject(raddr->getPath(),refpObject); 00297 if (sc.isFailure()) { 00298 log << MSG::ERROR << "Could not register object " << raddr->getPath()<<" status "<<sc.getCode()<<endreq; 00299 } 00300 // } 00301 } 00302 00303 entryN++; 00304 return StatusCode::SUCCESS; 00305 }
|
|
Convert the transient object to the requested representation.
|
|
Convert the transient object to the requested representation.
00078 { 00079 // Purpose and Method: Convert the transient object to ROOT 00080 00081 MsgStream log(msgSvc(), "RootEventBaseCnv"); 00082 00083 StatusCode sc= StatusCode::SUCCESS; 00084 // get the corresponding address 00085 RootAddress *rootaddr; 00086 sc=m_cnvSvc->createAddress(obj,addr); 00087 00088 rootaddr = dynamic_cast<RootAddress *>(addr); 00089 00090 if (sc.isFailure() || !rootaddr ) { 00091 log << MSG::ERROR << "Could not create address for clid " <<obj->clID()<<", objname "<<obj->name()<<endreq; 00092 return StatusCode::FAILURE; 00093 } 00094 00095 // do the real conversion in the derived converter 00096 sc = DataObjectToTObject(obj,rootaddr); 00097 00098 delete addr; 00099 addr = NULL; 00100 00101 if (sc.isFailure()) { 00102 log << MSG::ERROR << "Could not transform object" << endreq; 00103 return sc; 00104 } 00105 00106 return StatusCode::SUCCESS; 00107 }
|
|
transformation to root
Implements RootEventBaseCnv. |
|
transformation to root
Implements RootEventBaseCnv. 00218 { 00219 00220 MsgStream log(msgSvc(), "ExtTrackCnv"); 00221 log << MSG::DEBUG << "ExtTrackCnv::DataObjectToTObject" << endreq; 00222 StatusCode sc=StatusCode::SUCCESS; 00223 00224 DstExtTrackCol * extTrackColTds=dynamic_cast<DstExtTrackCol *> (obj); 00225 if (!extTrackColTds) { 00226 log << MSG::ERROR << "Could not downcast to DstExtTrackCol" << endreq; 00227 return StatusCode::FAILURE; 00228 } 00229 00230 DataObject *evt; 00231 m_eds->findObject(EventModel::Dst::Event,evt); 00232 if (evt==NULL) { 00233 log << MSG::ERROR << "Could not get ReconEvent in TDS " << endreq; 00234 return StatusCode::FAILURE; 00235 } 00236 00237 DstEvent * devtTds=dynamic_cast<DstEvent *> (evt); 00238 if (!devtTds) { 00239 log << MSG::ERROR << "ExtTrackCnv:Could not downcast to TDS Dst Event" << endreq; 00240 } 00241 IOpaqueAddress *addr; 00242 00243 m_cnvSvc->getDstCnv()->createRep(evt,addr); 00244 TDstEvent *recEvt=m_cnvSvc->getDstCnv()->getWriteObject(); 00245 00246 const TObjArray *m_extTrackCol = recEvt->getExtTrackCol(); 00247 00248 if (!m_extTrackCol) return sc; 00249 00250 recEvt->clearExtTrackCol(); //necessary in case there is I/O at the same time since array is static 00251 DstExtTrackCol::const_iterator extTrackTds; 00252 00253 for (extTrackTds = extTrackColTds->begin(); extTrackTds != extTrackColTds->end(); extTrackTds++) { 00254 //Get Data from TDS 00255 Int_t trackId = (*extTrackTds)->GetTrackId(); 00256 //Tof layer1 00257 Double_t p1x = (*extTrackTds)->tof1Position().x(); 00258 Double_t p1y = (*extTrackTds)->tof1Position().y(); 00259 Double_t p1z = (*extTrackTds)->tof1Position().z(); 00260 Double_t m1x = (*extTrackTds)->tof1Momentum().x(); 00261 Double_t m1y = (*extTrackTds)->tof1Momentum().y(); 00262 Double_t m1z = (*extTrackTds)->tof1Momentum().z(); 00263 00264 TString v1s = (*extTrackTds)->tof1VolumeName() ; 00265 Int_t v1n = (*extTrackTds)->tof1VolumeNumber() ; 00266 Double_t tof1= (*extTrackTds)->tof1(); 00267 Double_t tof1p = (*extTrackTds)->tof1Path(); 00268 Double_t z1 = (*extTrackTds)->tof1PosSigmaAlongZ(); 00269 Double_t t1 = (*extTrackTds)->tof1PosSigmaAlongT(); 00270 Double_t x1 = (*extTrackTds)->tof1PosSigmaAlongX(); 00271 Double_t y1 = (*extTrackTds)->tof1PosSigmaAlongY(); 00272 Double_t e1m[6][6]; 00273 HepSymMatrix e1mTds = (*extTrackTds)->tof1ErrorMatrix(); 00274 for (int i = 0;i<6 ;i++ ) 00275 for (int j= 0;j<6 ;j++ ) 00276 e1m[i][j] = e1mTds[i][j]; 00277 00278 //Tof llayer2 00279 Double_t p2x = (*extTrackTds)->tof2Position().x(); 00280 Double_t p2y = (*extTrackTds)->tof2Position().y(); 00281 Double_t p2z = (*extTrackTds)->tof2Position().z(); 00282 Double_t m2x = (*extTrackTds)->tof2Momentum().x(); 00283 Double_t m2y = (*extTrackTds)->tof2Momentum().y(); 00284 Double_t m2z = (*extTrackTds)->tof2Momentum().z(); 00285 00286 TString v2s = (*extTrackTds)->tof2VolumeName() ; 00287 Int_t v2n = (*extTrackTds)->tof2VolumeNumber() ; 00288 Double_t tof2= (*extTrackTds)->tof2(); 00289 Double_t tof2p = (*extTrackTds)->tof2Path(); 00290 Double_t z2 = (*extTrackTds)->tof2PosSigmaAlongZ(); 00291 Double_t t2 = (*extTrackTds)->tof2PosSigmaAlongT(); 00292 Double_t x2 = (*extTrackTds)->tof2PosSigmaAlongX(); 00293 Double_t y2 = (*extTrackTds)->tof2PosSigmaAlongY(); 00294 Double_t e2m[6][6]; 00295 HepSymMatrix e2mTds = (*extTrackTds)->tof2ErrorMatrix(); 00296 for (int i = 0;i<6 ;i++ ) 00297 for (int j= 0;j<6 ;j++ ) 00298 e2m[i][j] = e2mTds[i][j]; 00299 //Emc 00300 Double_t pEx = (*extTrackTds)->emcPosition().x(); 00301 Double_t pEy = (*extTrackTds)->emcPosition().y(); 00302 Double_t pEz = (*extTrackTds)->emcPosition().z(); 00303 Double_t mEx = (*extTrackTds)->emcMomentum().x(); 00304 Double_t mEy = (*extTrackTds)->emcMomentum().y(); 00305 Double_t mEz = (*extTrackTds)->emcMomentum().z(); 00306 00307 TString vEs = (*extTrackTds)->emcVolumeName() ; 00308 Int_t vEn = (*extTrackTds)->emcVolumeNumber() ; 00309 00310 Double_t theta = (*extTrackTds)->emcPosSigmaAlongTheta(); 00311 Double_t phi = (*extTrackTds)->emcPosSigmaAlongPhi(); 00312 00313 Double_t eEm[6][6]; 00314 HepSymMatrix eEmTds = (*extTrackTds)->emcErrorMatrix(); 00315 for (int i = 0;i<6 ;i++ ) 00316 for (int j= 0;j<6 ;j++ ) 00317 eEm[i][j] = eEmTds[i][j]; 00318 Double_t emcPath=(*extTrackTds)->emcPath(); 00319 00320 //Muc 00321 Double_t pMx = (*extTrackTds)->mucPosition().x(); 00322 Double_t pMy = (*extTrackTds)->mucPosition().y(); 00323 Double_t pMz = (*extTrackTds)->mucPosition().z(); 00324 Double_t mMx = (*extTrackTds)->mucMomentum().x(); 00325 Double_t mMy = (*extTrackTds)->mucMomentum().y(); 00326 Double_t mMz = (*extTrackTds)->mucMomentum().z(); 00327 00328 TString vMs = (*extTrackTds)->mucVolumeName() ; 00329 Int_t vMn = (*extTrackTds)->mucVolumeNumber() ; 00330 00331 Double_t zM = (*extTrackTds)->mucPosSigmaAlongZ(); 00332 Double_t tM = (*extTrackTds)->mucPosSigmaAlongT(); 00333 Double_t xM = (*extTrackTds)->mucPosSigmaAlongX(); 00334 Double_t yM = (*extTrackTds)->mucPosSigmaAlongY(); 00335 00336 Double_t eMm[6][6]; 00337 HepSymMatrix eMmTds = (*extTrackTds)->mucErrorMatrix(); 00338 for (int i = 0;i<6 ;i++ ) 00339 for (int j= 0;j<6 ;j++ ) 00340 eMm[i][j]= eMmTds[i][j]; 00341 00342 //ExtMucHitVec 00343 /*ExtMucHitVec vecHit = (*extTrackTds)->GetExtMucHitVec(); 00344 Int_t size = vecHit.size();*/ 00345 00346 TExtTrack *extTrackRoot = new TExtTrack(); 00347 //m_common.m_extTrackMap[(*extTrackTds)] = extTrackRoot; 00348 00349 //Set to Root 00350 00351 //ExtMucHitVec 00352 /*extTrackRoot->SetSize(size); 00353 for(int i=0;i<size;i++){ 00354 Double_t px = vecHit[i].GetPosition().x(); 00355 Double_t py = vecHit[i].GetPosition().y(); 00356 Double_t pz = vecHit[i].GetPosition().z(); 00357 Double_t mx = vecHit[i].GetMomentum().x(); 00358 Double_t my = vecHit[i].GetMomentum().y(); 00359 Double_t mz = vecHit[i].GetMomentum().z(); 00360 TString vs = vecHit[i].GetVolumeName(); 00361 Int_t vn = vecHit[i].GetVolumeNumber(); 00362 Double_t z = vecHit[i].GetPosSigmaAlongZ(); 00363 Double_t t = vecHit[i].GetPosSigmaAlongT(); 00364 Double_t x = vecHit[i].GetPosSigmaAlongX(); 00365 Double_t y = vecHit[i].GetPosSigmaAlongY(); 00366 Double_t m[6][6]; 00367 HepSymMatrix mTds = vecHit[i].GetErrorMatrix(); 00368 for (int j = 0;j<6;j++) 00369 for(int k=0;k<6;k++) 00370 m[i][j] = mTds[i][j]; 00371 extTrackRoot->SetExtMucHit(px,py,pz,mx,my,mz,vs,vn,z,t,y,x,m); 00372 }*/ 00373 00374 //Set to Root 00375 extTrackRoot->SetTrackId(trackId); 00376 //Tof layer1 00377 extTrackRoot->SetTof1PositionX(p1x); 00378 extTrackRoot->SetTof1PositionY(p1y); 00379 extTrackRoot->SetTof1PositionZ(p1z); 00380 extTrackRoot->SetTof1MomentumX(m1x); 00381 extTrackRoot->SetTof1MomentumY(m1y); 00382 extTrackRoot->SetTof1MomentumZ(m1z); 00383 00384 extTrackRoot->SetTof1VolumeName(v1s); 00385 extTrackRoot->SetTof1VolumeNumber(v1n); 00386 00387 extTrackRoot->SetTof1(tof1); 00388 extTrackRoot->SetTof1Path(tof1p); 00389 00390 extTrackRoot->SetTof1PosSigmaAlongZ(z1); 00391 extTrackRoot->SetTof1PosSigmaAlongT(t1); 00392 extTrackRoot->SetTof1PosSigmaAlongX(x1); 00393 extTrackRoot->SetTof1PosSigmaAlongY(y1); 00394 00395 extTrackRoot->SetTof1ErrorMatrix(e1m); 00396 //Tof layer2 00397 extTrackRoot->SetTof2PositionX(p2x); 00398 extTrackRoot->SetTof2PositionY(p2y); 00399 extTrackRoot->SetTof2PositionZ(p2z); 00400 extTrackRoot->SetTof2MomentumX(m2x); 00401 extTrackRoot->SetTof2MomentumY(m2y); 00402 extTrackRoot->SetTof2MomentumZ(m2z); 00403 00404 extTrackRoot->SetTof2VolumeName(v2s); 00405 extTrackRoot->SetTof2VolumeNumber(v2n); 00406 00407 extTrackRoot->SetTof2(tof2); 00408 extTrackRoot->SetTof2Path(tof2p); 00409 00410 extTrackRoot->SetTof2PosSigmaAlongZ(z2); 00411 extTrackRoot->SetTof2PosSigmaAlongT(t2); 00412 extTrackRoot->SetTof2PosSigmaAlongX(x2); 00413 extTrackRoot->SetTof2PosSigmaAlongY(y2); 00414 00415 extTrackRoot->SetTof2ErrorMatrix(e2m); 00416 //Emc 00417 extTrackRoot->SetEmcPositionX(pEx); 00418 extTrackRoot->SetEmcPositionY(pEy); 00419 extTrackRoot->SetEmcPositionZ(pEz); 00420 extTrackRoot->SetEmcMomentumX(mEx); 00421 extTrackRoot->SetEmcMomentumY(mEy); 00422 extTrackRoot->SetEmcMomentumZ(mEz); 00423 00424 extTrackRoot->SetEmcVolumeName(vEs); 00425 extTrackRoot->SetEmcVolumeNumber(vEn); 00426 00427 extTrackRoot->SetEmcPosSigmaAlongTheta(theta); 00428 extTrackRoot->SetEmcPosSigmaAlongPhi(phi); 00429 00430 extTrackRoot->SetEmcErrorMatrix(eEm); 00431 extTrackRoot->SetEmcPath(emcPath); 00432 //Muc 00433 extTrackRoot->SetMucPositionX(pMx); 00434 extTrackRoot->SetMucPositionY(pMy); 00435 extTrackRoot->SetMucPositionZ(pMz); 00436 extTrackRoot->SetMucMomentumX(mMx); 00437 extTrackRoot->SetMucMomentumY(mMy); 00438 extTrackRoot->SetMucMomentumZ(mMz); 00439 00440 extTrackRoot->SetMucVolumeName(vMs); 00441 extTrackRoot->SetMucVolumeNumber(vMn); 00442 00443 extTrackRoot->SetMucPosSigmaAlongZ(zM); 00444 extTrackRoot->SetMucPosSigmaAlongT(tM); 00445 extTrackRoot->SetMucPosSigmaAlongX(xM); 00446 extTrackRoot->SetMucPosSigmaAlongY(yM); 00447 00448 extTrackRoot->SetMucErrorMatrix(eMm); 00449 00450 recEvt->addExtTrack(extTrackRoot); 00451 } 00452 00453 return StatusCode::SUCCESS; 00454 } 00455 #endif
|
|
Store TDS path to link a particular converter to an object on the TDS.
|
|
Store TDS path to link a particular converter to an object on the TDS.
00150 { 00151 // Purpose and Method: Save the path on the TDS, treename, pathname in the m_leaves vector, 00152 // corresponding to the DataObject that the converter handles. 00153 m_leaves.push_back(RootCnvSvc::Leaf(path, cl,treename,branchname)); 00154 }
|
|
Resolve the references of the converted object.
|
|
Resolve the references of the converted object.
00117 { 00118 // Purpose and Method: Resolve the references of the converted object. 00119 // It is expected that derived classes will override this method. 00120 MsgStream log(msgSvc(), "RootEventBaseCnv"); 00121 return StatusCode::SUCCESS; 00122 }
|
|
Resolve the references of the converted object.
|
|
Resolve the references of the converted object.
00109 { 00110 // Purpose and Method: Resolve the references of the converted object. 00111 // It is expected that derived classes will override this method. 00112 MsgStream log(msgSvc(), "RootEventBaseCnv"); 00113 return StatusCode::SUCCESS; 00114 }
|
|
|
|
00141 { 00142 if ( m_cnvSvc ) { 00143 m_cnvSvc->release(); 00144 m_cnvSvc=0; 00145 } 00146 return Converter::finalize(); 00147 }
|
|
get the object to be read
00124 { return m_objRead;}
|
|
get the object to be read
00124 { return m_objRead;}
|
|
Reimplemented in DigiCnv, DstCnv, EvtHeaderCnv, EvtRecCnv, HltCnv, McCnv, RecTrackCnv, TrigCnv, DigiCnv, DstCnv, EvtHeaderCnv, EvtRecCnv, HltCnv, McCnv, RecTrackCnv, and TrigCnv. |
|
Reimplemented in DigiCnv, DstCnv, EvtHeaderCnv, EvtRecCnv, HltCnv, McCnv, RecTrackCnv, TrigCnv, DigiCnv, DstCnv, EvtHeaderCnv, EvtRecCnv, HltCnv, McCnv, RecTrackCnv, and TrigCnv. 00125 { 00126 00127 StatusCode status = Converter::initialize(); 00128 00129 if ( status.isSuccess() ) { 00130 IService* isvc = 0; 00131 status = serviceLocator()->service("RootCnvSvc", isvc, false); 00132 if ( !status.isSuccess() ) status = serviceLocator()->service("EventCnvSvc", isvc, true); 00133 if ( status.isSuccess() ) { 00134 status = isvc->queryInterface(IID_IRootCnvSvc, (void**)&m_cnvSvc); 00135 } 00136 } 00137 00138 return status; 00139 }
|
|
|
|
|
|
00087 {
00088 return ROOT_StorageType;
00089 }
|
|
00087 {
00088 return ROOT_StorageType;
00089 }
|
|
Storage type and class ID.
00083 {
00084 return ROOT_StorageType;
00085 }
|
|
Storage type and class ID.
00083 {
00084 return ROOT_StorageType;
00085 }
|
|
transformation from root
Implements RootEventBaseCnv. |
|
transformation from root
Implements RootEventBaseCnv. 00050 { 00051 // creation of TDS object from root object 00052 00053 MsgStream log(msgSvc(), "ExtTrackCnv"); 00054 log << MSG::DEBUG << "ExtTrackCnv::TObjectToDataObject" << endreq; 00055 StatusCode sc=StatusCode::SUCCESS; 00056 00057 // create the TDS location for the ExtTrack Collection 00058 DstExtTrackCol* extTrackTdsCol = new DstExtTrackCol; 00059 refpObject=extTrackTdsCol; 00060 00061 00062 // now convert 00063 if (!m_extTrackCol) return sc; 00064 TIter extTrackIter(m_extTrackCol); 00065 TExtTrack *extTrackRoot = 0; 00066 while ((extTrackRoot = (TExtTrack*)extTrackIter.Next())) { 00067 00068 int trackId = extTrackRoot->GetTrackId(); 00069 //Tof layer1: 00070 double p1x = extTrackRoot->GetTof1PositionX(); 00071 double p1y = extTrackRoot->GetTof1PositionY(); 00072 double p1z = extTrackRoot->GetTof1PositionZ(); 00073 double m1x = extTrackRoot->GetTof1MomentumX(); 00074 double m1y = extTrackRoot->GetTof1MomentumY(); 00075 double m1z = extTrackRoot->GetTof1MomentumZ(); 00076 Hep3Vector tof1p(p1x,p1y,p1z); 00077 Hep3Vector tof1m(m1x,m1y,m1z); 00078 00079 // char * pTof1 = extTrackRoot->GetTof1VolumeName().Data(); 00080 string v1s = extTrackRoot->GetTof1VolumeName().Data(); 00081 int v1n = extTrackRoot->GetTof1VolumeNumber() ; 00082 double tof1= extTrackRoot->GetTof1(); 00083 double tof1path= extTrackRoot->GetTof1Path(); 00084 double z1 = extTrackRoot->GetTof1PosSigmaAlongZ(); 00085 double t1 = extTrackRoot->GetTof1PosSigmaAlongT(); 00086 double x1 = extTrackRoot->GetTof1PosSigmaAlongX(); 00087 double y1 = extTrackRoot->GetTof1PosSigmaAlongY(); 00088 HepSymMatrix e1m(6) ; 00089 for (int i = 0;i<6 ;i++ ) 00090 for (int j= 0;j<6 ;j++ ) 00091 e1m[i][j]= extTrackRoot->GetTof1ErrorMatrix(i , j) ; 00092 00093 //Tof layer2: 00094 double p2x = extTrackRoot->GetTof2PositionX() ; 00095 double p2y = extTrackRoot->GetTof2PositionY() ; 00096 double p2z = extTrackRoot->GetTof2PositionZ() ; 00097 double m2x = extTrackRoot->GetTof2MomentumX() ; 00098 double m2y = extTrackRoot->GetTof2MomentumY() ; 00099 double m2z = extTrackRoot->GetTof2MomentumZ(); 00100 Hep3Vector tof2p(p2x,p2y,p2z); 00101 Hep3Vector tof2m(m2x,m2y,m2z); 00102 00103 string v2s = extTrackRoot->GetTof2VolumeName().Data(); 00104 int v2n = extTrackRoot->GetTof2VolumeNumber() ; 00105 double tof2= extTrackRoot->GetTof2(); 00106 double tof2path = extTrackRoot->GetTof2Path(); 00107 double z2 = extTrackRoot->GetTof2PosSigmaAlongZ() ; 00108 double t2 = extTrackRoot->GetTof2PosSigmaAlongT(); 00109 double x2 = extTrackRoot->GetTof2PosSigmaAlongX(); 00110 double y2 = extTrackRoot->GetTof2PosSigmaAlongY(); 00111 HepSymMatrix e2m(6) ; 00112 for (int i = 0;i<6 ;i++ ) 00113 for (int j= 0;j<6 ;j++ ) 00114 e2m[i][j]= extTrackRoot->GetTof2ErrorMatrix(i,j) ; 00115 00116 //Emc 00117 double pEx = extTrackRoot->GetEmcPositionX(); 00118 double pEy = extTrackRoot->GetEmcPositionY(); 00119 double pEz = extTrackRoot->GetEmcPositionZ(); 00120 double mEx = extTrackRoot->GetEmcMomentumX(); 00121 double mEy = extTrackRoot->GetEmcMomentumY(); 00122 double mEz = extTrackRoot->GetEmcMomentumZ(); 00123 Hep3Vector Ep(pEx,pEy,pEz); 00124 Hep3Vector Em(mEx,mEy,mEz); 00125 00126 string vEs = extTrackRoot->GetEmcVolumeName().Data(); 00127 int vEn = extTrackRoot->GetEmcVolumeNumber(); 00128 double theta = extTrackRoot->GetEmcPosSigmaAlongTheta(); 00129 double phi = extTrackRoot->GetEmcPosSigmaAlongPhi(); 00130 HepSymMatrix eEm(6) ; 00131 for(int i=0;i<6 ;i++ ) 00132 for(int j= 0;j<6 ;j++ ) 00133 eEm[i][j]= extTrackRoot->GetEmcErrorMatrix(i,j); 00134 double emcPath=extTrackRoot->emcPath(); 00135 00136 //Muc 00137 double pMx = extTrackRoot->GetMucPositionX() ; 00138 double pMy = extTrackRoot->GetMucPositionY() ; 00139 double pMz = extTrackRoot->GetMucPositionZ() ; 00140 double mMx = extTrackRoot->GetMucMomentumX() ; 00141 double mMy = extTrackRoot->GetMucMomentumY() ; 00142 double mMz = extTrackRoot->GetMucMomentumZ(); 00143 Hep3Vector Mp(pMx,pMy,pMz); 00144 Hep3Vector Mm(mMx,mMy,mMz); 00145 00146 string vMs = extTrackRoot->GetMucVolumeName().Data(); 00147 int vMn = extTrackRoot->GetMucVolumeNumber() ; 00148 00149 double zM = extTrackRoot->GetMucPosSigmaAlongZ() ; 00150 double tM = extTrackRoot->GetMucPosSigmaAlongT(); 00151 double xM = extTrackRoot->GetMucPosSigmaAlongX(); 00152 double yM = extTrackRoot->GetMucPosSigmaAlongY(); 00153 HepSymMatrix eMm(6) ; 00154 for (int i = 0;i<6 ;i++ ) 00155 for (int j= 0;j<6 ;j++ ) 00156 eMm[i][j]= extTrackRoot->GetMucErrorMatrix(i,j) ; 00157 00158 DstExtTrack *extTrackTds = new DstExtTrack(); 00159 m_common.m_rootExtTrackMap[extTrackRoot] = extTrackTds; 00160 00161 //ExtMucHitVec 00162 /*int size = extTrackRoot->GetSize(); 00163 ExtMucHit aExtMucHit; 00164 // Hep3Vector p(0,0,0); 00165 // Hep3Vector m(0,0,0); 00166 string vs; 00167 int vn; 00168 double z; 00169 double t; 00170 double x; 00171 double y; 00172 HepSymMatrix matrix(6); 00173 for(int i =0;i<size;i++){ 00174 double px = extTrackRoot->GetPositionX(i) ; 00175 double py = extTrackRoot->GetPositionY(i) ; 00176 double pz = extTrackRoot->GetPositionZ(i) ; 00177 Hep3Vector p(px,py,pz); 00178 double mx = extTrackRoot->GetMomentumX(i) ; 00179 double my = extTrackRoot->GetMomentumY(i) ; 00180 double mz = extTrackRoot->GetMomentumZ(i); 00181 Hep3Vector m(mx,my,mz); 00182 vs = extTrackRoot->GetVolumeName(i).Data(); 00183 vn = extTrackRoot->GetVolumeNumber(i) ; 00184 z = extTrackRoot->GetPosSigmaAlongZ(i) ; 00185 t = extTrackRoot->GetPosSigmaAlongT(i); 00186 x = extTrackRoot->GetPosSigmaAlongX(i); 00187 y = extTrackRoot->GetPosSigmaAlongY(i); 00188 std::vector<double> vecError = extTrackRoot->GetErrorMatrix(i); 00189 for(int k =0;i<6;k++){ 00190 for(int j =0; j<6;j++){ 00191 matrix[k][j] = vecError[k*6+j]; 00192 } 00193 } 00194 aExtMucHit.SetExtMucHit(p,m,vs,vn,matrix,z,t,x,y); 00195 extTrackTds->AddExtMucHit(aExtMucHit); 00196 }*/ 00197 00198 // DstExtTrack *extTrackTds = new DstExtTrack(); 00199 extTrackTds->SetTrackId(trackId); 00200 extTrackTds->SetTof1Data( tof1p, tof1m, v1s, v1n , tof1, tof1path, e1m, z1, t1, x1, y1 ); 00201 extTrackTds->SetTof2Data( tof2p, tof2m, v2s, v2n , tof2, tof2path, e2m, z2, t2, x2, y2 ); 00202 extTrackTds->SetEmcData( Ep, Em, vEs, vEn , theta, phi , eEm); 00203 extTrackTds->SetEmcPath(emcPath); 00204 extTrackTds->SetMucData( Mp, Mm, vMs, vMn , eMm, zM, tM, xM, yM ); 00205 00206 extTrackTdsCol->push_back(extTrackTds); 00207 00208 00209 //delete extTrackTds; // wensp add 2005/12/31 00210 // extTrackTds = NULL; 00211 } 00212 //m_extTrackCol->Delete(); // wensp add 2005/12/30 00213 delete m_extTrackCol; 00214 m_extTrackCol = 0; 00215 return StatusCode::SUCCESS; 00216 }
|
|
|
|
the CLID of the upper converter if any
|
|
each converter knows the corresponding adresses
|
|
each converter knows the corresponding adresses
|
|
the branchNr of this converter for writing
|
|
|
|
|
|
|
|
|
|
|
|
array with number of branches for reading
|
|
array with number of branches for reading
|
|
|
|
|
|
relational maps
|
|
|
|
pointer to eventdataservice
|
|
pointer to eventdataservice
|
|
|
|
|
|
root object to be read
|
|
root object to be read
|
|
|
|
|
|
the object that was read
|
|
the object that was read
|
|
root branchname (may be concatenated of severals)
|
|
pointer to the RootInterface
|
|
pointer to the RootInterface
|
|
each converter knows it's treename
|