#include <MdcKalTrackCnv.h>
Inheritance diagram for MdcKalTrackCnv:
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 | ~MdcKalTrackCnv () |
virtual | ~MdcKalTrackCnv () |
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 | |
MdcKalTrackCnv (ISvcLocator *svc) | |
MdcKalTrackCnv (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_mdcKalTrackCol |
root object to be read | |
TObjArray * | m_mdcKalTrackCol |
root object to be read | |
Friends | |
class | CnvFactory<MdcKalTrackCnv> |
|
|
|
|
|
|
|
|
|
00025 { };
|
|
00034 : RootEventBaseCnv(classID(), svc) 00035 { 00036 // Here we associate this converter with the /Event path on the TDS. 00037 MsgStream log(msgSvc(), "MdcKalTrackCnv"); 00038 m_rootBranchname ="m_mdcKalTrackCol"; 00039 m_adresses.push_back(&m_mdcKalTrackCol); 00040 m_mdcKalTrackCol=0; 00041 }
|
|
00025 { };
|
|
|
|
00021 {
00022 return CLID_DstMdcKalTrackCol;
00023 }
|
|
00021 {
00022 return CLID_DstMdcKalTrackCol;
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. 00305 { 00306 00307 MsgStream log(msgSvc(), "MdcKalTrackCnv"); 00308 log << MSG::DEBUG << "MdcKalTrackCnv::DataObjectToTObject" << endreq; 00309 StatusCode sc=StatusCode::SUCCESS; 00310 00311 DstMdcKalTrackCol * mdcKalTrackColTds=dynamic_cast<DstMdcKalTrackCol *> (obj); 00312 //RecMdcKalTrackCol * mdcKalTrackColTds=dynamic_cast<RecMdcKalTrackCol *> (obj); 00313 if (!mdcKalTrackColTds) { 00314 log << MSG::ERROR << "Could not downcast to DstMdcKalTrackCol" << endreq; 00315 return StatusCode::FAILURE; 00316 } 00317 00318 DataObject *evt; 00319 m_eds->findObject(EventModel::Dst::Event,evt); 00320 if (evt==NULL) { 00321 log << MSG::ERROR << "Could not get ReconEvent in TDS " << endreq; 00322 return StatusCode::FAILURE; 00323 } 00324 00325 DstEvent * devtTds=dynamic_cast<DstEvent *> (evt); 00326 if (!devtTds) { 00327 log << MSG::ERROR << "MdcKalTrackCnv:Could not downcast to TDS Dst Event" << endreq; 00328 } 00329 IOpaqueAddress *addr; 00330 00331 m_cnvSvc->getDstCnv()->createRep(evt,addr); 00332 TDstEvent *recEvt=m_cnvSvc->getDstCnv()->getWriteObject(); 00333 00334 const TObjArray *m_mdcKalTrackCol = recEvt->getMdcKalTrackCol(); 00335 00336 if (!m_mdcKalTrackCol) return sc; 00337 00338 recEvt->clearMdcKalTrackCol(); //necessary in case there is I/O at the same time since array is static 00339 DstMdcKalTrackCol::const_iterator mdcKalTrackTds; 00340 00341 for (mdcKalTrackTds = mdcKalTrackColTds->begin(); mdcKalTrackTds != mdcKalTrackColTds->end(); mdcKalTrackTds++) { 00342 00343 // Get Data from DST 00344 00345 //Double_t poca[3]; 00346 Double_t zhelix[5]; 00347 Double_t zerror[5][5]; 00348 00349 //Double_t poca_e[3]; 00350 Double_t zhelix_e[5]; 00351 Double_t zerror_e[5][5]; 00352 00353 //Double_t poca_mu[3]; 00354 Double_t zhelix_mu[5]; 00355 Double_t zerror_mu[5][5]; 00356 00357 //Double_t poca_k[3]; 00358 Double_t zhelix_k[5]; 00359 Double_t zerror_k[5][5]; 00360 00361 //Double_t poca_p[3]; 00362 Double_t zhelix_p[5]; 00363 Double_t zerror_p[5][5]; 00364 00365 Double_t fhelix[5]; 00366 Double_t ferror[5][5]; 00367 Double_t fhelix_e[5]; 00368 Double_t ferror_e[5][5]; 00369 Double_t fhelix_mu[5]; 00370 Double_t ferror_mu[5][5]; 00371 Double_t fhelix_k[5]; 00372 Double_t ferror_k[5][5]; 00373 Double_t fhelix_p[5]; 00374 Double_t ferror_p[5][5]; 00375 00376 TMdcKalTrack *mdcKalTrackRoot = new TMdcKalTrack(); 00377 //m_common.m_mdcKalTrackMap[(*mdcKalTrackTds)] = mdcKalTrackRoot; 00378 RecMdcKalTrack* recMdcKalTrackTds=(RecMdcKalTrack*) (*mdcKalTrackTds); 00379 00380 for(int k=0; k<5; k++){ 00381 mdcKalTrackRoot->setStat((*mdcKalTrackTds)->getStat(k),k); 00382 mdcKalTrackRoot->setStat2(recMdcKalTrackTds->getStat(1,k),k); 00383 mdcKalTrackRoot->setChisq((*mdcKalTrackTds)->getChisq(k),k); 00384 mdcKalTrackRoot->setNdf((*mdcKalTrackTds)->getNdf(k),k); 00385 mdcKalTrackRoot->setNster((*mdcKalTrackTds)->getNster(k),k); 00386 mdcKalTrackRoot->setFirstLayer((*mdcKalTrackTds)->getFirstLayer(k),k); 00387 mdcKalTrackRoot->setLastLayer((*mdcKalTrackTds)->getLastLayer(k),k); 00388 } 00389 00390 //HepPoint3D h_poca = (*mdcKalTrackTds)->getPoca(2); 00391 HepVector h_zhelix = (*mdcKalTrackTds)->getZHelix(2); 00392 HepSymMatrix h_zerror = (*mdcKalTrackTds)->getZError(2); 00393 00394 //HepPoint3D h_poca_e = (*mdcKalTrackTds)->getPoca(0); 00395 HepVector h_zhelix_e = (*mdcKalTrackTds)->getZHelix(0); 00396 HepSymMatrix h_zerror_e = (*mdcKalTrackTds)->getZError(0); 00397 00398 //HepPoint3D h_poca_mu = (*mdcKalTrackTds)->getPoca(1); 00399 HepVector h_zhelix_mu = (*mdcKalTrackTds)->getZHelix(1); 00400 HepSymMatrix h_zerror_mu = (*mdcKalTrackTds)->getZError(1); 00401 00402 //HepPoint3D h_poca_k = (*mdcKalTrackTds)->getPoca(3); 00403 HepVector h_zhelix_k = (*mdcKalTrackTds)->getZHelix(3); 00404 HepSymMatrix h_zerror_k = (*mdcKalTrackTds)->getZError(3); 00405 00406 //HepPoint3D h_poca_p = (*mdcKalTrackTds)->getPoca(4); 00407 HepVector h_zhelix_p = (*mdcKalTrackTds)->getZHelix(4); 00408 HepSymMatrix h_zerror_p = (*mdcKalTrackTds)->getZError(4); 00409 00410 HepVector h_fhelix = (*mdcKalTrackTds)->getFHelix(2); 00411 HepSymMatrix h_ferror = (*mdcKalTrackTds)->getFError(2); 00412 HepVector h_fhelix_e = (*mdcKalTrackTds)->getFHelix(0); 00413 HepSymMatrix h_ferror_e = (*mdcKalTrackTds)->getFError(0); 00414 HepVector h_fhelix_mu = (*mdcKalTrackTds)->getFHelix(1); 00415 HepSymMatrix h_ferror_mu = (*mdcKalTrackTds)->getFError(1); 00416 HepVector h_fhelix_k = (*mdcKalTrackTds)->getFHelix(3); 00417 HepSymMatrix h_ferror_k = (*mdcKalTrackTds)->getFError(3); 00418 HepVector h_fhelix_p = (*mdcKalTrackTds)->getFHelix(4); 00419 HepSymMatrix h_ferror_p = (*mdcKalTrackTds)->getFError(4); 00420 00421 mdcKalTrackRoot->setTrackId((*mdcKalTrackTds)->getTrackId()); 00422 00423 /* 00424 for(int k=0; k<3; k++){ 00425 poca[k] = h_poca[k]; 00426 poca_e[k] = h_poca_e[k]; 00427 poca_mu[k] = h_poca_mu[k]; 00428 poca_k[k] = h_poca_k[k]; 00429 poca_p[k] = h_poca_p[k]; 00430 } 00431 */ 00432 00433 for (int i=0; i<5; i++){ 00434 zhelix[i] = h_zhelix[i]; 00435 zhelix_e[i] = h_zhelix_e[i]; 00436 zhelix_mu[i] = h_zhelix_mu[i]; 00437 zhelix_p[i] = h_zhelix_p[i]; 00438 zhelix_k[i] = h_zhelix_k[i]; 00439 fhelix[i] = h_fhelix[i]; 00440 fhelix_e[i] = h_fhelix_e[i]; 00441 fhelix_mu[i] = h_fhelix_mu[i]; 00442 fhelix_p[i] = h_fhelix_p[i]; 00443 fhelix_k[i] = h_fhelix_k[i]; 00444 for (int j=0; j<=i; j++){ 00445 zerror[i][j] = h_zerror[i][j]; 00446 zerror_e[i][j] = h_zerror_e[i][j]; 00447 zerror_mu[i][j] = h_zerror_mu[i][j]; 00448 zerror_p[i][j] = h_zerror_p[i][j]; 00449 zerror_k[i][j] = h_zerror_k[i][j]; 00450 zerror[j][i] = h_zerror[i][j]; 00451 zerror_e[j][i] = h_zerror_e[i][j]; 00452 zerror_mu[j][i] = h_zerror_mu[i][j]; 00453 zerror_p[j][i] = h_zerror_p[i][j]; 00454 zerror_k[j][i] = h_zerror_k[i][j]; 00455 ferror[i][j] = h_ferror[i][j]; 00456 ferror_e[i][j] = h_ferror_e[i][j]; 00457 ferror_mu[i][j] = h_ferror_mu[i][j]; 00458 ferror_p[i][j] = h_ferror_p[i][j]; 00459 ferror_k[i][j] = h_ferror_k[i][j]; 00460 ferror[j][i] = h_ferror[i][j]; 00461 ferror_e[j][i] = h_ferror_e[i][j]; 00462 ferror_mu[j][i] = h_ferror_mu[i][j]; 00463 ferror_p[j][i] = h_ferror_p[i][j]; 00464 ferror_k[j][i] = h_ferror_k[i][j]; 00465 } 00466 } 00467 00468 //mdcKalTrackRoot->setPoca(poca); 00469 mdcKalTrackRoot->setZHelix(zhelix); 00470 mdcKalTrackRoot->setZError(zerror); 00471 00472 //mdcKalTrackRoot->setPocaE(poca_e); 00473 mdcKalTrackRoot->setZHelixE(zhelix_e); 00474 mdcKalTrackRoot->setZErrorE(zerror_e); 00475 00476 //mdcKalTrackRoot->setPocaMu(poca_mu); 00477 mdcKalTrackRoot->setZHelixMu(zhelix_mu); 00478 mdcKalTrackRoot->setZErrorMu(zerror_mu); 00479 00480 //mdcKalTrackRoot->setPocaK(poca_k); 00481 mdcKalTrackRoot->setZHelixK(zhelix_k); 00482 mdcKalTrackRoot->setZErrorK(zerror_k); 00483 00484 //mdcKalTrackRoot->setPocaP(poca_p); 00485 mdcKalTrackRoot->setZHelixP(zhelix_p); 00486 mdcKalTrackRoot->setZErrorP(zerror_p); 00487 00488 mdcKalTrackRoot->setFHelix(fhelix); 00489 mdcKalTrackRoot->setFError(ferror); 00490 00491 mdcKalTrackRoot->setFHelixE(fhelix_e); 00492 mdcKalTrackRoot->setFErrorE(ferror_e); 00493 00494 mdcKalTrackRoot->setFHelixMu(fhelix_mu); 00495 mdcKalTrackRoot->setFErrorMu(ferror_mu); 00496 00497 mdcKalTrackRoot->setFHelixK(fhelix_k); 00498 mdcKalTrackRoot->setFErrorK(ferror_k); 00499 00500 mdcKalTrackRoot->setFHelixP(fhelix_p); 00501 mdcKalTrackRoot->setFErrorP(ferror_p); 00502 00503 recEvt->addMdcKalTrack(mdcKalTrackRoot); 00504 } 00505 00506 return StatusCode::SUCCESS; 00507 }
|
|
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. 00043 { 00044 // creation of TDS object from root object 00045 00046 MsgStream log(msgSvc(), "MdcKalTrackCnv"); 00047 log << MSG::DEBUG << "MdcKalTrackCnv::TObjectToDataObject" << endreq; 00048 StatusCode sc=StatusCode::SUCCESS; 00049 00050 // create the TDS location for the MdcKalTrack Collection 00051 DstMdcKalTrackCol* mdcKalTrackTdsCol = new DstMdcKalTrackCol; 00052 refpObject=mdcKalTrackTdsCol; 00053 00054 // now convert 00055 if (!m_mdcKalTrackCol) return sc; 00056 TIter mdcKalTrackIter(m_mdcKalTrackCol); 00057 TMdcKalTrack *mdcKalTrackRoot = 0; 00058 while ((mdcKalTrackRoot = (TMdcKalTrack*)mdcKalTrackIter.Next())) { 00059 std::vector<HepVector> zhelixs; 00060 std::vector<HepSymMatrix> zerrors; 00061 std::vector<HepPoint3D> pocas; 00062 std::vector<HepVector> fhelixs; 00063 std::vector<HepSymMatrix> ferrors; 00064 00065 HepVector zhelix(5); 00066 HepSymMatrix zerror(5); 00067 HepPoint3D poca(0,0,0); 00068 00069 HepVector zhelix_e(5); 00070 HepSymMatrix zerror_e(5); 00071 HepPoint3D poca_e(0,0,0); 00072 00073 HepVector zhelix_mu(5); 00074 HepSymMatrix zerror_mu(5); 00075 HepPoint3D poca_mu(0,0,0); 00076 00077 HepVector zhelix_k(5); 00078 HepSymMatrix zerror_k(5); 00079 HepPoint3D poca_k(0,0,0); 00080 00081 HepVector zhelix_p(5); 00082 HepSymMatrix zerror_p(5); 00083 HepPoint3D poca_p(0,0,0); 00084 00085 HepVector fhelix(5); 00086 HepSymMatrix ferror(5); 00087 00088 HepVector fhelix_e(5); 00089 HepSymMatrix ferror_e(5); 00090 00091 HepVector fhelix_mu(5); 00092 HepSymMatrix ferror_mu(5); 00093 00094 HepVector fhelix_k(5); 00095 HepSymMatrix ferror_k(5); 00096 00097 HepVector fhelix_p(5); 00098 HepSymMatrix ferror_p(5); 00099 00100 00101 DstMdcKalTrack *mdcKalTrackTds = new DstMdcKalTrack(); 00102 m_common.m_rootMdcKalTrackMap[mdcKalTrackRoot] = mdcKalTrackTds; 00103 00104 /* 00105 for(int ii=0; ii<3; ii++){ 00106 poca_e[ii] = mdcKalTrackRoot->getPocaE(ii); 00107 poca_mu[ii] = mdcKalTrackRoot->getPocaMu(ii); 00108 poca[ii] = mdcKalTrackRoot->getPoca(ii); 00109 poca_k[ii] = mdcKalTrackRoot->getPocaK(ii); 00110 poca_p[ii] = mdcKalTrackRoot->getPocaP(ii); 00111 } 00112 */ 00113 00114 log<<MSG::DEBUG<<"T to DST, poca: "<<poca<<endreq; 00115 00116 for (int i=0; i<5; i++){ 00117 zhelix[i] = mdcKalTrackRoot->getZHelix(i); 00118 zhelix_e[i] = mdcKalTrackRoot->getZHelixE(i); 00119 zhelix_mu[i] = mdcKalTrackRoot->getZHelixMu(i); 00120 zhelix_k[i] = mdcKalTrackRoot->getZHelixK(i); 00121 zhelix_p[i] = mdcKalTrackRoot->getZHelixP(i); 00122 00123 fhelix[i] = mdcKalTrackRoot->getFHelix(i); 00124 fhelix_e[i] = mdcKalTrackRoot->getFHelixE(i); 00125 fhelix_mu[i] = mdcKalTrackRoot->getFHelixMu(i); 00126 fhelix_k[i] = mdcKalTrackRoot->getFHelixK(i); 00127 fhelix_p[i] = mdcKalTrackRoot->getFHelixP(i); 00128 00129 for (int j=0; j<=i; j++){ 00130 zerror[i][j] = mdcKalTrackRoot->getZError(i,j); 00131 zerror_e[i][j] = mdcKalTrackRoot->getZErrorE(i,j); 00132 zerror_mu[i][j] = mdcKalTrackRoot->getZErrorMu(i,j); 00133 zerror_k[i][j] = mdcKalTrackRoot->getZErrorK(i,j); 00134 zerror_p[i][j] = mdcKalTrackRoot->getZErrorP(i,j); 00135 00136 zerror[j][i] = zerror[i][j]; 00137 zerror_e[j][i] = zerror_e[i][j]; 00138 zerror_mu[j][i] = zerror_mu[i][j]; 00139 zerror_k[j][i] = zerror_k[i][j]; 00140 zerror_p[j][i] = zerror_p[i][j]; 00141 00142 ferror[i][j] = mdcKalTrackRoot->getFError(i,j); 00143 ferror_e[i][j] = mdcKalTrackRoot->getFErrorE(i,j); 00144 ferror_mu[i][j] = mdcKalTrackRoot->getFErrorMu(i,j); 00145 ferror_k[i][j] = mdcKalTrackRoot->getFErrorK(i,j); 00146 ferror_p[i][j] = mdcKalTrackRoot->getFErrorP(i,j); 00147 00148 ferror[j][i] = ferror[i][j]; 00149 ferror_e[j][i] = ferror_e[i][j]; 00150 ferror_mu[j][i] = ferror_mu[i][j]; 00151 ferror_k[j][i] = ferror_k[i][j]; 00152 ferror_p[j][i] = ferror_p[i][j]; 00153 } 00154 } 00155 00156 00157 double dr = zhelix[0]; 00158 double phi0 = zhelix[1]; 00159 double kappa = zhelix[2]; 00160 double dz = zhelix[3]; 00161 double tanl = zhelix[4]; 00162 poca[0]=dr*cos(phi0); 00163 poca[1]=dr*sin(phi0); 00164 poca[2]=dz; 00165 00166 dr = zhelix_e[0]; 00167 phi0 = zhelix_e[1]; 00168 kappa = zhelix_e[2]; 00169 dz = zhelix_e[3]; 00170 tanl = zhelix_e[4]; 00171 poca_e[0]=dr*cos(phi0); 00172 poca_e[1]=dr*sin(phi0); 00173 poca_e[2]=dz; 00174 00175 dr = zhelix_mu[0]; 00176 phi0 = zhelix_mu[1]; 00177 kappa = zhelix_mu[2]; 00178 dz = zhelix_mu[3]; 00179 tanl = zhelix_mu[4]; 00180 poca_mu[0]=dr*cos(phi0); 00181 poca_mu[1]=dr*sin(phi0); 00182 poca_mu[2]=dz; 00183 00184 dr = zhelix_k[0]; 00185 phi0 = zhelix_k[1]; 00186 kappa = zhelix_k[2]; 00187 dz = zhelix_k[3]; 00188 tanl = zhelix_k[4]; 00189 poca_k[0]=dr*cos(phi0); 00190 poca_k[1]=dr*sin(phi0); 00191 poca_k[2]=dz; 00192 00193 dr = zhelix_p[0]; 00194 phi0 = zhelix_p[1]; 00195 kappa = zhelix_p[2]; 00196 dz = zhelix_p[3]; 00197 tanl = zhelix_p[4]; 00198 poca_p[0]=dr*cos(phi0); 00199 poca_p[1]=dr*sin(phi0); 00200 poca_p[2]=dz; 00201 00202 00203 log<<MSG::DEBUG<<"T to DST, zhelix: "<<zhelix<<endreq; 00204 log<<MSG::DEBUG<<"T to DST, zerror: "<<zerror<<endreq; 00205 00206 zhelixs.push_back(zhelix_e); 00207 zhelixs.push_back(zhelix_mu); 00208 zhelixs.push_back(zhelix); 00209 zhelixs.push_back(zhelix_k); 00210 zhelixs.push_back(zhelix_p); 00211 zerrors.push_back(zerror_e); 00212 zerrors.push_back(zerror_mu); 00213 zerrors.push_back(zerror); 00214 zerrors.push_back(zerror_k); 00215 zerrors.push_back(zerror_p); 00216 00217 fhelixs.push_back(fhelix_e); 00218 fhelixs.push_back(fhelix_mu); 00219 fhelixs.push_back(fhelix); 00220 fhelixs.push_back(fhelix_k); 00221 fhelixs.push_back(fhelix_p); 00222 ferrors.push_back(ferror_e); 00223 ferrors.push_back(ferror_mu); 00224 ferrors.push_back(ferror); 00225 ferrors.push_back(ferror_k); 00226 ferrors.push_back(ferror_p); 00227 00228 pocas.push_back(poca_e); 00229 pocas.push_back(poca_mu); 00230 pocas.push_back(poca); 00231 pocas.push_back(poca_k); 00232 pocas.push_back(poca_p); 00233 00234 for(int m=0; m<5; m++){ 00235 int charge; 00236 double pxy(0.),px(0.),py(0.),pz(0.),ptot(0.),dr(0.),phi0(0.),kappa(0.),dz(0.),tanl(0.),x(0.),y(0.),z(0.),vx0(0.),vy0(0.),vz0(0.); 00237 dr = zhelixs[m][0]; 00238 phi0 = zhelixs[m][1]; 00239 kappa = zhelixs[m][2]; 00240 dz = zhelixs[m][3]; 00241 tanl = zhelixs[m][4]; 00242 00243 // x = pocas[m][0]; 00244 // y = pocas[m][1]; 00245 // z = pocas[m][2]; 00246 00247 x = dr * cos(phi0); 00248 y = dr * sin(phi0); 00249 z = dz; 00250 00251 // std::cout<<"x: "<<x<<"y: "<<y<<"z: "<<z<<std::endl; 00252 00253 if (kappa > 0.0000000001) 00254 charge = 1; 00255 else if (kappa < -0.0000000001) 00256 charge = -1; 00257 else 00258 charge = 0; 00259 00260 if(kappa!=0) pxy = 1.0/fabs(kappa); 00261 else pxy = 0; 00262 00263 px = pxy * (-sin(phi0)); 00264 py = pxy * cos(phi0); 00265 pz = pxy * tanl; 00266 ptot = sqrt(px*px+py*py+pz*pz); 00267 00268 mdcKalTrackTds->setCharge(charge,m); 00269 mdcKalTrackTds->setPxy(pxy,m); 00270 mdcKalTrackTds->setPx(px,m); 00271 mdcKalTrackTds->setPy(py,m); 00272 mdcKalTrackTds->setPz(pz,m); 00273 mdcKalTrackTds->setP(ptot,m); 00274 mdcKalTrackTds->setTheta(acos(pz/ptot),m); 00275 mdcKalTrackTds->setPhi(atan2(py,px),m); 00276 mdcKalTrackTds->setX(x,m); 00277 mdcKalTrackTds->setY(y,m); 00278 mdcKalTrackTds->setZ(z,m); 00279 mdcKalTrackTds->setR(sqrt(x*x+y*y),m); 00280 00281 mdcKalTrackTds->setStat(mdcKalTrackRoot->getStat(m),0,m); 00282 mdcKalTrackTds->setStat(mdcKalTrackRoot->getStat2(m),1,m); 00283 mdcKalTrackTds->setChisq(mdcKalTrackRoot->getChisq(m),0,m); 00284 mdcKalTrackTds->setNdf(mdcKalTrackRoot->getNdf(m),0,m); 00285 } 00286 00287 mdcKalTrackTds->setTrackId(mdcKalTrackRoot->getTrackId()); 00288 00289 for(int jj=0; jj<5; jj++){ 00290 mdcKalTrackTds->setZHelix(zhelixs[jj],jj); 00291 mdcKalTrackTds->setZError(zerrors[jj],jj); 00292 mdcKalTrackTds->setFHelix(fhelixs[jj],jj); 00293 mdcKalTrackTds->setFError(ferrors[jj],jj); 00294 mdcKalTrackTds->setPoca(pocas[jj],jj); 00295 } 00296 00297 mdcKalTrackTdsCol->push_back(mdcKalTrackTds); 00298 } 00299 // m_mdcKalTrackCol->Delete(); // wensp add 2005/12/30 00300 delete m_mdcKalTrackCol; 00301 m_mdcKalTrackCol = 0; 00302 return StatusCode::SUCCESS; 00303 }
|
|
|
|
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
|