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 "RooRealVar.h"
26#include "RooRandom.h"
27#include "RooBCPEffDecay.h"
28#include "RooRealIntegral.h"
29
30
31/// \brief Constructor for RooBCPEffDecay.
32///
33/// Creates an instance of RooBCPEffDecay with the specified parameters.
34///
35/// \param[in] name The name of the PDF.
36/// \param[in] title The title of the PDF.
37/// \param[in] t The time variable.
38/// \param[in] tag The CP state category.
39/// \param[in] tau The decay time parameter.
40/// \param[in] dm The mixing frequency parameter.
41/// \param[in] avgMistag The average mistag rate parameter.
42/// \param[in] CPeigenval The CP eigen value parameter.
43/// \param[in] absLambda The absolute value of the complex lambda parameter.
44/// \param[in] argLambda The argument of the complex lambda parameter.
45/// \param[in] effRatio The B0/B0bar efficiency ratio.
46/// \param[in] delMistag Delta mistag rate parameter.
47/// \param[in] model The resolution model.
48/// \param[in] type The decay type.
49
50RooBCPEffDecay::RooBCPEffDecay(const char *name, const char *title,
52 RooAbsReal& tau, RooAbsReal& dm,
56 const RooResolutionModel& model, DecayType type) :
57 RooAbsAnaConvPdf(name,title,model,t),
58 _absLambda("absLambda","Absolute value of lambda",this,absLambda),
59 _argLambda("argLambda","Arg(Lambda)",this,argLambda),
60 _effRatio("effRatio","B0/B0bar efficiency ratio",this,effRatio),
61 _CPeigenval("CPeigenval","CP eigen value",this,CPeigenval),
62 _avgMistag("avgMistag","Average mistag rate",this,avgMistag),
63 _delMistag("delMistag","Delta mistag rate",this,delMistag),
64 _t("t","time",this,t),
65 _tau("tau","decay time",this,tau),
66 _dm("dm","mixing frequency",this,dm),
67 _tag("tag","CP state",this,tag),
68 _genB0Frac(0),
69 _type(type)
70{
71 switch(type) {
72 case SingleSided:
73 _basisExp = declareBasis("exp(-@0/@1)",RooArgList(tau,dm)) ;
74 _basisSin = declareBasis("exp(-@0/@1)*sin(@0*@2)",RooArgList(tau,dm)) ;
75 _basisCos = declareBasis("exp(-@0/@1)*cos(@0*@2)",RooArgList(tau,dm)) ;
76 break ;
77 case Flipped:
78 _basisExp = declareBasis("exp(@0)/@1)",RooArgList(tau,dm)) ;
79 _basisSin = declareBasis("exp(@0/@1)*sin(@0*@2)",RooArgList(tau,dm)) ;
80 _basisCos = declareBasis("exp(@0/@1)*cos(@0*@2)",RooArgList(tau,dm)) ;
81 break ;
82 case DoubleSided:
83 _basisExp = declareBasis("exp(-abs(@0)/@1)",RooArgList(tau,dm)) ;
84 _basisSin = declareBasis("exp(-abs(@0)/@1)*sin(@0*@2)",RooArgList(tau,dm)) ;
85 _basisCos = declareBasis("exp(-abs(@0)/@1)*cos(@0*@2)",RooArgList(tau,dm)) ;
86 break ;
87 }
88}
89
90////////////////////////////////////////////////////////////////////////////////
91/// Copy constructor.
92
95 _absLambda("absLambda",this,other._absLambda),
96 _argLambda("argLambda",this,other._argLambda),
97 _effRatio("effRatio",this,other._effRatio),
98 _CPeigenval("CPeigenval",this,other._CPeigenval),
99 _avgMistag("avgMistag",this,other._avgMistag),
100 _delMistag("delMistag",this,other._delMistag),
101 _t("t",this,other._t),
102 _tau("tau",this,other._tau),
103 _dm("dm",this,other._dm),
104 _tag("tag",this,other._tag),
105 _genB0Frac(other._genB0Frac),
106 _type(other._type),
107 _basisExp(other._basisExp),
108 _basisSin(other._basisSin),
109 _basisCos(other._basisCos)
110{
111}
112
113////////////////////////////////////////////////////////////////////////////////
114/// B0 : _tag = +1
115///
116/// B0bar : _tag = -1
117/// \param[in] basisIndex
118
120{
121 if (basisIndex==_basisExp) {
122 //exp term: (1 -/+ dw)(1+a^2)/2
123 return (1 - _tag*_delMistag)*(1+_absLambda*_absLambda)/2 ;
124 // = 1 + _tag*deltaDil/2
125 }
126
127 if (basisIndex==_basisSin) {
128 //sin term: +/- (1-2w)*ImLambda(= -etaCP * |l| * sin2b)
130 // = _tag*avgDil * ...
131 }
132
133 if (basisIndex==_basisCos) {
134 //cos term: +/- (1-2w)*(1-a^2)/2
135 return -1*_tag*(1-2*_avgMistag)*(1-_absLambda*_absLambda)/2 ;
136 // = -_tag*avgDil * ...
137 }
138
139 return 0 ;
140}
141
142////////////////////////////////////////////////////////////////////////////////
143
145{
146 if (rangeName) return 0 ;
147
148 if (matchArgs(allVars,analVars,_tag)) return 1 ;
149 return 0 ;
150}
151
152////////////////////////////////////////////////////////////////////////////////
153
154double RooBCPEffDecay::coefAnalyticalIntegral(Int_t basisIndex, Int_t code, const char* /*rangeName*/) const
155{
156 switch(code) {
157 // No integration
158 case 0: return coefficient(basisIndex) ;
159
160 // Integration over 'tag'
161 case 1:
162 if (basisIndex==_basisExp) {
163 return (1+_absLambda*_absLambda) ;
164 }
165
167 return 0 ;
168 }
169 break ;
170
171 default:
172 assert(0) ;
173 }
174
175 return 0 ;
176}
177
178////////////////////////////////////////////////////////////////////////////////
179
181{
182 if (staticInitOK) {
183 if (matchArgs(directVars,generateVars,_t,_tag)) return 2 ;
184 }
185 if (matchArgs(directVars,generateVars,_t)) return 1 ;
186 return 0 ;
187}
188
189////////////////////////////////////////////////////////////////////////////////
190
192{
193 if (code==2) {
194 // Calculate the fraction of mixed events to generate
195 double sumInt = RooRealIntegral("sumInt","sum integral",*this,RooArgSet(_t.arg(),_tag.arg())).getVal() ;
196 _tag = 1 ;
197 double b0Int = RooRealIntegral("mixInt","mix integral",*this,RooArgSet(_t.arg())).getVal() ;
199 }
200}
201
202////////////////////////////////////////////////////////////////////////////////
203/// Generates mix-state dependent.
204/// \param[in] code
205
207{
208 if (code==2) {
209 double rand = RooRandom::uniform() ;
210 _tag = (rand<=_genB0Frac) ? 1 : -1 ;
211 }
212
213 // Generate delta-t dependent
214 while(true) {
215 double rand = RooRandom::uniform() ;
216 double tval(0) ;
217
218 switch(_type) {
219 case SingleSided:
220 tval = -_tau*log(rand);
221 break ;
222 case Flipped:
223 tval= +_tau*log(rand);
224 break ;
225 case DoubleSided:
226 tval = (rand<=0.5) ? -_tau*log(2*rand) : +_tau*log(2*(rand-0.5)) ;
227 break ;
228 }
229
230 // Accept event if T is in generated range
231 double maxDil = 1.0 ;
232 double al2 = _absLambda*_absLambda ;
233 double maxAcceptProb = (1+al2) + std::abs(maxDil*_CPeigenval*_absLambda*_argLambda) + std::abs(maxDil*(1-al2)/2);
234 double acceptProb = (1+al2)/2*(1-_tag*_delMistag)
236 - (_tag*(1-2*_avgMistag))*(1-al2)/2*cos(_dm*tval);
237
239
240 if (tval<_t.max() && tval>_t.min() && accept) {
241 _t = tval ;
242 break ;
243 }
244 }
245
246}
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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:142
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.
friend class RooRealIntegral
Definition RooAbsArg.h:543
A space to attach TBranches.
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:63
bool matchArgs(const RooArgSet &allDeps, RooArgSet &analDeps, const RooArgProxy &a, const Proxies &... proxies) const
Definition RooAbsReal.h:425
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:24
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:77
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.