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 149 of file rename_histos_in_files_from_old_code.py.

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

Variable Documentation

◆ currentdir

rename_histos_in_files_from_old_code.currentdir

Definition at line 288 of file rename_histos_in_files_from_old_code.py.

◆ dirlist

rename_histos_in_files_from_old_code.dirlist

Definition at line 289 of file rename_histos_in_files_from_old_code.py.

◆ histograms

rename_histos_in_files_from_old_code.histograms

Definition at line 294 of file rename_histos_in_files_from_old_code.py.

◆ input_file

rename_histos_in_files_from_old_code.input_file

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

◆ name_list

rename_histos_in_files_from_old_code.name_list

Definition at line 237 of file rename_histos_in_files_from_old_code.py.

◆ new_histo

rename_histos_in_files_from_old_code.new_histo

Definition at line 313 of file rename_histos_in_files_from_old_code.py.

◆ obj

rename_histos_in_files_from_old_code.obj

Definition at line 298 of file rename_histos_in_files_from_old_code.py.

◆ output_file

rename_histos_in_files_from_old_code.output_file

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

◆ path

rename_histos_in_files_from_old_code.path

Definition at line 264 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 35 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:149