<commit_before>/*****************************************************************************
 * Project: BaBar detector at the SLAC PEP-II B-factory
 * Package: RooFitTools
 *    File: $Id: RooKeysPdf.cc,v 1.3 2002/02/07 17:06:13 giraudpf Exp $
 * Authors:
 *   GR, <NAME>, UC, San Diego , <EMAIL>
 *   DK, <NAME>, Stanford University, <EMAIL>
 * History:
 *   04-Jul-2000 GR Created initial version
 *   01-Sep-2000 DK Override useParameters() method to fix the normalization
 *
 * Copyright (C) 2000 UC, San Diego
 *****************************************************************************/
#include "BaBar/BaBar.hh"
#include <math.h>
#include <iostream.h>

#include "RooFitModels/RooKeysPdf.hh"
#include "RooFitCore/RooAbsReal.hh"
#include "RooFitCore/RooRealVar.hh"
#include "RooFitCore/RooRandom.hh"
#include "RooFitCore/RooDataSet.hh"

ClassImp(RooKeysPdf)

RooKeysPdf::RooKeysPdf(const char *name, const char *title,
                       RooAbsReal& x, RooDataSet& data,
                       Mirror mirror, Double_t rho) :
  RooAbsPdf(name,title),
  _x("x","Dependent",this,x),
  _nEvents(0),
  _dataPts(0),
  _weights(0),
  _mirrorLeft(mirror==MirrorLeft || mirror==MirrorBoth || mirror==MirrorLeftAsymRight),
  _mirrorRight(mirror==MirrorRight || mirror==MirrorBoth || mirror==MirrorAsymLeftRight),
  _asymLeft(mirror==MirrorAsymLeft || mirror==MirrorAsymLeftRight || mirror==MirrorAsymBoth),
  _asymRight(mirror==MirrorAsymRight || mirror==MirrorLeftAsymRight || mirror==MirrorAsymBoth),
  _rho(rho)
{
  // cache stuff about x
  sprintf(_varName, "%s", x.GetName());
  RooRealVar real= (RooRealVar&)(_x.arg());
  _lo = real.getFitMin();
  _hi = real.getFitMax();
  _binWidth = (_hi-_lo)/(_nPoints-1);

  // form the lookup table
  LoadDataSet(data);
}

RooKeysPdf::RooKeysPdf(const RooKeysPdf& other, const char* name):
  RooAbsPdf(other,name), _x("x",this,other._x), _nEvents(other._nEvents),
  _dataPts(0), _weights(0),
  _mirrorLeft( other._mirrorLeft ), _mirrorRight( other._mirrorRight ),
  _asymLeft(other._asymLeft), _asymRight(other._asymRight),
  _rho( other._rho ) {

  // cache stuff about x
  sprintf(_varName, "%s", other._varName );
  RooRealVar real= (RooRealVar&)(_x.arg());
  _lo = real.getFitMin();
  _hi = real.getFitMax();
  _binWidth = (_hi-_lo)/(_nPoints-1);

  // copy over data and weights... not necessary, commented out for speed
//    _dataPts = new Double_t[_nEvents];<commit_msg>Cleaned up a small issue in the copy constructor.  The old constructor did not create an exact copy, as it took the *current* range for the dependent variable for the new copy's cache of _lo, _hi, and _binWidth. This can lead to normalization and/or range problems if the dependent variable has it's fitRange modified between RooKeysPdf creation and plotting.<commit_after>/*****************************************************************************
 * Project: BaBar detector at the SLAC PEP-II B-factory
 * Package: RooFitTools
 *    File: $Id: RooKeysPdf.cc,v 1.4 2002/02/11 21:20:55 giraudpf Exp $
 * Authors:
 *   GR, <NAME>, UC, San Diego , <EMAIL>
 *   DK, <NAME>, Stanford University, k<EMAIL>
 * History:
 *   04-Jul-2000 GR Created initial version
 *   01-Sep-2000 DK Override useParameters() method to fix the normalization
 *
 * Copyright (C) 2000 UC, San Diego
 *****************************************************************************/
#include "BaBar/BaBar.hh"
#include <math.h>
#include <iostream.h>

#include "RooFitModels/RooKeysPdf.hh"
#include "RooFitCore/RooAbsReal.hh"
#include "RooFitCore/RooRealVar.hh"
#include "RooFitCore/RooRandom.hh"
#include "RooFitCore/RooDataSet.hh"

ClassImp(RooKeysPdf)

RooKeysPdf::RooKeysPdf(const char *name, const char *title,
                       RooAbsReal& x, RooDataSet& data,
                       Mirror mirror, Double_t rho) :
  RooAbsPdf(name,title),
  _x("x","Dependent",this,x),
  _nEvents(0),
  _dataPts(0),
  _weights(0),
  _mirrorLeft(mirror==MirrorLeft || mirror==MirrorBoth || mirror==MirrorLeftAsymRight),
  _mirrorRight(mirror==MirrorRight || mirror==MirrorBoth || mirror==MirrorAsymLeftRight),
  _asymLeft(mirror==MirrorAsymLeft || mirror==MirrorAsymLeftRight || mirror==MirrorAsymBoth),
  _asymRight(mirror==MirrorAsymRight || mirror==MirrorLeftAsymRight || mirror==MirrorAsymBoth),
  _rho(rho)
{
  // cache stuff about x
  sprintf(_varName, "%s", x.GetName());
  RooRealVar real= (RooRealVar&)(_x.arg());
  _lo = real.getFitMin();
  _hi = real.getFitMax();
  _binWidth = (_hi-_lo)/(_nPoints-1);

  // form the lookup table
  LoadDataSet(data);
}

RooKeysPdf::RooKeysPdf(const RooKeysPdf& other, const char* name):
  RooAbsPdf(other,name), _x("x",this,other._x), _nEvents(other._nEvents),
  _dataPts(0), _weights(0),
  _mirrorLeft( other._mirrorLeft ), _mirrorRight( other._mirrorRight ),
  _asymLeft(other._asymLeft), _asymRight(other._asymRight),
  _rho( other._rho ) {

  // cache stuff about x
  sprintf(_varName, "%s", other._varName );
  _lo = other._lo;
  _hi = other._hi;
  _binWidth = other._binWidth;

  // copy over data and weights... not necessary, commented out for speed
//    _dataPts = new Double_t[_nEvents];
{'fraction_non_alphanumeric': 0.19029996104402025, 'fraction_numerical': 0.014998052201012855, 'mean_word_length': 4.848519362186789, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3483666', 'n_tokens_mistral': 1887, 'n_tokens_neox': 1752, 'n_words': 396}