8 #include "GaudiKernel/EventContext.h"
13 ISvcLocator* pSvcLocator ) :
14 base_class(
name, pSvcLocator),
15 m_evtStore(
"StoreGateSvc",
name),
17 m_cutflowSvc(
"",
name),
19 m_cutflowSvc(
"CutFlowSvc/CutFlowSvc",
name),
21 m_algstateSvc(
"AlgExecStateSvc",
name)
52 return StatusCode::SUCCESS;
60 return StatusCode::SUCCESS;
69 std::set<std::string> uniStreams;
74 uniStreams.insert(iter->first);
79 uniStreams.insert(iter->first);
84 uniStreams.insert(iter->first);
107 status = StatusCode::FAILURE;
110 std::vector<std::string> tmpvec;
114 status = StatusCode::SUCCESS;
122 const std::string&
name,
const std::string&
stream)
125 std::map<std::string, std::vector<std::string> >
::iterator it = streamsModeMap.find(
stream);
126 if(
it != streamsModeMap.end()){
130 bool algexist =
false;
132 for(
auto vit = (
it->second).begin();
133 vit != (
it->second).end(); ++vit) {
138 <<
" of stream " <<
stream
139 <<
" has already been registered!");
140 return StatusCode::FAILURE;
147 if(algexist ==
false){
148 std::vector<std::string> &tmpvec =
it->second;
149 tmpvec.push_back(
name);
154 std::vector<std::string> tmpvec;
155 tmpvec.push_back(
name);
156 streamsModeMap[
stream] = std::move(tmpvec);
159 return StatusCode::SUCCESS;
174 const std::string&
stream)
185 const std::string&
stream)
201 const std::vector<std::string>
206 return std::vector<std::string>();
210 const std::vector<std::string>
215 return std::vector<std::string>();
219 const std::vector<std::string>
224 return std::vector<std::string>();
245 const EventContext& ectx)
const
253 bool found_accept =
false;
254 bool found_require =
false;
255 bool found_veto =
false;
262 const auto &vecAlgs = itAlgs->second;
267 if ( ! vecAlgs.empty( ) ) {
269 for (
auto it = vecAlgs.begin();
it != vecAlgs.end();
it++) {
271 isE = (
m_algstateSvc->algExecState(*
it,ectx).state() == AlgExecState::State::Done);
284 found_require =
true;
286 const auto &vecAlgs = itAlgs->second;
291 if ( ! vecAlgs.empty( ) ) {
292 for (
auto it = vecAlgs.begin();
it != vecAlgs.end();
it++) {
294 isE = (
m_algstateSvc->algExecState(*
it,ectx).state() == AlgExecState::State::Done);
309 const auto &vecAlgs = itAlgs->second;
314 if ( ! vecAlgs.empty( ) ) {
315 for (
auto it = vecAlgs.begin();
it != vecAlgs.end();
it++) {
317 isE = (
m_algstateSvc->algExecState(*
it,ectx).state() == AlgExecState::State::Done);
327 if(found_accept ==
false && found_require ==
false && found_veto ==
false){
328 ATH_MSG_DEBUG(
"Stream: " <<
stream <<
" not found registered in DecisionSvc -- accepting event by default ");
341 auto teststreams = [](
const auto&
m)
343 for (
const auto&
p :
m)
344 if (!
p.second.empty())
return true;
355 return StatusCode::RECOVERABLE;
373 for(
auto ait = m_streamNames.begin();
374 ait != m_streamNames.end(); ++ait) {
376 const std::vector<std::string> *accFilt=
nullptr;
377 const std::vector<std::string> *reqFilt=
nullptr;
378 const std::vector<std::string> *vetFilt=
nullptr;
379 std::vector< const std::vector<std::string>* > totFilt;
380 if (
auto itr = m_stream_accept.find(
streamName); itr != m_stream_accept.end()) {
381 accFilt = &itr->second;
382 totFilt.push_back(accFilt);
384 if (
auto itr = m_stream_require.find(
streamName); itr != m_stream_require.end()) {
385 reqFilt = &itr->second;
386 totFilt.push_back(reqFilt);
388 if (
auto itr = m_stream_veto.find(
streamName); itr != m_stream_veto.end()) {
389 vetFilt = &itr->second;
390 totFilt.push_back(vetFilt);
395 std::string accstring(
""), reqstring(
""), vetstring(
"");
397 for (
auto it = accFilt->begin();
it != accFilt->end(); ++
it) {
398 if(!accstring.empty()) accstring +=
"||";
399 else accstring +=
'(';
404 for (
auto it = reqFilt->begin();
it != reqFilt->end(); ++
it) {
405 if(!reqstring.empty()) reqstring +=
"&&";
406 else reqstring +=
'(';
411 for (
auto it = vetFilt->begin();
it != vetFilt->end(); ++
it) {
412 if(!vetstring.empty()) vetstring +=
"||";
413 else vetstring +=
'(';
417 std::string logicalKey(
"");
418 if(!accstring.empty()) {
420 logicalKey += accstring;
422 if(!reqstring.empty()) {
424 if (!logicalKey.empty()) logicalKey +=
"&&";
425 logicalKey += reqstring;
427 if(!vetstring.empty()) {
429 if (!logicalKey.empty()) logicalKey +=
"&&";
431 logicalKey += vetstring;
434 if (logicalKey.empty()) logicalKey=
"PassThru";
438 for(
auto vec = totFilt.begin();
439 vec != totFilt.end(); ++
vec) {
441 for (
auto filter = (*vec)->begin();
443 if(!m_cutflowSvc.empty()) {m_cutflowSvc->registerTopFilter( (*
filter), logicalKey, 2,
streamName,
true ); }
448 return StatusCode::SUCCESS;