Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 150 of file rename_histos_in_files_from_old_code.py.

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

Variable Documentation

◆ currentdir

rename_histos_in_files_from_old_code.currentdir

Definition at line 289 of file rename_histos_in_files_from_old_code.py.

◆ dirlist

rename_histos_in_files_from_old_code.dirlist

Definition at line 290 of file rename_histos_in_files_from_old_code.py.

◆ histograms

rename_histos_in_files_from_old_code.histograms

Definition at line 295 of file rename_histos_in_files_from_old_code.py.

◆ input_file

rename_histos_in_files_from_old_code.input_file

Definition at line 275 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 17 of file rename_histos_in_files_from_old_code.py.

◆ jet_collections

rename_histos_in_files_from_old_code.jet_collections

Definition at line 24 of file rename_histos_in_files_from_old_code.py.

◆ name_associations

rename_histos_in_files_from_old_code.name_associations

Definition at line 247 of file rename_histos_in_files_from_old_code.py.

◆ name_list

rename_histos_in_files_from_old_code.name_list

Definition at line 238 of file rename_histos_in_files_from_old_code.py.

◆ new_histo

rename_histos_in_files_from_old_code.new_histo

Definition at line 314 of file rename_histos_in_files_from_old_code.py.

◆ obj

rename_histos_in_files_from_old_code.obj

Definition at line 299 of file rename_histos_in_files_from_old_code.py.

◆ output_file

rename_histos_in_files_from_old_code.output_file

Definition at line 260 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 253 of file rename_histos_in_files_from_old_code.py.

◆ path

rename_histos_in_files_from_old_code.path

Definition at line 265 of file rename_histos_in_files_from_old_code.py.

◆ production_process

rename_histos_in_files_from_old_code.production_process

Definition at line 20 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 36 of file rename_histos_in_files_from_old_code.py.

◆ verbose

rename_histos_in_files_from_old_code.verbose

Definition at line 22 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:150