MINT2
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
RooEffConvGenContext Class Reference

#include <RooEffConvGenContext.h>

Inheritance diagram for RooEffConvGenContext:

Public Member Functions

 RooEffConvGenContext (const RooFFTConvPdf &model, const RooArgSet &vars, const RooDataSet *prototype=0, const RooArgSet *auxProto=0, Bool_t _verbose=kFALSE)
 
 RooEffConvGenContext (const RooNumConvPdf &model, const RooArgSet &vars, const RooDataSet *prototype=0, const RooArgSet *auxProto=0, Bool_t _verbose=kFALSE)
 
 RooEffConvGenContext (const RooAbsAnaConvPdf &model, const RooArgSet &vars, const RooDataSet *prototype=0, const RooArgSet *auxProto=0, Bool_t _verbose=kFALSE)
 
virtual ~RooEffConvGenContext ()
 
virtual void attach (const RooArgSet &params)
 

Protected Member Functions

virtual void initGenerator (const RooArgSet &theEvent)
 
virtual void generateEvent (RooArgSet &theEvent, Int_t remaining)
 
 RooEffConvGenContext (const RooEffConvGenContext &other)
 

Private Member Functions

void initEfficiency ()
 
const RooAbsReal * efficiency ()
 

Private Attributes

double _maxEff
 

Detailed Description

Definition at line 17 of file RooEffConvGenContext.h.

Constructor & Destructor Documentation

◆ RooEffConvGenContext() [1/4]

RooEffConvGenContext::RooEffConvGenContext ( const RooFFTConvPdf &  model,
const RooArgSet &  vars,
const RooDataSet *  prototype = 0,
const RooArgSet *  auxProto = 0,
Bool_t  _verbose = kFALSE 
)

Definition at line 69 of file RooEffConvGenContext.cpp.

71  : RooConvGenContext(model, vars, prototype, auxProto, verbose)
72 {
73  cxcoutI(Generation) << "RooEffConvGenContext::ctor() setting up special generator context "
74  << "to apply an efficiency to the analytical convolution p.d.f. "
75  << reinterpret_cast<const RooAbsPdf*>(&model)->GetName() << " for generation of observable(s) " << vars << endl ;
77 }

◆ RooEffConvGenContext() [2/4]

RooEffConvGenContext::RooEffConvGenContext ( const RooNumConvPdf &  model,
const RooArgSet &  vars,
const RooDataSet *  prototype = 0,
const RooArgSet *  auxProto = 0,
Bool_t  _verbose = kFALSE 
)

Definition at line 58 of file RooEffConvGenContext.cpp.

60  : RooConvGenContext(model, vars, prototype, auxProto, verbose)
61 {
62  cxcoutI(Generation) << "RooEffConvGenContext::ctor() setting up special generator context "
63  << "to apply an efficiency to the analytical convolution p.d.f. "
64  << reinterpret_cast<const RooAbsPdf*>(&model)->GetName() << " for generation of observable(s) " << vars << endl ;
66 }

◆ RooEffConvGenContext() [3/4]

RooEffConvGenContext::RooEffConvGenContext ( const RooAbsAnaConvPdf &  model,
const RooArgSet &  vars,
const RooDataSet *  prototype = 0,
const RooArgSet *  auxProto = 0,
Bool_t  _verbose = kFALSE 
)

Definition at line 47 of file RooEffConvGenContext.cpp.

49  : RooConvGenContext(model, vars, prototype, auxProto, verbose)
50 {
51  cxcoutI(Generation) << "RooEffConvGenContext::ctor() setting up special generator context "
52  << "to apply an efficiency to the analytical convolution p.d.f. "
53  << reinterpret_cast<const RooAbsPdf*>(&model)->GetName() << " for generation of observable(s) " << vars << endl ;
55 }

◆ ~RooEffConvGenContext()

RooEffConvGenContext::~RooEffConvGenContext ( )
virtual

Definition at line 43 of file RooEffConvGenContext.cpp.

44 { }

◆ RooEffConvGenContext() [4/4]

RooEffConvGenContext::RooEffConvGenContext ( const RooEffConvGenContext other)
protected

Member Function Documentation

◆ attach()

void RooEffConvGenContext::attach ( const RooArgSet &  params)
virtual

Definition at line 80 of file RooEffConvGenContext.cpp.

81 {
82  RooConvGenContext::initGenerator(theEvent);
83 
84  // Replace observables in efficiency function by the generated observables.
85  // Attach the output value of the convolution variable to the efficiencies,
86  // so the final hit-miss is with respect to the correct (smeared) value;
87  RooAbsReal* eff = const_cast<RooAbsReal*>(efficiency());
88  RooArgSet* effVars
89  = (RooArgSet*)_modelVars->selectCommon(*eff->getVariables());
90  effVars->remove(*_cvModel, kTRUE, kTRUE);
91  effVars->add(*_cvOut);
92  eff->recursiveRedirectServers(*effVars, kTRUE, kFALSE, kTRUE);
93  delete effVars;
94 }
const RooAbsReal * efficiency()

◆ efficiency()

const RooAbsReal * RooEffConvGenContext::efficiency ( )
private

Definition at line 151 of file RooEffConvGenContext.cpp.

152 {
153  const RooAbsEffResModel* model = dynamic_cast<const RooAbsEffResModel*>(_modelCloneSet->first());
154  assert(model);
155  const RooAbsReal* efficiency = model->efficiency();
156  assert(efficiency);
157  return efficiency;
158 }
virtual const RooAbsReal * efficiency() const =0
const RooAbsReal * efficiency()

◆ generateEvent()

void RooEffConvGenContext::generateEvent ( RooArgSet &  theEvent,
Int_t  remaining 
)
protectedvirtual

Definition at line 99 of file RooEffConvGenContext.cpp.

100 {
101  // Generate a single event
102 
103  while(1) {
104  // Generate pdf and model data
105  _modelGen->generateEvent(*_modelVars, remaining);
106  _pdfGen->generateEvent(*_pdfVars, remaining);
107 
108  // Construct smeared convolution variable
109  Double_t convValSmeared = _cvPdf->getVal() + _cvModel->getVal();
110 
111  if (!_cvOut->isValidReal(convValSmeared)) continue;
112 
113  // Hit-miss on the efficiency
114  // This has to be set first to get the proper value of the efficiency
115  _cvOut->setVal(convValSmeared);
116 
117  double val = efficiency()->getVal();
118  if (val > _maxEff && !efficiency()->getMaxVal(*_modelVars)) {
119  coutE(Generation) << ClassName() << "::" << GetName()
120  << ":generateEvent: value of efficiency is larger "
121  << "than assumed maximum of 1." << endl;
122  continue;
123  }
124  if (val > RooRandom::uniform() * _maxEff) {
125  // Smeared value in acceptance range, transfer values to output set
126  theEvent = *_modelVars;
127  theEvent = *_pdfVars;
128  _cvOut->setVal(convValSmeared);
129  return;
130  }
131  }
132 }
const RooAbsReal * efficiency()

◆ initEfficiency()

void RooEffConvGenContext::initEfficiency ( )
private

Definition at line 135 of file RooEffConvGenContext.cpp.

136 {
137  // Check if efficiency supports maximum finding
138  const RooAbsEffResModel* model = dynamic_cast<const RooAbsEffResModel*>(_modelCloneSet->first());
139  assert(model);
140  RooAbsReal* eff = const_cast<RooAbsReal*>(model->efficiency());
141  Int_t maxCode = eff->getMaxVal(*_modelVars);
142  if (!maxCode) {
143  _maxEff = 1.;
144  } else {
145  Double_t maxVal = eff->maxVal(maxCode);
146  if (maxVal > _maxEff) _maxEff = maxVal;
147  }
148 }
virtual const RooAbsReal * efficiency() const =0

◆ initGenerator()

void RooEffConvGenContext::initGenerator ( const RooArgSet &  theEvent)
protectedvirtual

Definition at line 96 of file RooEffConvGenContext.cpp.

97 { return attach(theEvent); }
virtual void attach(const RooArgSet &params)

Member Data Documentation

◆ _maxEff

double RooEffConvGenContext::_maxEff
private

Definition at line 42 of file RooEffConvGenContext.h.


The documentation for this class was generated from the following files: