I have the following macro where I do a FitSlices
to a 3D histogram and I plot the fitting parameter
stored in a 2D histogram. The macro works fine
with the interpreter.
However when I compile (.L macro.C++), obviously I
get the error that : `HParticleRapidityPtPhi_0'
undeclared (first use this function).
I then uncomment the line :TH2 *
HParticleRapidityPtPhi_0 ; Obviously again the
compilation works fine but at running time the
pointer HParticleRapidityPtPhi_0 remains = 0 !
What is the trick ?
Thanks ... Yves
Double_t fitparphi(Double_t *x, Double_t *par)
{
Double_t fitval = par[0];
return fitval;
}
#include "TH1.h"
#include "TH2.h"
#include "TH3.h"
#include "TFile.h"
#include <iostream.h>
#include "TF1.h"
#include "TF3.h"
#include "TCanvas.h"
#include "TGraph.h"
void fit3d()
{
TFile * file = new
TFile("/tempo/gps/commun/nexus/Osc2Root/histogram3.root")
; TH3 * histo =
(TH3F*)file->Get("HParticleRapidityPtPhi");
TF1 * funcphi = new
TF1("fitparphi",fitparphi,-5., 5.,1);
funcphi->SetParameters(0.,1.,1.,1.);
funcphi->SetParNames( "A0");
funcphi->SetRange(-3.,3.) ;
// TH2 * HParticleRapidityPtPhi_0 ;
histo->FitSlicesZ(funcphi);
HParticleRapidityPtPhi_0->Draw() ;
}
--
__________________________________________________________________
|Yves SCHUTZ (IN2P3 - CNRS) collaboration TAPS/WA98/ALICE |
|SUBATECH |
|Ecole des Mines de Nantes Telephone: (+33/0) 2 51 85 84 71 |
|4, rue Alfred Kastler Fax : (+33/0) 2 51 85 84 24 |
|F-44070 Nantes cedex 03 e-mail : yves.schutz@subatech.in2p3.fr|
|__________________________________________________________________|
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:29 MET