CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
UserOptions_cff.py
Go to the documentation of this file.
1 #
2 # configuration file fragment containing user choices
3 # for release to run, sample and data type to use in
4 # a cfg file
5 #
6 
7 #
8 
9 import FWCore.ParameterSet.Config as cms
10 import sys
11 
12 
13 
14 ###################### user choices ######################
15 
16 # number of events to be run (-1 for all)
17 maxNumberEvents = 10
18 maxNumberEvents = -1
19 
20 # useRelValSample: choose the type of sample used:
21 # True to use MC RelVal
22 # False to use data
23 
24 # default value
25 useRelValSample = False
26 #
27 # comment/uncomment the next line to choose sample type
28 # (un-commented selects MC RelVal)
29 #useRelValSample=True
30 
31 if useRelValSample == False :
32 
33  # choose the global tag type
34  # WARNING: global mess in global tag management,
35  # must be chosen per sample
36  # must be checked in the release
37  #
38  globalTag = '75X_dataRun2_HLT_v2'
39 
40  # choose one sample identifier from the list of data samples
41  #
42  sampleIdentifier = '251162'
43  #sampleIdentifier = '165633-CAFDQM'
44  #sampleIdentifier = '191833_RAW'
45  #sampleIdentifier = '205666.A.storageManager'
46 
47 else :
48  # choose the global tag type
49  # WARNING: global mess in global tag management,
50  # must be chosen per sample
51  # must be checked in the release
52  #
53  globalTag = 'auto:run1_mc'
54  #globalTag = 'auto:MCRUN2_72_V3A'
55  #globalTag = 'auto:run1_mc_hi'
56 
57  # choose (pre)release used to produce the RelVal samples
58  sampleFromRelease = 'CMSSW_7_5_0'
59 
60  # RelVals samples - add the "short name" of the dataset e.g. /RelValLM1_sfts/...
61  #
62  #dataset = 'RelValMinBias'
63  dataset = 'RelValTTbar'
64 
65  # data type
66  #
67  dataType = 'RAW'
68  #dataType = 'RECO'
69 
70 # change to True to use local files
71 # the type of file must be matched by hand
72 
73 useLocalFiles = False
74 #useLocalFiles = True
75 
76 # override default global tag - expert choice, do it only if you know what you do
77 overrideGlobalTag = False
78 #overrideGlobalTag = True
79 
80 if overrideGlobalTag == True :
81  myGlobalTag = 'GR_P_V28'
82 
83 ###################### end user choices ###################
84 
85 #
86 errorUserOptions = False
87 
88 # initialize list of files, of secondary files, list of selected events and luminosity segments
89 readFiles = cms.untracked.vstring()
90 secFiles = cms.untracked.vstring()
91 selectedEvents = cms.untracked.VEventRange()
92 selectedLumis= cms.untracked.VLuminosityBlockRange()
93 
94 # type of sample used (True for RelVal, False for data)
95 
96 if (useRelValSample == True) and (useLocalFiles == False) :
97 
98  #
99 
100  print " Release: ", sampleFromRelease
101  print " Dataset: ", dataset
102  print " Data type: ", dataType
103  print
104 
105  useDAS = True
106 
107  if useDAS :
108  import das_client
109  import os
110 
111  # query DAS
112 
113  myQuery = 'dataset release=' + sampleFromRelease
114  dasClientCommand = 'das_client.py --limit=0 --format=plain --query='+'"'+myQuery+'"'
115  datasets = os.popen(dasClientCommand)
116 
117 
118  # adjust strings for dataset and sampleFromRelease to search the dataset exact name
119  dataset = '/' + dataset + '/'
120  sampleFromRelease = sampleFromRelease +'-'
121 
122  if 'start' in globalTag :
123  gTag = 'START'
124  elif 'mc' in globalTag :
125  gTag = 'MC'
126  else :
127  gTag =''
128 
129  datasetName = ''
130  for line in datasets.readlines() :
131  if dataset in line :
132  if sampleFromRelease in line :
133  if gTag in line :
134  if dataType in line :
135  if 'ALCA' not in line :
136  datasetName = line.strip(' \n')
137  # print datasetName
138 
139  # print datasetName
140 
141  if datasetName == '' :
142  print "\n No dataset found."
143  errorUserOptions = True
144 
145  if not errorUserOptions :
146 
147  myQuery = 'file dataset=' + '"' + datasetName + '"'
148  dasClientCommand = 'das_client.py --limit=0 --format=plain --query=' + '"' + myQuery + '"'
149  data = os.popen(dasClientCommand)
150  filePaths = data.readlines()
151 
152 
153  print '\n das_client using the query'
154  print ' ', myQuery
155  print ' retrieved the following files\n'
156 
157  for line in filePaths :
158  print ' ', line
159 
160  readFiles.extend(filePaths);
161 
162 
163  # nothing added to secondary files by DAS
164  secFiles.extend([
165  ])
166 
167 
168 
169 
170 elif (useRelValSample == False) and (useLocalFiles == False) :
171 
172  # data
173 
174  if sampleIdentifier == '191833_RAW' :
175  runNumber = '191833'
176  dataset = '/DoubleElectron/Run2012A-v1/RAW'
177  dataType = 'RAW'
178  useDAS = True
179  selectedLumis= cms.untracked.VLuminosityBlockRange(
180  '191833:1'
181  )
182  selectedEvents = cms.untracked.VEventRange(
183  '191833:256674',
184  '191833:588211'
185  )
186 
187  elif sampleIdentifier == '251162' :
188  runNumber = '251162'
189  dataset = '/Run2015B/DoubleMuon/RAW'
190  dataType = 'RAW'
191  useDAS = False
192  readFiles.extend( [
193  '/store/data/Run2015B/DoubleMuon/RAW/v1/000/251/162/00000/9A6A3CB4-AD25-E511-84E5-02163E01264D.root'
194  ] );
195 
196 
197  elif sampleIdentifier == '191833_RECO' :
198  runNumber = '191833'
199  dataset = '/DoubleElectron/Run2012A-PromptReco-v1/RECO'
200  dataType = 'RECO'
201  useDAS = True
202  selectedLumis= cms.untracked.VLuminosityBlockRange(
203  '191833:1'
204  )
205  selectedEvents = cms.untracked.VEventRange(
206  '191833:256674',
207  '191833:588211'
208  )
209 
210  elif sampleIdentifier == '191833_AOD' :
211  runNumber = '191833'
212  dataset = '/DoubleElectron/Run2012A-PromptReco-v1/AOD'
213  dataType = 'RECO'
214  useDAS = True
215  selectedLumis= cms.untracked.VLuminosityBlockRange(
216  '191833:1'
217  )
218  selectedEvents = cms.untracked.VEventRange(
219  '191833:256674',
220  '191833:588211'
221  )
222 
223  # splash events 2012
224  elif sampleIdentifier == '187858' :
225  runNumber = '187858'
226  dataset = '/Commissioning/Commissioning12-v1/RAW'
227  dataType = 'RAW'
228  useDAS = True
229  selectedLumis= cms.untracked.VLuminosityBlockRange(
230  '187858:394',
231  '187858:499'
232  )
233  selectedEvents = cms.untracked.VEventRange(
234  '187858:3244833',
235  '187858:4094284'
236  )
237 
238  # high PU run 2011
239  elif sampleIdentifier == '179828' :
240  runNumber = '179828'
241  dataset = '/ZeroBiasHPF0/Run2011B-v1/RAW'
242  dataType = 'RAW'
243  useDAS = True
244 
245 
246  elif sampleIdentifier == '165633-CAFDQM' :
247  runNumber = '165633'
248  dataset = '/ZeroBiasHPF0/Run2011B-v1/RAW'
249  dataType = 'RAW'
250  useDAS = False
251  readFiles.extend( [
252  'file:/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/DQMTest/MinimumBias__RAW__v1__165633__1CC420EE-B686-E011-A788-0030487CD6E8.root'
253  ]);
254 
255 
256  elif sampleIdentifier == '137028' :
257  runNumber = '137028'
258  dataset = '/Run2010A/ZeroBias/RECO-v2'
259  dataType = 'RECO'
260  useDAS = False
261  readFiles.extend( [
262  '/store/data/Run2010A/ZeroBias/RECO/v2/000/137/028/08BF857D-2471-DF11-9CEB-003048D2BBF0.root'
263  ] );
264 
265 
266  elif sampleIdentifier == 'StreamFile_105760' :
267  runNumber = '105760'
268  dataset = 'A_Stream'
269  dataType = 'StreamFile'
270  useDAS = False
271  readFiles.extend( [
272  'file:/lookarea_SM/MWGR_29.00105760.0001.A.storageManager.00.0000.dat'
273  ] );
274 
275  # run with L1 GT data - emulator disagreements for the selectedEvents
276  elif sampleIdentifier == '205666.A.storageManager' :
277  runNumber = '205666'
278  dataset = 'A.storageManager'
279  dataType = 'StreamFile'
280  useDAS = False
281 
282  selectedEvents = cms.untracked.VEventRange(
283  '205666:101:125069341',
284  '205666:161:238160322',
285  '205666:281:443371795',
286  '205666:341:537654884',
287  '205666:361:567121052'
288  )
289 
290  readFiles.extend( [
291 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0001.A.storageManager.00.0000.dat',
292 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0021.A.storageManager.01.0000.dat',
293 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0041.A.storageManager.02.0000.dat',
294 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0061.A.storageManager.03.0000.dat',
295 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0081.A.storageManager.04.0000.dat',
296  'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0101.A.storageManager.05.0000.dat',
297 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0121.A.storageManager.06.0000.dat',
298 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0141.A.storageManager.07.0000.dat',
299  'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0161.A.storageManager.08.0000.dat',
300 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0181.A.storageManager.09.0000.dat',
301 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0201.A.storageManager.10.0000.dat',
302 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0221.A.storageManager.11.0000.dat',
303 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0241.A.storageManager.12.0000.dat',
304 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0261.A.storageManager.13.0000.dat',
305  'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0281.A.storageManager.14.0000.dat',
306 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0301.A.storageManager.15.0000.dat',
307 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0321.A.storageManager.00.0000.dat',
308  'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0341.A.storageManager.01.0000.dat',
309  'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0361.A.storageManager.02.0000.dat',
310 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0381.A.storageManager.03.0000.dat',
311 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0401.A.storageManager.04.0000.dat',
312 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0421.A.storageManager.05.0000.dat',
313 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0441.A.storageManager.06.0000.dat',
314 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0461.A.storageManager.07.0000.dat',
315 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0481.A.storageManager.08.0000.dat',
316 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0501.A.storageManager.09.0000.dat',
317 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0521.A.storageManager.10.0000.dat',
318 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0541.A.storageManager.11.0000.dat',
319 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0561.A.storageManager.12.0000.dat',
320 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0581.A.storageManager.13.0000.dat',
321 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0601.A.storageManager.14.0000.dat',
322 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0621.A.storageManager.15.0000.dat',
323 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0641.A.storageManager.00.0000.dat',
324 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0661.A.storageManager.01.0000.dat',
325 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0681.A.storageManager.02.0000.dat',
326 # 'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0701.A.storageManager.03.0000.dat',
327  'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0721.A.storageManager.04.0000.dat'
328  ]);
329 
330 
331  else :
332  print 'Error: sample identifier ', sampleIdentifier, ' not defined.\n'
333  errorUserOptions = True
334  runNumber = '0'
335  dataset = 'None'
336  dataType = 'None'
337  useDAS = False
338 
339 
340  #
341  # end of data samples
342  #
343 
344  print " Run number: ", runNumber
345  print " Dataset: ", dataset
346  print " Data type: ", dataType
347 
348  if useDAS :
349  import das_client
350  import os
351 
352  # query DAS
353  myQuery = 'file dataset=' + dataset + ' run=' + runNumber
354  dasClientCommand = 'das_client.py --limit=0 --format=plain --query='+'"'+myQuery+'"'
355  data = os.popen(dasClientCommand)
356  filePaths = data.readlines()
357 
358 
359  print '\n das_client using the query'
360  print ' ', myQuery
361  print ' retrieved the following files\n'
362 
363  for line in filePaths :
364  print ' ', line
365 
366  readFiles.extend(filePaths);
367 
368 
369  # nothing added to secondary files by DAS
370  secFiles.extend([
371  ])
372 
373 
374 
375 else :
376  # local file(s)
377 
378 
379  if sampleIdentifier == 'dummy' :
380  dataType = 'RAW'
381  readFiles.extend( [
382  'file:/afs/cern.ch/user/g/ghete/scratch0/CmsswTestFiles/LocalFile_source.root'
383  ]);
384 
385  secFiles.extend([
386  ])
387 
388  print 'Local file(s)', readFiles
389 
390 if overrideGlobalTag == True :
391  globalTag = myGlobalTag
392 
393 if globalTag.count('auto') :
394  from Configuration.AlCa.autoCond_condDBv2 import autoCond
395  useGlobalTag = autoCond[globalTag.replace('auto:', '')]
396 else :
397  useGlobalTag = globalTag
398 
399 print "\n Using global tag ", useGlobalTag, "\n"
400 
401