@@ -83,8 +83,10 @@ def __init__(
8383 self .s_evtsel = datap ["analysis" ][self .typean ]["evtsel" ]
8484
8585 # bins: 2d array [[low, high], ...]
86- self .bins_skimming = np .array (list (zip (self .lpt_anbinmin , self .lpt_anbinmax )), "d" ) # TODO: replace with cfg
87- self .bins_analysis = np .array (list (zip (self .lpt_finbinmin , self .lpt_finbinmax )), "d" )
86+ self .bins_skimming = np .array (
87+ list (zip (self .lpt_anbinmin , self .lpt_anbinmax , strict = True )), "d"
88+ ) # TODO: replace with cfg
89+ self .bins_analysis = np .array (list (zip (self .lpt_finbinmin , self .lpt_finbinmax , strict = True )), "d" )
8890
8991 # skimming bins in overlap with the analysis range
9092 self .active_bins_skim = [
@@ -143,7 +145,7 @@ def _verify_variables(self, dfi):
143145 for idx , row in df .iterrows ():
144146 isSoftDropped = False
145147 nsd = 0
146- for zg , theta in zip (row ["zg_array" ], row ["fTheta" ]):
148+ for zg , theta in zip (row ["zg_array" ], row ["fTheta" ], strict = True ):
147149 if zg >= self .cfg ("zcut" , 0.1 ):
148150 if not isSoftDropped :
149151 df .loc [idx , "zg" ] = zg
@@ -178,7 +180,12 @@ def _calculate_variables(self, df, verify=False): # pylint: disable=invalid-nam
178180 df ["zg" ] = df ["zg_array" ].apply (lambda ar : next ((zg for zg in ar if zg >= zcut ), - 0.1 ))
179181 if "rg" in observables :
180182 df ["rg" ] = df [["zg_array" , "fTheta" ]].apply (
181- (lambda ar : next ((rg for (zg , rg ) in zip (ar .zg_array , ar .fTheta ) if zg >= zcut ), - 0.1 )), axis = 1
183+ (
184+ lambda ar : next (
185+ (rg for (zg , rg ) in zip (ar .zg_array , ar .fTheta , strict = True ) if zg >= zcut ), - 0.1
186+ )
187+ ),
188+ axis = 1 ,
182189 )
183190 if "nsd" in observables :
184191 df ["nsd" ] = df ["zg_array" ].apply (lambda ar : len ([zg for zg in ar if zg >= zcut ]))
@@ -232,7 +239,7 @@ def process_histomass_single(self, index):
232239 self .logger .info ("Processing (histomass) %s" , self .l_evtorig [index ])
233240
234241 print (f"Opening file { self .l_histomass [index ]} " , flush = True )
235- with TFile .Open (self .l_histomass [index ], "recreate" ) as rfile :
242+ with TFile .Open (self .l_histomass [index ], "recreate" ) as _ :
236243 dfevtorig = read_df (self .l_evtorig [index ])
237244 histonorm = TH1F ("histonorm" , "histonorm" , 4 , 0 , 4 )
238245 histonorm .SetBinContent (1 , len (dfquery (dfevtorig , self .s_evtsel )))
@@ -256,7 +263,7 @@ def process_histomass_single(self, index):
256263 get_axis (histonorm , 0 ).SetBinLabel (4 , "N_{BC}^{TVX}" )
257264 histonorm .Write ()
258265
259- if self .datatype != 'fd' :
266+ if self .datatype != "fd" :
260267 df = pd .concat (read_df (self .mptfiles_recosk [bin ][index ]) for bin in self .active_bins_skim )
261268 else :
262269 df = pd .concat (read_df (self .mptfiles_gensk [bin ][index ]) for bin in self .active_bins_skim )
@@ -489,7 +496,10 @@ def process_efficiency_single(self, index):
489496 }
490497
491498 for cat in cats :
492- print (f"Filling histograms for { cat } : { dfgen [cat ].info ()} , { dfdet [cat ].info ()} , { dfmatch [cat ].info ()} " , flush = True )
499+ print (
500+ f"Filling histograms for { cat } : { dfgen [cat ].info ()} , { dfdet [cat ].info ()} , { dfmatch [cat ].info ()} " ,
501+ flush = True ,
502+ )
493503 fill_hist (h_eff [(cat , "gen" )], dfgen [cat ][["fJetPt_gen" , "fPt_gen" ]])
494504 fill_hist (h_eff [(cat , "det" )], dfdet [cat ][["fJetPt" , "fPt" ]])
495505 if cat in dfmatch and dfmatch [cat ] is not None :
0 commit comments