Vector of User defined class

Hello everyone,
i’m trying to write a little macro that exports data to ASCII from certain histogramms of a rootfile. Therefore i browse through all the directories of the rootfile and as soon as the histname matches an entry in my list the histogram is saved. Since i like to do some operations on the data and essentially can do that only after all histograms are found i’d like to store the data in class. And since i have several datasets i want to use a vector of this class. Something like this:

class Particle
{
public:
	Particle()	{}
	Particle(std::string fiName,std::vector<double> counts):path(fiName),raw_counts(counts)		{}

	
	double get_RawCounts(int index)		{return (index<raw_counts.size())?raw_counts[index]:0.;}
	int get_Size()					{return raw_counts.size();}
	const std::string get_Path()				{return path;}
	
private:
	std::vector<double> raw_counts;
	std::string path;
};


//_________________________________________________________________________________________________________________________
void SaveCounts(TH1D *hist,std::string name)
{
	std::vector<double> vec;
	for(int i=1;i <= hist->GetNbinsX();i++)
		vec.push_back(hist->GetBinContent(i));

	Particle p(name,vec);
	for(int i=0;i<p.get_Size();i++)
		std::cout << p.get_RawCounts(i) << std::endl;
	vector<Particle> counts;
     
       counts.push_back(p); // leads to crash
}

The CINT crashes as soon as it invokes the last line.
The strange thing is: if i do basically the same steps by hand it doesn’t crash. So if i enter for example:

string name = "test";
vector<double> dvec;
dvec.push_back(1.2);
Particle p(name,dvec);
vector<Particle> pvec;
pvec.push_back(p);
pvec.push_back(Particle(name,dvec));

it will work without any problems.
Any idea what i’m missing

Cheers Moritz

Hi,

You need to either generate a dictionary for vector or simply load your script via ACLiC (.L myscript.C+)

Cheers,
Philippe.