Collaboration diagram for ExposureAlg:

Public Member Functions | |
| ExposureAlg (const std::string &name, ISvcLocator *pSvcLocator) | |
| ctor | |
| StatusCode | initialize () |
| set parameters and attach to various perhaps useful services. | |
| StatusCode | execute () |
| process a tick | |
| StatusCode | finalize () |
| clean up, summarize | |
Private Member Functions | |
| int | askGPS () |
| notified when position changes | |
| void | createEntry () |
Private Attributes | |
| double | m_lasttime |
| double | m_last_livetime |
| double | m_initial_time |
| StringProperty | m_root_tree |
| StringProperty | m_pointing_history_input_file |
| StringProperty | m_clockName |
| IntegerProperty | m_print_frequency |
| IFluxSvc * | m_fluxSvc |
| int | m_tickCount |
| INTupleWriterSvc * | m_rootTupleSvc |
| ILivetimeSvc * | m_livetimeSvc |
| PointingInfo | m_history |
| bool | m_insideSAA |
| ObserverAdapter< ExposureAlg > | m_observer |
| astro::GPS * | m_gps |
| std::map< std::string, int > | m_ticks |
Definition at line 54 of file ExposureAlg.cxx.
|
||||||||||||
|
ctor
Definition at line 100 of file ExposureAlg.cxx. References m_clockName, m_print_frequency, and m_root_tree.
00101 : Algorithm(name, pSvcLocator) 00102 , m_lasttime(0) 00103 , m_tickCount(0) 00104 , m_insideSAA(false) 00105 { 00106 // declare properties with setProperties calls 00107 declareProperty("root_tree",m_root_tree="pointing_history"); //doesn't work??? 00108 00109 declareProperty("PrintFrequency", m_print_frequency=1); 00110 declareProperty("clockName" , m_clockName = "clock" );// the name to check for 00111 } |
|
|
notified when position changes
Definition at line 168 of file ExposureAlg.cxx. References createEntry(), and m_insideSAA. Referenced by initialize().
00169 {
00170 // callback from GPS when position has been updated
00171 astro::EarthCoordinate pos = astro::GPS::instance()->earthpos();
00172 bool inside = pos.insideSAA();
00173 if( inside != m_insideSAA){
00174 // changed:
00175
00176 m_insideSAA= inside;
00177 createEntry();
00178 }
00179
00180 return 0; // can't be void in observer pattern
00181 }
|
|
|
Definition at line 206 of file ExposureAlg.cxx. References PointingInfo::finish(), PointingInfo::in_saa, PointingInfo::lat_geo, PointingInfo::lat_mag, PointingInfo::lon_geo, m_history, m_initial_time, m_last_livetime, m_lasttime, m_livetimeSvc, m_print_frequency, m_rootTupleSvc, m_tickCount, PointingInfo::set(), PointingInfo::start_time(), and PointingInfo::zenith_scz. Referenced by askGPS(), execute(), and finalize().
00207 {
00208 m_lasttime = astro::GPS::instance()->time();
00209 if( m_tickCount!=0){
00210 double interval = m_lasttime - m_history.start_time();
00211 if( interval<=1e-10) return;
00212 m_history.finish( m_lasttime, m_livetimeSvc->livetime()-m_last_livetime);
00213
00214 m_rootTupleSvc->saveRow(this->m_root_tree.value());
00215 }
00216 m_last_livetime = m_livetimeSvc->livetime();
00217
00218 // start new entry
00219 m_history.set();
00220
00221 if( m_tickCount% m_print_frequency==0){
00222 MsgStream log( msgSvc(), name() );
00223 log << MSG::INFO;
00224 if( log.isActive() ){
00225 std::stringstream t;
00226 t << "tick at " << std::setprecision(10)
00227 << m_lasttime - m_initial_time << " sec"
00228 << std::setprecision(3)
00229 << ", lat, lon, magLat, zenithTheta, SAA = "
00230 << m_history.lat_geo << ", "
00231 << m_history.lon_geo << ", "
00232 << m_history.lat_mag << ", "
00233 << ( fabs(m_history.zenith_scz)<1e-8? 0: m_history.zenith_scz) << ", "
00234 << m_history.in_saa;
00235 log << t.str();
00236 }
00237 log << endreq;
00238 }
00239
00240 m_tickCount++;
00241 }
|
|
|
process a tick
Definition at line 185 of file ExposureAlg.cxx. References createEntry(), IFluxSvc::currentFlux(), m_clockName, m_fluxSvc, m_gps, m_ticks, and IFlux::name().
00186 {
00187 StatusCode sc = StatusCode::SUCCESS;
00188 MsgStream log(msgSvc(), name());
00189
00190 IFlux* flux=m_fluxSvc->currentFlux();
00191
00192 std::string name( flux->name());
00193
00194 log << MSG::DEBUG << "Clock tick at "<< m_gps->time()<<", clock: "<<name << endreq;
00195
00196 m_ticks[name]++;
00197
00198 if(m_clockName.value() == name){
00199 createEntry();
00200 setFilterPassed(false); // since this is on a branch, and we want the sequence to fail
00201 }
00202
00203 return sc;
00204 }
|
|
|
clean up, summarize
Definition at line 245 of file ExposureAlg.cxx. References createEntry(), m_tickCount, and m_ticks.
00245 {
00246 // finish up
00247 if( m_tickCount>0 ) createEntry();
00248
00249 StatusCode sc = StatusCode::SUCCESS;
00250 MsgStream log(msgSvc(), name());
00251
00252 log << MSG::INFO <<" clock Name ticks"<<endreq;;
00253 for(std::map<std::string,int>::const_iterator im=m_ticks.begin(); im !=m_ticks.end(); ++im) {
00254 log<< MSG::INFO
00255 <<std::setw(15) << std::left << im->first
00256 << std::setw(10)<< std::right << im->second << endreq;
00257 }
00258 log << std::endl;
00259
00260 return sc;
00261 }
|
|
|
set parameters and attach to various perhaps useful services.
Definition at line 115 of file ExposureAlg.cxx. References askGPS(), IFluxSvc::attachGpsObserver(), m_clockName, m_fluxSvc, m_gps, m_history, m_initial_time, m_lasttime, m_livetimeSvc, m_observer, m_root_tree, m_rootTupleSvc, and PointingInfo::setFT2Tuple().
00115 {
00116 StatusCode sc = StatusCode::SUCCESS;
00117 MsgStream log(msgSvc(), name());
00118
00119 // Use the Job options service to set the Algorithm's parameters
00120 setProperties();
00121
00122 if ( service("FluxSvc", m_fluxSvc).isFailure() ){
00123 log << MSG::ERROR << "Couldn't find the FluxSvc!" << endreq;
00124 return StatusCode::FAILURE;
00125 }
00126
00127 // access the properties of FluxSvc
00128 IProperty* propMgr=0;
00129 sc = serviceLocator()->service("FluxSvc", propMgr );
00130 if( sc.isFailure()) {
00131 log << MSG::ERROR << "Unable to locate PropertyManager Service" << endreq;
00132 return sc;
00133 }
00134
00135
00136 DoubleProperty startTime("StartTime",0);
00137 sc = propMgr->getProperty( &startTime );
00138 if (sc.isFailure()) return sc;
00139
00140 m_initial_time =m_lasttime = startTime.value();
00141
00142 // get a pointer to RootTupleSvc
00143 if( (sc = service("RootTupleSvc", m_rootTupleSvc, true) ). isFailure() ) {
00144 log << MSG::ERROR << " failed to get the RootTupleSvc" << endreq;
00145 return sc;
00146 }
00147 // get a pointer to LivetimeSvc
00148 if( (service("LivetimeSvc", m_livetimeSvc, true) ). isFailure() ) {
00149 log << MSG::ERROR << " LivetimeSvc is not available" << endreq;
00150 return StatusCode::FAILURE;
00151 }
00152
00153 m_history.setFT2Tuple(m_rootTupleSvc, m_root_tree.value());
00154
00155 log << MSG::INFO << "Using the clock \""<< m_clockName<< "\" to generate FT2 entries" << endreq;
00156
00157 // attach an observer to be notified when orbital position changes
00158 // set callback to be notified when the position changes
00159 m_observer.setAdapter( new ActionAdapter<ExposureAlg>
00160 (this, &ExposureAlg::askGPS) );
00161
00162 m_fluxSvc->attachGpsObserver(&m_observer);
00163 m_gps = astro::GPS::instance();
00164
00165 return sc;
00166 }
|
|
|
Definition at line 72 of file ExposureAlg.cxx. Referenced by execute(), ExposureAlg(), and initialize(). |
|
|
Definition at line 75 of file ExposureAlg.cxx. Referenced by execute(), and initialize(). |
|
|
Definition at line 90 of file ExposureAlg.cxx. Referenced by execute(), and initialize(). |
|
|
Definition at line 81 of file ExposureAlg.cxx. Referenced by createEntry(), and initialize(). |
|
|
Definition at line 68 of file ExposureAlg.cxx. Referenced by createEntry(), and initialize(). |
|
|
Definition at line 84 of file ExposureAlg.cxx. Referenced by askGPS(). |
|
|
Definition at line 67 of file ExposureAlg.cxx. Referenced by createEntry(). |
|
|
Definition at line 66 of file ExposureAlg.cxx. Referenced by createEntry(), and initialize(). |
|
|
Definition at line 79 of file ExposureAlg.cxx. Referenced by createEntry(), and initialize(). |
|
|
Definition at line 85 of file ExposureAlg.cxx. Referenced by initialize(). |
|
|
Definition at line 71 of file ExposureAlg.cxx. |
|
|
Definition at line 74 of file ExposureAlg.cxx. Referenced by createEntry(), and ExposureAlg(). |
|
|
Definition at line 70 of file ExposureAlg.cxx. Referenced by ExposureAlg(), and initialize(). |
|
|
Definition at line 78 of file ExposureAlg.cxx. Referenced by createEntry(), and initialize(). |
|
|
Definition at line 77 of file ExposureAlg.cxx. Referenced by createEntry(), and finalize(). |
|
|
Definition at line 91 of file ExposureAlg.cxx. Referenced by execute(), and finalize(). |
1.3.3