Changeset 17866


Ignore:
Timestamp:
05/16/14 11:51:28 (10 years ago)
Author:
tbretz
Message:
Added the possibility to combine all output files into a single output file.
Location:
trunk/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/ceres.cc

    r15049 r17866  
    6363    gLog << "   --ind=path                Input path of Corsika files if sequence used" << endl;
    6464    gLog << "                              [def=standard path in datacenter]" << endl;
     65    gLog << "   --outf=filename           Output filename. Combines all input files into" << endl;
     66    gLog << "                              one output file. (Note that the output file will" << endl;
     67    gLog << "                              contain only the headers corresponding to the" << endl;
     68    gLog << "                              first input file)" << endl;
    6569    gLog << "   --dev-null                Suppress output of files (for test purpose)" << endl;
    6670    gLog << "   --print-seq               Print Sequence information [sequence only]" << endl;
     
    167171    const TString kInpath     = arg.GetStringAndRemove("--ind=", "");
    168172    const TString kOutpath    = arg.GetStringAndRemove("--out=", ".");
     173    const TString kOutfile    = arg.GetStringAndRemove("--outf=", "");
    169174
    170175    const Int_t   kRunNumber  = arg.GetIntAndRemove("--run-number=", -1);
     
    343348        job.SetOverwrite(kOverwrite);
    344349        job.SetPathOut(kOutpath);
     350        job.SetFileOut(kOutfile);
    345351        job.SetNullOut(kNullOut);
    346352        job.SetForceMode(kForce);
  • trunk/Mars/mjobs/MJSimulation.cc

    r17855 r17866  
    233233{
    234234    // Common run headers
    235     write.AddContainer("MMcCorsikaRunHeader", "RunHeaders", kFALSE);
    236     write.AddContainer("MCorsikaRunHeader",   "RunHeaders", kFALSE);
    237     write.AddContainer("MRawRunHeader",       "RunHeaders");
    238     write.AddContainer("MGeomCam",            "RunHeaders");
    239     write.AddContainer("MMcRunHeader",        "RunHeaders");
     235    write.AddContainer("MMcCorsikaRunHeader", "RunHeaders", kFALSE, 1);
     236    write.AddContainer("MCorsikaRunHeader",   "RunHeaders", kFALSE, 1);
     237    write.AddContainer("MRawRunHeader",       "RunHeaders", kTRUE,  1);
     238    write.AddContainer("MGeomCam",            "RunHeaders", kTRUE,  1);
     239    write.AddContainer("MMcRunHeader",        "RunHeaders", kTRUE,  1);
    240240
    241241    // Common events
     
    584584    // -------------------------------------------------------------------
    585585
    586     const char *fmt = Form("s/cer([0-9]+)([0-9][0-9][0-9])/%s\\/%08d.$2_%%c_MonteCarlo$1.root/", Esc(fPathOut).Data(), header.GetRunNumber());
    587 
    588     const TString rule1(Form(fmt, 'R'));
    589     const TString rule2(Form(fmt, 'Y'));
    590     const TString rule4(Form(fmt, 'I'));
    591     TString rule3(Form(fmt, header.GetRunTypeChar()));
     586    if (!fFileOut.IsNull())
     587    {
     588        const Ssiz_t dot   = fFileOut.Last('.');
     589        const Ssiz_t slash = fFileOut.Last('/');
     590        if (dot>slash)
     591            fFileOut = fFileOut.Remove(dot);
     592    }
     593
     594    // -------------------------------------------------------------------
     595
     596    const char *fmt = fFileOut.IsNull() ?
     597        Form("s/cer([0-9]+)([0-9][0-9][0-9])/%s\\/%08d.$2%%s_MonteCarlo$1.root/", Esc(fPathOut).Data(), header.GetRunNumber()) :
     598        Form("%s/%s%%s.root", Esc(fPathOut).Data(), Esc(fFileOut).Data());
     599
     600    const TString rule1(Form(fmt, fFileOut.IsNull()?"_R":""));
     601    const TString rule2(Form(fmt, "_Y"));
     602    const TString rule4(Form(fmt, "_I"));
     603    TString rule3(Form(fmt, Form("_%c", header.GetRunTypeChar())));
    592604
    593605    MWriteRootFile write4a( 2, rule4, fOverwrite?"RECREATE":"NEW", "Star file");
     
    600612
    601613    if (fWriteFitsFile)
    602         rule3.ReplaceAll("$1.root/", "$1.fits/");
     614        rule3.ReplaceAll(".root", ".fits");
    603615
    604616    MWriteFitsFile write3af( 2, rule3, fOverwrite?"RECREATE":"NEW", "Camera file");
     
    631643
    632644    // Y: Dedicated file structure
    633     write2a.AddContainer("MPedPhotFromExtractorRndm", "RunHeaders"); // FIXME: Needed for the signal files to be display in MARS
     645    write2a.AddContainer("MPedPhotFromExtractorRndm", "RunHeaders", kTRUE, 1); // FIXME: Needed for the signal files to be display in MARS
    634646    write2a.AddContainer("MSignalCam", "Events");
    635647
    636648    // D: Dedicated file structure
    637     write3af.AddContainer("ElectronicNoise",  "RunHeaders");
    638     write3af.AddContainer("IntendedPulsePos", "RunHeaders");
     649    write3af.AddContainer("ElectronicNoise",  "RunHeaders", kTRUE, 1);
     650    write3af.AddContainer("IntendedPulsePos", "RunHeaders", kTRUE, 1);
    639651    write3af.AddContainer("MRawEvtData",      "Events");
    640652    write3af.AddContainer("MTruePhotonsPerPixelCont", "Events");
    641653    write3af.AddContainer("MPhotonEvent","Events");
    642654
    643     write3ar.AddContainer("ElectronicNoise",  "RunHeaders");
    644     write3ar.AddContainer("IntendedPulsePos", "RunHeaders");
     655    write3ar.AddContainer("ElectronicNoise",  "RunHeaders", kTRUE, 1);
     656    write3ar.AddContainer("IntendedPulsePos", "RunHeaders", kTRUE, 1);
    645657    write3ar.AddContainer("MRawEvtData",      "Events");
    646658    // It doesn't make much sene to write this information
  • trunk/Mars/mjobs/MJSimulation.h

    r17737 r17866  
    2929    Int_t  fRunNumber;      // 8 digits run number to be used for the file names
    3030
     31    TString fFileOut;       // Output file name if all runs should be combines
     32
    3133    Bool_t WriteResult(const MParList &plist, const MSequence &seq, Int_t run);
    3234    Bool_t CheckEnvLocal();
     
    4547    void SetMode(Int_t mode) { fOperationMode = mode; }
    4648    void SetWriteFitsFile(Bool_t fits) { fWriteFitsFile = fits; }
     49    void SetFileOut(const char *file="") { fFileOut = file; }
    4750
    4851    void SetRunNumber(Int_t n=-1) { fRunNumber = n%100000000; }
Note: See TracChangeset for help on using the changeset viewer.