<br><br><div class="gmail_quote">On Wed, Mar 24, 2010 at 10:54 AM, Diana Parno &lt;<a href="mailto:dseymour@andrew.cmu.edu">dseymour@andrew.cmu.edu</a>&gt; wrote:<br><blockquote class="gmail_quote">
I might advise creating a separate, explicit TProfile object, as in<br>
<div class="im"><br>
        h1[i]-&gt;SetMinimum(0.1);<br>
</div>        TProfile *myprofX = h1[i]-&gt;ProfileX();<br>
        myprofX-&gt;Draw();<br>
        myprofX-&gt;Fit(&quot;pol1&quot;);<br>
        // etc<br>
<br>
If the profile isn&#39;t attached to its own object, I&#39;m really not sure how<br>
ROOT would handle it -- I wouldn&#39;t expect the ProfileX to persist as an<br>
object past the line where you write &quot;h1[i]-&gt;ProfileX()-&gt;Draw();&quot;. There<br>
is no reason for ROOT to think it might have to hang onto the profile once<br>
it&#39;s drawn. My terminology here is probably not sound, but I suspect that<br>
this is why the fits aren&#39;t working.<br></blockquote><div><br>This makes sense -- however, it does not work... I&#39;ve modified your idea a bit, so I can make arrays of profiles:<br><br><br> [. . .]<br><br>  TProfile **PR = new TProfile*[6];<br>
<br>  for(Int_t i=0; i&lt;6; i++){<br>    c1-&gt;cd(i+1);<br>    rootvar.Form(&quot;1e+9*L.s1.lt_c[%d]:1.0/sqrt(L.s1.la_c[%d])&quot;,i,i);<br>    hname.Form(&quot;h1[%d]&quot;,i+1);<br>    h1[i] = new TH2F(hname,rootvar,1000,0.02,0.2,1000,0,220);<br>
    h1[i]-&gt;SetName(hname);<br>    h1[i]-&gt;GetXaxis()-&gt;SetTitle(&quot;1/sqrt(ADC) (arb.)&quot;);<br>    h1[i]-&gt;GetXaxis()-&gt;CenterTitle();<br>    h1[i]-&gt;GetYaxis()-&gt;SetTitle(&quot;TDC (ns)&quot;);<br>    h1[i]-&gt;GetYaxis()-&gt;CenterTitle();<br>
    h1[i]-&gt;SetMarkerColor(kBlack);<br>    cut = cut0;<br>    T-&gt;Project(hname,rootvar,cut);<br>    h1[i]-&gt;SetMinimum(0.1);<br>    PR[i] = h1[i]-&gt;ProfileX();<br>    PR[i]-&gt;Draw();<br>    PR[i]-&gt;Fit(&quot;pol1&quot;);<br>
<br>    c1-&gt;Update();<br><br>  } <br><br>I&#39;ve tried it this way, and the way you initially mentioned -- still get a flat line along x.  I&#39;m quite confused.<br><br><br></div></div><br clear="all"><br>-- <br>-----------------------------------------------------------<br>
David Flay<br>Physics Department<br>Temple University<br>Philadelphia, PA 19122 <br><br>office: Barton Hall, BA319<br>phone: (215) 204-1331<br><br>e-mail: <a href="mailto:flay@jlab.org">flay@jlab.org</a> <br>            <a href="mailto:flay@temple.edu">flay@temple.edu</a><br>
<br>website: <a href="http://www.jlab.org/~flay">http://www.jlab.org/~flay</a><br>              <a href="http://quarks.temple.edu">http://quarks.temple.edu</a><br>-----------------------------------------------------------<br>
<br><br>