ATLAS Offline Software
EgEfficiencyCorr_mem_check.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3  */
4 
5 /*
6  To run with something like
7  valgrind --tool=memcheck --leak-check=full
8 --suppressions=$ROOTSYS/etc/valgrind-root.supp --error-limit=no \
9  --track-origins=yes --smc-check=all --trace-children=yes --track-fds=yes
10 --num-callers=30 \
11  $ROOTCOREBIN/bin/x86_64-slc6-gcc49-opt/EgEfficiencyCorr_mem_check>valgrind.log
12 2>&1 &
13 
14  In order to identify memory leaks in out methods
15  Look here:
16 http://valgrind.org/docs/manual/faq.html#faq.deflost
17 */
18 
22 #include <iostream>
23 #include <string>
24 #include <vector>
25 #ifdef XAOD_STANDALONE
26 // xAOD include(s):
27 #include "xAODRootAccess/TEvent.h"
28 #endif // XAOD_STANDALONE
30 #include "TInterpreter.h"
31 
32 int
34 {
35  std::cout << "EgEfficiencyCorr_mem_check" << std::endl;
36 
37  // Suppress known ubsan warning we get from cling.
38  CxxUtils::ubsan_suppress([]() { TInterpreter::Instance(); });
39 
40 #ifdef XAOD_STANDALONE
42 #endif
43 
44  using namespace asg::msgUserCode;
45  ANA_CHECK_SET_TYPE(int);
46 
48  "AsgElectronEfficiencyCorrectionTool/ElectronEffCorrection");
49  ANA_CHECK(tool.setProperty("CorrelationModel", "FULL") &&
50  tool.setProperty("ForceDataType", 1) &&
51  tool.setProperty("IdKey", "Medium") && tool.retrieve());
52 
54  eccTool.setTypeAndName(
55  "CP::ElectronChargeEfficiencyCorrectionTool/ElectronChargeCorrection");
56  ANA_CHECK(
57  eccTool.setProperty(
58  "CorrectionFileName",
59  "ElectronEfficiencyCorrection/2015_2016/rel20.7/Moriond_February2017_v1/"
60  "charge_misID/ChargeCorrectionSF.Medium_FixedCutTight.root") &&
61  eccTool.retrieve());
62 
63  return 0;
64 }
ubsan_suppress.h
Helper for suppressing ubsan warnings.
IAsgElectronEfficiencyCorrectionTool.h
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
AsgMessaging.h
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
asg::StandaloneToolHandle::setProperty
StatusCode setProperty(const std::string &name, T2 &&value)
Definition: StandaloneToolHandle.h:105
asg::StandaloneToolHandle
an "initializing" ToolHandle for stand-alone applications
Definition: StandaloneToolHandle.h:44
TEvent.h
asg::StandaloneToolHandle::retrieve
StatusCode retrieve()
initialize the tool, will succeed if the tool was already initialized
Definition: StandaloneToolHandle.h:147
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
asg::StandaloneToolHandle::setTypeAndName
void setTypeAndName(const std::string &typeAndName)
Definition: StandaloneToolHandle.h:101
ANA_CHECK_SET_TYPE
#define ANA_CHECK_SET_TYPE(TYPE)
set the type for ANA_CHECK to report failures
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:314
main
int main()
Definition: EgEfficiencyCorr_mem_check.cxx:33
StandaloneToolHandle.h
CxxUtils::ubsan_suppress
void ubsan_suppress(void(*func)())
Helper for suppressing ubsan warnings.
Definition: ubsan_suppress.cxx:69
xAOD::TEvent
Tool for accessing xAOD files outside of Athena.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:81