ATLAS Offline Software
Functions | Variables
rename_histos_in_files_from_old_code Namespace Reference

Functions

def get_name_associations (list)
 

Variables

 input_file_name
 
 production_process
 
 verbose
 
 jet_collections
 
 var_name_list
 don't change here More...
 
 name_list
 
 name_associations
 
 output_file_name
 
 output_file
 
 path
 
 input_file
 
 currentdir
 
 dirlist
 
 histograms
 
 obj
 
 new_histo
 

Function Documentation

◆ get_name_associations()

def rename_histos_in_files_from_old_code.get_name_associations (   list)

Definition at line 146 of file rename_histos_in_files_from_old_code.py.

146 def get_name_associations(list):
147 
148  taggers = ["_IP3D_", "_SV1_", "_JetFitter_"]
149  old_taggers = ["_IP2D_"]
150  oneToOne_associations = {
151  '_truthLabel ': '_jet_truthLabel ',
152  '_IP3Dpb ': '_tagger_IP3D_pb ',
153  '_IP3Dpc ': '_tagger_IP3D_pc ',
154  '_IP3Dpu ': '_tagger_IP3D_pu ',
155  '_SV1pb ': '_tagger_SV1_pb ',
156  '_SV1pc ': '_tagger_SV1_pc ',
157  '_SV1pu ': '_tagger_SV1_pu ',
158  '_NTracksIP3D ': '_tagger_IP3D_NTracks_incl ',
159  '_NTracksIP2D ': '_old_taggers_IP2D_NTracks_incl ',
160  '_NGTinSvx1 ': '_tagger_SV1_nGoodTracks_incl ',
161  '_eta ': '_jet_jet_eta ',
162  '_phi ': '_jet_jet_phi ',
163  '_d0 ': '_tracks_d0_b ',
164  '_z0 ': '_tracks_z0_b ',
165  '_IP3DgradeOfTracks ': '_tagger_IP3D_gradeOfTracks_incl ',
166  '_IP2DgradeOfTracks ': '_old_taggers_IP2D_gradeOfTracks_incl ',
167  }
168  oneToOne_associations_ttbar = {
169  '_TruthBpt ': '_jet_jet_pt_b_ttbar ',
170  '_TruthLpt ': '_jet_jet_pt_l_ttbar ',
171  '_TruthCpt ': '_jet_jet_pt_c_ttbar ',
172  '_e ': '_jet_jet_e ',
173  '_pt ': '_jet_jet_pt_ttbar ',
174  }
175  oneToOne_associations_Zprime = {
176  '_TruthBpt ': '_jet_jet_pt_b_Zprime ',
177  '_TruthLpt ': '_jet_jet_pt_l_Zprime ',
178  '_TruthCpt ': '_jet_jet_pt_c_Zprime ',
179  '_e ': '_jet_jet_e_Zprime ',
180  '_pt ': '_jet_jet_pt_Zprime ',
181  }
182 
183  name_associations = {}
184 
185  for name in list:
186  new_name = name
187 
188  for tag in taggers:
189  if tag in new_name:
190  new_name = new_name.replace(tag, "_tagger" + tag)
191 
192  for tag in old_taggers:
193  if tag in new_name:
194  new_name = new_name.replace(tag, "_old_taggers" + tag)
195 
196  if "_matched_pt" in new_name:
197  new_name = new_name.replace("_matched_pt", "_matched_pt_" + production_process)
198 
199  if "AntiKt4EMPFlowJets" in new_name:
200  new_name = new_name.replace("AntiKt4EMPFlowJets", "AntiKt4EMPFlowJets_")
201 
202  for key in oneToOne_associations:
203  if key in new_name:
204  new_name = new_name.replace(key, oneToOne_associations[key])
205 
206  if production_process == 'ttbar':
207  for key in oneToOne_associations_ttbar:
208  if key in new_name:
209  new_name = new_name.replace(key, oneToOne_associations_ttbar[key])
210 
211  if production_process == 'Zprime':
212  for key in oneToOne_associations_Zprime:
213  if key in new_name:
214  new_name = new_name.replace(key, oneToOne_associations_Zprime[key])
215 
216  # if new_name not in new_list and "tau" not in new_name and "Tau" not in new_name and not "_NGTinSvx0" in new_name:
217  # print(new_name)
218 
219  # remove spaces
220  name = name.replace(" ", "")
221  new_name = new_name.replace(" ", "")
222 
223  # fill the dict
224  name_associations[name] = new_name
225 
226  return name_associations
227 
228 
229 
230 # get the name_list for all jet collections

Variable Documentation

◆ currentdir

rename_histos_in_files_from_old_code.currentdir

Definition at line 282 of file rename_histos_in_files_from_old_code.py.

◆ dirlist

rename_histos_in_files_from_old_code.dirlist

Definition at line 283 of file rename_histos_in_files_from_old_code.py.

◆ histograms

rename_histos_in_files_from_old_code.histograms

Definition at line 288 of file rename_histos_in_files_from_old_code.py.

◆ input_file

rename_histos_in_files_from_old_code.input_file

Definition at line 268 of file rename_histos_in_files_from_old_code.py.

◆ input_file_name

rename_histos_in_files_from_old_code.input_file_name

Definition at line 16 of file rename_histos_in_files_from_old_code.py.

◆ jet_collections

rename_histos_in_files_from_old_code.jet_collections

Definition at line 23 of file rename_histos_in_files_from_old_code.py.

◆ name_associations

rename_histos_in_files_from_old_code.name_associations

Definition at line 240 of file rename_histos_in_files_from_old_code.py.

◆ name_list

rename_histos_in_files_from_old_code.name_list

Definition at line 231 of file rename_histos_in_files_from_old_code.py.

◆ new_histo

rename_histos_in_files_from_old_code.new_histo

Definition at line 307 of file rename_histos_in_files_from_old_code.py.

◆ obj

rename_histos_in_files_from_old_code.obj

Definition at line 292 of file rename_histos_in_files_from_old_code.py.

◆ output_file

rename_histos_in_files_from_old_code.output_file

Definition at line 253 of file rename_histos_in_files_from_old_code.py.

◆ output_file_name

rename_histos_in_files_from_old_code.output_file_name

Definition at line 246 of file rename_histos_in_files_from_old_code.py.

◆ path

rename_histos_in_files_from_old_code.path

Definition at line 258 of file rename_histos_in_files_from_old_code.py.

◆ production_process

rename_histos_in_files_from_old_code.production_process

Definition at line 19 of file rename_histos_in_files_from_old_code.py.

◆ var_name_list

rename_histos_in_files_from_old_code.var_name_list

don't change here

Definition at line 32 of file rename_histos_in_files_from_old_code.py.

◆ verbose

rename_histos_in_files_from_old_code.verbose

Definition at line 21 of file rename_histos_in_files_from_old_code.py.

rename_histos_in_files_from_old_code.get_name_associations
def get_name_associations(list)
Definition: rename_histos_in_files_from_old_code.py:146