Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooExtendedTerm.cxx
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * @(#)root/roofitcore:$Name: $:$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 RooExtendedTerm.cxx
19\class RooExtendedTerm
20\ingroup Roofitcore
21
22A p.d.f with no observables that only introduces
23an extended ML term for a given number of expected events term when an extended ML
24is constructed.
25**/
26
27#include <RooExtendedTerm.h>
28#include <RooProduct.h>
29
31
32
33////////////////////////////////////////////////////////////////////////////////
34/// Constructor. An ExtendedTerm has no observables, it only introduces an extended
35/// ML term with the given number of expected events when an extended ML is constructed
36/// from this p.d.f.
37
38RooExtendedTerm::RooExtendedTerm(const char *name, const char *title, const RooAbsReal& n) :
39 RooAbsPdf(name,title),
40 _n("n","Nexpected",this,(RooAbsReal&)n)
41{
42}
43
44
45
46////////////////////////////////////////////////////////////////////////////////
47/// Copy constructor
48
50 RooAbsPdf(other,name),
51 _n("n",this,other._n)
52{
53}
54
55////////////////////////////////////////////////////////////////////////////////
56/// Return number of expected events from associated event count variable
57
58double RooExtendedTerm::expectedEvents(const RooArgSet* /*nset*/) const
59{
60 return _n ;
61}
62
63std::unique_ptr<RooAbsReal> RooExtendedTerm::createExpectedEventsFunc(const RooArgSet * /*nset*/) const
64{
65 auto name = std::string(GetName()) + "_expectedEvents";
66 return std::make_unique<RooProduct>(name.c_str(), name.c_str(), *_n);
67}
#define ClassImp(name)
Definition Rtypes.h:377
char name[80]
Definition TGX11.cxx:110
Abstract interface for all probability density functions.
Definition RooAbsPdf.h:40
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:55
A p.d.f with no observables that only introduces an extended ML term for a given number of expected e...
RooRealProxy _n
Number of expected events.
double expectedEvents(const RooArgSet *nset) const override
Return number of expected events, in other words the value of the associated n parameter.
RooExtendedTerm()=default
std::unique_ptr< RooAbsReal > createExpectedEventsFunc(const RooArgSet *nset) const override
Returns an object that represents the expected number of events for a given normalization set,...
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
const Int_t n
Definition legend1.C:16