|
1 | 1 | import FWCore.ParameterSet.Config as cms |
2 | 2 | from FWCore.ParameterSet.VarParsing import VarParsing |
3 | 3 | from RecoPPS.Local.ctppsDiamondLocalReconstruction_cff import * |
| 4 | +from Geometry.VeryForwardGeometry.geometryRPFromDB_cfi import * |
| 5 | + |
4 | 6 |
|
5 | 7 | process = cms.Process("TIMINGSTUDY") |
6 | 8 | options = VarParsing ('analysis') |
|
10 | 12 |
|
11 | 13 | # minimum of logs |
12 | 14 | process.load("FWCore.MessageService.MessageLogger_cfi") |
| 15 | +# process.MessageLogger.cerr.threshold = "INFO" |
| 16 | +# process.MessageLogger.cerr.INFO.limit = -1 |
13 | 17 | process.MessageLogger.cerr.FwkReport.reportEvery = 1000 |
14 | 18 |
|
15 | 19 | options.register ('rootFiles', |
|
18 | 22 | VarParsing.varType.string, |
19 | 23 | "root files produced by DQMWorker") |
20 | 24 |
|
| 25 | +options.register ('outputDirectoryRoot', |
| 26 | + 'OutputHarvester', |
| 27 | + VarParsing.multiplicity.singleton, #TODO: it was designed to be a list revert change before merging |
| 28 | + VarParsing.varType.string, |
| 29 | + "root output dircetory") |
| 30 | + |
21 | 31 | # options.register ('calibInput', |
22 | 32 | # '', |
23 | 33 | # VarParsing.multiplicity.singleton, |
|
36 | 46 | VarParsing.varType.string, |
37 | 47 | "Input file") |
38 | 48 |
|
39 | | -options.register ('geometryFile', |
40 | | - 'Geometry.VeryForwardGeometry.geometryRPFromDD_2022_cfi', |
41 | | - VarParsing.multiplicity.singleton, |
42 | | - VarParsing.varType.string, |
43 | | - "Geometry input file") |
44 | | - |
45 | 49 | options.register ('calibFiles', |
46 | 50 | [], |
47 | 51 | VarParsing.multiplicity.list, |
|
65 | 69 | VarParsing.multiplicity.singleton, |
66 | 70 | VarParsing.varType.float, |
67 | 71 | "max rms of t distribution") |
| 72 | + |
| 73 | +options.register('sqlFileName', |
| 74 | + '', |
| 75 | + VarParsing.multiplicity.singleton, |
| 76 | + VarParsing.varType.string, |
| 77 | + 'sqlFileNameForCalib' |
| 78 | +) |
| 79 | + |
| 80 | +options.register('useDB', |
| 81 | + '', |
| 82 | + VarParsing.multiplicity.singleton, |
| 83 | + VarParsing.varType.string, |
| 84 | + 'use data base for calibraiton' |
| 85 | +) |
| 86 | + |
68 | 87 |
|
69 | 88 | options.parseArguments() |
70 | 89 |
|
|
84 | 103 | from Configuration.AlCa.GlobalTag import GlobalTag |
85 | 104 | process.GlobalTag = GlobalTag(process.GlobalTag, '124X_dataRun3_v9', '') |
86 | 105 |
|
87 | | -if options.calibInput == '': |
88 | | - process.GlobalTag.toGet = cms.VPSet( |
89 | | - cms.PSet(record = cms.string('PPSTimingCalibrationRcd'), |
90 | | - tag = cms.string('PPSDiamondTimingCalibration_Run3_v1_hlt'), |
91 | | - connect = cms.string("frontier://FrontierProd/CMS_CONDITIONS") |
| 106 | +### SET TIME SHIFT SOURCE BEGIN |
| 107 | +if options.useDB=='True': |
| 108 | + use_db=True |
| 109 | +elif options.useDB=='False': |
| 110 | + use_db=False |
| 111 | +elif options.useDB!='': |
| 112 | + assert 'UseDB paramter is not valid. It should be True or False (case sensitive)' |
| 113 | +else: |
| 114 | + use_db=False |
| 115 | + |
| 116 | + |
| 117 | +# if((options.sqlFileName != '') ^ (options.calibInput != '') ^ (options.useDB !='')): |
| 118 | + # assert 'Please specify exactly one source of time shift paramiters. One from set {calib.json, SQLLite File or globalDB}' |
| 119 | + |
| 120 | +use_sqlite_file = options.sqlFileName != '' |
| 121 | +if (use_sqlite_file): |
| 122 | + print('Using SQL file') |
| 123 | + process.load('CondCore.CondDB.CondDB_cfi') |
| 124 | + process.CondDB.connect = options.sqlFileName # SQLite input TODO: migrate to using tag |
| 125 | + process.PoolDBESSource = cms.ESSource('PoolDBESSource', |
| 126 | + process.CondDB, |
| 127 | + DumpStats = cms.untracked.bool(True), |
| 128 | + toGet = cms.VPSet( |
| 129 | + cms.PSet( |
| 130 | + record = cms.string('PPSTimingCalibrationRcd'), |
| 131 | + tag = cms.string('DiamondTimingCalibration'), |
| 132 | + label = cms.untracked.string('PPSTestCalibration'), |
| 133 | + ) |
92 | 134 | ) |
| 135 | +) |
| 136 | +elif options.calibInput != '': |
| 137 | + print('Using CalibInput file ') |
| 138 | + process.ppsTimingCalibrationESSource = cms.ESSource('PPSTimingCalibrationESSource', |
| 139 | + calibrationFile = cms.string(options.calibInput), |
| 140 | + subDetector = cms.uint32(2), |
| 141 | + appendToDataLabel = cms.string('') |
| 142 | + ) |
| 143 | +else: #default use db |
| 144 | + print('Using db') |
| 145 | + process.GlobalTag.toGet = cms.VPSet() |
| 146 | + process.GlobalTag.toGet.append( |
| 147 | + cms.PSet(record = cms.string("PPSTimingCalibrationRcd"), |
| 148 | + tag = cms.string("PPSDiamondTimingCalibration_Run3_recovered_v1"), |
| 149 | + label = cms.untracked.string('PPSTestCalibration'), |
| 150 | + connect = cms.string("frontier://FrontierPrep/CMS_CONDITIONS") |
| 151 | + ) |
93 | 152 | ) |
94 | | -else: |
95 | | - process.ppsTimingCalibrationESSource = cms.ESSource('PPSTimingCalibrationESSource', |
96 | | - calibrationFile = cms.string(options.calibInput), |
97 | | - subDetector = cms.uint32(2), |
98 | | - appendToDataLabel = cms.string('') |
99 | | - ) |
| 153 | + #TODO: uncomment below when delete sqlite file dependency |
| 154 | + # process.GlobalTag.toGet = cms.VPSet( |
| 155 | + # cms.PSet(record = cms.string('PPSTimingCalibrationRcd'), |
| 156 | + # tag = cms.string('PPSDiamondTimingCalibration_Run3_v1_hlt'), # working tag: PPSDiamondTimingCalibration_Run3_v1_hlt |
| 157 | + # #TODO: old tag PPSDiamondTimingCalibration_v1 - to delete |
| 158 | + # connect = cms.string("frontier://FrontierProd/CMS_CONDITIONS") |
| 159 | + # ) |
| 160 | + # ) |
| 161 | +### SET TIME SHIFT SOURCE END |
100 | 162 |
|
101 | 163 | # rechits production |
102 | 164 | process.load("DQM.Integration.config.environment_cfi") |
103 | 165 | process.load("DQMServices.Components.DQMEnvironment_cfi") |
104 | | -process.load(options.geometryFile) |
105 | | - |
106 | | -process.diamondTimingHarvester = DQMEDHarvester("DiamondTimingHarvester", |
| 166 | +process.load('Geometry.VeryForwardGeometry.geometryRPFromDB_cfi') #TODO: use geometry form DB not from file |
| 167 | + |
| 168 | +# PROCESS HARVESTER: |
| 169 | +if(options.calibInput != ''): |
| 170 | + process.diamondTimingHarvester = DQMEDHarvester("DiamondTimingHarvester", |
| 171 | + # timingCalibrationTag=cms.string("PoolDBESSource:PPSTestCalibration"), |
| 172 | + # timingCalibrationTag=cms.string("PPSTimingCalibrationESSource:PPSTiming"), |
| 173 | + # timingCalibrationTag=cms.string("PoolDBESSource:PPSTestCalibration"), |
| 174 | + timingCalibrationTag=cms.string(":"), |
| 175 | + calib_json_output = cms.string(options.calibOutput), |
| 176 | + calibFiles = cms.vstring(options.calibFiles), |
| 177 | + loopIndex = cms.int32(options.loopIndex), |
| 178 | + meanMax = cms.double(options.meanMax), |
| 179 | + rmsMax = cms.double(options.rmsMax) |
| 180 | + ) |
| 181 | +elif (use_sqlite_file): |
| 182 | + process.diamondTimingHarvester = DQMEDHarvester("DiamondTimingHarvester", |
| 183 | + timingCalibrationTag=cms.string("PoolDBESSource:PPSTestCalibration"), |
107 | 184 | calib_json_output = cms.string(options.calibOutput), |
108 | | - calibInput = cms.string(options.calibInput), |
109 | 185 | calibFiles = cms.vstring(options.calibFiles), |
110 | 186 | loopIndex = cms.int32(options.loopIndex), |
111 | 187 | meanMax = cms.double(options.meanMax), |
112 | 188 | rmsMax = cms.double(options.rmsMax) |
113 | 189 | ) |
| 190 | +else: # defualt use db |
| 191 | + process.diamondTimingHarvester = DQMEDHarvester("DiamondTimingHarvester", |
| 192 | + timingCalibrationTag=cms.string("GlobalTag:PPSTestCalibration"), |
| 193 | + calib_json_output = cms.string(options.calibOutput), |
| 194 | + calibFiles = cms.vstring(options.calibFiles), |
| 195 | + loopIndex = cms.int32(options.loopIndex), |
| 196 | + meanMax = cms.double(options.meanMax), |
| 197 | + rmsMax = cms.double(options.rmsMax) |
| 198 | + ) |
| 199 | +# else: |
| 200 | +# assert "need to provide timing calibration tag from json, slq file or db" |
| 201 | + |
| 202 | +# process.diamondTimingHarvester.timingCalibrationTag=cms.string("PoolDBESSource:PPSTestCalibration") |
| 203 | + |
114 | 204 |
|
115 | 205 | #CONFIGURE DQM Saver |
116 | 206 | process.dqmEnv.subSystemFolder = "CalibPPS" |
|
0 commit comments