Hi Luc,
I don't see why this should be a property of a TH1. Why don't you simply do:
if (enableFill) {
h1->Fill(1);
h1->Fill(2);
}
etc? If you have multiple histograms you can e.g. keep a std::vector<bool> enableFill, so you can check
for (int iHist=0; iHist<nHist; iHist++)
if (enableFill[iHist]) hists[iHist]->Fill(value)
Axel.
Legeard Luc wrote:
>
> Hello Rooters
>
> I'd like know if there a posibility to disable/enable filling an
> histogram
> for example :
>
> we can imaging a such method TH1:Enable(Bool_t boolenable) with this
> behaviour:
>
> TH1F <http://root.cern.ch/root/html////TH1F.html> *h1 = new TH1F
> <http://root.cern.ch/root/html////TH1F.html>("h1","h1",10,0,10);
>
> h1->Fill <http://root.cern.ch/root/html///TH1.html#TH1:Fill>(1); // fill
> bin 1
> h1->Fill <http://root.cern.ch/root/html///TH1.html#TH1:Fill>(1); // fill
> bin 1
> h1->Fill <http://root.cern.ch/root/html///TH1.html#TH1:Fill>(2); // fill
> bin 2
> h1->Fill <http://root.cern.ch/root/html///TH1.html#TH1:Fill>(2); // fill
> bin 2
> h1->Enable(kFALSE);
>
> h1->Fill <http://root.cern.ch/root/html///TH1.html#TH1:Fill>(1); // no
> action !
> h1->Fill <http://root.cern.ch/root/html///TH1.html#TH1:Fill>(1); // no
> action !
> h1->Fill <http://root.cern.ch/root/html///TH1.html#TH1:Fill>(2); // no
> action !
> h1->Fill <http://root.cern.ch/root/html///TH1.html#TH1:Fill>(2); // no
> action !
> h1->Enable(kTRUE);
>
> h1->Fill <http://root.cern.ch/root/html///TH1.html#TH1:Fill>(1); // fill
> bin 1
> h1->Fill <http://root.cern.ch/root/html///TH1.html#TH1:Fill>(1); // fill
> bin 1
> h1->Fill <http://root.cern.ch/root/html///TH1.html#TH1:Fill>(2); // fill
> bin 2
> h1->Fill <http://root.cern.ch/root/html///TH1.html#TH1:Fill>(2); // fill
> bin 2
>
>
> Thanks a lot for your help
>
> Luc
>
Received on Tue Jan 17 2006 - 16:21:32 MET
This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:56 MET