58 static bool first_call_configure =
true;
59 if ( first_call_configure ) { first_call_configure =
false; }
69 std::cout <<
"efpsc::SC::configure "
70 <<
"SC configuration started." << std::endl;
77 std::cout <<
"efpsc::SC::configure "
78 <<
"---> Create Pesa Application Manager:" << m_isCreated << std::endl;
81 if ( ( m_config->dllName().size() != 0 ) && ( m_config->factoryName().size() != 0 ) )
84 Gaudi::createApplicationMgr( m_config->dllName(), m_config->factoryName() );
86 std::cout <<
"Gaudi::createApplicationMgr(m_config->dllName(),m_config->factoryName())"
91 m_pesaAppMgr = Gaudi::createApplicationMgr();
92 if ( m_outLev <= 3 ) std::cout <<
"Gaudi::createApplicationMgr()" << std::endl;
100 std::cout <<
"efpsc::SC::configure "
101 <<
"---> Configure Pesa Property Manager" << std::endl;
103 SmartIF<IProperty> propMgr( m_pesaAppMgr );
104 SmartIF<IAppMgrUI> appMgr( m_pesaAppMgr );
105 if ( !appMgr.isValid() || !propMgr.isValid() )
110 std::cout <<
"efpsc::SC::configure "
111 <<
"While creating the ApplicationMgr" << std::endl;
116 std::string opts =
"jobOptions.txt";
117 ::setenv(
"efJobPath",
"", 1 );
118 if ( m_config->jobOptionsPath().size() != 0 )
120 opts = m_config->jobOptionsPath();
121 if ( opts.rfind(
"/" ) < opts.size() )
122 { ::setenv(
"efJobPath", opts.substr( 0, opts.rfind(
"/" ) ).c_str(), 1 ); }
128 std::cout <<
"efpsc::SC::configure "
129 <<
"---> Pesa JobOptions file is = " << opts << std::endl
131 <<
"---> Pesa JobOptions path = " << ::getenv(
"efJobPath" ) << std::endl;
132 propMgr->setProperty(
"JobOptionsPath", opts );
134 propMgr->setProperty(
"EventLoop", m_nameEventLoopMgr );
137 if ( m_config->messageSvcType().size() != 0 )
138 { propMgr->setProperty(
"MessageSvcType", m_config->messageSvcType() ); }
141 if ( m_config->evtSel().size() != 0 )
142 { propMgr->setProperty(
"EvtSel", m_config->evtSel() ); }
143 else { propMgr->setProperty(
"EvtSel",
"NONE" ); }
148 std::cout <<
"efpsc::SC::configure "
149 <<
"finish property set--->start configure" << std::endl;
151 std::cout <<
"efpsc::SC::configure "
152 <<
"Configuring ApplicationMgr: " << appMgr->FSMState()
153 <<
" Status : " << sc.getCode() << std::endl;
155 if ( opts.substr( opts.length() - 3, 3 ) ==
".py" )
161 std::cout <<
"efpsc::SC::configure "
162 <<
"Error: Don't support python config files" << std::endl;
209 sc = appMgr->configure();
210 if ( sc.isFailure() )
215 std::cout <<
"efpsc::SC::configure "
216 <<
"While configuring the ApplicationMgr" << std::endl;
223 std::cout <<
"efpsc::SC::configure "
224 <<
"Configuring ApplicationMgr: " << appMgr->FSMState()
225 <<
" Status : " << sc.getCode() << std::endl;
227 sc = appMgr->initialize();
232 std::cout <<
"efpsc::SC::configure "
233 <<
"Initialize ApplicationMgr : " << appMgr->FSMState()
234 <<
" Status : " << sc.getCode() << std::endl;
235 if ( sc.isFailure() )
237 EFPSC_ERROR(
"efpsc::SC::configure",
"While intializing the ApplicationMgr" );
244 sc = propMgr->getProperty(
"EventLoop", value );
246 if ( sc.isFailure() )
250 std::cout <<
"efpsc::SC::configure "
251 <<
"While retrieving Property EventLoop " << std::endl;
255 m_nameEventLoopMgr.assign( value, value.find_first_of(
"\"" ) + 1,
256 value.find_last_of(
"\"" ) - value.find_first_of(
"\"" ) - 1 );
259 SmartIF<ISvcLocator> svcLoc( m_pesaAppMgr );
260 if ( svcLoc.isValid() )
264 std::cout <<
"efpsc::SC::configure "
265 <<
"Name for EventLoopManager:" << m_nameEventLoopMgr << std::endl;
267 IEventProcessor* processingMgr = 0;
269 sc = svcLoc->service( m_nameEventLoopMgr, processingMgr );
270 m_eventLoopMgr = processingMgr;
272 if ( !sc.isSuccess() )
276 std::cout <<
"efpsc::SC::configure "
277 <<
"Error Retrieving Processing manager!" << std::endl;
285 std::cout <<
"efpsc::SC::configure "
286 <<
"Error Retrieving Service Locator!" << std::endl;
293 std::cout <<
"efpsc::SC::configure "
294 <<
"SC configuration finished." << std::endl;
303 std::cout <<
"efpsc::SC::unconfigure "
304 <<
"SC UNconfiguration started." << std::endl;
306 SmartIF<IAppMgrUI> appMgr( m_pesaAppMgr );
307 if ( !appMgr.isValid() )
312 std::cout <<
"efpsc::SC::unconfigure "
313 <<
"While unconfiguring the ApplicationMgr, no valid interface" << std::endl;
316 SmartIF<ISvcLocator> svcLoc( m_pesaAppMgr );
324 sc = appMgr->finalize();
329 std::cout <<
"efpsc::SC::unconfigure "
330 <<
"Finalize ApplicationMgr: " << appMgr->FSMState()
331 <<
" Status : " << sc.getCode() << std::endl;
332 if ( sc.isFailure() )
337 std::cout <<
"efpsc::SC::unconfigure "
338 <<
"While finalizing the ApplicationMgr" << std::endl;
343 sc = appMgr->terminate();
347 std::cout <<
"efpsc::SC::unconfigure "
348 <<
"Terminate ApplicationMgr : " << appMgr->FSMState()
349 <<
" Status : " << sc.getCode() << std::endl;
350 if ( sc.isFailure() )
354 std::cout <<
"efpsc::SC::unconfigure "
355 <<
"While terminating the ApplicationMgr" << std::endl;
384 std::cout <<
"efpsc::SC::unconfigure "
385 <<
"SC UNconfiguration finished." << std::endl;
402 std::string& efDecision_s, std::vector<uint32_t>& efBitPattern ) {
408 std::cout <<
"efpsc::SC::process"
409 <<
" **************** NEW EVENT ****************" << std::endl;
420 if ( 0 != m_eventLoopMgr )
422 SmartIF<IEventProcessor> processor( m_eventLoopMgr );
424 if ( processor.isValid() )
426 SmartIF<IService> processor_s( m_eventLoopMgr );
430 sc = processor->executeEvent( (
void*)feStore );
436 std::cout <<
"efpsc::SC::process "
437 <<
"after executeEvent(fe)" << std::endl;
438 if ( sc.isFailure() )
443 std::cout <<
"efpsc::SC::process "
444 <<
"Error for executeEvent in the ApplicationMgr " << processor_s->name()
449 SmartIF<IEFEventLoopMgr> processor_psc( m_eventLoopMgr );
454 efDecision_s = processor_psc->EF_Decision();
459 std::cout <<
"efpsc::SC::process "
460 <<
"after EF_Decision. EFdecision is: " << efDecision_s << std::endl;
461 sdStore = (uint32_t*)processor_psc->EF_Fragment_Address();
463 if ( sdStore == NULL )
467 std::cout <<
"efpsc::SC::process "
468 <<
"EF_Fragment_Address() returns NULL pointer" << std::endl;
491 efBitPattern.resize( 4, 0 );
492 if ( efDecision_s ==
"Junk" ) efBitPattern[0] = 1 << 0;
494 else if ( efDecision_s ==
"GJunk" ) efBitPattern[0] = ( 1 << 1 );
495 else if ( efDecision_s ==
"Beamgas" ) efBitPattern[0] = 1 << 2;
497 else if ( efDecision_s ==
"GBeamgas" ) efBitPattern[0] = ( 1 << 3 );
498 else if ( efDecision_s ==
"Cosmic" ) efBitPattern[0] = 1 << 4;
500 else if ( efDecision_s ==
"GCosmic" ) efBitPattern[0] = ( 1 << 5 );
501 else if ( efDecision_s ==
"EBhabha" ) efBitPattern[0] = 1 << 6;
503 else if ( efDecision_s ==
"GEBhabha" ) efBitPattern[0] = ( 1 << 7 );
504 else if ( efDecision_s ==
"BBhabha" ) efBitPattern[0] = 1 << 8;
506 else if ( efDecision_s ==
"GBBhabha" ) efBitPattern[0] = ( 1 << 9 );
507 else if ( efDecision_s ==
"Dimuon" ) efBitPattern[0] = 1 << 10;
509 else if ( efDecision_s ==
"GDimuon" ) efBitPattern[0] = ( 1 << 11 );
510 else if ( efDecision_s ==
"Diphoton" ) efBitPattern[0] = 1 << 12;
512 else if ( efDecision_s ==
"GDiphoton" ) efBitPattern[0] = ( 1 << 13 );
513 else if ( efDecision_s ==
"Hadron" ) efBitPattern[0] = 1 << 14;
515 else if ( efDecision_s ==
"GHadron" ) efBitPattern[0] = ( 1 << 15 );
516 else if ( efDecision_s ==
"Twophoton" ) efBitPattern[0] = 1 << 16;
518 else if ( efDecision_s ==
"GTwophoton" ) efBitPattern[0] = ( 17 );
519 else if ( efDecision_s ==
"RandomTrg" ) efBitPattern[0] = 1 << 31;
520 else if ( efDecision_s ==
"Error" ) efBitPattern[0] = 1 << 30;
521 else if ( efDecision_s ==
"Other" ) efBitPattern[0] = 1 << 29;
522 else efBitPattern[0] = 1 << 28;
523 efBitPattern[1] = processor_psc->EF_Algorithm_Tag();
524 efBitPattern[2] = processor_psc->EF_Version();
525 efBitPattern[3] = processor_psc->EF_Total_Energy();
529 std::cout <<
"efpsc::SC::process "
530 <<
"**************end of psc process!**************" << std::endl;
538 std::cout <<
"efpsc::SC::process "
539 <<
"executeEvent ApplicationMgr : no valid event processor " << std::endl;
543 else {
return false; }