CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/HiggsAnalysis/CombinedLimit/python/HiggsJPC.py

Go to the documentation of this file.
00001 from HiggsAnalysis.CombinedLimit.PhysicsModel import *
00002 
00003 ### This base class implements signal yields by production and decay mode
00004 ### Specific models can be obtained redefining getHiggsSignalYieldScale
00005 class TwoHypotesisHiggs(PhysicsModel):
00006     def __init__(self): 
00007         self.mHRange = []
00008         self.muAsPOI    = False
00009         self.muFloating = False
00010         self.altSignal  = "ALT"
00011     def getYieldScale(self,bin,process):
00012         "Split in production and decay, and call getHiggsSignalYieldScale; return 1 for backgrounds "
00013         if not self.DC.isSignal[process]: return 1
00014         #print "Process ",process," will get norm ",self.sigNorms[self.altSignal in process]
00015         return self.sigNorms[self.altSignal in process]
00016     def setPhysicsOptions(self,physOptions):
00017         for po in physOptions:
00018             if po == "muAsPOI": 
00019                 print "Will consider the signal strength as a parameter of interest"
00020                 self.muAsPOI = True
00021                 self.muFloating = True
00022             if po == "muFloating": 
00023                 print "Will consider the signal strength as a floating parameter (as a parameter of interest if --PO muAsPOI is specified, as a nuisance otherwise)"
00024                 self.muFloating = True
00025             if po.startswith("altSignal="): self.altSignal = po.split(",")[1]
00026             if po.startswith("higgsMassRange="):
00027                 self.mHRange = po.replace("higgsMassRange=","").split(",")
00028                 if len(self.mHRange) != 2:
00029                     raise RuntimeError, "Higgs mass range definition requires two extrema"
00030                 elif float(self.mHRange[0]) >= float(self.mHRange[1]):
00031                     raise RuntimeError, "Extrema for Higgs mass range defined with inverterd order. Second must be larger the first"
00032     def doParametersOfInterest(self):
00033         """Create POI and other parameters, and define the POI set."""
00034         self.modelBuilder.doVar("x[0,0,1]");
00035         poi = "x"
00036         if self.muFloating: 
00037             self.modelBuilder.doVar("r[1,0,10]");
00038             if self.muAsPOI: poi += ",r"
00039             self.modelBuilder.factory_("expr::r_times_not_x(\"@0*(1-@1)\", r, x)")
00040             self.modelBuilder.factory_("expr::r_times_x(\"@0*@1\", r, x)")
00041             self.sigNorms = { True:'r_times_x', False:'r_times_not_x' }
00042         else:
00043             self.modelBuilder.factory_("expr::not_x(\"(1-@1)\", x)")
00044             self.sigNorms = { True:'x', False:'not_x' }
00045         if self.modelBuilder.out.var("MH"):
00046             if len(self.mHRange):
00047                 print 'MH will be left floating within', self.mHRange[0], 'and', self.mHRange[1]
00048                 self.modelBuilder.out.var("MH").setRange(float(self.mHRange[0]),float(self.mHRange[1]))
00049                 self.modelBuilder.out.var("MH").setConstant(False)
00050                 poi+=',MH'
00051             else:
00052                 print 'MH will be assumed to be', self.options.mass
00053                 self.modelBuilder.out.var("MH").removeRange()
00054                 self.modelBuilder.out.var("MH").setVal(self.options.mass)
00055         else:
00056             if len(self.mHRange):
00057                 print 'MH will be left floating within', self.mHRange[0], 'and', self.mHRange[1]
00058                 self.modelBuilder.doVar("MH[%s,%s]" % (self.mHRange[0],self.mHRange[1]))
00059                 poi+=',MH'
00060             else:
00061                 print 'MH (not there before) will be assumed to be', self.options.mass
00062                 self.modelBuilder.doVar("MH[%g]" % self.options.mass)
00063         self.modelBuilder.doSet("POI",poi)
00064 
00065 twoHypothesisHiggs = TwoHypotesisHiggs()
00066