Skip to content

Commit

Permalink
fiex?
Browse files Browse the repository at this point in the history
  • Loading branch information
VanyaBelyaev committed Feb 9, 2024
1 parent fd071b1 commit 30e9598
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
9 changes: 8 additions & 1 deletion ostap/fitting/simfit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,14 @@ def generate ( self ,

weight = None
wvar = None


if not varset :
varset = ROOT.RooArgSet ()
for lab in self.categories :
pdf = self.categories [ lab ]
for v in pdf.vars :
if not v in varset : varset.add ( v )

## generate all categories separately:
for label in nEvents :

Expand Down
20 changes: 19 additions & 1 deletion ostap/fitting/tests/test_fitting_simfit7.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@
fDATA = model_sim.draw ( 'DATA' , cds )
with use_canvas ( 'test_simfit7: simultaneous fit/MC' ) :
fMC = model_sim.draw ( 'MC' , cds )



# =============================================================================
## (2) Perform DATA fit with MC constraints to get scale-factor
# =============================================================================
Expand All @@ -113,6 +114,23 @@

logger.info ( "Scale factor from 'simultaneous' fit: %s" % ( rSIM .sfactor * 1 ) )
logger.info ( "Scale factor from 'constrained' fit: %s" % ( rDATA.sfactor * 1 ) )


# =========================================================================
## test creation of dataset
# =========================================================================
ds_gen = model_sim.generate ( nEvents = { 'MC' : len ( ds_MC ) ,
'DATA' : len ( ds_DATA ) } ,
varset = vars )

rg , f = model_sim.fitTo ( ds_gen , silent = True )
rg , f = model_sim.fitTo ( ds_gen , silent = True )

title = 'Results of simultaneous fit to generated dataset'
logger.info ( '%s\n%s' % ( title , rg.table ( title = title , prefix = '# ' ) ) )




# =============================================================================
## The END
Expand Down

0 comments on commit 30e9598

Please sign in to comment.