Skip to content

Commit 438ecaf

Browse files
committed
make proton reco use LHCInfoCombined
1 parent e0f88d0 commit 438ecaf

24 files changed

+343
-68
lines changed

CalibPPS/ESProducers/plugins/BuildFile.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@
2222
<use name="Utilities/Xerces"/>
2323

2424
<use name="clhep"/>
25+
<use name="CondTools/RunInfo"/>
2526
</library>

CalibPPS/ESProducers/plugins/CTPPSInterpolatedOpticalFunctionsESSource.cc

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
#include "FWCore/MessageLogger/interface/MessageLogger.h"
1010

11-
#include "CondFormats/DataRecord/interface/LHCInfoRcd.h"
11+
#include "CondTools/RunInfo/interface/LHCInfoCombined.h"
12+
1213
#include "CondFormats/DataRecord/interface/CTPPSOpticsRcd.h"
1314
#include "CondFormats/DataRecord/interface/CTPPSInterpolatedOpticsRcd.h"
1415

@@ -28,19 +29,26 @@ class CTPPSInterpolatedOpticalFunctionsESSource : public edm::ESProducer {
2829
private:
2930
edm::ESGetToken<LHCOpticalFunctionsSetCollection, CTPPSOpticsRcd> opticsToken_;
3031
edm::ESGetToken<LHCInfo, LHCInfoRcd> lhcInfoToken_;
32+
edm::ESGetToken<LHCInfoPerLS, LHCInfoPerLSRcd> lhcInfoPerLSToken_;
33+
edm::ESGetToken<LHCInfoPerFill, LHCInfoPerFillRcd> lhcInfoPerFillToken_;
3134
std::shared_ptr<LHCInterpolatedOpticalFunctionsSetCollection> currentData_;
3235
float currentCrossingAngle_;
3336
bool currentDataValid_;
37+
const bool useNewLHCInfo_;
3438
};
3539

3640
//----------------------------------------------------------------------------------------------------
3741
//----------------------------------------------------------------------------------------------------
3842

3943
CTPPSInterpolatedOpticalFunctionsESSource::CTPPSInterpolatedOpticalFunctionsESSource(const edm::ParameterSet &iConfig)
40-
: currentCrossingAngle_(-1.), currentDataValid_(false) {
44+
: currentCrossingAngle_(LHCInfoCombined::crossingAngleInvalid),
45+
currentDataValid_(false),
46+
useNewLHCInfo_(iConfig.getParameter<bool>("useNewLHCInfo")) {
4147
auto cc = setWhatProduced(this, iConfig.getParameter<std::string>("opticsLabel"));
4248
opticsToken_ = cc.consumes(edm::ESInputTag("", iConfig.getParameter<std::string>("opticsLabel")));
4349
lhcInfoToken_ = cc.consumes(edm::ESInputTag("", iConfig.getParameter<std::string>("lhcInfoLabel")));
50+
lhcInfoPerLSToken_ = cc.consumes(edm::ESInputTag("", iConfig.getParameter<std::string>("lhcInfoPerLSLabel")));
51+
lhcInfoPerFillToken_ = cc.consumes(edm::ESInputTag("", iConfig.getParameter<std::string>("lhcInfoPerFillLabel")));
4452
}
4553

4654
//----------------------------------------------------------------------------------------------------
@@ -49,7 +57,10 @@ void CTPPSInterpolatedOpticalFunctionsESSource::fillDescriptions(edm::Configurat
4957
edm::ParameterSetDescription desc;
5058

5159
desc.add<std::string>("lhcInfoLabel", "")->setComment("label of the LHCInfo record");
60+
desc.add<std::string>("lhcInfoPerFillLabel", "")->setComment("label of the LHCInfoPerFill record");
61+
desc.add<std::string>("lhcInfoPerLSLabel", "")->setComment("label of the LHCInfoPerLS record");
5262
desc.add<std::string>("opticsLabel", "")->setComment("label of the optics records");
63+
desc.add<bool>("useNewLHCInfo", false)->setComment("flag whether to use new LHCInfoPer* records or old LHCInfo");
5364

5465
descriptions.add("ctppsInterpolatedOpticalFunctionsESSource", desc);
5566
}
@@ -61,26 +72,29 @@ std::shared_ptr<LHCInterpolatedOpticalFunctionsSetCollection> CTPPSInterpolatedO
6172
// get the input data
6273
LHCOpticalFunctionsSetCollection const &ofColl = iRecord.get(opticsToken_);
6374

64-
LHCInfo const &lhcInfo = iRecord.get(lhcInfoToken_);
75+
auto lhcInfoCombined = LHCInfoCombined::createLHCInfoCombined<
76+
CTPPSInterpolatedOpticsRcd,
77+
edm::mpl::Vector<CTPPSOpticsRcd, LHCInfoRcd, LHCInfoPerFillRcd, LHCInfoPerLSRcd>>(
78+
iRecord, lhcInfoPerLSToken_, lhcInfoPerFillToken_, lhcInfoToken_, useNewLHCInfo_);
6579

6680
// is there anything to do?
67-
if (currentDataValid_ && lhcInfo.crossingAngle() == currentCrossingAngle_)
81+
if (currentDataValid_ && lhcInfoCombined.crossingAngle() == currentCrossingAngle_)
6882
return currentData_;
6983

7084
// is crossing angle reasonable (LHCInfo is correctly filled in DB)?
71-
if (lhcInfo.crossingAngle() == 0.) {
85+
if (lhcInfoCombined.isCrossingAngleInvalid()) {
7286
edm::LogInfo("CTPPSInterpolatedOpticalFunctionsESSource")
7387
<< "Invalid crossing angle, no optical functions produced.";
7488

7589
currentDataValid_ = false;
76-
currentCrossingAngle_ = -1;
90+
currentCrossingAngle_ = LHCInfoCombined::crossingAngleInvalid;
7791
currentData_ = std::make_shared<LHCInterpolatedOpticalFunctionsSetCollection>();
7892

7993
return currentData_;
8094
}
8195

8296
// set new crossing angle
83-
currentCrossingAngle_ = lhcInfo.crossingAngle();
97+
currentCrossingAngle_ = lhcInfoCombined.crossingAngle();
8498
edm::LogInfo("CTPPSInterpolatedOpticalFunctionsESSource")
8599
<< "Crossing angle has changed to " << currentCrossingAngle_ << ".";
86100

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from CalibPPS.ESProducers.ctppsInterpolatedOpticalFunctionsESSource_cfi import *
2+
from Configuration.Eras.Modifier_run3_common_cff import run3_common
3+
run3_common.toModify(ctppsInterpolatedOpticalFunctionsESSource, useNewLHCInfo = True)

CalibPPS/ESProducers/python/ctppsLHCInfo_cff.py

Lines changed: 0 additions & 13 deletions
This file was deleted.

CalibPPS/ESProducers/python/ctppsOpticalFunctions_cff.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import FWCore.ParameterSet.Config as cms
22

3-
from CalibPPS.ESProducers.ctppsLHCInfo_cff import *
43

54
# by default, (raw) optical functions are now loaded from CondDB using a GT
65

@@ -26,5 +25,4 @@
2625
#ctppsOpticalFunctionsESSource.configuration.append(config_2016_preTS2)
2726

2827
# optics interpolation between crossing angles
29-
from CalibPPS.ESProducers.ctppsInterpolatedOpticalFunctionsESSource_cfi import *
30-
ctppsInterpolatedOpticalFunctionsESSource.lhcInfoLabel = ctppsLHCInfoLabel
28+
from CalibPPS.ESProducers.ctppsInterpolatedOpticalFunctionsESSource_cff import *

CalibPPS/ESProducers/python/ctppsOpticalFunctions_non_DB_cff.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import FWCore.ParameterSet.Config as cms
22

3-
from CalibPPS.ESProducers.ctppsLHCInfo_cff import *
4-
53
# (source) optical functions sampled at few xangles
64
from CalibPPS.ESProducers.ctppsOpticalFunctionsESSource_cfi import *
75

@@ -138,5 +136,4 @@
138136
ctppsOpticalFunctionsESSource.configuration.append(optics_2022)
139137

140138
# optics interpolation between crossing angles
141-
from CalibPPS.ESProducers.ctppsInterpolatedOpticalFunctionsESSource_cfi import *
142-
ctppsInterpolatedOpticalFunctionsESSource.lhcInfoLabel = ctppsLHCInfoLabel
139+
from CalibPPS.ESProducers.ctppsInterpolatedOpticalFunctionsESSource_cff import *

Calibration/PPSAlCaRecoProducer/test/test_express_PPSAlCaReco_output.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
process = cms.Process( 'TEST',ctpps_2018)
77

88
# LHCInfo plotter
9-
process.load("Validation.CTPPS.ctppsLHCInfoPlotter_cfi")
9+
process.load('Validation.CTPPS.ctppsLHCInfoPlotter_cff')
1010
process.ctppsLHCInfoPlotter.outputFile = "alcareco_lhc_info_express.root"
1111

1212
# Load geometry from DB

Calibration/PPSAlCaRecoProducer/test/test_prompt_PPSAlCaReco_output.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
process = cms.Process( 'TEST',ctpps_2018)
77

88
# LHCInfo plotter
9-
process.load("Validation.CTPPS.ctppsLHCInfoPlotter_cfi")
9+
process.load('Validation.CTPPS.ctppsLHCInfoPlotter_cff')
1010
process.ctppsLHCInfoPlotter.outputFile = "alcareco_lhc_info_prompt.root"
1111

1212
# Load geometry from DB

CondFormats/DataRecord/interface/CTPPSInterpolatedOpticsRcd.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@
77

88
#include "CondFormats/DataRecord/interface/CTPPSOpticsRcd.h"
99
#include "CondFormats/DataRecord/interface/LHCInfoRcd.h"
10+
#include "CondFormats/DataRecord/interface/LHCInfoPerFillRcd.h"
11+
#include "CondFormats/DataRecord/interface/LHCInfoPerLSRcd.h"
1012

1113
#include "FWCore/Utilities/interface/mplVector.h"
1214

1315
class CTPPSInterpolatedOpticsRcd
14-
: public edm::eventsetup::DependentRecordImplementation<CTPPSInterpolatedOpticsRcd,
15-
edm::mpl::Vector<CTPPSOpticsRcd, LHCInfoRcd>> {};
16+
: public edm::eventsetup::DependentRecordImplementation<
17+
CTPPSInterpolatedOpticsRcd,
18+
edm::mpl::Vector<CTPPSOpticsRcd, LHCInfoRcd, LHCInfoPerFillRcd, LHCInfoPerLSRcd>> {};
1619

1720
#endif

CondFormats/RunInfo/BuildFile.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<use name="FWCore/Utilities"/>
66
<use name="CoralBase"/>
77
<use name="boost_serialization"/>
8+
<use name="CondFormats/DataRecord"/>
89
<export>
910
<lib name="1"/>
1011
</export>

0 commit comments

Comments
 (0)