00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include "RooFit.h"
00029
00030 #include "Riostream.h"
00031 #include "Riostream.h"
00032 #include <math.h>
00033
00034 #include "RooRecursiveFraction.h"
00035 #include "RooAbsReal.h"
00036 #include "RooAbsPdf.h"
00037 #include "RooErrorHandler.h"
00038 #include "RooArgSet.h"
00039 #include "RooNLLVar.h"
00040 #include "RooChi2Var.h"
00041 #include "RooMsgService.h"
00042
00043 ClassImp(RooRecursiveFraction)
00044 ;
00045
00046
00047
00048 RooRecursiveFraction::RooRecursiveFraction()
00049 {
00050
00051 _listIter = _list.createIterator() ;
00052 }
00053
00054
00055
00056
00057 RooRecursiveFraction::RooRecursiveFraction(const char* name, const char* title, const RooArgList& fracList) :
00058 RooAbsReal(name, title),
00059 _list("list","First set of components",this)
00060 {
00061
00062 _listIter = _list.createIterator() ;
00063
00064 for (Int_t ifrac=fracList.getSize()-1 ; ifrac>=0 ; ifrac--) {
00065 RooAbsArg* comp = fracList.at(ifrac) ;
00066 if (!dynamic_cast<RooAbsReal*>(comp)) {
00067 coutE(InputArguments) << "RooRecursiveFraction::ctor(" << GetName() << ") ERROR: component " << comp->GetName()
00068 << " is not of type RooAbsReal" << endl ;
00069 RooErrorHandler::softAbort() ;
00070 }
00071 _list.add(*comp) ;
00072 }
00073 }
00074
00075
00076
00077
00078 RooRecursiveFraction::RooRecursiveFraction(const RooRecursiveFraction& other, const char* name) :
00079 RooAbsReal(other, name),
00080 _list("list",this,other._list)
00081 {
00082
00083
00084 _listIter = _list.createIterator() ;
00085 }
00086
00087
00088
00089
00090 RooRecursiveFraction::~RooRecursiveFraction()
00091 {
00092
00093
00094 if (_listIter) delete _listIter ;
00095 }
00096
00097
00098
00099
00100 Double_t RooRecursiveFraction::evaluate() const
00101 {
00102
00103
00104 RooAbsReal* comp ;
00105 const RooArgSet* nset = _list.nset() ;
00106
00107 _listIter->Reset() ;
00108 comp=(RooAbsReal*)_listIter->Next() ;
00109 Double_t prod = comp->getVal(nset) ;
00110
00111 while((comp=(RooAbsReal*)_listIter->Next())) {
00112 prod *= (1-comp->getVal(nset)) ;
00113 }
00114
00115 return prod ;
00116 }
00117