CMS 3D CMS Logo

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