ROOT
6.10/09
Reference Guide
roofit
roofitcore
src
RooFracRemainder.cxx
Go to the documentation of this file.
1
/*****************************************************************************
2
* Project: RooFit *
3
* Package: RooFitCore *
4
* @(#)root/roofitcore:$Id$
5
* Authors: *
6
* WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7
* DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8
* *
9
* Copyright (c) 2000-2005, Regents of the University of California *
10
* and Stanford University. All rights reserved. *
11
* *
12
* Redistribution and use in source and binary forms, *
13
* with or without modification, are permitted according to the terms *
14
* listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15
*****************************************************************************/
16
17
/**
18
\file RooFracRemainder.cxx
19
\class RooFracRemainder
20
\ingroup Roofitcore
21
22
23
RooFracRemainder calculates the remainder fraction of a sum of RooAbsReal
24
fraction, i.e (1 - sum_i a_i). This class is used by RooSimWSTool to
25
as specialization of the remainder fraction term of a parameter with
26
a constrained split
27
**/
28
29
30
#include "
RooFit.h
"
31
32
#include "
Riostream.h
"
33
#include "
Riostream.h
"
34
#include <math.h>
35
36
#include "
RooFracRemainder.h
"
37
#include "
RooAbsReal.h
"
38
#include "
RooAbsPdf.h
"
39
#include "
RooErrorHandler.h
"
40
#include "
RooArgSet.h
"
41
#include "
RooMsgService.h
"
42
43
using namespace
std
;
44
45
ClassImp
(
RooFracRemainder
)
46
;
47
48
49
////////////////////////////////////////////////////////////////////////////////
50
/// Default constructor
51
52
RooFracRemainder::RooFracRemainder
()
53
{
54
_setIter1 = _set1.createIterator() ;
55
}
56
57
58
59
////////////////////////////////////////////////////////////////////////////////
60
/// Constructor with given set of input fractions. All arguments in sumSet must be of type RooAbsReal.
61
62
RooFracRemainder::RooFracRemainder
(
const
char
*
name
,
const
char
* title,
const
RooArgSet
& sumSet) :
63
RooAbsReal
(name, title),
64
_set1(
"set1"
,
"First set of components"
,this)
65
{
66
_setIter1
=
_set1
.
createIterator
() ;
67
68
TIterator
* inputIter = sumSet.
createIterator
() ;
69
RooAbsArg
* comp ;
70
while
((comp = (
RooAbsArg
*)inputIter->
Next
())) {
71
if
(!dynamic_cast<RooAbsReal*>(comp)) {
72
coutE
(
InputArguments
) <<
"RooFracRemainder::ctor("
<<
GetName
() <<
") ERROR: component "
<< comp->
GetName
()
73
<<
" is not of type RooAbsReal"
<< endl ;
74
RooErrorHandler::softAbort
() ;
75
}
76
_set1
.
add
(*comp) ;
77
}
78
79
delete
inputIter ;
80
}
81
82
83
84
85
////////////////////////////////////////////////////////////////////////////////
86
/// Copy constructor
87
88
RooFracRemainder::RooFracRemainder
(
const
RooFracRemainder
& other,
const
char
*
name
) :
89
RooAbsReal
(other, name),
90
_set1
(
"set1"
,this,other.
_set1
)
91
{
92
_setIter1
=
_set1
.
createIterator
() ;
93
94
// Member _ownedList is intentionally not copy-constructed -- ownership is not transferred
95
}
96
97
98
99
////////////////////////////////////////////////////////////////////////////////
100
/// Destructor
101
102
RooFracRemainder::~RooFracRemainder
()
103
{
104
if
(
_setIter1
)
delete
_setIter1
;
105
}
106
107
108
109
////////////////////////////////////////////////////////////////////////////////
110
/// Calculate value
111
112
Double_t
RooFracRemainder::evaluate
()
const
113
{
114
Double_t
sum
(1);
115
RooAbsReal
* comp ;
116
const
RooArgSet
* nset =
_set1
.
nset
() ;
117
118
_setIter1
->
Reset
() ;
119
120
while
((comp=(
RooAbsReal
*)
_setIter1
->
Next
())) {
121
sum -= comp->
getVal
(nset) ;
122
}
123
124
return
sum
;
125
}
126
TNamed::GetName
virtual const char * GetName() const
Returns name of object.
Definition:
TNamed.h:47
RooAbsCollection::createIterator
TIterator * createIterator(Bool_t dir=kIterForward) const
Definition:
RooAbsCollection.h:98
sum
static long int sum(long int i)
Definition:
Factory.cxx:2162
coutE
#define coutE(a)
Definition:
RooMsgService.h:34
RooErrorHandler::softAbort
static void softAbort()
Definition:
RooErrorHandler.h:30
RooArgSet.h
TIterator::Reset
virtual void Reset()=0
RooArgSet
Definition:
RooArgSet.h:26
RooAbsReal::getVal
Double_t getVal(const RooArgSet *set=0) const
Definition:
RooAbsReal.h:64
RegressionKeras.name
name
Definition:
RegressionKeras.py:30
RooFracRemainder::_setIter1
TIterator * _setIter1
Definition:
RooFracRemainder.h:38
RooMsgService.h
std
STL namespace.
TIterator
Iterator abstract base class.
Definition:
TIterator.h:30
RooFracRemainder::evaluate
Double_t evaluate() const
Iterator over set of input fractions.
Definition:
RooFracRemainder.cxx:112
RooFracRemainder::RooFracRemainder
RooFracRemainder()
Default constructor.
Definition:
RooFracRemainder.cxx:52
RooErrorHandler.h
RooAbsPdf.h
RooListProxy::add
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Reimplementation of standard RooArgList::add()
Definition:
RooListProxy.cxx:104
RooAbsProxy::nset
const RooArgSet * nset() const
Definition:
RooAbsProxy.h:46
RooFracRemainder::~RooFracRemainder
virtual ~RooFracRemainder()
Destructor.
Definition:
RooFracRemainder.cxx:102
Riostream.h
RooAbsReal.h
ClassImp
#define ClassImp(name)
Definition:
Rtypes.h:336
Double_t
double Double_t
Definition:
RtypesCore.h:55
RooAbsReal
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition:
RooAbsReal.h:53
RooFracRemainder.h
RooFracRemainder::_set1
RooListProxy _set1
Definition:
RooFracRemainder.h:37
TIterator::Next
virtual TObject * Next()=0
RooFit::InputArguments
Definition:
RooGlobalFunc.h:58
RooFit.h
RooFracRemainder
RooFracRemainder calculates the remainder fraction of a sum of RooAbsReal fraction, i.e (1 - sum_i a_i).
Definition:
RooFracRemainder.h:25
RooAbsArg
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
Definition:
RooAbsArg.h:66