#include <EFEventLoopMgr.h>
Inheritance diagram for EFEventLoopMgr:
Public Member Functions | |
virtual uint32_t | EF_Algorithm_Tag () |
return algorithm tag | |
virtual uint32_t | EF_Algorithm_Tag () |
return algorithm tag | |
virtual std::string | EF_Decision () |
return data from EF decision | |
virtual std::string | EF_Decision () |
return data from EF decision | |
virtual uint32_t * | EF_Fragment_Address () |
Return a pointer to the local memory containing the EF subdetector fragment. | |
virtual uint32_t * | EF_Fragment_Address () |
Return a pointer to the local memory containing the EF subdetector fragment. | |
virtual uint32_t | EF_Total_Energy () |
return total energy | |
virtual uint32_t | EF_Total_Energy () |
return total energy | |
virtual uint32_t | EF_Version () |
return version number | |
virtual uint32_t | EF_Version () |
return version number | |
virtual StatusCode | executeEvent (void *par) |
implementation of IEventProcessor::executeEvent(void* par) | |
virtual StatusCode | executeEvent (void *par) |
implementation of IEventProcessor::executeEvent(void* par) | |
virtual StatusCode | finalize () |
implementation of IAppMgrUI::finalize | |
virtual StatusCode | finalize () |
implementation of IAppMgrUI::finalize | |
StatusCode | getEventRoot (IOpaqueAddress *&refpAddr) |
Create event address using event selector. | |
StatusCode | getEventRoot (IOpaqueAddress *&refpAddr) |
Create event address using event selector. | |
virtual bool | getTrigChn (uint32_t *data, uint32_t ndata) |
whether it is a RrandomTrg | |
virtual bool | getTrigChn (uint32_t *data, uint32_t ndata) |
whether it is a RrandomTrg | |
virtual StatusCode | initialize () |
implementation of IAppMgrUI::initalize | |
virtual StatusCode | initialize () |
implementation of IAppMgrUI::initalize | |
virtual StatusCode | prepareForRun (int ef_run_number) |
prepare for run step | |
virtual StatusCode | prepareForRun (int ef_run_number) |
prepare for run step | |
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvInterface) |
implementation of IInterface: queryInterface | |
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvInterface) |
implementation of IInterface: queryInterface | |
Static Public Member Functions | |
const InterfaceID & | interfaceID () |
Retrieve interface ID. | |
const InterfaceID & | interfaceID () |
Retrieve interface ID. | |
Protected Member Functions | |
EFEventLoopMgr (const std::string &nam, ISvcLocator *svcLoc) | |
Standard Constructor. | |
EFEventLoopMgr (const std::string &nam, ISvcLocator *svcLoc) | |
Standard Constructor. | |
virtual | ~EFEventLoopMgr () |
Standard Destructor. | |
virtual | ~EFEventLoopMgr () |
Standard Destructor. | |
Protected Attributes | |
EventID::number_type | m_currentRun |
current run number | |
IEvtSelector::Context * | m_evtContext |
Event Context. | |
IEvtSelector::Context * | m_evtContext |
Event Context. | |
IDataManagerSvc * | m_evtDataMgrSvc |
Reference to the Event Data Service's IDataManagerSvc interface. | |
IDataManagerSvc * | m_evtDataMgrSvc |
Reference to the Event Data Service's IDataManagerSvc interface. | |
IDataProviderSvc * | m_evtDataSvc |
Reference to the Event Data Service's IDataProviderSvc interface. | |
IDataProviderSvc * | m_evtDataSvc |
Reference to the Event Data Service's IDataProviderSvc interface. | |
std::string | m_evtsel |
Event selector. | |
IEvtSelector * | m_evtSelector |
Reference to the Event Selector. | |
IEvtSelector * | m_evtSelector |
Reference to the Event Selector. | |
bool | m_firstRun |
IDataManagerSvc * | m_histoDataMgrSvc |
Reference to the Histogram Data Service. | |
IDataManagerSvc * | m_histoDataMgrSvc |
Reference to the Histogram Data Service. | |
IConversionSvc * | m_histoPersSvc |
Reference to the Histogram Persistency Service. | |
IConversionSvc * | m_histoPersSvc |
Reference to the Histogram Persistency Service. | |
std::string | m_histPersName |
Name of the Hist Pers type. | |
HltStoreSvc * | m_HltStoreSvc |
Reference to HltStoreSvc;. | |
HltStoreSvc * | m_HltStoreSvc |
Reference to HltStoreSvc;. | |
IIncidentSvc * | m_incidentSvc |
Reference to the indicent service. | |
IIncidentSvc * | m_incidentSvc |
Reference to the indicent service. | |
Private Attributes | |
bool | m_disableEFResult |
EFResult * | m_efResult |
EFResult * | m_efResult |
EFResult * | m_evtType |
EFResult * | m_evtType |
bool | m_firstEvent |
IRawDataInputSvc * | m_inputSvc |
IRawDataInputSvc * | m_inputSvc |
bool | m_okexecuteEvent |
RAWEVENT * | m_re |
RAWEVENT * | m_re |
char * | m_serializedEFAddress |
Pointer to the local memory containing the EF Fragment. | |
char * | m_serializedEFAddress |
Pointer to the local memory containing the EF Fragment. | |
int | m_timeTest |
int | m_total_nevt |
uint32_t | m_trgType |
Friends | |
class | SvcFactory<EFEventLoopMgr> |
Creator friend class. |
History:
+---------+----------------------------------------------+---------+ | Date | Comment | Who | +---------+----------------------------------------------+---------+ |13/12/00 | Initial version | M.Frank | +---------+----------------------------------------------+---------+
|
Standard Constructor.
00050 : MinimalEventLoopMgr(nam, svcLoc) 00051 { 00052 declareProperty( "EvtSel", m_evtsel ); 00053 declareProperty( "HistogramPersistency", m_histPersName = ""); 00054 declareProperty( "DisableEFResult", m_disableEFResult = true); 00055 declareProperty( "OkexecuteEvent", m_okexecuteEvent = true); 00056 declareProperty( "OutputLevel", m_outputLevel = MSG::ALWAYS); 00057 declareProperty( "TimeTest", m_timeTest = 0); 00058 m_histoDataMgrSvc = 0; 00059 m_histoPersSvc = 0; 00060 m_total_nevt = 0; 00061 m_currentRun = 0; 00062 m_evtDataMgrSvc = 0; 00063 m_evtDataSvc = 0; 00064 m_evtSelector = 0; 00065 m_evtContext = 0; 00066 m_firstRun = true; 00067 m_incidentSvc = 0; 00068 m_trgType = 0; 00069 m_firstEvent = true; 00070 }
|
|
Standard Destructor.
00076 { 00077 if( m_histoDataMgrSvc ) m_histoDataMgrSvc->release(); 00078 if( m_histoPersSvc ) m_histoPersSvc->release(); 00079 if( m_incidentSvc ) m_incidentSvc->release(); 00080 if( m_evtDataMgrSvc ) m_evtDataMgrSvc->release(); 00081 if( m_evtDataSvc ) m_evtDataSvc->release(); 00082 if( m_evtSelector ) m_evtSelector->release(); 00083 if( m_evtContext ) delete m_evtContext; 00084 }
|
|
Standard Constructor.
|
|
Standard Destructor.
|
|
return algorithm tag
Implements IEFEventLoopMgr. |
|
return algorithm tag
Implements IEFEventLoopMgr. 00524 { 00525 MsgStream log( msgSvc(), name() ); 00526 uint32_t alg=m_efResult->getEFVec(0); 00527 //log << MSG::INFO << "The algorithm tag is " << alg<<endreq; 00528 int itype=m_evtType->getMidAnswerIndex(); 00529 //cout <<itype<<endl; 00530 if(itype != -1) alg += (1<<itype); 00531 uint32_t alg16=alg>>16; 00532 log << MSG::DEBUG << "The algorithm tag is " << alg <<":" 00533 << (alg&1)<<((alg>>1)&1)<<((alg>>2)&1)<<((alg>>3)&1) 00534 <<((alg>>4)&1)<<((alg>>5)&1)<<((alg>>6)&1)<<((alg>>7)&1) 00535 << ":%# "<< alg16<<endreq; 00536 return alg; 00537 }
|
|
return data from EF decision
Implements IEFEventLoopMgr. |
|
return data from EF decision
Implements IEFEventLoopMgr. 00481 { 00482 MsgStream log( msgSvc(), name() ); 00483 if (m_disableEFResult) { 00484 std::string defaultEFDecision = "Other" ; 00485 log << MSG::WARNING 00486 << "EFEventLoopMgr:EF_Decision():---> EFResult handling is disabled. Default EFDecision = " 00487 << defaultEFDecision 00488 << endreq; 00489 if (m_okexecuteEvent!=1){ 00490 std::string defaultEFDecision = "Error"; 00491 log << MSG::WARNING 00492 << "EFEventLoopMgr:EF_Decision():---> Error in executeEvent, setting EFDecision to: "<< defaultEFDecision << endreq; 00493 return defaultEFDecision; 00494 } 00495 return defaultEFDecision; 00496 } 00497 else { 00498 //log << MSG::DEBUG << "Try to get the EFDecision" << endreq; 00499 00500 //StatusCode sc = m_HltStoreSvc->get("EFResult", m_efResult); 00501 //enrich the result returned to online 00502 //by Fu Chengdong 00503 if (m_evtType->getAnswerIndex() == -1) { 00504 log << MSG::DEBUG << "EF_Decision(): Unvalid EFResult(AnswerIndex=-1)" << endreq; 00505 return "Error"; 00506 } 00507 std::string answer = m_evtType->getAnswer(); 00508 log << MSG::INFO << "The answer is " << answer << endreq; 00509 return answer; 00510 } 00511 }
|
|
Return a pointer to the local memory containing the EF subdetector fragment.
Implements IEFEventLoopMgr. |
|
Return a pointer to the local memory containing the EF subdetector fragment. EF ROD Create an emply RawEvent and fill the RODs into the RawEvent (FullEventFragment) re Implements IEFEventLoopMgr. 00548 { 00549 //std::cout << "jak:"<<__FILE__<<std::endl; 00550 MsgStream log( msgSvc(), name() ); 00551 00552 if (m_disableEFResult) { 00553 log << MSG::WARNING << "EFEventLoopMgr:EF_Fragment_Address():---> EFResult handling is disabled!!!! No pointer to EF Fragment will be given." << endreq; 00554 return NULL; 00555 00556 } 00557 else { 00558 00559 //log << MSG::DEBUG << "EFEventLoopMgr:EF_Fragment_Address():---> Going to retrieve EFResult, for the Fragment Address"<<endreq; 00560 uint32_t alg=m_efResult->getEFVec(0); 00561 log << MSG::DEBUG << "alg="<<alg<<endreq; 00562 uint32_t num=m_efResult->getEFVec(1); 00563 int nmdc=num&0xFF; 00564 int ntof=(num>>8)&0xFF; 00565 int nemc=(num>>16)&0xFF; 00566 int nmuc=(num>>24)&0xFF; 00567 int ndata=1; 00568 uint32_t ndatap = nmdc+ntof+nemc+nmuc; 00569 ndata += ndatap; 00570 int ndec=m_efResult->getDecNum(); 00571 if(ndec>0) ndata +=(ndec+1); 00572 if((alg&4)&&(!(alg&2))) log << MSG::WARNING<<"sub-algorithms error!"<<endreq; 00573 if((ONLINE_DATA_HEAD+ONLINE_DATA_TAIL)!=40){ 00574 log << MSG::FATAL << "data length error!" <<endreq; 00575 return NULL; 00576 } 00577 log << MSG::INFO<< "sent data lenth=" << ndata+40<<endreq;//byjak 00578 //uint32_t* efAddress=malloc((ndata+ONLINE_DATA_HEAD+ONLINE_DATA_TAIL)*sizeof(uint32_t)); 00579 uint32_t* efAddress=new uint32_t[ndata+ONLINE_DATA_HEAD+ONLINE_DATA_TAIL]; 00580 //std::cout << "fucd-->Address" << efAddress << "; ndata="<<ndata<<std::endl; 00581 if(efAddress==NULL) return NULL; 00582 efAddress[0]=0xbb1234bb; 00583 efAddress[1]=ndata+ONLINE_DATA_HEAD+ONLINE_DATA_TAIL; 00584 efAddress[2]=8; 00585 efAddress[3]=0x3000000; 00586 efAddress[4]=0x7c0000; 00587 efAddress[5]=1; 00588 efAddress[6]=0; 00589 efAddress[7]=0; 00590 efAddress[8]=0xcc1234cc; 00591 efAddress[9]=efAddress[1]-efAddress[2]; 00592 efAddress[10]=0xb; 00593 efAddress[11]=0x3000000; 00594 efAddress[12]=0x7c0000; 00595 efAddress[13]=1; 00596 efAddress[14]=0; 00597 efAddress[15]=3; 00598 efAddress[16]=0; 00599 efAddress[17]=0; 00600 efAddress[18]=0; 00601 efAddress[19]=0xdd1234dd; 00602 efAddress[20]=efAddress[9]-efAddress[10]; 00603 efAddress[21]=8; 00604 efAddress[22]=0x3000000; 00605 efAddress[23]=0x7c0000; 00606 efAddress[24]=1; 00607 efAddress[25]=0; 00608 efAddress[26]=0; 00609 efAddress[27]=0xee1234ee; 00610 efAddress[28]=9; 00611 efAddress[29]=0x3000000; 00612 efAddress[30]=0x7c0000; 00613 efAddress[31]=0; 00614 efAddress[32]=0; 00615 efAddress[33]=0; 00616 efAddress[34]=0; 00617 efAddress[35]=0; 00618 //efAddress[36]=0; 00619 efAddress[36+ndata]=0; 00620 efAddress[37+ndata]=1; 00621 efAddress[38+ndata]=ndata; 00622 efAddress[39+ndata]=1; 00623 efAddress[ONLINE_DATA_HEAD]=m_efResult->getEFVec(1); 00624 if(ndata==1){ 00625 return efAddress; 00626 } 00627 else{ 00628 unsigned int i=1; 00629 for(int j=5;j<5+nmdc;j++){ 00630 efAddress[ONLINE_DATA_HEAD+i]=m_efResult->getEFVec(j); 00631 ++i; 00632 } 00633 for(int j=25;j<25+ntof;j++){ 00634 efAddress[ONLINE_DATA_HEAD+i]=m_efResult->getEFVec(j); 00635 ++i; 00636 } 00637 for(int j=30;j<30+nemc;j++){ 00638 efAddress[ONLINE_DATA_HEAD+i]=m_efResult->getEFVec(j); 00639 ++i; 00640 } 00641 for(int j=52;j<52+nmuc;j++){ 00642 efAddress[ONLINE_DATA_HEAD+i]=m_efResult->getEFVec(j); 00643 ++i; 00644 } 00645 if(ndec>0) { 00646 efAddress[ONLINE_DATA_HEAD+i]=ndec; 00647 ++i; 00648 for(int j=54;j<54+ndec;++j){ 00649 efAddress[ONLINE_DATA_HEAD+i]=m_efResult->getEFVec(j); 00650 ++i; 00651 } 00652 } 00653 log << MSG::DEBUG <<"0th eff data is " 00654 <<((efAddress[ONLINE_DATA_HEAD]>>24)&0xFF) 00655 <<((efAddress[ONLINE_DATA_HEAD]>>16)&0xFF) 00656 <<((efAddress[ONLINE_DATA_HEAD]>>8)&0xFF) 00657 <<((efAddress[ONLINE_DATA_HEAD]>>0)&0xFF)<<endreq; 00658 for(int i=1;i<ndatap+1;i++){ 00659 log << MSG::DEBUG <<i<<"th eff data is " <<*((float*)&(efAddress[ONLINE_DATA_HEAD+i]))<<endreq; 00660 } 00661 for(int i=ndatap+1;i<ndata;i++){ 00662 log << MSG::DEBUG <<i<<"th eff data is " << efAddress[ONLINE_DATA_HEAD+i]<<endreq; 00663 } 00664 return efAddress; 00665 } 00666 00667 return NULL; 00668 00669 //FullEventAssembler<EFSrcIdMap> fea ; 00670 00672 //FullEventAssembler<EFSrcIdMap>::RODDATA* EFROD ; 00673 //EventFormat::SourceID helpEFID(EventFormat::TDAQ_EVENT_FILTER,EventFormat::ROD_TYPE,0); 00674 //uint32_t rodIdEF = helpEFID.source_id(); 00675 00676 /* Create the ROD data container to be filled later */ 00677 //EFROD = fea.getRodData( rodIdEF ); 00678 00679 //std::vector<uint32_t> efVec(m_efResult->getEFVec()); 00680 00681 //for (std::vector<uint32_t>::iterator i=efVec.begin(); 00682 // i!=efVec.end();++i) 00683 //{ 00684 // EFROD->push_back(*i); 00685 // } 00686 00687 00690 //Get ByteStreamCnvSvc 00691 00692 // StatusCode sc; 00693 00694 00695 //Get ByteStreamCnvSvc 00696 //hxt if(StatusCode::SUCCESS != service("ByteStreamCnvSvc",m_ByteStreamEventAccess)){ 00697 //hxt log << MSG::ERROR << " EFEventLoopMgr:EF_Fragment_Address():Can't get ByteStreamEventAccess interface " << endreq; 00698 //hxt return NULL; 00699 //hxt } 00700 00701 //Obtain the RawEvent 00702 /* 00703 log <<MSG::INFO<< "EFEventLoopMgr:EF_Fragment_Address(): Abans del get RawEvent" << endreq; 00704 00705 RawEvent* re = m_ByteStreamEventAccess->getRawEvent(); 00706 00707 log << MSG::INFO <<"EFEventLoopMgr:EF_Fragment_Address(): Despres del get RawEvent" << endreq; 00708 */ 00709 00710 //fea.fill(re,log); 00711 00712 00713 //To serialize RawEvent and obtain a pointer to the memory address 00714 //where the EF SubdetectorFragment is 00715 00716 00717 //Now get SubdetectorFragment from Raw Event 00718 /* 00719 const VDETF& vdetf=re->compounds(); 00720 00721 log << MSG::DEBUG<< " EFEventLoopMgr:EF_Fragment_Address(): Full Event:" << hex << "Full source ID: " << re->header().source_id() <<endreq; 00722 log << MSG::DEBUG<< " EFEventLoopMgr:EF_Fragment_Address(): Fragment size in words:" << re->header().fragment_size_word()<<endreq; 00723 log << MSG::DEBUG<< " EFEventLoopMgr:EF_Fragment_Address(): # of subdetectors:" <<vdetf.size()<<endreq; 00724 00725 00726 VDETF::const_iterator it_detf = vdetf.begin(); 00727 VDETF::const_iterator it_detf_end = vdetf.end(); 00728 00729 00730 //Loop over all Subdetectors 00731 00732 for(; it_detf!=it_detf_end; ++it_detf){ 00733 00734 00735 00736 if(!((*it_detf)->is_valid())){ 00737 00738 log<< MSG::ERROR << "EFEventLoopMgr:EF_Fragment_Address():Got invalid subdetector fragment!. A null pointer will be returned" << endreq; 00739 return NULL; 00740 } 00741 00742 // Get the size of the SubDet fragment in WORDS 00743 int fragSize = (*it_detf)->size_word(); 00744 00745 //Now like in ptdummy::Steering 00746 00747 00748 // Create a NEW memory storage (it mallocs a new region in "local" memory) 00749 EventFormat::RawMemoryStorage store(fragSize*4); 00750 00751 // Serialize the subDetector fragment on the store (on the "local" buffer) 00752 (*it_detf)->serialise(store); 00753 00754 log << MSG::DEBUG<< " EFEventLoopMgr:EF_Fragment_Address():SubDetectorFragment serialized on 'local memory.'" <<endreq; 00755 00756 00757 00758 // Return to pt::Worker the address (p) of the "local" memory region 00759 // containing the serialized EF fragment 00760 00761 m_serializedEFAddress=(char*)store.address(); 00762 00763 // Release the ownership of the 'local' memory region containing the 00764 // serialized Fragment (i.e.: exiting from process() the storage distructor 00765 // will not delete this memory region) 00766 // The memory region MUST be deleted by pt::worker !!! 00767 00768 store.release_memory(); 00769 } 00770 return m_serializedEFAddress; 00771 */ 00772 } 00773 00774 return NULL; 00775 }
|
|
return total energy
Implements IEFEventLoopMgr. |
|
return total energy
Implements IEFEventLoopMgr. 00540 { 00541 MsgStream log( msgSvc(), name() ); 00542 uint32_t etot=m_efResult->getEFVec(31); 00543 log << MSG::INFO << "The total energy is " <<*((float*)&etot) <<"GeV"<<endreq; 00544 return etot; 00545 }
|
|
return version number
Implements IEFEventLoopMgr. |
|
return version number
Implements IEFEventLoopMgr. 00514 { 00515 MsgStream log( msgSvc(), name() ); 00516 uint32_t x=1; 00517 uint32_t y=0; 00518 uint32_t z=0; 00519 uint32_t version=x<<16+y<<8+z; 00520 log << MSG::INFO << "The version is " <<version << endreq; 00521 return version; 00522 }
|
|
implementation of IEventProcessor::executeEvent(void* par)
|
|
implementation of IEventProcessor::executeEvent(void* par)
00248 { 00249 00250 StatusCode sc; 00251 DataObject* pObject = 0; 00252 MsgStream log( msgSvc(), name() ); 00253 //return StatusCode::SUCCESS; 00254 //log << MSG::DEBUG << "EFEventLoopMgr:executeEvent(void* par):Declaring Fragment" << endreq; 00255 //if(pBesTimer&&m_timeTest==1){ 00256 // pBesTimer->start(); 00257 // pStart=true; 00258 //cout<<"time test: start!!!!!!!!!!!!!!!!!!!"<<endl; 00259 //} 00260 if(m_firstEvent) m_re = new RAWEVENT; 00261 else { 00262 m_re->reset(); 00263 m_firstEvent=false; 00264 } 00265 eformat::FullEventFragment<uint32_t*> pre((uint32_t*)par); 00266 try { 00267 pre.check_tree(); 00268 } 00269 catch (eformat::Issue& ex) { 00270 std::cerr << std::endl 00271 << "Uncaught eformat issue: " << ex.what() << std::endl; 00272 return StatusCode::FAILURE ; 00273 } 00274 catch (ers::Issue& ex) { 00275 std::cerr << std::endl 00276 << "Uncaught ERS issue: " << ex.what() << std::endl; 00277 return StatusCode::FAILURE ; 00278 } 00279 catch (std::exception& ex) { 00280 std::cerr << std::endl 00281 << "Uncaught std exception: " << ex.what() << std::endl; 00282 return StatusCode::FAILURE ; 00283 } 00284 catch (...) { 00285 std::cerr << std::endl << "Uncaught unknown exception" << std::endl; 00286 return StatusCode::FAILURE ; 00287 } 00288 00289 log << MSG::DEBUG << "[Event No. #" << pre.global_id() 00290 << "] " << pre.fragment_size_word() << " words in " 00291 << pre.nchildren() << " subdetectors " 00292 << endreq; 00293 00294 m_re->setRunNo(pre.run_no()); 00295 m_re->setEventNo(pre.global_id()); 00296 m_re->setTime(pre.time()); 00297 00298 uint32_t *robs[100]; 00299 int nrobs = eformat::get_robs((uint32_t*)par, (const uint32_t **)robs, 100); 00300 if(nrobs>100) log<<MSG::ERROR<< "ROBFragments' number exceeds than 100!"<<endreq; 00301 00302 for (int robi = 0; robi < nrobs; robi++) { 00303 eformat::ROBFragment<uint32_t*> rob(robs[robi]); 00304 uint32_t status= rob.rod_detev_type(); 00305 uint32_t sourceid = rob.rod_source_id(); 00306 if((status&0x2)&&(sourceid!=0xa50000)) { 00307 std::string answer="Error"; 00308 m_efResult->reset(); 00309 m_evtType->reset(); 00310 m_evtType->setAnswer(answer); 00311 log << MSG::DEBUG << "detector status is "<<status<<endreq; 00312 delete m_re; 00313 return StatusCode::SUCCESS; 00314 } 00315 } 00316 00317 bool trg=false; 00318 for (int robi = 0; robi < nrobs; robi++) { 00319 eformat::ROBFragment<uint32_t*> rob(robs[robi]); 00320 uint32_t* dataptr = NULL; 00321 rob.rod_data(dataptr); 00322 vector<uint32_t> DetElements(dataptr, (dataptr+rob.rod_ndata())); 00323 00324 uint32_t source_id_number = rob.rod_source_id(); 00325 //std::cout<<"#####source_id_number#####"<<source_id_number<<std::endl; 00326 source_id_number <<= 8; 00327 source_id_number >>= 24; 00328 //std::cout<<"#####(source_id_number<<24)>>29#####"<<source_id_number<<std::endl; 00329 //be careful here!!! 00330 log<<MSG::DEBUG<< source_id_number << " Digi size="<<DetElements.size()<<endreq; 00331 switch(source_id_number) 00332 { 00333 case 161: 00334 m_re->addReMdcDigi(dataptr,DetElements.size()); 00335 //if(DetElements.size()>0)std::cout<<hex<<DetElements[0]<<std::endl; 00336 break; 00337 case 163: 00338 m_re->addReEmcDigi(dataptr,DetElements.size()); 00339 break; 00340 case 162: 00341 //std::cout<<"EFEventLoopMgr::TOFDigi size="<<DetElements.size()<<std::endl; 00342 m_re->addReTofDigi(dataptr,DetElements.size()); 00343 break; 00344 case 164: 00345 //std::cout<<"EFEventLoopMgr::MUCDigi size="<<DetElements.size()<<std::endl; 00346 m_re->addReMucDigi(dataptr,DetElements.size()); 00347 break; 00348 case 165: 00349 trg=getTrigChn(dataptr,rob.rod_ndata()); 00350 break; 00351 default: 00352 //std::cerr << "no such subdetector type!" << std::endl; 00353 break; 00354 } 00355 if(trg){ 00356 std::string answer="RandomTrg"; 00357 m_efResult->reset(); 00358 m_evtType->reset(); 00359 m_evtType->setAnswer(answer); 00360 log << MSG::DEBUG << "a random trigger event is taken" << endreq; 00361 m_re->reset(); 00362 return StatusCode::SUCCESS; 00363 } 00364 } 00365 //if(pBesTimer&&m_timeTest==2){ 00366 // pBesTimer->start(); 00367 // pStart=true; 00368 //cout<<"time test: start!!!!!!!!!!!!!!!!!!!"<<endl; 00369 //} 00370 if(!(m_inputSvc->setCurrentEvent(m_re))) { 00371 log << MSG::FATAL << "m_inputSvc->setCurrentEvent(m_re) Failed!" << endreq; 00372 exit(1); 00373 } 00374 00375 if( 0 != m_total_nevt ) { 00376 sc = m_evtDataMgrSvc->clearStore(); 00377 if( !sc.isSuccess() ) { 00378 log << MSG::DEBUG << "Clear of Event data store failed" << endreq; 00379 } 00380 } 00381 00382 // Create event address in the event store 00383 IOpaqueAddress* addr = new RawDataAddress(CLID_Event, "EventHeader", "EventHeader"); 00384 00385 // Set root clears the event data store first 00386 sc = m_evtDataMgrSvc->setRoot ("/Event", addr); 00387 if( !sc.isSuccess() ) { 00388 log << MSG::WARNING << "Error declaring event root address." << endreq; 00389 return sc; 00390 } 00391 sc = m_evtDataSvc->retrieveObject("/Event", pObject); 00392 if( !sc.isSuccess() ) { 00393 log << MSG::WARNING << "Unable to retrieve Event root object" << endreq; 00394 return sc; 00395 } 00396 00397 m_total_nevt++; 00398 // Fire BeginEvent "Incident" 00399 m_incidentSvc->fireIncident(Incident(name(), "BeginEvent")); 00400 // Execute Algorithms 00401 sc = MinimalEventLoopMgr::executeEvent(NULL); 00402 // Fire EndEvent "Incident" 00403 m_incidentSvc->fireIncident(Incident(name(), "EndEvent")); 00404 00405 //if(pBesTimer){ 00406 // pBesTimer->stop(); 00407 // double time=pBesTimer->elapsed(); 00408 // std::cout<<"Run time="<<time<<std::endl; 00409 //} 00410 //delete addr; 00411 //delete m_re; 00412 return sc; 00413 }
|
|
implementation of IAppMgrUI::finalize
|
|
implementation of IAppMgrUI::finalize
00223 { 00224 MsgStream log(msgSvc(), name()); 00225 log << MSG::INFO << " EFEventLoopMgr:finalize():Number of events processed : " << m_total_nevt << endreq; 00226 00227 if ( m_evtSelector && m_evtContext ) { 00228 m_evtSelector->releaseContext(m_evtContext); 00229 m_evtContext = 0; 00230 } 00231 00232 m_histoPersSvc = releaseInterface(m_histoPersSvc); 00233 00234 m_evtSelector = releaseInterface(m_evtSelector); 00235 m_incidentSvc = releaseInterface(m_incidentSvc); 00236 m_evtDataSvc = releaseInterface(m_evtDataSvc); 00237 m_evtDataMgrSvc = releaseInterface(m_evtDataMgrSvc); 00238 00239 return MinimalEventLoopMgr::finalize(); 00240 }
|
|
Create event address using event selector.
|
|
Create event address using event selector.
00416 { 00417 refpAddr = 0; 00418 StatusCode sc = m_evtSelector->next(*m_evtContext); 00419 if ( !sc.isSuccess() ) { 00420 return sc; 00421 } 00422 // Create root address and assign address to data service 00423 sc = m_evtSelector->createAddress(*m_evtContext,refpAddr); 00424 if( !sc.isSuccess() ) { 00425 sc = m_evtSelector->next(*m_evtContext); 00426 if ( sc.isSuccess() ) { 00427 sc = m_evtSelector->createAddress(*m_evtContext,refpAddr); 00428 if ( !sc.isSuccess() ) { 00429 MsgStream log( msgSvc(), name() ); 00430 log << MSG::WARNING << "Error creating IOpaqueAddress." << endreq; 00431 } 00432 } 00433 } 00434 return sc; 00435 }
|
|
whether it is a RrandomTrg
Implements IEFEventLoopMgr. |
|
whether it is a RrandomTrg
Implements IEFEventLoopMgr. 00777 { 00778 MsgStream log( msgSvc(), name() ); 00779 log << MSG::DEBUG << ndata<<":"<<(*data)<<","<<endreq; 00780 uint32_t index = 0; 00781 00782 while (ndata - index > 1) { 00783 uint32_t header= *(data+index); 00784 uint32_t blockSize = ( (header>>14) & 0x3FF); 00785 uint32_t id = (header>>24); 00786 //std::cout << "TriggerChannel:" << hex<<header << "==>" << blockSize<<","<<id 00787 // << ","<<((header >> 8) & 0x3F) << dec<<std::endl; 00788 if (blockSize == 0 || (index+blockSize) > ndata) break; 00789 if (id==0xD3) { 00790 uint32_t window = ((header >> 8) & 0x3F); //Time window, bit8 to bit13, total: 0--31 00791 uint32_t size= blockSize-1; 00792 if(window==0){ 00793 log << MSG::FATAL << "window=0" << endreq; 00794 //return false; 00795 } 00796 else if(size%window != 0) { 00797 log << MSG::FATAL << "GTL data is NOT completed" << endreq; 00798 //return false; 00799 } 00800 //vector<uint32_t> trigData(data+index+1, data+index+size); 00801 for(uint32_t j = 0; j < size; j++) { 00802 uint32_t trgdata = *(data+index+1+j); 00803 uint32_t dataId = ((trgdata >> 24) & 0x7); 00804 //std::cout <<hex<< trgdata << "==>"<< dataId <<"," << (trgdata&0xFFFFFF)<<dec<<std::endl; 00805 if(dataId!=5) continue; 00806 //std::cout <<hex<< trgdata <<dec<<std::endl; 00807 m_trgType= m_trgType|(trgdata&0xFFFF); 00808 if(trgdata&(1<<9)) return true; 00809 //if(trgdata&(1<<8)) return true; 00810 //if(trgdata&(1<<10)) return true; 00811 } 00812 } 00813 index += blockSize; 00814 } 00815 //cout<<m_trgType<<endl; 00816 00817 return false; 00818 }
|
|
implementation of IAppMgrUI::initalize
|
|
implementation of IAppMgrUI::initalize
00090 { 00091 00092 // initialize the base class 00093 StatusCode sc = MinimalEventLoopMgr::initialize(); 00094 // leave this after initialization of base class, otherwise msgSvc is not correctly set up 00095 // ----- 00096 MsgStream log(msgSvc(), name()); 00097 log << MSG::INFO << "EFEventLoopMgr:initalize(): ---> EventLoopMgr = " << name() << " initializing " << endreq; 00098 if ( !sc.isSuccess() ) { 00099 log << MSG::ERROR 00100 << "EFEventLoopMgr:initalize():Failed to initialize base class MinimalEventLoopMgr" 00101 << endreq; 00102 return sc; 00103 } 00104 00105 // Setup access to event data services 00106 sc = serviceLocator()->service("EventDataSvc", m_evtDataMgrSvc, true); 00107 00108 if( !sc.isSuccess() ) { 00109 log << MSG::FATAL << "Error retrieving EventDataSvc interface IDataManagerSvc." << endreq; 00110 return sc; 00111 } 00112 sc = serviceLocator()->service("EventDataSvc", m_evtDataSvc, true); 00113 00114 if( !sc.isSuccess() ) { 00115 log << MSG::FATAL << "Error retrieving EventDataSvc interface IDataProviderSvc." << endreq; 00116 return sc; 00117 } 00118 00119 //------------------------------------------------------------------------------- 00120 // Get the references to the services that are needed by the ApplicationMgr itself 00121 //-------------------------------------------------------------------------------- 00122 sc = serviceLocator()->service("IncidentSvc" , m_incidentSvc, true); 00123 00124 if( !sc.isSuccess() ) { 00125 log << MSG::FATAL << "EFEventLoopMgr:initalize():Error retrieving IncidentSvc" << endreq; 00126 return sc; 00127 } 00128 00129 //------------------------------------------------------------------------------- 00130 // Get the references to the services that are needed by the ApplicationMgr itself 00131 //-------------------------------------------------------------------------------- 00132 sc = serviceLocator()->service("HltStoreSvc" , m_HltStoreSvc, true); 00133 if( !sc.isSuccess() ) { 00134 log << MSG::FATAL << "EFEventLoopMgr:initalize():Error retrieving HltStoreSvc" << endreq; 00135 return sc; 00136 } 00137 00138 //-------------------------------------------------------------------------- 00139 // Access Property Manager interface: 00140 //-------------------------------------------------------------------------- 00141 SmartIF<IProperty> prpMgr(IID_IProperty, serviceLocator()); 00142 if ( !prpMgr.isValid() ) { 00143 log << MSG::FATAL 00144 << "EFEventLoopMgr:initalize():IProperty interface not found in ApplicationMgr." 00145 << endreq; 00146 return StatusCode::FAILURE; 00147 } 00148 00149 //------------------------------------------------------------------------- 00150 // Setup Event Setector 00151 //------------------------------------------------------------------------- 00152 // We do not expect a Event Selector necessarily being declared 00153 setProperty(prpMgr->getProperty("EvtSel")); 00154 00155 if( m_evtsel != "NONE" || m_evtsel.length() == 0) { 00156 00157 sc = serviceLocator()->service( "EventSelector" , m_evtSelector, true ); 00158 if( sc.isSuccess() ) { // Setup Event Selector 00159 sc=m_evtSelector->createContext(m_evtContext); 00160 if( !sc.isSuccess() ) { 00161 log << MSG::FATAL << "Can not create the event selector Context." << endreq; 00162 return sc; 00163 } 00164 } else { 00165 log << MSG::FATAL << "EFEventLoopMgr:initalize():EventSelector not found." << endreq; 00166 return StatusCode::FAILURE; 00167 } 00168 } else { 00169 m_evtSelector = 0; 00170 m_evtContext = 0; 00171 log << MSG::WARNING 00172 << "EFEventLoopMgr:initalize():No service \"EventSelector\" provided : assume \"online\" running " 00173 << endreq; 00174 } 00175 00176 //-------------------------------------------------------------------- 00177 // Get the RawDataInputSvc 00178 //-------------------------------------------------------------------- 00179 IService* svc ; 00180 sc = serviceLocator()->getService("RawDataInputSvc", svc); 00181 if(sc != StatusCode::SUCCESS ) { 00182 log<<MSG::WARNING << " Cant get RawDataInputSvc " <<endreq; 00183 return sc ; 00184 } 00185 00186 m_inputSvc = dynamic_cast<IRawDataInputSvc*> (svc); 00187 if(m_inputSvc == 0 ) { 00188 log<<MSG::WARNING << " Cant cast to RawDataInputSvc " <<endreq; 00189 return StatusCode::FAILURE ; 00190 } 00191 00192 sc = m_HltStoreSvc->get("EventType", m_evtType); 00193 if ( sc.isFailure() ) { 00194 log << MSG::ERROR << "Could not find EventType" << endreq; 00195 return StatusCode::FAILURE ; 00196 } 00197 sc = m_HltStoreSvc->get("EFResult", m_efResult); 00198 if ( sc.isFailure() ) { 00199 log << MSG::ERROR << "Could not find EFResult" << endreq; 00200 return StatusCode::FAILURE ; 00201 } 00202 //cout <<"000000000000000000000000000000 "<<m_timeTest<<endl; 00203 if(m_timeTest){ 00204 //cout <<"111111111111111111111111111111111111"<<endl; 00205 //IBesTimerSvc* timerSvc; 00206 //sc = service( "BesTimerSvc", timerSvc); 00207 //if( sc.isFailure() ) { 00208 // log << MSG::WARNING << ": Unable to locate BesTimer Service" << endreq; 00209 //} 00210 //else{ 00211 //cout <<"222222222222222222222222222222222222222"<<endl; 00212 // pBesTimer=timerSvc->addItem("EventFilterHandler"); 00213 // if(pBesTimer)pBesTimer->propName("nEventFilterHandler"); 00214 //} 00215 } 00216 return StatusCode::SUCCESS; 00217 }
|
|
Retrieve interface ID.
00014 { return IID_IEFEventLoopMgr; }
|
|
Retrieve interface ID.
00014 { return IID_IEFEventLoopMgr; }
|
|
prepare for run step
Implements IEFEventLoopMgr. |
|
prepare for run step
Implements IEFEventLoopMgr. 00455 { 00456 MsgStream log( msgSvc(), name() ); 00457 StatusCode sc; 00458 int run_num = ef_run_number; 00459 log << MSG::DEBUG << " ---> EFprepareForRun::Received run number from PT = " 00460 << run_num << endreq; 00461 00462 log << MSG::DEBUG 00463 << " ---> EFprepareForRun::Setup IOVSvc for run number = " 00464 << run_num << endreq; 00465 const EventInfo* pEvent = new EventInfo(new EventID(run_num,0), new EventType()); 00466 00467 //hxt sc = m_StoreGateSvc->record(pEvent,""); 00468 if(m_currentRun!=run_num) m_incidentSvc-> fireIncident(Incident(name(),"NewRun")); 00469 m_currentRun = run_num; 00470 //Fire BeginRun "Incident" 00471 //m_incidentSvc-> fireIncident(EventIncident(*pEvent, name(),"BeginRun")); 00472 m_incidentSvc-> fireIncident(Incident(name(),"BeginRun")); 00473 return StatusCode::SUCCESS; 00474 }
|
|
implementation of IInterface: queryInterface
|
|
implementation of IInterface: queryInterface
00440 { 00441 if ( IEFEventLoopMgr::interfaceID().versionMatch(riid) ) { 00442 *ppvInterface = (IEFEventLoopMgr*)this; 00443 } 00444 else { 00445 return MinimalEventLoopMgr::queryInterface(riid, ppvInterface); 00446 } 00447 addRef(); 00448 return StatusCode::SUCCESS; 00449 }
|
|
Creator friend class.
|
|
current run number
|
|
|
|
|
|
|
|
Event Context.
|
|
Event Context.
|
|
Reference to the Event Data Service's IDataManagerSvc interface.
|
|
Reference to the Event Data Service's IDataManagerSvc interface.
|
|
Reference to the Event Data Service's IDataProviderSvc interface.
|
|
Reference to the Event Data Service's IDataProviderSvc interface.
|
|
Event selector.
|
|
Reference to the Event Selector.
|
|
Reference to the Event Selector.
|
|
|
|
|
|
|
|
|
|
Reference to the Histogram Data Service.
|
|
Reference to the Histogram Data Service.
|
|
Reference to the Histogram Persistency Service.
|
|
Reference to the Histogram Persistency Service.
|
|
Name of the Hist Pers type.
|
|
Reference to HltStoreSvc;.
|
|
Reference to HltStoreSvc;.
|
|
Reference to the indicent service.
|
|
Reference to the indicent service.
|
|
|
|
|
|
|
|
|
|
|
|
Pointer to the local memory containing the EF Fragment.
|
|
Pointer to the local memory containing the EF Fragment.
|
|
|
|
|
|
|