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
42
43
44////////////////////////////////////////////////////////////////////////////////
45/// Constructor with given set of input fractions. All arguments in sumSet must be of type RooAbsReal.
46
47RooFracRemainder::RooFracRemainder(const char* name, const char* title, const RooArgSet& sumSet) :
48 RooAbsReal(name, title),
49 _set1("set1","First set of components",this)
50{
51 for(RooAbsArg * comp : sumSet) {
52 if (!dynamic_cast<RooAbsReal*>(comp)) {
53 coutE(InputArguments) << "RooFracRemainder::ctor(" << GetName() << ") ERROR: component " << comp->GetName()
54 << " is not of type RooAbsReal" << std::endl ;
56 }
57 _set1.add(*comp) ;
58 }
59}
60
61
62////////////////////////////////////////////////////////////////////////////////
63/// Copy constructor
64
66 RooAbsReal(other, name),
67 _set1("set1",this,other._set1)
68{
69 // Member _ownedList is intentionally not copy-constructed -- ownership is not transferred
70}
71
72
73////////////////////////////////////////////////////////////////////////////////
74/// Calculate value
75
77{
78 double sum(1);
79 const RooArgSet* nset = _set1.nset() ;
80
81 for (auto * comp : static_range_cast<RooAbsReal*>(_set1)) {
82 sum -= comp->getVal(nset) ;
83 }
84
85 return sum ;
86}
ROOT::RRangeCast< T, false, Range_t > static_range_cast(Range_t &&coll)
#define coutE(a)
char name[80]
Definition TGX11.cxx:148
RooAbsArg()
Default constructor.
RooAbsReal()
coverity[UNINIT_CTOR] Default constructor
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
static void softAbort()
Soft abort function that interrupts macro execution but doesn't kill ROOT.
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:49
static uint64_t sum(uint64_t i)
Definition Factory.cxx:2338