Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooBCPEffDecay.cxx
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitModels *
4 * @(#)root/roofit:$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/** \class RooBCPEffDecay
18 \ingroup Roofit
19
20PDF describing decay time distribution of B meson including effects of standard model CP violation.
21This function can be analytically convolved with any RooResolutionModel implementation.
22*/
23
24
25#include "Riostream.h"
26#include "RooRealVar.h"
27#include "RooRandom.h"
28#include "RooBCPEffDecay.h"
29#include "RooRealIntegral.h"
30
32
33/// \brief Constructor for RooBCPEffDecay.
34///
35/// Creates an instance of RooBCPEffDecay with the specified parameters.
36///
37/// \param[in] name The name of the PDF.
38/// \param[in] title The title of the PDF.
39/// \param[in] t The time variable.
40/// \param[in] tag The CP state category.
41/// \param[in] tau The decay time parameter.
42/// \param[in] dm The mixing frequency parameter.
43/// \param[in] avgMistag The average mistag rate parameter.
44/// \param[in] CPeigenval The CP eigen value parameter.
45/// \param[in] absLambda The absolute value of the complex lambda parameter.
46/// \param[in] argLambda The argument of the complex lambda parameter.
47/// \param[in] effRatio The B0/B0bar efficiency ratio.
48/// \param[in] delMistag Delta mistag rate parameter.
49/// \param[in] model The resolution model.
50/// \param[in] type The decay type.
51
52RooBCPEffDecay::RooBCPEffDecay(const char *name, const char *title,
54 RooAbsReal& tau, RooAbsReal& dm,
55 RooAbsReal& avgMistag, RooAbsReal& CPeigenval,
56 RooAbsReal& absLambda, RooAbsReal& argLambda,
57 RooAbsReal& effRatio, RooAbsReal& delMistag,
58 const RooResolutionModel& model, DecayType type) :
59 RooAbsAnaConvPdf(name,title,model,t),
60 _absLambda("absLambda","Absolute value of lambda",this,absLambda),
61 _argLambda("argLambda","Arg(Lambda)",this,argLambda),
62 _effRatio("effRatio","B0/B0bar efficiency ratio",this,effRatio),
63 _CPeigenval("CPeigenval","CP eigen value",this,CPeigenval),
64 _avgMistag("avgMistag","Average mistag rate",this,avgMistag),
65 _delMistag("delMistag","Delta mistag rate",this,delMistag),
66 _t("t","time",this,t),
67 _tau("tau","decay time",this,tau),
68 _dm("dm","mixing frequency",this,dm),
69 _tag("tag","CP state",this,tag),
70 _genB0Frac(0),
71 _type(type)
72{
73 switch(type) {
74 case SingleSided:
75 _basisExp = declareBasis("exp(-@0/@1)",RooArgList(tau,dm)) ;
76 _basisSin = declareBasis("exp(-@0/@1)*sin(@0*@2)",RooArgList(tau,dm)) ;
77 _basisCos = declareBasis("exp(-@0/@1)*cos(@0*@2)",RooArgList(tau,dm)) ;
78 break ;
79 case Flipped:
80 _basisExp = declareBasis("exp(@0)/@1)",RooArgList(tau,dm)) ;
81 _basisSin = declareBasis("exp(@0/@1)*sin(@0*@2)",RooArgList(tau,dm)) ;
82 _basisCos = declareBasis("exp(@0/@1)*cos(@0*@2)",RooArgList(tau,dm)) ;
83 break ;
84 case DoubleSided:
85 _basisExp = declareBasis("exp(-abs(@0)/@1)",RooArgList(tau,dm)) ;
86 _basisSin = declareBasis("exp(-abs(@0)/@1)*sin(@0*@2)",RooArgList(tau,dm)) ;
87 _basisCos = declareBasis("exp(-abs(@0)/@1)*cos(@0*@2)",RooArgList(tau,dm)) ;
88 break ;
89 }
90}
91
92////////////////////////////////////////////////////////////////////////////////
93/// Copy constructor.
94
97 _absLambda("absLambda",this,other._absLambda),
98 _argLambda("argLambda",this,other._argLambda),
99 _effRatio("effRatio",this,other._effRatio),
100 _CPeigenval("CPeigenval",this,other._CPeigenval),
101 _avgMistag("avgMistag",this,other._avgMistag),
102 _delMistag("delMistag",this,other._delMistag),
103 _t("t",this,other._t),
104 _tau("tau",this,other._tau),
105 _dm("dm",this,other._dm),
106 _tag("tag",this,other._tag),
107 _genB0Frac(other._genB0Frac),
108 _type(other._type),
109 _basisExp(other._basisExp),
110 _basisSin(other._basisSin),
111 _basisCos(other._basisCos)
112{
113}
114
115////////////////////////////////////////////////////////////////////////////////
116/// B0 : _tag = +1
117///
118/// B0bar : _tag = -1
119/// \param[in] basisIndex
120
121double RooBCPEffDecay::coefficient(Int_t basisIndex) const
122{
123 if (basisIndex==_basisExp) {
124 //exp term: (1 -/+ dw)(1+a^2)/2
125 return (1 - _tag*_delMistag)*(1+_absLambda*_absLambda)/2 ;
126 // = 1 + _tag*deltaDil/2
127 }
128
129 if (basisIndex==_basisSin) {
130 //sin term: +/- (1-2w)*ImLambda(= -etaCP * |l| * sin2b)
132 // = _tag*avgDil * ...
133 }
134
135 if (basisIndex==_basisCos) {
136 //cos term: +/- (1-2w)*(1-a^2)/2
137 return -1*_tag*(1-2*_avgMistag)*(1-_absLambda*_absLambda)/2 ;
138 // = -_tag*avgDil * ...
139 }
140
141 return 0 ;
142}
143
144////////////////////////////////////////////////////////////////////////////////
145
146Int_t RooBCPEffDecay::getCoefAnalyticalIntegral(Int_t /*code*/, RooArgSet& allVars, RooArgSet& analVars, const char* rangeName) const
147{
148 if (rangeName) return 0 ;
149
150 if (matchArgs(allVars,analVars,_tag)) return 1 ;
151 return 0 ;
152}
153
154////////////////////////////////////////////////////////////////////////////////
155
156double RooBCPEffDecay::coefAnalyticalIntegral(Int_t basisIndex, Int_t code, const char* /*rangeName*/) const
157{
158 switch(code) {
159 // No integration
160 case 0: return coefficient(basisIndex) ;
161
162 // Integration over 'tag'
163 case 1:
164 if (basisIndex==_basisExp) {
165 return (1+_absLambda*_absLambda) ;
166 }
167
168 if (basisIndex==_basisSin || basisIndex==_basisCos) {
169 return 0 ;
170 }
171 break ;
172
173 default:
174 assert(0) ;
175 }
176
177 return 0 ;
178}
179
180////////////////////////////////////////////////////////////////////////////////
181
182Int_t RooBCPEffDecay::getGenerator(const RooArgSet& directVars, RooArgSet &generateVars, bool staticInitOK) const
183{
184 if (staticInitOK) {
185 if (matchArgs(directVars,generateVars,_t,_tag)) return 2 ;
186 }
187 if (matchArgs(directVars,generateVars,_t)) return 1 ;
188 return 0 ;
189}
190
191////////////////////////////////////////////////////////////////////////////////
192
194{
195 if (code==2) {
196 // Calculate the fraction of mixed events to generate
197 double sumInt = RooRealIntegral("sumInt","sum integral",*this,RooArgSet(_t.arg(),_tag.arg())).getVal() ;
198 _tag = 1 ;
199 double b0Int = RooRealIntegral("mixInt","mix integral",*this,RooArgSet(_t.arg())).getVal() ;
200 _genB0Frac = b0Int/sumInt ;
201 }
202}
203
204////////////////////////////////////////////////////////////////////////////////
205/// Generates mix-state dependent.
206/// \param[in] code
207
209{
210 if (code==2) {
211 double rand = RooRandom::uniform() ;
212 _tag = (rand<=_genB0Frac) ? 1 : -1 ;
213 }
214
215 // Generate delta-t dependent
216 while(true) {
217 double rand = RooRandom::uniform() ;
218 double tval(0) ;
219
220 switch(_type) {
221 case SingleSided:
222 tval = -_tau*log(rand);
223 break ;
224 case Flipped:
225 tval= +_tau*log(rand);
226 break ;
227 case DoubleSided:
228 tval = (rand<=0.5) ? -_tau*log(2*rand) : +_tau*log(2*(rand-0.5)) ;
229 break ;
230 }
231
232 // Accept event if T is in generated range
233 double maxDil = 1.0 ;
234 double al2 = _absLambda*_absLambda ;
235 double maxAcceptProb = (1+al2) + std::abs(maxDil*_CPeigenval*_absLambda*_argLambda) + std::abs(maxDil*(1-al2)/2);
236 double acceptProb = (1+al2)/2*(1-_tag*_delMistag)
237 - (_tag*(1-2*_avgMistag))*(_CPeigenval*_absLambda*_argLambda)*sin(_dm*tval)
238 - (_tag*(1-2*_avgMistag))*(1-al2)/2*cos(_dm*tval);
239
240 bool accept = maxAcceptProb*RooRandom::uniform() < acceptProb ? true : false ;
241
242 if (tval<_t.max() && tval>_t.min() && accept) {
243 _t = tval ;
244 break ;
245 }
246 }
247
248}
#define ClassImp(name)
Definition Rtypes.h:377
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char name[80]
Definition TGX11.cxx:110
Base class for PDFs that represent a physics model that can be analytically convolved with a resoluti...
Int_t declareBasis(const char *expression, const RooArgList &params)
Declare a basis function for use in this physics model.
A space to attach TBranches.
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:59
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
Definition RooAbsReal.h:103
bool matchArgs(const RooArgSet &allDeps, RooArgSet &numDeps, const RooArgProxy &a) const
Utility function for use in getAnalyticalIntegral().
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition RooArgList.h:22
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:55
PDF describing decay time distribution of B meson including effects of standard model CP violation.
Int_t getGenerator(const RooArgSet &directVars, RooArgSet &generateVars, bool staticInitOK=true) const override
Load generatedVars with the subset of directVars that we can generate events for, and return a code t...
double coefAnalyticalIntegral(Int_t coef, Int_t code, const char *rangeName=nullptr) const override
Default implementation of function implementing advertised integrals.
double coefficient(Int_t basisIndex) const override
B0 : _tag = +1.
Int_t getCoefAnalyticalIntegral(Int_t coef, RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=nullptr) const override
Default implementation of function advertising integration capabilities.
RooRealProxy _t
RooRealProxy _avgMistag
RooRealProxy _delMistag
void generateEvent(Int_t code) override
Generates mix-state dependent.
RooRealProxy _dm
RooRealProxy _absLambda
RooRealProxy _argLambda
RooCategoryProxy _tag
RooRealProxy _CPeigenval
RooRealProxy _tau
void initGenerator(Int_t code) override
Interface for one-time initialization to setup the generator for the specified code.
static double uniform(TRandom *generator=randomGenerator())
Return a number uniformly distributed from (0,1)
Definition RooRandom.cxx:78
Performs hybrid numerical/analytical integrals of RooAbsReal objects.
Variable that can be changed from the outside.
Definition RooRealVar.h:37
RooResolutionModel is the base class for PDFs that represent a resolution model that can be convolute...
double max(const char *rname=nullptr) const
Query upper limit of range. This requires the payload to be RooAbsRealLValue or derived.
const T & arg() const
Return reference to object held in proxy.
double min(const char *rname=nullptr) const
Query lower limit of range. This requires the payload to be RooAbsRealLValue or derived.