Ignore:
Timestamp:
02/12/09 20:07:51 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mjobs
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mjobs/MDataSet.cc

    r9212 r9328  
    217217#include "MEnv.h"
    218218#include "MAstro.h"
     219#include "MString.h"
    219220#include "MDirIter.h"
    220221#include "MSequence.h"
     
    297298        // Set default sequence file and dir name
    298299        if (name.IsNull())
    299             name = Form("%s%04d/sequence%08d.txt", sequences.Data(), num[i]/10000, num[i]);
     300            name = MString::Format("%s%04d/sequence%08d.txt", sequences.Data(), num[i]/10000, num[i]);
    300301        if (dir.IsNull())
    301             dir = Form("%s%04d/%08d", data.Data(), num[i]/10000, num[i]);
     302            dir = MString::Format("%s%04d/%08d", data.Data(), num[i]/10000, num[i]);
    302303
    303304        // Check if sequence information is contained in Dataset file
     
    385386
    386387    // Determin the prefix to access this resource
    387     const TString prefix = num==(UInt_t)-1 ? "" : Form("%d", num);
     388    const TString prefix = num==(UInt_t)-1 ? "" : MString::Format("%d", num);
    388389
    389390    // Open and read the file
     
    494495    const Bool_t useds = seq.GetFileName()==fFileName;
    495496
    496     out << "Sequence" << Form("%08d", seq.GetSequence()) << ".File:   " << (useds?"-":seq.GetFileName()) << endl;
    497     out << "Sequence" << Form("%08d", seq.GetSequence()) << ".Dir:    " << seq.GetDataPath() << endl;
     497    out << "Sequence" << MString::Format("%08d", seq.GetSequence()) << ".File:   " << (useds?"-":seq.GetFileName()) << endl;
     498    out << "Sequence" << MString::Format("%08d", seq.GetSequence()) << ".Dir:    " << seq.GetDataPath() << endl;
    498499    if (!useds && seq.GetNumExclRuns()>0)
    499         out << "Sequence" << Form("%08d", seq.GetSequence()) << ".Exclude: " << seq.GetExcludedRuns() << endl;
     500        out << "Sequence" << MString::Format("%08d", seq.GetSequence()) << ".Exclude: " << seq.GetExcludedRuns() << endl;
    500501
    501502    if (useds)
  • trunk/MagicSoft/Mars/mjobs/MJSimulation.cc

    r9319 r9328  
    152152
    153153    cont.Add(plist.FindObject("MPulseShape"));
    154     cont.Add(plist.FindObject("MReflector"));
     154    cont.Add(plist.FindObject("Reflector"));
    155155    cont.Add(plist.FindObject("MGeomCam"));
    156     cont.Add(plist.FindObject("GeomAPDs"));
     156    cont.Add(plist.FindObject("GeomCones"));
    157157
    158158    if (fDisplay)
     
    248248    // --------------------------------------------------------------------------------
    249249
    250     // ---------- FIXME FIXME FIXME -----------
    251     // FIXME: Find a better name (What if both cams are identical?)
    252     MParEnv env1("GeomAPDs");  // Inheritance!
    253     MParEnv env2("MGeomCam");  // Inheritance!
     250    // FIXME: Allow empty GeomCones!
     251    MParEnv env0("Reflector");
     252    MParEnv env1("GeomCones");
     253    MParEnv env2("MGeomCam");
     254    env0.SetClassName("MReflector");
    254255    env1.SetClassName("MGeomCam");
    255256    env2.SetClassName("MGeomCam");
     257    plist.AddToList(&env0);
    256258    plist.AddToList(&env1);
    257259    plist.AddToList(&env2);
    258 
    259     // FIXME: Allow the user to create other reflectors
    260     MReflector reflector;
    261     plist.AddToList(&reflector);
    262260
    263261    plist.FindCreateObj("MPedPhotCam", "MPedPhotFromExtractorRndm");
     
    314312    MSimMMCS simmmcs;
    315313
    316     MSimAbsorption absapd("AbsorptionAPDs");
    317     MSimAbsorption absmir("AbsorptionMirrors");
    318     MSimAbsorption cones("AbsorptionCones");
     314    MSimAbsorption absapd("PhotonDetectionEfficiency");
     315    MSimAbsorption absmir("MirrorReflectivity");
     316    MSimAbsorption cones("ConesAngularAcceptance");
    319317    cones.SetUseTheta();
    320318
     
    322320
    323321    MSimReflector reflect;
    324     reflect.SetNameGeomCam("GeomAPDs");
     322    reflect.SetNameGeomCam("GeomCones");
    325323//  MSimStarField stars;
    326324
     
    337335    MBinning binszd( 70,     0,       70, "BinningZd");
    338336    MBinning binsvc(155,     0,       31, "BinningViewCone");
    339     MBinning binsew(150,     0,       25, "BinningEvtWidth");
     337    MBinning binsew(150,     0,       50, "BinningEvtWidth");
    340338    MBinning binstr("BinningTrigPos");
    341339
     
    357355    MH3 mhtp("TriggerPos.fVal-IntendedPulsePos.fVal-MPulseShape.GetPulseWidth");
    358356    mhtp.SetName("TrigPos");
    359     mhtp.SetTitle("Trigger position w.r.t. the first photon hitting an APD");
     357    mhtp.SetTitle("Trigger position w.r.t. the first photon hitting a detector");
    360358
    361359    MH3 mhew("MPhotonStatistics.fTimeLast-MPhotonStatistics.fTimeFirst - MRawRunHeader.GetFreqSampling/1000.*MRawRunHeader.fNumSamplesHiGain - 2*MPulseShape.GetPulseWidth");
    362360    mhew.SetName("EvtWidth");
    363     mhew.SetTitle("Time between first and last photon hitting an APD");
     361    mhew.SetTitle("Time between first and last photon hitting a detector");
    364362
    365363    MFillH fillh1(&mhn1, "", "FillH1");
     
    372370    fillh3.SetNameTab("H3", "Distribution after trigger");
    373371    filltp.SetNameTab("TrigPos", "TriggerPosition w.r.t the first photon");
    374     fillew.SetNameTab("EvtWidth", "Time between first and last photon hitting an APD");
     372    fillew.SetNameTab("EvtWidth", "Time between first and last photon hitting a detector");
    375373
    376374    MHPhotonEvent planeG(1);     // Get from MaxImpact
     
    387385    MFillH fillG(&planeG,   "MPhotonEvent", "FillGround");
    388386    MFillH fill0(&plane0,   "MirrorPlane0", "FillReflector");
    389     MFillH fill1(&plane1,   "MirrorPlane1", "FillCamShadow");
     387    //MFillH fill1(&plane1,   "MirrorPlane1", "FillCamShadow");
    390388    MFillH fill2(&plane2,   "MirrorPlane2", "FillCandidates");
    391389    MFillH fill3(&plane3,   "MirrorPlane3", "FillReflected");
    392390    MFillH fill4(&plane4,   "MirrorPlane4", "FillFocal");
    393391    MFillH fillF1(&planeF1, "MPhotonEvent", "FillCamera");
    394     MFillH fillF2(&planeF2, "MPhotonEvent", "FillAPDs");
     392    MFillH fillF2(&planeF2, "MPhotonEvent", "FillCones");
    395393    //MFillH fillP(&psf,      "MPhotonEvent", "FillPSF");
    396394
    397395    fillG.SetNameTab("Ground",     "Photon distribution at ground");
    398396    fill0.SetNameTab("Reflector",  "Photon distribution at reflector plane w/o camera shadow");
    399     fill1.SetNameTab("CamShadow",  "Photon distribution at reflector plane w/ camera shadow");
     397    //fill1.SetNameTab("CamShadow",  "Photon distribution at reflector plane w/ camera shadow");
    400398    fill2.SetNameTab("Candidates", "'Can hit' photon distribution at reflector plane w/ camera shadow");
    401399    fill3.SetNameTab("Reflected",  "Photon distribution after reflector projected to reflector plane");
    402400    fill4.SetNameTab("Focal",      "Photon distribution at focal plane");
    403401    fillF1.SetNameTab("Camera",    "Photon distribution which hit the detector");
    404     fillF2.SetNameTab("APDs",      "Photon distribution after cones");
     402    fillF2.SetNameTab("Cones",     "Photon distribution after cones");
    405403    //fillP.SetNameTab("PSF",        "Photon distribution after cones for all mirrors");
    406404
    407405    // -------------------------------------------------------------------
    408406
    409     const TString rule1(Form("s/cer([0-9]+)/%s\\/ref$1.root/", Esc(fPathOut).Data()));
    410     const TString rule2(Form("s/cer([0-9]+)/%s\\/sig$1.root/", Esc(fPathOut).Data()));
    411     const TString rule3(Form("s/cer([0-9]+)/%s\\/cam$1.root/", Esc(fPathOut).Data()));
     407    // FIXME: Pedestal and Calibration runs should get P and C
     408    const TString rule1(Form("s/cer([0-9]+)/%s\\/00$1_R_MonteCarlo.root/", Esc(fPathOut).Data()));
     409    const TString rule2(Form("s/cer([0-9]+)/%s\\/00$1_I_MonteCarlo.root/", Esc(fPathOut).Data()));
     410    const TString rule3(Form("s/cer([0-9]+)/%s\\/00$1_D_MonteCarlo.root/", Esc(fPathOut).Data()));
    412411
    413412    MWriteRootFile write3a( 2, rule3, fOverwrite?"RECREATE":"NEW", "Camera file");
     
    471470
    472471    MSimGeomCam simgeom;
    473     simgeom.SetNameGeomCam("GeomAPDs");
     472    simgeom.SetNameGeomCam("GeomCones");
    474473
    475474    MSimCalibrationSignal simcal;
    476     simcal.SetNameGeomCam("GeomAPDs");
     475    simcal.SetNameGeomCam("GeomCones");
    477476
    478477    //  Dark Current: 4MHz = 0.004 GHz
     
    484483//    simnsb.SetFreq(0.005, 0.004);    // 5MHz/cm^2, 4MHz
    485484    simnsb.SetFreq(0, 0.04);           // 40MHz fixed for each APD
    486     simnsb.SetNameGeomCam("GeomAPDs");
     485    simnsb.SetNameGeomCam("GeomCones");
    487486
    488487    // FIXME: How do we handle star-light? We need the rate but we also
     
    491490    MSimAPD simapd;
    492491    simapd.SetFreq(0.04); // Must be identical to MSimRanodmPhotons!!
    493     simapd.SetNameGeomCam("GeomAPDs");
     492    simapd.SetNameGeomCam("GeomCones");
    494493
    495494    MSimExcessNoise   simexcnoise;
     
    563562        {
    564563            tasks.AddToList(&fill0);
    565             tasks.AddToList(&fill1);
     564            //tasks.AddToList(&fill1);
    566565            tasks.AddToList(&fill2);
    567566            tasks.AddToList(&fill3);
     
    645644        return kFALSE;
    646645
     646    // FIXME: If pedestal file given use the values from this file
    647647    //-------------------------------------------
    648648
     
    652652
    653653    header.Print();
     654
     655    // FIXME: Display acceptance curves!
    654656
    655657    if (fDisplay)
     
    666668        shape.DrawClone()->SetBit(kCanDelete);
    667669
    668         if (header.IsDataRun() || header.IsPointRun())
     670        if (env0.GetCont() && (header.IsDataRun() || header.IsPointRun()))
    669671        {
    670672            c.cd(3);
     
    674676            gPad->SetGridy();
    675677            gROOT->SetSelectedPad(0);
    676             reflector.DrawClone("line")->SetBit(kCanDelete);
     678            static_cast<MReflector*>(env0.GetCont())->DrawClone("line")->SetBit(kCanDelete);
    677679
    678680        }
     
    680682        if (fCamera)
    681683        {
    682             if (dynamic_cast<MGeomCam*>(env1.GetCont()))
     684            if (env1.GetCont())
    683685            {
    684686                c.cd(2);
     
    696698            }
    697699
    698             if (dynamic_cast<MGeomCam*>(env2.GetCont()))
     700            if (env2.GetCont())
    699701            {
    700702                c.cd(4);
  • trunk/MagicSoft/Mars/mjobs/MSequence.cc

    r9318 r9328  
    416416        case kRoot: // mcdata
    417417            d += "rawfiles/";
     418            if (!fNight)
     419                *fLog << "WARNING - No Night-resource... path not supported." << endl;
    418420            d += fNight.GetStringFmt("%Y/%m/%d");
    419421            break;
     
    423425            break;
    424426        case kCalibrated:
    425             d += Form("callisto/%04d/%08d", fSequence/10000, fSequence);
     427            d += MString::Format("callisto/%04d/%08d", fSequence/10000, fSequence);
    426428            break;
    427429        case kImages:
    428             d += Form("star/%04d/%08d", fSequence/10000, fSequence);
     430            d += MString::Format("star/%04d/%08d", fSequence/10000, fSequence);
    429431            break;
    430432        }
     
    477479
    478480    // ------------- Create file name --------------
    479     TString n = night.GetStringFmt("%Y%m%d_");
     481    TString n;
     482
     483    if (night)
     484        n += night.GetStringFmt("%Y%m%d_");
    480485
    481486    // This is for MCs (FIXME!!!!)
    482487    if (run<0)
    483         n += Form("%08d", -run);
     488        n += MString::Format("%08d", -run);
    484489    else
    485490    {
    486491        if (tel>0)
    487             n += Form("M%d_", tel);
     492            n += MString::Format("M%d_", tel);
    488493
    489494        // R. DeLosReyes and T. Bretz
    490495        // Changes to read the DAQ numbering format. Changes takes place
    491496        // between runs 35487 and 00035488 (2004_08_30)
    492         n += Form(run>limit ? "%08d" : "%05d", run);
     497        n += MString::Format(run>limit ? "%08d" : "%05d", run);
    493498
    494499        if (tel>0)
    495             n += Form(".%03d", file);
     500            n += MString::Format(".%03d", file);
    496501    }
    497502
     
    876881    fSequence = (UInt_t)env.GetValue("Sequence", (Int_t)seq);
    877882
    878     const TString prefix = Form("Sequence%08d", fSequence);
     883    const TString prefix = MString::Format("Sequence%08d", fSequence);
    879884
    880885    fTelescope = GetEnvValue2(env, prefix, "Telescope",  1);
     
    890895
    891896    str = GetEnvValue2(env, prefix, "Night", "");
    892     if (str.IsNull())
    893         fNight = MTime();
    894     else
    895     {
    896         str += " 00:00:00";
    897         fNight.SetSqlDateTime(str);
    898     }
    899 
    900     fPeriod = fNight.GetMagicPeriod();
     897    SetNight(str);
    901898
    902899    fProject      = GetEnvValue2(env, prefix, "Project", "");
     
    11601157    while (p<pos+n)
    11611158    {
    1162         str += Form(" %d", f[p]);
     1159        str += MString::Format(" %d", f[p]);
    11631160
    11641161        if (p==pos+n-1)
     
    11711168
    11721169        if (i>1)
    1173             str += Form(":%d", f[p+i-1]);
     1170            str += MString::Format(":%d", f[p+i-1]);
    11741171
    11751172        p += i;
     
    12121209            return str;
    12131210
    1214         str += Form(" %d", r[p]);
     1211        str += MString::Format(" %d", r[p]);
    12151212        // p now points to the last entry which fits and
    12161213        // has a file number == 0
     
    12191216        // More tahn one found (i-1>1)
    12201217        str += i-1==1 ? " " : ":";
    1221         str += Form("%d", r[p]);
     1218        str += MString::Format("%d", r[p]);
    12221219
    12231220        // One step forward
     
    12941291                str += '\n';
    12951292                str += pre;
    1296                 str += Form("Run%08d:", r[pos]);
     1293                str += MString::Format("Run%08d:", r[pos]);
    12971294                str += GetNumSequence(pos, n, f);
    12981295            }
     
    13271324    const TString opt(o);
    13281325
    1329     const TString pre = opt.Contains("prefixed") ? Form("Sequence%08d.", fSequence) : "";
     1326    const TString pre = opt.Contains("prefixed") ? MString::Format("Sequence%08d.", fSequence) : "";
    13301327
    13311328    if (!IsValid())
     
    13451342    if (fMonteCarlo)
    13461343        out << pre << "MonteCarlo:     Yes" << endl;
    1347     if (fPeriod>=0)
     1344    if (fPeriod!=(UInt_t)-1)
    13481345        out << pre << "Period:         " << fPeriod << endl;
    13491346    if (fNight!=MTime())
     
    15131510{
    15141511    TString night(txt);
     1512
     1513    if (night.IsNull())
     1514    {
     1515        fNight  = MTime();
     1516        fPeriod = UInt_t(-1);
     1517        return;
     1518    }
     1519
    15151520    night += " 00:00:00";
    15161521    fNight.SetSqlDateTime(night);
     
    15741579            seq = "/magic/";
    15751580            if (ismc)
    1576             seq += "montecarlo/";
    1577             seq += Form("sequences/%04d/sequence%08d.txt", numseq/10000, numseq);
     1581                seq += "montecarlo/";
     1582            seq += MString::Format("sequences/%04d/sequence%08d.txt", numseq/10000, numseq);
    15781583            gLog << inf << "Inflated sequence file: " << seq << endl;
    15791584        }
Note: See TracChangeset for help on using the changeset viewer.