Ignore:
Timestamp:
06/09/08 15:17:23 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/datacenter/macros
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/datacenter/macros/fillcalib.C

    r8927 r8931  
    149149    }
    150150
    151     Float_t meani = h->GetMean();
    152     Float_t rmsi  = h->GetRMS();
    153     meani = TMath::Nint(meani*10)/10.;
    154     rmsi  = TMath::Nint(rmsi*100)/100.;
    155     TString meaninner = Form("%5.1f", meani);
    156     TString rmsinner  = Form("%6.2f", rmsi);
    157 
     151    TString meaninner = Form("%5.1f", h->GetMean());
     152    TString rmsinner  = Form("%6.2f", h->GetRMS());
    158153
    159154    //getting the mean and rms from the arrival time (outer cam)
     
    165160    }
    166161
    167     Float_t meano = h->GetMean();
    168     Float_t rmso  = h->GetRMS();
    169     meano = TMath::Nint(meano*10)/10.;
    170     rmso  = TMath::Nint(rmso*100)/100.;
    171     TString meanouter = Form("%5.1f", meano);
    172     TString rmsouter  = Form("%6.2f", rmso);
    173 
     162    TString meanouter = Form("%5.1f", h->GetMean());
     163    TString rmsouter  = Form("%6.2f", h->GetRMS());
    174164
    175165    //Getting conversion factors
     
    189179    Stat_t meanconvi = c->GetMeanSectors(TArrayI(6, s0), inner);
    190180    Stat_t meanconvo = c->GetMeanSectors(TArrayI(6, s0), outer);
    191     meanconvi = TMath::Nint(meanconvi*1000)/1000.;
    192     meanconvo = TMath::Nint(meanconvo*1000)/1000.;
    193181    TString meanconvinner=Form("%6.3f", meanconvi);
    194182    TString meanconvouter=Form("%6.3f", meanconvo);
  • trunk/MagicSoft/Mars/datacenter/macros/fillsignal.C

    r8927 r8931  
    6262#include <TRegexp.h>
    6363
     64#include <TH2.h>
    6465#include <TFile.h>
    6566#include <TGraph.h>
     
    8687    }
    8788
    88     Float_t meanextpul = -1;
    89     Float_t rmsextpul  = -1;
     89    TString meanextpulpos("NULL");
     90    TString rmsextpulpos("NULL");
    9091
    9192    MCalibrationPulseTimeCam *pt;
     
    9394    if (pt)
    9495    {
    95         meanextpul = pt->GetAverageArea(0).GetHiGainMean();
    96         rmsextpul  = pt->GetAverageArea(0).GetHiGainRms();
    97 
    98         meanextpul = TMath::Nint(meanextpul*100)/100.;
    99         rmsextpul  = TMath::Nint(rmsextpul*100)/100.;
    100     }
     96        Double_t meanextpul = pt->GetAverageArea(0).GetHiGainMean();
     97        Double_t rmsextpul  = pt->GetAverageArea(0).GetHiGainRms();
     98
     99        if (meanextpul>=0 || rmsextpulpos>=0)
     100        {
     101            meanextpulpos.Form("%6.2f", meanextpul);
     102            rmsextpulpos.Form("%6.2f", rmsextpul);
     103        }
     104    }
     105
    101106
    102107    MStatusArray arr;
     
    145150
    146151    Int_t seq = atoi(sequence.Data()+6);
    147 
    148     Double_t medoff;
    149     Double_t devoff;
    150 
    151     Double_t medcal;
    152     Double_t devcal;
    153152
    154153    TString medpuloff("NULL");
     
    173172        }
    174173
    175         medoff = TMath::Nint(hilooff->GetMedian()*10000)/10000.;
    176         devoff = TMath::Nint(hilooff->GetDev()   *10000)/10000.;
    177 
    178         medcal = TMath::Nint(hilocal->GetMedian()*100)/100.;
    179         devcal = TMath::Nint(hilocal->GetDev()   *100)/100.;
    180 
    181         medpuloff.Form("%7.4f", medoff);
    182         devpuloff.Form("%7.4f", devoff);
    183         medhilocal.Form("%6.2f", medcal);
    184         devhilocal.Form("%6.2f", devcal);
     174        medpuloff.Form("%7.4f",  hilooff->GetMedian());
     175        devpuloff.Form("%7.4f",  hilooff->GetDev());
     176        medhilocal.Form("%6.2f", hilocal->GetMedian());
     177        devhilocal.Form("%6.2f", hilocal->GetDev());
    185178    }
    186179
     
    204197    }
    205198
    206     meanrmsi = TMath::Nint(meanrmsi*100)/100.;
    207     meanrmso = TMath::Nint(meanrmso*100)/100.;
     199    TString meanrmsinner=Form("%6.2f", meanrmsi);
     200    TString meanrmsouter=Form("%6.2f", meanrmso);
    208201
    209202    cam = (MHCamera*)arr.FindObjectInCanvas("Interp'd;avg", "MHCamera", "Interp'd");
     
    225218    }
    226219
    227     meansigi = TMath::Nint(meansigi*100)/100.;
    228     meansigo = TMath::Nint(meansigo*100)/100.;
    229 
    230     Stat_t meanpul = pul->GetMean();
    231     Stat_t rmspul  = pul->GetRMS();
    232 
    233     if (meanpul<0 || rmspul<0)
     220    TString meansiginner =Form("%6.2f", meansigi);
     221    TString meansigouter =Form("%6.2f", meansigo);
     222
     223    if (pul->GetMean()<0 || pul->GetRMS()<0)
    234224    {
    235225        cout << "WARNING - PulsePos'd mean or rms < 0 " << endl;
    236         cout << "PulsePos'd mean " << meanpul << endl;
    237         cout << "PulsePos'd rms  " << rmspul << endl;
    238         return 2;
    239     }
    240 
    241     meanpul = TMath::Nint(meanpul*100)/100.;
    242     rmspul  = TMath::Nint(rmspul *100)/100.;
    243 
    244     cam = (MHCamera*)arr.FindObjectInCanvas("Unsuitable;avg", "MHCamera", "Unsuitable");
    245     if (!cam)
    246     {
    247         cout << "WARNING - Reading of Unsuitable;avg failed." << endl;
    248         return 2;
    249     }
    250 
    251     Int_t unsuitable50 = cam->GetNumBinsAboveThreshold(0.50);
    252     Int_t unsuitable01 = cam->GetNumBinsAboveThreshold(0.01);
    253 
    254     TString unsuitablemax = "NULL";
    255     TString deadmax       = "NULL";
    256 
    257     TGraph *gr = (TGraph*)arr.FindObjectInCanvas("BadPixTm", "TGraph", "BadPixTm");
    258     if (gr)
    259     {
    260         const Int_t p = TMath::FloorNint(gr->GetN()*0.999);
    261         unsuitablemax = Form("%d", TMath::Nint(TMath::KOrdStat(gr->GetN(), gr->GetY(), p)));
    262     }
    263 
    264     gr = (TGraph*)arr.FindObjectInCanvas("DeadPixTm", "TGraph", "DeadPixTm");
    265     if (gr)
    266         deadmax = Form("%d", TMath::Nint(TMath::MaxElement(gr->GetN(), gr->GetY())));
    267 
     226        cout << "PulsePos'd mean " << pul->GetMean() << endl;
     227        cout << "PulsePos'd rms  " << pul->GetRMS() << endl;
     228        return 2;
     229    }
     230
     231    TString meanpulpos = Form("%6.2f", pul->GetMean());
     232    TString rmspulpos  = Form("%6.2f", pul->GetRMS());
    268233
    269234/*
     
    278243    Double_t meanoff = TMath::Nint(pullo->GetMean()*100.)/100.;
    279244    Double_t rmsoff  = TMath::Nint(pullo->GetRMS() *100.)/100.;
    280     */
    281245
    282246    // USE MEDIAN INSTEAD? GetQuantiles(Int_t nprobSum, Double_t *q, const Double_t *probSum=0);
    283247
    284 
    285     TString meanrmsinner =Form("%6.2f", meanrmsi);
    286     TString meanrmsouter =Form("%6.2f", meanrmso);
    287     TString meansiginner =Form("%6.2f", meansigi);
    288     TString meansigouter =Form("%6.2f", meansigo);
    289     TString meanpulpos   =Form("%6.2f", meanpul);
    290     TString rmspulpos    =Form("%6.2f", rmspul);
    291     TString meanextpulpos=Form("%6.2f", meanextpul);
    292     TString rmsextpulpos =Form("%6.2f", rmsextpul);
    293    /*
    294248    TString meanpulhi    =Form("%6.2f", meanhi);
    295249    TString rmspulhi     =Form("%6.2f", rmshi);
     
    299253    */
    300254
    301     if (meanextpul<0 && rmsextpul<0)
    302     {
    303         meanextpulpos = "NULL";
    304         rmsextpulpos  = "NULL";
     255    cam = (MHCamera*)arr.FindObjectInCanvas("Unsuitable;avg", "MHCamera", "Unsuitable");
     256    if (!cam)
     257    {
     258        cout << "WARNING - Reading of Unsuitable;avg failed." << endl;
     259        return 2;
     260    }
     261
     262    Int_t unsuitable50 = cam->GetNumBinsAboveThreshold(0.50);
     263    Int_t unsuitable01 = cam->GetNumBinsAboveThreshold(0.01);
     264
     265    TString unsuitablemax = "NULL";
     266    TString deadmax       = "NULL";
     267
     268    TGraph *gr = (TGraph*)arr.FindObjectInCanvas("BadPixTm", "TGraph", "BadPixTm");
     269    if (gr)
     270    {
     271        const Int_t p = TMath::FloorNint(gr->GetN()*0.999);
     272        unsuitablemax = Form("%d", TMath::Nint(TMath::KOrdStat(gr->GetN(), gr->GetY(), p)));
     273    }
     274
     275    gr = (TGraph*)arr.FindObjectInCanvas("DeadPixTm", "TGraph", "DeadPixTm");
     276    if (gr)
     277        deadmax = Form("%d", TMath::Nint(TMath::MaxElement(gr->GetN(), gr->GetY())));
     278
     279    TString rateped  = "NULL";
     280    TString rateped2 = "NULL";
     281    TString ratecal  = "NULL";
     282    TString ratetrig = "NULL";
     283    TString ratesum  = "NULL";
     284    TString ratena   = "NULL";
     285    TString ratenull = "NULL";
     286
     287    TH2D *htp = (TH2D*)arr.FindObjectInCanvas("TrigPat", "TH2D", "TrigPat");
     288    if (htp)
     289    {
     290        htp->ResetBit(TH1::kCanRebin);
     291
     292        Int_t iped  = htp->GetYaxis()->FindBin("Ped");
     293        Int_t iped2 = htp->GetYaxis()->FindBin("Ped+Trig");
     294        Int_t ical  = htp->GetYaxis()->FindBin("Cal");
     295        Int_t itrig = htp->GetYaxis()->FindBin("Trig");
     296        Int_t isum  = htp->GetYaxis()->FindBin("Sum");
     297        Int_t inull = htp->GetYaxis()->FindBin("0");
     298        Int_t ina   = htp->GetYaxis()->FindBin("UNKNOWN");
     299
     300        Int_t nx = htp->GetNbinsX();
     301
     302        rateped  = Form("%8.1f", iped <0 ? 0 : htp->Integral(1, nx, iped,  iped)  / nx);
     303        rateped2 = Form("%7.2f", iped2<0 ? 0 : htp->Integral(1, nx, iped2, iped2) / nx);
     304        ratecal  = Form("%8.1f", ical <0 ? 0 : htp->Integral(1, nx, ical,  ical)  / nx);
     305        ratetrig = Form("%8.1f", itrig<0 ? 0 : htp->Integral(1, nx, itrig, itrig) / nx);
     306        ratesum  = Form("%8.1f", isum <0 ? 0 : htp->Integral(1, nx, isum,  isum)  / nx);
     307        ratenull = Form("%8.1f", inull<0 ? 0 : htp->Integral(1, nx, inull, inull) / nx);
     308        ratena   = Form("%7.2f", ina  <0 ? 0 : htp->Integral(1, nx, ina,   ina)   / nx);
    305309    }
    306310
     
    325329    cout << "  UnsuitableMax (99.9%)   " << setw(6) << unsuitablemax << endl;
    326330    cout << "  DeadMax                 " << setw(6) << deadmax << endl;
     331    cout << "  Rate Trigger       [Hz] "  << rateped  << endl;
     332    cout << "  Rate SUM           [Hz] "  << ratesum  << endl;
     333    cout << "  Rate Ped+Trigger   [Hz]  " << rateped2 << endl;
     334    cout << "  Rate Pedestal      [Hz] "  << rateped  << endl;
     335    cout << "  Rate Calibration   [Hz] "  << ratecal  << endl;
     336    cout << "  Rate 0             [Hz] "  << ratenull << endl;
     337    cout << "  Rate UNKNOWN       [Hz]  " << ratena   << endl;
    327338    cout << endl;
    328339
     
    340351                        " fHiLoGainRatioMed=%s,  fHiLoGainRatioDev=%s, "
    341352                        " fUnsuitable50=%d,      fUnsuitable01=%d, "
    342                         " fUnsuitableMax=%s,     fDeadMax=%s "
     353                        " fUnsuitableMax=%s,     fDeadMax=%s, "
     354                        " fRateTrigEvts=%s,      fRateSumEvts=%s, "
     355                        " fRatePedTrigEvts=%s,   fRatePedEvts=%s, "
     356                        " fRateCalEvts=%s,       fRateNullEvts=%s, "
     357                        " fRateUnknownEvts=%s ",
    343358                         meanrmsinner.Data(),  meanrmsouter.Data(),
    344359                         meansiginner.Data(),  meansigouter.Data(),
     
    350365                         medhilocal.Data(),    devhilocal.Data(),
    351366                         unsuitable50,         unsuitable01,
    352                          unsuitablemax.Data(), deadmax.Data());
    353 
    354     return serv.Update("Calibration", vars, Form("fSequenceFirst=%d", seq), vars);
     367                         unsuitablemax.Data(), deadmax.Data(),
     368                         ratetrig.Data(),      ratesum.Data(),
     369                         rateped2.Data(),      rateped.Data(),
     370                         ratecal.Data(),       ratenull.Data(),
     371                         ratena.Data()
     372                       );
     373
     374
     375    return serv.Update("Calibration", vars, Form("fSequenceFirst=%d", seq));
    355376}
    356377
  • trunk/MagicSoft/Mars/datacenter/macros/fillstar.C

    r8927 r8931  
    134134    Float_t mw    = hmuon->GetMeanWidth();
    135135    Float_t psf   = 70.205*mw - 28.055;
    136     psf = TMath::Nint(psf*10)/10.;
    137     if (psf<0)
    138         psf=0;
    139     TString PSF = Form("%5.1f", psf);
     136    TString PSF = Form("%5.1f", psf<0?0:psf);
    140137    Int_t   num = (int)hmuon->GetEntries();
    141138
     
    150147    }
    151148
    152     Float_t quality = h->GetMean();
    153     quality = TMath::Nint(quality*100)/100.;
    154     TString islands = Form("%6.2f", quality);
     149    TString islands = Form("%6.2f", h->GetMean());
    155150
    156151    h = (TH1*)arr.FindObjectInCanvas("EffOnTheta", "TH1D", "EffOnTime");
     
    163158    Float_t effon = h->Integral();
    164159    Float_t mrate  = num/effon;
    165     mrate = TMath::Nint(mrate*100)/100.;
    166     if (mrate<0)
    167         mrate=0;
    168     TString muonrate = Form("%6.2f", mrate);
     160    TString muonrate = Form("%6.2f", mrate<0?0:mrate);
    169161    Int_t effontime = TMath::Nint(effon);
    170162
Note: See TracChangeset for help on using the changeset viewer.