@@ -79,16 +79,18 @@ def tcards(theoryid):
7979def ekos (theoryid , datasets , overwrite ):
8080 """Command to generate numerical FONLL ekos.
8181
82- 1. Create the 3 operator cards for the different flavor patches.
82+ 1. Create all the operator cards for the different flavor patches.
8383 2. Run the 3 ekos for the different flavor patches.
8484 3. Inherit the ekos.
8585 """
86- for nf_id in [ "00" , "04" , "05" ]:
87- # create opcards
86+ # Create all the operator cards as they are required for careful testing
87+ for nf_id in range ( 7 ):
8888 theory .TheoryBuilder (
89- f"{ theoryid } { nf_id } " , datasets , overwrite = overwrite
89+ f"{ theoryid } 0 { nf_id } " , datasets , overwrite = overwrite
9090 ).opcards ()
9191
92+ # Most of the time only these 3 patches are necessary
93+ for nf_id in ["00" , "04" , "05" ]:
9294 # run the ekos
9395 theory .TheoryBuilder (
9496 f"{ theoryid } { nf_id } " ,
@@ -98,25 +100,29 @@ def ekos(theoryid, datasets, overwrite):
98100 overwrite = overwrite ,
99101 ).ekos ()
100102
101- # now inherit ekos
102- # nf=3
103- rich .print (f"[green] Inherit nf=3 ekos from theory { theoryid } 00" )
104- theory .TheoryBuilder (f"{ theoryid } 00" , datasets , overwrite = overwrite ).inherit_ekos (
105- f"{ theoryid } 01"
106- )
107- # nf=4
108- rich .print (f"[green] Inherit nf=4 ekos from theory { theoryid } 04" )
109- theory .TheoryBuilder (f"{ theoryid } 04" , datasets , overwrite = overwrite ).inherit_ekos (
110- f"{ theoryid } 02"
111- )
112- theory .TheoryBuilder (f"{ theoryid } 04" , datasets , overwrite = overwrite ).inherit_ekos (
113- f"{ theoryid } 03"
114- )
115- # nf=5
116- rich .print (f"[green] Inherit nf=5 ekos from theory { theoryid } 05" )
117- theory .TheoryBuilder (f"{ theoryid } 05" , datasets , overwrite = overwrite ).inherit_ekos (
118- f"{ theoryid } 06"
119- )
103+ # Now _attempt_ to inherit the ekos
104+ # _if_ a discrepancy is found between the eko and the grid, recompute
105+
106+ inheritance_map = {"00" : ["01" ], "04" : ["02" , "03" ], "05" : ["06" ]}
107+ for i , (source , targets ) in enumerate (inheritance_map .items ()):
108+ source_tid = f"{ theoryid } { source } "
109+ rich .print (f"[green] Inherit nf={ 3 + i } ekos from theory { source_tid } " )
110+ source_theory = theory .TheoryBuilder (source_tid , datasets , overwrite = overwrite )
111+ for target in targets :
112+ target_tid = f"{ theoryid } { target } "
113+ try :
114+ source_theory .inherit_ekos (target_tid , careful = True )
115+ except AssertionError as e :
116+ rich .print (
117+ f"[red] Could not inherit from theory { source_tid } to { target_tid } , computing the EKO"
118+ )
119+ theory .TheoryBuilder (
120+ target_tid ,
121+ datasets ,
122+ silent = False ,
123+ clear_logs = True ,
124+ overwrite = overwrite ,
125+ ).ekos ()
120126
121127
122128@fonll_ .command ()
0 commit comments