Skip to content

Commit df91324

Browse files
committed
fix?
1 parent c1006b7 commit df91324

File tree

12 files changed

+236
-278
lines changed

12 files changed

+236
-278
lines changed

ostap/core/base.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@
3232
'valid_pointer' , ## valid C++ pointer?
3333
)
3434
# =============================================================================
35-
from ostap.utils.basic import NoContext
36-
import ROOT, cppyy
35+
import ostap.fixes.fixes
36+
from ostap.utils.basic import NoContext
37+
import ROOT, cppyy
3738
# =============================================================================
3839
## get global C++ namespace
3940
cpp = cppyy.gbl
@@ -304,14 +305,16 @@ def rootException () :
304305
return RootError2Exception()
305306

306307
# =============================================================================
307-
## with ROOTIgnore ( ROOT.kError ) :
308-
if True :
308+
with ROOTIgnore ( ROOT.kError ) :
309+
## if True :
310+
print ( 'OSTAP' , dir(Ostap) )
311+
print ( 'HAS UTILS?' , hasattr ( Ostap , 'Utils' ) )
309312
_error_sentry_ = Ostap.Utils.ErrorSentry
310313
## valid C++ pointer ?
311314
_valid_pointer_ = Ostap.Utils.valid_pointer
312315
_rootID_ = Ostap.Utils.rootID
313316
## used by ROOT/RooFit ?
314-
usedRootID = Ostap.Utils.usedRootID
317+
usedRootID = Ostap.Utils.usedRootID
315318

316319
# =============================================================================
317320
## global identifier for ROOT objects

ostap/core/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
##
6969
)
7070
# =============================================================================
71-
from ostap.core.meta_info import root_info
7271
from ostap.core.base import ( rootID ,
7372
usedRootID ,
7473
ROOTIgnore ,
@@ -80,6 +79,7 @@
8079
roo_silent ,
8180
rootError ,
8281
rootWarning )
82+
from ostap.core.meta_info import root_info
8383
from ostap.math.base import ( Ostap , std , cpp ,
8484
iszero , isequal ,
8585
isint , islong ,

ostap/fitting/resolution.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,11 +322,10 @@ def __init__ ( self ,
322322
self.roo_name ( 'rgauss2_' ) ,
323323
"Resolution double Gauss %s" % self.name ,
324324
self.xvar ,
325+
self.mean ,
325326
self.sigma_corr , ## ATTENTION!
326327
self.fraction ,
327-
self.sigma_scale ,
328-
self.mean
329-
)
328+
self.sigma_scale )
330329

331330
## save the configuration
332331
self.config = {

ostap/fitting/rooreduce.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2645,14 +2645,14 @@ def _r2expo_reduce_ ( pdf ):
26452645
## reduce DoubleGauss
26462646
def _r2gau_reduce_ ( pdf ):
26472647
""" Reduce DoubleGauss"""
2648-
return root_store_factory , ( type ( pdf ) ,
2649-
pdf.name ,
2650-
pdf.title ,
2651-
pdf.x () ,
2652-
pdf.sigma () ,
2653-
pdf.fraction () ,
2654-
pdf.scale () ,
2655-
pdf.mean () )
2648+
return root_store_factory , ( type ( pdf ) ,
2649+
pdf.name ,
2650+
pdf.title ,
2651+
pdf.x () ,
2652+
pdf.mean () ,
2653+
pdf.sigma () ,
2654+
pdf.fraction () ,
2655+
pdf.sigma_scale () )
26562656

26572657
Ostap.Models.DoubleGauss.__reduce__ = _r2gau_reduce_
26582658

@@ -2663,11 +2663,11 @@ def _r2gau2_reduce_ ( pdf ):
26632663
return root_store_factory , ( type ( pdf ) ,
26642664
pdf.name ,
26652665
pdf.title ,
2666-
pdf.x () ,
2666+
pdf.x () ,
2667+
pdf.mean () ,
26672668
pdf.sigma () ,
26682669
pdf.fraction () ,
2669-
pdf.delta () ,
2670-
pdf.mean () )
2670+
pdf.delta () )
26712671

26722672
Ostap.Models.DoubleGauss2.__reduce__ = _r2gau2_reduce_
26732673

ostap/fitting/signals.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,10 +1075,10 @@ def __init__ ( self ,
10751075
self.roo_name ( 'gauss2_' ) ,
10761076
"double Gauss %s" % self.name ,
10771077
self.mass ,
1078+
self.mean ,
10781079
self.sigma ,
10791080
self.fraction ,
10801081
self.sigma_scale ,
1081-
self.mean
10821082
)
10831083

10841084
## save the configuration
@@ -1157,10 +1157,10 @@ def __init__ ( self ,
11571157
self.roo_name ( 'gauss2_' ) ,
11581158
"double Gauss2 %s" % self.name ,
11591159
self.mass ,
1160-
self.sigma ,
1160+
self.mean ,
1161+
self.sigma ,
11611162
self.fraction ,
1162-
self.delta ,
1163-
self.mean )
1163+
self.delta )
11641164

11651165
## save the configuration
11661166
self.config = {

ostap/fixes/fixes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def __exit__(self, *_):
9797
# Include path for ACLiC:
9898
# =============================================================================
9999
opath = ROOT.gSystem.GetIncludePath()
100-
## logger.debug ( 'Old include ath: %s' % opath )
100+
## logger.debug ( 'Old include path: %s' % opath )
101101
opath = opath.replace ( '-I' , ' ' ) . split ()
102102
## add gsl ?
103103
opath.append ( '$OSTAP_DIR/include' )

ostap/math/more_reduce.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,10 @@ def _om2g_reduce_ ( peak ) :
306306
- see `Ostap.Math.GoubleGauss`
307307
"""
308308
return root_factory , ( type ( peak ) ,
309-
peak.m0 () , peak.sigma() ,
310-
peak.fraction () , peak.scale() )
309+
peak.m0 () ,
310+
peak.sigma () ,
311+
peak.fraction () ,
312+
peak.sigma_scale () )
311313

312314
Ostap.Math.DoubleGauss. __reduce__ = _om2g_reduce_
313315

@@ -319,8 +321,10 @@ def _om2g2_reduce_ ( peak ) :
319321
- see `Ostap.Math.GoubleGauss2`
320322
"""
321323
return root_factory , ( type ( peak ) ,
322-
peak.m0 () , peak.sigma() ,
323-
peak.fraction () , peak.delta() )
324+
peak.m0 () ,
325+
peak.sigma () ,
326+
peak.fraction () ,
327+
peak.delta () )
324328

325329
Ostap.Math.DoubleGauss2. __reduce__ = _om2g2_reduce_
326330

source/include/Ostap/PDFs.h

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7708,23 +7708,23 @@ namespace Ostap
77087708
* Simple double Gaussian PDF
77097709
* suitable as resolution model
77107710
*/
7711-
class DoubleGauss: public RooAbsPdf
7711+
class DoubleGauss: public ShiftAndScale
77127712
{
77137713
public:
77147714
// ======================================================================
7715-
ClassDefOverride(Ostap::Models::DoubleGauss, 1) ;
7715+
ClassDefOverride(Ostap::Models::DoubleGauss, 2) ;
77167716
// ======================================================================
77177717
public:
77187718
// ======================================================================
77197719
/// constructor from all parameters
77207720
DoubleGauss
7721-
( const char* name ,
7722-
const char* title ,
7723-
RooAbsReal& x ,
7724-
RooAbsReal& sigma , // narrow sigma
7725-
RooAbsReal& fraction , // fraction of narrow sigma
7726-
RooAbsReal& scale , // wide/narrow sigma ratio
7727-
RooAbsReal& mean ) ; // mean, presumably fixed at 0
7721+
( const char* name ,
7722+
const char* title ,
7723+
RooAbsReal& x ,
7724+
RooAbsReal& mean , // mean, presumably fixed at 0
7725+
RooAbsReal& sigma , // narrow sigma
7726+
RooAbsReal& fraction , // fraction of narrow sigma
7727+
RooAbsReal& sigma_scale ) ; // wide/narrow sigma ratio
77287728
/// "copy" constructor
77297729
DoubleGauss ( const DoubleGauss& , const char* name = 0 ) ;
77307730
/// virtual destructor
@@ -7770,19 +7770,17 @@ namespace Ostap
77707770
// =====================================================================
77717771
public:
77727772
// ======================================================================
7773-
const RooAbsReal& x () const { return m_x .arg() ; }
7774-
const RooAbsReal& sigma () const { return m_sigma .arg() ; }
7775-
const RooAbsReal& fraction () const { return m_fraction .arg() ; }
7776-
const RooAbsReal& scale () const { return m_scale .arg() ; }
7777-
const RooAbsReal& mean () const { return m_mean .arg() ; }
7773+
const RooAbsReal& x () const { return m_x .arg() ; }
7774+
const RooAbsReal& fraction () const { return m_fraction .arg() ; }
7775+
const RooAbsReal& sigma_scale () const { return m_sigma_scale .arg() ; }
7776+
//
7777+
const RooAbsReal& mean () const { return shift () ; }
7778+
const RooAbsReal& sigma () const { return scale () ; }
77787779
// ======================================================================
77797780
protected:
77807781
// =====================================================================
7781-
RooRealProxy m_x {} ;
7782-
RooRealProxy m_sigma {} ;
7783-
RooRealProxy m_fraction {} ;
7784-
RooRealProxy m_scale {} ;
7785-
RooRealProxy m_mean {} ;
7782+
RooRealProxy m_fraction {} ;
7783+
RooRealProxy m_sigma_scale {} ;
77867784
// ======================================================================
77877785
protected: // the function
77887786
// ======================================================================
@@ -7794,11 +7792,11 @@ namespace Ostap
77947792
* Simple double Gaussian PDF
77957793
* suitable as resolution model
77967794
*/
7797-
class DoubleGauss2: public RooAbsPdf
7795+
class DoubleGauss2: public ShiftAndScale
77987796
{
77997797
public:
78007798
// ======================================================================
7801-
ClassDefOverride(Ostap::Models::DoubleGauss2, 1) ;
7799+
ClassDefOverride(Ostap::Models::DoubleGauss2, 2) ;
78027800
// ======================================================================
78037801
public:
78047802
// ======================================================================
@@ -7807,10 +7805,10 @@ namespace Ostap
78077805
( const char* name ,
78087806
const char* title ,
78097807
RooAbsReal& x ,
7810-
RooAbsReal& sigma , // narrow sigma
7808+
RooAbsReal& mean , // mean, presumably fixed at 0
7809+
RooAbsReal& sigma , // narrow sigma
78117810
RooAbsReal& fraction , // fraction of narrow sigma
7812-
RooAbsReal& delta , // wide/narrow delta
7813-
RooAbsReal& mean ) ; // mean, presumably fixed at 0
7811+
RooAbsReal& delta ) ; // wide/narrow delta
78147812
/// "copy" constructor
78157813
DoubleGauss2 ( const DoubleGauss2& , const char* name = 0 ) ;
78167814
/// virtual destructor
@@ -7856,19 +7854,16 @@ namespace Ostap
78567854
// =====================================================================
78577855
public:
78587856
// ======================================================================
7859-
const RooAbsReal& x () const { return m_x .arg() ; }
7860-
const RooAbsReal& sigma () const { return m_sigma .arg() ; }
78617857
const RooAbsReal& fraction () const { return m_fraction .arg() ; }
78627858
const RooAbsReal& delta () const { return m_delta .arg() ; }
7863-
const RooAbsReal& mean () const { return m_mean .arg() ; }
7859+
//
7860+
const RooAbsReal& sigma () const { return scale () ; }
7861+
const RooAbsReal& mean () const { return shift () ; }
78647862
// ======================================================================
78657863
protected:
78667864
// =====================================================================
7867-
RooRealProxy m_x {} ;
7868-
RooRealProxy m_sigma {} ;
78697865
RooRealProxy m_fraction {} ;
78707866
RooRealProxy m_delta {} ;
7871-
RooRealProxy m_mean {} ;
78727867
// ======================================================================
78737868
protected: // the function
78747869
// ======================================================================

0 commit comments

Comments
 (0)