| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

OnXSvc Namespace Reference


Functions

 OnXSvc (const std::string &aName, ISvcLocator *aSvcLoc)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
 ~OnXSvc ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
StatusCode queryInterface (const InterfaceID &aRIID, void **aPPVIF)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
StatusCode initialize ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
StatusCode finalize ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
StatusCode run ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
SoPage * currentSoPage ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
SoRegion * currentSoRegion ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
IWidget * currentWidget ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
Slash::Data::IProcessor * typeManager ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
Slash::Data::IAccessor * metaType ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void setSession (Slash::Core::ISession *aSession)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
ISession * session ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void nextEvent ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void eventInfo ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
StatusCode visualize (const DataObject &aDataObject)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
StatusCode visualize (const AIDA::IHistogram &aHistogram)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
IDataProviderSvcdataProvider (const std::string &aPath)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
StatusCode visualize (const std::string &aWhat)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
std::vector< std::string > dataChildren (const std::string &aPath)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
bool ls (IDataProviderSvc *aDataSvc, SmartIF< IDataManagerSvc > &aDataManagerSvc, SmartDataPtr< DataObject > &aDataObject, MsgStream &aLog, int aWantedDepth, int &aDepth)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void ls (const std::string &aPath, int aDepth)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void clearDetectorStore ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
StatusCode changeGeometry (const std::string &file)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
StatusCode changeColors (const std::string &file)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void openEventFile (const std::string &aFile)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
bool visitToXML (IDataProviderSvc *aDataSvc, SmartIF< IDataManagerSvc > &aDataManagerSvc, SmartDataPtr< DataObject > &aDataObject, std::string &aOut)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
bool writeToString (const std::string &aPath, std::string &aOut)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void addType (Slash::Data::IAccessor *aType)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
IServicegetService (const std::string &aName)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
const std::string & cuts () const
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
Slash::Core::IWriter & printer ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
std::string torgb (const std::string &aColor)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void * topointer (const std::string &aValue) const
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
IAppMgrUIappMgr () const
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
Slash::UI::IUI * findUI ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
StatusCode visualize (const Gaudi::XYZPoint &aData)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
StatusCode visualize (const std::vector< Gaudi::XYZPoint > &aData, RepType aType)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
std::vector< std::string > getHighlightedSoShapeNames ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
std::vector< ContainedObject * > getHighlightedContainedObject ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Function Documentation

OnXSvc::OnXSvc ( const std::string &  aName,
ISvcLocator aSvcLoc 
)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 109 of file OnXSvc.cpp.

00113 :Service(aName,aSvcLoc)
00114 ,fAppMgrUI(0)
00115 ,fSoCnvSvc(0)
00116 ,fEventDataSvc(0)
00117 ,fDetectorDataSvc(0) 
00118 ,fHistogramSvc(0)
00119 ,fSession(0)
00120 ,fThreaded(false)
00121 ,fToolkit("NATIVE")
00122 ,fFile("$ONXFILE")
00123 ,fVerboseLevel(0)
00124 ,fOutputToTerminal(false)
00125 ,fLog(0)
00126 ,fOnXMain(0)
00127 ,fTypeManager(0)
00128 ,fMetaType(0)
00129 ,fLibPrinter(0)
00130 ,fGaudiPrinter(0)
00133 {
00134   declareProperty("Threaded",fThreaded);
00135   declareProperty("Toolkit",fToolkit);
00136   declareProperty("File",fFile);
00137   declareProperty("VerboseLevel",fVerboseLevel);
00138   declareProperty("OutputToTerminal",fOutputToTerminal);
00139   // Create a default printer. The printer() method may be called
00140   // before the service is initialized (through the declaration of types).
00141   fLibPrinter = new Lib::Printer();
00142 }

OnXSvc::~OnXSvc (  ) 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 144 of file OnXSvc.cpp.

00148 { 
00149 }

StatusCode OnXSvc::queryInterface ( const InterfaceID aRIID,
void **  aPPVIF 
)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 151 of file OnXSvc.cpp.

00157 {
00158   if (aRIID==IRunable::interfaceID())   {
00159     *aPPVIF = static_cast<IRunable*>(this);
00160     addRef();
00161     return StatusCode::SUCCESS;
00162   } else if(aRIID==IUserInterfaceSvc::interfaceID()) {
00163     *aPPVIF = static_cast<IUserInterfaceSvc*>(this);
00164     addRef();
00165     return StatusCode::SUCCESS;
00166   } else {
00167     return Service::queryInterface(aRIID, aPPVIF);
00168   }
00169 }

StatusCode OnXSvc::initialize (  ) 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 171 of file OnXSvc.cpp.

00175 {
00176   StatusCode status = Service::initialize();
00177   if( status.isFailure() ) return status;
00178 
00179   fLog = new MsgStream(messageService(), Service::name());
00180 
00181   fGaudiPrinter = new Printer(*fLog);
00182 
00183   MsgStream log(messageService(), Service::name());
00184 
00185   log << MSG::INFO << "OnXSvc::initialize " << endreq;
00186 
00187   setProperties();
00188 
00189   if(!serviceLocator()) {
00190     log << MSG::INFO << "Service locator not found " << endreq;
00191     return StatusCode::FAILURE;
00192   }
00193 
00194   if(fAppMgrUI) {
00195     fAppMgrUI->release();
00196     fAppMgrUI = 0;
00197   }
00198   status = serviceLocator()->service("ApplicationMgr",fAppMgrUI);
00199   if( status.isFailure() || !fAppMgrUI) {
00200     log << MSG::INFO << "ApplicationMgr not found " << endreq;
00201     return StatusCode::FAILURE;
00202   }
00203   fAppMgrUI->addRef();
00204 
00205   // Dynamic load OnX GUI driver :
00206   if(fToolkit=="NONE") {
00207     log << MSG::INFO << "GUI toolkit NONE." << endreq;
00208   } else {
00209     Lib::Arguments gaudi_args(System::cmdLineArgs());
00210 
00211     //args relevant to OnX::Main :
00212     Lib::Arguments args;
00213    {std::string key = "-debug_check_class";
00214     if(gaudi_args.isAnArgument(key)) {
00215       std::string value;
00216       gaudi_args.find(key,value);
00217       args.add(key,value);
00218     }}
00219    {std::string key = "-Qt";
00220     if(gaudi_args.isAnArgument(key)) {
00221       std::string value;
00222       gaudi_args.find(key,value);
00223       args.add(key,value);
00224     }}
00225         
00226     fOnXMain = new OnX::Main(false,false,args.tovector());
00227     if(!fOnXMain->isValid()) {
00228       log << MSG::INFO << "Can't create a valid OnX::Main" << endreq;
00229       delete fOnXMain;
00230       fOnXMain = 0;
00231       return StatusCode::FAILURE;
00232     }
00233 
00234     // Do the below also if fThreaded ?
00235     // Have a property to control the below ?
00236     if(!fOnXMain->loadInterpreter("Python")) {
00237       // Not fatal.
00238       log << MSG::INFO << "Can't load the OnX Python module." << endreq;
00239     }
00240 
00241     //#601 ISession* session = fOnXMain->session();
00242     ISession* session = fOnXMain;
00243     if(!session) {
00244       log << MSG::INFO << "OnX::Main don't have a ISession." << endreq;
00245       delete fOnXMain;
00246       fOnXMain = 0;
00247       return StatusCode::FAILURE;
00248     }
00249 
00250     if(fOutputToTerminal) session->setParameter("session.output","terminal");
00251 
00252     session->setParameter("UI_Manager.thread",fThreaded?"true":"false");
00253 
00254     setSession(session);
00255 
00256     std::string driver;
00257     if(fToolkit=="NATIVE") {
00258       driver = ""; //Let OnX decide. Decided also from program (argc,argv).
00259     } else {
00260       driver = fToolkit;
00261     }
00262 
00263     log << MSG::INFO << "GUI toolkit " << driver << "." << endreq;
00264     log << MSG::INFO << "OnX GUI file " << fFile << "." << endreq;
00265 
00266     if(fOnXMain->createUI(driver,fFile,true)) {
00267       log << MSG::INFO << "GUI created." << endreq;
00268     } else {
00269       log << MSG::INFO << "GUI creation failed." << endreq;
00270       delete fOnXMain;
00271       fOnXMain = 0;
00272       fSession = 0;
00273       return StatusCode::FAILURE;
00274     }
00275   }
00276 
00277   return status;
00278 }

StatusCode OnXSvc::finalize (  ) 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 280 of file OnXSvc.cpp.

00284 {
00285   if(fAppMgrUI) {
00286     fAppMgrUI->release();
00287     fAppMgrUI = 0;
00288   }
00289   if(fSoCnvSvc) {
00290     fSoCnvSvc->release();
00291     fSoCnvSvc = 0;
00292   }
00293   if(fEventDataSvc) {
00294     fEventDataSvc->release();
00295     fEventDataSvc = 0;
00296   }
00297   if(fDetectorDataSvc) {
00298     fDetectorDataSvc->release();
00299     fDetectorDataSvc = 0;
00300   }
00301   if(fHistogramSvc) {
00302     fHistogramSvc->release();
00303     fHistogramSvc = 0;
00304   }
00305 
00306   MsgStream log(messageService(), Service::name());
00307   log << MSG::INFO << "OnXSvc finalizing..." << endreq;
00308 
00309   delete fOnXMain;
00310   fOnXMain = 0;
00311   fSession = 0;
00312 
00313   delete fGaudiPrinter;
00314   fGaudiPrinter = 0;
00315   delete fLibPrinter;
00316   fLibPrinter = 0;
00317   delete fLog;
00318   fLog = 0;
00319 
00320   log << MSG::INFO << "OnXSvc finalized successfully" << endreq;
00321 
00322   return StatusCode::SUCCESS;
00323 }

StatusCode OnXSvc::run (  ) 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 325 of file OnXSvc.cpp.

00330 {
00331   MsgStream log(messageService(), Service::name());
00332   if(!fSession) {
00333     log << MSG::INFO << "No ISession given " << endreq;
00334     return StatusCode::FAILURE;
00335   }
00336   IUI* ui = findUI();
00337   if(!ui) return StatusCode::FAILURE;
00338   log << MSG::INFO << "Enter in GUI toolkit mainloop... " << endreq;
00339   ui->steer();
00340   log << MSG::INFO << "GUI toolkit mainloop exited. " << endreq;
00341   return StatusCode::SUCCESS;
00342 }

SoPage* OnXSvc::currentSoPage (  ) 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 344 of file OnXSvc.cpp.

00348 {
00349   if(!fSession) {
00350     MsgStream log(messageService(), Service::name());
00351     log << MSG::INFO << "No ISession given " << endreq;
00352     return 0;
00353   }
00354   IUI* ui = findUI();
00355   if(!ui) return 0;
00356   return ui_SoPage(*ui);
00357 }

SoRegion* OnXSvc::currentSoRegion (  ) 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 359 of file OnXSvc.cpp.

00363 {
00364   SoPage* soPage = currentSoPage();
00365   if(!soPage) {
00366     MsgStream log(messageService(), Service::name());
00367     log << MSG::INFO << "SoPage not found " << endreq;
00368     return 0;
00369   }
00370   return page_currentRegion(*soPage);
00371 }

IWidget* OnXSvc::currentWidget (  ) 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 373 of file OnXSvc.cpp.

00377 {
00378   if(!fSession) {
00379     MsgStream log(messageService(), Service::name());
00380     log << MSG::INFO << "No ISession given " << endreq;
00381     return 0;
00382   }
00383   IUI* ui = findUI();
00384   if(!ui) return 0;
00385   return ui->currentWidget();
00386 }

Slash::Data::IProcessor* OnXSvc::typeManager (  ) 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 388 of file OnXSvc.cpp.

00392 {
00393   return fTypeManager;
00394 }

Slash::Data::IAccessor* OnXSvc::metaType (  ) 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 396 of file OnXSvc.cpp.

00400 {
00401   return fMetaType;
00402 }

void OnXSvc::setSession ( Slash::Core::ISession *  aSession  ) 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 406 of file OnXSvc.cpp.

00413 {
00414   if(fSession) return; //done.
00415   if(!aSession) return;
00416   fSession = aSession;
00417   
00418   fSession->addManager(new SvcLocatorManager(serviceLocator()));
00419 
00420   fTypeManager = 
00421     Lib_findManager(*fSession,"AccessorManager",Slash::Data::IProcessor);
00422 
00423   if(fTypeManager) {
00424     std::vector<Slash::Data::IAccessor*>::const_iterator it;
00425     for(it=fTypes.begin(); it!=fTypes.end(); it++) {
00426       fTypeManager->addAccessor(*it);
00427     }
00428     fTypes.clear();
00429 
00430     /*
00431     IIntrospectionSvc* introspectionSvc = 0;
00432     serviceLocator()->service("IntrospectionSvc",introspectionSvc);
00433     if(!introspectionSvc) {
00434       MsgStream log(messageService(), Service::name());
00435       log << MSG::INFO << "IntrospectionSvc not found " << endreq;
00436     }
00437     
00438     if(introspectionSvc) {
00439       fMetaType = new MetaType(fSession->printer(),introspectionSvc);
00440       fTypeManager->addType(fMetaType);
00441     }
00442     */
00443   }
00444 
00445 }

ISession* OnXSvc::session (  ) 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 447 of file OnXSvc.cpp.

00451 {
00452   return fSession;
00453 }

void OnXSvc::nextEvent (  ) 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 455 of file OnXSvc.cpp.

00459 {
00460   if(!fAppMgrUI) return;
00461   fAppMgrUI->nextEvent(1);
00462 }

void OnXSvc::eventInfo (  ) 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 464 of file OnXSvc.cpp.

00468 {
00469   MsgStream log(messageService(), Service::name());
00470 
00471   if(!fSession) {
00472     log << MSG::INFO << "No ISession given " << endreq;
00473     return;
00474   }
00475 
00476   if(!fEventDataSvc) {
00477     StatusCode status = service("EventDataSvc",fEventDataSvc,true);
00478     if(status.isFailure() || !fEventDataSvc) {
00479       log << MSG::INFO << "EventDataSvc not found " << endreq;
00480       return;
00481     }
00482     fEventDataSvc->addRef();
00483   }
00484 
00485   //SmartDataPtr<DataObject> smartDataObject(fEventDataSvc,"/Event");
00486   //if(smartDataObject) {}
00487 
00488   DataObject* dataObject;
00489   StatusCode sc = fEventDataSvc->retrieveObject("/Event", dataObject);
00490   if(!sc.isSuccess()) {
00491     log << MSG::ERROR << "Unable to retrieve /Event " << endreq;
00492     return;
00493   }
00494   if(!dataObject) {
00495     log << MSG::ERROR << "Unable to retrieve /Event " << endreq;
00496     return;
00497   }
00498 
00499   //Event* event = dynamic_cast<Event*>(dataObject);
00500   //if(!event) return;
00501   //fSession->out().println("run %d event %d ",event->run(),event->event());
00502 }

StatusCode OnXSvc::visualize ( const DataObject aDataObject  ) 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 504 of file OnXSvc.cpp.

00509 {
00510   MsgStream log(messageService(), Service::name());
00511 
00512   log << MSG::INFO << " visualize DataObject... " << endreq;
00513 
00514   if(!fSoCnvSvc) {
00515     StatusCode status = service("SoConversionSvc",fSoCnvSvc,true);
00516     if(status.isFailure() || !fSoCnvSvc) {
00517       log << MSG::INFO << "SoConversionSvc not found " << endreq;
00518       return StatusCode::FAILURE;
00519     }
00520     fSoCnvSvc->addRef();
00521   }
00522 
00523   try {
00524     IOpaqueAddress* addr = 0;
00525     fCuts = "";
00526     StatusCode sc = fSoCnvSvc->createRep ((DataObject*)&aDataObject, addr);
00527     fCuts = "";
00528     if (sc.isSuccess()) 
00529       sc = fSoCnvSvc->fillRepRefs(addr,(DataObject*)&aDataObject);
00530     if (sc.isFailure()) {
00531       log << MSG::WARNING 
00532           << "Error creating graphical representations" 
00533           << endreq;
00534       return sc;
00535     }
00536   } catch (GaudiException e) {
00537     fCuts = "";
00538     log << MSG::ERROR 
00539         << "Unable to create graphical representation, received exception :";
00540     e.printOut(log);
00541     log << endreq;
00542     return StatusCode::FAILURE;
00543   }
00544 
00545   return StatusCode::SUCCESS;
00546 }

StatusCode OnXSvc::visualize ( const AIDA::IHistogram &  aHistogram  ) 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 548 of file OnXSvc.cpp.

00553 {
00554   MsgStream log(messageService(), Service::name());
00555 
00556   const DataObject* dataObject = dynamic_cast<const DataObject*>(&aHistogram);
00557   if(!dataObject) {
00558     log << MSG::ERROR << "histogram not a DataObject." << endreq;
00559     return StatusCode::FAILURE;
00560   }
00561 
00562   return visualize(*dataObject);
00563 }

IDataProviderSvc* OnXSvc::dataProvider ( const std::string &  aPath  ) 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 565 of file OnXSvc.cpp.

00568 {
00569   MsgStream log(messageService(), Service::name());
00570   if(aPath.find_first_of("E", 1) == 1) {
00571     if(!fEventDataSvc) {
00572       StatusCode status = service("EventDataSvc",fEventDataSvc,true);
00573       if(status.isFailure() || !fEventDataSvc) {
00574         log << MSG::INFO << "EventDataSvc not found " << endreq;
00575         return 0;
00576       }
00577       fEventDataSvc->addRef();
00578     }
00579     return fEventDataSvc;
00580   } else if( aPath.find_first_of("d", 1) == 1) {
00581     if(!fDetectorDataSvc) {
00582       StatusCode status = service("DetectorDataSvc",fDetectorDataSvc,true);
00583       if(status.isFailure() || !fDetectorDataSvc) {
00584         log << MSG::INFO << "DetectorDataSvc not found " << endreq;
00585         return 0;
00586       }
00587       fDetectorDataSvc->addRef();
00588     }
00589     return fDetectorDataSvc;
00590   } else if(aPath.find_first_of("s",1)==1) {
00591     if(!fHistogramSvc) {
00592       StatusCode status = service("HistogramDataSvc",fHistogramSvc,true);
00593       if(status.isFailure() || !fHistogramSvc) {
00594         log << MSG::INFO << "HistogramDataSvc not found " << endreq;
00595         return 0;
00596       }
00597       fHistogramSvc->addRef();
00598     }
00599     return fHistogramSvc;
00600   } else {
00601     log << MSG::INFO 
00602         << "Data service not found for \"" << aPath << "\"." 
00603         << endreq;
00604     return 0;
00605   }
00606 }  

StatusCode OnXSvc::visualize ( const std::string &  aWhat  ) 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 608 of file OnXSvc.cpp.

00613 {
00614   MsgStream log(messageService(), Service::name());
00615 
00616   if(!fSoCnvSvc) {
00617     StatusCode status = service("SoConversionSvc",fSoCnvSvc,true);
00618     if(status.isFailure() || !fSoCnvSvc) {
00619       log << MSG::INFO << "SoConversionSvc not found " << endreq;
00620       return StatusCode::FAILURE;
00621     }
00622     fSoCnvSvc->addRef();
00623   }
00624 
00625   StatusCode sc = StatusCode::FAILURE;
00626 
00627   std::string path = aWhat;
00628   std::string cuts;
00629 
00630   std::string::size_type sp;
00631   if((sp=aWhat.find(' '))!=std::string::npos){
00632     path = aWhat.substr(0,sp);
00633     cuts = aWhat.substr(sp+1,aWhat.size()-(sp+1));
00634   }
00635   log << MSG::INFO << "Path \"" << path << "\"" << endreq;
00636   log << MSG::INFO << "Cuts \"" << cuts << "\"" << endreq;
00637 
00638   IDataProviderSvc* dataSvc = dataProvider(path);
00639   if(!dataSvc) return StatusCode::FAILURE;
00640 
00641   DataObject* dataObject = 0;
00642   sc = dataSvc->retrieveObject(path, dataObject);
00643   if(!sc.isSuccess()) {
00644     log << MSG::ERROR << "Unable to retrieve " << path << endreq;
00645     return sc;
00646   }
00647   if(!dataObject) {
00648     log << MSG::ERROR << "Unable to retrieve " << path << endreq;
00649     return StatusCode::FAILURE;
00650   }
00651 
00652   try {
00653     IOpaqueAddress* addr = 0;
00654     fCuts = cuts;
00655     sc = fSoCnvSvc->createRep(dataObject,addr);
00656     fCuts = "";
00657     if (sc.isSuccess()) sc = fSoCnvSvc->fillRepRefs(addr,dataObject); 
00658     if (sc.isFailure()) {
00659       log << MSG::WARNING 
00660           << "Error creating graphical representations" << endreq;
00661       return sc;
00662     } 
00663   } catch (GaudiException e) {
00664     fCuts = "";
00665     log << MSG::ERROR << "Unable to convert : " 
00666         << path << endreq;
00667     return StatusCode::FAILURE;
00668   }
00669 
00670   return StatusCode::SUCCESS;  
00671 }

std::vector<std::string> OnXSvc::dataChildren ( const std::string &  aPath  ) 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 675 of file OnXSvc.cpp.

00678 {
00679   MsgStream log(messageService(), Service::name());
00680 
00681   std::vector<std::string> text;
00682 
00683   IDataProviderSvc* dataSvc = dataProvider(aPath);
00684   if(!dataSvc) return text;
00685   SmartIF<IDataManagerSvc> dataManagerSvc(dataSvc);
00686   if(dataManagerSvc==0) {
00687     log << MSG::ERROR 
00688         << "Unable to get DataManager interface." 
00689         << endreq;
00690     return text;
00691   }
00692   
00693   SmartDataPtr<DataObject> dataObject(dataSvc,aPath);
00694   if(dataObject==0) {
00695     log << MSG::ERROR 
00696         << "Can't get \"" << aPath << "\"." 
00697         << endreq;
00698     return text;
00699   }
00700 
00701   std::vector<IRegistry*> children;
00702   dataManagerSvc->objectLeaves(dataObject->registry(),children);
00703   std::vector<IRegistry*>::iterator it;
00704   for (it = children.begin();it != children.end();it++) {
00705     text.push_back((*it)->identifier());
00706   }
00707 
00708   return text;
00709 }

bool OnXSvc::ls ( IDataProviderSvc aDataSvc,
SmartIF< IDataManagerSvc > &  aDataManagerSvc,
SmartDataPtr< DataObject > &  aDataObject,
MsgStream aLog,
int  aWantedDepth,
int &  aDepth 
)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 713 of file OnXSvc.cpp.

00723 {
00724   if((aWantedDepth!=-1)&&(aDepth>=aWantedDepth)) return true;
00725 
00726   std::vector<IRegistry*> children;
00727   aDataManagerSvc->objectLeaves(aDataObject->registry(),children);
00728   std::vector<IRegistry*>::iterator it;
00729   for (it = children.begin();it != children.end();it++) {
00730     try {
00731 
00732       aLog << MSG::INFO << (*it)->identifier() << endreq;
00733       SmartDataPtr<DataObject> obj(aDataSvc,(*it));
00734 
00735       if(obj) { // To compell loading of things in the sub directory.
00736         aDepth++;
00737         if(!ls(aDataSvc,aDataManagerSvc,obj,aLog,aWantedDepth,aDepth)) 
00738           return false;
00739         aDepth--;
00740       } else {
00741         aLog << MSG::ERROR 
00742              << "Unable to load \"" << (*it)->identifier() << "\"." << endreq;
00743       }
00744 
00745     } catch (GaudiException e) {
00746       aLog << MSG::ERROR 
00747            << "Unable to load \"" << (*it)->identifier() << "\"." << endreq;
00748       return false;
00749     }
00750 
00751   }
00752 
00753   return true; //continue;
00754 }

void OnXSvc::ls ( const std::string &  aPath,
int  aDepth 
)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 756 of file OnXSvc.cpp.

00762 {
00763   MsgStream log(messageService(), Service::name());
00764 
00765   IDataProviderSvc* dataSvc = dataProvider(aPath);
00766   if(!dataSvc) return;
00767   SmartIF<IDataManagerSvc> dataManagerSvc(dataSvc);
00768   if (dataManagerSvc==0) {
00769     log << MSG::ERROR 
00770         << "Unable to get DataManager interface " 
00771         << endreq;
00772     return;
00773   }
00774 
00775   SmartDataPtr<DataObject> dataObject(dataSvc,aPath);
00776   if(dataObject==0) {
00777     log << MSG::ERROR 
00778         << "Can't get \"" << aPath << "\"." 
00779         << endreq;
00780     return;
00781   }
00782 
00783   log << MSG::INFO << aPath << endreq;
00784 
00785   int depth = 0;
00786   ls(dataSvc,dataManagerSvc,dataObject,log,aDepth,depth);
00787 }

void OnXSvc::clearDetectorStore (  ) 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 791 of file OnXSvc.cpp.

00795 {
00796   MsgStream log(messageService(), Service::name());
00797 
00798   if(!fDetectorDataSvc) {
00799     StatusCode status = service("DetectorDataSvc",fDetectorDataSvc,true);
00800     if(status.isFailure() || !fDetectorDataSvc) {
00801       log << MSG::INFO << "DetectorDataSvc not found " << endreq;
00802       return;
00803     }
00804     fDetectorDataSvc->addRef();
00805   }
00806 
00807   SmartIF<IDataManagerSvc> dm(fDetectorDataSvc);
00808   if(dm==0) {
00809     log << MSG::ERROR << "No DataManagerSvc. Store not cleared." << endreq;
00810     return;
00811   }
00812 
00813   IXmlSvc* xs = 0;
00814   service ("XmlCnvSvc", xs);
00815   if(!xs) {
00816     log << MSG::ERROR << "No XmlCnvSvc. Store not cleared." << endreq;
00817     return;
00818   }
00819 
00820   IVisualizationSvc* vs = 0;
00821   service ("VisualizationSvc", vs);
00822   if(!vs) {
00823     log << MSG::WARNING
00824         << "No VisualizationSvc. Visualization attributes not reloaded."
00825         << endreq;
00826     return;
00827   }
00828 
00829   StatusCode sc = dm->clearStore();
00830   if (!sc.isSuccess()) {
00831     log << MSG::ERROR << "Unable to clear store !!!" << endreq;
00832     return;
00833   }
00834   xs->clearCache();
00835   vs->reload();
00836 }

StatusCode OnXSvc::changeGeometry ( const std::string &  file  ) 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 838 of file OnXSvc.cpp.

00841 {
00842   MsgStream log(messageService(), Service::name());
00843 
00844   // Change some properties
00845   IProperty* pdm = 0;
00846   service ("DetectorDataSvc", pdm);
00847   if(!pdm) {
00848     log << MSG::ERROR
00849         << "No DetectorDataSvc found (Looking for IProperty Interface)."
00850         << endreq;
00851     return StatusCode::FAILURE;
00852   }
00853   pdm->setProperty("DetDbLocation", file);
00854 
00855   // Now Reinitialize services
00856   IService* dm = 0;
00857   service ("DetectorDataSvc", dm);
00858   if(!dm) {
00859     log << MSG::ERROR << "No DetectorDataSvc found." << endreq;
00860     return StatusCode::FAILURE;
00861   }
00862 
00863   IService* xs = 0;
00864   service ("XmlCnvSvc", xs);
00865   if(!xs) {
00866     log << MSG::ERROR << "No XmlCnvSvc found." << endreq;
00867     return StatusCode::FAILURE;
00868   }
00869 
00870   StatusCode sc = dm->reinitialize();
00871   if (!sc.isSuccess()) {
00872     log << MSG::ERROR << "Unable to reinitialize DetectorDataSvc !" << endreq;
00873     return sc;
00874   }
00875   sc = xs->reinitialize();
00876   if (!sc.isSuccess()) {
00877     log << MSG::ERROR << "Unable to reinitialize XmlCnvSvc !" << endreq;
00878     return sc;
00879   }
00880   return StatusCode::SUCCESS;
00881 }

StatusCode OnXSvc::changeColors ( const std::string &  file  ) 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 883 of file OnXSvc.cpp.

00886 {
00887   MsgStream log(messageService(), Service::name());
00888 
00889   // Change some properties
00890   IProperty* pvs = 0;
00891   service ("VisualizationSvc", pvs);
00892   if(!pvs) {
00893     log << MSG::ERROR
00894         << "No VisualizationSvc found (Looking for IProperty Interface)."
00895         << endreq;
00896     return StatusCode::FAILURE;
00897   }
00898   pvs->setProperty("ColorDbLocation", file);
00899 
00900   // Now Reinitialize services
00901   IService* vs = 0;
00902   service ("VisualizationSvc", vs);
00903   if(!vs) {
00904     log << MSG::WARNING << "No VisualizationSvc found." << endreq;
00905     return StatusCode::FAILURE;
00906   }
00907 
00908   StatusCode sc = vs->reinitialize();
00909   if (!sc.isSuccess()) {
00910     log << MSG::ERROR << "Unable to reinitialize VisualizationSvc !" << endreq;
00911     return sc;
00912   }
00913   return StatusCode::SUCCESS;
00914 }

void OnXSvc::openEventFile ( const std::string &  aFile  ) 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 916 of file OnXSvc.cpp.

00921 {
00922   if(aFile=="") return;
00923 
00924   MsgStream log(messageService(), Service::name());
00925 
00926   log << MSG::INFO << "Try to open " << aFile << "..." << endreq;
00927 
00928   IEvtSelector* eventSelector = 0;
00929   StatusCode status = service("EventSelector",eventSelector,true);
00930   if(status.isFailure() || !eventSelector) {
00931     log << MSG::INFO << "EventSelector not found " << endreq;
00932     return;
00933     //return StatusCode::FAILURE;
00934   }
00935   eventSelector->addRef();
00936 
00937   SmartIF<IProperty> prp(eventSelector);
00938   std::string prop = 
00939     std::string("[\"DATAFILE='") + aFile + "' TYP='ROOT' OPT='READ'\"]";
00940 
00941   prp->setProperty("Input",prop);
00942   SmartIF<IService> prp2(eventSelector);
00943   prp2->reinitialize();
00944   
00945   eventSelector->release();
00946 
00947   IService* eventLoopMgr = 0;
00948   status = service("EventLoopMgr",eventLoopMgr,true);
00949   if(status.isFailure() || !eventLoopMgr) {
00950     log << MSG::INFO << "EventLoopMgr not found " << endreq;
00951     return;
00952   }
00953   eventLoopMgr->addRef();
00954   eventLoopMgr->reinitialize();
00955   eventLoopMgr->release();
00956 }

bool OnXSvc::visitToXML ( IDataProviderSvc aDataSvc,
SmartIF< IDataManagerSvc > &  aDataManagerSvc,
SmartDataPtr< DataObject > &  aDataObject,
std::string &  aOut 
)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 960 of file OnXSvc.cpp.

00968 {
00969   std::vector<IRegistry*> children;
00970   aDataManagerSvc->objectLeaves(aDataObject->registry(), children);
00971   std::vector<IRegistry*>::iterator it;
00972   for(it=children.begin();it != children.end();it++) {
00973 
00974     std::string path = (*it)->identifier();
00975     std::string name = path;
00976    {std::string::size_type pos = path.find_last_of("/");
00977     if(pos!=std::string::npos) name = path.substr(pos+1,path.size()-pos);}
00978 
00979     aOut +=  "<treeItem><label>" + name + "</label>";
00980 
00981     try {
00982 
00983       SmartDataPtr<DataObject> obj(aDataSvc,(*it));
00984       if(obj) { // To compell loading of things in the sub directory.
00985         if(!visitToXML(aDataSvc,aDataManagerSvc,obj,aOut)) {
00986           aOut = "";
00987           return false;
00988         }
00989       } else {
00990         MsgStream log(messageService(), Service::name());
00991         log << MSG::ERROR 
00992             << "Unable to load \"" << (*it)->identifier() << "\"." 
00993             << endreq;
00994       }
00995 
00996     } catch (GaudiException e) {
00997       MsgStream log(messageService(), Service::name());
00998       log << MSG::ERROR 
00999           << "Unable to load \"" << (*it)->identifier() << "\"." 
01000           << endreq;
01001       aOut = "";
01002       return false;
01003     }
01004 
01005     aOut += "</treeItem>";
01006   }
01007 
01008   return true;
01009 }

bool OnXSvc::writeToString ( const std::string &  aPath,
std::string &  aOut 
)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 1011 of file OnXSvc.cpp.

01017 {
01018   aOut = "";
01019   if(!fSession) return false;
01020   MsgStream log(messageService(), Service::name());
01021 
01022   IDataProviderSvc* dataSvc = dataProvider(aPath);
01023   if(!dataSvc) return false;
01024   SmartIF<IDataManagerSvc> dataManagerSvc(dataSvc);
01025   if (dataManagerSvc==0) {
01026     log << MSG::ERROR 
01027         << "Unable to get DataManager interface " 
01028         << endreq;
01029     return false;
01030   }
01031 
01032   SmartDataPtr<DataObject> dataObject(dataSvc,aPath);
01033   if(dataObject==0) {
01034     log << MSG::ERROR 
01035         << "Can't get \"" << aPath << "\"." 
01036         << endreq;
01037     return false;
01038   }
01039 
01040   aOut = "<tree>";
01041 
01042   std::string name = aPath;
01043  {std::string::size_type pos = aPath.find_last_of("/");
01044   if(pos!=std::string::npos) name = aPath.substr(pos+1,aPath.size()-pos);}
01045   aOut +=  "<treeItem><label>" + name + "</label>";
01046 
01047   if(!visitToXML(dataSvc,dataManagerSvc,dataObject,aOut)) return false;
01048 
01049   aOut += "</treeItem>";
01050   aOut += "</tree>";
01051   return true;
01052 }

void OnXSvc::addType ( Slash::Data::IAccessor *  aType  ) 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 1056 of file OnXSvc.cpp.

01061 {
01062   if(!aType) return;
01063   if(!fSession) { 
01064     // Session not yet set, store types in a temporary list.
01065     fTypes.push_back(aType);
01066   } else {
01067     if(!fTypeManager) return; // Should never happen.
01068     fTypeManager->addAccessor(aType);
01069   }
01070 }

IService* OnXSvc::getService ( const std::string &  aName  ) 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 1072 of file OnXSvc.cpp.

01077 {
01078   MsgStream log(messageService(), Service::name());
01079   if(!serviceLocator()) {
01080     log << MSG::INFO << "service locator not found " << endreq;
01081     return 0;
01082   }
01083   IService* svc = 0;
01084   StatusCode status = serviceLocator()->service(aName,svc);
01085   if(status.isFailure() || !svc) {
01086     log << MSG::INFO << aName << " not found " << endreq;
01087     return 0;
01088   }
01089   return svc;
01090 }

const std::string& OnXSvc::cuts (  )  const

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 1092 of file OnXSvc.cpp.

01096 {
01097   return fCuts;
01098 }

Slash::Core::IWriter& OnXSvc::printer (  ) 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 1100 of file OnXSvc.cpp.

01104 {
01105   return fGaudiPrinter ? *fGaudiPrinter : *fLibPrinter;
01106 }

std::string OnXSvc::torgb ( const std::string &  aColor  ) 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 1109 of file OnXSvc.cpp.

01114 {
01115   double r,g,b;
01116   if(!Lib::smanip::torgb(aColor,r,g,b)) return "";
01117   std::string s;
01118   Lib::smanip::printf(s,128,"%g %g %g",r,g,b);
01119   return s;
01120 }

void* OnXSvc::topointer ( const std::string &  aValue  )  const

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 1122 of file OnXSvc.cpp.

01127 {
01128   void* p;
01129   Lib::smanip::topointer(aValue,p); 
01130   return p;
01131 }

IAppMgrUI* OnXSvc::appMgr (  )  const

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 1133 of file OnXSvc.cpp.

01137 {
01138   return fAppMgrUI;
01139 }

Slash::UI::IUI* OnXSvc::findUI (  ) 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 1141 of file OnXSvc.cpp.

01145 {
01146   if(!fSession) {
01147     MsgStream log(messageService(), Service::name());
01148     log << MSG::INFO << "No ISession given " << endreq;
01149     return 0;
01150   }
01151   Slash::UI::IUI_Manager* uiManager = 
01152     Lib_findManager(*fSession,"UI_Manager",Slash::UI::IUI_Manager);
01153   if(!uiManager) {
01154     MsgStream log(messageService(), Service::name());
01155     log << MSG::INFO << "UI manager not found " << endreq;
01156     return 0;
01157   }
01158   IUI* ui = uiManager->find("default");
01159   if(!ui) {
01160     MsgStream log(messageService(), Service::name());
01161     log << MSG::INFO << "UI not found " << endreq;
01162     return 0;
01163   }
01164   return ui;
01165 }

StatusCode OnXSvc::visualize ( const Gaudi::XYZPoint aData  ) 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 1202 of file OnXSvc.cpp.

01207 {
01208   MsgStream log(messageService(), Service::name());
01209   log << MSG::INFO << " visualize Gaudi::XYZPoint... " << endreq;
01210 
01211   SoRegion* region = currentSoRegion();
01212   if(!region) {
01213     log << MSG::INFO << " can't get viewing region." << endreq;
01214     return StatusCode::FAILURE; 
01215   }
01216 
01217   double r = 0.5, g = 0.5, b = 0.5;
01218   double hr = 1.0, hg = 1.0, hb = 0.0;
01219   std::string value;
01220   if(fSession->parameterValue("modeling.color",value))
01221     Lib::smanip::torgb(value,r,g,b);
01222   if(fSession->parameterValue("modeling.highlightColor",value))
01223     Lib::smanip::torgb(value,hr,hg,hb);
01224   // Non linear projections :
01225   fSession->parameterValue("modeling.projection",value);
01226   SoUtils::SbProjector projector(value.c_str());
01227 
01228   SbMarkerStyle mStyle = SbMarkerPlus;
01229   if(fSession->parameterValue("modeling.markerStyle",value))
01230     mStyle = SoTools_markerStyle(value);
01231   int mSize = 5;
01232   if(fSession->parameterValue("modeling.markerSize",value))
01233     if(!Lib::smanip::toint(value,mSize)) mSize = 5;
01234 
01235   SoSeparator* separator = new SoSeparator;
01236   separator->setName("sceneGraph");
01237 
01238   // Material :
01239   SoHighlightMaterial* highlightMaterial = new SoHighlightMaterial;
01240   highlightMaterial->setName("highlight");
01241   highlightMaterial->diffuseColor.setValue
01242     (SbColor(float(r),float(g),float(b)));
01243   highlightMaterial->highlightColor.setValue
01244     (SbColor(float(hr),float(hg),float(hb)));
01245   //highlightMaterial->transparency.setValue((float)transparency);
01246   separator->addChild(highlightMaterial);
01247 
01248   SbVec3f point;
01249   point.setValue((float)aData.x(), (float)aData.y(), (float)aData.z());
01250   projector.project(1,&point);
01251 
01252   SoTools::addPointsToNode(separator,1,&point,mStyle,mSize);
01253 
01254   //  Send scene graph to the viewing region
01255   // (in the "dynamic" sub-scene graph) :
01256   region_addToDynamicScene(*region,separator);
01257 
01258   return StatusCode::SUCCESS;
01259 }

StatusCode OnXSvc::visualize ( const std::vector< Gaudi::XYZPoint > &  aData,
RepType  aType 
)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 1261 of file OnXSvc.cpp.

01267 {
01268   MsgStream log(messageService(), Service::name());
01269   log << MSG::INFO << " visualize std::vector<Gaudi::XYZPoint>... " << endreq;
01270 
01271   if(!aData.size()) return StatusCode::SUCCESS; 
01272   if((aType==POLYGON)&&(aData.size()<=2)) return StatusCode::FAILURE; 
01273 
01274   SoRegion* region = currentSoRegion();
01275   if(!region) {
01276     log << MSG::INFO << " can't get viewing region." << endreq;
01277     return StatusCode::FAILURE; 
01278   }
01279 
01280   double r = 0.5, g = 0.5, b = 0.5;
01281   double hr = 1.0, hg = 1.0, hb = 0.0;
01282   std::string value;
01283   if(fSession->parameterValue("modeling.color",value))
01284     Lib::smanip::torgb(value,r,g,b);
01285   if(fSession->parameterValue("modeling.highlightColor",value))
01286     Lib::smanip::torgb(value,hr,hg,hb);
01287   // Non linear projections :
01288   fSession->parameterValue("modeling.projection",value);
01289   SoUtils::SbProjector projector(value.c_str());
01290 
01291   int pointn = aData.size();
01292   SbVec3f* points = new SbVec3f[pointn];
01293   for(int index=0;index<pointn;index++) {
01294     points[index].setValue
01295      ((float)aData[index].x(),(float)aData[index].y(),(float)aData[index].z());
01296   }
01297   projector.project(pointn,points);
01298 
01299   SoSeparator* separator = new SoSeparator;
01300   separator->setName("sceneGraph");
01301 
01302   // Material :
01303   SoHighlightMaterial* highlightMaterial = new SoHighlightMaterial;
01304   highlightMaterial->setName("highlight");
01305   highlightMaterial->diffuseColor.setValue
01306     (SbColor((float)r,(float)g,(float)b));
01307   highlightMaterial->highlightColor.setValue
01308     (SbColor((float)hr,(float)hg,(float)hb));
01309   //highlightMaterial->transparency.setValue((float)transparency);
01310   separator->addChild(highlightMaterial);
01311 
01312   switch(aType) {
01313   case POINTS: {
01314     SbMarkerStyle mStyle = SbMarkerPlus;
01315     if(fSession->parameterValue("modeling.markerStyle",value))
01316       mStyle = SoTools_markerStyle(value);
01317     int mSize = 5;
01318     if(fSession->parameterValue("modeling.markerSize",value))
01319       if(!Lib::smanip::toint(value,mSize)) mSize = 5;
01320     SoTools::addPointsToNode(separator,pointn,points,mStyle,mSize);
01321   }break;
01322   case LINES: {
01323     SoLightModel* lightModel = new SoLightModel;
01324     lightModel->model = SoLightModel::BASE_COLOR;
01325     separator->addChild(lightModel);
01326       
01327     SoDrawStyle* drawStyle = new SoDrawStyle;
01328     drawStyle->style.setValue(SoDrawStyle::LINES);
01329     drawStyle->linePattern.setValue(0xFFFF);
01330     separator->addChild(drawStyle);
01331       
01332     SoTools::addLinesToNode(separator,pointn,points);
01333   }break;
01334   case SEGMENTS: {
01335     SoLightModel* lightModel = new SoLightModel;
01336     lightModel->model = SoLightModel::BASE_COLOR;
01337     separator->addChild(lightModel);
01338       
01339     SoDrawStyle* drawStyle = new SoDrawStyle;
01340     drawStyle->style.setValue(SoDrawStyle::LINES);
01341     drawStyle->linePattern.setValue(0xFFFF);
01342     separator->addChild(drawStyle);
01343 
01344     SoTools::addSegmentsToNode(separator,pointn,points);
01345   }break;
01346   case POLYGON: {
01347     SoLightModel* lightModel = new SoLightModel;
01348     lightModel->model = SoLightModel::PHONG;
01349     separator->addChild(lightModel);
01350       
01351     SoDrawStyle* drawStyle = new SoDrawStyle;
01352     drawStyle->style.setValue(SoDrawStyle::FILLED);
01353     separator->addChild(drawStyle);
01354 
01355     SoNormalBinding* normalBinding = new SoNormalBinding;
01356     normalBinding->value=SoNormalBinding::PER_FACE;
01357     separator->addChild(normalBinding);
01358 
01359     // It is assumed that the points are in the same plane.
01360     //WARNING : get the normal from the three first points.
01361     // It assumes that the three first points can form a plane...
01362     SbPlane plane(points[0],points[1],points[2]);
01363     SbVec3f normal = plane.getNormal();
01364     if(normal.length()<=0) normal.setValue(0,0,1); //Anomaly. Continue anyway.
01365     SoTools::addPolygonToNode(separator,pointn,points,normal);
01366   }break;
01367   }
01368 
01369   //  Send scene graph to the viewing region
01370   // (in the "dynamic" sub-scene graph) :
01371   region_addToDynamicScene(*region,separator);
01372 
01373   delete [] points;
01374 
01375   return StatusCode::SUCCESS;
01376 }

std::vector<std::string> OnXSvc::getHighlightedSoShapeNames (  ) 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 1380 of file OnXSvc.cpp.

01384 {
01385   std::vector<std::string> names;
01386 
01387   MsgStream log(messageService(), Service::name());
01388 
01389   SoRegion* region = currentSoRegion();
01390   if(!region) {
01391     log << MSG::INFO << " can't get viewing region." << endreq;
01392     return names;
01393   }
01394 
01395   //typedef std::pair<std::string,void*> Loc;
01396   //std::vector<Loc> locs;
01397 
01398   SoNode* node = region->findNode("part","topSeparator");
01399   if(!node) {
01400     log << MSG::INFO << " part not found." << endreq;
01401     return names;
01402   }
01403  
01404   // Need to search in nodekits (for exa SoDetectorTreeKit) :
01405   SbBool oldsearch = SoBaseKit::isSearchingChildren();
01406   SoBaseKit::setSearchingChildren(TRUE);
01407   SoSearchAction searchAction;
01408   searchAction.setFind(SoSearchAction::NAME);
01409   searchAction.setName("sceneGraph");
01410   //searchAction.setSearchingAll(TRUE); //to search all under an SoSwitch.
01411   searchAction.setInterest(SoSearchAction::ALL);
01412   searchAction.apply(node);
01413   SoBaseKit::setSearchingChildren(oldsearch);
01414 
01415   SoPathList& pathList = searchAction.getPaths();
01416   unsigned int number = pathList.getLength();
01417 
01418   for(unsigned int index=0;index<number;index++) {
01419     SoFullPath* path = (SoFullPath*)pathList[index];
01420 
01421     SoNode* sep_sceneGraph = path->getTail();
01422 
01423     // highlighted ?
01424     bool highlighted = false;
01425    {SoSearchAction searchAction;
01426     searchAction.setFind(SoSearchAction::TYPE);
01427     searchAction.setType(SoHighlightMaterial::getClassTypeId());
01428     searchAction.apply(sep_sceneGraph);
01429     SoPath* path = searchAction.getPath();
01430     if(path) {
01431       SoHighlightMaterial* material = (SoHighlightMaterial*)path->getTail();
01432       if(material->getSavedMaterial()) highlighted = true;
01433     }}
01434 
01435     if(highlighted) {
01436       SoSearchAction searchAction;
01437       searchAction.setFind(SoSearchAction::TYPE);
01438       searchAction.setType(SoShape::getClassTypeId());
01439       searchAction.apply(sep_sceneGraph);
01440       SoPath* path = searchAction.getPath();
01441       std::string spath = path ? path->getTail()->getName().getString():"nil";
01442       //printf("debug : %s\n",spath.c_str());
01443       names.push_back(spath);
01444     }
01445 
01446   }
01447 
01448   return names;
01449 }

std::vector<ContainedObject*> OnXSvc::getHighlightedContainedObject (  ) 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 1451 of file OnXSvc.cpp.

01455 {
01456   MsgStream log(messageService(), Service::name());
01457 
01458   std::vector<ContainedObject*> objs;
01459 
01460   std::vector<std::string> names = getHighlightedSoShapeNames(); 
01461   std::vector<std::string>::const_iterator it;
01462   for(it=names.begin();it!=names.end(); it++) {
01463 
01464     std::vector<std::string> fields;
01465     Lib::smanip::words(*it,"/",fields);
01466     if(fields.size()<=1) {
01467       log << MSG::INFO << " bad syntax in " << (*it) << "." << endreq;
01468       objs.clear();
01469       break;
01470     }
01471       
01472     //std::string sclass = fields[0];
01473       
01474     std::string sid = fields[1];
01475     void* id = 0;
01476     if(!Lib::smanip::topointer(sid,id)) {
01477       log << MSG::INFO << " bad syntax in " << sid << "." << endreq;
01478       objs.clear();
01479       break;
01480     }
01481 
01482     //WARNING : it assumes that the deposited address is a ContainedObject* !
01483 
01484     objs.push_back((ContainedObject*)id);
01485 
01486 
01487   }
01488 
01489   return objs;
01490 }

| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:02:02 2011 for OnXSvc by doxygen 1.4.7