-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCBC_Analysis.py
More file actions
93 lines (76 loc) · 2.89 KB
/
Copy pathCBC_Analysis.py
File metadata and controls
93 lines (76 loc) · 2.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import FWCore.ParameterSet.Config as cms
import sys
import os
import re
import string
# Bad Strip File
try:
os.environ['BADSTRIPS']
os.getenv('BADSTRIPS',"/afs/cern.ch/user/g/gauzinge/tb_data/bad_strips.txt")
badstripfile = os.environ['BADSTRIPS']
print 'Bad Strip File:', badstripfile
except KeyError:
print 'Please set the BADSTRIPS environment variable'
sys.exit(1)
# Filenames for in and outfile
if len(sys.argv) != 3:
print 'Wrong number of Command line arguments. Usage: cmsRun', sys.argv[1], 'datafile!\n\n'
# runnumber = re.findall("USC.00000(\d+)",sys.argv[2])
# runnumber = re.findall("run(\d+)",sys.argv[2])
datafile = 'file:'+sys.argv[2]
print 'datafilestring', datafile
if "USC" in datafile:
runnumber = re.findall("USC.000(\d+)",sys.argv[2])
histofile = datafile.replace("USC.000","run")
histofile = histofile.replace(".0001.A.storageManager.00.0000","_results")
histofile = histofile.replace("/digis/","/results/")
else:
runnumber = re.findall("run(\d+)",sys.argv[2])
histofile = datafile.replace("_clusters","_results")
histofile = histofile.replace("/clusters/","/results/")
print '\nThe runnumber is ',runnumber[0]
print '\nThe File to be read is ',datafile
print '\nThe histograms are written to ', histofile
print '\n'
#set up a process , for e.g. Low Level Analysis in this case
process = cms.Process("CBCAnalysis")
process.load("FWCore.MessageLogger.MessageLogger_cfi")
process.MessageLogger.cerr.FwkReport.reportEvery = 1000
process.MessageLogger.cerr.threshold = 'INFO'
process.MessageLogger.categories.append('CBC_Analysis')
process.MessageLogger.cerr.INFO = cms.untracked.PSet(
limit = cms.untracked.int32(-1)
)
process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(False) )
process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(5000) )
# Infile
process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring(datafile
# separate several with comma
)
)
#TfileService for Histograms
process.TFileService = cms.Service("TFileService",
fileName = cms.string(histofile)
)
# Conditions Data Decoder
process.conditions = cms.EDAnalyzer('ConditionDecoder')
# Low Level Analysis
process.lowlevel = cms.EDAnalyzer('LL_Analysis',
sensors = cms.untracked.vuint32(50001, 50002, 50011, 50012),
bad_strip_file = cms.string(badstripfile)
)
# CM Noise Analysis
process.cmn = cms.EDAnalyzer('CMN_Analysis',
bad_strip_file = cms.string(badstripfile)
)
# process.mypath = cms.Path(process.conditions*process.lowlevel)
if "USC" in datafile:
process.mypath = cms.Path(process.conditions*process.lowlevel*process.cmn)
else:
# bad Strips are already masked in the Cluster&Stub Producer
process.stubs = cms.EDAnalyzer('ClusterAndStubAnalyzer',
sensors = cms.untracked.vuint32(50001, 50002, 50011, 50012),
modules = cms.untracked.vuint32(50000, 50010)
)
process.mypath = cms.Path(process.conditions*process.lowlevel*process.cmn*process.stubs)