[d2n-analysis-talk] ROOT TH2D Fit Trouble: S1 Timewalk

David Flay flay at jlab.org
Wed Mar 24 14:23:46 EDT 2010


On Wed, Mar 24, 2010 at 10:54 AM, Diana Parno <dseymour at andrew.cmu.edu>wrote:

> I might advise creating a separate, explicit TProfile object, as in
>
>        h1[i]->SetMinimum(0.1);
>         TProfile *myprofX = h1[i]->ProfileX();
>        myprofX->Draw();
>        myprofX->Fit("pol1");
>        // etc
>
> If the profile isn't attached to its own object, I'm really not sure how
> ROOT would handle it -- I wouldn't expect the ProfileX to persist as an
> object past the line where you write "h1[i]->ProfileX()->Draw();". There
> is no reason for ROOT to think it might have to hang onto the profile once
> it's drawn. My terminology here is probably not sound, but I suspect that
> this is why the fits aren't working.
>

This makes sense -- however, it does not work... I've modified your idea a
bit, so I can make arrays of profiles:


 [. . .]

  TProfile **PR = new TProfile*[6];

  for(Int_t i=0; i<6; i++){
    c1->cd(i+1);
    rootvar.Form("1e+9*L.s1.lt_c[%d]:1.0/sqrt(L.s1.la_c[%d])",i,i);
    hname.Form("h1[%d]",i+1);
    h1[i] = new TH2F(hname,rootvar,1000,0.02,0.2,1000,0,220);
    h1[i]->SetName(hname);
    h1[i]->GetXaxis()->SetTitle("1/sqrt(ADC) (arb.)");
    h1[i]->GetXaxis()->CenterTitle();
    h1[i]->GetYaxis()->SetTitle("TDC (ns)");
    h1[i]->GetYaxis()->CenterTitle();
    h1[i]->SetMarkerColor(kBlack);
    cut = cut0;
    T->Project(hname,rootvar,cut);
    h1[i]->SetMinimum(0.1);
    PR[i] = h1[i]->ProfileX();
    PR[i]->Draw();
    PR[i]->Fit("pol1");

    c1->Update();

  }

I've tried it this way, and the way you initially mentioned -- still get a
flat line along x.  I'm quite confused.




-- 
-----------------------------------------------------------
David Flay
Physics Department
Temple University
Philadelphia, PA 19122

office: Barton Hall, BA319
phone: (215) 204-1331

e-mail: flay at jlab.org
           flay at temple.edu

website: http://www.jlab.org/~flay
             http://quarks.temple.edu
-----------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mailman.jlab.org/pipermail/d2n-analysis-talk/attachments/20100324/9d10baea/attachment.html 


More information about the d2n-analysis-talk mailing list