Ignore:
Timestamp:
05/02/05 10:17:41 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mjobs
Files:
2 edited

Legend:

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

    r6979 r6988  
    7777MJCut::MJCut(const char *name, const char *title)
    7878    : fStoreSummary(kFALSE), fStoreResult(kTRUE), fWriteOnly(kFALSE),
    79     fIsWobble(kFALSE), fIsMonteCarlo(kFALSE),  fFullDisplay(kFALSE), /*fSubstraction(kFALSE),*/
    80     /*fEstimateEnergy(0),*/ fCalcHadronness(0)
     79    fIsWobble(kFALSE), fIsMonteCarlo(kFALSE),  fFullDisplay(kFALSE),
     80    fNameHist("MHTheta"), fCalcHadronness(0)
    8181{
    8282    fName  = name  ? name  : "MJCut";
     
    258258
    259259    // Save also the result, not only the setup
    260     const MHAlpha *halpha = (MHAlpha*)plist.FindObject("MHAlpha");
     260    const MHAlpha *halpha = (MHAlpha*)plist.FindObject(fNameHist, "MHAlpha");
    261261    if (halpha)
    262262        arr.Add((TObject*)(&halpha->GetAlphaFitter()));
     
    285285//   MJCut.WriteResult:  yes, no
    286286//   MJCut.ResultFile:   filename
     287//   MJCut.HistName:     MHAlpha
    287288//
    288289Bool_t MJCut::CheckEnvLocal()
     
    301302    EnableFullDisplay(GetEnv("FullDisplay", fFullDisplay));
    302303    //EnableSubstraction(GetEnv("HistogramSubstraction", fSubstraction));
     304
     305    SetNameHist(GetEnv("NameHist", fNameHist));
    303306
    304307    return kTRUE;
     
    341344}
    342345
    343 void MJCut::DisplayResult(const MParList &plist) const
    344 {
    345     /*
    346      TObject *h1 = plist.FindObject("MHHillasOffPre",  "MHHillas");
    347      TObject *h2 = plist.FindObject("MHHillasOffPost", "MHHillas");
    348      TObject *h3 = plist.FindObject("MHVsSizeOffPost", "MHVsSize");
    349      TObject *h4 = plist.FindObject("MHHilExtOffPost", "MHHillasExt");
    350      TObject *h5 = plist.FindObject("MHHilSrcOffPost", "MHHillasSrc");
    351      TObject *h6 = plist.FindObject("MHImgParOffPost", "MHImagePar");
    352      TObject *h7 = plist.FindObject("MHNewParOffPost", "MHNewImagePar");
    353      */
     346// --------------------------------------------------------------------------
     347//
     348// Create a new instance of an object with name name of class
     349// type fNameHist in parlist. It must derive from MHAlpha.
     350// Call ForceUsingSize for it and return its pointer.
     351// If something fails NULL is returned.
     352//
     353MHAlpha *MJCut::CreateNewHist(MParList &plist, const char *name) const
     354{
     355    TClass *cls = gROOT->GetClass(fNameHist);
     356    if (!cls)
     357    {
     358        *fLog << err << "Class " << fNameHist << " not found in dictionary... abort." << endl;
     359        return NULL;
     360    }
     361    if (!cls->InheritsFrom(MHAlpha::Class()))
     362    {
     363        *fLog << err << "Class " << fNameHist << " doesn't inherit from MHAlpha... abort." << endl;
     364        return NULL;
     365    }
     366
     367    const TString objname(Form("%s%s", fNameHist.Data(), name));
     368    MHAlpha *h = (MHAlpha*)plist.FindCreateObj(fNameHist, objname);
     369    if (!h)
     370        return NULL;
     371
     372    h->ForceUsingSize();
     373
     374    return h;
    354375}
    355376
     
    424445        fit.SetScaleMode(MAlphaFitter::kNone);
    425446
    426     MHAlpha halphaoff("MHAlphaOff");
    427     halphaoff.ForceUsingSize();
    428     plist.AddToList(&halphaoff);
    429 
    430     MFillH falpha("MHAlphaOff [MHAlpha]", "MHillasSrc", "FillAlpha");
     447    MHAlpha *halphaoff = CreateNewHist(plist, "Off");
     448    MFillH falpha(halphaoff, "MHillasSrc", "FillAlpha");
    431449    MFillH ffs("MHFalseSourceOff [MHFalseSource]", "MHillas", "FillFS");
    432450
     
    655673    }
    656674    */
    657     MHAlpha halphaon("MHAlpha");
    658     halphaon.ForceUsingSize();
    659     plist.AddToList(&halphaon);
    660 
    661     MFillH falpha2("MHAlpha", "MHillasSrc", "FillAlpha");
     675    MHAlpha *halphaon=CreateNewHist(plist);
     676    MFillH falpha2(halphaon, "MHillasSrc", "FillAlpha");
    662677    MFillH ffs2("MHFalseSource", "MHillas", "FillFS");
    663678
     
    706721    tlist.PrintStatistics();
    707722
    708     DisplayResult(plist);
    709 
    710723    // FIXME: Perform fit and plot energy dependant alpha plots
    711724    // and fit result to new tabs!
  • trunk/MagicSoft/Mars/mjobs/MJCut.h

    r6979 r6988  
    99class MDataSet;
    1010class MParList;
     11class MHAlpha;
    1112class MWriteRootFile;
    1213
     
    2627    TString fNameOutput;
    2728
     29    TString fNameHist;
     30
    2831    //MTask *fEstimateEnergy;
    2932    MTask *fCalcHadronness;
    3033
    31     TString GetOutputFile(UInt_t num) const;
    32     Bool_t  CheckEnvLocal();
    33     void    SetupWriter(MWriteRootFile *write, const char *name) const;
    34     Bool_t  WriteTasks(UInt_t num, TObjArray &cont) const;
    35     Bool_t  WriteResult(const MParList &plist, UInt_t num) const;
    36     void    DisplayResult(const MParList &plist) const;
     34    TString  GetOutputFile(UInt_t num) const;
     35    Bool_t   CheckEnvLocal();
     36    void     SetupWriter(MWriteRootFile *write, const char *name) const;
     37    Bool_t   WriteTasks(UInt_t num, TObjArray &cont) const;
     38    Bool_t   WriteResult(const MParList &plist, UInt_t num) const;
     39    MHAlpha *CreateNewHist(MParList &plist, const char *name="") const;
    3740
    38     Bool_t  CanStoreSummary() const { return !fPathOut.IsNull() && fStoreSummary; }
    39     Bool_t  CanStoreResult() const  { return !fPathOut.IsNull() && fStoreResult;  }
     41    Bool_t   CanStoreSummary() const { return !fPathOut.IsNull() && fStoreSummary; }
     42    Bool_t   CanStoreResult() const  { return !fPathOut.IsNull() && fStoreResult;  }
    4043
    4144public:
     
    5760    void SetNameOutFile(const char *name="")      { fNameOutput=name; }
    5861
     62    void SetNameHist(const char *name) { fNameHist=name; }
     63
    5964    //void SetEnergyEstimator(const MTask *task=0);
    6065    void SetHadronnessCalculator(const MTask *task=0);
Note: See TracChangeset for help on using the changeset viewer.