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
00029 #include "RooFit.h"
00030
00031 #include "Riostream.h"
00032 #include "Riostream.h"
00033 #include <math.h>
00034
00035 #include "RooFracRemainder.h"
00036 #include "RooAbsReal.h"
00037 #include "RooAbsPdf.h"
00038 #include "RooErrorHandler.h"
00039 #include "RooArgSet.h"
00040 #include "RooMsgService.h"
00041
00042 ClassImp(RooFracRemainder)
00043 ;
00044
00045
00046
00047 RooFracRemainder::RooFracRemainder()
00048 {
00049
00050
00051 _setIter1 = _set1.createIterator() ;
00052 }
00053
00054
00055
00056
00057 RooFracRemainder::RooFracRemainder(const char* name, const char* title, const RooArgSet& sumSet) :
00058 RooAbsReal(name, title),
00059 _set1("set1","First set of components",this)
00060 {
00061
00062
00063 _setIter1 = _set1.createIterator() ;
00064
00065 TIterator* inputIter = sumSet.createIterator() ;
00066 RooAbsArg* comp ;
00067 while((comp = (RooAbsArg*)inputIter->Next())) {
00068 if (!dynamic_cast<RooAbsReal*>(comp)) {
00069 coutE(InputArguments) << "RooFracRemainder::ctor(" << GetName() << ") ERROR: component " << comp->GetName()
00070 << " is not of type RooAbsReal" << endl ;
00071 RooErrorHandler::softAbort() ;
00072 }
00073 _set1.add(*comp) ;
00074 }
00075
00076 delete inputIter ;
00077 }
00078
00079
00080
00081
00082
00083 RooFracRemainder::RooFracRemainder(const RooFracRemainder& other, const char* name) :
00084 RooAbsReal(other, name),
00085 _set1("set1",this,other._set1)
00086 {
00087
00088
00089 _setIter1 = _set1.createIterator() ;
00090
00091
00092 }
00093
00094
00095
00096
00097 RooFracRemainder::~RooFracRemainder()
00098 {
00099
00100
00101 if (_setIter1) delete _setIter1 ;
00102 }
00103
00104
00105
00106
00107 Double_t RooFracRemainder::evaluate() const
00108 {
00109
00110
00111 Double_t sum(1);
00112 RooAbsReal* comp ;
00113 const RooArgSet* nset = _set1.nset() ;
00114
00115 _setIter1->Reset() ;
00116
00117 while((comp=(RooAbsReal*)_setIter1->Next())) {
00118 sum -= comp->getVal(nset) ;
00119 }
00120
00121 return sum ;
00122 }
00123