1 from __future__
import print_function
5 luminorm and correction functions. 6 The result of the functions are correction factors, not final luminosity 7 all functions take 5 run time parameters, and arbituary named params 10 def fPoly(self,luminonorm,intglumi,nBXs,whatev,whatav,a0=1.0,a1=0.0,a2=0.0,drift=0.0,c1=0.0,afterglow=''):
12 input: luminonorm unit Hz/ub 13 output: correction factor to be applied on lumi in Hz/ub 17 avglumi=c1*luminonorm/nBXs
20 afterglowmap=ast.literal_eval(afterglow)
21 for (bxthreshold,correction)
in afterglowmap:
22 if nBXs >= bxthreshold :
23 Afterglow = correction
25 if drift
and intglumi:
26 driftterm=1.0+drift*intglumi
27 result=a0*Afterglow/(1+a1*avglumi+a2*avglumi*avglumi)*driftterm
30 def fPolyScheme(self,luminonorm,intglumi,nBXs,fillschemeStr,fillschemePatterns,a0=1.0,a1=0.0,a2=0.0,drift=0.0,c1=0.0):
32 input: luminonorm unit Hz/ub 33 input: fillschemePatterns [(patternStr,afterglow]) 34 output: correction factor to be applied on lumi in Hz/ub 38 avglumi=c1*luminonorm/nBXs
40 if fillschemeStr
and fillschemePatterns:
41 for apattern,cfactor
in fillschemePatterns.items():
42 if re.match(apattern,fillschemeStr):
45 if drift
and intglumi:
46 driftterm=1.0+drift*intglumi
47 result=a0*Afterglow/(1+a1*avglumi+a2*avglumi*avglumi)*driftterm
53 myfunc=getattr(fac,funcName,
None)
54 except AttributeError:
55 print(
'[ERROR] unknown correction function '+funcName)
58 return myfunc(*args,**kwds)
60 raise ValueError(
'uncallable function '+funcName)
61 if __name__ ==
'__main__':
63 luminonorm=0.5061*1.0e3
66 constParams={
'a0':1.0}
67 argvals=[luminonorm,intglumi,nBXs,0.0,0.0]
69 polyParams={
'a0':7.268,
'a1':0.063,
'a2':-0.0037,
'drift':0.01258,
'c1':6.37,
'afterglow':
'[(213,0.992), (321,0.99), (423,0.988), (597,0.985), (700,0.984), (873,0.981), (1041,0.979), (1179,0.977),(1317,0.975)]'}
71 polyParams={
'a0':7.268,
'a1':0.063,
'a2':-0.0037,
'drift':0.0,
'c1':6.37,
'afterglow':
'[(213,0.992), (321,0.99), (423,0.988), (597,0.985), (700,0.984), (873,0.981), (1041,0.979), (1179,0.977),(1317,0.975)]'}
73 constParams={
'a0':7.268}
def normFunctionCaller(funcName, args, kwds)
S & print(S &os, JobReport::InputFile const &f)
def fPoly(self, luminonorm, intglumi, nBXs, whatev, whatav, a0=1.0, a1=0.0, a2=0.0, drift=0.0, c1=0.0, afterglow='')
def fPolyScheme(self, luminonorm, intglumi, nBXs, fillschemeStr, fillschemePatterns, a0=1.0, a1=0.0, a2=0.0, drift=0.0, c1=0.0)