Changeset 15527 for trunk/Mars/fact


Ignore:
Timestamp:
05/07/13 23:35:45 (12 years ago)
Author:
Daniela Dorner
Message:
bugfix: sometimes last point was missing, adapted y-range for rates
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/fact/analysis/lightcurve.C

    r15396 r15527  
    147147        {
    148148            counter2++;
     149            cout << "-----" << (*row2)[0] << " " << (*row2)[3] << endl;
    149150            ontime=(*row2)[0];
    150151            bgevts=(*row2)[1];
     
    171172                significance=MMath::SignificanceLiMa(sigevtssum, bgevtssum, 0.2);
    172173                cout << "  significance: " << significance << endl;
    173                 cout << "  excess: " << excevtssum << endl;
    174                 cout << "  bg: " << bgevtssum << endl;
    175                 cout << "  ontime: " << ontimesum/3600 << endl;
    176                 cout << "  excessrate: " << excevtssum/ontimesum*3600 << endl;
    177                 cout << "  bgrate: " << bgevtssum/ontimesum*3600 << endl;
    178                 signifrate=significance/ontimesum*3600;
     174                cout << "  excess: " << excevtssum << " evts" << endl;
     175                cout << "  bg: " << bgevtssum << " evts" << endl;
     176                cout << "  ontime: " << ontimesum << " s " << endl;
     177                cout << "  excessrate: " << excevtssum/ontimesum*3600 << " evts/h" << endl;
     178                cout << "  bgrate: " << bgevtssum/ontimesum*3600 << " evts/h" << endl;
     179                signifrate=significance/sqrt(ontimesum*3600);
    179180                bgrate=bgevtssum/ontimesum*3600;
    180181                excrate=excevtssum/ontimesum*3600;
     
    185186                mjd=mjdstart+(mjdstop-mjdstart)/2;
    186187                cout << "  mjd: " << mjd <<  " (" << mjdstart << " - " << mjdstop << ") " << endl;
    187                 if (mjd<50000)
     188                if (excrate>300)
    188189                    cout << "==>" << (*row2)[0] << " " << (*row2)[1] << " " << (*row2)[2]
    189190                        << " " << (*row2)[3] << " " << (*row2)[4] << " " << (*row2)[5]
     
    227228
    228229        }
    229 
     230        cout << "reached last run" << endl;
     231        // if ontime is larger than 90% of the timebin width, the last point is filled
     232        if (ontimesum>(minutes-0.1*minutes))
     233        {
     234            cout << "ontime > " << minutes-0.1*minutes << endl;
     235            significance=MMath::SignificanceLiMa(sigevtssum, bgevtssum, 0.2);
     236            cout << "  significance: " << significance << endl;
     237            cout << "  excess: " << excevtssum << " evts" << endl;
     238            cout << "  bg: " << bgevtssum << " evts" << endl;
     239            cout << "  ontime: " << ontimesum << " s " << endl;
     240            cout << "  excessrate: " << excevtssum/ontimesum*3600 << " evts/h" << endl;
     241            cout << "  bgrate: " << bgevtssum/ontimesum*3600 << " evts/h" << endl;
     242            signifrate=significance/sqrt(ontimesum*3600);
     243            bgrate=bgevtssum/ontimesum*3600;
     244            excrate=excevtssum/ontimesum*3600;
     245            excerr = MMath::ErrorExc(significance, bgevtssum, 0.2)/ontimesum*3600.;
     246            zdmean=zdmin+(zdmax-zdmin)/2;
     247            mjdstop=stop.GetMjd();
     248            mjd=mjdstart+(mjdstop-mjdstart)/2;
     249            cout << "  mjd: " << mjd <<  " (" << mjdstart << " - " << mjdstop << ") " << endl;
     250
     251            exc.Fill(excrate);
     252            bg.Fill(bgrate);
     253            excessrate.SetPoint(counter, mjd, excrate);
     254            excessrate.SetPointError(counter, ontimesum/3600./24/2, excerr);
     255            backgroundrate.SetPoint(counter, mjd, bgrate);
     256            backgroundrate.SetPointError(counter, ontimesum/3600./24/2, sqrt(bgevtssum)/ontimesum*3600);
     257            excvszd.SetPoint(counter, zdmean, excrate);
     258            excvszd.SetPointError(counter, (zdmax-zdmin)/2, excerr);
     259            excvsbg.SetPoint(counter, bgrate, excrate);
     260            excvsbg.SetPointError(counter, sqrt(bgevtssum)/ontimesum*3600, excerr);
     261            bgvszd.SetPoint(counter, zdmean, bgrate);
     262            bgvszd.SetPointError(counter, (zdmax-zdmin)/2, sqrt(bgevtssum)/ontimesum*3600);
     263            signif.SetPoint(counter, mjd, significance);
     264            signif.SetPointError(counter, ontimesum/3600./24/2, 0);
     265            significancerate.SetPoint(counter, mjd, signifrate);
     266            significancerate.SetPointError(counter, ontimesum/3600./24/2, 0);
     267        }
    230268        delete res2;
    231269    }
     
    238276
    239277    TCanvas &c1 = d->AddTab("Rates vs MJD", "Rates vs MJD");
     278    gPad->SetGridy();
    240279    excessrate.SetTitle("Rates vs MJD");
    241280    excessrate.SetMarkerStyle(7);
     
    244283    excessrate.GetXaxis()->SetTitle("MJD");
    245284    excessrate.GetXaxis()->CenterTitle();
    246     excessrate.GetYaxis()->SetRangeUser(-50,200);
     285    excessrate.GetYaxis()->SetRangeUser(-50,400);
    247286    excessrate.DrawClone("AP");
    248287
     
    254293
    255294    TCanvas &c2 = d->AddTab("Excess Rate vs MJD", "Excess Rate vs MJD");
     295    gPad->SetGridy();
    256296    excessrate.SetTitle("Excess Rate vs MJD");
    257297    excessrate.SetMarkerStyle(7);
     
    290330
    291331    TCanvas &c6 = d->AddTab("Signifrate vs MJD", "Signifrate vs MJD");
     332    gPad->SetGridy();
    292333    significancerate.SetTitle("Significance Rate vs MJD");
    293334    significancerate.SetMarkerStyle(7);
Note: See TracChangeset for help on using the changeset viewer.