6#include "GaudiKernel/MsgStream.h"
7#include "GaudiKernel/Property.h"
8#include "GaudiKernel/ISvcLocator.h"
14 std::string& SubAlg_type,
15 std::string& SubAlg_NameParam)
17 int slash_pos =
property.find_first_of(
"/");
18 SubAlg_type =
property.substr( 0, slash_pos );
19 SubAlg_NameParam = (slash_pos > 0) ? property.substr( slash_pos + 1) : SubAlg_type;
23 std::string& SubAlg_name,
24 std::string& SubAlg_param)
26 int slash_pos =
property.find_first_of(
"/");
27 SubAlg_name =
property.substr( 0, slash_pos );
28 SubAlg_param = (slash_pos > 0) ? property.substr( slash_pos + 1) : SubAlg_name;
33 Algorithm(name, pSvcLocator) {
43 std::map<std::string, std::vector<Algorithm*> >::iterator it = m_AlgMap.begin();
44 for ( ; it != m_AlgMap.end(); it++) {
46 const std::vector<Algorithm*>& algs = it->second;
48 for (
int i = 0; i <
n; i++) {
59 MsgStream log( messageService(), name() );
61 std::string SubAlg_type, SubAlg_name, SubAlg_param, SubAlg_NameParam,AlgNameFromConfig ;
66 log<< MSG::DEBUG <<
"Sequence " << sequence->
getSeqID()
67 <<
" has " << sequence->
algoNum() <<
" algorithms " << endreq;
69 std::vector<Algorithm*> helpAlgVec;
70 std::vector<std::string>::iterator algI = sequence->
algoVector().begin();
72 for ( ; algI != sequence->
algoVector().end(); algI++){
73 std::string alg_def = *algI;
74 log << MSG::DEBUG <<
"algorithm : " << alg_def << endreq;
76 findParamSet(SubAlg_NameParam,AlgNameFromConfig,SubAlg_param);
77 SubAlg_name=AlgNameFromConfig+
"_"+SubAlg_param;
82 StatusCode sc = createSubAlgorithm(SubAlg_type, SubAlg_name, pAlg);
84 log << MSG::FATAL << alg_def <<
" sub-algorithm create failed!" << endreq;
87 log << MSG::DEBUG <<
"created " << SubAlg_type <<
"/" << SubAlg_name << endreq;
88 bAlg =
dynamic_cast<Algorithm*
>(pAlg);
91 StringProperty paramSet(
"ParamSetFile", SubAlg_param);
92 bAlg->setProperty(paramSet);
94 helpAlgVec.push_back(bAlg);
97 bAlg =
dynamic_cast<Algorithm*
>(pAlg);
99 StringProperty paramSet(
"ParamSetFile",SubAlg_param);
100 bAlg->setProperty(paramSet);
101 helpAlgVec.push_back(bAlg);
104 m_AlgMap[sequence->
getSeqID()] = helpAlgVec;
106 log << MSG::INFO <<
"Initialization of "<< name() <<
" completed successfully" << endreq;
107 return StatusCode::SUCCESS;
114 MsgStream log( messageService(), name() );
116 std::vector<Algorithm*>* subAlgms = subAlgorithms();
117 std::vector<Algorithm*>::iterator it = subAlgms->begin();
118 for ( ; it != subAlgms->end(); it++) {
119 if(subAlgName==(*it)->name()) {
120 log << subAlgName<<
" already created, return pointer to it "<< endreq;
130 MsgStream log( messageService(), name() );
131 bool doesExist=
false;
132 std::vector<Algorithm*>* subAlgms = subAlgorithms();
134 if(subAlgms->size()==0) {
139 std::vector<Algorithm*>::iterator it = subAlgms->begin();
140 for ( ; it != subAlgms->end(); it++) {
141 if(aName==(*it)->name()) {
142 log << MSG::WARNING << aName <<
" sub-algorithm already created" << endreq;
155 MsgStream log( messageService(), name() );
156 const std::vector<Algorithm*>& algVec = m_AlgMap[seqID];
160 log << MSG::DEBUG <<
"=============================" << endreq;
162 std::vector<Algorithm*>::const_iterator it = algVec.begin();
163 for(; it != algVec.end(); it++) {
164 StatusCode sc = (*it)->execute();
165 if (sc.isFailure()) {
166 log << MSG::ERROR << (*it)->name() <<
" execute failed" << endreq;
177 MsgStream log( messageService(), name() );
178 std::string SubAlg_type, SubAlg_name, SubAlg_param, SubAlg_NameParam,AlgNameFromConfig;
187 std::vector<std::string>::iterator It = seq->
algoVector().begin();
189 std::string alg_defin = *It;
191 findParamSet(SubAlg_NameParam,AlgNameFromConfig,SubAlg_param);
192 SubAlg_name=AlgNameFromConfig+
"_"+SubAlg_param;
void findParamSet(const std::string &property, std::string &SubAlg_name, std::string &SubAlg_param)
void findAlgTypeName(const std::string &property, std::string &SubAlg_type, std::string &SubAlg_NameParam)
int algoNum() const
Retrieve number of algorithms.
const std::string & getSeqID() const
std::vector< std::string > & algoVector()
Retrieve algorithm vector reference.
StepSequencer(const std::string &name, ISvcLocator *pSvcLocator)
Algorithm * existingAlg(std::string)
bool doesExistAlready(std::string)
StatusCode initSequencer(HltProcessor::Sequence *)
std::vector< Algorithm * > searchAlgForEachTE_o(HltProcessor::Sequence *)
bool execSequencer(const std::string &seqID)