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