TDrawFeedback::Feedback draw only TH1

I want to monitor a custom class during the TProof::Execute, so I’m using the TProof::AddFeedBack mechanism.

My class has the Draw and DrawClone methods. They simple draw an internal TH1I field of the class, for example:

TObject* MyClass::DrawClone(Option_t* option) const
{
    return m_histo_counter->DrawClone(option);
}

If I look into the implementation

root.cern.ch/root/html/src/TDraw … x.html#114

I see that the object is drawn only if it inherites from TH1. Why this? How can I draw my class?

I tried to add

MyClass::operator TH1*() const { return m_histo; }
MyClass::operator TH1() const  { return *m_histo; }

but it doesn’t work.

Hi,

The TDrawFeedback class is only provided as an example of usage of the Feedback mechanism, namely to show how to connect to the Feedback(TList *) signal emitted by PROOF. You should write your own feedback class and in its Feedback(TList *) method (or in the one the you Connect in the constructor) you can do what you need, in particular you can create your canvases and draw the histograms members of your object.

I have just added a page about this on the PROOF web site:
root.cern.ch/drupal/content/usin … -mechanism

G. Ganis

[quote=“ganis”]Hi,

The TDrawFeedback class is only provided as an example of usage of the Feedback mechanism, namely to show how to connect to the Feedback(TList *) signal emitted by PROOF. You should write your own feedback class and in its Feedback(TList *) method (or in the one the you Connect in the constructor) you can do what you need, in particular you can create your canvases and draw the histograms members of your object.

I have just added a page about this on the PROOF web site:
root.cern.ch/drupal/content/usin … -mechanism

G. Ganis[/quote]

Hello, sorry for the late reply. Why you don’t simply remove the line

if (TH1 *h = dynamic_cast<TH1*>(o)) {

from root.cern.ch/drupal/content/usin … -mechanism?

What do you mean? Why should it be removed?

Philippe.

[quote=“pcanal”]What do you mean? Why should it be removed?

Philippe.[/quote]
sorry, wrong link: line 113 here: root.cern.ch/root/html/src/TDraw … x.html#113

Hi,

If we remove the dynamic_cast, we can no longer call DrawCopy which is not part of the TObject interface but only appear in TH1 (and a few other interfaces).

Cheers,
Philippe.

[quote=“pcanal”]Hi,

If we remove the dynamic_cast, we can no longer call DrawCopy which is not part of the TObject interface but only appear in TH1 (and a few other interfaces).

Cheers,
Philippe.[/quote]

DrawClone is not suitable?

Hi,

DrawCopy and DrawClone have some significant differences and are not interchangeable (for example it set the cloned histogram to belong to the canvas rather than the current directory).

Cheers,
Philippe.

Hi,

What we can do is to call DrawCopy for histograms and DrawClone for the others.
However, TDrawFeedback is really for illustration only, and people should really just use it as the basic example of how the whole thing works, and as starting point for their own feedback-displaying class.

Gerri