PROOF session. TSelector, how to pass object to Slaves?


I would like to fill a “std::vector” in “Begin()”, and pass it to each Slave (just for reading it, not modifying).

I found that I can do it iif the vector is related to fObject as

fObject = (TObject*) new std::vector();

I tried to use it as an internal variable, but it didn’t work.

So, apart from using “fObject” in that shoddy way, is there any other solution?

Thank you for your time.

I found this older answer,

So, why is better a wrapper using TParameter than a (TObject*)/(myObject*) cast?

Hi atd,
you definitely cannot convert a std::vector to a TObject* safely. That code will probably crash, and certainly will not do what you want.

I think you can simply declare a std::vector member variable for your selector class and then use it in its methods, as usual with c++ classes.


I was trying to prepare a simplified example code, and I discover how to set the member variables: the member variables must be set in the constructor, not during the “Begin()” step.

Thank you :smiley:


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.