Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooLinTransBinning.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 RooLinTransBinning.cxx
19\class RooLinTransBinning
20\ingroup Roofitcore
21
22RooLinTransBinning is a special binning implementation for RooLinearVar
23that transforms the binning of the RooLinearVar input variable in the same
24way that RooLinearVar does
25**/
26
27
28#include "RooFit.h"
29
30#include "RooLinTransBinning.h"
31
32using namespace std;
33
35;
36
37
38
39////////////////////////////////////////////////////////////////////////////////
40/// Constructor with a given input binning and the slope and offset to be applied to
41/// construct the linear transformation
42
45{
46 updateInput(input,slope,offset) ;
47}
48
49
50
51////////////////////////////////////////////////////////////////////////////////
52/// Copy constructor
53
56{
57 _input = other._input ;
58 _slope = other._slope ;
59 _offset = other._offset ;
60}
61
62
63
64////////////////////////////////////////////////////////////////////////////////
65/// Destructor
66
68{
69 if (_array) delete[] _array ;
70}
71
72
73
74////////////////////////////////////////////////////////////////////////////////
75
77{
78 // Change limits -- not implemented
79}
80
81
82////////////////////////////////////////////////////////////////////////////////
83/// Return array of bin boundaries
84
86{
87 const int n = numBoundaries();
88 // Return array with boundary values
89 if (_array) delete[] _array ;
90 _array = new Double_t[n] ;
91
92 const double* inputArray = _input->array() ;
93
94 if (_slope>0) {
95 for (int i=0; i < n; i++) {
96 _array[i] = trans(inputArray[i]) ;
97 }
98 } else {
99 for (int i=0; i < n; i++) {
100 _array[i] = trans(inputArray[n-i-1]) ;
101 }
102 }
103
104 return _array;
105}
106
107
108
109////////////////////////////////////////////////////////////////////////////////
110/// Update the slope and offset parameters and the pointer to the input binning
111
113{
114 _input = (RooAbsBinning*) &input ;
115 _slope = slope ;
116 _offset = offset ;
117}
118
#define ClassImp(name)
Definition Rtypes.h:364
char name[80]
Definition TGX11.cxx:110
RooAbsBinning is the abstract base class for RooRealVar binning definitions.
virtual Double_t * array() const =0
RooLinTransBinning is a special binning implementation for RooLinearVar that transforms the binning o...
RooAbsBinning * _input
virtual ~RooLinTransBinning()
Destructor.
virtual Int_t numBoundaries() const
virtual void setRange(Double_t xlo, Double_t xhi)
void updateInput(const RooAbsBinning &input, Double_t slope=1.0, Double_t offset=0.0)
Update the slope and offset parameters and the pointer to the input binning.
virtual Double_t * array() const
Return array of bin boundaries.
RooLinTransBinning(const char *name=0)
Double_t trans(Double_t x) const
const Int_t n
Definition legend1.C:16