Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
196 changes: 102 additions & 94 deletions CalibPPS/AlignmentGlobal/README.md

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion CalibPPS/AlignmentGlobal/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
<use name="FWCore/Framework"/>
<use name="FWCore/ParameterSet"/>
<use name="FWCore/Utilities"/>
<use name="FWCore/ServiceRegistry"/>
<use name="CondCore/DBOutputService"/>
<use name="DataFormats/CTPPSDetId"/>
<use name="DataFormats/CTPPSReco"/>
<use name="CondFormats/PPSObjects"/>
<use name="CondFormats/DataRecord"/>
<use name="rootcore"/>
<use name="rootgraphics"/>
</library>
</library>
811 changes: 491 additions & 320 deletions CalibPPS/AlignmentGlobal/plugins/PPSAlignmentHarvester.cc

Large diffs are not rendered by default.

335 changes: 177 additions & 158 deletions CalibPPS/AlignmentGlobal/plugins/PPSAlignmentWorker.cc

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions CalibPPS/AlignmentGlobal/python/ALCARECOPPSAlignment_Output_cff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import FWCore.ParameterSet.Config as cms

OutALCARECOPPSAlignment_noDrop = cms.PSet(
SelectEvents = cms.untracked.PSet(
SelectEvents = cms.vstring('pathALCARECOPPSAlignment')
),
outputCommands = cms.untracked.vstring(
'keep *_MEtoEDMConvertPPSAlignment_*_*',
)
)

OutALCARECOPPSAlignment = OutALCARECOPPSAlignment_noDrop.clone()
OutALCARECOPPSAlignment.outputCommands.insert(0, 'drop *')
16 changes: 16 additions & 0 deletions CalibPPS/AlignmentGlobal/python/ALCARECOPPSAlignment_cff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import FWCore.ParameterSet.Config as cms

from CalibPPS.AlignmentGlobal.ppsAlignmentWorker_cfi import ppsAlignmentWorker

MEtoEDMConvertPPSAlignment = cms.EDProducer('MEtoEDMConverter',
Name=cms.untracked.string('MEtoEDMConverter'),
Verbosity=cms.untracked.int32(0),
Frequency=cms.untracked.int32(50),
MEPathToSave=cms.untracked.string('AlCaReco/PPSAlignment'),
deleteAfterCopy=cms.untracked.bool(True)
)

taskALCARECOPPSAlignment = cms.Task(
ppsAlignmentWorker,
MEtoEDMConvertPPSAlignment
)
6 changes: 6 additions & 0 deletions CalibPPS/AlignmentGlobal/python/PPSAlignmentHarvester_cff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from CalibPPS.AlignmentGlobal.ppsAlignmentHarvester_cfi import *

ppsAlignmentHarvester.text_results_path = cms.string("")
ppsAlignmentHarvester.write_sqlite_results = cms.bool(True)
ppsAlignmentHarvester.x_ali_rel_final_slope_fixed = cms.bool(False)
ppsAlignmentHarvester.y_ali_final_slope_fixed = cms.bool(False)
7 changes: 0 additions & 7 deletions CalibPPS/AlignmentGlobal/python/ppsAlignmentHarvester_cfi.py

This file was deleted.

9 changes: 0 additions & 9 deletions CalibPPS/AlignmentGlobal/python/ppsAlignmentWorker_cfi.py

This file was deleted.

75 changes: 42 additions & 33 deletions CalibPPS/AlignmentGlobal/test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,47 @@

## Running instructions
```
cmsRun run_distributions_reference_cfg.py
cmsRun run_distributions_cfg.py
cmsRun run_analysis_manual_cfg.py
cmsRun run_distributions_reference_cfg.py && cmsRun run_distributions_cfg.py && cmsRun run_analysis_cfg.py
```

## Expected results
### x_alignment
- RP 3: x = -3690.0 +- 17.9 um
- RP 23: x = -41690.0 +- 17.2 um
- RP 103: x = -2700.0 +- 16.9 um
- RP 123: x = -41830.0 +- 16.0 um

### x_alignment_relative:
- RP 3: x = 18985.6 +- 1.0 um
- RP 23: x = -18985.6 +- 1.0 um
- RP 103: x = 19484.1 +- 1.2 um
- RP 123: x = -19484.1 +- 1.2 um

### x_alignment_relative_sl_fix:
- RP 3: x = 18983.7 +- 0.2 um
- RP 23: x = -18983.7 +- 0.2 um
- RP 103: x = 19486.6 +- 0.3 um
- RP 123: x = -19486.6 +- 0.3 um

### y_alignment:
- RP 3: y = 3468.8 +- 44.1 um
- RP 23: y = 4097.6 +- 44.8 um
- RP 103: y = 3025.5 +- 77.8 um
- RP 123: y = 3344.0 +- 66.1 um

### y_alignment_sl_fix:
- RP 3: y = 3491.7 +- 10.7 um
- RP 23: y = 4167.4 +- 11.6 um
- RP 103: y = 2753.5 +- 18.2 um
- RP 123: y = 3390.2 +- 17.3 um
## Expected results (alignment_results.txt)
```
1: x_alignment:
RP 3: shift (um) x = -3670.0 +- 19.8, y = 0.0 +- 0.0, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0
RP 23: shift (um) x = -41710.0 +- 20.6, y = 0.0 +- 0.0, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0
RP 103: shift (um) x = -2700.0 +- 18.8, y = 0.0 +- 0.0, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0
RP 123: shift (um) x = -41840.0 +- 19.5, y = 0.0 +- 0.0, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0


2: x_alignment_relative:
RP 3: shift (um) x = 18984.6 +- 1.2, y = 0.0 +- 0.0, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0
RP 23: shift (um) x = -18984.6 +- 1.2, y = 0.0 +- 0.0, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0
RP 103: shift (um) x = 19485.3 +- 1.5, y = 0.0 +- 0.0, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0
RP 123: shift (um) x = -19485.3 +- 1.5, y = 0.0 +- 0.0, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0

2: x_alignment_relative_sl_fix:
RP 3: shift (um) x = 18983.8 +- 0.3, y = 0.0 +- 0.0, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0
RP 23: shift (um) x = -18983.8 +- 0.3, y = 0.0 +- 0.0, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0
RP 103: shift (um) x = 19486.8 +- 0.3, y = 0.0 +- 0.0, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0
RP 123: shift (um) x = -19486.8 +- 0.3, y = 0.0 +- 0.0, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0


3: y_alignment:
RP 3: shift (um) x = 0.0 +- 0.0, y = 3443.3 +- 101.7, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0
RP 23: shift (um) x = 0.0 +- 0.0, y = 4190.3 +- 87.0, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0
RP 103: shift (um) x = 0.0 +- 0.0, y = 2885.9 +- 66.2, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0
RP 123: shift (um) x = 0.0 +- 0.0, y = 3491.8 +- 129.5, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0

3: y_alignment_sl_fix:
RP 3: shift (um) x = 0.0 +- 0.0, y = 3490.3 +- 16.0, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0
RP 23: shift (um) x = 0.0 +- 0.0, y = 4209.1 +- 15.8, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0
RP 103: shift (um) x = 0.0 +- 0.0, y = 2751.2 +- 16.1, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0
RP 123: shift (um) x = 0.0 +- 0.0, y = 3417.9 +- 23.9, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0


final merged results:
RP 3: shift (um) x = -3706.2 +- 19.8, y = 3490.3 +- 16.0, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0
RP 23: shift (um) x = -41673.8 +- 20.6, y = 4209.1 +- 15.8, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0
RP 103: shift (um) x = -2783.2 +- 18.8, y = 2751.2 +- 16.1, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0
RP 123: shift (um) x = -41756.8 +- 19.5, y = 3417.9 +- 23.9, z = 0.0 +- 0.0, rotation (mrad) x = 0.0 +- 0.0, y = 0.0 +- 0.0, z = 0.0 +- 0.0
```
22 changes: 14 additions & 8 deletions CalibPPS/AlignmentGlobal/test/config_cff.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import FWCore.ParameterSet.Config as cms

ppsAlignmentConfigESSource = cms.ESSource("PPSAlignmentConfigESSource",
sequence = cms.vstring(
"x_alignment",
"x_alignment_relative",
"y_alignment"
),

ppsAlignmentConfigESSource = cms.ESSource("PPSAlignmentConfigurationESSource",
sector_45 = cms.PSet(
rp_N = cms.PSet(
x_max_fit_mode = cms.double(7.0),
Expand Down Expand Up @@ -39,5 +33,17 @@

cut_h_c = cms.double(-39.26 + 0.33),
cut_v_c = cms.double(1.49 - 1.80)
),

y_alignment = cms.PSet(
rp_L_F = cms.PSet(
x_min = cms.double(45.5)
),
rp_L_N = cms.PSet(
x_min = cms.double(7.8)
),
rp_R_F = cms.PSet(
x_min = cms.double(45.5)
)
)
)
)
2 changes: 1 addition & 1 deletion CalibPPS/AlignmentGlobal/test/config_reference_cff.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import FWCore.ParameterSet.Config as cms

ppsAlignmentConfigESSource = cms.ESSource("PPSAlignmentConfigESSource",
ppsAlignmentConfigESSource = cms.ESSource("PPSAlignmentConfigurationESSource",
label = cms.string('reference'),

sector_45 = cms.PSet(
Expand Down
111 changes: 111 additions & 0 deletions CalibPPS/AlignmentGlobal/test/run_analysis_cfg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
########## Configuration ##########
# if set to True, a file with logs will be produced.
produce_logs = True

# if set to True, the harvester will produce an extra ROOT file with some debug plots.
# Works only for one-run input.
harvester_debug = True

# Path for a ROOT file with the histograms.
input_distributions = 'file:dqm_run_distributions_test.root'

# Reference dataset path.
reference_dataset_path = 'DQM_V0001_CalibPPS_R000314273.root'

# If set to True, the results will be also written to an SQLite file.
write_sqlite_results = False

# Output database. Used only if write_sqlite_results is set to True.
output_conditions = 'sqlite_file:alignment_results.db'

# Database tag. Used only if write_sqlite_results is set to True.
output_db_tag = 'CTPPSRPAlignmentCorrectionsData_test'
###################################

import sys
import os
import FWCore.ParameterSet.Config as cms

process = cms.Process('testDistributions')

process.load('FWCore.MessageService.MessageLogger_cfi')
process.load("DQMServices.Core.DQMStore_cfi")
process.load("CalibPPS.AlignmentGlobal.ppsAlignmentHarvester_cfi")

if harvester_debug:
process.ppsAlignmentHarvester.debug = cms.bool(True)

# Message Logger
if produce_logs:
process.MessageLogger = cms.Service("MessageLogger",
destinations = cms.untracked.vstring('run_analysis',
'cout'
),
run_analysis = cms.untracked.PSet(
threshold = cms.untracked.string("INFO")
),
cout = cms.untracked.PSet(
threshold = cms.untracked.string('WARNING')
)
)
else:
process.MessageLogger = cms.Service("MessageLogger",
destinations = cms.untracked.vstring('cout'),
cout = cms.untracked.PSet(
threshold = cms.untracked.string('WARNING')
)
)

# load DQM framework
process.load("DQMServices.Components.DQMEnvironment_cfi")
process.dqmEnv.subSystemFolder = "CalibPPS"
process.dqmSaver.convention = 'Offline'
process.dqmSaver.workflow = "/CalibPPS/AlignmentGlobal/CMSSW_12_1_0_pre1"
process.dqmSaver.saveByRun = -1
process.dqmSaver.saveAtJobEnd = True
process.dqmSaver.forceRunNumber = 999999

# Source (histograms)
process.source = cms.Source("DQMRootSource",
fileNames = cms.untracked.vstring(input_distributions),
)

# Event Setup (test)
from config_cff import ppsAlignmentConfigESSource as ppsAlignmentConfigESSourceTest
process.ppsAlignmentConfigESSourceTest = ppsAlignmentConfigESSourceTest

# Event Setup (reference)
from config_reference_cff import ppsAlignmentConfigESSource as ppsAlignmentConfigESSourceReference
ppsAlignmentConfigESSourceReference.matching = cms.PSet(
reference_dataset = cms.string(reference_dataset_path)
)
process.ppsAlignmentConfigESSourceReference = ppsAlignmentConfigESSourceReference

# SQLite results
if write_sqlite_results:
process.load("CondCore.CondDB.CondDB_cfi")
process.CondDB.connect = output_conditions
process.PoolDBOutputService = cms.Service("PoolDBOutputService",
process.CondDB,
timetype = cms.untracked.string('runnumber'),
toPut = cms.VPSet(cms.PSet(
record = cms.string('CTPPSRPAlignmentCorrectionsDataRcd'),
tag = cms.string(output_db_tag)
))
)

# DB object maker parameters
process.ppsAlignmentHarvester.write_sqlite_results = cms.bool(True)

process.path = cms.Path(
process.ppsAlignmentHarvester
)

process.end_path = cms.EndPath(
process.dqmSaver
)

process.schedule = cms.Schedule(
process.path,
process.end_path
)
58 changes: 0 additions & 58 deletions CalibPPS/AlignmentGlobal/test/run_analysis_manual_cfg.py

This file was deleted.

Loading