Pass std::vector to fInput

What’s the easiest way to pass an std::vector to the fInput? I tried to copy the vector to a TArrayI, but I found TArrayI doesn’t inherited from TObject (at this point I can’t understand why TArray exists).

TH1I derives from TArrayI, is streamable and can be therefore be added to fInput.
Otherwise you can add named TParamaters<Int_t> directly to fInput.
It depends what the integers are used for.

G. Ganis

[quote=“ganis”]TH1I derives from TArrayI, is streamable and can be therefore be added to fInput.
Otherwise you can add named TParamaters<Int_t> directly to fInput.
It depends what the integers are used for.

G. Ganis[/quote]

Do I need to use an histogram to pass a list of integers? It’s seems very controintuitive: an histogram is an histogram, a way to collect, manipulate and visualize data, not a simple list of numbers, it has a very different semantic from a std::vector.

What is TParameters? I know TParameter, but it encapsulate only one value, not many.

I think at the end I will use TVector.

Sure, but if you start from std::vector to be passed to the selector via fInput then the dimension is fixed, so you can put them into an TH1I, which also offers a operator.
But you can of course use TVectorT .
Or write a small TObject wrapper around std::vector .

That was a typo, sorry.

[quote=“ganis”][quote]
an histogram is an histogram, a way to collect, manipulate and visualize data, not a simple list of numbers, it has a very different semantic from a std::vector.
[/quote]
Sure, but if you start from std::vector to be passed to the selector via fInput then the dimension is fixed, so you can put them into an TH1I, which also offers a operator.
But you can of course use TVectorT .
Or write a small TObject wrapper around std::vector .

That was a typo, sorry.[/quote]

I tried to build an adapter:

template <class T>
class TSTDvector : public vector<T>, public TNamed
{
public:
    TSTDvector(const char* name, const vector<T> & vec) : vector<T>(vec), TNamed(name, name) { };
};

but when I try to load it in the fInput

TSTDvector<int> my_vector("particle_energies", options.ParticleEnergies);
proof->AddInput(&my_vector);

proof crashes with seg fault in the Terminate method