Logo ROOT  
Reference Guide
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
23RooFracRemainder calculates the remainder fraction of a sum of RooAbsReal
24fraction, i.e (1 - sum_i a_i). This class is used by RooSimWSTool to
25as specialization of the remainder fraction term of a parameter with
26a constrained split
27**/
28
29
30#include "Riostream.h"
31#include <math.h>
32
33#include "RooFracRemainder.h"
34#include "RooAbsReal.h"
35#include "RooAbsPdf.h"
36#include "RooErrorHandler.h"
37#include "RooArgSet.h"
38#include "RooMsgService.h"
39
40using namespace std;
41
43
44
45
46////////////////////////////////////////////////////////////////////////////////
47/// Default constructor
48
50{
52}
53
54
55
56////////////////////////////////////////////////////////////////////////////////
57/// Constructor with given set of input fractions. All arguments in sumSet must be of type RooAbsReal.
58
59RooFracRemainder::RooFracRemainder(const char* name, const char* title, const RooArgSet& sumSet) :
60 RooAbsReal(name, title),
61 _set1("set1","First set of components",this)
62{
64
65 TIterator* inputIter = sumSet.createIterator() ;
66 RooAbsArg* comp ;
67 while((comp = (RooAbsArg*)inputIter->Next())) {
68 if (!dynamic_cast<RooAbsReal*>(comp)) {
69 coutE(InputArguments) << "RooFracRemainder::ctor(" << GetName() << ") ERROR: component " << comp->GetName()
70 << " is not of type RooAbsReal" << endl ;
72 }
73 _set1.add(*comp) ;
74 }
75
76 delete inputIter ;
77}
78
79
80
81
82////////////////////////////////////////////////////////////////////////////////
83/// Copy constructor
84
86 RooAbsReal(other, name),
87 _set1("set1",this,other._set1)
88{
90
91 // Member _ownedList is intentionally not copy-constructed -- ownership is not transferred
92}
93
94
95
96////////////////////////////////////////////////////////////////////////////////
97/// Destructor
98
100{
101 if (_setIter1) delete _setIter1 ;
102}
103
104
105
106////////////////////////////////////////////////////////////////////////////////
107/// Calculate value
108
110{
111 Double_t sum(1);
112 RooAbsReal* comp ;
113 const RooArgSet* nset = _set1.nset() ;
114
115 _setIter1->Reset() ;
116
117 while((comp=(RooAbsReal*)_setIter1->Next())) {
118 sum -= comp->getVal(nset) ;
119 }
120
121 return sum ;
122}
123
#define coutE(a)
Definition: RooMsgService.h:33
#define ClassImp(name)
Definition: Rtypes.h:375
char name[80]
Definition: TGX11.cxx:110
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition: RooAbsArg.h:78
TIterator * createIterator(Bool_t dir=kIterForward) const
TIterator-style iteration over contained elements.
const RooArgSet * nset() const
Definition: RooAbsProxy.h:45
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:63
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
Definition: RooAbsReal.h:93
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:57
bool add(const RooAbsArg &var, bool valueServer, bool shapeServer, bool silent)
Overloaded RooCollection_t::add() method insert object into set and registers object as server to own...
static void softAbort()
Soft abort function that interrupts macro execution but doesn't kill ROOT.
RooFracRemainder calculates the remainder fraction of a sum of RooAbsReal fraction,...
RooListProxy _set1
Set of input fractions.
~RooFracRemainder() override
Destructor.
TIterator * _setIter1
! Iterator over set of input fractions
RooFracRemainder()
Default constructor.
Double_t evaluate() const override
Calculate value.
Iterator abstract base class.
Definition: TIterator.h:30
virtual void Reset()=0
virtual TObject * Next()=0
const char * GetName() const override
Returns name of object.
Definition: TNamed.h:47
@ InputArguments
Definition: RooGlobalFunc.h:64
static uint64_t sum(uint64_t i)
Definition: Factory.cxx:2345