Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
23Calculates 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 <cmath>
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 std::endl;
41
43
44
45////////////////////////////////////////////////////////////////////////////////
46/// Constructor with given set of input fractions. All arguments in sumSet must be of type RooAbsReal.
47
48RooFracRemainder::RooFracRemainder(const char* name, const char* title, const RooArgSet& sumSet) :
49 RooAbsReal(name, title),
50 _set1("set1","First set of components",this)
51{
52 for(RooAbsArg * comp : sumSet) {
53 if (!dynamic_cast<RooAbsReal*>(comp)) {
54 coutE(InputArguments) << "RooFracRemainder::ctor(" << GetName() << ") ERROR: component " << comp->GetName()
55 << " is not of type RooAbsReal" << endl ;
57 }
58 _set1.add(*comp) ;
59 }
60}
61
62
63////////////////////////////////////////////////////////////////////////////////
64/// Copy constructor
65
67 RooAbsReal(other, name),
68 _set1("set1",this,other._set1)
69{
70 // Member _ownedList is intentionally not copy-constructed -- ownership is not transferred
71}
72
73
74////////////////////////////////////////////////////////////////////////////////
75/// Calculate value
76
78{
79 double sum(1);
80 const RooArgSet* nset = _set1.nset() ;
81
82 for (auto * comp : static_range_cast<RooAbsReal*>(_set1)) {
83 sum -= comp->getVal(nset) ;
84 }
85
86 return sum ;
87}
#define coutE(a)
#define ClassImp(name)
Definition Rtypes.h:382
char name[80]
Definition TGX11.cxx:110
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Definition RooAbsArg.h:77
const RooArgSet * nset() const
Definition RooAbsProxy.h:52
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:59
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
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.
Calculates the remainder fraction of a sum of RooAbsReal fraction, i.e (1 - sum_i a_i).
RooListProxy _set1
Set of input fractions.
double evaluate() const override
Calculate value.
RooFracRemainder()
Default constructor.
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
static uint64_t sum(uint64_t i)
Definition Factory.cxx:2345