Logo ROOT  
Reference Guide
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#include "RooLinTransBinning.h"
32
33using namespace std;
34
36;
37
38
39
40////////////////////////////////////////////////////////////////////////////////
41/// Constructor with a given input binning and the slope and offset to be applied to
42/// construct the linear transformation
43
46{
47 updateInput(input,slope,offset) ;
48}
49
50
51
52////////////////////////////////////////////////////////////////////////////////
53/// Copy constructor
54
57{
58 _input = other._input ;
59 _slope = other._slope ;
60 _offset = other._offset ;
61}
62
63
64
65////////////////////////////////////////////////////////////////////////////////
66/// Destructor
67
69{
70 if (_array) delete[] _array ;
71}
72
73
74
75////////////////////////////////////////////////////////////////////////////////
76
78{
79 // Change limits -- not implemented
80}
81
82
83////////////////////////////////////////////////////////////////////////////////
84/// Return array of bin boundaries
85
87{
88 const int n = numBoundaries();
89 // Return array with boundary values
90 if (_array) delete[] _array ;
91 _array = new Double_t[n] ;
92
93 const double* inputArray = _input->array() ;
94
95 if (_slope>0) {
96 for (int i=0; i < n; i++) {
97 _array[i] = trans(inputArray[i]) ;
98 }
99 } else {
100 for (int i=0; i < n; i++) {
101 _array[i] = trans(inputArray[n-i-1]) ;
102 }
103 }
104
105 return _array;
106}
107
108
109
110////////////////////////////////////////////////////////////////////////////////
111/// Update the slope and offset parameters and the pointer to the input binning
112
114{
115 _input = (RooAbsBinning*) &input ;
116 _slope = slope ;
117 _offset = offset ;
118}
119
double Double_t
Definition: RtypesCore.h:55
#define ClassImp(name)
Definition: Rtypes.h:365
char name[80]
Definition: TGX11.cxx:109
RooAbsBinning is the abstract base class for RooRealVar binning definitions This class defines the in...
Definition: RooAbsBinning.h:26
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