Changeset 19719 for trunk/Mars/hawc


Ignore:
Timestamp:
10/05/19 16:53:52 (5 years ago)
Author:
tbretz
Message:
Some updates, in particular allowing to process more than one file at a time.
Location:
trunk/Mars/hawc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/hawc/callisto.C

    r19704 r19719  
    6666    // Range in which the pulse extraction searches for the
    6767    // pulse (in samples).
    68     const int first_slice = 100;
    69     const int last_slice  = 500;
     68    const int first_slice = 290;
     69    const int last_slice  = 350;
    7070
    7171    // Calibration constant (for the moment a single constant to
    7272    // convert the extracted charge to photo-electrons)
    73     double scale = 0.2;
     73    double scale = 1./22.553;//0.2;
    7474
    7575    // ------------------------------------------------------
     
    179179    // ------------------ Setup the tasks ---------------
    180180
     181    MDirIter files(datafile);
     182
    181183    // Instantiate the reading task
    182184    // You can use
    183185    //    read5.AddFiles("*.fits.fz")
    184186    // for example to read more than one file at once
    185     MRawFitsRead read5(datafile);
     187    MRawFitsRead read5;
     188    read5.AddFiles(files);
    186189    if (mmap)
    187190        read5.LoadMap(mmap);
     
    278281    //MWriteRootFile write5(2, fname, "RECREATE", "Calibrated Data");
    279282
     283    /*
    280284    // Convert the name of the input file to the name of the output file
    281285    TString fname = gSystem->ConcatFileName(outpath, gSystem->BaseName(datafile));
     
    286290
    287291    gSystem->ExpandPathName(fname);
     292    */
     293
     294    const TString rule(Form("s/(([0-9]+_)?[0-9.]+)_[PCD]_(.*)([.]fits)$/%s\\/$1_Y_$3.root/",
     295                            MJob:: Esc(outpath).Data()));
    288296
    289297    // Instantitate the writing task and setup the writing
    290     MWriteRootFile write5(fname, "RECREATE", "Calibrated Data", 2);
     298    MWriteRootFile write5(2, rule, "RECREATE", "Calibrated Data");
    291299    write5.AddContainer("MSignalCam",      "Events");
    292300    write5.AddContainer("MRawEvtHeader",   "Events");
     
    340348    // ============================================================
    341349
    342     // Check if the output file is still accessible from root
    343     TFile *ofile = (TFile*)gROOT->GetListOfFiles()->FindObject(fname);
    344     cout << ofile << endl;
    345     if (!ofile || !ofile->IsOpen() || ofile->IsZombie())
    346     {
    347         gLog << err << "File " << fname << " not found" << endl;
    348         return 20;
    349     }
     350    TString fname = write5.GetFileName();
     351    fname.ReplaceAll(".root", "-display.root");
    350352
    351353    // Write the status display to the file
     
    355357    d->SetTitle(title, kFALSE);
    356358
    357     ofile->cd();
    358     d->Write();
     359    d->SaveAsRoot(fname);
    359360
    360361    return 0;
  • trunk/Mars/hawc/star.C

    r19705 r19719  
    9494    loop.SetParList(&plist2);
    9595
     96    MDirIter files(datafile);
     97
    9698    // Instantiate the reading task
    9799    // You can use
     
    100102    MReadMarsFile read("Events");
    101103    read.DisableAutoScheme();
    102     read.AddFile(datafile);
     104    read.AddFiles(files);
    103105
    104106    // Instantiate the task which takes care of the size of all containers
     
    116118    MImgCleanTime clean;
    117119    clean.SetMinCount(0);
    118     clean.SetMinSize(50);
     120    clean.SetMinSize(55);
    119121    clean.SetDeltaT(17.5);
    120122
     
    173175    //MWriteRootFile write5(2, fname, "RECREATE", "Image parameters");
    174176
     177    const TString rule(Form("s/(([0-9]+_)?[0-9.]+)_Y_(.*)([.]root)$/%s\\/$1_Y_$3.root/",
     178                            MJob:: Esc(outpath).Data()));
     179
    175180    // Instantiate writing the file
    176     MWriteRootFile write(fname, "RECREATE", "Image parameters", 2);
     181    MWriteRootFile write(2, rule, "RECREATE", "Image parameters");
    177182    write.AddContainer("MTime",           "Events");
    178183    write.AddContainer("MHillas",         "Events");
     
    224229    // ============================================================
    225230
    226     // Check if the output file is still accessible from root
    227     TFile *ofile = (TFile*)gROOT->GetListOfFiles()->FindObject(fname);
    228     if (!ofile || !ofile->IsOpen() || ofile->IsZombie())
    229     {
    230         gLog << err << "File " << fname << " not found" << endl;
    231         return 20;
    232     }
     231    TString fname = write.GetFileName();
     232    fname.ReplaceAll(".root", "-display.root");
    233233
    234234    // Write the status display to the file
     
    238238    d->SetTitle(title, kFALSE);
    239239
    240     ofile->cd();
    241     d->Write();
     240    d->SaveAsRoot(fname);
    242241
    243242    return 0;
Note: See TracChangeset for help on using the changeset viewer.