Ignore:
Timestamp:
01/16/09 14:57:34 (16 years ago)
Author:
hoehne
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/datacenter/macros
Files:
3 edited

Legend:

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

    r9216 r9225  
    235235    if (impact < 0)
    236236        imax = "NULL";
    237     TString numphe    = Form("%5.1f", runheader3->GetNumPheFromDNSB());
     237    TString numphe    = Form("%7.3f", runheader3->GetNumPheFromDNSB());
    238238    TString pmin      = Form("%5.1f", runheader3->GetShowerPhiMin());
    239239    TString pmax      = Form("%5.1f", runheader3->GetShowerPhiMax());
     
    600600                 "fReflectorVersionKEY=%d, fCameraVersionKEY=%d, "
    601601                 "fObservationModeKEY=%d, fMCParticleKEY=%d, "
    602                  "fSequenceFirst=0, fNumTriggers=%d, fNumSumTriggers=%d, fViewconeAngleInner=%5.2f, fViewconeAngleOuter=%5.2f, "
     602                 "fNumTriggers=%d, fNumSumTriggers=%d, fViewconeAngleInner=%5.2f, fViewconeAngleOuter=%5.2f, "
    603603                 "fAtmosphericModelKEY=%d, fAmplFadcKEY=%d, fAddSpotSizeKEY=%d, "
    604604                 "fPSFKEY=%d, fViewconeAngleOKEY=%d, fSpectrumKEY=%d, fTriggerFlagKEY=%d ",
     
    613613
    614614        TString vars2 =
    615             Form("fRunFilled=Now(), fFileName=\"%s\", fRunNumber=%d ",
    616                  fname.Data(), RunNum);
     615            Form("fRunFilled=Now(), fFileName=\"%s\", fRunNumber=%d, fPriority=%d ",
     616                 fname.Data(), RunNum, RunNum);
    617617
    618618
     
    670670                     "fReflectorVersionKEY=%d, fCameraVersionKEY=%d, "
    671671                     "fObservationModeKEY=%d, fMCParticleKEY=%d, "
    672                      "fSequenceFirst=0, fNumTriggers=%d, fNumSumTriggers=%d, fViewconeAngleInner=%5.2f, fViewconeAngleOuter=%5.2f, "
     672                     "fNumTriggers=%d, fNumSumTriggers=%d, fViewconeAngleInner=%5.2f, fViewconeAngleOuter=%5.2f, "
    673673                     "fAtmosphericModelKEY=%d, fAmplFadcKEY=%d, fAddSpotSizeKEY=%d, "
    674674                     "fPSFKEY=%d, fViewconeAngleOKEY=%d, fSpectrumKEY=%d, fTriggerFlagKEY=%d ",
     
    683683
    684684            TString vars2 =
    685                 Form("fRunFilled=Now(), fFileName=\"%s\", fRunNumber=%d ",
    686                      fname.Data(), RunNum);
     685                Form("fRunFilled=Now(), fFileName=\"%s\", fRunNumber=%d, fPriority=%d ",
     686                     fname.Data(), RunNum, RunNum);
    687687
    688688
  • trunk/MagicSoft/Mars/datacenter/macros/fillmccalib.C

    r9221 r9225  
    6161#include <iostream>
    6262
    63 #include <TEnv.h>
    6463#include <TRegexp.h>
    6564
     
    141140    if (!h)
    142141    {
    143         cout << "WARNING - Could not find histogram HRelTimeHiGainArea0." << endl;
     142        cout << "ERROR - Could not find histogram HRelTimeHiGainArea0." << endl;
    144143        return 2;
    145144    }
     
    152151    if (!h)
    153152    {
    154         cout << "WARNING - Could not find histogram HRelTimeHiGainArea1." << endl;
     153        cout << "ERROR - Could not find histogram HRelTimeHiGainArea1." << endl;
    155154        return 2;
    156155    }
     
    163162    if (!c)
    164163    {
    165         cout << "WARNING - Could not find MHCamera TotalConv." << endl;
     164        cout << "ERROR - Could not find MHCamera TotalConv." << endl;
    166165        return 2;
    167166    }
     
    264263             " fConvFactorInner=%s, "
    265264             " fConvFactorOuter=%s, "
    266              " fRatioCalEvents=%s, "
     265             " fRatioCalEvts=%s, "
    267266             " fRelChargeRmsInner=%s, "
    268267             " fRelChargeRmsOuter=%s, "
  • trunk/MagicSoft/Mars/datacenter/macros/fillmcsignal.C

    r9221 r9225  
    6060#include <iomanip>
    6161
    62 #include <TEnv.h>
    6362#include <TRegexp.h>
    6463
     
    6665#include <TGraph.h>
    6766#include <TSQLResult.h>
     67#include <TSQLRow.h>
    6868
    6969#include "MSQLServer.h"
     
    8989    }
    9090
    91     Float_t meanextpul = -1;
    92     Float_t rmsextpul  = -1;
     91    TString meanextpulpos("NULL");
     92    TString rmsextpulpos("NULL");
    9393
    9494    MCalibrationPulseTimeCam *pt;
     
    9696    if (pt)
    9797    {
    98         meanextpul = pt->GetAverageArea(0).GetHiGainMean();
    99         rmsextpul  = pt->GetAverageArea(0).GetHiGainRms();
    100 
    101         meanextpul = TMath::Nint(meanextpul*100)/100.;
    102         rmsextpul  = TMath::Nint(rmsextpul*100)/100.;
    103     }
     98        Double_t meanextpul = pt->GetAverageArea(0).GetHiGainMean();
     99        Double_t rmsextpul  = pt->GetAverageArea(0).GetHiGainRms();
     100
     101        if (meanextpul>=0 || rmsextpulpos>=0)
     102        {
     103            meanextpulpos.Form("%6.2f", meanextpul);
     104            rmsextpulpos.Form("%6.2f", rmsextpul);
     105        }
     106    }
     107
    104108
    105109    MStatusArray arr;
     
    113117    if (!cam)
    114118    {
    115         cout << "WARNING - Reading of PedRMS;avg failed." << endl;
     119        cout << "ERROR - Reading of PedRMS;avg failed." << endl;
    116120        return 2;
    117121    }
     
    121125    if (!pul)
    122126    {
    123         cout << "WARNING - Reading of PulsePos;avg failed." << endl;
     127        cout << "ERROR - Reading of PulsePos;avg failed." << endl;
    124128        return 2;
    125129    }
     
    136140        return 2;
    137141    }
    138 
    139     Double_t medoff;
    140     Double_t devoff;
    141 
    142     Double_t medcal;
    143     Double_t devcal;
    144142
    145143    TString medpuloff("NULL");
     
    148146    TString devhilocal("NULL");
    149147
    150     MHCamera *hilooff = (MHCamera*)arr.FindObjectInCanvas("HiLoOff;avg", "MHCamera", "HiLoOff");
    151     if (!hilooff)
    152     {
    153         cout << "WARNING - Reading of HiLoOff failed." << endl;
    154         return 2;
    155     }
    156 
    157     MHCamera *hilocal = (MHCamera*)arr.FindObjectInCanvas("HiLoCal;avg", "MHCamera", "HiLoCal");
    158     if (!hilocal)
    159     {
    160         cout << "WARNING - Reading of HiLoCal failed." << endl;
    161         return 2;
    162     }
    163 
    164     medoff = TMath::Nint(hilooff->GetMedian()*10000)/10000.;
    165     devoff = TMath::Nint(hilooff->GetDev()   *10000)/10000.;
    166 
    167     medcal = TMath::Nint(hilocal->GetMedian()*100)/100.;
    168     devcal = TMath::Nint(hilocal->GetDev()   *100)/100.;
    169 
    170     medpuloff.Form("%7.4f", medoff);
    171     devpuloff.Form("%7.4f", devoff);
    172     medhilocal.Form("%6.2f", medcal);
    173     devhilocal.Form("%6.2f", devcal);
     148    TString query(Form("SELECT MCSequences.fAmplFadcKEY FROM MCSequences LEFT JOIN "
     149                       "AmplFadc on MCSequences.fAmplFadcKEY=AmplFadc.fAmplFadcKEY "
     150                       "where fSequenceFirst=%d;",seq.GetSequence()));
     151
     152    TSQLResult *res = serv.Query(query);
     153    if (!res)
     154    {
     155        cout << "ERROR - Query failed: " << query << endl;
     156        return 2;
     157    }
     158
     159    TSQLRow *row = res->Next();
     160    if (!row)
     161    {
     162        cout << "ERROR - Query failed: " << query << endl;
     163        return 2;
     164    }
     165    TString epochkey  = (*row)[0];
     166    Int_t epoch = atoi(epochkey.Data());
     167
     168    delete res;
     169
     170    if (epoch!=1)
     171    {
     172        MHCamera *hilooff = (MHCamera*)arr.FindObjectInCanvas("HiLoOff;avg", "MHCamera", "HiLoOff");
     173        if (!hilooff)
     174        {
     175            cout << "ERROR - Reading of HiLoOff failed." << endl;
     176            return 2;
     177        }
     178
     179        MHCamera *hilocal = (MHCamera*)arr.FindObjectInCanvas("HiLoCal;avg", "MHCamera", "HiLoCal");
     180        if (!hilocal)
     181        {
     182            cout << "ERROR - Reading of HiLoCal failed." << endl;
     183            return 2;
     184        }
     185
     186        medpuloff.Form("%7.4f",  hilooff->GetMedian());
     187        devpuloff.Form("%7.4f",  hilooff->GetDev());
     188        medhilocal.Form("%6.2f", hilocal->GetMedian());
     189        devhilocal.Form("%6.2f", hilocal->GetDev());
     190    }
    174191
    175192    TArrayI inner(1);
     
    186203    if (meanrmsi<0 || meanrmso<0)
    187204    {
    188         cout << "WARNING - MeanPedRMS inner or outer < 0 " << endl;
     205        cout << "ERROR - MeanPedRMS inner or outer < 0 " << endl;
    189206        cout << "MeanPedRMS inner " << meanrmsi << endl;
    190207        cout << "MeanPedRMS outer " << meanrmso << endl;
     
    192209    }
    193210
    194     meanrmsi = TMath::Nint(meanrmsi*100)/100.;
    195     meanrmso = TMath::Nint(meanrmso*100)/100.;
     211    TString meanrmsinner=Form("%6.2f", meanrmsi);
     212    TString meanrmsouter=Form("%6.2f", meanrmso);
    196213
    197214    cam = (MHCamera*)arr.FindObjectInCanvas("Interp'd;avg", "MHCamera", "Interp'd");
    198215    if (!cam)
    199216    {
    200         cout << "WARNING - Reading of Interp'd;avg failed." << endl;
     217        cout << "ERROR - Reading of Interp'd;avg failed." << endl;
    201218        return 2;
    202219    }
     
    207224    if (meansigi<0 || meansigo<0)
    208225    {
    209         cout << "WARNING - MeanInterp'd inner or outer < 0 " << endl;
     226        cout << "ERROR - MeanInterp'd inner or outer < 0 " << endl;
    210227        cout << "MeanInterp'd inner " << meansigi << endl;
    211228        cout << "MeanInterp'd outer " << meansigo << endl;
     
    213230    }
    214231
    215     meansigi = TMath::Nint(meansigi*100)/100.;
    216     meansigo = TMath::Nint(meansigo*100)/100.;
     232    TString meansiginner =Form("%6.2f", meansigi);
     233    TString meansigouter =Form("%6.2f", meansigo);
    217234
    218235    TString calpos = cal ? Form("%5.1f", cal->GetMean()) : "NULL";
    219236
    220     Stat_t meanpul = pul->GetMean();
    221     Stat_t rmspul  = pul->GetRMS();
    222 
    223     if (meanpul<0 || rmspul<0)
    224     {
    225         cout << "WARNING - PulsePos'd mean or rms < 0 " << endl;
    226         cout << "PulsePos'd mean " << meanpul << endl;
    227         cout << "PulsePos'd rms  " << rmspul << endl;
    228         return 2;
    229     }
    230 
    231     meanpul = TMath::Nint(meanpul*100)/100.;
    232     rmspul  = TMath::Nint(rmspul *100)/100.;
     237    if (pul->GetMean()<0 || pul->GetRMS()<0)
     238    {
     239        cout << "ERROR - PulsePos'd mean or rms < 0 " << endl;
     240        cout << "PulsePos'd mean " << pul->GetMean() << endl;
     241        cout << "PulsePos'd rms  " << pul->GetRMS() << endl;
     242        return 2;
     243    }
     244
     245    TString meanpulpos = Form("%6.2f", pul->GetMean());
     246    TString rmspulpos  = Form("%6.2f", pul->GetRMS());
    233247
    234248    cam = (MHCamera*)arr.FindObjectInCanvas("Unsuitable;avg", "MHCamera", "Unsuitable");
    235249    if (!cam)
    236250    {
    237         cout << "WARNING - Reading of Unsuitable;avg failed." << endl;
     251        cout << "ERROR - Reading of Unsuitable;avg failed." << endl;
    238252        return 2;
    239253    }
     
    242256    Int_t unsuitable01 = cam->GetNumBinsAboveThreshold(0.01);
    243257
    244     TString meanrmsinner =Form("%6.2f", meanrmsi);
    245     TString meanrmsouter =Form("%6.2f", meanrmso);
    246     TString meansiginner =Form("%6.2f", meansigi);
    247     TString meansigouter =Form("%6.2f", meansigo);
    248     TString meanpulpos   =Form("%6.2f", meanpul);
    249     TString rmspulpos    =Form("%6.2f", rmspul);
    250     TString meanextpulpos=Form("%6.2f", meanextpul);
    251     TString rmsextpulpos =Form("%6.2f", rmsextpul);
    252 
    253     if (meanextpul<0 && rmsextpul<0)
    254     {
    255         meanextpulpos = "NULL";
    256         rmsextpulpos  = "NULL";
    257     }
    258 
    259258    // *****************************************************
    260 
    261     // *****************************************************
    262 
    263259
    264260    cout << "Sequence #" << seq.GetSequence() << endl;
Note: See TracChangeset for help on using the changeset viewer.