[Rivet] MSG_DEBUG in plugins

Andy Buckley andy.buckley at ed.ac.uk
Wed Feb 22 12:52:16 GMT 2012


On 22/02/12 12:11, Holger Schulz wrote:
> Hi,
>
> I would like to add some debug messages to an inline function
> in a plugin analysis but I fail to so with this approach:
>
>     <includes>
>     #include "Rivet/Tools/Logging.hh"
>     <more includes>
>
>     using namespace std;
>     using namespace Rivet;
>
>     inline bool function(const Rivet::Particle& p) {
>     < code >
>     MSG_DEBUG("Failed pT cut: " << pTs[0]*Rivet::MeV << " " <<
>     pTs[1]*Rivet::MeV);
>     <more code>
>     }
>
>
> The compiler yields errors like this:
>
>     ATLAS_LAMBDA_KSHORT.cc:48:7: error: ‘getLog’ was not declared in
>     this scope
>
> What am I missing?

It's that those MSG_DEBUG functions need to get a named logger object. 
Analyses and Projections automatically have one of those, accessed via 
their getLog method, so MSG_DEBUG etc. will work there. If you make this 
a member function (automatically inline if written as usual) rather than 
a standalone function, then it'll work.

Andy

-- 
Dr Andy Buckley
SUPA Advanced Research Fellow
Particle Physics Experiment Group, University of Edinburgh

The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.



More information about the Rivet mailing list