Changeset 8989 for trunk


Ignore:
Timestamp:
07/01/08 15:04:01 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r8988 r8989  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20
     21 2008/07/01 Thomas Bretz
     22
     23   * ganymed.cc:
     24     - removed the checks for the accessability of the files. They
     25       are checked in the corresponding classes instead
     26
     27   * sponde.cc:
     28     - display only the base name of the ganymed file, not the full path
     29
     30   * mbase/MMath.[h,cc]:
     31     - added a new member function ErrorExc
     32     - Let SignificanceExc (former SignificanceLiMaExc) use ErrorExc
     33
     34   * mhflux/MAlphaFitter.[h,cc]:
     35     - replaced fSignificanceExc by fErrorExcess
     36     - calculate the error instead of the significance (otherwise we
     37       get infinity at 0)
     38     - also store a negative number of excess events
     39     - replaced all -1 in ProjectionZ calls by the histogram limits
     40       (including under- and overflows) This is necessary to get
     41       root 5.20/00 working
     42     - increased class version number according to the changes
     43
     44   * mjobs/MDataSet.[h,cc], mjobs/MSequence.[h,cc]:
     45     - removed wrong usage of fName and fTitle, introduced new data
     46       members instead
     47     - initialize fName and fTitle in the constructors correctly
     48     - always store the full qualified path name
     49     - introduced new member functions GetBaseName and GetFilePath
     50     - give the ostream as an argument to Print
     51     - added new member function WriteFile to directly Print to
     52       an fostream
     53     - do not print empty values in Print
     54     - increased class version number accordingly
     55     - removed GetName and GetRcName accordingly
     56
     57   * mjobs/MDataSet.cc:
     58     - set the dataset number to an invalid status if the file could
     59       not be accessed
     60
     61   * mjobs/MJCut.cc:
     62     - replaced GetName for the dataset by GetBaseName
     63     - make sure the summary file is not created if not requested
     64     - do not use pointers to MWriteRootFile to make sure the instances
     65       always get deleted
     66
     67   * mjobs/MJSpectrum.cc:
     68     - fixed a bug in the check for the existence of the excess time
     69     - replaced GetName for the dataset by GetBaseName
     70     - Write the full path name to the ganymed.root into the file
     71     - fixed typos in determine
     72
     73   * mpointing/MPointingDevCalc.cc:
     74     - initialize fNsb* members also in PreProcess as correctly
     75       suggested by valgrind
     76
     77
    2078
    2179 2008/06/30 Thomas Bretz
  • trunk/MagicSoft/Mars/ganymed.cc

    r8986 r8989  
    207207    }
    208208
    209     gSystem->ExpandPathName(kSequences);
    210 
    211     if (gSystem->AccessPathName(kSequences, kFileExists))
    212     {
    213         gLog << err << "Sorry, dataset file '" << kSequences << "' doesn't exist." << endl;
    214         return 2;
    215     }
    216 
    217     if (gSystem->AccessPathName(kConfig, kFileExists))
    218     {
    219         gLog << err << "Sorry, config file '" << kConfig << "' doesn't exist." << endl;
    220         return 2;
    221     }
    222 
    223209    if (kDebugMem)
    224210        TObject::SetObjectStat(kTRUE);
     
    228214    //
    229215    MDataSet seq(kSequences, (UInt_t)kNumDataset, kPathSequences, kPathDataFiles);
     216    if (!seq.IsValid())
     217    {
     218        gLog << err << "ERROR - Reading dataset file " << kSequences << "." << endl;
     219        return 0xfc;
     220    }
    230221    if (!seq.IsMonteCarlo())
    231222        seq.SetMonteCarlo(kIsMc);
  • trunk/MagicSoft/Mars/mbase/MMath.cc

    r8988 r8989  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MMath.cc,v 1.40 2008-06-30 09:36:35 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MMath.cc,v 1.41 2008-07-01 14:03:58 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    172172//
    173173// Return Li/Ma (5) for the error of the excess, under the assumption that
    174 // the existance of a signal is already known.
    175 //
    176 Double_t MMath::SignificanceLiMaExc(Double_t s, Double_t b, Double_t alpha)
    177 {
    178     Double_t Ns = s - alpha*b;
    179     Double_t sN = s + alpha*alpha*b;
    180 
    181     if (Ns<0 || sN<0)
     174// the existance of a signal is already known. (basically signal/error
     175// calculated by error propagation)
     176//
     177Double_t MMath::SignificanceExc(Double_t s, Double_t b, Double_t alpha)
     178{
     179    const Double_t error = ErrorExc(s, b, alpha);
     180    if (error==0)
    182181        return 0;
    183182
    184     if (Ns==0 && sN==0)
    185         return 0;
    186 
    187     return Ns/TMath::Sqrt(sN);
     183    const Double_t Ns = s - alpha*b;
     184
     185    return Ns/error;
     186}
     187
     188// --------------------------------------------------------------------------
     189//
     190// Calculate the error of s-alpha*b by error propagation
     191//
     192Double_t MMath::ErrorExc(Double_t s, Double_t b, Double_t alpha)
     193{
     194    const Double_t sN = s + alpha*alpha*b;
     195    return sN<0 ? 0 : TMath::Sqrt(sN);
    188196}
    189197
  • trunk/MagicSoft/Mars/mbase/MMath.h

    r8978 r8989  
    3737    Double_t SignificanceLiMa(Double_t s, Double_t b, Double_t alpha=1);
    3838    Double_t SignificanceLiMaSigned(Double_t s, Double_t b, Double_t alpha=1);
    39     Double_t SignificanceLiMaExc(Double_t s, Double_t b, Double_t alpha=1);
     39    Double_t SignificanceExc(Double_t s, Double_t b, Double_t alpha=1);
     40    Double_t ErrorExc(Double_t s, Double_t b, Double_t alpha=1);
    4041
    4142    void ReducePrecision(Float_t &val);
  • trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc

    r8780 r8989  
    1818!   Author(s): Thomas Bretz, 3/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2004
     20!   Copyright: MAGIC Software Development, 2000-2008
    2121!
    2222!
     
    4242//  + TArrayD fErrors;  // errors of coefficients
    4343//
     44// Version 4:
     45// ----------
     46//  + Double_t fErrorExcess;
     47//  - Double_t fSignificanceExc;
     48//
    4449//
    4550//////////////////////////////////////////////////////////////////////////////
     
    6873{
    6974    fSignificance=0;
    70     fSignificanceExc=0;
     75    fErrorExcess=0;
    7176    fEventsExcess=0;
    7277    fEventsSignal=0;
     
    168173    fEventsExcess     = fEventsSignal-fEventsBackground;
    169174    fSignificance     = MMath::SignificanceLiMaSigned(fEventsSignal, fEventsBackground);
    170     fSignificanceExc  = MMath::SignificanceLiMaExc(fEventsSignal, fEventsBackground);
     175    fErrorExcess      = MMath::ErrorExc(fEventsSignal, fEventsBackground);
    171176
    172177    // !Finitite includes IsNaN
    173178    if (!TMath::Finite(fSignificance))
    174179        fSignificance=0;
    175 
    176     if (fEventsExcess<0)
    177         fEventsExcess=0;
    178180}
    179181
     
    282284    const Int_t bin = hon.GetXaxis()->FindFixBin(fSigInt*0.999);
    283285
    284 
    285286    MAlphaFitter fit(*this);
    286287    fit.EnableBackgroundFit();
     
    290291    // off-source in the off-source region and the on-data in the source-region
    291292    TH1D h(hof);
     293    h.SetDirectory(0);
    292294    h.Add(&hon);
    293295    h.Scale(0.5);
     
    342344{
    343345    TH1D h(hon);
     346    h.SetDirectory(0);
    344347    h.Add(&hof, -1); // substracts also number of entries!
    345348    h.SetEntries(hon.GetEntries());
     
    354357    fCoefficients = fit.GetCoefficients();
    355358    fErrors       = fit.GetErrors();
    356 
    357359
    358360    // ----------------------------------------------------------------------------
     
    372374    fScaleFactor      = alpha;
    373375    fSignificance     = MMath::SignificanceLiMaSigned(fEventsSignal, fEventsBackground/alpha, alpha);
    374     fSignificanceExc  = MMath::SignificanceLiMaExc(fEventsSignal, fEventsBackground/alpha, alpha);
     376    fErrorExcess      = MMath::ErrorExc(fEventsSignal, fEventsBackground/alpha, alpha);
    375377
    376378    // !Finitite includes IsNaN
    377379    if (!TMath::Finite(fSignificance))
    378380        fSignificance=0;
    379     if (fEventsExcess<0)
    380         fEventsExcess=0;
    381381
    382382    return kTRUE;
     
    461461    // Result
    462462    f.fSignificance     = fSignificance;
    463     f.fSignificanceExc  = fSignificanceExc;
     463    f.fErrorExcess      = fErrorExcess;
    464464    f.fEventsExcess     = fEventsExcess;
    465465    f.fEventsSignal     = fEventsSignal;
     
    526526{
    527527    const TString name(Form("TempAlphaEnergy%06d", gRandom->Integer(1000000)));
    528     TH1D *h = hon.ProjectionZ(name, -1, -1, bin, bin, "E");
     528    TH1D *h = hon.ProjectionZ(name, 0, hon.GetNbinsX()+1, bin, bin, "E");
    529529    h->SetDirectory(0);
    530530
     
    537537{
    538538    const TString name(Form("TempAlphaTheta%06d", gRandom->Integer(1000000)));
    539     TH1D *h = hon.ProjectionZ(name, bin, bin, -1, -1, "E");
     539    TH1D *h = hon.ProjectionZ(name, bin, bin, 0, hon.GetNbinsY()+1, "E");
    540540    h->SetDirectory(0);
    541541
     
    563563{
    564564    const TString name(Form("TempAlpha%06d", gRandom->Integer(1000000)));
    565     TH1D *h = hon.ProjectionZ(name, -1, -1, -1, -1, "E");
     565    TH1D *h = hon.ProjectionZ(name, 0, hon.GetNbinsX()+1, 0, hon.GetNbinsY()+1, "E");
    566566    h->SetDirectory(0);
    567567
     
    576576    const TString name0(Form("TempAlpha%06d_off", gRandom->Integer(1000000)));
    577577
    578     TH1D *h1 = hon.ProjectionZ(name1, -1, -1, bin, bin, "E");
    579     TH1D *h0 = hof.ProjectionZ(name0, -1, -1, bin, bin, "E");
     578    TH1D *h1 = hon.ProjectionZ(name1, 0, hon.GetNbinsX()+1, bin, bin, "E");
     579    TH1D *h0 = hof.ProjectionZ(name0, 0, hof.GetNbinsX()+1, bin, bin, "E");
    580580    h1->SetDirectory(0);
    581581    h0->SetDirectory(0);
     
    594594    const TString name0(Form("TempAlpha%06d_off", gRandom->Integer(1000000)));
    595595
    596     TH1D *h1 = hon.ProjectionZ(name1, bin, bin, -1, -1, "E");
    597     TH1D *h0 = hof.ProjectionZ(name0, bin, bin, -1, -1, "E");
     596    TH1D *h1 = hon.ProjectionZ(name1, bin, bin, 0, hon.GetNbinsY()+1, "E");
     597    TH1D *h0 = hof.ProjectionZ(name0, bin, bin, 0, hof.GetNbinsY()+1, "E");
    598598    h1->SetDirectory(0);
    599599    h0->SetDirectory(0);
     
    636636    const TString name0(Form("TempAlpha%06d_off", gRandom->Integer(1000000)));
    637637
    638     TH1D *h1 = hon.ProjectionZ(name1, -1, -1, -1, -1, "E");
    639     TH1D *h0 = hof.ProjectionZ(name0, -1, -1, -1, -1, "E");
     638    TH1D *h1 = hon.ProjectionZ(name1, 0, hon.GetNbinsX()+1, 0, hon.GetNbinsY()+1, "E");
     639    TH1D *h0 = hof.ProjectionZ(name0, 0, hof.GetNbinsX()+1, 0, hof.GetNbinsY()+1, "E");
    640640    h1->SetDirectory(0);
    641641    h0->SetDirectory(0);
     
    654654    const TString name0(Form("TempAlpha%06d_off", gRandom->Integer(1000000)));
    655655
    656     TH1D *h1 = hon.ProjectionZ(name1, -1, -1, bin, bin, "E");
    657     TH1D *h0 = hof.ProjectionZ(name0, -1, -1, bin, bin, "E");
     656    TH1D *h1 = hon.ProjectionZ(name1, 0, hon.GetNbinsX()+1, bin, bin, "E");
     657    TH1D *h0 = hof.ProjectionZ(name0, 0, hof.GetNbinsX()+1, bin, bin, "E");
    658658    h1->SetDirectory(0);
    659659    h0->SetDirectory(0);
  • trunk/MagicSoft/Mars/mhflux/MAlphaFitter.h

    r8780 r8989  
    5656    // Result
    5757    Double_t fSignificance;     // significance of an unknown signal (Li/Ma 17)
    58     Double_t fSignificanceExc;  // significance of a known excess    (Li/Ma 5)
     58    Double_t fErrorExcess;      // Simple error propagation
    5959    Double_t fEventsExcess;     // calculated number of excess events (signal-bg)
    6060    Double_t fEventsSignal;     // calculated number of signal events
     
    179179
    180180    Double_t GetSignificance() const       { return fSignificance; }
    181     Double_t GetSignificanceExc() const    { return fSignificanceExc; }
     181    Double_t GetErrorExcess() const        { return fErrorExcess; }
    182182    Double_t GetChiSqSignal() const        { return fChiSqSignal; }
    183183    Double_t GetChiSqBg() const            { return fChiSqBg; }
     
    253253    Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
    254254
    255     ClassDef(MAlphaFitter, 3)
     255    ClassDef(MAlphaFitter, 4)
    256256};
    257257
  • trunk/MagicSoft/Mars/mjobs/MDataSet.cc

    r8895 r8989  
    1818!   Author(s): Thomas Bretz, 1/2005 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2004-2007
     20!   Copyright: MAGIC Software Development, 2004-2008
    2121!
    2222!
     
    177177//
    178178//
     179// ===========================================================================
     180//
    179181// ToDO:
    180182//   * Default paths could be moved into the global .rootrc
    181183//
     184// ===========================================================================
     185//
     186//
     187// Class Version 3:
     188// ----------------
     189//  + fFileName
     190//  + fDataSet
    182191//
    183192// Class Version 2:
     193// ----------------
    184194//  + fMonteCarlo
    185195//  + fWobbleMode
     
    297307
    298308        // FIXME: The sequence number from the sequence file is assigned!!!
    299         MSequence *seq = new MSequence(useds?fName:name, dir, num[i]);
     309        MSequence *seq = new MSequence(useds?fFileName:name, dir, num[i]);
    300310        seq->ExcludeRuns(excl);
    301311
     
    354364void MDataSet::Init(const char *fname, const UInt_t num, TString sequences, TString &data)
    355365{
     366    fName  = "MDataSet";
     367    fTitle = "DataSet file";
     368
    356369    // Store given file name as name
    357     fName = fname;
     370    fFileName = fname;
    358371
    359372    // Delete the stored Sequences automatically at destruction
     
    361374    fSequencesOff.SetOwner();
    362375
     376    // Expand the file name (eg $MARS or ~ are expanded)
     377    gSystem->ExpandPathName(fFileName);
     378
     379    // Check its accessibility
     380    const Bool_t access = !gSystem->AccessPathName(fFileName, kFileExists);
     381    if (!access)
     382    {
     383        gLog << err << "ERROR - Dataset file " << fname << " not accessible!" << endl;
     384        fNumAnalysis = (UInt_t)-1;
     385        return;
     386    }
     387
    363388    // Determin the prefix to access this resource
    364389    const TString prefix = num==(UInt_t)-1 ? "" : Form("%d", num);
    365390
    366     // Expand the file name (eg $MARS or ~ are expanded)
    367     TString expname(fname);
    368     gSystem->ExpandPathName(expname);
    369 
    370     // Check its accessibility
    371     const Bool_t access = !gSystem->AccessPathName(expname, kFileExists);
    372     if (!access)
    373         gLog << err << "ERROR - Dataset file " << expname << " not accessible!" << endl;
    374 
    375391    // Open and read the file
    376     MEnv env(expname);
     392    MEnv env(fFileName);
    377393
    378394    // Get analysis number and name
    379395    fNumAnalysis = GetEnvValue2(env, prefix, "AnalysisNumber", (Int_t)num);
    380     fTitle       = GetEnvValue2(env, prefix, "Name", expname);
     396    fDataSet     = GetEnvValue2(env, prefix, "Name", GetBaseName());
    381397
    382398    // Get sequences from file
     
    443459//---------------------------------------------------------------------------
    444460//
    445 // Make sure that the name used for writing doesn't contain a full path
    446 //
    447 const char *MDataSet::GetName() const
    448 {
    449     const char *pos = strrchr(GetRcName(), '/');
    450     return pos>0 ? pos+1 : GetRcName();
     461// Return the name of the file
     462//
     463const char *MDataSet::GetBaseName() const
     464{
     465    return gSystem->BaseName(fFileName);
     466}
     467
     468//---------------------------------------------------------------------------
     469//
     470// Return the directory of the file
     471//
     472const char *MDataSet::GetFilePath() const
     473{
     474    return gSystem->DirName(fFileName);
    451475}
    452476
     
    456480// Return '+' if both can be accessed, '-' otherwise.
    457481//
    458 void MDataSet::PrintFile(const MSequence &seq)
     482void MDataSet::PrintFile(ostream &out, const MSequence &seq)
    459483{
    460484    const Char_t access =
     
    462486        !gSystem->AccessPathName(seq.GetDataPath(), kFileExists) ? '+' : '-';
    463487
    464     gLog << "#  " << access << " " << seq.GetFileName() << " <" << seq.GetDataPath() << ">" << endl;
     488    out << "#  " << access << " " << seq.GetFileName() << " <" << seq.GetDataPath() << ">" << endl;
    465489}
    466490
     
    469493// Helper to print a seqeunce in Print()
    470494//
    471 void MDataSet::PrintSeq(const MSequence &seq) const
    472 {
    473     const Bool_t useds = seq.GetFileName()==fName;
    474 
    475     gLog << "Sequence" << Form("%08d", seq.GetSequence()) << ".File:   " << (useds?"-":seq.GetFileName()) << endl;
    476     gLog << "Sequence" << Form("%08d", seq.GetSequence()) << ".Dir:    " << seq.GetDataPath() << endl;
     495void MDataSet::PrintSeq(ostream &out, const MSequence &seq) const
     496{
     497    const Bool_t useds = seq.GetFileName()==fFileName;
     498
     499    out << "Sequence" << Form("%08d", seq.GetSequence()) << ".File:   " << (useds?"-":seq.GetFileName()) << endl;
     500    out << "Sequence" << Form("%08d", seq.GetSequence()) << ".Dir:    " << seq.GetDataPath() << endl;
    477501    if (!useds && seq.GetNumExclRuns()>0)
    478         gLog << "Sequence" << Form("%08d", seq.GetSequence()) << ".Exclude: " << seq.GetExcludedRuns() << endl;
     502        out << "Sequence" << Form("%08d", seq.GetSequence()) << ".Exclude: " << seq.GetExcludedRuns() << endl;
    479503
    480504    if (useds)
    481505    {
    482         gLog << endl;
    483         seq.Print("prefixed");
    484         gLog << endl << "# ---" << endl;
    485     }
    486 }
    487 
    488 
    489 // --------------------------------------------------------------------------
    490 //
    491 // Print the contents of the sequence
    492 //
    493 void MDataSet::Print(Option_t *o) const
    494 {
    495     gLog << all;
     506        out << endl;
     507        seq.Print(out, "prefixed");
     508        out << endl << "# ---" << endl;
     509    }
     510}
     511
     512// --------------------------------------------------------------------------
     513//
     514// Print the contents of the dataset to the ostream out
     515//
     516void MDataSet::Print(ostream &out, Option_t *o) const
     517{
    496518    if (!IsValid())
    497519    {
    498         gLog << "Dataset: " << fName << " <invalid - no analysis number available>" << endl;
     520        out << "Dataset: " << fFileName << " <invalid - no analysis number available>" << endl;
    499521        return;
    500522    }
    501     gLog << "# Path: " << GetRcName() << endl;
    502     gLog << "# Name: " << GetName() << endl;
    503     gLog << endl;
    504     gLog << "AnalysisNumber: " << fNumAnalysis << endl << endl;
    505 
    506     if (!fTitle.IsNull())
    507         gLog << "Name: " << fTitle << endl << endl;
    508 
    509     gLog << "SequencesOn:   ";
     523    out << "# Path: " << GetFilePath() << endl;
     524    out << "# Name: " << GetBaseName() << endl;
     525    out << endl;
     526    out << "AnalysisNumber: " << fNumAnalysis << endl << endl;
     527
     528    if (!fDataSet.IsNull())
     529        out << "Name: " << fDataSet << endl << endl;
     530
     531    out << "SequencesOn:   ";
    510532    for (int i=0; i<fNumSequencesOn.GetSize(); i++)
    511         gLog << " " << fNumSequencesOn[i];
    512     gLog << endl;
    513     gLog << "SequencesOff:  ";
    514     for (int i=0; i<fNumSequencesOff.GetSize(); i++)
    515         gLog << " " << fNumSequencesOff[i];
    516     gLog << endl << endl;
    517 
    518     gLog << "SourceName: " << fNameSource << endl;
    519     gLog << "Catalog: " << fCatalog << endl;
    520 
    521     gLog << "WobbleMode: " << (fWobbleMode?"Yes":"No") << endl << endl;
    522     gLog << "MonteCarlo: " << (fMonteCarlo?"Yes":"No") << endl << endl;
    523 
    524     gLog << "Comment: " << fComment << endl;
     533        out << " " << fNumSequencesOn[i];
     534    out << endl;
     535    if (fNumSequencesOff.GetSize()>0)
     536    {
     537        out << "SequencesOff:  ";
     538        for (int i=0; i<fNumSequencesOff.GetSize(); i++)
     539            out << " " << fNumSequencesOff[i];
     540        out << endl;
     541    }
     542
     543    out << endl;
     544    if (!fNameSource.IsNull())
     545        out << "SourceName: " << fNameSource << endl;
     546    out << "Catalog: " << fCatalog << endl;
     547
     548    out << "WobbleMode: " << (fWobbleMode?"Yes":"No") << endl << endl;
     549    out << "MonteCarlo: " << (fMonteCarlo?"Yes":"No") << endl << endl;
     550
     551    if (!fComment.IsNull())
     552        out << "Comment: " << fComment << endl;
    525553
    526554    if (fSequencesOn.GetEntries()>0)
    527         gLog << endl;
     555        out << endl;
    528556
    529557    // FIXME: If file==fName --> print Sequence0000.content
     
    533561    MSequence *seq=0;
    534562    while ((seq=(MSequence*)NextOn()))
    535         PrintSeq(*seq);
     563        PrintSeq(out, *seq);
    536564    if (fSequencesOff.GetEntries()>0)
    537         gLog << endl;
     565        out << endl;
    538566    while ((seq=(MSequence*)NextOff()))
    539         PrintSeq(*seq);
     567        PrintSeq(out, *seq);
    540568
    541569    if (TString(o).Contains("files", TString::kIgnoreCase))
    542570    {
    543         gLog << endl;
    544         gLog << "# On-Data Files:" << endl;
     571        out << endl;
     572        out << "# On-Data Files:" << endl;
    545573        NextOn.Reset();
    546574        while ((seq=(MSequence*)NextOn()))
    547             PrintFile(*seq);
    548 
    549         gLog << endl;
    550         gLog << "# Off-Data Files:" << endl;
     575            PrintFile(out, *seq);
     576
     577        out << endl;
     578        out << "# Off-Data Files:" << endl;
    551579        NextOff.Reset();
    552580        while ((seq=(MSequence*)NextOff()))
    553             PrintFile(*seq);
     581            PrintFile(out, *seq);
    554582
    555583        return;
    556584    }
     585}
     586
     587// --------------------------------------------------------------------------
     588//
     589// Print the contents of the dataset to the gLog stream
     590//
     591void MDataSet::Print(Option_t *o) const
     592{
     593    gLog << all;
     594    Print(gLog, o);
     595}
     596
     597// --------------------------------------------------------------------------
     598//
     599// Print the contents of the dataset to the file with name filename
     600//
     601void MDataSet::WriteFile(const char *name, const Option_t *o) const
     602{
     603    ofstream fout(name);
     604    if (!fout)
     605    {
     606        gLog << err << "Cannot open file " << name << ": ";
     607        gLog << strerror(errno) << endl;
     608        return;
     609    }
     610
     611    Print(fout, o);
    557612}
    558613
     
    755810}
    756811
     812/*
    757813// --------------------------------------------------------------------------
    758814//
     
    786842    }
    787843}
     844*/
  • trunk/MagicSoft/Mars/mjobs/MDataSet.h

    r8888 r8989  
    2121private:
    2222    static const TString fgCatalog; //! Default Catalog path
     23
     24    TString fFileName;        // File name to original file (MParContainer::fName is not streamed)
     25    TString fDataSet;         // Name of the dataset given by the user
    2326
    2427    UInt_t  fNumAnalysis;     // Analysis number (artificial)
     
    4548    void ResolveSequences(const TEnv &env, const TString &prefix, const TArrayI &num, TList &list/*, const TString &sequences, const TString &data*/) const;
    4649    Bool_t GetWobbleMode(const TEnv &env, const TString &prefix) const;
    47     static void PrintFile(const MSequence &obj);
    48     void PrintSeq(const MSequence &seq) const;
     50    static void PrintFile(ostream &out, const MSequence &obj);
     51    void PrintSeq(ostream &out, const MSequence &seq) const;
    4952
    5053    // Directory and file handling
    51     void ReplaceDir(TList &list, const TString &old, const TString &news) const;
    52     void ReplaceFile(TList &list, const TString &old, const TString &news) const;
     54    //void ReplaceDir(TList &list, const TString &old, const TString &news) const;
     55    //void ReplaceFile(TList &list, const TString &old, const TString &news) const;
    5356
    5457    void SetupDefaultPath(TString &path, const TString &def) const
     
    7275
    7376public:
    74     MDataSet() : fNumAnalysis((UInt_t)-1) { }
     77    MDataSet() : fNumAnalysis((UInt_t)-1)
     78    {
     79        fName  = "MDataSet";
     80        fTitle = "DataSet file";
     81    }
    7582    MDataSet(const char *fname, TString sequences="", TString data="");
    7683    MDataSet(const char *fname, Int_t num, TString sequences="", TString data="");
    7784
    78     const char *GetName() const;
    79     const char *GetRcName() const { return fName; }
     85    const char    *GetBaseName() const;
     86    const char    *GetFilePath() const;
     87    const TString &GetFileName() const { return fFileName; }
     88    const TString &GetDataSet()  const { return fDataSet;  }
    8089
    8190    void Copy(TObject &obj) const
     
    154163    Bool_t AddFilesOff(MDirIter &iter) const;
    155164
     165    /*
    156166    void ReplaceDir(const TString &old, const TString &news)
    157167    {
     
    165175        ReplaceFile(fSequencesOff, old, news);
    166176    }
     177    */
     178
     179    // I/O
     180    void WriteFile(const char *filename, const Option_t *o) const;
     181    void WriteFile(const char *filename) const { WriteFile(filename,""); } //*MENU *ARGS={filename=>fBaseName}
    167182
    168183    // TObject
     184    void Print(ostream &out, Option_t *o) const;
    169185    void Print(Option_t *o) const;
    170186    void Print() const { Print(""); } //*MENU*
    171187
    172     ClassDef(MDataSet, 2)
     188    ClassDef(MDataSet, 3)
    173189};
    174190
  • trunk/MagicSoft/Mars/mjobs/MJCut.cc

    r8907 r8989  
    1818!   Author(s): Thomas Bretz, 1/2005 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2007
     20!   Copyright: MAGIC Software Development, 2000-2008
    2121!
    2222!
     
    461461    *fLog << inf;
    462462    fLog->Separator(GetDescriptor());
    463     *fLog << "Filling MHSrcPosCam " << set.GetName() << endl;
     463    *fLog << "Filling MHSrcPosCam " << set.GetBaseName() << endl;
    464464    *fLog << endl;
    465465
     
    591591    *fLog << inf;
    592592    fLog->Separator(GetDescriptor());
    593     *fLog << "Perform cuts for data set " << set.GetName() << endl;
     593    *fLog << "Perform cuts for data set " << set.GetBaseName() << endl;
    594594    *fLog << endl;
    595595
     
    693693    TString fname0(path);
    694694    TString fname1(path);
    695     fname0 += fNameSummary.IsNull() ?  (TString) Form("ganymed%08d-summary.root", set.GetNumAnalysis()) : fNameSummary;
    696     fname1 += fNameResult.IsNull()  ?  (TString) Form("ganymed%08d.root",         set.GetNumAnalysis()) : fNameResult;
    697 
    698     MWriteRootFile *write0 = CanStoreSummary() ? new MWriteRootFile(fPathOut.IsNull()?0:fname0.Data(), fOverwrite?"RECREATE":"NEW") : 0;
    699     MWriteRootFile *write1 = CanStoreResult()  ? new MWriteRootFile(fPathOut.IsNull()?0:fname1.Data(), fOverwrite?"RECREATE":"NEW") : 0;
     695    fname0 += fNameSummary.IsNull() ? (TString) Form("ganymed%08d-summary.root", set.GetNumAnalysis()) : fNameSummary;
     696    fname1 += fNameResult.IsNull()  ? (TString) Form("ganymed%08d.root",         set.GetNumAnalysis()) : fNameResult;
     697
     698    MWriteRootFile dummy0(fPathOut.IsNull()||!CanStoreSummary()?0:fname0.Data(), fOverwrite?"RECREATE":"NEW");
     699    MWriteRootFile dummy1(fPathOut.IsNull()||!CanStoreResult() ?0:fname1.Data(), fOverwrite?"RECREATE":"NEW");
     700
     701    MWriteRootFile *write0 = CanStoreSummary() ? &dummy0 : 0;
     702    MWriteRootFile *write1 = CanStoreResult()  ? &dummy1 : 0;
    700703    SetupWriter(write0, "WriteAfterCut0");
    701704    SetupWriter(write1, "WriteAfterCut3");
     
    10461049    }
    10471050
    1048     if (write0)
    1049         delete write0;
    1050     if (write1)
    1051         delete write1;
    1052 
    10531051    // FIXME: Perform fit and plot energy dependant alpha plots
    10541052    // and fit result to new tabs!
  • trunk/MagicSoft/Mars/mjobs/MJSpectrum.cc

    r8985 r8989  
    1818!   Author(s): Thomas Bretz, 4/2005 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2007
     20!   Copyright: MAGIC Software Development, 2000-2008
    2121!
    2222!
     
    311311
    312312    TH1D *time   = (TH1D*)arr.FindObjectInCanvas("ExcessTime", "TH1D", "Hist");
    313     if (!size)
     313    if (!time)
    314314    {
    315315        *fLog << err;
     
    690690Bool_t MJSpectrum::Refill(MParList &plist, TH1D &h2)/*const*/
    691691{
    692     // Try to find the class used to determin the signal!
     692    // Try to find the class used to determine the signal!
    693693    TString cls("MHAlpha");
    694694    if (fDisplay)
     
    14981498    *fLog << inf;
    14991499    fLog->Separator(GetDescriptor());
    1500     *fLog << "Compile Monte Carlo sample (dataset " << set.GetName() << ")" << endl;
     1500    *fLog << "Compile Monte Carlo sample (dataset " << set.GetBaseName() << ")" << endl;
    15011501    *fLog << endl;
    15021502
     
    15391539    if (ontime<0)
    15401540    {
    1541         *fLog << err << GetDescriptor() << ": Could not determin effective on time..." << endl;
     1541        *fLog << err << GetDescriptor() << ": Could not determine effective on time..." << endl;
    15421542        return kFALSE;
    15431543    }
     
    16051605    // -------------- Fill excess events versus energy ---------------
    16061606
    1607     // Refill excess histogram to determin the excess events
     1607    // Refill excess histogram to determine the excess events
    16081608    TH1D excess;
    16091609    if (!Refill(plist, excess))
     
    18771877        return kTRUE;
    18781878
    1879     TNamed ganame("ganymed.root", gSystem->BaseName(fPathIn));
     1879    TNamed ganame("ganymed.root", fPathIn.Data());
    18801880
    18811881    // Write the output
  • trunk/MagicSoft/Mars/mjobs/MSequence.cc

    r8969 r8989  
    141141//    seq.SetupPedRuns(iter, "/mypath", "[DPC]");
    142142//
     143//
    143144// ===========================================================================
    144145//
     146// ToDO:
     147//   * Default paths could be moved into the global .rootrc
     148//
     149// ===========================================================================
     150//
     151//
    145152//  Class Version 2:
     153//  ----------------
    146154//   + fMonteCarlo
    147155//
    148156//  Class Version 3:
     157//  ----------------
    149158//   + fComment
    150159//
    151160//  Class Version 4:
     161//  ----------------
    152162//   + fExclRuns
    153163//
    154164//  Class Version 5:
     165//  ----------------
    155166//   + fRunsSub
    156167//   + fDatRunsSub
     
    163174
    164175#include <stdlib.h>
     176#include <errno.h>
     177
     178#include <fstream>
    165179
    166180#include <TEnv.h>
     
    538552        *fLog << err;
    539553        *fLog << "ERROR - No input files for sequence #" << GetSequence() << endl;
    540         *fLog << "        read from " << GetName() << endl;
     554        *fLog << "        read from " << GetBaseName() << endl;
    541555        *fLog << "        found in" << (def?" default-path ":" ") << d << endl;
    542556        return 0;
     
    550564    *fLog << "        " << (def?" default-path ":" ") << d << endl;
    551565    *fLog << "        but " << n2 << " files were defined in sequence file" << endl;
    552     *fLog << "        " << GetName() << endl;
     566    *fLog << "        " << GetBaseName() << endl;
    553567    if (fLog->GetDebugLevel()<=4)
    554568        return 0;
     
    580594
    581595    gLog << warn;
    582     gLog << "WARNING - in " << fFileName << ":" << endl;
     596    gLog << "WARNING - in " << GetBaseName() << ":" << endl;
    583597    gLog << "          LightCondition-tag is '" << str << "' but must be n/a, no_moon, twilight, moon or day." << endl;
    584598    return kNA;
     
    591605MSequence::MSequence(const char *fname, const char *path, UInt_t seq)
    592606{
    593     fName  = fname;
    594     fTitle = path;
     607    fName  = "MSequence";
     608    fTitle = "Sequence file";
    595609
    596610    fFileName = fname;
    597611    fDataPath = path;
    598612
    599     gSystem->ExpandPathName(fName);
    600     gSystem->ExpandPathName(fTitle);
    601 
    602     const Bool_t rc1 = gSystem->AccessPathName(fName, kFileExists);
    603     const Bool_t rc2 = !fTitle.IsNull() && gSystem->AccessPathName(fTitle, kFileExists);
     613    gSystem->ExpandPathName(fFileName);
     614    gSystem->ExpandPathName(fDataPath);
     615
     616    const Bool_t rc1 = gSystem->AccessPathName(fFileName, kFileExists);
     617    const Bool_t rc2 = !fDataPath.IsNull() && gSystem->AccessPathName(fDataPath, kFileExists);
    604618
    605619    if (rc1)
    606         gLog << err << "ERROR - Sequence file '" << fName << "' doesn't exist." << endl;
     620        gLog << err << "ERROR - Sequence file '" << fname << "' doesn't exist." << endl;
    607621    if (rc2)
    608         gLog << err << "ERROR - Directory '" << fTitle << "' doesn't exist." << endl;
    609 
    610     MEnv env(fName);
     622        gLog << err << "ERROR - Directory '" << path << "' doesn't exist." << endl;
     623
     624    MEnv env(fFileName);
    611625
    612626    fSequence = (UInt_t)env.GetValue("Sequence", (Int_t)seq);
     
    659673// Make sure that the name used for writing doesn't contain a full path
    660674//
    661 const char *MSequence::GetName() const
    662 {
    663     const char *pos = strrchr(GetRcName(), '/');
    664     return pos>0 ? pos+1 : GetRcName();
     675const char *MSequence::GetBaseName() const
     676{
     677    return gSystem->BaseName(fFileName);
     678}
     679
     680//---------------------------------------------------------------------------
     681//
     682// Make sure that the name used for writing doesn't contain a full path
     683//
     684const char *MSequence::GetFilePath() const
     685{
     686    return gSystem->DirName(fFileName);
    665687}
    666688
     
    752774// simplyfing the file setup
    753775//
    754 TString MSequence::PrintRuns(const char *pre, const char *name, const TArrayI &r, const TArrayI &f) const
     776TString MSequence::PrintRuns(ostream &out, const char *pre, const char *name, const TArrayI &r, const TArrayI &f) const
    755777{
    756778    if (r.GetSize()==0)
    757779        return "";
    758780
    759     gLog << pre << name;
     781    out << pre << name;
    760782    if (f.GetSize()==0)
    761783        const_cast<TArrayI&>(f).Set(r.GetSize());
     
    763785#ifdef DEBUG
    764786    for (int i=0; i<r.GetSize(); i++)
    765         gLog << "  " << r[i] << "." << f[i];
    766     gLog << endl;
     787        out << "  " << r[i] << "." << f[i];
     788    out << endl;
    767789    return "";
    768790#endif
     
    776798        if (!rc.IsNull())
    777799        {
    778             gLog << rc;
     800            out << rc;
    779801            continue;
    780802        }
     
    788810        if (n==1)
    789811        {
    790             gLog << " " << r[pos];
     812            out << " " << r[pos];
    791813            if (f[pos]>0)
    792                 gLog << "." << f[pos];
     814                out << "." << f[pos];
    793815        }
    794816        else
     
    802824            if (isseq)
    803825            {
    804                 gLog << " " << r[pos] << ".";
     826                out << " " << r[pos] << ".";
    805827                if (f[pos]!=0)
    806                     gLog << f[pos];
    807                 gLog << ":" << f[pos+n-1];
     828                    out << f[pos];
     829                out << ":" << f[pos+n-1];
    808830            }
    809831            else
    810832            {
    811                 gLog << " " << r[pos] << "+";
     833                out << " " << r[pos] << "+";
    812834
    813835                str += '\n';
     
    821843    }
    822844
    823     gLog << endl;
     845    out << endl;
    824846
    825847    return str;
     
    830852// Print the numbers in the classical way (one run after the other)
    831853//
    832 void MSequence::PrintRunsClassic(const char *pre, const char *name, const TArrayI &r) const
    833 {
    834     gLog << pre << name;
     854void MSequence::PrintRunsClassic(ostream &out, const char *pre, const char *name, const TArrayI &r) const
     855{
     856    out << pre << name;
    835857    for (int i=0; i<r.GetSize(); i++)
    836         gLog << " " << r[i];
    837     gLog << endl;
     858        out << " " << r[i];
     859    out << endl;
    838860}
    839861
     
    842864// Print the contents of the sequence
    843865//
    844 void MSequence::Print(Option_t *o) const
     866void MSequence::Print(ostream &out, Option_t *o) const
    845867{
    846868    const TString opt(o);
     
    848870    const TString pre = opt.Contains("prefixed") ? Form("Sequence%08d.", fSequence) : "";
    849871
    850     gLog << all;
    851872    if (!IsValid())
    852873    {
    853         gLog << pre << "Sequence: " << fFileName << " <invalid>" << endl;
     874        out << pre << "Sequence: " << fFileName << " <invalid>" << endl;
    854875        return;
    855876    }
    856     gLog << "# Path: " << GetRcName() << endl;
    857     gLog << "# Name: " << GetName() << endl;
    858     gLog << endl;
     877    out << "# Path: " << GetFileName() << endl;
     878    out << "# Name: " << GetBaseName() << endl;
     879    out << endl;
    859880    if (pre.IsNull())
    860         gLog << "Sequence:       " << fSequence << endl;
     881        out << "Sequence:       " << fSequence << endl;
    861882    if (fMonteCarlo)
    862         gLog << pre << "MonteCarlo:     Yes" << endl;
    863     gLog << pre <<"Period:         " << fPeriod << endl;
    864     gLog << pre << "Night:          " << fNight << endl << endl;
    865     gLog << pre << "LightCondition: ";
     883        out << pre << "MonteCarlo:     Yes" << endl;
     884    if (fPeriod>=0)
     885        out << pre << "Period:         " << fPeriod << endl;
     886    if (fNight!=MTime())
     887        out << pre << "Night:          " << fNight << endl;
     888    out << endl;
     889    out << pre << "LightCondition: ";
    866890    switch (fLightCondition)
    867891    {
    868     case kNA:       gLog << "n/a" << endl;      break;
    869     case kNoMoon:   gLog << "NoMoon" << endl;   break;
    870     case kTwilight: gLog << "Twilight" << endl; break;
    871     case kMoon:     gLog << "Moon" << endl;     break;
    872     case kDay:      gLog << "Day" << endl;     break;
    873     }
    874     gLog << pre << "Start:          " << fStart << endl;
    875     gLog << pre << "LastRun:        " << fLastRun << endl;
    876     gLog << pre << "NumEvents:      " << fNumEvents << endl;
    877     gLog << pre << "Project:        " << fProject << endl;
    878     gLog << pre << "Source:         " << fSource << endl;
    879     gLog << pre << "TriggerTable:   " << fTriggerTable << endl;
    880     gLog << pre << "HvSettings:     " << fHvSettings << endl << endl;
     892    case kNA:       out << "n/a" << endl;      break;
     893    case kNoMoon:   out << "NoMoon" << endl;   break;
     894    case kTwilight: out << "Twilight" << endl; break;
     895    case kMoon:     out << "Moon" << endl;     break;
     896    case kDay:      out << "Day" << endl;     break;
     897    }
     898
     899    if (fStart!=MTime())
     900        out << pre << "Start:          " << fStart << endl;
     901    if (fLastRun>=0)
     902        out << pre << "LastRun:        " << fLastRun << endl;
     903    if (fNumEvents>=0)
     904        out << pre << "NumEvents:      " << fNumEvents << endl;
     905    if (!fProject.IsNull())
     906        out << pre << "Project:        " << fProject << endl;
     907    if (!fSource.IsNull())
     908        out << pre << "Source:         " << fSource << endl;
     909    if (!fTriggerTable.IsNull())
     910        out << pre << "TriggerTable:   " << fTriggerTable << endl;
     911    if (!fHvSettings.IsNull())
     912        out << pre << "HvSettings:     " << fHvSettings << endl;
     913    out << endl;
    881914
    882915    TString str;
    883916    if (!HasSubRuns() && opt.Contains("classic"))
    884917    {
    885         PrintRunsClassic(pre, "Runs:     ", fRuns);
    886         PrintRunsClassic(pre, "CalRuns:  ", fCalRuns);
    887         PrintRunsClassic(pre, "PedRuns:  ", fPedRuns);
    888         PrintRunsClassic(pre, "DataRuns: ", fDatRuns);
    889         PrintRunsClassic(pre, "Exclude:  ", fExclRuns);
     918        PrintRunsClassic(out, pre, "Runs:     ", fRuns);
     919        PrintRunsClassic(out, pre, "CalRuns:  ", fCalRuns);
     920        PrintRunsClassic(out, pre, "PedRuns:  ", fPedRuns);
     921        PrintRunsClassic(out, pre, "DataRuns: ", fDatRuns);
     922        PrintRunsClassic(out, pre, "Exclude:  ", fExclRuns);
    890923    }
    891924    else
    892925    {
    893         str += PrintRuns(pre, "Runs:     ", fRuns,     fRunsSub);
    894         str += PrintRuns(pre, "CalRuns:  ", fCalRuns,  fCalRunsSub);
    895         str += PrintRuns(pre, "PedRuns:  ", fPedRuns,  fPedRunsSub);
    896         str += PrintRuns(pre, "DataRuns: ", fDatRuns,  fDatRunsSub);
    897         str += PrintRuns(pre, "Exclude:  ", fExclRuns, fExclRunsSub);
     926        str += PrintRuns(out, pre, "Runs:     ", fRuns,     fRunsSub);
     927        str += PrintRuns(out, pre, "CalRuns:  ", fCalRuns,  fCalRunsSub);
     928        str += PrintRuns(out, pre, "PedRuns:  ", fPedRuns,  fPedRunsSub);
     929        str += PrintRuns(out, pre, "DataRuns: ", fDatRuns,  fDatRunsSub);
     930        str += PrintRuns(out, pre, "Exclude:  ", fExclRuns, fExclRunsSub);
    898931    }
    899932
    900933    if (!fDataPath.IsNull())
    901         gLog << endl << pre << "DataPath: " << fDataPath << endl;
     934        out << endl << pre << "DataPath: " << fDataPath << endl;
    902935
    903936    if (!str.IsNull())
    904         gLog << str << endl;
    905 
    906     gLog << endl << pre << "Comment: " << fComment << endl;
     937        out << str << endl;
     938
     939    out << endl;
     940
     941    if (!fComment.IsNull())
     942        out << pre << "Comment: " << fComment << endl;
     943}
     944
     945// --------------------------------------------------------------------------
     946//
     947// Print the contents of the sequence to gLog
     948//
     949void MSequence::Print(Option_t *o) const
     950{
     951    gLog << all;
     952    Print(gLog, o);
     953}
     954
     955// --------------------------------------------------------------------------
     956//
     957// Print the contents of the sequence to the file with name filename
     958//
     959void MSequence::WriteFile(const char *name, const Option_t *o) const
     960{
     961    ofstream fout(name);
     962    if (!fout)
     963    {
     964        gLog << err << "Cannot open file " << name << ": ";
     965        gLog << strerror(errno) << endl;
     966        return;
     967    }
     968
     969    Print(fout, o);
    907970}
    908971
  • trunk/MagicSoft/Mars/mjobs/MSequence.h

    r8969 r8989  
    2222    };
    2323private:
    24     TString fFileName;
    25     TString fDataPath;
     24    TString fFileName;         // Expanded file name
     25    TString fDataPath;         // Path to data files
    2626
    27     UInt_t fSequence;
     27    UInt_t fSequence;          // Sequence number
    2828
    29     MTime  fStart;
     29    MTime  fStart;             // Start time of sequence
    3030
    31     UInt_t fLastRun;
    32     UInt_t fNumEvents;
     31    UInt_t fLastRun;           // Last run in sequence (necessary?)
     32    UInt_t fNumEvents;         // Number of events in sequence
    3333
    34     UInt_t fPeriod;
    35     MTime  fNight;
     34    UInt_t fPeriod;            // Observation period of the sequence
     35    MTime  fNight;             // Night (day of sunrise) of the sequence
    3636
    3737    LightCondition_t fLightCondition;
     
    4343    TString fComment;
    4444
    45     TArrayI fRuns;
    46     TArrayI fRunsSub;
     45    TArrayI fRuns;            // Run numbers
     46    TArrayI fRunsSub;         // Sub runs (files)
    4747
    48     TArrayI fCalRuns;
    49     TArrayI fCalRunsSub;
     48    TArrayI fCalRuns;         // Numbers of calibration runs/files
     49    TArrayI fCalRunsSub;      // Sub runs (files) of calibration runs
    5050
    51     TArrayI fPedRuns;
    52     TArrayI fPedRunsSub;
     51    TArrayI fPedRuns;         // Numbers of pedestal runs/files
     52    TArrayI fPedRunsSub;      // Sub runs (files) of pedestal runs
    5353
    54     TArrayI fDatRuns;
    55     TArrayI fDatRunsSub;
     54    TArrayI fDatRuns;         // Numbers of data runs/files
     55    TArrayI fDatRunsSub;      // Sub runs (files) of data runs
    5656
    57     TArrayI fExclRuns;
    58     TArrayI fExclRunsSub;
     57    TArrayI fExclRuns;        // Numbers of excluded runs/files
     58    TArrayI fExclRunsSub;     // Sub runs (files) of excluded runs
    5959
    60     Bool_t fMonteCarlo;
     60    Bool_t fMonteCarlo;       // Flag for Monte Carlo sequences
    6161
    6262    // Helper for interpretation
     
    7878    TString GetNumSequence(Int_t &pos, const TArrayI &n, const TArrayI &f) const;
    7979
    80     void    PrintRunsClassic(const char *pre, const char *name, const TArrayI &r) const;
    81     TString PrintRuns(const char *pre, const char *name, const TArrayI &r, const TArrayI &f) const;
     80    void    PrintRunsClassic(ostream &out, const char *pre, const char *name, const TArrayI &r) const;
     81    TString PrintRuns(ostream &out, const char *pre, const char *name, const TArrayI &r, const TArrayI &f) const;
    8282
    8383    // General helper
     
    9292public:
    9393    MSequence() : fSequence((UInt_t)-1), fLastRun((UInt_t)-1),
    94         fNumEvents((UInt_t)-1), fPeriod((UInt_t)-1), fMonteCarlo(kFALSE) { }
     94        fNumEvents((UInt_t)-1), fPeriod((UInt_t)-1), fMonteCarlo(kFALSE)
     95    {
     96        fName  = "MSequence";
     97        fTitle = "Sequence file";
     98    }
    9599    MSequence(const char *fname, const char *path="", UInt_t id=(UInt_t)-1);
    96     MSequence(const MSequence &s) : fSequence(s.fSequence), fStart(s.fStart),
     100    MSequence(const MSequence &s) : MParContainer(s),
     101        fFileName(s.fFileName), fDataPath(s.fDataPath),
     102        fSequence(s.fSequence), fStart(s.fStart),
    97103        fLastRun(s.fLastRun), fNumEvents(s.fNumEvents), fPeriod(s.fPeriod),
    98104        fNight(s.fNight), fProject(s.fProject), fSource(s.fSource),
     
    101107        fDatRuns(s.fDatRuns), fMonteCarlo(s.fMonteCarlo) { }
    102108
     109    // I/O
     110    void WriteFile(const char *filename, const Option_t *o) const;
     111    void WriteFile(const char *filename) const { WriteFile(filename,""); } //*MENU *ARGS={filename=>fBaseName}
     112
    103113    // TObject
     114    void Print(ostream &out, Option_t *o) const;
    104115    void Print(Option_t *o) const;
    105116    void Print() const { Print(""); } //*MENU*
    106 
    107     const char *GetName() const;
    108     const char *GetRcName() const { return fName; }
    109117
    110118    // Genaral interface
     
    151159
    152160    // Filesystem getter
     161    const char    *GetBaseName() const;
     162    const char    *GetFilePath() const;
    153163    const TString &GetFileName() const { return fFileName; }
    154164    const TString &GetDataPath() const { return fDataPath; }
  • trunk/MagicSoft/Mars/mpointing/MPointingDevCalc.cc

    r8985 r8989  
    491491    fSkip.Reset();
    492492
     493    // In cases in which ReInit isn't called right in time (e.g. if
     494    // the first starguider event comes before the first data event)
     495    fNsbSum   =  0;
     496    fNsbSq    =  0;
     497    fNsbCount =  0;
     498
    493499    return fDeviation ? kTRUE : kFALSE;
    494500}
  • trunk/MagicSoft/Mars/sponde.cc

    r8986 r8989  
    237237    //
    238238    {
    239         MJSpectrum job(Form("Spectrum - %s", kInfile.Data()));
     239        MJSpectrum job(Form("Spectrum - %s", gSystem->BaseName(kInfile)));
    240240        job.SetEnv(&env);
    241241        job.SetEnvDebug(kDebugEnv);
Note: See TracChangeset for help on using the changeset viewer.