This repository has been archived by the owner on Jun 12, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
/
unpack2017_cfg.py
149 lines (124 loc) · 7.34 KB
/
unpack2017_cfg.py
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
import FWCore.ParameterSet.Config as cms
import FWCore.ParameterSet.VarParsing as VarParsing
import os,sys
options = VarParsing.VarParsing('standard') # avoid the options: maxEvents, files, secondaryFiles, output, secondaryOutput because they are already defined in 'standard'
#Change the data folder appropriately to where you wish to access the files from:
options.register('dataFolder',
'/disk2_2TB/July2017_TB_data_orm',
VarParsing.VarParsing.multiplicity.singleton,
VarParsing.VarParsing.varType.string,
'folder containing raw input')
options.register('runNumber',
106,
VarParsing.VarParsing.multiplicity.singleton,
VarParsing.VarParsing.varType.int,
'Input run to process')
options.register('outputFolder',
'/afs/cern.ch/work/a/asteen/public/data/july2017/',
VarParsing.VarParsing.multiplicity.singleton,
VarParsing.VarParsing.varType.string,
'Output folder where analysis output are stored')
options.register('dataFormat',
0,
VarParsing.VarParsing.multiplicity.singleton,
VarParsing.VarParsing.varType.int,
'Data formats int -> important for parameter setting')
options.register('electronicMap',
"HGCal/CondObjects/data/map_CERN_Hexaboard_September_17Sensors_7EELayers_10FHLayers_V1.txt",
VarParsing.VarParsing.multiplicity.singleton,
VarParsing.VarParsing.varType.string,
'path to the electronic map')
#electronicMap="HGCal/CondObjects/data/map_CERN_Hexaboard_28Layers_AllFlipped.txt"
#electronicMap="HGCal/CondObjects/data/map_CERN_Hexaboard_July_6Layers.txt"
#electronicMap="HGCal/CondObjects/data/map_CERN_Hexaboard_September_17Sensors_7EELayers_10FHLayers_V1.txt" # end of september
#electronicMap="HGCal/CondObjects/data/map_CERN_Hexaboard_October_17Sensors_5EELayers_6FHLayers_V1.txt" # october 18-22, 1st conf
#electronicMap="HGCal/CondObjects/data/map_CERN_Hexaboard_October_20Sensors_5EELayers_7FHLayers_V1.txt" # october 18-22, 2nd conf
options.register('beamEnergy',
0,
VarParsing.VarParsing.multiplicity.singleton,
VarParsing.VarParsing.varType.float,
'Beam energy.'
)
options.register('beamParticlePDGID',
0,
VarParsing.VarParsing.multiplicity.singleton,
VarParsing.VarParsing.varType.int,
'Beam particles PDG ID.'
)
options.register('runType',
"Beam",
VarParsing.VarParsing.multiplicity.singleton,
VarParsing.VarParsing.varType.string,
'Run type: Pedestal, Beam, Simulation.'
)
options.register('setupConfiguration',
0,
VarParsing.VarParsing.multiplicity.singleton,
VarParsing.VarParsing.varType.int,
'setupConfiguration (1: July - 4: 20 Layers in October in H6A".'
)
options.maxEvents = -1
options.output = "cmsswEvents.root"
options.parseArguments()
print options
if not os.path.isdir(options.dataFolder):
sys.exit("Error: Data folder not found or inaccessible!")
pedestalHighGain=options.outputFolder+"/pedestalHG_"+str(options.runNumber)+".txt"
pedestalLowGain=options.outputFolder+"/pedestalLG_"+str(options.runNumber)+".txt"
noisyChannels=options.outputFolder+"/noisyChannels_"+str(options.runNumber)+".txt"
################################
process = cms.Process("unpack")
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(options.maxEvents)
)
####################################
if options.dataFormat==0 :
numberOfBytesForTheHeader=8
numberOfBytesForTheTrailer=4
numberOfBytesForTheEventTrailers=4
elif options.dataFormat==1 :
numberOfBytesForTheHeader=12
numberOfBytesForTheTrailer=4
numberOfBytesForTheEventTrailers=12
process.source = cms.Source("HGCalTBRawDataSource",
ElectronicMap=cms.untracked.string(options.electronicMap),
fileNames=cms.untracked.vstring("file:%s/HexaData_Run%04d.raw"%(options.dataFolder,options.runNumber)),
OutputCollectionName=cms.untracked.string("skiroc2cmsdata"),
NumberOf32BitsWordsPerReadOut=cms.untracked.uint32(30787),
NumberOfBytesForTheHeader=cms.untracked.uint32(numberOfBytesForTheHeader),
NumberOfBytesForTheTrailer=cms.untracked.uint32(numberOfBytesForTheTrailer),
NumberOfBytesForTheEventTrailers=cms.untracked.uint32(numberOfBytesForTheEventTrailers),
NSkipEvents=cms.untracked.uint32(0),
ReadTimeStamps=cms.untracked.bool(True),
DataFormats=cms.untracked.uint32(options.dataFormat),
timingFiles=cms.vstring("%s/HexaData_Run%04d_TIMING_RDOUT_ORM0.txt"%(options.dataFolder,options.runNumber),
"%s/HexaData_Run%04d_TIMING_RDOUT_ORM1.txt"%(options.dataFolder,options.runNumber),
"%s/HexaData_Run%04d_TIMING_RDOUT_ORM2.txt"%(options.dataFolder,options.runNumber)),
beamEnergy=cms.untracked.double(options.beamEnergy),
beamParticlePDGID=cms.untracked.int32(options.beamParticlePDGID),
runType=cms.untracked.string(options.runType),
setupConfiguration=cms.untracked.uint32(options.setupConfiguration)
)
filename = options.outputFolder+"/PedestalOutput_"+str(options.runNumber)+".root"
process.TFileService = cms.Service("TFileService", fileName=cms.string(filename))
process.output = cms.OutputModule("PoolOutputModule",
fileName = cms.untracked.string(options.output)
)
process.content = cms.EDAnalyzer("EventContentAnalyzer") #add process.content in cms.Path if you want to check which collections are in the event
process.pedestalplotter = cms.EDAnalyzer("PedestalPlotter",
SensorSize=cms.untracked.int32(128),
WritePedestalFile=cms.untracked.bool(True),
InputCollection=cms.InputTag("source","skiroc2cmsdata"),
ElectronicMap=cms.untracked.string(options.electronicMap),
HighGainPedestalFileName=cms.untracked.string(pedestalHighGain),
LowGainPedestalFileName=cms.untracked.string(pedestalLowGain),
WriteNoisyChannelsFile=cms.untracked.bool(True),
NoisyChannelsFileName=cms.untracked.string(noisyChannels),
)
process.rawdataplotter = cms.EDAnalyzer("RawDataPlotter",
SensorSize=cms.untracked.int32(128),
EventPlotter=cms.untracked.bool(False),
InputCollection=cms.InputTag("source","skiroc2cmsdata")
)
process.p = cms.Path( process.pedestalplotter )
process.end = cms.EndPath(process.output)