From a28faa6f83927e3c3bcc4366f97a566a1413ee41 Mon Sep 17 00:00:00 2001
From: Dag Gillberg <dag.gillberg@cern.ch>
Date: Sat, 25 Feb 2017 19:07:50 +0000
Subject: [PATCH] Added test application for athena

---
 cmt/requirements                  | 12 +++++++--
 test/ath_test_truthWeightTool.cxx | 45 +++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+), 2 deletions(-)
 create mode 100644 test/ath_test_truthWeightTool.cxx

diff --git a/cmt/requirements b/cmt/requirements
index eed4f611bee1..d4578f730d45 100644
--- a/cmt/requirements
+++ b/cmt/requirements
@@ -6,15 +6,20 @@ use GaudiInterface           GaudiInterface-*         External
 # Infrastructure package(s):
 use AsgTools                AsgTools-*                Control/AthToolSupport
 
+
 ## put here your package dependencies...
-use xAODTruth             xAODTruth-*             Event/xAOD
+use xAODTruth           xAODTruth-*             Event/xAOD
+use xAODEventInfo       xAODEventInfo-*         Event/xAOD
 ##
 
 private
 
-use xAODEventInfo       xAODEventInfo-*         Event/xAOD
+use AtlasROOT		AtlasROOT-*		External
 use AtlasReflex         AtlasReflex-*           External -no-auto-imports
 use GaudiInterface 	GaudiInterface-* 	External
+use POOLRootAccess 	POOLRootAccess-* 	PhysicsAnalysis
+
+use AthAnalysisBaseComps AthAnalysisBaseComps-* Control
 
 end_private
 
@@ -34,3 +39,6 @@ private
 apply_pattern lcgdict dict=TruthWeightTools selectionfile=selection.xml headerfiles="../TruthWeightTools/TruthWeightToolsDict.h"
 
 end_private
+
+application ath_test_truthWeightTool ../test/ath_test_truthWeightTool.cxx
+
diff --git a/test/ath_test_truthWeightTool.cxx b/test/ath_test_truthWeightTool.cxx
new file mode 100644
index 000000000000..8acabaaf5f30
--- /dev/null
+++ b/test/ath_test_truthWeightTool.cxx
@@ -0,0 +1,45 @@
+#ifndef ROOTCORE
+
+/// Example standalone executable using POOL to read an xAOD
+/// Tests the TruthWeightTool ... shows example usage
+
+/// Author: Dag Gillberg - based on 
+///  https://svnweb.cern.ch/trac/atlasoff/browser/PhysicsAnalysis/AnalysisCommon/CPAnalysisExamples/trunk/test/ut_ath_checkTrigger_test.cxx
+/// by Will Buttinger
+
+#include "AthAnalysisBaseComps/AthAnalysisHelper.h" //tool creation and configuration
+#include "POOLRootAccess/TEvent.h" //event looping
+#include "GaudiKernel/ToolHandle.h" //for better working with tools
+
+#include "AsgTools/MessageCheck.h" //messaging
+using namespace asg::msgUserCode;  //messaging
+
+//EDM includes
+
+//ROOT includes
+#include "TString.h"
+#include "TSystem.h"
+#include "TStopwatch.h"
+#include "TH1D.h"
+#include "TFile.h"
+
+//specific includes for this test
+#include "TruthWeightTools/TruthWeightTool.h"
+
+int main( int argc, char* argv[] ) {
+
+  IAppMgrUI* app = POOL::Init(); //important to do this first!
+
+  // The application's name:
+  const char* APP_NAME = argv[ 0 ];
+
+  // Open the input file:
+  TString fileName = "";
+  if( argc < 1 ) {
+    ANA_MSG_WARNING("Usage: ath_test_truthWewightTool.exe <file>");
+  } else {
+    fileName = argv[1];
+  }
+}
+
+
-- 
GitLab