#include <RecExtTrackCnv.h>
Inheritance diagram for RecExtTrackCnv:
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 | ~RecExtTrackCnv () |
virtual | ~RecExtTrackCnv () |
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 | |
RecExtTrackCnv (ISvcLocator *svc) | |
RecExtTrackCnv (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<RecExtTrackCnv> |
|
|
|
|
|
|
|
|
|
00025 { };
|
|
00034 : RootEventBaseCnv(classID(), svc) 00035 { 00036 00037 // Here we associate this converter with the /Event path on the TDS. 00038 MsgStream log(msgSvc(), "RecExtTrackCnv"); 00039 //log << MSG::DEBUG << "Constructor called for " << objType() << endreq; 00040 //m_rootTreename ="Rec"; 00041 //m_rootBranchname ="m_RecExtTrackCol"; 00042 m_rootBranchname ="m_extTrackCol"; 00043 //declareObject(EventModel::Recon::ExtTrackCol, objType(), m_rootTreename, m_rootBranchname); 00044 m_adresses.push_back(&m_extTrackCol); 00045 m_extTrackCol=0; 00046 }
|
|
00025 { };
|
|
|
|
00021 {
00022 return CLID_RecExtTrackCol;
00023 }
|
|
00021 {
00022 return CLID_RecExtTrackCol;
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. 00222 { 00223 00224 00225 00226 MsgStream log(msgSvc(), "RecExtTrackCnv"); 00227 log << MSG::DEBUG << "RecExtTrackCnv::DataObjectToTObject" << endreq; 00228 StatusCode sc=StatusCode::SUCCESS; 00229 00230 RecExtTrackCol * extTrackColTds=dynamic_cast<RecExtTrackCol *> (obj); 00231 if (!extTrackColTds) { 00232 log << MSG::ERROR << "Could not downcast to RecExtTrackCol" << endreq; 00233 return StatusCode::FAILURE; 00234 } 00235 00236 DataObject *evt; 00237 m_eds->findObject(EventModel::Recon::Event,evt); 00238 if (evt==NULL) { 00239 log << MSG::ERROR << "Could not get ReconEvent in TDS " << endreq; 00240 return StatusCode::FAILURE; 00241 } 00242 00243 ReconEvent * devtTds=dynamic_cast<ReconEvent *> (evt); 00244 if (!devtTds) { 00245 log << MSG::ERROR << "RecExtTrackCnv:Could not downcast to TDS Rec Event" << endreq; 00246 } 00247 IOpaqueAddress *addr; 00248 00249 m_cnvSvc->getRecTrackCnv()->createRep(evt,addr); 00250 TRecTrackEvent *recEvt=m_cnvSvc->getRecTrackCnv()->getWriteObject(); 00251 00252 const TObjArray *m_extTrackCol = recEvt->getExtTrackCol(); 00253 00254 if (!m_extTrackCol) return sc; 00255 00256 recEvt->clearExtTrackCol(); //necessary in case there is I/O at the same time since array is static 00257 RecExtTrackCol::const_iterator extTrackTds; 00258 00259 for (extTrackTds = extTrackColTds->begin(); extTrackTds != extTrackColTds->end(); extTrackTds++) { 00260 //Get Data from TDS 00261 Int_t trackId = (*extTrackTds)->GetTrackId(); 00262 TRecExtTrack *extTrackRoot = new TRecExtTrack; 00263 //Set to Root 00264 extTrackRoot->SetTrackId(trackId); 00265 for(int iPart=0; iPart<5; iPart++) { 00266 //Tof layer1 00267 Double_t p1x = (*extTrackTds)->tof1Position(iPart).x(); 00268 Double_t p1y = (*extTrackTds)->tof1Position(iPart).y(); 00269 Double_t p1z = (*extTrackTds)->tof1Position(iPart).z(); 00270 Double_t m1x = (*extTrackTds)->tof1Momentum(iPart).x(); 00271 Double_t m1y = (*extTrackTds)->tof1Momentum(iPart).y(); 00272 Double_t m1z = (*extTrackTds)->tof1Momentum(iPart).z(); 00273 00274 TString v1s = (*extTrackTds)->tof1VolumeName(iPart) ; 00275 Int_t v1n = (*extTrackTds)->tof1VolumeNumber(iPart) ; 00276 Double_t tof1= (*extTrackTds)->tof1(iPart); 00277 Double_t tof1p = (*extTrackTds)->tof1Path(iPart); 00278 Double_t z1 = (*extTrackTds)->tof1PosSigmaAlongZ(iPart); 00279 Double_t t1 = (*extTrackTds)->tof1PosSigmaAlongT(iPart); 00280 Double_t x1 = (*extTrackTds)->tof1PosSigmaAlongX(iPart); 00281 Double_t y1 = (*extTrackTds)->tof1PosSigmaAlongY(iPart); 00282 Double_t e1m[6][6]; 00283 HepSymMatrix e1mTds = (*extTrackTds)->tof1ErrorMatrix(iPart); 00284 for (int i = 0;i<6 ;i++ ) 00285 for (int j= 0;j<6 ;j++ ) 00286 e1m[i][j] = e1mTds[i][j]; 00287 00288 //Tof llayer2 00289 Double_t p2x = (*extTrackTds)->tof2Position(iPart).x(); 00290 Double_t p2y = (*extTrackTds)->tof2Position(iPart).y(); 00291 Double_t p2z = (*extTrackTds)->tof2Position(iPart).z(); 00292 Double_t m2x = (*extTrackTds)->tof2Momentum(iPart).x(); 00293 Double_t m2y = (*extTrackTds)->tof2Momentum(iPart).y(); 00294 Double_t m2z = (*extTrackTds)->tof2Momentum(iPart).z(); 00295 00296 TString v2s = (*extTrackTds)->tof2VolumeName(iPart) ; 00297 Int_t v2n = (*extTrackTds)->tof2VolumeNumber(iPart) ; 00298 Double_t tof2= (*extTrackTds)->tof2(iPart); 00299 Double_t tof2p = (*extTrackTds)->tof2Path(iPart); 00300 Double_t z2 = (*extTrackTds)->tof2PosSigmaAlongZ(iPart); 00301 Double_t t2 = (*extTrackTds)->tof2PosSigmaAlongT(iPart); 00302 Double_t x2 = (*extTrackTds)->tof2PosSigmaAlongX(iPart); 00303 Double_t y2 = (*extTrackTds)->tof2PosSigmaAlongY(iPart); 00304 Double_t e2m[6][6]; 00305 HepSymMatrix e2mTds = (*extTrackTds)->tof2ErrorMatrix(iPart); 00306 for (int i = 0;i<6 ;i++ ) 00307 for (int j= 0;j<6 ;j++ ) 00308 e2m[i][j] = e2mTds[i][j]; 00309 //Emc 00310 Double_t pEx = (*extTrackTds)->emcPosition(iPart).x(); 00311 Double_t pEy = (*extTrackTds)->emcPosition(iPart).y(); 00312 Double_t pEz = (*extTrackTds)->emcPosition(iPart).z(); 00313 Double_t mEx = (*extTrackTds)->emcMomentum(iPart).x(); 00314 Double_t mEy = (*extTrackTds)->emcMomentum(iPart).y(); 00315 Double_t mEz = (*extTrackTds)->emcMomentum(iPart).z(); 00316 00317 TString vEs = (*extTrackTds)->emcVolumeName(iPart) ; 00318 Int_t vEn = (*extTrackTds)->emcVolumeNumber(iPart) ; 00319 00320 Double_t theta = (*extTrackTds)->emcPosSigmaAlongTheta(iPart); 00321 Double_t phi = (*extTrackTds)->emcPosSigmaAlongPhi(iPart); 00322 00323 Double_t eEm[6][6]; 00324 HepSymMatrix eEmTds = (*extTrackTds)->emcErrorMatrix(iPart); 00325 for (int i = 0;i<6 ;i++ ) 00326 for (int j= 0;j<6 ;j++ ) 00327 eEm[i][j] = eEmTds[i][j]; 00328 Double_t emcPath=(*extTrackTds)->emcPath(iPart); 00329 00330 //Muc 00331 Double_t pMx = (*extTrackTds)->mucPosition(iPart).x(); 00332 Double_t pMy = (*extTrackTds)->mucPosition(iPart).y(); 00333 Double_t pMz = (*extTrackTds)->mucPosition(iPart).z(); 00334 Double_t mMx = (*extTrackTds)->mucMomentum(iPart).x(); 00335 Double_t mMy = (*extTrackTds)->mucMomentum(iPart).y(); 00336 Double_t mMz = (*extTrackTds)->mucMomentum(iPart).z(); 00337 00338 TString vMs = (*extTrackTds)->mucVolumeName(iPart) ; 00339 Int_t vMn = (*extTrackTds)->mucVolumeNumber(iPart) ; 00340 00341 Double_t zM = (*extTrackTds)->mucPosSigmaAlongZ(iPart); 00342 Double_t tM = (*extTrackTds)->mucPosSigmaAlongT(iPart); 00343 Double_t xM = (*extTrackTds)->mucPosSigmaAlongX(iPart); 00344 Double_t yM = (*extTrackTds)->mucPosSigmaAlongY(iPart); 00345 00346 Double_t eMm[6][6]; 00347 HepSymMatrix eMmTds = (*extTrackTds)->mucErrorMatrix(iPart); 00348 for (int i = 0;i<6 ;i++ ) 00349 for (int j= 0;j<6 ;j++ ) 00350 eMm[i][j]= eMmTds[i][j]; 00351 00352 //ExtMucHitVec 00353 ExtMucHitVec vecHit = (*extTrackTds)->GetExtMucHitVec(iPart); 00354 Int_t size = vecHit.size(); 00355 00356 //m_common.m_extTrackMap[(*extTrackTds)] = extTrackRoot; 00357 00358 //Set to Root 00359 00360 //ExtMucHitVec 00361 extTrackRoot->SetSize(size,iPart); 00362 for(int i=0;i<size;i++){ 00363 Double_t px = vecHit[i].GetPosition().x(); 00364 Double_t py = vecHit[i].GetPosition().y(); 00365 Double_t pz = vecHit[i].GetPosition().z(); 00366 Double_t mx = vecHit[i].GetMomentum().x(); 00367 Double_t my = vecHit[i].GetMomentum().y(); 00368 Double_t mz = vecHit[i].GetMomentum().z(); 00369 TString vs = vecHit[i].GetVolumeName(); 00370 Int_t vn = vecHit[i].GetVolumeNumber(); 00371 Double_t z = vecHit[i].GetPosSigmaAlongZ(); 00372 Double_t t = vecHit[i].GetPosSigmaAlongT(); 00373 Double_t x = vecHit[i].GetPosSigmaAlongX(); 00374 Double_t y = vecHit[i].GetPosSigmaAlongY(); 00375 Double_t m[6][6]; 00376 HepSymMatrix mTds = vecHit[i].GetErrorMatrix(); 00377 for (int j = 0;j<6;j++) 00378 for(int k=0;k<6;k++) 00379 m[j][k] = mTds[j][k]; 00380 00381 extTrackRoot->SetExtMucHit(px,py,pz,mx,my,mz,vs,vn,z,t,x,y,m,iPart); 00382 } 00383 00384 //Tof layer1 00385 extTrackRoot->SetTof1PositionX(p1x,iPart); 00386 extTrackRoot->SetTof1PositionY(p1y,iPart); 00387 extTrackRoot->SetTof1PositionZ(p1z,iPart); 00388 extTrackRoot->SetTof1MomentumX(m1x,iPart); 00389 extTrackRoot->SetTof1MomentumY(m1y,iPart); 00390 extTrackRoot->SetTof1MomentumZ(m1z,iPart); 00391 00392 extTrackRoot->SetTof1VolumeName(v1s,iPart); 00393 extTrackRoot->SetTof1VolumeNumber(v1n,iPart); 00394 00395 extTrackRoot->SetTof1(tof1,iPart); 00396 extTrackRoot->SetTof1Path(tof1p,iPart); 00397 00398 extTrackRoot->SetTof1PosSigmaAlongZ(z1,iPart); 00399 extTrackRoot->SetTof1PosSigmaAlongT(t1,iPart); 00400 extTrackRoot->SetTof1PosSigmaAlongX(x1,iPart); 00401 extTrackRoot->SetTof1PosSigmaAlongY(y1,iPart); 00402 00403 extTrackRoot->SetTof1ErrorMatrix(e1m,iPart); 00404 //Tof layer2 00405 extTrackRoot->SetTof2PositionX(p2x,iPart); 00406 extTrackRoot->SetTof2PositionY(p2y,iPart); 00407 extTrackRoot->SetTof2PositionZ(p2z,iPart); 00408 extTrackRoot->SetTof2MomentumX(m2x,iPart); 00409 extTrackRoot->SetTof2MomentumY(m2y,iPart); 00410 extTrackRoot->SetTof2MomentumZ(m2z,iPart); 00411 00412 extTrackRoot->SetTof2VolumeName(v2s,iPart); 00413 extTrackRoot->SetTof2VolumeNumber(v2n,iPart); 00414 00415 extTrackRoot->SetTof2(tof2,iPart); 00416 extTrackRoot->SetTof2Path(tof2p,iPart); 00417 00418 extTrackRoot->SetTof2PosSigmaAlongZ(z2,iPart); 00419 extTrackRoot->SetTof2PosSigmaAlongT(t2,iPart); 00420 extTrackRoot->SetTof2PosSigmaAlongX(x2,iPart); 00421 extTrackRoot->SetTof2PosSigmaAlongY(y2,iPart); 00422 00423 extTrackRoot->SetTof2ErrorMatrix(e2m,iPart); 00424 //Emc 00425 extTrackRoot->SetEmcPositionX(pEx,iPart); 00426 extTrackRoot->SetEmcPositionY(pEy,iPart); 00427 extTrackRoot->SetEmcPositionZ(pEz,iPart); 00428 extTrackRoot->SetEmcMomentumX(mEx,iPart); 00429 extTrackRoot->SetEmcMomentumY(mEy,iPart); 00430 extTrackRoot->SetEmcMomentumZ(mEz,iPart); 00431 00432 extTrackRoot->SetEmcVolumeName(vEs,iPart); 00433 extTrackRoot->SetEmcVolumeNumber(vEn,iPart); 00434 00435 extTrackRoot->SetEmcPosSigmaAlongTheta(theta,iPart); 00436 extTrackRoot->SetEmcPosSigmaAlongPhi(phi,iPart); 00437 00438 extTrackRoot->SetEmcErrorMatrix(eEm,iPart); 00439 extTrackRoot->SetEmcPath(emcPath,iPart); 00440 //Muc 00441 extTrackRoot->SetMucPositionX(pMx,iPart); 00442 extTrackRoot->SetMucPositionY(pMy,iPart); 00443 extTrackRoot->SetMucPositionZ(pMz,iPart); 00444 extTrackRoot->SetMucMomentumX(mMx,iPart); 00445 extTrackRoot->SetMucMomentumY(mMy,iPart); 00446 extTrackRoot->SetMucMomentumZ(mMz,iPart); 00447 00448 extTrackRoot->SetMucVolumeName(vMs,iPart); 00449 extTrackRoot->SetMucVolumeNumber(vMn,iPart); 00450 00451 extTrackRoot->SetMucPosSigmaAlongZ(zM,iPart); 00452 extTrackRoot->SetMucPosSigmaAlongT(tM,iPart); 00453 extTrackRoot->SetMucPosSigmaAlongX(xM,iPart); 00454 extTrackRoot->SetMucPosSigmaAlongY(yM,iPart); 00455 00456 extTrackRoot->SetMucErrorMatrix(eMm,iPart); 00457 00458 } 00459 recEvt->addExtTrack(extTrackRoot); 00460 } 00461 00462 return StatusCode::SUCCESS; 00463 }
|
|
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. 00048 { 00049 // creation of TDS object from root object 00050 MsgStream log(msgSvc(), "RecExtTrackCnv"); 00051 log << MSG::DEBUG << "RecExtTrackCnv::TObjectToDataObject" << endreq; 00052 StatusCode sc=StatusCode::SUCCESS; 00053 00054 // create the TDS location for the ExtTrack Collection 00055 RecExtTrackCol* extTrackTdsCol = new RecExtTrackCol; 00056 refpObject=extTrackTdsCol; 00057 00058 00059 // now convert 00060 if (!m_extTrackCol) return sc; 00061 TIter extTrackIter(m_extTrackCol); 00062 TRecExtTrack *extTrackRoot = 0; 00063 while ((extTrackRoot = (TRecExtTrack*)extTrackIter.Next())) { 00064 00065 RecExtTrack *extTrackTds = new RecExtTrack(); 00066 m_common.m_rootExtTrackMap[extTrackRoot] = extTrackTds; 00067 int trackId = extTrackRoot->GetTrackId(); 00068 extTrackTds->SetTrackId(trackId); 00069 for(int iPart=0; iPart<5; iPart++) { 00070 extTrackTds->SetParType(iPart); 00071 //Tof layer1: 00072 double p1x = extTrackRoot->GetTof1PositionX(iPart); 00073 double p1y = extTrackRoot->GetTof1PositionY(iPart); 00074 double p1z = extTrackRoot->GetTof1PositionZ(iPart); 00075 double m1x = extTrackRoot->GetTof1MomentumX(iPart); 00076 double m1y = extTrackRoot->GetTof1MomentumY(iPart); 00077 double m1z = extTrackRoot->GetTof1MomentumZ(iPart); 00078 Hep3Vector tof1p(p1x,p1y,p1z); 00079 Hep3Vector tof1m(m1x,m1y,m1z); 00080 00081 // char * pTof1 = extTrackRoot->GetTof1VolumeName().Data(); 00082 string v1s = extTrackRoot->GetTof1VolumeName(iPart).Data(); 00083 int v1n = extTrackRoot->GetTof1VolumeNumber(iPart) ; 00084 double tof1= extTrackRoot->GetTof1(iPart); 00085 double tof1path= extTrackRoot->GetTof1Path(iPart); 00086 double z1 = extTrackRoot->GetTof1PosSigmaAlongZ(iPart); 00087 double t1 = extTrackRoot->GetTof1PosSigmaAlongT(iPart); 00088 double x1 = extTrackRoot->GetTof1PosSigmaAlongX(iPart); 00089 double y1 = extTrackRoot->GetTof1PosSigmaAlongY(iPart); 00090 HepSymMatrix e1m(6) ; 00091 for (int i = 0;i<6 ;i++ ) 00092 for (int j= 0;j<6 ;j++ ) 00093 e1m[i][j]= extTrackRoot->GetTof1ErrorMatrix(i , j, iPart) ; 00094 00095 //Tof layer2: 00096 double p2x = extTrackRoot->GetTof2PositionX(iPart) ; 00097 double p2y = extTrackRoot->GetTof2PositionY(iPart) ; 00098 double p2z = extTrackRoot->GetTof2PositionZ(iPart) ; 00099 double m2x = extTrackRoot->GetTof2MomentumX(iPart) ; 00100 double m2y = extTrackRoot->GetTof2MomentumY(iPart) ; 00101 double m2z = extTrackRoot->GetTof2MomentumZ(iPart); 00102 Hep3Vector tof2p(p2x,p2y,p2z); 00103 Hep3Vector tof2m(m2x,m2y,m2z); 00104 00105 string v2s = extTrackRoot->GetTof2VolumeName(iPart).Data(); 00106 int v2n = extTrackRoot->GetTof2VolumeNumber(iPart) ; 00107 double tof2= extTrackRoot->GetTof2(iPart); 00108 double tof2path = extTrackRoot->GetTof2Path(iPart); 00109 double z2 = extTrackRoot->GetTof2PosSigmaAlongZ(iPart) ; 00110 double t2 = extTrackRoot->GetTof2PosSigmaAlongT(iPart); 00111 double x2 = extTrackRoot->GetTof2PosSigmaAlongX(iPart); 00112 double y2 = extTrackRoot->GetTof2PosSigmaAlongY(iPart); 00113 HepSymMatrix e2m(6) ; 00114 for (int i = 0;i<6 ;i++ ) 00115 for (int j= 0;j<6 ;j++ ) 00116 e2m[i][j]= extTrackRoot->GetTof2ErrorMatrix(i,j,iPart) ; 00117 00118 //Emc 00119 double pEx = extTrackRoot->GetEmcPositionX(iPart); 00120 double pEy = extTrackRoot->GetEmcPositionY(iPart); 00121 double pEz = extTrackRoot->GetEmcPositionZ(iPart); 00122 double mEx = extTrackRoot->GetEmcMomentumX(iPart); 00123 double mEy = extTrackRoot->GetEmcMomentumY(iPart); 00124 double mEz = extTrackRoot->GetEmcMomentumZ(iPart); 00125 Hep3Vector Ep(pEx,pEy,pEz); 00126 Hep3Vector Em(mEx,mEy,mEz); 00127 00128 string vEs = extTrackRoot->GetEmcVolumeName(iPart).Data(); 00129 int vEn = extTrackRoot->GetEmcVolumeNumber(iPart); 00130 double theta = extTrackRoot->GetEmcPosSigmaAlongTheta(iPart); 00131 double phi = extTrackRoot->GetEmcPosSigmaAlongPhi(iPart); 00132 HepSymMatrix eEm(6) ; 00133 for(int i=0;i<6 ;i++ ) 00134 for(int j= 0;j<6 ;j++ ) 00135 eEm[i][j]= extTrackRoot->GetEmcErrorMatrix(i,j,iPart); 00136 double emcPath=extTrackRoot->emcPath(iPart); 00137 00138 //Muc 00139 double pMx = extTrackRoot->GetMucPositionX(iPart) ; 00140 double pMy = extTrackRoot->GetMucPositionY(iPart) ; 00141 double pMz = extTrackRoot->GetMucPositionZ(iPart) ; 00142 double mMx = extTrackRoot->GetMucMomentumX(iPart) ; 00143 double mMy = extTrackRoot->GetMucMomentumY(iPart) ; 00144 double mMz = extTrackRoot->GetMucMomentumZ(iPart); 00145 Hep3Vector Mp(pMx,pMy,pMz); 00146 Hep3Vector Mm(mMx,mMy,mMz); 00147 00148 string vMs = extTrackRoot->GetMucVolumeName(iPart).Data(); 00149 int vMn = extTrackRoot->GetMucVolumeNumber(iPart) ; 00150 00151 double zM = extTrackRoot->GetMucPosSigmaAlongZ(iPart) ; 00152 double tM = extTrackRoot->GetMucPosSigmaAlongT(iPart); 00153 double xM = extTrackRoot->GetMucPosSigmaAlongX(iPart); 00154 double yM = extTrackRoot->GetMucPosSigmaAlongY(iPart); 00155 HepSymMatrix eMm(6) ; 00156 for (int i = 0;i<6 ;i++ ) 00157 for (int j= 0;j<6 ;j++ ) 00158 eMm[i][j]= extTrackRoot->GetMucErrorMatrix(i,j,iPart) ; 00159 00160 00161 //ExtMucHitVec 00162 int size = extTrackRoot->GetSize(iPart); 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 00174 for(int i =0;i<size;i++){ 00175 double px = extTrackRoot->GetPositionX(i,iPart) ; 00176 double py = extTrackRoot->GetPositionY(i,iPart) ; 00177 double pz = extTrackRoot->GetPositionZ(i,iPart) ; 00178 Hep3Vector p(px,py,pz); 00179 double mx = extTrackRoot->GetMomentumX(i,iPart) ; 00180 double my = extTrackRoot->GetMomentumY(i,iPart) ; 00181 double mz = extTrackRoot->GetMomentumZ(i,iPart); 00182 Hep3Vector m(mx,my,mz); 00183 vs = extTrackRoot->GetVolumeName(i,iPart).Data(); 00184 vn = extTrackRoot->GetVolumeNumber(i,iPart) ; 00185 z = extTrackRoot->GetPosSigmaAlongZ(i,iPart) ; 00186 t = extTrackRoot->GetPosSigmaAlongT(i,iPart); 00187 x = extTrackRoot->GetPosSigmaAlongX(i,iPart); 00188 y = extTrackRoot->GetPosSigmaAlongY(i,iPart); 00189 std::vector<double> vecError = extTrackRoot->GetErrorMatrix(i,iPart); 00190 for(int k =0;k<6;k++){ 00191 for(int j =0; j<6;j++){ 00192 matrix[k][j] = vecError[k*6+j]; 00193 } 00194 } 00195 aExtMucHit.SetExtMucHit(p,m,vs,vn,matrix,z,t,x,y); 00196 extTrackTds->AddExtMucHit(aExtMucHit); 00197 } 00198 00199 // DstExtTrack *extTrackTds = new DstExtTrack(); 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 extTrackTds->SetParType(2);// default particle: pion 00213 } 00214 //m_extTrackCol->Delete(); // wensp add 2005/12/30 00215 delete m_extTrackCol; 00216 m_extTrackCol = 0; 00217 00218 00219 return StatusCode::SUCCESS; 00220 }
|
|
|
|
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
|