#include <FluxSvc.h>
Inheritance diagram for FluxSvc::

Public Methods | |
| StatusCode | source (std::string name, IFlux *&) |
| return pointer to a flux object. More... | |
| std::list< std::string > | fluxNames () const |
| return a list of possible names. More... | |
| virtual void | addFactory (std::string name, const ISpectrumFactory *factory) |
| add a new SpectrumFactory. More... | |
| virtual void | pass (double t) |
| pass a specific amount of time. More... | |
| void | rootDisplay (std::vector< char *> arguments) |
| create a set of display windows using rootplot. More... | |
| IFlux * | currentFlux () |
| return the pointer to the current IFlux object. More... | |
| std::string | fluxName () const |
| name of the flux. More... | |
| void | setOrientation (std::pair< double, double > ang) |
| set the glast tilt angles. More... | |
| std::pair< double, double > | getOrientation () |
| get the angular values of the satellite. More... | |
| HepRotation | transformGlastToGalactic (double time) const |
| this transforms glast-local (cartesian) vectors into galactic (cartesian) vectors. More... | |
| std::pair< double, double > | location () |
| get the current satellite location. More... | |
| std::string | uniqueIDString () const |
| return a string which uniquely identifies the source. More... | |
| void | setRockType (int rockType) |
| 0=NONE, 1=UPDOWN, 2=SLEWING, 3=ONEPERORBIT. More... | |
| std::vector< std::pair< std::string, std::list< std::string > > > | sourceOriginList () const |
| this should return the source file names, along with the contained sources. More... | |
| virtual StatusCode | run () |
| for the IRunnable interfce. More... | |
| virtual StatusCode | initialize () |
| perform initializations for this service. More... | |
| virtual StatusCode | finalize () |
| perform the finalization, as required for a service. More... | |
| virtual StatusCode | queryInterface (const IID &riid, void **ppvUnknown) |
| Query interface. More... | |
Protected Methods | |
| FluxSvc (const std::string &name, ISvcLocator *al) | |
| Standard Constructor. More... | |
| virtual | ~FluxSvc () |
| destructor. More... | |
Private Attributes | |
| IParticlePropertySvc * | m_partSvc |
| FluxMgr * | m_fluxMgr |
| std::vector< std::string > | m_source_lib |
| the user-defined list of acceptable XML sources (from JobOptions.txt). More... | |
| std::string | m_source_lib_default |
| the default XML file name (from JobOptions.txt). More... | |
| std::string | m_dtd_file |
| set dtd to use. More... | |
| IFlux * | m_currentFlux |
| the "current" flux object. More... | |
| IAppMgrUI * | m_appMgrUI |
| Reference to application manager UI. More... | |
| IntegerProperty | m_evtMax |
| DoubleProperty | m_startTime |
| DoubleProperty | m_endTime |
Friends | |
| class | SvcFactory< FluxSvc > |
| Allow SvcFactory to instantiate the service. More... | |
Definition at line 36 of file FluxSvc.h.
|
||||||||||||
|
Standard Constructor.
Definition at line 43 of file FluxSvc.cxx.
00044 : Service(name,svc), m_currentFlux(0) 00045 { 00046 00047 declareProperty("source_lib" , m_source_lib); 00048 declareProperty("dtd_file" , m_dtd_file=default_dtd_file); 00049 declareProperty("EvtMax" , m_evtMax=0); 00050 declareProperty("StartTime" , m_startTime=0); 00051 declareProperty("EndTime", m_endTime=0); 00052 00053 } |
|
|
destructor.
Definition at line 73 of file FluxSvc.cxx.
00074 {
00075 }
|
|
||||||||||||
|
add a new SpectrumFactory.
Reimplemented from IFluxSvc. Definition at line 196 of file FluxSvc.cxx. References FluxMgr::addFactory(), and m_fluxMgr.
00196 {
00197 m_fluxMgr->addFactory(name, factory);
00198 }
|
|
|
return the pointer to the current IFlux object.
Reimplemented from IFluxSvc. Definition at line 211 of file FluxSvc.cxx. References m_currentFlux. Referenced by run().
00211 {
00212 return m_currentFlux;
00213 }
|
|
|
perform the finalization, as required for a service.
Definition at line 172 of file FluxSvc.cxx. References m_fluxMgr.
00173 {
00174 StatusCode status = StatusCode::SUCCESS;
00175
00176 delete m_fluxMgr;
00177 return status;
00178 }
|
|
|
name of the flux.
Reimplemented from IFluxSvc. Definition at line 216 of file FluxSvc.cxx.
00216 {
00217 return m_currentFlux->name();
00218 }
|
|
|
return a list of possible names.
Reimplemented from IFluxSvc. Definition at line 55 of file FluxSvc.cxx. Referenced by source().
00055 {
00056 return m_fluxMgr->sourceList();
00057 }
|
|
|
get the angular values of the satellite.
Reimplemented from IFluxSvc. Definition at line 233 of file FluxSvc.cxx. References FluxMgr::getOrientation(), and m_fluxMgr.
00233 {
00234 return m_fluxMgr->getOrientation();
00235 }
|
|
|
perform initializations for this service.
Definition at line 79 of file FluxSvc.cxx. References IRegisterSource::interfaceID(), m_appMgrUI, m_dtd_file, m_fluxMgr, m_partSvc, m_source_lib, Flux::mgr(), and FluxMgr::sourceList().
00080 {
00081 StatusCode status = Service::initialize ();
00082
00083 // bind all of the properties for this service
00084 setProperties ();
00085
00086 // open the message log
00087 MsgStream log( msgSvc(), name() );
00088
00089 status = serviceLocator()->queryInterface(IID_IAppMgrUI, (void**)&m_appMgrUI);
00090
00091 // If source library was not set, put in default
00092 if( m_source_lib.empty() ){
00093 m_source_lib.push_back(default_source_library);
00094 log << MSG::INFO << "Set source library list to " << default_source_library << endreq;
00095 }
00096
00097
00098 // create a FluxMgr object which will then be available.
00099 m_fluxMgr = new FluxMgr(m_source_lib, m_dtd_file);
00100
00101 Flux::mgr(m_fluxMgr); // tell our Flux object
00102
00103 // check that it was made properly
00104 if( m_fluxMgr->sourceList().empty()) {
00105 log << MSG::ERROR << "Did not initialize properly: no sources detected" << endreq;
00106 status = StatusCode::FAILURE;
00107 }
00108
00109 if ( service("ParticlePropertySvc", m_partSvc).isFailure() ){
00110 log << MSG::ERROR << "Couldn't find the ParticlePropertySvc!" << endreq;
00111 return StatusCode::FAILURE;
00112 }
00113
00114 //----------------------------------------------------------------
00115 // most of the following cribbed from ToolSvc and ObjManager
00116
00117 // look for a factory of an AlgTool that implements the IRegisterSource interface:
00118 // if found, make one and call the special method
00119
00120 // Manager of the AlgTool Objects
00121 IObjManager* objManager=0;
00122
00123 // locate Object Manager to locate later the tools
00124 status = serviceLocator()->service("ApplicationMgr", objManager );
00125 if( status.isFailure()) {
00126 log << MSG::ERROR << "Unable to locate ObjectManager Service" << endreq;
00127 return status;
00128 }
00129
00130
00131 IToolSvc* tsvc =0;
00132 status = service( "ToolSvc", tsvc, true );
00133 if( status.isFailure() ) {
00134 log << MSG::ERROR << "Unable to locate Tool Service" << endreq;
00135 return status;
00136 }
00137
00138 IToolFactory* toolfactory = 0;
00139
00140 // search throught all objects (factories?)
00141 for(IObjManager::ObjIterator it = objManager->objBegin(); it !=objManager->objEnd(); ++ it){
00142
00143 std::string tooltype= (*it)->ident();
00144 // is it a tool factory?
00145 const IFactory* factory = objManager->objFactory( tooltype );
00146 IFactory* fact = const_cast<IFactory*>(factory);
00147 status = fact->queryInterface( IID_IToolFactory, (void**)&toolfactory );
00148 if( status.isSuccess() ) {
00149
00150 IAlgTool* itool;
00151 status = tsvc->retrieveTool(tooltype, itool);
00152 if( status.isSuccess()) {
00153 status =itool->queryInterface( IRegisterSource::interfaceID(), (void**)&itool);
00154 if( status.isSuccess() ){
00155 log << MSG::INFO << "Registering sources in " << tooltype << endreq;
00156 dynamic_cast<IRegisterSource*>(itool)->registerMe(this);
00157 }else{
00158 tsvc->releaseTool(itool);
00159 }
00160
00161 }
00162
00163 }
00164
00165 }
00166
00167
00168 return StatusCode::SUCCESS;
00169 }
|
|
|
get the current satellite location.
Reimplemented from IFluxSvc. Definition at line 241 of file FluxSvc.cxx. References FluxMgr::location(), and m_fluxMgr.
|
|
|
pass a specific amount of time.
Reimplemented from IFluxSvc. Definition at line 202 of file FluxSvc.cxx. References m_fluxMgr, and FluxMgr::pass().
|
|
||||||||||||
|
Query interface.
Definition at line 181 of file FluxSvc.cxx.
00181 {
00182 if ( IID_IFluxSvc.versionMatch(riid) ) {
00183 *ppvInterface = (IFluxSvc*)this;
00184 }else if (IID_IRunable.versionMatch(riid) ) {
00185 *ppvInterface = (IRunable*)this;
00186 } else {
00187 return Service::queryInterface(riid, ppvInterface);
00188 }
00189
00190 addRef();
00191 return SUCCESS;
00192 }
|
|
|
create a set of display windows using rootplot.
Reimplemented from IFluxSvc. Definition at line 206 of file FluxSvc.cxx.
00206 {
00207 rootplot abc(arguments);
00208 }
|
|
|
for the IRunnable interfce.
Definition at line 254 of file FluxSvc.cxx. References currentFlux(), IFlux::gpsTime(), m_appMgrUI, m_endTime, m_evtMax, and m_startTime.
00254 {
00255 StatusCode status = StatusCode::FAILURE;
00256 MsgStream log( msgSvc(), name() );
00257
00258 if ( 0 == m_appMgrUI ) return status;
00259
00260 IProperty* propMgr=0;
00261 status = serviceLocator()->service("ApplicationMgr", propMgr );
00262 if( status.isFailure()) {
00263 log << MSG::ERROR << "Unable to locate PropertyManager Service" << endreq;
00264 return status;
00265 }
00266
00267 IntegerProperty evtMax("EvtMax",0);
00268 status = propMgr->getProperty( &evtMax );
00269 if (status.isFailure()) return status;
00270
00271 setProperty(evtMax);
00272
00273 // now find the top alg so we can monitor its error count
00274 //
00275 IAlgManager* theAlgMgr;
00276 status = serviceLocator( )->getService( "ApplicationMgr",
00277 IID_IAlgManager,
00278 (IInterface*&)theAlgMgr );
00279 IAlgorithm* theIAlg;
00280 Algorithm* theAlgorithm=0;
00281 IntegerProperty errorProperty("ErrorCount",0);
00282
00283 status = theAlgMgr->getAlgorithm( "Top", theIAlg );
00284 if ( status.isSuccess( ) ) {
00285 try{
00286 theAlgorithm = dynamic_cast<Algorithm*>(theIAlg);
00287 } catch(...){
00288 status = StatusCode::FAILURE;
00289 }
00290 }
00291 if ( status.isFailure( ) ) {
00292 log << MSG::WARNING << "Could not find algorithm 'Top'; will not monitor errors" << endreq;
00293 }
00294
00295
00296 // loop over the events
00297 IFlux* flux=currentFlux();
00298 int eventNumber= 0;
00299 double currentTime=m_startTime;
00300
00301 { bool noend=true;
00302 log << MSG::INFO << "Runable interface starting event loop as :" ;
00303 if( m_evtMax>0) { log << " MaxEvt = " << m_evtMax; noend=false; }
00304 if( m_endTime>0) { log << " EndTime= " << m_endTime; noend=false; }
00305 log << endreq;
00306
00307 if(noend) {
00308 log << MSG::WARNING << "No end condition specified: will not process any events!" << endreq;
00309 }
00310 }
00311 while( m_evtMax>0 && eventNumber < m_evtMax
00312 || m_endTime>0 && currentTime< m_endTime ) {
00313
00314 status = m_appMgrUI->nextEvent(1); // currently, always success
00315
00316 // the single event may have created a failure. Check the ErrorCount propery of the Top alg.
00317 if( theAlgorithm !=0) theAlgorithm->getProperty(&errorProperty);
00318 if( status.isFailure() || errorProperty.value() > 0){
00319 status = StatusCode::FAILURE;
00320 }
00321
00322 if( status.isFailure()) break;
00323 currentTime = flux->gpsTime();
00324 eventNumber ++;
00325 }
00326 if( status.isFailure()){
00327 log << MSG::ERROR << "Terminating FluxSvc loop due to error" << endreq;
00328
00329 }else if( m_endTime>0 && currentTime >= m_endTime ) {
00330 log << MSG::INFO << "Loop terminated by time " << endreq;
00331 }else {
00332 log << MSG::INFO << "Processing loop terminated by event count" << endreq;
00333 }
00334 return status;
00335
00336 }
|
|
|
set the glast tilt angles.
Reimplemented from IFluxSvc. Definition at line 228 of file FluxSvc.cxx. References m_fluxMgr, and FluxMgr::setOrientation().
00228 {
00229 m_fluxMgr->setOrientation(ang);
00230 }
|
|
|
0=NONE, 1=UPDOWN, 2=SLEWING, 3=ONEPERORBIT.
Reimplemented from IFluxSvc. Definition at line 245 of file FluxSvc.cxx. References m_fluxMgr, and FluxMgr::setRockType().
00245 {
00246 m_fluxMgr->setRockType(rockType);
00247 }
|
|
||||||||||||
|
return pointer to a flux object.
Reimplemented from IFluxSvc. Definition at line 59 of file FluxSvc.cxx. References fluxNames(), SpectrumFactoryTable::instance(), and m_currentFlux.
00059 {
00060 std::list<std::string> source_list( fluxNames() );
00061 std::list<std::string> source_list2( SpectrumFactoryTable::instance()->spectrumList() );
00062
00063 if( std::find(source_list.begin(), source_list.end(), name) == source_list.end()
00064 &&(std::find(source_list2.begin(), source_list2.end(), name) == source_list2.end()))
00065 //flux = new Flux(name);
00066 return StatusCode::FAILURE;
00067 flux = new Flux(name);
00068 m_currentFlux = flux;
00069 return StatusCode::SUCCESS;
00070 }
|
|
|
this should return the source file names, along with the contained sources.
Reimplemented from IFluxSvc. Definition at line 249 of file FluxSvc.cxx. References m_fluxMgr, and FluxMgr::sourceOriginList().
00249 {
00250 return m_fluxMgr->sourceOriginList();
00251 }
|
|
|
this transforms glast-local (cartesian) vectors into galactic (cartesian) vectors.
Reimplemented from IFluxSvc. Definition at line 237 of file FluxSvc.cxx.
00237 {
00238 return m_fluxMgr->transformGlastToGalactic(time);
00239 }
|
|
|
return a string which uniquely identifies the source.
Definition at line 221 of file FluxSvc.cxx.
00221 {
00222 std::strstream t;
00223 t << m_currentFlux->numSource();
00224 return m_currentFlux->name() + t.str();
00225 }
|
|
|
Allow SvcFactory to instantiate the service.
|
|
|
Reference to application manager UI.
Definition at line 128 of file FluxSvc.h. Referenced by initialize(), and run(). |
|
|
the "current" flux object.
Definition at line 125 of file FluxSvc.h. Referenced by currentFlux(), and source(). |
|
|
set dtd to use.
Definition at line 123 of file FluxSvc.h. Referenced by initialize(). |
|
|
Definition at line 133 of file FluxSvc.h. Referenced by run(). |
|
|
Definition at line 129 of file FluxSvc.h. Referenced by run(). |
|
|
Definition at line 116 of file FluxSvc.h. Referenced by addFactory(), finalize(), getOrientation(), initialize(), location(), pass(), setOrientation(), setRockType(), and sourceOriginList(). |
|
|
Definition at line 111 of file FluxSvc.h. Referenced by initialize(). |
|
|
the user-defined list of acceptable XML sources (from JobOptions.txt).
Definition at line 119 of file FluxSvc.h. Referenced by initialize(). |
|
|
the default XML file name (from JobOptions.txt).
|
|
|
Definition at line 132 of file FluxSvc.h. Referenced by run(). |
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001