Histogram and Canvas array

I am making a histogram fitting in a loop by varying the mean and sigma of the gaussian function everytime. I am looping 18 times and doing a gaussian fit 18 times on the same original histogram (with diff mean and sigma each time) but would like to draw the result of each fit on a different histogram. So, I was thinking of defining a histogram and Canvas array by doing

TChain* tc = new TChain("tree1"); tc->Add(file); tc->Project("massplot(200, 10, 30)", "masstree", "", ""); TH1F *hist[18]; for(int i=0;i<18;i++){ hist[i] = (TH1F*) gDirectory->FindObject("massplot");}

where massplot is the name of the histogram with 200 bins, xmin=10,xmax=30, masstree is the tree
but this is giving me a pointer error.
Can someone tell me where I’m going wrong in defining my histogram array ?
And can I define a Canvas array in a similar manner to defining a histogram array?