Problem to use the STL vector

Hello I would like to pass in a function a vector of pointer of the class TH1d *, here is what my code look like in the main() function :

(. . . )
  vector<TH1D*> SA_pTl_MCtru_histos ;
  for(int i=0 ; i<=nb_of_sa ; i++)
    {
      // a. Construct string for current mass sample
      string mW = "m0" + GetStringFromInt(i) + "_" ;
      // b. Get coresponding histogram
      TH1D * current_SA_histo = GetHisto(SA_root_files[i], PD_HISTO_P+mW+obs) ;
      SA_pTl_MCtru_histos.push_back( current_SA_histo ) ;
    }

(. . . )

  TCanvas * can_lla_MC_truth = Make_lla(PD_pTl_MCtru_histo, 
					SA_pTl_MCtru_histos,
					options) ;
(. . . )

And here is how I declared the function that is being called :

TCanvas * Make_lla        (TH1D * data, vector<TH1D*> samples, 
			   string * options)

After some debugging it appears that my vector of TH1D * is not passed very well, can someone give me a tip here ?

Thanks in advance

You should pass the vector by reference

TCanvas * Make_lla (TH1D * data, vector<TH1D*> &samples, string * options)

Rene

Hi,

Thanks for your reply at such an houir and such a day, I will try your advice but I noticed the mistake seems to lie before that point in the histograms,…

I will see what comes out from that, thanks,