<br><br><div class="gmail_quote">On Wed, Mar 24, 2010 at 10:54 AM, Diana Parno <<a href="mailto:dseymour@andrew.cmu.edu">dseymour@andrew.cmu.edu</a>> wrote:<br><blockquote class="gmail_quote">
I might advise creating a separate, explicit TProfile object, as in<br>
<div class="im"><br>
h1[i]->SetMinimum(0.1);<br>
</div> TProfile *myprofX = h1[i]->ProfileX();<br>
myprofX->Draw();<br>
myprofX->Fit("pol1");<br>
// etc<br>
<br>
If the profile isn't attached to its own object, I'm really not sure how<br>
ROOT would handle it -- I wouldn't expect the ProfileX to persist as an<br>
object past the line where you write "h1[i]->ProfileX()->Draw();". There<br>
is no reason for ROOT to think it might have to hang onto the profile once<br>
it's drawn. My terminology here is probably not sound, but I suspect that<br>
this is why the fits aren't working.<br></blockquote><div><br>This makes sense -- however, it does not work... I'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<6; i++){<br> c1->cd(i+1);<br> rootvar.Form("1e+9*L.s1.lt_c[%d]:1.0/sqrt(L.s1.la_c[%d])",i,i);<br> hname.Form("h1[%d]",i+1);<br> h1[i] = new TH2F(hname,rootvar,1000,0.02,0.2,1000,0,220);<br>
h1[i]->SetName(hname);<br> h1[i]->GetXaxis()->SetTitle("1/sqrt(ADC) (arb.)");<br> h1[i]->GetXaxis()->CenterTitle();<br> h1[i]->GetYaxis()->SetTitle("TDC (ns)");<br> h1[i]->GetYaxis()->CenterTitle();<br>
h1[i]->SetMarkerColor(kBlack);<br> cut = cut0;<br> T->Project(hname,rootvar,cut);<br> h1[i]->SetMinimum(0.1);<br> PR[i] = h1[i]->ProfileX();<br> PR[i]->Draw();<br> PR[i]->Fit("pol1");<br>
<br> c1->Update();<br><br> } <br><br>I've tried it this way, and the way you initially mentioned -- still get a flat line along x. I'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>