The following explains the procedure on how to setup the
TrigConfBunchCrossingTool to access BC information from inside
EventLoop. This has been tested in
AnalysisBase 2.4.28 with
TrigBunchCrossingTool -00-04-20.
A local instance of the
TrigBunchCrossingTool is required as a minor change needs to be applied within the tool to make it work within
EventLoop
rc checkout_pkg TrigBunchCrossingTool
Now open
TrigBunchCrossingTool /Root/TrigConfBunchCrossingTool.cxx. Line 47 reads
m_configTool( "TrigConf::xAODConfigTool" ) {
and change this to
m_configTool( "xAODConfigTool" ) {
Setting up the tool in EventLoop
Include the needed dependencies in cmt/Makefile.RootCore
PACKAGE_DEP = [...] TrigBunchCrossingTool TrigConfxAOD TrigConfHLTDat
where [...] stands for all other dependencies. In the *.h file of the package we add the following three headers
#include "TrigConfxAOD/xAODConfigTool.h"
#include "TrigConfInterfaces/ITrigConfigTool.h"
#include "TrigBunchCrossingTool/TrigConfBunchCrossingTool.h"
and in public: declare both a new instance of the trigger configuration tool and the BC tool
xAODConfigTool *m_configTool; //!
Trig::TrigConfBunchCrossingTool *m_trigConfBunchCrossingTool; //!
Now we look into the packages source code in *.cxx. Add the following lines to the initialize() function:
// Trigger configuration tool
m_configTool = new xAODConfigTool("xAODConfigTool");
ToolHandle<TrigConf::ITrigConfigTool> configHandle( m_configTool );
ANA_CHECK( configHandle->initialize() );
// BunchCrossingTool
m_trigConfBunchCrossingTool = new Trig::TrigConfBunchCrossingTool("TrigConfBunchCrossingTool");
m_trigConfBunchCrossingTool->setProperty( "OutputLevel", MSG::INFO);
ANA_CHECK( m_trigConfBunchCrossingTool->initialize() );
Using the BC tool
Bunch crossing information can be easily read in the execute(), e.g. to check whether a BC was filled ones needs to put in the BCID of the collision
const bool result = m_trigConfBunchCrossingTool->isFilled( eventInfo->bcid() );
The available functions can be seen from
TrigBunchCrossingTool /TrigBunchCrossingTool/BunchCrossingToolBase.h
--
JochenJensHeinrich - 2017-05-10