Can or Cann't use vector<TH1*> in a root macro?

Dear Experts,
Is it OK to use vector<TH1*> in a macro? If yes, there must be something wrong with my small macro. Could you please point it out?
I have no problem using vector<TH1*> without the for loop(commented out part), but if I uncomment the for loop, I will get Segment fault. Do I have something wrong with that part?
Thank you very much.

-----------------------------------------------My macro-----------------------------------------------------
#include “commonFunctions.h”
#include “tools.h”
#include
using namespace std;
int t () {
vector<TH1 *> myHistograms;

std::string mcFile = "dijetMass_pythia_noK.root";
double massMin = 200;
double massMax = 1800;

//template
TH1F h_pythia;
retrieve(mcFile,"massMC",h_pythia);

TH1F *histo = &h_pythia;
histo->Reset();
histo->SetName("template");

myHistograms.push_back (histo);


TFile f("/xdata05/hji/output/Pythia.root");

// for(int i=0; i<1; i++)
// {
// TString pt3Cut;//20-30
// pt3Cut.Form(“evt_weight*(tmp_jet_pt[2]>%d)”, 20+2*i);
// cout<<"pt 3 cut: "<<pt3Cut<<endl;
// TCut ptCut(pt3Cut);

// TString name1;
// name1.Form(“pt3_%d”, 20+2*i);

// TH1F histo1 = (TH1F)histo->Clone();
// histo1->SetName(name1.Data());

// TString var1;
// var1.Form(“Mjj>>%s”, name1.Data());

// BHAnalysis->Draw(var1.Data(), ptCut);

// myHistograms.push_back(histo1);
// }

// fill histograms
TFile ("out.root", "RECREATE");
for (unsigned int k = 0; k < myHistograms.size(); ++k) {
    myHistograms[k]->Write();
}

}

[quote]Is it OK to use vector<TH1*> in a macro? If yes, there must be something wrong with my small macro. Could you please point it out?[/quote]It depends on the version. The safest way is to generate the dictionary for vector<TH1*> yourself (search for loader.C on the forum). In the trunk, the dictionary is automatically generated.

In addition, you may simply want to use a TObjArray rather than vector as it will be as efficient as vector and work perfectly on all version of ROOT.

Cheers,
Philippe.