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) {
52 MsgStream log( messageService(), name() );
53 std::map<std::string, std::vector<Algorithm*> >::iterator it = m_AlgMap.begin();
54 log << MSG::DEBUG <<
"the size of algorithm map is " << m_AlgMap.size() << endreq;
55 for ( ; it != m_AlgMap.end(); it++) {
56 log << MSG::DEBUG <<
"reset() of " << it->first << endreq;
57 const std::vector<Algorithm*>& algs = it->second;
59 for (
int i = 0; i <
n; i++) {
70 MsgStream log( messageService(), name() );
72 std::string SubAlg_type, SubAlg_name, SubAlg_param, SubAlg_NameParam,AlgNameFromConfig ;
77 log<< MSG::DEBUG <<
"Sequence " << sequence->
getSeqID()
78 <<
" has " << sequence->
algoNum() <<
" algorithms " << endreq;
80 std::vector<Algorithm*> helpAlgVec;
81 std::vector<std::string>::iterator algI = sequence->
algoVector().begin();
83 for ( ; algI != sequence->
algoVector().end(); algI++){
84 std::string alg_def = *algI;
85 log << MSG::DEBUG <<
"algorithm : " << alg_def << endreq;
87 findParamSet(SubAlg_NameParam,AlgNameFromConfig,SubAlg_param);
88 SubAlg_name=AlgNameFromConfig+
"_"+SubAlg_param;
93 StatusCode sc = createSubAlgorithm(SubAlg_type, SubAlg_name, pAlg);
95 log << MSG::FATAL << alg_def <<
" sub-algorithm create failed!" << endreq;
98 log << MSG::DEBUG <<
"created " << SubAlg_type <<
"/" << SubAlg_name << endreq;
99 bAlg =
dynamic_cast<Algorithm*
>(pAlg);
102 StringProperty paramSet(
"ParamSetFile", SubAlg_param);
103 bAlg->setProperty(paramSet);
105 helpAlgVec.push_back(bAlg);
108 bAlg =
dynamic_cast<Algorithm*
>(pAlg);
110 StringProperty paramSet(
"ParamSetFile",SubAlg_param);
111 bAlg->setProperty(paramSet);
112 helpAlgVec.push_back(bAlg);
115 m_AlgMap[sequence->
getSeqID()] = helpAlgVec;
117 log << MSG::INFO <<
"Initialization of "<< name() <<
" completed successfully" << endreq;
118 return StatusCode::SUCCESS;
125 MsgStream log( messageService(), name() );
127 std::vector<Algorithm*>* subAlgms = subAlgorithms();
128 std::vector<Algorithm*>::iterator it = subAlgms->begin();
129 for ( ; it != subAlgms->end(); it++) {
130 if(subAlgName==(*it)->name()) {
131 log << subAlgName<<
" already created, return pointer to it "<< endreq;
141 MsgStream log( messageService(), name() );
142 bool doesExist=
false;
143 std::vector<Algorithm*>* subAlgms = subAlgorithms();
145 if(subAlgms->size()==0) {
150 std::vector<Algorithm*>::iterator it = subAlgms->begin();
151 for ( ; it != subAlgms->end(); it++) {
152 if(aName==(*it)->name()) {
153 log << MSG::WARNING << aName <<
" sub-algorithm already created" << endreq;
166 MsgStream log( messageService(), name() );
167 const std::vector<Algorithm*>& algVec = m_AlgMap[seqID];
171 log << MSG::DEBUG <<
"=============================" << endreq;
173 std::vector<Algorithm*>::const_iterator it = algVec.begin();
174 for(; it != algVec.end(); it++) {
175 StatusCode sc = (*it)->execute();
176 if (sc.isFailure()) {
177 log << MSG::ERROR << (*it)->name() <<
" execute failed" << endreq;
188 MsgStream log( messageService(), name() );
189 std::string SubAlg_type, SubAlg_name, SubAlg_param, SubAlg_NameParam,AlgNameFromConfig;
198 std::vector<std::string>::iterator It = seq->
algoVector().begin();
200 std::string alg_defin = *It;
202 findParamSet(SubAlg_NameParam,AlgNameFromConfig,SubAlg_param);
203 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)