Hi, This is a problem in fitting and then copying the fit parameter to another variable. TCanvas* c1 = new TCanvas("c1","The Ntuple canvas",200,10,700,780); // The next few lines are repeated 5 times with new histograms and new // pads in the real macro TPad* pad1 = new TPad("pad1","This is pad1",0.02,0.68,0.48,0.98,kWhite); pad1->Draw(); pad1->SetLogy(); TH1F* h4 = new TH1F("h4","4 MeV Electrons",80,-1,1); char fileName[6][80]; strcpy(fileName[0],"/net/eagle/usr5/chris/ntp/angres/cjj_e4.root"); Int_t i; for(i=0;i<6;i++) { TFile* ntp = new TFile(fileName[i]); TTree *h509 = (TTree*)ntp->Get("h509"); // Thanks for explaining this next line to me. gROOT->cd(); if(i==0) h509->Draw("(Ue*Uft+Ve*Vft+We*Wft)>>+h4","Rfitt<600","goff"); if(i==1) h509->Draw("(Ue*Uft+Ve*Vft+We*Wft)>>+h6","Rfitt<600","goff"); if(i==2) h509->Draw("(Ue*Uft+Ve*Vft+We*Wft)>>+h8","Rfitt<600","goff"); if(i==3) h509->Draw("(Ue*Uft+Ve*Vft+We*Wft)>>+h10","Rfitt<600","goff"); if(i==4) h509->Draw("(Ue*Uft+Ve*Vft+We*Wft)>>+h12","Rfitt<600","goff"); if(i==5) h509->Draw("(Ue*Uft+Ve*Vft+We*Wft)>>+h14","Rfitt<600","goff"); delete ntp; } TF1* gaussExp = new TF1("gaussExp",gaussExp,-1,1,4); // x=-1 to 1, 4params gaussExp->SetParNames("Exp co-eff","Gauss Amp","Gau sigma","scale fac"); gaussExp->SetParameters(6,0.1,2,1000); Int_t lNPlots = 6; TArrayD energy(lNPlots); TArrayD expSlope(lNPlots); TArrayD gaussAmp(lNPlots); TArrayD gaussSigma(lNPlots); pad1->cd(); h4->Fit("gaussExp"); energy[0] = 4.0; expSlope[0] = gaussExp->GetParameter(0); gaussAmp[0] = gaussExp->GetParameter(1); gaussSigma[0] = gaussExp->GetParameter(2); // This does get printed to screen correctly printf("%f\n",expSlope[0]); pad2->cd(); h6->Fit("gaussExp"); energy[1] = 6.0; expSlope[1] = gaussExp->GetParameter(0); gaussAmp[1] = gaussExp->GetParameter(1); gaussSigma[1] = gaussExp->GetParameter(2); ... The problem is I can't find the arrays energy,expSlope,gaussAmp, and gaussSigma *anywhere*. I want to make a plot to see how these parameters change from histogram to histogram. I try typing printf("%f\n",energy[0]); at the prompt and I get Error: No symbol energy[0] in current scope FILE:/tmp/03374iaa LINE:1 Thanks for your time, Chris ================================================================= = = = Chris Jillings = = Department of Physics phone/voice mail: (613) 545-6000x4805 = = Queen's University fax: (613) 545-6813 = = Kingston, Ontario email: chris@mips2.phy.queensu.ca = = Canada, K7L 3N6 web: http://snodaq.phy.queensu.ca = = = =================================================================
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:30 MET