#include <StepSequencer.h>
Public Member Functions | |
bool | doesExistAlready (std::string) |
bool | doesExistAlready (std::string) |
bool | execSequencer (const std::string &seqID) |
bool | execSequencer (const std::string &seqID) |
StatusCode | execute () |
StatusCode | execute () |
Algorithm * | existingAlg (std::string) |
Algorithm * | existingAlg (std::string) |
StatusCode | finalize () |
StatusCode | finalize () |
StatusCode | initialize () |
StatusCode | initialize () |
StatusCode | initSequencer (HltProcessor::Sequence *) |
StatusCode | initSequencer (HltProcessor::Sequence *) |
void | reset () |
void | reset () |
std::vector< Algorithm * > | searchAlgForEachTE_o (HltProcessor::Sequence *) |
std::vector< Algorithm * > | searchAlgForEachTE_o (HltProcessor::Sequence *) |
StepSequencer (const std::string &name, ISvcLocator *pSvcLocator) | |
StepSequencer (const std::string &name, ISvcLocator *pSvcLocator) | |
~StepSequencer () | |
~StepSequencer () | |
Private Attributes | |
std::map< std::string, std::vector< Algorithm * > > | m_AlgMap |
std::map< std::string, std::vector< Algorithm * > > | m_AlgMap |
Algorithm * | matchAlg |
Algorithm * | matchAlg |
std::vector< Algorithm * > | vMatchAlg |
std::vector< Algorithm * > | vMatchAlg |
|
00032 : 00033 Algorithm(name, pSvcLocator) { }
|
|
00036 { }
|
|
|
|
|
|
|
|
00127 { 00128 MsgStream log( messageService(), name() ); 00129 bool doesExist=false; 00130 std::vector<Algorithm*>* subAlgms = subAlgorithms(); 00131 00132 if(subAlgms->size()==0) { 00133 doesExist=false; 00134 return doesExist; 00135 } 00136 else { 00137 std::vector<Algorithm*>::iterator it = subAlgms->begin(); 00138 for ( ; it != subAlgms->end(); it++) { 00139 if(aName==(*it)->name()) { 00140 log << MSG::WARNING << aName <<" sub-algorithm already created" << endreq; 00141 doesExist=true; 00142 break; 00143 } 00144 } 00145 } 00146 return doesExist; 00147 }
|
|
|
|
00152 { 00153 MsgStream log( messageService(), name() ); 00154 const std::vector<Algorithm*>& algVec = m_AlgMap[seqID]; 00155 /*log << MSG::DEBUG << " Execute Sequencer on a step with " 00156 << algVec.size() << " algorithms." << endreq;*/ 00157 00158 log << MSG::DEBUG << "=============================" << endreq; 00159 00160 std::vector<Algorithm*>::const_iterator it = algVec.begin(); 00161 for(; it != algVec.end(); it++) { 00162 StatusCode sc = (*it)->execute(); 00163 if (sc.isFailure()) { 00164 log << MSG::ERROR << (*it)->name() << " execute failed" << endreq; 00165 return false; 00166 } 00167 } 00168 00169 return true; 00170 }
|
|
00022 { return StatusCode::SUCCESS; }
|
|
00022 { return StatusCode::SUCCESS; }
|
|
|
|
00111 { 00112 MsgStream log( messageService(), name() ); 00113 Algorithm* exAlg; 00114 std::vector<Algorithm*>* subAlgms = subAlgorithms(); 00115 std::vector<Algorithm*>::iterator it = subAlgms->begin(); 00116 for ( ; it != subAlgms->end(); it++) { 00117 if(subAlgName==(*it)->name()) { 00118 log << subAlgName<<" already created, return pointer to it "<< endreq; 00119 return *it; 00120 } 00121 } 00122 return exAlg; 00123 }
|
|
00023 { return StatusCode::SUCCESS; }
|
|
00023 { return StatusCode::SUCCESS; }
|
|
00021 { return StatusCode::SUCCESS; }
|
|
00021 { return StatusCode::SUCCESS; }
|
|
|
|
00056 { 00057 MsgStream log( messageService(), name() ); 00058 00059 std::string SubAlg_type, SubAlg_name, SubAlg_param, SubAlg_NameParam,AlgNameFromConfig ; 00060 Algorithm* pAlg; 00061 Algorithm* bAlg; 00062 00063 //read in algorithms in sequence and initialize them 00064 log<< MSG::DEBUG << "Sequence " << sequence->getSeqID() 00065 <<" has " << sequence->algoNum() << " algorithms " << endreq; 00066 00067 std::vector<Algorithm*> helpAlgVec; 00068 std::vector<std::string>::iterator algI = sequence->algoVector().begin(); 00069 00070 for ( ; algI != sequence->algoVector().end(); algI++){ 00071 std::string alg_def = *algI; 00072 log << MSG::DEBUG << "algorithm : " << alg_def << endreq; 00073 findAlgTypeName(alg_def,SubAlg_type,SubAlg_NameParam); 00074 findParamSet(SubAlg_NameParam,AlgNameFromConfig,SubAlg_param); 00075 SubAlg_name=AlgNameFromConfig+"_"+SubAlg_param; 00076 00077 //check if the name exists, don't create again the subalgorithm, just added to the AlgoTePairs vector 00078 bool subAlgExist = doesExistAlready(SubAlg_name); 00079 if(!subAlgExist) { 00080 StatusCode sc = createSubAlgorithm(SubAlg_type, SubAlg_name, pAlg); 00081 if(sc.isFailure() ) { 00082 log << MSG::FATAL << alg_def <<" sub-algorithm create failed!" << endreq; 00083 return sc; 00084 } 00085 log << MSG::DEBUG << "created " << SubAlg_type << "/" << SubAlg_name << endreq; 00086 bAlg = dynamic_cast<Algorithm*>(pAlg); 00087 bAlg->initialize(); 00088 bAlg->beginRun(); 00089 StringProperty paramSet("ParamSetFile", SubAlg_param); 00090 bAlg->setProperty(paramSet); 00091 00092 helpAlgVec.push_back(bAlg); 00093 } else { 00094 pAlg = existingAlg(SubAlg_name); 00095 bAlg = dynamic_cast<Algorithm*>(pAlg); 00096 //bAlg->set_isReRunable(); 00097 StringProperty paramSet("ParamSetFile",SubAlg_param); 00098 bAlg->setProperty(paramSet); 00099 helpAlgVec.push_back(bAlg); 00100 } 00101 } 00102 m_AlgMap[sequence->getSeqID()] = helpAlgVec; 00103 00104 log << MSG::INFO << "Initialization of "<< name() << " completed successfully" << endreq; 00105 return StatusCode::SUCCESS; 00106 }
|
|
|
|
00040 { 00041 std::map<std::string, std::vector<Algorithm*> >::iterator it = m_AlgMap.begin(); 00042 for ( ; it != m_AlgMap.end(); it++) { 00043 //std::cout << "@reset(): " << it->first << std::endl; 00044 const std::vector<Algorithm*>& algs = it->second; 00045 int n = algs.size(); 00046 for (int i = 0; i < n; i++) { 00047 if (IEFAlgorithm* ialg = dynamic_cast<IEFAlgorithm*>(algs[i])) { 00048 //std::cout << " @reset(): " << algs[i]->name() << " p: " << ialg << std::endl; 00049 ialg->reset(); 00050 } 00051 } 00052 } 00053 }
|
|
|
|
00173 { 00174 00175 MsgStream log( messageService(), name() ); 00176 std::string SubAlg_type, SubAlg_name, SubAlg_param, SubAlg_NameParam,AlgNameFromConfig; 00177 00178 /* std::string n=name(); 00179 std::string::size_type p_end, p_begin; 00180 p_end=n.size(); 00181 p_begin=p_end-3; 00182 std::string instance=n.substr( p_begin, p_end);*/ 00183 00184 vMatchAlg.clear(); 00185 std::vector<std::string>::iterator It = seq->algoVector().begin(); 00186 for ( ; It < seq->algoVector().end(); It++) { 00187 std::string alg_defin = *It; 00188 findAlgTypeName(alg_defin,SubAlg_type,SubAlg_NameParam); 00189 findParamSet(SubAlg_NameParam,AlgNameFromConfig,SubAlg_param); 00190 SubAlg_name=AlgNameFromConfig+"_"+SubAlg_param; 00191 00192 /*std::vector<std::pair<Algorithm*,HltElement* > >::iterator I; 00193 for(I=AlgoTEPairs.begin();I!=AlgoTEPairs.end();++I) { 00194 00195 if( SubAlg_name==(I->first)->name() && (I->second)->label()==seq->outputLabel() ) { 00196 matchAlg=I->first; 00197 vMatchAlg.push_back(matchAlg); 00198 } 00199 }*/ 00200 } 00201 return vMatchAlg; 00202 }
|
|
|
|
|
|
|
|
|
|
|
|
|