fiiting histogram with several gaus functions

From: Boris Skorodumov <bskorodo_at_nd.edu>
Date: Tue, 12 Apr 2005 18:53:28 -0500


dear rooters,

if i want to fit histogram *h1* with several *"gaus"* functions, i can carry out the next procedure:

  ...............

  TMarker *m;
  Double_t limits[100];
  int num = 5;

  ....................

   for(int j = 0; j < num*2; j++) {
    m = (TMarker*)gPad->WaitPrimitive("TMarker","Marker");     *limits*[j] = m -> GetX();
    m -> Delete();
   }

   ...................

   g1    = new TF1("g1","gaus",limits[0],limits[1]);
   g2    = new TF1("g2","gaus",limits[2],limits[3]);
   g3    = new TF1("g3","gaus",limits[4],limits[5]);
   g4 = new TF1("g4","gaus",limits[6],limits[7]);    g5 = new TF1("g5","gaus",limits[8],limits[9]);   
   h1 -> Fit("g1","RQ+");
   h1 -> Fit("g2","RQ+");
   h1 -> Fit("g3","RQ+");
   h1 -> Fit("g4","RQ+");
   h1 -> Fit("g5","RQ+");
  

   h1 -> Draw();

   ....................

i remember, somewhere in tutorials i saw how to make the same think in one loop, but unfortunatly i cannot find it.

thank you,
boris.

-- 

--------------------------------------
| Boris Skorodumov, Graduate Student | | Physics Department | | University of Notre Dame | | Indiana 46556, USA | | WWW: http://www.nd.edu/~bskorodo |
--------------------------------------
Received on Wed Apr 13 2005 - 01:53:40 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:06 MET