Ignore:
Timestamp:
08/24/04 14:51:17 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r4695 r4722  
    9191MJPedestal::MJPedestal(const char *name, const char *title)
    9292    : fEnv(0), fRuns(0), fSequence(0), fExtractor(NULL), fDisplayType(kNormalDisplay),
    93       fDataCheck(kFALSE), fUseData(kFALSE), fMaxEvents(0)
     93      fDataCheck(kFALSE), fUseData(kFALSE), fOverwrite(kFALSE), fMaxEvents(0)
    9494{
    9595    fName  = name  ? name  : "MJPedestal";
     
    451451    *fLog << inf << "Writing to file: " << oname << endl;
    452452
    453     TFile file(oname, "RECREATE");
     453    TFile file(oname, fOverwrite?"RECREATE":"NEW", "File created by MJPedestal", 9);
     454    if (!file.IsOpen())
     455    {
     456        *fLog << err << "ERROR - Couldn't open file " << oname << " for writing..." << endl;
     457        return kFALSE;
     458    }
    454459
    455460    if (fDisplay && fDisplay->Write()<=0)
     
    481486}
    482487
     488// --------------------------------------------------------------------------
     489//
     490// Set the path from which the sequence files are read
     491//
     492void MJPedestal::SetInputPath(const char *path)
     493{
     494    fInputPath = path;
     495    if (fInputPath.EndsWith("/"))
     496        fInputPath = fInputPath(0, fInputPath.Length()-1);
     497}
     498
    483499void MJPedestal::SetEnv(const char *env)
    484500{
     
    496512}
    497513
     514// --------------------------------------------------------------------------
     515//
     516// MJPedestsl allows to setup several option by a resource file:
     517//   MJPedestal.OutputPath: path
     518//   MJPedestal.MaxEvents: 1000
     519//   MJPedestal.AllowOverwrite: yes, no
     520//   MJPedestal.UseData: yes, no (use DatRuns from sequence instead of PedRuns)
     521//
     522// For more details see the class description and the corresponding Getters
     523//
    498524void MJPedestal::CheckEnv()
    499525{
     
    508534    }
    509535
    510     fMaxEvents = fEnv->GetValue("MJPedestal.MaxEvents", fMaxEvents);
    511     fUseData   = fEnv->GetValue("MJPedestal.UseData",   fUseData);
     536    SetMaxEvents(fEnv->GetValue("MJPedestal.MaxEvents", fMaxEvents));
     537    SetOverwrite(fEnv->GetValue("MJPedestal.AllowOverwrite", fOverwrite));
     538
     539    fUseData = fEnv->GetValue("MJPedestal.UseData", fUseData);
    512540}
    513541
     
    548576    MDirIter iter;
    549577    if (fSequence)
    550         fUseData ? fSequence->SetupDatRuns(iter) : fSequence->SetupPedRuns(iter);
     578    {
     579        const Int_t n = fUseData ? fSequence->SetupDatRuns(iter, fInputPath) : fSequence->SetupPedRuns(iter, fInputPath);
     580        if (n==0)
     581        {
     582            *fLog << err << "ERROR - No input files of sequence found!" << endl;
     583            return kFALSE;
     584        }
     585    }
    551586
    552587    if (fDataCheck)
Note: See TracChangeset for help on using the changeset viewer.