Factory.h   Factory.h 
// @(#)root/tmva $Id: Factory.h 40012 2011-06-27 16:03:11Z stelzer $ // @(#)root/mathcore:$Id: Factory.h 37448 2010-12-09 20:20:56Z moneta $
// Author: Andreas Hoecker, Peter Speckmayer, Joerg Stelzer, Helge Voss, Ka // Author: L. Moneta Fri Dec 22 14:43:33 2006
i Voss, Eckhard von Toerne, Jan Therhaag
/************************************************************************** /**********************************************************************
******** * *
* Project: TMVA - a Root-integrated toolkit for multivariate data analysis * Copyright (c) 2006 LCG ROOT Math Team, CERN/PH-SFT *
* * *
* Package: TMVA * *
* **********************************************************************/
* Class : Factory
* // Header file for class Factory
* Web : http://tmva.sourceforge.net
* #ifndef ROOT_Math_Factory
* #define ROOT_Math_Factory
*
* Description:
*
* This is the main MVA steering class: it creates (books) all MVA met
hods, *
* and guides them through the training, testing and evaluation phases
. *
*
*
* Authors (alphabetical):
*
* Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland
*
* Joerg Stelzer <stelzer@cern.ch> - DESY, Germany
*
* Peter Speckmayer <peter.speckmayer@cern.ch> - CERN, Switzerland
*
* Jan Therhaag <Jan.Therhaag@cern.ch> - U of Bonn, Germany
*
* Eckhard v. Toerne <evt@uni-bonn.de> - U of Bonn, Germany
*
* Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, German
y *
* Kai Voss <Kai.Voss@cern.ch> - U. of Victoria, Canada
*
*
*
* Copyright (c) 2005-2011:
*
* CERN, Switzerland
*
* U. of Victoria, Canada
*
* MPI-K Heidelberg, Germany
*
* U. of Bonn, Germany
*
*
*
* Redistribution and use in source and binary forms, with or without
*
* modification, are permitted according to the terms listed in LICENSE
*
* (http://tmva.sourceforge.net/LICENSE)
*
**************************************************************************
********/
#ifndef ROOT_TMVA_Factory
#define ROOT_TMVA_Factory
//////////////////////////////////////////////////////////////////////////
// //
// Factory //
// //
// This is the main MVA steering class: it creates all MVA methods, //
// and guides them through the training, testing and evaluation //
// phases //
// //
//////////////////////////////////////////////////////////////////////////
#include <string> #include <string>
#include <vector>
#include <map>
#ifndef ROOT_TCut
#include "TCut.h"
#endif
#ifndef ROOT_TMVA_Configurable
#include "TMVA/Configurable.h"
#endif
#ifndef ROOT_TMVA_Types
#include "TMVA/Types.h"
#endif
#ifndef ROOT_TMVA_DataSet
#include "TMVA/DataSet.h"
#endif
class TFile;
class TTree;
class TDirectory;
namespace TMVA {
class IMethod;
class MethodBase;
class DataInputHandler;
class DataSetInfo;
class DataSetManager;
class VariableTransformBase;
class Factory : public Configurable {
public:
typedef std::vector<IMethod*> MVector;
// no default constructor
Factory( TString theJobName, TFile* theTargetFile, TString theOption
= "" );
// default destructor
virtual ~Factory();
virtual const char* GetName() const { return "Factory"; }
// add events to training and testing trees
void AddSignalTrainingEvent ( const std::vector<Double_t>& event,
Double_t weight = 1.0 );
void AddBackgroundTrainingEvent( const std::vector<Double_t>& event,
Double_t weight = 1.0 );
void AddSignalTestEvent ( const std::vector<Double_t>& event,
Double_t weight = 1.0 );
void AddBackgroundTestEvent ( const std::vector<Double_t>& event,
Double_t weight = 1.0 );
void AddTrainingEvent( const TString& className, const std::vector<Do
uble_t>& event, Double_t weight );
void AddTestEvent ( const TString& className, const std::vector<Do
uble_t>& event, Double_t weight );
void AddEvent ( const TString& className, Types::ETreeType tt,
const std::vector<Double_t>& event, Double_t weight );
Bool_t UserAssignEvents(UInt_t clIndex);
TTree* CreateEventAssignTrees( const TString& name );
DataSetInfo& AddDataSet( DataSetInfo& );
DataSetInfo& AddDataSet( const TString& );
// special case: signal/background
// Data input related
void SetInputTrees( const TString& signalFileName, const TString& bac
kgroundFileName,
Double_t signalWeight=1.0, Double_t backgroundWei
ght=1.0 );
void SetInputTrees( TTree* inputTree, const TCut& SigCut, const TCut&
BgCut );
// Set input trees at once
void SetInputTrees( TTree* signal, TTree* background,
Double_t signalWeight=1.0, Double_t backgroundWei
ght=1.0) ;
void AddSignalTree( TTree* signal, Double_t weight=1.0, Types::ETr
eeType treetype = Types::kMaxTreeType );
void AddSignalTree( TString datFileS, Double_t weight=1.0, Types::ETr
eeType treetype = Types::kMaxTreeType );
void AddSignalTree( TTree* signal, Double_t weight, const TString& tr
eetype );
// ... depreciated, kept for backwards compatibility
void SetSignalTree( TTree* signal, Double_t weight=1.0);
void AddBackgroundTree( TTree* background, Double_t weight=1.0, Types
::ETreeType treetype = Types::kMaxTreeType );
void AddBackgroundTree( TString datFileB, Double_t weight=1.0, Types
::ETreeType treetype = Types::kMaxTreeType );
void AddBackgroundTree( TTree* background, Double_t weight, const TSt
ring & treetype );
// ... depreciated, kept for backwards compatibility
void SetBackgroundTree( TTree* background, Double_t weight=1.0 );
void SetSignalWeightExpression( const TString& variable );
void SetBackgroundWeightExpression( const TString& variable );
// special case: regression
void AddRegressionTree( TTree* tree, Double_t weight = 1.0,
Types::ETreeType treetype = Types::kMaxTreeTy
pe ) {
AddTree( tree, "Regression", weight, "", treetype );
}
// general
// Data input related
void SetTree( TTree* tree, const TString& className, Double_t weight
); // depreciated
void AddTree( TTree* tree, const TString& className, Double_t weight=
1.0,
const TCut& cut = "",
Types::ETreeType tt = Types::kMaxTreeType );
void AddTree( TTree* tree, const TString& className, Double_t weight,
const TCut& cut, const TString& treeType );
// set input variable
void SetInputVariables ( std::vector<TString>* theVariables ); // de
preciated
void AddVariable ( const TString& expression, const TString& t
itle, const TString& unit,
char type='F', Double_t min = 0, Double_t m
ax = 0 );
void AddVariable ( const TString& expression, char type='F',
Double_t min = 0, Double_t max = 0 );
void AddTarget ( const TString& expression, const TString& t
itle = "", const TString& unit = "",
Double_t min = 0, Double_t max = 0 );
void AddRegressionTarget( const TString& expression, const TString& t
itle = "", const TString& unit = "",
Double_t min = 0, Double_t max = 0 )
{
AddTarget( expression, title, unit, min, max );
}
void AddSpectator ( const TString& expression, const TString&
title = "", const TString& unit = "",
Double_t min = 0, Double_t max = 0 );
// set weight for class
void SetWeightExpression( const TString& variable, const TString& cla
ssName = "" );
// set cut for class
void SetCut( const TString& cut, const TString& className = "" );
void SetCut( const TCut& cut, const TString& className = "" );
void AddCut( const TString& cut, const TString& className = "" );
void AddCut( const TCut& cut, const TString& className = "" );
// prepare input tree for training
void PrepareTrainingAndTestTree( const TCut& cut, const TString& spli
tOpt );
void PrepareTrainingAndTestTree( TCut sigcut, TCut bkgcut, const TStr
ing& splitOpt );
// ... deprecated, kept for backwards compatibility
void PrepareTrainingAndTestTree( const TCut& cut, Int_t Ntrain, Int_t
Ntest = -1 );
void PrepareTrainingAndTestTree( const TCut& cut, Int_t NsigTrain, In
t_t NbkgTrain, Int_t NsigTest, Int_t NbkgTest,
const TString& otherOpt="SplitMode=R
andom:!V" );
MethodBase* BookMethod( TString theMethodName, TString methodTitle, T
String theOption = "" );
MethodBase* BookMethod( Types::EMVA theMethod, TString methodTitle,
TString theOption = "" );
MethodBase* BookMethod( TMVA::Types::EMVA /*theMethod*/,
TString /*methodTitle*/,
TString /*methodOption*/,
TMVA::Types::EMVA /*theCommittee*/,
TString /*committeeOption = ""*/ ) { return 0
; }
// optimize all booked methods (well, if desired by the method)
void OptimizeAllMethods (TString fomType="ROCIntegral
", TString fitType="FitGA");
void OptimizeAllMethodsForClassification(TString fomType="ROCIntegral
", TString fitType="FitGA") { OptimizeAllMethods(fomType,fitType); }
void OptimizeAllMethodsForRegression (TString fomType="ROCIntegral
", TString fitType="FitGA") { OptimizeAllMethods(fomType,fitType); }
// training for all booked methods
void TrainAllMethods ();
void TrainAllMethodsForClassification( void ) { TrainAllMethods(); }
void TrainAllMethodsForRegression ( void ) { TrainAllMethods(); }
// testing
void TestAllMethods();
// performance evaluation
void EvaluateAllMethods( void );
void EvaluateAllVariables( TString options = "" );
// delete all methods and reset the method vector
void DeleteAllMethods( void );
// accessors
IMethod* GetMethod( const TString& title ) const;
Bool_t Verbose( void ) const { return fVerbose; }
void SetVerbose( Bool_t v=kTRUE );
// make ROOT-independent C++ class for classifier response
// (classifier-specific implementation)
// If no classifier name is given, help messages for all booked
// classifiers are printed
virtual void MakeClass( const TString& methodTitle = "" ) const;
// prints classifier-specific hepl messages, dedicated to
// help with the optimisation and configuration options tuning.
// If no classifier name is given, help messages for all booked
// classifiers are printed
void PrintHelpMessage( const TString& methodTitle = "" ) const;
static TDirectory* RootBaseDir() { return (TDirectory*)fgTargetFile;
}
private:
// the beautiful greeting message
void Greetings();
void WriteDataInformation();
DataInputHandler& DataInput() { return *fDataInputHandler; }
DataSetInfo& DefaultDataSetInfo();
void SetInputTreesFromEventAssignTrees();
private:
// data members
DataSetManager* fDataSetManager; // DSMTEST
static TFile* fgTargetFile; //! ROOT
output file
DataInputHandler* fDataInputHandler;
std::vector<TMVA::VariableTransformBase*> fDefaultTrfs; //! list
of transformations on default DataSet
// cd to local directory
TString fOptions; //! optio
n string given by construction (presently only "V")
TString fTransformations; //! List
of transformations to test
Bool_t fVerbose; //! verbo
se mode
MVector fMethods; //! all M
VA methods
TString fJobName; //! jobna
me, used as extension in weight file names
// flag determining the way training and test data are assigned to Fa
ctory
enum DataAssignType { kUndefined = 0,
kAssignTrees,
kAssignEvents };
DataAssignType fDataAssignType; //! flags
for data assigning
std::vector<TTree*> fTrainAssignTree; //! for e
ach class: tmp tree if user wants to assign the events directly
std::vector<TTree*> fTestAssignTree; //! for e
ach class: tmp tree if user wants to assign the events directly
Int_t fATreeType; // typ
e of event (=classIndex)
Float_t fATreeWeight; // wei
ght of the event
Float_t* fATreeEvent; // eve
nt variables
Types::EAnalysisType fAnalysisType; //! the t
raining type
protected: namespace ROOT {
namespace Math {
class Minimizer;
class DistSampler;
//_________________________________________________________________________
__
/**
Factory class holding static functions to create the interfaces like RO
OT::Math::Minimizer
via the Plugin Manager
*/
class Factory {
public:
/**
static method to create the corrisponding Minimizer given the string
Supported Minimizers types are:
Minuit (TMinuit), Minuit2, GSLMultiMin, GSLMultiFit, GSLSimAn, Linear
, Fumili, Genetic
If no name is given use default values defined in MinimizerOptions
*/
static ROOT::Math::Minimizer * CreateMinimizer(const std::string & minim
izerType = "", const std::string & algoType = "");
/**
static method to create the distribution sampler class given a string
specifying the type
Supported sampler types are:
Unuran, Foam
If no name is given use default values defined in DistSamplerOptions
*/
static ROOT::Math::DistSampler * CreateDistSampler(const std::string & s
amplerType ="");
};
ClassDef(Factory,0) // The factory creates all MVA methods, and perf } // end namespace Fit
orms their training and testing
};
} // namespace TMVA } // end namespace ROOT
#endif #endif /* ROOT_Fit_MinimizerFactory */
 End of changes. 7 change blocks. 
360 lines changed or deleted 53 lines changed or added


 MCMCCalculator.h   MCMCCalculator.h 
// @(#)root/roostats:$Id: MCMCCalculator.h 39391 2011-05-26 09:51:59Z monet a $ // @(#)root/roostats:$Id: MCMCCalculator.h 40961 2011-09-20 17:08:56Z monet a $
// Authors: Kevin Belasco 17/06/2009 // Authors: Kevin Belasco 17/06/2009
// Authors: Kyle Cranmer 17/06/2009 // Authors: Kyle Cranmer 17/06/2009
/************************************************************************* /*************************************************************************
* Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. * * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
* All rights reserved. * * All rights reserved. *
* * * *
* For the licensing terms see $ROOTSYS/LICENSE. * * For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. * * For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/ *************************************************************************/
skipping to change at line 85 skipping to change at line 85
// Set the Pdf if not already there // Set the Pdf if not already there
virtual void SetPdf(RooAbsPdf& pdf) { fPdf = &pdf; } virtual void SetPdf(RooAbsPdf& pdf) { fPdf = &pdf; }
// Set the Prior Pdf if not already there // Set the Prior Pdf if not already there
virtual void SetPriorPdf(RooAbsPdf& pdf) { fPriorPdf = &pdf; } virtual void SetPriorPdf(RooAbsPdf& pdf) { fPriorPdf = &pdf; }
// specify the parameters of interest in the interval // specify the parameters of interest in the interval
virtual void SetParameters(const RooArgSet& set) { fPOI.removeAll(); fPOI.add(set); } virtual void SetParameters(const RooArgSet& set) { fPOI.removeAll(); fPOI.add(set); }
// specify the parameters to store in the Markov chain
// By default all the parameters are stored
virtual void SetChainParameters(const RooArgSet & set) { fChainParams
.removeAll(); fChainParams.add(set); }
// specify the nuisance parameters (eg. the rest of the parameters) // specify the nuisance parameters (eg. the rest of the parameters)
virtual void SetNuisanceParameters(const RooArgSet& set) {fNuisParams .removeAll(); fNuisParams.add(set);} virtual void SetNuisanceParameters(const RooArgSet& set) {fNuisParams .removeAll(); fNuisParams.add(set);}
// set the size of the test (rate of Type I error) ( Eg. 0.05 for a 9 5% Confidence Interval) // set the size of the test (rate of Type I error) ( Eg. 0.05 for a 9 5% Confidence Interval)
virtual void SetTestSize(Double_t size) {fSize = size;} virtual void SetTestSize(Double_t size) {fSize = size;}
// set the confidence level for the interval (eg. 0.95 for a 95% Conf idence Interval) // set the confidence level for the interval (eg. 0.95 for a 95% Conf idence Interval)
virtual void SetConfidenceLevel(Double_t cl) {fSize = 1.-cl;} virtual void SetConfidenceLevel(Double_t cl) {fSize = 1.-cl;}
// set the proposal function for suggesting new points for the MCMC // set the proposal function for suggesting new points for the MCMC
skipping to change at line 175 skipping to change at line 179
<< "negative delta value" << endl; << "negative delta value" << endl;
else else
fDelta = delta; fDelta = delta;
} }
protected: protected:
Double_t fSize; // size of the test (eg. specified rate of Type I e rror) Double_t fSize; // size of the test (eg. specified rate of Type I e rror)
RooArgSet fPOI; // parameters of interest for interval RooArgSet fPOI; // parameters of interest for interval
RooArgSet fNuisParams; // nuisance parameters for interval (not rea lly used) RooArgSet fNuisParams; // nuisance parameters for interval (not rea lly used)
RooArgSet fChainParams; // parameters to store in the chain (if not specified they are all of them )
mutable ProposalFunction* fPropFunc; // Proposal function for MCMC in tegration mutable ProposalFunction* fPropFunc; // Proposal function for MCMC in tegration
RooAbsPdf * fPdf; // pointer to common PDF (owned by the works pace) RooAbsPdf * fPdf; // pointer to common PDF (owned by the works pace)
RooAbsPdf * fPriorPdf; // pointer to prior PDF (owned by the works pace) RooAbsPdf * fPriorPdf; // pointer to prior PDF (owned by the works pace)
RooAbsData * fData; // pointer to the data (owned by the workspac e) RooAbsData * fData; // pointer to the data (owned by the workspac e)
Int_t fNumIters; // number of iterations to run metropolis algorithm Int_t fNumIters; // number of iterations to run metropolis algorithm
Int_t fNumBurnInSteps; // number of iterations to discard as burn-in, starting from the first Int_t fNumBurnInSteps; // number of iterations to discard as burn-in, starting from the first
Int_t fNumBins; // set the number of bins to create for each Int_t fNumBins; // set the number of bins to create for each
// axis when constructing the interval // axis when constructing the interval
RooArgList * fAxes; // which variables to put on each axis RooArgList * fAxes; // which variables to put on each axis
Bool_t fUseKeys; // whether to use kernel estimation to determine int erval Bool_t fUseKeys; // whether to use kernel estimation to determine int erval
skipping to change at line 208 skipping to change at line 213
void SetBins(const RooAbsCollection& coll, Int_t numBins) const void SetBins(const RooAbsCollection& coll, Int_t numBins) const
{ {
TIterator* it = coll.createIterator(); TIterator* it = coll.createIterator();
RooAbsArg* r; RooAbsArg* r;
while ((r = (RooAbsArg*)it->Next()) != NULL) while ((r = (RooAbsArg*)it->Next()) != NULL)
if (dynamic_cast<RooRealVar*>(r)) if (dynamic_cast<RooRealVar*>(r))
((RooRealVar*)r)->setBins(numBins); ((RooRealVar*)r)->setBins(numBins);
delete it; delete it;
} }
ClassDef(MCMCCalculator,1) // Markov Chain Monte Carlo calculator for Bayesian credible intervals ClassDef(MCMCCalculator,2) // Markov Chain Monte Carlo calculator for Bayesian credible intervals
}; };
} }
#endif #endif
 End of changes. 4 change blocks. 
2 lines changed or deleted 8 lines changed or added


 MaxLikelihoodEstimateTestStat.h   MaxLikelihoodEstimateTestStat.h 
skipping to change at line 35 skipping to change at line 35
#endif #endif
#ifndef ROO_NLL_VAR #ifndef ROO_NLL_VAR
#include "RooNLLVar.h" #include "RooNLLVar.h"
#endif #endif
#include "RooFitResult.h" #include "RooFitResult.h"
#include "RooStats/TestStatistic.h" #include "RooStats/TestStatistic.h"
#include "RooAbsPdf.h" #include "RooAbsPdf.h"
#include "RooRealVar.h" #include "RooRealVar.h"
#include "RooMinimizer.h"
#include "Math/MinimizerOptions.h"
namespace RooStats { namespace RooStats {
class MaxLikelihoodEstimateTestStat: public TestStatistic { class MaxLikelihoodEstimateTestStat: public TestStatistic {
public: public:
//__________________________________ //__________________________________
MaxLikelihoodEstimateTestStat() : MaxLikelihoodEstimateTestStat() :
fPdf(NULL),fParameter(NULL), fUpperLimit(true) fPdf(NULL),fParameter(NULL), fUpperLimit(true)
{ {
// constructor // constructor
// fPdf = pdf; // fPdf = pdf;
// fParameter = parameter; // fParameter = parameter;
fMinimizer=ROOT::Math::MinimizerOptions::DefaultMinimizerType().c_st
r();
fStrategy=ROOT::Math::MinimizerOptions::DefaultStrategy();
fPrintLevel=ROOT::Math::MinimizerOptions::DefaultPrintLevel();
} }
//__________________________________ //__________________________________
MaxLikelihoodEstimateTestStat(RooAbsPdf& pdf, RooRealVar& parameter) : MaxLikelihoodEstimateTestStat(RooAbsPdf& pdf, RooRealVar& parameter) :
fPdf(&pdf),fParameter(&parameter), fUpperLimit(true) fPdf(&pdf),fParameter(&parameter), fUpperLimit(true)
{ {
// constructor // constructor
// fPdf = pdf; // fPdf = pdf;
// fParameter = parameter; // fParameter = parameter;
fMinimizer=ROOT::Math::MinimizerOptions::DefaultMinimizerType().c_st
r();
fStrategy=ROOT::Math::MinimizerOptions::DefaultStrategy();
fPrintLevel=ROOT::Math::MinimizerOptions::DefaultPrintLevel();
} }
//______________________________ //______________________________
virtual Double_t Evaluate(RooAbsData& data, RooArgSet& /*nullPOI*/) { virtual Double_t Evaluate(RooAbsData& data, RooArgSet& /*nullPOI*/) {
RooFit::MsgLevel msglevel = RooMsgService::instance().globalKillBelow() ; RooFit::MsgLevel msglevel = RooMsgService::instance().globalKillBelow() ;
RooMsgService::instance().setGlobalKillBelow(RooFit::FATAL); RooMsgService::instance().setGlobalKillBelow(RooFit::FATAL);
/* /*
// this is more straight forward, but produces a lot of messages // this is more straight forward, but produces a lot of messages
RooFitResult* res = fPdf.fitTo(data, RooFit::CloneData(kFALSE),RooFit:: Minos(0),RooFit::Hesse(false), RooFit::Save(1),RooFit::PrintLevel(-1),RooFi t::PrintEvalErrors(0)); RooFitResult* res = fPdf.fitTo(data, RooFit::CloneData(kFALSE),RooFit:: Minos(0),RooFit::Hesse(false), RooFit::Save(1),RooFit::PrintLevel(-1),RooFi t::PrintEvalErrors(0));
RooRealVar* mle = (RooRealVar*) res->floatParsFinal().find(fParameter.G etName()); RooRealVar* mle = (RooRealVar*) res->floatParsFinal().find(fParameter.G etName());
double ret = mle->getVal(); double ret = mle->getVal();
delete res; delete res;
return ret; return ret;
*/ */
RooAbsReal* nll = fPdf->createNLL(data, RooFit::CloneData(false)); RooArgSet* allParams = fPdf->getParameters(data);
RooAbsReal* profile = nll->createProfile(RooArgSet()); RooStats::RemoveConstantParameters(allParams);
profile->getVal();
RooArgSet* vars = profile->getVariables(); // need to call constrain for RooSimultaneous until stripDisconnected p
RooMsgService::instance().setGlobalKillBelow(msglevel); roblem fixed
double ret = vars->getRealValue(fParameter->GetName()); RooAbsReal* nll = (RooNLLVar*) fPdf->createNLL(data, RooFit::CloneData(
delete vars; kFALSE),RooFit::Constrain(*allParams));
delete nll;
delete profile; //RooAbsReal* nll = fPdf->createNLL(data, RooFit::CloneData(false));
return ret;
// RooAbsReal* profile = nll->createProfile(RooArgSet());
// profile->getVal();
// RooArgSet* vars = profile->getVariables();
// RooMsgService::instance().setGlobalKillBelow(msglevel);
// double ret = vars->getRealValue(fParameter->GetName());
// delete vars;
// delete nll;
// delete profile;
// return ret;
RooMinimizer minim(*nll);
minim.setStrategy(fStrategy);
//LM: RooMinimizer.setPrintLevel has +1 offset - so subtruct here -1
minim.setPrintLevel(fPrintLevel-1);
int status = -1;
// minim.optimizeConst(true);
for (int tries = 0, maxtries = 4; tries <= maxtries; ++tries) {
// status = minim.minimize(fMinimizer, ROOT::Math::MinimizerOp
tions::DefaultMinimizerAlgo().c_str());
status = minim.minimize(fMinimizer, "Minimize");
if (status == 0) {
break;
} else {
if (tries > 1) {
printf(" ----> Doing a re-scan first\n");
minim.minimize(fMinimizer,"Scan");
}
if (tries > 2) {
printf(" ----> trying with strategy = 1\n");
minim.setStrategy(1);
}
}
}
std::cout << "BEST FIT values " << std::endl;
allParams->Print("V");
RooMsgService::instance().setGlobalKillBelow(msglevel);
delete nll;
if (status != 0) return -1;
return fParameter->getVal();
} }
virtual const TString GetVarName() const { virtual const TString GetVarName() const {
TString varName = Form("Maximum Likelihood Estimate of %s",fParameter-> GetName()); TString varName = Form("Maximum Likelihood Estimate of %s",fParameter-> GetName());
return varName; return varName;
} }
virtual void PValueIsRightTail(bool isright) { fUpperLimit = isright; } virtual void PValueIsRightTail(bool isright) { fUpperLimit = isright; }
virtual bool PValueIsRightTail(void) const { return fUpperLimit; } virtual bool PValueIsRightTail(void) const { return fUpperLimit; }
private: private:
RooAbsPdf *fPdf; RooAbsPdf *fPdf;
RooRealVar *fParameter; RooRealVar *fParameter;
bool fUpperLimit; bool fUpperLimit;
TString fMinimizer;
Int_t fStrategy;
Int_t fPrintLevel;
protected: protected:
ClassDef(MaxLikelihoodEstimateTestStat,1) ClassDef(MaxLikelihoodEstimateTestStat,1)
}; };
} }
#endif #endif
 End of changes. 5 change blocks. 
10 lines changed or deleted 67 lines changed or added


 MetropolisHastings.h   MetropolisHastings.h 
// @(#)root/roostats:$Id: MetropolisHastings.h 39391 2011-05-26 09:51:59Z m oneta $ // @(#)root/roostats:$Id: MetropolisHastings.h 40961 2011-09-20 17:08:56Z m oneta $
// Authors: Kevin Belasco 17/06/2009 // Authors: Kevin Belasco 17/06/2009
// Authors: Kyle Cranmer 17/06/2009 // Authors: Kyle Cranmer 17/06/2009
/************************************************************************* /*************************************************************************
* Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. * * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
* All rights reserved. * * All rights reserved. *
* * * *
* For the licensing terms see $ROOTSYS/LICENSE. * * For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. * * For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/ *************************************************************************/
skipping to change at line 46 skipping to change at line 46
class MetropolisHastings : public TObject { class MetropolisHastings : public TObject {
public: public:
enum FunctionSign {kNegative, kPositive, kSignUnset}; enum FunctionSign {kNegative, kPositive, kSignUnset};
enum FunctionType {kRegular, kLog, kTypeUnset}; enum FunctionType {kRegular, kLog, kTypeUnset};
// default constructor // default constructor
MetropolisHastings(); MetropolisHastings();
// alternate constructor // alternate constructor
MetropolisHastings(RooAbsReal& function, RooArgSet& paramsOfInterest, MetropolisHastings(RooAbsReal& function, const RooArgSet& paramsOfInt erest,
ProposalFunction& proposalFunction, Int_t numIters); ProposalFunction& proposalFunction, Int_t numIters);
virtual ~MetropolisHastings() {} virtual ~MetropolisHastings() {}
// main purpose of MetropolisHastings - run Metropolis-Hastings // main purpose of MetropolisHastings - run Metropolis-Hastings
// algorithm to generate Markov Chain of points in the parameter spac e // algorithm to generate Markov Chain of points in the parameter spac e
virtual MarkovChain* ConstructChain(); virtual MarkovChain* ConstructChain();
// specify the parameters of interest in the interval // specify the parameters to store in the chain
// kbelasco: should clone before removing constant parameters? // if not specified all of them will be stored
virtual void SetParameters(RooArgSet& set) virtual void SetChainParameters(const RooArgSet& set)
{ fParameters = &set; RemoveConstantParameters(fParameters); } { fChainParams.removeAll(); fChainParams.add(set); RemoveConstantPa
rameters(&fChainParams); }
// specify all the parameters of interest in the interval
virtual void SetParameters(const RooArgSet& set)
{ fParameters.removeAll(); fParameters.add(set); RemoveConstantPara
meters(&fParameters); }
// set the proposal function for suggesting new points for the MCMC // set the proposal function for suggesting new points for the MCMC
virtual void SetProposalFunction(ProposalFunction& proposalFunction) virtual void SetProposalFunction(ProposalFunction& proposalFunction)
{ fPropFunc = &proposalFunction; } { fPropFunc = &proposalFunction; }
// set the number of iterations to run the metropolis algorithm // set the number of iterations to run the metropolis algorithm
virtual void SetNumIters(Int_t numIters) virtual void SetNumIters(Int_t numIters)
{ fNumIters = numIters; } { fNumIters = numIters; }
// set the number of steps in the chain to discard as burn-in, // set the number of steps in the chain to discard as burn-in,
// starting from the first // starting from the first
virtual void SetNumBurnInSteps(Int_t numBurnInSteps) virtual void SetNumBurnInSteps(Int_t numBurnInSteps)
{ fNumBurnInSteps = numBurnInSteps; } { fNumBurnInSteps = numBurnInSteps; }
// set the (likelihood) function // set the (likelihood) function
virtual void SetFunction(RooAbsReal& function) { fFunction = &functio n; } virtual void SetFunction(RooAbsReal& function) { fFunction = &functio n; }
// set the sign of the function // set the sign of the function
virtual void SetSign(enum FunctionSign sign) { fSign = sign; } virtual void SetSign(enum FunctionSign sign) { fSign = sign; }
// set the type of the function // set the type of the function
virtual void SetType(enum FunctionType type) { fType = type; } virtual void SetType(enum FunctionType type) { fType = type; }
protected: protected:
RooAbsReal* fFunction; // function that will generate likelihood valu es RooAbsReal* fFunction; // function that will generate likelihood valu es
RooArgSet* fParameters; // RooRealVars that define parameter space RooArgSet fParameters; // RooRealVars that define all parameter space
RooArgSet fChainParams; // RooRealVars that are stored in the chain
ProposalFunction* fPropFunc; // Proposal function for MCMC integratio n ProposalFunction* fPropFunc; // Proposal function for MCMC integratio n
Int_t fNumIters; // number of iterations to run metropolis algorithm Int_t fNumIters; // number of iterations to run metropolis algorithm
Int_t fNumBurnInSteps; // number of iterations to discard as burn-in, starting from the first Int_t fNumBurnInSteps; // number of iterations to discard as burn-in, starting from the first
enum FunctionSign fSign; // whether the likelihood is negative (like NLL) or positive enum FunctionSign fSign; // whether the likelihood is negative (like NLL) or positive
enum FunctionType fType; // whether the likelihood is on a regular, l og, (or other) scale enum FunctionType fType; // whether the likelihood is on a regular, l og, (or other) scale
// whether we should take the step, based on the value of d, fSign, f Type // whether we should take the step, based on the value of d, fSign, f Type
virtual Bool_t ShouldTakeStep(Double_t d); virtual Bool_t ShouldTakeStep(Double_t d);
virtual Double_t CalcNLL(Double_t xL); virtual Double_t CalcNLL(Double_t xL);
ClassDef(MetropolisHastings,1) // Markov Chain Monte Carlo calculator for Bayesian credible intervals ClassDef(MetropolisHastings,2) // Markov Chain Monte Carlo calculator for Bayesian credible intervals
}; };
} }
#endif #endif
 End of changes. 5 change blocks. 
8 lines changed or deleted 14 lines changed or added


 ProfileLikelihoodTestStat.h   ProfileLikelihoodTestStat.h 
// @(#)root/roostats:$Id: ProfileLikelihoodTestStat.h 40567 2011-08-11 16:3 1:47Z moneta $ // @(#)root/roostats:$Id: ProfileLikelihoodTestStat.h 40937 2011-09-19 16:1 6:56Z moneta $
// Author: Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke // Author: Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke
// Additional Contributions: Giovanni Petrucciani // Additional Contributions: Giovanni Petrucciani
/************************************************************************* /*************************************************************************
* Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. * * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
* All rights reserved. * * All rights reserved. *
* * * *
* For the licensing terms see $ROOTSYS/LICENSE. * * For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. * * For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/ *************************************************************************/
skipping to change at line 120 skipping to change at line 120
//paramsOfInterest.getRealValue(firstPOI->GetName()); //paramsOfInterest.getRealValue(firstPOI->GetName());
RooFit::MsgLevel msglevel = RooMsgService::instance().globalKillBelo w(); RooFit::MsgLevel msglevel = RooMsgService::instance().globalKillBelo w();
RooMsgService::instance().setGlobalKillBelow(RooFit::FATAL); RooMsgService::instance().setGlobalKillBelow(RooFit::FATAL);
// simple // simple
Bool_t reuse=(fReuseNll || fgAlwaysReuseNll) ; Bool_t reuse=(fReuseNll || fgAlwaysReuseNll) ;
Bool_t created(kFALSE) ; Bool_t created(kFALSE) ;
if (!reuse || fNll==0) { if (!reuse || fNll==0) {
RooArgSet* allParams = fPdf->getParameters(data); RooArgSet* allParams = fPdf->getParameters(data);
RooStats::RemoveConstantParameters(allParams); RooStats::RemoveConstantParameters(allParams);
// need to call constrain for RooSimultaneous until stripDisconnect // need to call constrain for RooSimultaneous until stripDisconne
ed problem fixed cted problem fixed
fNll = (RooNLLVar*) fPdf->createNLL(data, RooFit::CloneData(kFALSE) fNll = (RooNLLVar*) fPdf->createNLL(data, RooFit::CloneData(kFALS
,RooFit::Constrain(*allParams)); E),RooFit::Constrain(*allParams));
// fNll = (RooNLLVar*) fPdf->createNLL(data, RooFit::CloneData // fNll = (RooNLLVar*) fPdf->createNLL(data, RooFit::CloneData
(kFALSE)); (kFALSE));
// fProfile = (RooProfileLL*) fNll->createProfile(paramsOfInte // fProfile = (RooProfileLL*) fNll->createProfile(paramsOfInte
rest); rest);
created = kTRUE ; created = kTRUE ;
//cout << "creating profile LL " << fNll << " " << fProfile << " da delete allParams;
ta = " << &data << endl ; //cout << "creating profile LL " << fNll << " " << fProfile << "
data = " << &data << endl ;
} }
if (reuse && !created) { if (reuse && !created) {
//cout << "reusing profile LL " << fNll << " new data = " << &data //cout << "reusing profile LL " << fNll << " new data = " << &dat
<< endl ; a << endl ;
fNll->setData(data,kFALSE) ; fNll->setData(data,kFALSE) ;
// if (fProfile) delete fProfile ; // if (fProfile) delete fProfile ;
// fProfile = (RooProfileLL*) fNll->createProfile(paramsOfInte // fProfile = (RooProfileLL*) fNll->createProfile(paramsOfInte
rest) ; rest) ;
//fProfile->clearAbsMin() ; //fProfile->clearAbsMin() ;
} }
// make sure we set the variables attached to this nll // make sure we set the variables attached to this nll
RooArgSet* attachedSet = fNll->getVariables(); RooArgSet* attachedSet = fNll->getVariables();
*attachedSet = paramsOfInterest; *attachedSet = paramsOfInterest;
RooArgSet* origAttachedSet = (RooArgSet*) attachedSet->snapshot(); RooArgSet* origAttachedSet = (RooArgSet*) attachedSet->snapshot();
//////////////////////////////////////////////////////////////////// /// //////////////////////////////////////////////////////////////////// ///
// Main profiling version as of 5.30 // Main profiling version as of 5.30
skipping to change at line 205 skipping to change at line 206
double uncondML = GetMinNLL(statusD); double uncondML = GetMinNLL(statusD);
*/ */
// other order // other order
// get the numerator // get the numerator
RooArgSet* snap = (RooArgSet*)paramsOfInterest.snapshot(); RooArgSet* snap = (RooArgSet*)paramsOfInterest.snapshot();
// get the denominator // get the denominator
int statusD; int statusD;
double uncondML = GetMinNLL(statusD); double uncondML = GetMinNLL(statusD);
// cout <<" reestablish snapshot"<<endl; // get best fit value for one-sided interval
*attachedSet = *snap; double fit_favored_mu = attachedSet->getRealValue(firstPOI->GetName(
)) ;
TIterator* it = paramsOfInterest.createIterator(); double ret = 0;
RooRealVar* tmpPar = NULL, *tmpParA=NULL; int statusN = 0;
while((tmpPar = (RooRealVar*)it->Next())){
tmpParA = ((RooRealVar*)attachedSet->find(tmpPar->GetName()));
tmpParA->setConstant();
}
int statusN;
double condML = GetMinNLL(statusN);
*attachedSet = *origAttachedSet;
double ret=condML-uncondML;; // do the conditional ML (the numerator) only when fit value is smal
ler than test value
if (!fOneSided || fit_favored_mu <= initial_mu_value) {
if(fOneSided){ // cout <<" reestablish snapshot"<<endl;
// double fit_favored_mu = ((RooProfileLL*) fProfile)->bestFit *attachedSet = *snap;
Obs().getRealValue(firstPOI->GetName()) ;
double fit_favored_mu = attachedSet->getRealValue(firstPOI->GetName // in case no nuisance parameters are present
()) ; // no need to minimize just evaluate the nll
double condML = 0;
// set the POI to constant
RooLinkedListIter it = paramsOfInterest.iterator();
RooRealVar* tmpPar = NULL, *tmpParA=NULL;
while((tmpPar = (RooRealVar*)it.Next())){
tmpParA = ((RooRealVar*)attachedSet->find(tmpPar->GetName()))
;
tmpParA->setConstant();
}
// check if there are non-const parameters so it is worth to do t
he minimization
RooArgSet allParams(*attachedSet);
RooStats::RemoveConstantParameters(&allParams);
if (allParams.getSize() == 0 ) {
condML = fNll->getVal();
}
else {
condML = GetMinNLL(statusN);
}
if( fit_favored_mu > initial_mu_value) ret=condML-uncondML;
ret = 0 ;
} }
// need to restore the values ?
*attachedSet = *origAttachedSet;
delete attachedSet; delete attachedSet;
delete origAttachedSet; delete origAttachedSet;
delete snap; delete snap;
delete it;
if (!reuse) { if (!reuse) {
delete fNll; delete fNll;
fNll = 0; fNll = 0;
// delete fProfile; // delete fProfile;
fProfile = 0 ; fProfile = 0 ;
} }
RooMsgService::instance().setGlobalKillBelow(msglevel); RooMsgService::instance().setGlobalKillBelow(msglevel);
 End of changes. 12 change blocks. 
42 lines changed or deleted 62 lines changed or added


 RConfigOptions.h   RConfigOptions.h 
#ifndef ROOT_RConfigOptions #ifndef ROOT_RConfigOptions
#define ROOT_RConfigOptions #define ROOT_RConfigOptions
#define R__CONFIGUREOPTIONS "QTDIR=/afs/cern.ch/sw/lcg/external/qt/4.6.3p 2/i686-slc5-gcc43-opt PYTHONDIR=/afs/cern.ch/sw/lcg/external/Python/2.6.5/i 686-slc5-gcc43-opt linux --fail-on-missing --enable-builtin-pcre --enable-c intex --enable-explicitlink --enable-gdml --enable-genvector --enable-krb5 --enable-mathmore --enable-minuit2 --enable-mysql --enable-oracle --enable- python --enable-qt --enable-qtgsi --enable-reflex --enable-roofit --enable- table --enable-unuran --with-castor-incdir=/afs/cern.ch/sw/lcg/external/cas tor/2.1.8-10/i686-slc5-gcc43-opt/usr/include/shift --with-castor-libdir=/af s/cern.ch/sw/lcg/external/castor/2.1.8-10/i686-slc5-gcc43-opt/usr/lib --wit h-cern-libdir=/afs/cern.ch/sw/lcg/external/cernlib/2006a/i686-slc5-gcc43-op t/lib --with-dcap-libdir=/afs/cern.ch/sw/lcg/external/dcache_client/1.9.3p1 /i686-slc5-gcc43-opt/dcap/lib --with-dcap-incdir=/afs/cern.ch/sw/lcg/extern al/dcache_client/1.9.3p1/i686-slc5-gcc43-opt/dcap/include --with-fftw3-incd ir=/afs/cern.ch/sw/lcg/external/fftw3/3.1.2/i686-slc5-gcc43-opt/include --w ith-fftw3-libdir=/afs/cern.ch/sw/lcg/external/fftw3/3.1.2/i686-slc5-gcc43-o pt/lib --with-gccxml=/afs/cern.ch/sw/lcg/external/gccxml/0.9.0_20100114/i68 6-slc5-gcc43-opt/bin --with-gfal-libdir=/afs/cern.ch/sw/lcg/external/Grid/g fal/1.11.8-2/i686-slc5-gcc43-opt/lib --with-gfal-incdir=/afs/cern.ch/sw/lcg /external/Grid/gfal/1.11.8-2/i686-slc5-gcc43-opt/include --with-gsl-incdir= /afs/cern.ch/sw/lcg/external/GSL/1.10/i686-slc5-gcc43-opt/include --with-gs l-libdir=/afs/cern.ch/sw/lcg/external/GSL/1.10/i686-slc5-gcc43-opt/lib --wi th-mysql-incdir=/afs/cern.ch/sw/lcg/external/mysql/5.1.45/i686-slc5-gcc43-o pt/include/mysql --with-mysql-libdir=/afs/cern.ch/sw/lcg/external/mysql/5.1 .45/i686-slc5-gcc43-opt/lib/mysql --with-oracle-incdir=/afs/cern.ch/sw/lcg/ external/oracle/11.2.0.1.0p2/i686-slc5-gcc43-opt/include --with-oracle-libd ir=/afs/cern.ch/sw/lcg/external/oracle/11.2.0.1.0p2/i686-slc5-gcc43-opt/lib --with-rfio-incdir=/afs/cern.ch/sw/lcg/external/castor/2.1.8-10/i686-slc5- gcc43-opt/usr/include/shift --with-rfio-libdir=/afs/cern.ch/sw/lcg/external /castor/2.1.8-10/i686-slc5-gcc43-opt/usr/lib --with-pythia6-libdir=/afs/cer n.ch/sw/lcg/external/MCGenerators/pythia6/424.2/i686-slc5-gcc43-opt/lib --w ith-pythia8-incdir=/afs/cern.ch/sw/lcg/external/MCGenerators/pythia8/145/i6 86-slc5-gcc43-opt/include --with-pythia8-libdir=/afs/cern.ch/sw/lcg/externa l/MCGenerators/pythia8/145/i686-slc5-gcc43-opt/lib --with-gviz-incdir=/afs/ cern.ch/sw/lcg/external/graphviz/2.24.0/i686-slc5-gcc43-opt/include/graphvi z --with-gviz-libdir=/afs/cern.ch/sw/lcg/external/graphviz/2.24.0/i686-slc5 -gcc43-opt/lib" #define R__CONFIGUREOPTIONS "QTDIR=/afs/cern.ch/sw/lcg/external/qt/4.6.3p 2/i686-slc5-gcc43-opt PYTHONDIR=/afs/cern.ch/sw/lcg/external/Python/2.6.5/i 686-slc5-gcc43-opt linux --fail-on-missing --enable-builtin-pcre --enable-c intex --enable-explicitlink --enable-gdml --enable-genvector --enable-krb5 --enable-mathmore --enable-minuit2 --enable-mysql --enable-oracle --enable- python --enable-qt --enable-qtgsi --enable-reflex --enable-roofit --enable- table --enable-unuran --with-castor-incdir=/afs/cern.ch/sw/lcg/external/cas tor/2.1.8-10/i686-slc5-gcc43-opt/usr/include/shift --with-castor-libdir=/af s/cern.ch/sw/lcg/external/castor/2.1.8-10/i686-slc5-gcc43-opt/usr/lib --wit h-cern-libdir=/afs/cern.ch/sw/lcg/external/cernlib/2006a/i686-slc5-gcc43-op t/lib --with-dcap-libdir=/afs/cern.ch/sw/lcg/external/dcache_client/1.9.3p1 /i686-slc5-gcc43-opt/dcap/lib --with-dcap-incdir=/afs/cern.ch/sw/lcg/extern al/dcache_client/1.9.3p1/i686-slc5-gcc43-opt/dcap/include --with-fftw3-incd ir=/afs/cern.ch/sw/lcg/external/fftw3/3.1.2/i686-slc5-gcc43-opt/include --w ith-fftw3-libdir=/afs/cern.ch/sw/lcg/external/fftw3/3.1.2/i686-slc5-gcc43-o pt/lib --with-gccxml=/afs/cern.ch/sw/lcg/external/gccxml/0.9.0_20100114/i68 6-slc5-gcc43-opt/bin --with-gfal-libdir=/afs/cern.ch/sw/lcg/external/Grid/g fal/1.11.8-2/i686-slc5-gcc43-opt/lib --with-gfal-incdir=/afs/cern.ch/sw/lcg /external/Grid/gfal/1.11.8-2/i686-slc5-gcc43-opt/include --with-gsl-incdir= /afs/cern.ch/sw/lcg/external/GSL/1.10/i686-slc5-gcc43-opt/include --with-gs l-libdir=/afs/cern.ch/sw/lcg/external/GSL/1.10/i686-slc5-gcc43-opt/lib --wi th-mysql-incdir=/afs/cern.ch/sw/lcg/external/mysql/5.1.45/i686-slc5-gcc43-o pt/include/mysql --with-mysql-libdir=/afs/cern.ch/sw/lcg/external/mysql/5.1 .45/i686-slc5-gcc43-opt/lib/mysql --with-oracle-incdir=/afs/cern.ch/sw/lcg/ external/oracle/11.2.0.1.0p3/i686-slc5-gcc43-opt/include --with-oracle-libd ir=/afs/cern.ch/sw/lcg/external/oracle/11.2.0.1.0p3/i686-slc5-gcc43-opt/lib --with-rfio-incdir=/afs/cern.ch/sw/lcg/external/castor/2.1.8-10/i686-slc5- gcc43-opt/usr/include/shift --with-rfio-libdir=/afs/cern.ch/sw/lcg/external /castor/2.1.8-10/i686-slc5-gcc43-opt/usr/lib --with-pythia6-libdir=/afs/cer n.ch/sw/lcg/external/MCGenerators/pythia6/424.2/i686-slc5-gcc43-opt/lib --w ith-pythia8-incdir=/afs/cern.ch/sw/lcg/external/MCGenerators/pythia8/145/i6 86-slc5-gcc43-opt/include --with-pythia8-libdir=/afs/cern.ch/sw/lcg/externa l/MCGenerators/pythia8/145/i686-slc5-gcc43-opt/lib --with-gviz-incdir=/afs/ cern.ch/sw/lcg/external/graphviz/2.24.0/i686-slc5-gcc43-opt/include/graphvi z --with-gviz-libdir=/afs/cern.ch/sw/lcg/external/graphviz/2.24.0/i686-slc5 -gcc43-opt/lib"
#define R__CONFIGUREFEATURES "asimage astiff builtin_afterimage builtin_ft gl builtin_glew builtin_pcre builtin_lzma castor cintex dcache exceptions e xplicitlink fftw3 gviz gdml genvector gfal krb5 ldap mathmore memstat minui t2 mysql opengl oracle pythia8 python qt qtgsi reflex roofit rfio shadowpw shared ssl table tmva unuran x11 xft xml xrootd thread" #define R__CONFIGUREFEATURES "asimage astiff builtin_afterimage builtin_ft gl builtin_glew builtin_pcre builtin_lzma castor cintex dcache exceptions e xplicitlink fftw3 gviz gdml genvector gfal krb5 ldap mathmore memstat minui t2 mysql opengl oracle pythia8 python qt qtgsi reflex roofit rfio shadowpw shared ssl table tmva unuran x11 xft xml xrootd thread"
#endif #endif
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 RVersion.h   RVersion.h 
skipping to change at line 17 skipping to change at line 17
* These macros can be used in the following way: * These macros can be used in the following way:
* *
* #if ROOT_VERSION_CODE >= ROOT_VERSION(2,23,4) * #if ROOT_VERSION_CODE >= ROOT_VERSION(2,23,4)
* #include <newheader.h> * #include <newheader.h>
* #else * #else
* #include <oldheader.h> * #include <oldheader.h>
* #endif * #endif
* *
*/ */
#define ROOT_RELEASE "5.30/01" #define ROOT_RELEASE "5.30/02"
#define ROOT_RELEASE_DATE "Aug 8 2011" #define ROOT_RELEASE_DATE "Sep 21 2011"
#define ROOT_RELEASE_TIME "12:34:39" #define ROOT_RELEASE_TIME "16:42:14"
#define ROOT_SVN_REVISION 40484 #define ROOT_SVN_REVISION 40964
#define ROOT_SVN_BRANCH "branches/v5-30-00-patches" #define ROOT_SVN_BRANCH "branches/v5-30-00-patches"
#define ROOT_VERSION_CODE 335361 #define ROOT_VERSION_CODE 335362
#define ROOT_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) #define ROOT_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
#endif #endif
 End of changes. 2 change blocks. 
5 lines changed or deleted 5 lines changed or added


 RooStatsUtils.h   RooStatsUtils.h 
// @(#)root/roostats:$Id: RooStatsUtils.h 39391 2011-05-26 09:51:59Z moneta $ // @(#)root/roostats:$Id: RooStatsUtils.h 40937 2011-09-19 16:16:56Z moneta $
// Author: Kyle Cranmer 28/07/2008 // Author: Kyle Cranmer 28/07/2008
/************************************************************************* /*************************************************************************
* Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. * * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
* All rights reserved. * * All rights reserved. *
* * * *
* For the licensing terms see $ROOTSYS/LICENSE. * * For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. * * For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/ *************************************************************************/
skipping to change at line 49 skipping to change at line 49
inline Double_t SignificanceToPValue(Double_t Z){ inline Double_t SignificanceToPValue(Double_t Z){
return ::ROOT::Math::normal_cdf_c(Z); return ::ROOT::Math::normal_cdf_c(Z);
} }
inline void SetParameters(const RooArgSet* desiredVals, RooArgSet* params ToChange){ inline void SetParameters(const RooArgSet* desiredVals, RooArgSet* params ToChange){
*paramsToChange=*desiredVals ; *paramsToChange=*desiredVals ;
} }
inline void RemoveConstantParameters(RooArgSet* set){ inline void RemoveConstantParameters(RooArgSet* set){
RooArgSet constSet; RooArgSet constSet;
TIter it = set->createIterator(); RooLinkedListIter it = set->iterator();
RooRealVar *myarg; RooRealVar *myarg;
while ((myarg = (RooRealVar *)it.Next())) { while ((myarg = (RooRealVar *)it.Next())) {
if(myarg->isConstant()) constSet.add(*myarg); if(myarg->isConstant()) constSet.add(*myarg);
} }
set->remove(constSet); set->remove(constSet);
} }
// assuming all values in set are RooRealVars, randomize their values // assuming all values in set are RooRealVars, randomize their values
inline void RandomizeCollection(RooAbsCollection& set, inline void RandomizeCollection(RooAbsCollection& set,
Bool_t randomizeConstants = kTRUE) Bool_t randomizeConstants = kTRUE)
{ {
TIterator* it = set.createIterator(); RooLinkedListIter it = set.iterator();
RooRealVar* var; RooRealVar* var;
while ((var = (RooRealVar*)it->Next()) != NULL) // repeat loop tpo avoid calling isConstant for nothing
if (!var->isConstant() || randomizeConstants) if (randomizeConstants) {
while ((var = (RooRealVar*)it.Next()) != NULL)
var->randomize(); var->randomize();
}
else {
// exclude constants variables
while ((var = (RooRealVar*)it.Next()) != NULL)
if (!var->isConstant() )
var->randomize();
}
delete it;
} }
} }
#endif #endif
 End of changes. 6 change blocks. 
6 lines changed or deleted 13 lines changed or added


 SamplingDistribution.h   SamplingDistribution.h 
// @(#)root/roostats:$Id: SamplingDistribution.h 39391 2011-05-26 09:51:59Z moneta $ // @(#)root/roostats:$Id: SamplingDistribution.h 40937 2011-09-19 16:16:56Z moneta $
/************************************************************************* /*************************************************************************
* Project: RooStats * * Project: RooStats *
* Package: RooFit/RooStats * * Package: RooFit/RooStats *
* Authors: * * Authors: *
* Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke * * Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke *
************************************************************************* *************************************************************************
* Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. * * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
* All rights reserved. * * All rights reserved. *
* * * *
skipping to change at line 83 skipping to change at line 83
Double_t Integral(Double_t low, Double_t high, Bool_t normalize = kTRUE , Bool_t lowClosed = kTRUE, Bool_t highClosed = kFALSE) const; Double_t Integral(Double_t low, Double_t high, Bool_t normalize = kTRUE , Bool_t lowClosed = kTRUE, Bool_t highClosed = kFALSE) const;
// numerical integral in these limits including error estimation // numerical integral in these limits including error estimation
Double_t IntegralAndError(Double_t & error, Double_t low, Double_t high , Bool_t normalize = kTRUE, Double_t IntegralAndError(Double_t & error, Double_t low, Double_t high , Bool_t normalize = kTRUE,
Bool_t lowClosed = kTRUE, Bool_t highClosed = kFALSE) const; Bool_t lowClosed = kTRUE, Bool_t highClosed = kFALSE) const;
// calculate CDF as a special case of Integral(...) with lower limit eq ual to -inf // calculate CDF as a special case of Integral(...) with lower limit eq ual to -inf
Double_t CDF(Double_t x) const; Double_t CDF(Double_t x) const;
private: private:
std::vector<Double_t> fSamplingDist; // vector of points for the sampli
ng distribution mutable std::vector<Double_t> fSamplingDist; // vector of points for th
std::vector<Double_t> fSampleWeights; // vector of weights for the samp e sampling distribution
les mutable std::vector<Double_t> fSampleWeights; // vector of weights for
the samples
// store a RooRealVar that this distribution corresponds to? // store a RooRealVar that this distribution corresponds to?
TString fVarName; TString fVarName;
mutable std::vector<Double_t> fSumW; //! Chached vector with sum of t
he weight used to compute integral
mutable std::vector<Double_t> fSumW2; //! Chached vector with sum of t
he weight used to compute integral error
protected: protected:
ClassDef(SamplingDistribution,1) // Class containing the results of th // internal function to sort values
e HybridCalculator void SortValues() const;
ClassDef(SamplingDistribution,2) // Class containing the results of th
e HybridCalculator
}; };
} }
#endif #endif
 End of changes. 4 change blocks. 
7 lines changed or deleted 16 lines changed or added


 TProofBench.h   TProofBench.h 
// @(#)root/proofx:$Id: TProofBench.h 39090 2011-05-04 12:02:21Z ganis $ // @(#)root/proofx:$Id: TProofBench.h 40802 2011-09-05 09:51:55Z ganis $
/************************************************************************* /*************************************************************************
* Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. * * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
* All rights reserved. * * All rights reserved. *
* * * *
* For the licensing terms see $ROOTSYS/LICENSE. * * For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. * * For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/ *************************************************************************/
#ifndef ROOT_TProofBench #ifndef ROOT_TProofBench
#define ROOT_TProofBench #define ROOT_TProofBench
skipping to change at line 98 skipping to change at line 98
const char *GetOutFileName() const { return fOutFileName; } const char *GetOutFileName() const { return fOutFileName; }
void SetNTries(Int_t nt) { if (nt > 0) fNtries = nt; } void SetNTries(Int_t nt) { if (nt > 0) fNtries = nt; }
void SetHistType(TPBHistType *histtype) { fHistType = histtype; } void SetHistType(TPBHistType *histtype) { fHistType = histtype; }
void SetNHist(Int_t nh) { fNHist = nh; } void SetNHist(Int_t nh) { fNHist = nh; }
void SetReadType(TPBReadType *readtype) { fReadType = readtype; } void SetReadType(TPBReadType *readtype) { fReadType = readtype; }
void SetCPUSel(const char *sel) { fCPUSel = sel; } void SetCPUSel(const char *sel) { fCPUSel = sel; }
void SetCPUPar(const char *par) { fCPUPar = par; } void SetCPUPar(const char *par) { fCPUPar = par; }
void SetDataSel(const char *sel) { fDataSel = sel; } void SetDataSel(const char *sel) { fDataSel = sel; }
void SetDataPar(const char *par) { fDataPar = par; } void SetDataPar(const char *par) { fDataPar = par; }
void SetDataGetSel(const char *sel) { fDataGenSel = sel; } void SetDataGenSel(const char *sel) { fDataGenSel = sel; }
void SetDataGetPar(const char *par) { fDataGenPar = par; } void SetDataGenPar(const char *par) { fDataGenPar = par; }
void SetProofDS(TProof *p); void SetProofDS(TProof *p);
void SetDebug(Bool_t debug = kTRUE) { fDebug = debug; } void SetDebug(Bool_t debug = kTRUE) { fDebug = debug; }
Bool_t GetDebug() { return fDebug; } Bool_t GetDebug() { return fDebug; }
static void DrawCPU(const char *outfile, const char *opt = "std:"); static void DrawCPU(const char *outfile, const char *opt = "std:");
static void DrawDataSet(const char *outfile, const char *opt = "std:", c onst char *type = "mbs"); static void DrawDataSet(const char *outfile, const char *opt = "std:", c onst char *type = "mbs");
 End of changes. 2 change blocks. 
3 lines changed or deleted 3 lines changed or added


 TProofBenchTypes.h   TProofBenchTypes.h 
// @(#)root/proof:$Id: TProofBenchTypes.h 38114 2011-02-17 13:14:50Z rdm $ // @(#)root/proof:$Id: TProofBenchTypes.h 40802 2011-09-05 09:51:55Z ganis $
/************************************************************************* /*************************************************************************
* Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. * * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
* All rights reserved. * * All rights reserved. *
* * * *
* For the licensing terms see $ROOTSYS/LICENSE. * * For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. * * For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/ *************************************************************************/
#ifndef ROOT_TProofBenchTypes #ifndef ROOT_TProofBenchTypes
#define ROOT_TProofBenchTypes #define ROOT_TProofBenchTypes
skipping to change at line 28 skipping to change at line 28
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
#ifndef ROOT_TObject #ifndef ROOT_TObject
#include "TObject.h" #include "TObject.h"
#endif #endif
#ifndef ROOT_TString #ifndef ROOT_TString
#include "TString.h" #include "TString.h"
#endif #endif
const char* const kPROOF_BenchCPUSelPar = "ProofBenchCPUSel"; // PAR with bench CPU selectors const char* const kPROOF_BenchCPUSelPar = "ProofBenchCPUSel"; // PAR with bench CPU selectors
const char* const kPROOF_BenchDataSelPar = "ProofBenchDataSel"; // PAR wit h bench data selectors const char* const kPROOF_BenchDataSelPar = "ProofBenchDataSel"; // PAR wit h bench data selectors
const char* const kPROOF_BenchParDir = "proof/proofbench/"; // Dir wit h ProofBench Par files (under 'etc')
const char* const kPROOF_BenchSrcDir = "proof/proofbench/src/"; // Dir with ProofBench Src files const char* const kPROOF_BenchSrcDir = "proof/proofbench/src/"; // Dir with ProofBench Src files
const char* const kPROOF_BenchIncDir = "proof/proofbench/inc/"; // Dir with ProofBench Inc files const char* const kPROOF_BenchIncDir = "proof/proofbench/inc/"; // Dir with ProofBench Inc files
const char* const kPROOF_BenchSelCPUDef = "TSelHist"; // default CPU sel ector const char* const kPROOF_BenchSelCPUDef = "TSelHist"; // default CPU sel ector
const char* const kPROOF_BenchSelDataDef = "TSelEvent"; // default Data Re ad selector const char* const kPROOF_BenchSelDataDef = "TSelEvent"; // default Data Re ad selector
const char* const kPROOF_BenchSelDataGenDef = "TSelEventGen"; // default D ata generator selector const char* const kPROOF_BenchSelDataGenDef = "TSelEventGen"; // default D ata generator selector
class TPBReadType : public TObject { class TPBReadType : public TObject {
public: public:
enum EReadType { enum EReadType {
kReadNotSpecified = 0, //read type not specified kReadNotSpecified = 0, //read type not specified
 End of changes. 2 change blocks. 
1 lines changed or deleted 2 lines changed or added


 TSchemaRuleProcessor.h   TSchemaRuleProcessor.h 
// @(#)root/core:$Id: TSchemaRuleProcessor.h 34641 2010-07-28 18:12:36Z pca nal $ // @(#)root/core:$Id: TSchemaRuleProcessor.h 40664 2011-08-22 22:59:25Z pca nal $
// author: Lukasz Janyst <ljanyst@cern.ch> // author: Lukasz Janyst <ljanyst@cern.ch>
#ifndef ROOT_TSchemaRuleProcessor #ifndef ROOT_TSchemaRuleProcessor
#define ROOT_TSchemaRuleProcessor #define ROOT_TSchemaRuleProcessor
#if !defined(__CINT__) #if !defined(__CINT__)
// Do no clutter the dictionary (in particular with STL containers) // Do no clutter the dictionary (in particular with STL containers)
#include <stdlib.h> #include <stdlib.h>
#include <string> #include <string>
skipping to change at line 91 skipping to change at line 91
} }
else size = curr-last; else size = curr-last;
// Extra spaces. // Extra spaces.
elem = Trim( source.substr( last, size ) ); elem = Trim( source.substr( last, size ) );
if( !elem.empty() ) { if( !elem.empty() ) {
unsigned int level = 0; unsigned int level = 0;
// Split between the typename and the membername // Split between the typename and the membername
// Take in consideration template names. // Take in consideration template names.
for(std::string::size_type i=0; i<elem.size(); ++i) { for(std::string::size_type j=elem.size(); j>0; --j) {
if (elem[i]=='<') { ++level; } std::string::size_type i = j-1;
else if (elem[i]=='>') { --level; } if (elem[i]=='<') { --level; }
else if (elem[i]=='>') { ++level; }
else if (level == 0 && isspace(elem[i])) { else if (level == 0 && isspace(elem[i])) {
type = elem.substr( 0, i ); type = elem.substr( 0, i );
// At the first iteration we know we have a space. // At the first iteration we know we have a space.
while( elem[i]=='*' || elem[i]=='&' || isspace(elem [i]) ) { while( elem[i]=='*' || elem[i]=='&' || isspace(elem [i]) ) {
++i; ++i;
if (strcmp("const",elem.c_str()+i)==0 && (i+5)>e lem.size() if (strcmp("const",elem.c_str()+i)==0 && (i+5)>e lem.size()
&& ( elem[i+5]=='*' || elem[i+5]=='&' || iss pace(elem[i+5])) ) { && ( elem[i+5]=='*' || elem[i+5]=='&' || iss pace(elem[i+5])) ) {
i += 5; i += 5;
type += "const "; type += "const ";
} else if (elem[i]=='*' || elem[i]=='&') { } else if (elem[i]=='*' || elem[i]=='&') {
 End of changes. 2 change blocks. 
4 lines changed or deleted 5 lines changed or added


 ToyMCSampler.h   ToyMCSampler.h 
// @(#)root/roostats:$Id: ToyMCSampler.h 40023 2011-06-27 16:58:44Z moneta $ // @(#)root/roostats:$Id: ToyMCSampler.h 40961 2011-09-20 17:08:56Z moneta $
// Author: Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke // Author: Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke
// Additions and modifications by Mario Pelliccioni // Additions and modifications by Mario Pelliccioni
/************************************************************************* /*************************************************************************
* Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. * * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
* All rights reserved. * * All rights reserved. *
* * * *
* For the licensing terms see $ROOTSYS/LICENSE. * * For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. * * For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/ *************************************************************************/
skipping to change at line 206 skipping to change at line 206
// Forces n events even for extended PDFs. Set NEvents=0 to // Forces n events even for extended PDFs. Set NEvents=0 to
// use the Poisson distributed events from the extended PDF. // use the Poisson distributed events from the extended PDF.
fNEvents = nevents; fNEvents = nevents;
} }
// specify the values of parameters used when evaluating test statist ic // specify the values of parameters used when evaluating test statist ic
virtual void SetParametersForTestStat(const RooArgSet& nullpoi) { virtual void SetParametersForTestStat(const RooArgSet& nullpoi) {
if (fNullPOI) delete fNullPOI; fNullPOI = (RooArgSet*)nullpoi.snap shot(); if (fNullPOI) delete fNullPOI; fNullPOI = (RooArgSet*)nullpoi.snap shot();
} }
// Set the Pdf, add to the the workspace if not already there // Set the Pdf, add to the the workspace if not already there
virtual void SetPdf(RooAbsPdf& pdf) { fPdf = &pdf; } virtual void SetPdf(RooAbsPdf& pdf) { fPdf = &pdf; ClearCache(); }
// How to randomize the prior. Set to NULL to deactivate randomizatio n. // How to randomize the prior. Set to NULL to deactivate randomizatio n.
virtual void SetPriorNuisance(RooAbsPdf* pdf) { fPriorNuisance = pdf; } virtual void SetPriorNuisance(RooAbsPdf* pdf) { fPriorNuisance = pdf; }
// specify the nuisance parameters (eg. the rest of the parameters) // specify the nuisance parameters (eg. the rest of the parameters)
virtual void SetNuisanceParameters(const RooArgSet& np) { fNuisancePa rs = &np; } virtual void SetNuisanceParameters(const RooArgSet& np) { fNuisancePa rs = &np; }
// specify the observables in the dataset (needed to evaluate the tes t statistic) // specify the observables in the dataset (needed to evaluate the tes t statistic)
virtual void SetObservables(const RooArgSet& o) { fObservables = &o; } virtual void SetObservables(const RooArgSet& o) { fObservables = &o; }
// specify the conditional observables // specify the conditional observables
virtual void SetGlobalObservables(const RooArgSet& o) { fGlobalObserv ables = &o; } virtual void SetGlobalObservables(const RooArgSet& o) { fGlobalObserv ables = &o; }
// set the size of the test (rate of Type I error) ( Eg. 0.05 for a 9 5% Confidence Interval) // set the size of the test (rate of Type I error) ( Eg. 0.05 for a 9 5% Confidence Interval)
skipping to change at line 274 skipping to change at line 274
// calling with argument or NULL deactivates proof // calling with argument or NULL deactivates proof
void SetProofConfig(ProofConfig *pc = NULL) { fProofConfig = pc; } void SetProofConfig(ProofConfig *pc = NULL) { fProofConfig = pc; }
void SetProtoData(const RooDataSet* d) { fProtoData = d; } void SetProtoData(const RooDataSet* d) { fProtoData = d; }
protected: protected:
// helper for GenerateToyData // helper for GenerateToyData
RooAbsData* Generate(RooAbsPdf &pdf, RooArgSet &observables, const Ro oDataSet *protoData=NULL, int forceEvents=0) const; RooAbsData* Generate(RooAbsPdf &pdf, RooArgSet &observables, const Ro oDataSet *protoData=NULL, int forceEvents=0) const;
// helper method for clearing the cache
void ClearCache();
TestStatistic *fTestStat; // test statistic that is being sampled TestStatistic *fTestStat; // test statistic that is being sampled
RooAbsPdf *fPdf; // model RooAbsPdf *fPdf; // model
string fSamplingDistName; // name of the model string fSamplingDistName; // name of the model
RooAbsPdf *fPriorNuisance; // prior pdf for nuisance parameters RooAbsPdf *fPriorNuisance; // prior pdf for nuisance parameters
RooArgSet *fNullPOI; // parameters of interest RooArgSet *fNullPOI; // parameters of interest
const RooArgSet *fNuisancePars; const RooArgSet *fNuisancePars;
const RooArgSet *fObservables; const RooArgSet *fObservables;
const RooArgSet *fGlobalObservables; const RooArgSet *fGlobalObservables;
Int_t fNToys; // number of toys to generate Int_t fNToys; // number of toys to generate
Int_t fNEvents; // number of events per toy (may be ignored depending on settings) Int_t fNEvents; // number of events per toy (may be ignored depending on settings)
 End of changes. 3 change blocks. 
2 lines changed or deleted 5 lines changed or added


 ToyMCSamplerOld.h   ToyMCSamplerOld.h 
// @(#)root/roostats:$Id: ToyMCSamplerOld.h 40567 2011-08-11 16:31:47Z mone ta $ // @(#)root/roostats:$Id: ToyMCSamplerOld.h 40961 2011-09-20 17:08:56Z mone ta $
// Author: Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke // Author: Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke
// Additions and modifications by Mario Pelliccioni // Additions and modifications by Mario Pelliccioni
/************************************************************************* /*************************************************************************
* Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. * * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
* All rights reserved. * * All rights reserved. *
* * * *
* For the licensing terms see $ROOTSYS/LICENSE. * * For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. * * For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/ *************************************************************************/
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/