ATLAS Offline Software
Functions
python.AutoconfigurePRW Namespace Reference

Functions

def getLumicalcFiles (campaign)
 
def actualMuFiles (campaign)
 
def defaultConfigFiles (campaign)
 
def getConfigurationFiles (campaign=None, dsid=None, data_type=None, files=None, useDefaultConfig=False)
 

Function Documentation

◆ actualMuFiles()

def python.AutoconfigurePRW.actualMuFiles (   campaign)

Definition at line 52 of file AutoconfigurePRW.py.

52 def actualMuFiles(campaign):
53  list = []
54 
55  if campaign in [Campaign.MC16d, Campaign.MC20d]:
56  list.append(
57  'GoodRunsLists/data17_13TeV/20180619/physics_25ns_Triggerno17e33prim.actualMu.OflLumi-13TeV-010.root'
58  )
59  elif campaign in [Campaign.MC16e, Campaign.MC20e]:
60  list.append(
61  'GoodRunsLists/data18_13TeV/20190318/physics_25ns_Triggerno17e33prim.actualMu.OflLumi-13TeV-010.root'
62  )
63  elif campaign in [Campaign.MC21a, Campaign.MC23a]:
64  list.append(
65  'GoodRunsLists/data22_13p6TeV/20230207/purw.actualMu.2022.root'
66  )
67  elif campaign in [Campaign.MC23c, Campaign.MC23d]:
68  list.append(
69  'GoodRunsLists/data23_13p6TeV/20230828/purw.actualMu.2023.root'
70  )
71  elif campaign in [Campaign.MC23e]:
72  list.append(
73  'GoodRunsLists/data24_13p6TeV/20240723/purw.actualMu.root'
74  )
75 
76  if campaign in [Campaign.MC16d, Campaign.MC20d, Campaign.MC16e, Campaign.MC20e, Campaign.MC21a, Campaign.MC23a, Campaign.MC23c, Campaign.MC23d, Campaign.MC23e]:
77  assert(len(list) == 1)
78  else:
79  assert(len(list) == 0)
80 
81  return list
82 
83 

◆ defaultConfigFiles()

def python.AutoconfigurePRW.defaultConfigFiles (   campaign)

Definition at line 84 of file AutoconfigurePRW.py.

84 def defaultConfigFiles(campaign):
85  list = []
86 
87  if campaign in [Campaign.MC20a]:
88  list.append(
89  'PileupReweighting/mc20_common/mc20a.284500.physlite.prw.v1.root'
90  )
91  elif campaign in [Campaign.MC20d]:
92  list.append(
93  'PileupReweighting/mc20_common/mc20d.300000.physlite.prw.v1.root'
94  )
95  elif campaign in [Campaign.MC20e]:
96  list.append(
97  'PileupReweighting/mc20_common/mc20e.310000.physlite.prw.v1.root'
98  )
99  elif campaign in [Campaign.MC21a]:
100  list.append(
101  'PileupReweighting/mc21_common/mc21a.410000.physlite.prw.v1.root'
102  )
103  elif campaign in [Campaign.MC23a]:
104  list.append(
105  'PileupReweighting/mc23_common/mc23a.410000.physlite.prw.v2.root'
106  )
107  elif campaign in [Campaign.MC23c]:
108  list.append(
109  'PileupReweighting/mc23_common/mc23c.450000.physlite.prw.v1.root'
110  )
111  elif campaign in [Campaign.MC23d]:
112  list.append(
113  'PileupReweighting/mc23_common/mc23d.450000.physlite.prw.v1.root'
114  )
115  elif campaign in [Campaign.MC23e]:
116  list.append(
117  'PileupReweighting/mc23_common/mc23e.470000.physlite.prw.v1.root'
118  )
119  else:
120  raise ValueError(f'Unsupported campaign {campaign}')
121 
122  assert(len(list) == 1)
123 
124  return list
125 
126 

◆ getConfigurationFiles()

def python.AutoconfigurePRW.getConfigurationFiles (   campaign = None,
  dsid = None,
  data_type = None,
  files = None,
  useDefaultConfig = False 
)

Definition at line 127 of file AutoconfigurePRW.py.

127 def getConfigurationFiles(campaign=None, dsid=None, data_type=None, files=None, useDefaultConfig=False):
128  # Attempt auto-configuration
129  default_directory = 'dev/PileupReweighting/share'
130  configuration_files = []
131 
132  if files is not None and (campaign is None or dsid is None or data_type is None):
133  if campaign is None:
134  campaign = getMCCampaign(files)
135 
136  if dsid is None or data_type is None:
137  from AthenaConfiguration.AutoConfigFlags import GetFileMD
138  metadata = GetFileMD(files)
139  if dsid is None:
140  dsid = str(metadata.get('mc_channel_number', 0))
141  if data_type is None:
142  simulation_flavour = GetFileMD(files).get('Simulator', '')
143  if not simulation_flavour:
144  simulation_flavour = GetFileMD(files).get('SimulationFlavour', '')
145  data_type = DataType.FullSim if (not simulation_flavour or 'FullG4' in simulation_flavour) else DataType.FastSim
146 
147  # data_type as in pileup analysis sequence: either 'data' or ('fullsim' or 'af3')
148  if data_type is DataType.Data:
149  raise ValueError('Data is not supported')
150 
151  if data_type is DataType.FullSim:
152  simulation_type = 'FS'
153  elif data_type is DataType.FastSim:
154  simulation_type = 'AF3'
155  else:
156  raise ValueError(f'Invalid data_type {data_type}')
157 
158  configuration_files = actualMuFiles(campaign)
159  if useDefaultConfig:
160  configuration_files += defaultConfigFiles(campaign)
161  return configuration_files
162 
163  config = f'{default_directory}/DSID{dsid[:3]}xxx/pileup_{campaign.value}_dsid{dsid}_{simulation_type}.root'
164  from PathResolver import PathResolver
165  if not PathResolver.FindCalibFile(config):
166  return []
167  else:
168  configuration_files.append(config)
169  return configuration_files

◆ getLumicalcFiles()

def python.AutoconfigurePRW.getLumicalcFiles (   campaign)
Returns the list of lumicalc files for a given campaign 

Definition at line 6 of file AutoconfigurePRW.py.

6 def getLumicalcFiles(campaign):
7  """ Returns the list of lumicalc files for a given campaign """
8  ilumical_files = {
9  Campaign.MC16a: [
10  'GoodRunsLists/data15_13TeV/20170619/PHYS_StandardGRL_All_Good_25ns_276262-284484_OflLumi-13TeV-008.root',
11  'GoodRunsLists/data16_13TeV/20180129/PHYS_StandardGRL_All_Good_25ns_297730-311481_OflLumi-13TeV-009.root'
12  ],
13  Campaign.MC16d: [
14  'GoodRunsLists/data17_13TeV/20180619/physics_25ns_Triggerno17e33prim.lumicalc.OflLumi-13TeV-010.root'
15  ],
16  Campaign.MC16e: [
17  'GoodRunsLists/data18_13TeV/20190318/ilumicalc_histograms_None_348885-364292_OflLumi-13TeV-010.root'
18  ],
19  Campaign.MC20a: [
20  'GoodRunsLists/data15_13TeV/20170619/PHYS_StandardGRL_All_Good_25ns_276262-284484_OflLumi-13TeV-008.root',
21  'GoodRunsLists/data16_13TeV/20180129/PHYS_StandardGRL_All_Good_25ns_297730-311481_OflLumi-13TeV-009.root'
22  ],
23  Campaign.MC20d: [
24  'GoodRunsLists/data17_13TeV/20180619/physics_25ns_Triggerno17e33prim.lumicalc.OflLumi-13TeV-010.root'
25  ],
26  Campaign.MC20e: [
27  'GoodRunsLists/data18_13TeV/20190318/ilumicalc_histograms_None_348885-364292_OflLumi-13TeV-010.root'
28  ],
29  Campaign.MC21a: [
30  'GoodRunsLists/data22_13p6TeV/20230207/ilumicalc_histograms_None_431810-440613_OflLumi-Run3-003.root'
31  ],
32  Campaign.MC23a: [
33  'GoodRunsLists/data22_13p6TeV/20230207/ilumicalc_histograms_None_431810-440613_OflLumi-Run3-003.root'
34  ],
35  Campaign.MC23c: [
36  'GoodRunsLists/data23_13p6TeV/20230828/ilumicalc_histograms_None_451587-456749_OflLumi-Run3-003.root'
37  ],
38  Campaign.MC23d: [
39  'GoodRunsLists/data23_13p6TeV/20230828/ilumicalc_histograms_None_451587-456749_OflLumi-Run3-003.root'
40  ],
41  Campaign.MC23e: [
42  'GoodRunsLists/data24_13p6TeV/20240723/ilumicalc_histograms_None_472943-477048_OflLumi-Run3-005.root'
43  ]
44  }
45 
46  try:
47  return ilumical_files[campaign]
48  except KeyError:
49  raise ValueError(f'Unsupported campaign {campaign} for lumicalc files')
50 
51 
PathResolver::FindCalibFile
static std::string FindCalibFile(const std::string &logical_file_name)
Definition: PathResolver.h:108
python.AutoconfigurePRW.actualMuFiles
def actualMuFiles(campaign)
Definition: AutoconfigurePRW.py:52
python.AutoConfigFlags.GetFileMD
def GetFileMD(filenames, allowEmpty=True)
Definition: AutoConfigFlags.py:51
python.AutoconfigurePRW.getConfigurationFiles
def getConfigurationFiles(campaign=None, dsid=None, data_type=None, files=None, useDefaultConfig=False)
Definition: AutoconfigurePRW.py:127
python.AutoconfigurePRW.defaultConfigFiles
def defaultConfigFiles(campaign)
Definition: AutoconfigurePRW.py:84
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127
str
Definition: BTagTrackIpAccessor.cxx:11
python.AutoconfigurePRW.getLumicalcFiles
def getLumicalcFiles(campaign)
Definition: AutoconfigurePRW.py:6
python.Utils.getMCCampaign
def getMCCampaign(files)
Definition: Tools/Campaigns/python/Utils.py:27