Re: Disable/enable filling an histogram

From: Alexander Bürger <buerger_at_iskp.uni-bonn.de>
Date: Tue, 17 Jan 2006 17:41:06 +0100


Hello,

> Yes it is exactly what i want
> but when you have a lot of histograms
> and you want to devalidate the filling on 100 of them
> it is simpler not to change you code and juste tell to wanted histograms
> to be hang!

You could also add a helper function:

inline void FillIf(TH1* histo, bool doit, double x) {

	if( doit && histo )
		histo->Fill( x );

}

and then replace

h1->Fill(x);

with

bool isEnabled = false;
/* ... */
FillIf( h1, isEnabled, x );

Good luck,

Alexander Received on Tue Jan 17 2006 - 17:41:09 MET

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:56 MET