How do you turn off all root output/warnings

I’m compiling a program with g++ that uses various root classes but my output gets clogged by warnings which I am already aware of (the program works in any case). How can I turn these off within the program?

Ben

Hi,

info gcc tells you that “-w” is your friend. You should not do this, though - have been warned :wink: Better than -w is to fix your code. O, and it has nothing to do with ROOT, but with GCC.

Cheers, Axel.

Sorry, I probably wasn’t clear enough. I said I was compiling my code using g++ to be clear that I was not using aclic or running as a cint macro.

The unwanted output is produced at runtime, not at compile time so a -w will not help.

Let me expand. Some of the warnings I get are these:

Warning in TClass::TClass: no dictionary for class TRootGenParticle is available
Warning in TClass::TClass: no dictionary for class TSortableObject is available
Warning in TClass::TClass: no dictionary for class TRootEvent is available

(These are objects defined in ExRootAnalysis from the CMS ORCA project)

I’m a bit confused why a dictionary is involved since I’m not using CINT? And in any case the code works fine and these objects are successfully read from the root tree.

Other warnings I get are to do with pointers to histograms being replaced at runtime. I don’t always want root to warn me about this sort of thing.

I am grabbing regular expressions from the output of my program and don’t want to confuse my script with undesired output. Also, the root warnings stop me seeing all the output of my program on one page.
Whereas these errors might be fixable by writing the right code, its not something I care about when writing quick throwaway code. Is there anyway to turn off all root runtime output/warnings?

Ben

Hi,
uh, that’s indeed something completely different!

[quote=“benedict”]Warning in TClass::TClass: no dictionary for class TRootGenParticle is available
Warning in TClass::TClass: no dictionary for class TSortableObject is available
Warning in TClass::TClass: no dictionary for class TRootEvent is available

I’m a bit confused why a dictionary is involved since I’m not using CINT? And in any case the code works fine and these objects are successfully read from the root tree.[/quote]You are reading objects from a tree. The file containing the tree also contains the data member layout of these classes; the warning reminds you that - even though ROOT can read these data members’ data - you will not be able to call their methods, because their dictionary is not loaded.

[quote=“benedict”]Whereas these errors might be fixable by writing the right code, its not something I care about when writing quick throwaway code. Is there anyway to turn off all root runtime output/warnings?[/quote]This is of course absolutely your decision - if you want to suppress warnings, set gErrorIgnoreLevel=kError, or put “Root.ErrorIgnoreLevel: Error” into your .rootrc file.

Cheers, Axel.