BOSS 7.0.2
BESIII Offline Software System
Loading...
Searching...
No Matches
StepSequencer Class Reference

#include <StepSequencer.h>

+ Inheritance diagram for StepSequencer:

Public Member Functions

 StepSequencer (const std::string &name, ISvcLocator *pSvcLocator)
 
 ~StepSequencer ()
 
virtual bool isEnabled () const
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 
void reset ()
 
StatusCode initSequencer (HltProcessor::Sequence *)
 
bool execSequencer (const std::string &seqID)
 
std::vector< Algorithm * > searchAlgForEachTE_o (HltProcessor::Sequence *)
 
bool doesExistAlready (std::string)
 
Algorithm * existingAlg (std::string)
 
 StepSequencer (const std::string &name, ISvcLocator *pSvcLocator)
 
 ~StepSequencer ()
 
virtual bool isEnabled () const
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 
void reset ()
 
StatusCode initSequencer (HltProcessor::Sequence *)
 
bool execSequencer (const std::string &seqID)
 
std::vector< Algorithm * > searchAlgForEachTE_o (HltProcessor::Sequence *)
 
bool doesExistAlready (std::string)
 
Algorithm * existingAlg (std::string)
 

Detailed Description

Constructor & Destructor Documentation

◆ StepSequencer() [1/2]

StepSequencer::StepSequencer ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 32 of file StepSequencer.cxx.

32 :
33 Algorithm(name, pSvcLocator) {
34 m_isEnabled = false;
35}

◆ ~StepSequencer() [1/2]

StepSequencer::~StepSequencer ( )

Definition at line 38 of file StepSequencer.cxx.

38 {
39 /*
40 std::vector<Algorithm*>* subAlgms = subAlgorithms();
41 std::vector<Algorithm *>::iterator it;
42 for (it = subAlgms->begin(); it != subAlgms->end(); it++) {
43 std::cout << *it << (*it)->name() << std::endl;
44 (*it)->release();
45 }
46 */
47}

◆ StepSequencer() [2/2]

StepSequencer::StepSequencer ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

◆ ~StepSequencer() [2/2]

StepSequencer::~StepSequencer ( )

Member Function Documentation

◆ doesExistAlready() [1/2]

bool StepSequencer::doesExistAlready ( std::string  aName)

Definition at line 139 of file StepSequencer.cxx.

140{
141 MsgStream log( messageService(), name() );
142 bool doesExist=false;
143 std::vector<Algorithm*>* subAlgms = subAlgorithms();
144
145 if(subAlgms->size()==0) {
146 doesExist=false;
147 return doesExist;
148 }
149 else {
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;
154 doesExist=true;
155 break;
156 }
157 }
158 }
159 return doesExist;
160}

Referenced by initSequencer().

◆ doesExistAlready() [2/2]

bool StepSequencer::doesExistAlready ( std::string  )

◆ execSequencer() [1/2]

bool StepSequencer::execSequencer ( const std::string &  seqID)

Definition at line 164 of file StepSequencer.cxx.

165{
166 MsgStream log( messageService(), name() );
167 const std::vector<Algorithm*>& algVec = m_AlgMap[seqID];
168 /*log << MSG::DEBUG << " Execute Sequencer on a step with "
169 << algVec.size() << " algorithms." << endreq;*/
170
171 log << MSG::DEBUG << "=============================" << endreq;
172
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;
178 return false;
179 }
180 }
181
182 return true;
183}

Referenced by StepHandler::execute().

◆ execSequencer() [2/2]

bool StepSequencer::execSequencer ( const std::string &  seqID)

◆ execute() [1/2]

StatusCode StepSequencer::execute ( )
inline

Definition at line 23 of file EventFilter/HltProcessor/HltSteering/HltSteering-01-01-05/HltSteering/StepSequencer.h.

23{ return StatusCode::SUCCESS; }

◆ execute() [2/2]

StatusCode StepSequencer::execute ( )
inline

Definition at line 23 of file InstallArea/include/HltSteering/HltSteering/StepSequencer.h.

23{ return StatusCode::SUCCESS; }

◆ existingAlg() [1/2]

Algorithm * StepSequencer::existingAlg ( std::string  subAlgName)

Definition at line 123 of file StepSequencer.cxx.

124{
125 MsgStream log( messageService(), name() );
126 Algorithm* exAlg;
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;
132 return *it;
133 }
134 }
135 return exAlg;
136}

Referenced by initSequencer().

◆ existingAlg() [2/2]

Algorithm * StepSequencer::existingAlg ( std::string  )

◆ finalize() [1/2]

StatusCode StepSequencer::finalize ( )
inline

Definition at line 24 of file EventFilter/HltProcessor/HltSteering/HltSteering-01-01-05/HltSteering/StepSequencer.h.

24{ return StatusCode::SUCCESS; }

◆ finalize() [2/2]

StatusCode StepSequencer::finalize ( )
inline

Definition at line 24 of file InstallArea/include/HltSteering/HltSteering/StepSequencer.h.

24{ return StatusCode::SUCCESS; }

◆ initialize() [1/2]

StatusCode StepSequencer::initialize ( )
inline

Definition at line 22 of file EventFilter/HltProcessor/HltSteering/HltSteering-01-01-05/HltSteering/StepSequencer.h.

22{ return StatusCode::SUCCESS; }

◆ initialize() [2/2]

StatusCode StepSequencer::initialize ( )
inline

Definition at line 22 of file InstallArea/include/HltSteering/HltSteering/StepSequencer.h.

22{ return StatusCode::SUCCESS; }

◆ initSequencer() [1/2]

StatusCode StepSequencer::initSequencer ( HltProcessor::Sequence sequence)

Definition at line 69 of file StepSequencer.cxx.

69 {
70 MsgStream log( messageService(), name() );
71
72 std::string SubAlg_type, SubAlg_name, SubAlg_param, SubAlg_NameParam,AlgNameFromConfig ;
73 Algorithm* pAlg;
74 Algorithm* bAlg;
75
76 //read in algorithms in sequence and initialize them
77 log<< MSG::DEBUG << "Sequence " << sequence->getSeqID()
78 <<" has " << sequence->algoNum() << " algorithms " << endreq;
79
80 std::vector<Algorithm*> helpAlgVec;
81 std::vector<std::string>::iterator algI = sequence->algoVector().begin();
82
83 for ( ; algI != sequence->algoVector().end(); algI++){
84 std::string alg_def = *algI;
85 log << MSG::DEBUG << "algorithm : " << alg_def << endreq;
86 findAlgTypeName(alg_def,SubAlg_type,SubAlg_NameParam);
87 findParamSet(SubAlg_NameParam,AlgNameFromConfig,SubAlg_param);
88 SubAlg_name=AlgNameFromConfig+"_"+SubAlg_param;
89
90 //check if the name exists, don't create again the subalgorithm, just added to the AlgoTePairs vector
91 bool subAlgExist = doesExistAlready(SubAlg_name);
92 if(!subAlgExist) {
93 StatusCode sc = createSubAlgorithm(SubAlg_type, SubAlg_name, pAlg);
94 if(sc.isFailure() ) {
95 log << MSG::FATAL << alg_def <<" sub-algorithm create failed!" << endreq;
96 return sc;
97 }
98 log << MSG::DEBUG << "created " << SubAlg_type << "/" << SubAlg_name << endreq;
99 bAlg = dynamic_cast<Algorithm*>(pAlg);
100 bAlg->initialize();
101 bAlg->beginRun();
102 StringProperty paramSet("ParamSetFile", SubAlg_param);
103 bAlg->setProperty(paramSet);
104
105 helpAlgVec.push_back(bAlg);
106 } else {
107 pAlg = existingAlg(SubAlg_name);
108 bAlg = dynamic_cast<Algorithm*>(pAlg);
109 //bAlg->set_isReRunable();
110 StringProperty paramSet("ParamSetFile",SubAlg_param);
111 bAlg->setProperty(paramSet);
112 helpAlgVec.push_back(bAlg);
113 }
114 }
115 m_AlgMap[sequence->getSeqID()] = helpAlgVec;
116
117 log << MSG::INFO << "Initialization of "<< name() << " completed successfully" << endreq;
118 return StatusCode::SUCCESS;
119}
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.
Definition: Sequence.cxx:18
std::vector< std::string > & algoVector()
Retrieve algorithm vector reference.
Definition: Sequence.cxx:13
Algorithm * existingAlg(std::string)
bool doesExistAlready(std::string)

Referenced by StepHandler::beginRun().

◆ initSequencer() [2/2]

StatusCode StepSequencer::initSequencer ( HltProcessor::Sequence )

◆ isEnabled() [1/2]

virtual bool StepSequencer::isEnabled ( ) const
inlinevirtual

◆ isEnabled() [2/2]

virtual bool StepSequencer::isEnabled ( ) const
inlinevirtual

Definition at line 21 of file InstallArea/include/HltSteering/HltSteering/StepSequencer.h.

21{return m_isEnabled;};

◆ reset() [1/2]

void StepSequencer::reset ( )

Definition at line 50 of file StepSequencer.cxx.

51{
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;
58 int n = algs.size();
59 for (int i = 0; i < n; i++) {
60 if (IEFAlgorithm* ialg = dynamic_cast<IEFAlgorithm*>(algs[i])) {
61 //std::cout << " @reset(): " << algs[i]->name() << " p: " << ialg << std::endl;
62 ialg->reset();
63 }
64 }
65 }
66}
const Int_t n

Referenced by StepHandler::execute().

◆ reset() [2/2]

void StepSequencer::reset ( )

◆ searchAlgForEachTE_o() [1/2]

std::vector< Algorithm * > StepSequencer::searchAlgForEachTE_o ( HltProcessor::Sequence seq)

Definition at line 185 of file StepSequencer.cxx.

186{
187
188 MsgStream log( messageService(), name() );
189 std::string SubAlg_type, SubAlg_name, SubAlg_param, SubAlg_NameParam,AlgNameFromConfig;
190
191 /* std::string n=name();
192 std::string::size_type p_end, p_begin;
193 p_end=n.size();
194 p_begin=p_end-3;
195 std::string instance=n.substr( p_begin, p_end);*/
196
197 vMatchAlg.clear();
198 std::vector<std::string>::iterator It = seq->algoVector().begin();
199 for ( ; It < seq->algoVector().end(); It++) {
200 std::string alg_defin = *It;
201 findAlgTypeName(alg_defin,SubAlg_type,SubAlg_NameParam);
202 findParamSet(SubAlg_NameParam,AlgNameFromConfig,SubAlg_param);
203 SubAlg_name=AlgNameFromConfig+"_"+SubAlg_param;
204
205 /*std::vector<std::pair<Algorithm*,HltElement* > >::iterator I;
206 for(I=AlgoTEPairs.begin();I!=AlgoTEPairs.end();++I) {
207
208 if( SubAlg_name==(I->first)->name() && (I->second)->label()==seq->outputLabel() ) {
209 matchAlg=I->first;
210 vMatchAlg.push_back(matchAlg);
211 }
212 }*/
213 }
214 return vMatchAlg;
215}

◆ searchAlgForEachTE_o() [2/2]

std::vector< Algorithm * > StepSequencer::searchAlgForEachTE_o ( HltProcessor::Sequence )

The documentation for this class was generated from the following files: