```/*****************************************************************************
* Project: RooFit                                                           *
* Package: RooFitCore                                                       *
* @(#)root/roofitcore:\$Id\$
* Authors:                                                                  *
*   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
*   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
*                                                                           *
* Copyright (c) 2000-2005, Regents of the University of California          *
*                                                                           *
* Redistribution and use in source and binary forms,                        *
* with or without modification, are permitted according to the terms        *
*****************************************************************************/

//////////////////////////////////////////////////////////////////////////////
//
// BEGIN_HTML
//
// RooFracRemainder calculates the remainder fraction of a sum of RooAbsReal
// fraction, i.e (1 - sum_i a_i). This class is used by RooSimWSTool to
// as specialization of the remainder fraction term of a parameter with
// a constrained split
// END_HTML
//

#include "RooFit.h"

#include "Riostream.h"
#include "Riostream.h"
#include <math.h>

#include "RooFracRemainder.h"
#include "RooAbsReal.h"
#include "RooAbsPdf.h"
#include "RooErrorHandler.h"
#include "RooArgSet.h"
#include "RooMsgService.h"

using namespace std;

ClassImp(RooFracRemainder)
;

//_____________________________________________________________________________
RooFracRemainder::RooFracRemainder()
{
// Default constructor

_setIter1 = _set1.createIterator() ;
}

//_____________________________________________________________________________
RooFracRemainder::RooFracRemainder(const char* name, const char* title, const RooArgSet& sumSet) :
RooAbsReal(name, title),
_set1("set1","First set of components",this)
{
// Constructor with given set of input fractions. All arguments in sumSet must be of type RooAbsReal.

_setIter1 = _set1.createIterator() ;

TIterator* inputIter = sumSet.createIterator() ;
RooAbsArg* comp ;
while((comp = (RooAbsArg*)inputIter->Next())) {
if (!dynamic_cast<RooAbsReal*>(comp)) {
coutE(InputArguments) << "RooFracRemainder::ctor(" << GetName() << ") ERROR: component " << comp->GetName()
<< " is not of type RooAbsReal" << endl ;
RooErrorHandler::softAbort() ;
}
}

delete inputIter ;
}

//_____________________________________________________________________________
RooFracRemainder::RooFracRemainder(const RooFracRemainder& other, const char* name) :
RooAbsReal(other, name),
_set1("set1",this,other._set1)
{
// Copy constructor

_setIter1 = _set1.createIterator() ;

// Member _ownedList is intentionally not copy-constructed -- ownership is not transferred
}

//_____________________________________________________________________________
RooFracRemainder::~RooFracRemainder()
{
// Destructor

if (_setIter1) delete _setIter1 ;
}

//_____________________________________________________________________________
Double_t RooFracRemainder::evaluate() const
{
// Calculate value

Double_t sum(1);
RooAbsReal* comp ;
const RooArgSet* nset = _set1.nset() ;

_setIter1->Reset() ;

while((comp=(RooAbsReal*)_setIter1->Next())) {
sum -= comp->getVal(nset) ;
}

return sum ;
}

```
RooFracRemainder.cxx:1
RooFracRemainder.cxx:2
RooFracRemainder.cxx:3
RooFracRemainder.cxx:4
RooFracRemainder.cxx:5
RooFracRemainder.cxx:6
RooFracRemainder.cxx:7
RooFracRemainder.cxx:8
RooFracRemainder.cxx:9
RooFracRemainder.cxx:10
RooFracRemainder.cxx:11
RooFracRemainder.cxx:12
RooFracRemainder.cxx:13
RooFracRemainder.cxx:14
RooFracRemainder.cxx:15
RooFracRemainder.cxx:16
RooFracRemainder.cxx:17
RooFracRemainder.cxx:18
RooFracRemainder.cxx:19
RooFracRemainder.cxx:20
RooFracRemainder.cxx:21
RooFracRemainder.cxx:22
RooFracRemainder.cxx:23
RooFracRemainder.cxx:24
RooFracRemainder.cxx:25
RooFracRemainder.cxx:26
RooFracRemainder.cxx:27
RooFracRemainder.cxx:28
RooFracRemainder.cxx:29
RooFracRemainder.cxx:30
RooFracRemainder.cxx:31
RooFracRemainder.cxx:32
RooFracRemainder.cxx:33
RooFracRemainder.cxx:34
RooFracRemainder.cxx:35
RooFracRemainder.cxx:36
RooFracRemainder.cxx:37
RooFracRemainder.cxx:38
RooFracRemainder.cxx:39
RooFracRemainder.cxx:40
RooFracRemainder.cxx:41
RooFracRemainder.cxx:42
RooFracRemainder.cxx:43
RooFracRemainder.cxx:44
RooFracRemainder.cxx:45
RooFracRemainder.cxx:46
RooFracRemainder.cxx:47
RooFracRemainder.cxx:48
RooFracRemainder.cxx:49
RooFracRemainder.cxx:50
RooFracRemainder.cxx:51
RooFracRemainder.cxx:52
RooFracRemainder.cxx:53
RooFracRemainder.cxx:54
RooFracRemainder.cxx:55
RooFracRemainder.cxx:56
RooFracRemainder.cxx:57
RooFracRemainder.cxx:58
RooFracRemainder.cxx:59
RooFracRemainder.cxx:60
RooFracRemainder.cxx:61
RooFracRemainder.cxx:62
RooFracRemainder.cxx:63
RooFracRemainder.cxx:64
RooFracRemainder.cxx:65
RooFracRemainder.cxx:66
RooFracRemainder.cxx:67
RooFracRemainder.cxx:68
RooFracRemainder.cxx:69
RooFracRemainder.cxx:70
RooFracRemainder.cxx:71
RooFracRemainder.cxx:72
RooFracRemainder.cxx:73
RooFracRemainder.cxx:74
RooFracRemainder.cxx:75
RooFracRemainder.cxx:76
RooFracRemainder.cxx:77
RooFracRemainder.cxx:78
RooFracRemainder.cxx:79
RooFracRemainder.cxx:80
RooFracRemainder.cxx:81
RooFracRemainder.cxx:82
RooFracRemainder.cxx:83
RooFracRemainder.cxx:84
RooFracRemainder.cxx:85
RooFracRemainder.cxx:86
RooFracRemainder.cxx:87
RooFracRemainder.cxx:88
RooFracRemainder.cxx:89
RooFracRemainder.cxx:90
RooFracRemainder.cxx:91
RooFracRemainder.cxx:92
RooFracRemainder.cxx:93
RooFracRemainder.cxx:94
RooFracRemainder.cxx:95
RooFracRemainder.cxx:96
RooFracRemainder.cxx:97
RooFracRemainder.cxx:98
RooFracRemainder.cxx:99
RooFracRemainder.cxx:100
RooFracRemainder.cxx:101
RooFracRemainder.cxx:102
RooFracRemainder.cxx:103
RooFracRemainder.cxx:104
RooFracRemainder.cxx:105
RooFracRemainder.cxx:106
RooFracRemainder.cxx:107
RooFracRemainder.cxx:108
RooFracRemainder.cxx:109
RooFracRemainder.cxx:110
RooFracRemainder.cxx:111
RooFracRemainder.cxx:112
RooFracRemainder.cxx:113
RooFracRemainder.cxx:114
RooFracRemainder.cxx:115
RooFracRemainder.cxx:116
RooFracRemainder.cxx:117
RooFracRemainder.cxx:118
RooFracRemainder.cxx:119
RooFracRemainder.cxx:120
RooFracRemainder.cxx:121
RooFracRemainder.cxx:122
RooFracRemainder.cxx:123
RooFracRemainder.cxx:124
RooFracRemainder.cxx:125