Ignore:
Timestamp:
06/13/05 10:20:58 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mjobs
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mjobs/JobsLinkDef.h

    r7121 r7151  
    1919#pragma link C++ class MJSpectrum+;
    2020
    21 #pragma link C++ class MJOptimize+;
    22 #pragma link C++ class MJOptimizeCuts+;
    23 #pragma link C++ class MJOptimizeEnergy+;
    24 
    2521#endif
  • trunk/MagicSoft/Mars/mjobs/MJOptimize.cc

    r7121 r7151  
    158158    MParList *plist = fEvtLoop->GetParList();
    159159
    160     MParameterD   *eval = (MParameterD*)plist->FindObject("MinimizationValue", "MParameterD");
     160    MParameterD   *eval = (MParameterD*)plist->FindObject(fNameMinimizationValue, "MParameterD");
    161161    MParContainer *pars = (MParContainer*)plist->FindObject("MParameters", "MParContainer");
    162162
     
    172172        *fLog << endl;
    173173    }
    174  
     174
    175175    pars->SetVariables(par);
    176176    eval->SetVal(0);
     
    225225}
    226226
    227 MJOptimize::MJOptimize() : fDebug(-1), fNumEvents(0), fType(kSimplex), fNumMaxCalls(0), fTolerance(0), fTestTrain(0)
     227MJOptimize::MJOptimize() : fDebug(-1), fNumEvents(0), fType(kSimplex), fNumMaxCalls(0), fTolerance(0), fTestTrain(0), fNameMinimizationValue("MinimizationValue")
    228228{
    229229    fRules.SetOwner();
     
    648648{
    649649    // Checks to make sure, that fcn doesn't crash
    650     if (!parlist.FindCreateObj("MParameterD", "MinimizationValue"))
     650    if (!parlist.FindCreateObj("MParameterD", fNameMinimizationValue))
    651651        return kFALSE;
    652652
  • trunk/MagicSoft/Mars/mjobs/MJOptimize.h

    r7142 r7151  
    7373    Float_t fTolerance;
    7474    Int_t   fTestTrain;
     75    TString fNameMinimizationValue;
    7576
    7677    Bool_t Optimize(MEvtLoop &evtloop);
     
    112113    void SetTolerance(Float_t tol=0)  { fTolerance=tol; }
    113114    void EnableTestTrain(Int_t b=1)   { fTestTrain=b; } // Use 1 and -1
     115    void SetNameMinimizationValue(const char *name="MinimizationValue") { fNameMinimizationValue = name; }
    114116
    115117    // Parameter access
  • trunk/MagicSoft/Mars/mjobs/MJOptimizeEnergy.cc

    r7121 r7151  
    2727// MJOptimize
    2828//
    29 // Class for otimizing the parameters of the supercuts
     29// Class for otimizing a rule to estimate the energy. For more details see
     30// MJOptimize.
    3031//
    31 // Minimization Control
    32 // ====================
     32// Example:
     33// --------
    3334//
    34 //   To choose the minimization algorithm use:
    35 //         void SetOptimizer(Optimizer_t o);
    36 //
    37 //   Allowed options are:
    38 //        enum Optimizer_t
    39 //        {
    40 //            kMigrad,      // Minimize by the method of Migrad
    41 //            kSimplex,     // Minimize by the method of Simplex
    42 //            kMinimize,    // Migrad + Simplex (if Migrad fails)
    43 //            kMinos,       // Minos error determination
    44 //            kImprove,     // Local minimum search
    45 //            kSeek,        // Minimize by the method of Monte Carlo
    46 //            kNone         // Skip optimization
    47 //        };
    48 //
    49 //   For more details on the methods see TMinuit.
    50 //
    51 //
    52 //   You can change the behaviour of the minimization using
    53 //
    54 //        void SetNumMaxCalls(UInt_t num=0);
    55 //        void SetTolerance(Float_t tol=0);
    56 //
    57 //   While NumMaxCalls is the first, Tolerance the second arguement.
    58 //   For more details start root and type
    59 //
    60 //        gMinuit->mnhelp("command")
    61 //
    62 //   while command can be
    63 //        * MIGRAD
    64 //        * SIMPLEX
    65 //        * MINIMIZE
    66 //        * MINOS
    67 //        * IMPROVE
    68 //        * SEEK
    69 //
    70 //   The default (num==0 and tol==0) should always give you the
    71 //   corresponding defaults used in Minuit.
    72 //
    73 //
    74 // FIXME: Implement changing cut in hadronness...
    75 // FIXME: Show MHSignificance on MStatusDisplay during filling...
    76 // FIXME: Choose step-size percentage as static data membewr
    77 // FIXME: Choose minimization method
     35//    MJOptimizeEnergy opt;
     36//    opt.SetDebug(2);
     37//    opt.SetOptimizer(MJOptimize::kMigrad);
     38//    opt.SetNumEvents(20000);
     39//    opt.EnableTestTrain();
     40//    opt.AddParameter("MHillas.fSize");
     41//    opt.SetParameter(0, 1, 0, 2);
     42//    char *r = "[0]*M[0]"; //Rule to calculate estimated energy
     43//    MStatusDisplay *d = new MStatusDisplay;
     44//    opt.SetDisplay(d);
     45//    opt.RunDisp("ganymed-summary.root", r);
    7846//
    7947/////////////////////////////////////////////////////////////////////////////
     
    11684// energy estimator.
    11785//
    118 Bool_t MJOptimizeEnergy::RunEnergy(const char *fname, const char *rule)
     86Bool_t MJOptimizeEnergy::RunEnergy(const char *fname, const char *rule, MTask *weights)
    11987{
    12088    fLog->Separator("Preparing Energy optimization");
     
    139107    hist.InitMapping(&m);
    140108
    141     MEnergyEstimate est("MParameters");
    142     est.SetRule(rule);
     109    MParameterCalc est(rule, "MParameters");
     110    est.SetNameParameter("MEnergyEst");
    143111    parlist.AddToList(&est);
    144112
     
    159127
    160128    MFillH fill(&hist);
     129    if (weights)
     130        fill.SetWeight();
    161131
    162132    MMatrixLoop loop(&m);
     
    164134    tasklist.AddToList(&loop);
    165135    tasklist.AddToList(&est);
     136    if (weights)
     137        tasklist.AddToList(weights);
    166138    tasklist.AddToList(&fill);
    167139
  • trunk/MagicSoft/Mars/mjobs/MJOptimizeEnergy.h

    r7121 r7151  
    66#endif
    77
     8class MTask;
     9
    810class MJOptimizeEnergy : public MJOptimize
    911{
    1012public:
     13    MJOptimizeEnergy() : MJOptimize() { }
     14
    1115    // Special optimizing routines
    12     Bool_t RunEnergy(const char *fname, const char *rule);
    13     Bool_t RunEnergy(const char *rule)
     16    Bool_t RunEnergy(const char *fname, const char *rule, MTask *weights=0);
     17    Bool_t RunEnergy(const char *rule, MTask *weights=0)
    1418    {
    15         return RunEnergy(0, rule);
     19        return RunEnergy(0, rule, weights);
    1620    }
    1721
Note: See TracChangeset for help on using the changeset viewer.