From 894e741cfdbc751410ff2e502ad0fc6ee5735290 Mon Sep 17 00:00:00 2001
From: Francesca Pastore <Francesca.Pastore@cern.ch>
Date: Wed, 11 Feb 2015 17:31:51 +0100
Subject: [PATCH] Added streamTag into xAODEventInfo (ATR-9029)
 (TrigSteering-03-07-16)

	* Added streamTag into xAODEventInfo (ATR-9029)
	* TrigSteering-03-07-16

2015-02-09 Francesca Pastore
	* Change logic in calling the pre-fetching (ATR-9214)
	* TrigSteering-03-07-15

2015-02-05 Joerg Stelzer
	* Add loading of algorithms from Run2 database
	* TrigSteering-03-07-14
---
 .../TrigSteer/TrigSteering/cmt/requirements   |  1 +
 .../TrigSteering/python/TrigSteeringConfig.py |  4 +--
 .../TrigSteering/src/ResultBuilder.cxx        | 33 +++++++++++++++++++
 .../TrigSteer/TrigSteering/src/Sequence.cxx   |  4 +--
 .../TrigSteer/TrigSteering/src/TrigSteer.cxx  | 19 +++++++----
 5 files changed, 49 insertions(+), 12 deletions(-)

diff --git a/Trigger/TrigSteer/TrigSteering/cmt/requirements b/Trigger/TrigSteer/TrigSteering/cmt/requirements
index 125b4360405fb..8b5d88387f2d0 100755
--- a/Trigger/TrigSteer/TrigSteering/cmt/requirements
+++ b/Trigger/TrigSteer/TrigSteering/cmt/requirements
@@ -47,6 +47,7 @@ use  TrigMonitorBase            TrigMonitorBase-*               Trigger/TrigMoni
 use  TrigNavigation             TrigNavigation-*                Trigger/TrigEvent
 use  TrigSerializeResult        TrigSerializeResult-*           Trigger/TrigDataAccess
 use  TrigT1Interfaces           TrigT1Interfaces-*              Trigger/TrigT1
+use  xAODEventInfo              xAODEventInfo-*                 Event/xAOD
 use  L1TopoCommon               L1TopoCommon-*                  Trigger/TrigT1/L1Topo
 use  L1TopoConfig               L1TopoConfig-*                  Trigger/TrigT1/L1Topo
 use  TrigStorageDefinitions     TrigStorageDefinitions-*        Trigger/TrigEvent
diff --git a/Trigger/TrigSteer/TrigSteering/python/TrigSteeringConfig.py b/Trigger/TrigSteer/TrigSteering/python/TrigSteeringConfig.py
index eda9a7e759864..9dc65c6c0c98a 100755
--- a/Trigger/TrigSteer/TrigSteering/python/TrigSteeringConfig.py
+++ b/Trigger/TrigSteer/TrigSteering/python/TrigSteeringConfig.py
@@ -411,11 +411,9 @@ class TrigSteer_HLT( TrigSteer_baseClass ):
         # include("TrigSteering/pureNewSteering_menu.py")
 
         # add all PESA algorithms (of the correct lvl) to this instance of TrigSteer :
-        l2algs,efalgs = ServiceMgr.HLTConfigSvc.getAlgorithmsByLevel()
+        hltalgs = ServiceMgr.HLTConfigSvc.getAlgorithmsRun2()
         log.info( "will add HLT algorithms to: "+name)
 
-
-        hltalgs=l2algs+efalgs
         from AthenaCommon.Configurable import Configurable
         for alg in hltalgs:
             instance = getConfigurableByConfigName(alg)
diff --git a/Trigger/TrigSteer/TrigSteering/src/ResultBuilder.cxx b/Trigger/TrigSteer/TrigSteering/src/ResultBuilder.cxx
index c7fc866ff4c33..7744dba9f3ad0 100755
--- a/Trigger/TrigSteer/TrigSteering/src/ResultBuilder.cxx
+++ b/Trigger/TrigSteer/TrigSteering/src/ResultBuilder.cxx
@@ -18,6 +18,8 @@
 #include "TrigSteeringEvent/ScoutingInfo.h"
 #include "eformat/SourceIdentifier.h"
 
+#include "xAODEventInfo/EventInfo.h"
+
 using namespace HLT;
 
 ResultBuilder::ResultBuilder(const std::string& name, const std::string& type,
@@ -612,7 +614,38 @@ ErrorCode ResultBuilder::fillTriggerInfo(const std::vector<SteeringChain*>& acti
       (*m_log) << MSG::VERBOSE << (*triggerInfo) << endreq;
    }
 
+  
+  
+  /////////////////////////////////
+  //// Recording in xAODEventInfo
+  ////////////////////////////////
+  // put it all to SG xAOD::EventInfo object
+ 
+  const xAOD::EventInfo* constxEventInfo(0);
+  sc = m_storeGate->retrieve(constxEventInfo);
+  
+  if (sc.isFailure()) {   
+    if(m_logLvl <= MSG::FATAL)
+      (*m_log) << MSG::FATAL << "Can't get xAOD::EventInfo object for update of the StreamTag" << endreq;
+    return HLT::FATAL;
+  }
+  
+
+  //create xAOD::StreamTags
+  std::vector < xAOD::EventInfo::StreamTag > xAODStreamTags;
+  for (auto streamtag : m_uniqueStreams){
+    //copy streamtag into xAOD object
+    xAOD::EventInfo::StreamTag xstreamtag(streamtag.name(), streamtag.type(), streamtag.obeysLumiblock(), streamtag.robs(), streamtag.dets());
+    xAODStreamTags.push_back(xstreamtag);
+  }
 
+  xAOD::EventInfo* xeventInfo = const_cast<xAOD::EventInfo*>(constxEventInfo);
+  xeventInfo->setStreamTags(xAODStreamTags);
+  if(m_logLvl <= MSG::VERBOSE){
+    (*m_log) << MSG::VERBOSE << "Updated xAOD::StreamTags into xAOD::EventInfo:" << endreq;
+  }
+  
+  
    return HLT::OK;
 }
 
diff --git a/Trigger/TrigSteer/TrigSteering/src/Sequence.cxx b/Trigger/TrigSteer/TrigSteering/src/Sequence.cxx
index 7bdc2193749ab..11dc7546eb0f9 100755
--- a/Trigger/TrigSteer/TrigSteering/src/Sequence.cxx
+++ b/Trigger/TrigSteer/TrigSteering/src/Sequence.cxx
@@ -410,7 +410,7 @@ HLT::ErrorCode Sequence::prepareRobRequests()
       if ( m_prepRobReqErrorCode.action() > HLT::Action::CONTINUE ) 
 	return m_prepRobReqErrorCode;
     }
-    return m_prepRobReqErrorCode;
+    //FPP    return m_prepRobReqErrorCode;
   }
 
   // debug output
@@ -439,7 +439,7 @@ HLT::ErrorCode Sequence::prepareRobRequests()
 
     for (unsigned int j = 0; j <  m_nextAlgos.size()+1; ++j) {
       
-      if (j>0) break; // only for the first algo the processRobRequests can be run 
+      // if (j>0) break; // only for the first algo the processRobRequests can be run 
 
       HLT::Algo* alg = ( j==0 ? m_firstAlgo : m_nextAlgos[j-1] );
 
diff --git a/Trigger/TrigSteer/TrigSteering/src/TrigSteer.cxx b/Trigger/TrigSteer/TrigSteering/src/TrigSteer.cxx
index b259f8fee7f16..a5607d01f95df 100755
--- a/Trigger/TrigSteer/TrigSteering/src/TrigSteer.cxx
+++ b/Trigger/TrigSteer/TrigSteering/src/TrigSteer.cxx
@@ -510,9 +510,6 @@ StatusCode TrigSteer::execute()
    //reset EB status (for merged system)
    m_stepForEB = 0;
 
-   //reset EB status (for merged system)
-   m_stepForEB = -1;
-
    if ( setEvent() != HLT::OK ) {
       return StatusCode::FAILURE;
    }
@@ -720,13 +717,22 @@ StatusCode TrigSteer::execute()
 
 
 void  TrigSteer::doPrefetching(bool &secondPass, bool& noError){
+  (*m_log) << MSG::DEBUG << "TrigSteer::doPrefetching starts " << m_stepForEB <<endreq;
+
+  // skip if EB already called in the steering
+  if( m_stepForEB != 0) return;// should be useless
+
 
   //  skip if the event is already in cache
   if (m_trigROBDataProvider.isValid()) {
-    if (m_trigROBDataProvider->isEventComplete()) return;
+    if (m_trigROBDataProvider->isEventComplete()){ // this is return always treu for offline running
+      (*m_log) << MSG::DEBUG <<"FPP Event is complete" <<endreq;
+      if ( m_strategyEB == 0){ // return for online, do the prefetching for testing EBstrategy=1
+	(*m_log) << MSG::DEBUG <<"FPP Event is complete; do not pre-fetch data for online running" <<endreq;
+	return;
+      }
+    }
   }
-  // skip if EB already called in the steering
-  if( m_stepForEB != 0) return;// should be useless
 
   // Prepare ROB requests at this step:
     
@@ -737,7 +743,6 @@ void  TrigSteer::doPrefetching(bool &secondPass, bool& noError){
   if (m_config->getMsgLvl() <=MSG::DEBUG)
     (*m_log) << MSG::DEBUG << "\n ///\n /// Start collecting ROB requests\n ///\n" << endreq;
 
-  // bool isFirstPass = ! secondPass;
 
   // clear the list of ROB IDs at the beginning of each step
   getAlgoConfig()->robRequestInfo()->clearRequestScheduledRobIDs();
-- 
GitLab