From d02d9c796dd568ae2f1c9678f0947fdf10af48fc Mon Sep 17 00:00:00 2001
From: Tomasz Bold <tomasz.bold@gmail.com>
Date: Tue, 19 Sep 2017 21:48:39 +0200
Subject: [PATCH] Debugged filtering, introduced CF to egamma example

Former-commit-id: b45404cbfc2e9a44efcf948878c7f3fc276ed4a3
---
 .../DecisionHandling/src/RoRSeqFilter.cxx     | 19 +++++++------------
 .../DecisionHandling/src/RoRSeqFilter.h       | 13 ++++++-------
 .../test/TrigCompositeUtils_test.cxx          |  1 +
 .../L1Decoder/src/EMRoIsUnpackingTool.cxx     |  4 ++++
 .../TrigUpgradeTest/share/egamma.withViews.py |  3 ++-
 5 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/Trigger/TrigSteer/DecisionHandling/src/RoRSeqFilter.cxx b/Trigger/TrigSteer/DecisionHandling/src/RoRSeqFilter.cxx
index b50c771c4e3..d1186a001c8 100644
--- a/Trigger/TrigSteer/DecisionHandling/src/RoRSeqFilter.cxx
+++ b/Trigger/TrigSteer/DecisionHandling/src/RoRSeqFilter.cxx
@@ -7,14 +7,10 @@
 
 #include "GaudiKernel/Property.h"
 
-
-
 RoRSeqFilter::RoRSeqFilter( const std::string& name, 
 			  ISvcLocator* pSvcLocator ) : 
   ::AthAlgorithm( name, pSvcLocator )
-{
-  //declareProperty( "Property", m_nProperty );
-}
+{}
 
 RoRSeqFilter::~RoRSeqFilter()
 {}
@@ -63,12 +59,10 @@ StatusCode RoRSeqFilter::execute() {
     output->clear( SG::VIEW_ELEMENTS );
 
     for ( auto inputHandle: inputHandles ) {
-      //auto inputHandle = SG::makeHandle( inputKey );      
       passCounter += copyPassing( *inputHandle, *output );
     }
 
-    ATH_MSG_DEBUG( "Recording " <<  m_outputKeys[ 0 ].key() );
-    //auto outputHandle = SG::makeHandle( m_outputKeys[ 0 ] );
+    ATH_MSG_DEBUG( "Recording " <<  m_outputKeys[ 0 ].key() ); 
     CHECK( outputHandles[0].record( std::move( output ) ) );
 
   } else {
@@ -82,7 +76,7 @@ StatusCode RoRSeqFilter::execute() {
       passCounter += copyPassing( *inputHandle, *output );
 
       ATH_MSG_DEBUG( "Recording " << outputIndex << " " <<  m_outputKeys[ outputIndex ].key() );
-      //auto outputHandle = SG::makeHandle( m_outputKeys[ outputIndex ] );
+  
       CHECK( outputHandles[outputIndex].record( std::move( output ) ) );
 
       outputIndex++;
@@ -90,8 +84,7 @@ StatusCode RoRSeqFilter::execute() {
   }
 
   ATH_MSG_DEBUG( "Filter " << ( passCounter != 0 ? "passed" : "rejected") );
-  //setFilterPassed( passCounter != 0 );  
-  setFilterPassed( true );  
+  setFilterPassed( passCounter != 0 );  
   return StatusCode::SUCCESS;
 }
   
@@ -102,8 +95,10 @@ size_t RoRSeqFilter::copyPassing( const TrigCompositeUtils::DecisionContainer& i
   for ( const TrigCompositeUtils::Decision* i: input ) {
     
     TrigCompositeUtils::DecisionIDContainer objDecisions;      
-    TrigCompositeUtils::passingIDs( i, objDecisions );
+    TrigCompositeUtils::decisionIDs( i, objDecisions );
+
     ATH_MSG_DEBUG("Number of positive decisions " << objDecisions.size() );
+
     for ( TrigCompositeUtils::DecisionID id : objDecisions ) {
       ATH_MSG_DEBUG( "Positive decision " << HLT::Identifier( id ) );
     }
diff --git a/Trigger/TrigSteer/DecisionHandling/src/RoRSeqFilter.h b/Trigger/TrigSteer/DecisionHandling/src/RoRSeqFilter.h
index 4d140f4a7e9..0b7e6a9f8de 100644
--- a/Trigger/TrigSteer/DecisionHandling/src/RoRSeqFilter.h
+++ b/Trigger/TrigSteer/DecisionHandling/src/RoRSeqFilter.h
@@ -15,8 +15,8 @@
 
 
 /**
- * @class $(klass)s
- * @brief 
+ * @class Filtering algorithm for HLT step sequencer
+ * @brief Consumes multiple decision inputs and filters those that are labled with the required  decision IDs
  **/
 
 class RoRSeqFilter
@@ -27,11 +27,10 @@ class RoRSeqFilter
 
   virtual ~RoRSeqFilter(); 
 
-  //RoRSeqFilter &operator=(const RoRSeqFilter &alg); 
-
-  StatusCode  initialize() override;
-  StatusCode  execute() override;
-  StatusCode  finalize() override;
+  
+  virtual StatusCode  initialize() override;
+  virtual StatusCode  execute() override;
+  virtual StatusCode  finalize() override;
 
  private: 
   RoRSeqFilter();
diff --git a/Trigger/TrigSteer/DecisionHandling/test/TrigCompositeUtils_test.cxx b/Trigger/TrigSteer/DecisionHandling/test/TrigCompositeUtils_test.cxx
index 76999b56b3b..079f71d761d 100644
--- a/Trigger/TrigSteer/DecisionHandling/test/TrigCompositeUtils_test.cxx
+++ b/Trigger/TrigSteer/DecisionHandling/test/TrigCompositeUtils_test.cxx
@@ -30,6 +30,7 @@ int main() {
 
   for ( auto id: ids )
     std::cout << id << " from d1\n"; 
+  
 
   decisionIDs( d2, ids );
   for ( auto id: ids )
diff --git a/Trigger/TrigSteer/L1Decoder/src/EMRoIsUnpackingTool.cxx b/Trigger/TrigSteer/L1Decoder/src/EMRoIsUnpackingTool.cxx
index bd0ffa3c9ed..e306fc36eca 100644
--- a/Trigger/TrigSteer/L1Decoder/src/EMRoIsUnpackingTool.cxx
+++ b/Trigger/TrigSteer/L1Decoder/src/EMRoIsUnpackingTool.cxx
@@ -129,6 +129,10 @@ StatusCode EMRoIsUnpackingTool::unpack( const EventContext& ctx,
 	if ( recRoI->passedThreshold( th->thresholdNumber() ) ) {
 	  ATH_MSG_DEBUG( "Passed Threshold name " << th->name() );
 	  addChainsToDecision( HLT::Identifier( th->name() ), decision, activeChains );
+	  ATH_MSG_DEBUG( "Labeled object with chains: " << [&](){ 
+	      TrigCompositeUtils::DecisionIDContainer ids; 
+	      TrigCompositeUtils::decisionIDs( decision, ids ); 
+	      return std::vector<TrigCompositeUtils::DecisionID>( ids.begin(), ids.end() ); }() );
 	}
       }
       
diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py b/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py
index 5f7d4684aab..124d0c7f26e 100644
--- a/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py
+++ b/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py
@@ -322,9 +322,10 @@ else:
   # ID algs can't run w/o views yet
   pass
 
+
+# CF construction
 step0 = parOR("step0", [ egammaCaloStep ] )
 step1 = parOR("step1", [ egammaIDStep ] )
-
 steps = seqAND("HLTSteps", [ step0, step1 ]  )
 topSequence += steps
   
-- 
GitLab