CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
inputsource_file_cfi.py
Go to the documentation of this file.
1 #
2 # provide online L1 Trigger DQM input from file(s)
3 #
4 # V M Ghete 2010-07-09
5 
6 import FWCore.ParameterSet.Config as cms
7 
8 ###################### user choices ######################
9 
10 # choose one sample identifier from the list of data samples
11 #
12 sampleIdentifier = '165633-CAFDQM'
13 #sampleIdentifier = '195378'
14 
15 maxNumberEvents = 5000
16 
17 ###################### end user choices ###################
18 
19 # initialize list of files, of secondary files, list of selected events and luminosity segments
20 readFiles = cms.untracked.vstring()
21 secFiles = cms.untracked.vstring()
22 selectedEvents = cms.untracked.VEventRange()
23 selectedLumis= cms.untracked.VLuminosityBlockRange()
24 
25 
26 maxEvents = cms.untracked.PSet(
27  input = cms.untracked.int32(maxNumberEvents)
28 )
29 
30 
31 
32 if sampleIdentifier == '195378' :
33  runNumber = '195378'
34  dataset = '/MinimumBias/Run2012B-v1/RAW'
35  dataType = 'RAW'
36  useDAS = True
37  selectedLumis= cms.untracked.VLuminosityBlockRange(
38  '195378:1275-195378:max'
39  )
40 
41 elif sampleIdentifier == '195379' :
42  runNumber = '195379'
43  dataset = '/MinimumBias/Run2012B-v1/RAW'
44  dataType = 'RAW'
45  useDAS = True
46 
47 elif sampleIdentifier == '195390' :
48  runNumber = '195390'
49  dataset = '/MinimumBias/Run2012B-v1/RAW'
50  dataType = 'RAW'
51  useDAS = True
52 
53 # high PU run 2011
54 elif sampleIdentifier == '179828' :
55  runNumber = '179828'
56  dataset = '/ZeroBiasHPF0/Run2011B-v1/RAW'
57  dataType = 'RAW'
58  useDAS = True
59 
60 
61 elif sampleIdentifier == '165633-CAFDQM' :
62  runNumber = '165633'
63  dataset = '/ZeroBiasHPF0/Run2011B-v1/RAW'
64  dataType = 'RAW'
65  useDAS = False
66  readFiles.extend( [
67  #'file:/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/DQMTest/MinimumBias__RAW__v1__165633__1CC420EE-B686-E011-A788-0030487CD6E8.root'
68  ]);
69 
70 elif sampleIdentifier == 'FileStream_105760' :
71  runNumber = '105760'
72  dataset = 'A_Stream'
73  dataType = 'FileStream'
74  useDAS = False
75  readFiles.extend( [
76  'file:/lookarea_SM/MWGR_29.00105760.0001.A.storageManager.00.0000.dat'
77  ] );
78 
79 else :
80  print 'Error: sample identifier ', sampleIdentifier, ' not defined.\n'
81  errorUserOptions = True
82  runNumber = '0'
83  dataset = 'None'
84  dataType = 'None'
85  useDAS = False
86 
87 
88 #
89 # end of data samples
90 #
91 
92 print " Run number: ", runNumber
93 print " Dataset: ", dataset
94 print " Data type: ", dataType
95 
96 if useDAS :
97  import das_client
98  import os
99 
100  # query DAS
101  myQuery = 'file dataset=' + dataset + ' run=' + runNumber
102  dasClientCommand = 'das_client.py --limit=0 --format=plain --query='+'"'+myQuery+'"'
103  data = os.popen(dasClientCommand)
104  filePaths = data.readlines()
105 
106 
107  print '\n das_client using the query'
108  print ' ', myQuery
109  print ' retrieved the following files\n'
110 
111  for line in filePaths :
112  print ' ', line
113 
114  readFiles.extend(filePaths);
115 
116 
117  # nothing added to secondary files by DAS
118  secFiles.extend([
119  ])
120 
121 
122 # for RAW data, run first the RAWTODIGI
123 if dataType == 'StreamFile' :
124  source = cms.Source("NewEventStreamFileReader", fileNames=readFiles)
125 else :
126  source = cms.Source ('PoolSource',
127  fileNames=readFiles,
128  secondaryFileNames=secFiles,
129  lumisToProcess = selectedLumis,
130  eventsToProcess = selectedEvents
131  )
132