Skip to content
Draft
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
1 change: 0 additions & 1 deletion CalibPPS/ESProducers/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@
<use name="Utilities/Xerces"/>

<use name="clhep"/>
<use name="CondTools/RunInfo"/>
</library>
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@

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

#include "CondTools/RunInfo/interface/LHCInfoCombined.h"

#include "CondFormats/DataRecord/interface/LHCInfoRcd.h"
#include "CondFormats/DataRecord/interface/CTPPSOpticsRcd.h"
#include "CondFormats/DataRecord/interface/CTPPSInterpolatedOpticsRcd.h"

Expand All @@ -29,26 +28,19 @@ class CTPPSInterpolatedOpticalFunctionsESSource : public edm::ESProducer {
private:
edm::ESGetToken<LHCOpticalFunctionsSetCollection, CTPPSOpticsRcd> opticsToken_;
edm::ESGetToken<LHCInfo, LHCInfoRcd> lhcInfoToken_;
edm::ESGetToken<LHCInfoPerLS, LHCInfoPerLSRcd> lhcInfoPerLSToken_;
edm::ESGetToken<LHCInfoPerFill, LHCInfoPerFillRcd> lhcInfoPerFillToken_;
std::shared_ptr<LHCInterpolatedOpticalFunctionsSetCollection> currentData_;
float currentCrossingAngle_;
bool currentDataValid_;
const bool useNewLHCInfo_;
};

//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------

CTPPSInterpolatedOpticalFunctionsESSource::CTPPSInterpolatedOpticalFunctionsESSource(const edm::ParameterSet &iConfig)
: currentCrossingAngle_(LHCInfoCombined::crossingAngleInvalid),
currentDataValid_(false),
useNewLHCInfo_(iConfig.getParameter<bool>("useNewLHCInfo")) {
: currentCrossingAngle_(-1.), currentDataValid_(false) {
auto cc = setWhatProduced(this, iConfig.getParameter<std::string>("opticsLabel"));
opticsToken_ = cc.consumes(edm::ESInputTag("", iConfig.getParameter<std::string>("opticsLabel")));
lhcInfoToken_ = cc.consumes(edm::ESInputTag("", iConfig.getParameter<std::string>("lhcInfoLabel")));
lhcInfoPerLSToken_ = cc.consumes(edm::ESInputTag("", iConfig.getParameter<std::string>("lhcInfoPerLSLabel")));
lhcInfoPerFillToken_ = cc.consumes(edm::ESInputTag("", iConfig.getParameter<std::string>("lhcInfoPerFillLabel")));
}

//----------------------------------------------------------------------------------------------------
Expand All @@ -57,10 +49,7 @@ void CTPPSInterpolatedOpticalFunctionsESSource::fillDescriptions(edm::Configurat
edm::ParameterSetDescription desc;

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

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

auto lhcInfoCombined = LHCInfoCombined::createLHCInfoCombined<
CTPPSInterpolatedOpticsRcd,
edm::mpl::Vector<CTPPSOpticsRcd, LHCInfoRcd, LHCInfoPerFillRcd, LHCInfoPerLSRcd>>(
iRecord, lhcInfoPerLSToken_, lhcInfoPerFillToken_, lhcInfoToken_, useNewLHCInfo_);
LHCInfo const &lhcInfo = iRecord.get(lhcInfoToken_);

// is there anything to do?
if (currentDataValid_ && lhcInfoCombined.crossingAngle() == currentCrossingAngle_)
if (currentDataValid_ && lhcInfo.crossingAngle() == currentCrossingAngle_)
return currentData_;

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

currentDataValid_ = false;
currentCrossingAngle_ = LHCInfoCombined::crossingAngleInvalid;
currentCrossingAngle_ = -1;
currentData_ = std::make_shared<LHCInterpolatedOpticalFunctionsSetCollection>();

return currentData_;
}

// set new crossing angle
currentCrossingAngle_ = lhcInfoCombined.crossingAngle();
currentCrossingAngle_ = lhcInfo.crossingAngle();
edm::LogInfo("CTPPSInterpolatedOpticalFunctionsESSource")
<< "Crossing angle has changed to " << currentCrossingAngle_ << ".";

Expand All @@ -114,11 +100,17 @@ std::shared_ptr<LHCInterpolatedOpticalFunctionsSetCollection> CTPPSInterpolatedO
const auto &it = ofColl.begin();

// does the input xangle correspond to the actual one?
if (fabs(currentCrossingAngle_ - it->first) > 1e-6)
throw cms::Exception("CTPPSInterpolatedOpticalFunctionsESSource")
if (fabs(currentCrossingAngle_ - it->first) > 1e-6) {
edm::LogWarning("CTPPSInterpolatedOpticalFunctionsESSource")
<< "Cannot interpolate: input given only for xangle " << it->first << " while interpolation requested for "
<< currentCrossingAngle_ << ".";

currentDataValid_ = false;
currentData_ = std::make_shared<LHCInterpolatedOpticalFunctionsSetCollection>();

return currentData_;
}

currentData_ = std::make_shared<LHCInterpolatedOpticalFunctionsSetCollection>();
for (const auto &rp_p : it->second) {
const auto rpId = rp_p.first;
Expand Down

This file was deleted.

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

# by default, LHCInfo is now loaded from CondDB using a GT
ctppsLHCInfoLabel = cms.string("")

## minimal LHCInfo for 2016 data
#ctppsLHCInfoLabel = cms.string("ctpps_minimal")
#ctppsLHCInfoESSource_2016 = cms.ESSource("CTPPSLHCInfoESSource",
# label = ctppsLHCInfoLabel,
# validityRange = cms.EventRange("270293:min - 290872:max"),
# beamEnergy = cms.double(6500), # GeV
# xangle = cms.double(185) # murad
#)
4 changes: 3 additions & 1 deletion CalibPPS/ESProducers/python/ctppsOpticalFunctions_cff.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import FWCore.ParameterSet.Config as cms

from CalibPPS.ESProducers.ctppsLHCInfo_cff import *

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

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

# optics interpolation between crossing angles
from CalibPPS.ESProducers.ctppsInterpolatedOpticalFunctionsESSource_cff import *
from CalibPPS.ESProducers.ctppsInterpolatedOpticalFunctionsESSource_cfi import *
ctppsInterpolatedOpticalFunctionsESSource.lhcInfoLabel = ctppsLHCInfoLabel
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import FWCore.ParameterSet.Config as cms

from CalibPPS.ESProducers.ctppsLHCInfo_cff import *

# (source) optical functions sampled at few xangles
from CalibPPS.ESProducers.ctppsOpticalFunctionsESSource_cfi import *

Expand Down Expand Up @@ -136,4 +138,5 @@
ctppsOpticalFunctionsESSource.configuration.append(optics_2022)

# optics interpolation between crossing angles
from CalibPPS.ESProducers.ctppsInterpolatedOpticalFunctionsESSource_cff import *
from CalibPPS.ESProducers.ctppsInterpolatedOpticalFunctionsESSource_cfi import *
ctppsInterpolatedOpticalFunctionsESSource.lhcInfoLabel = ctppsLHCInfoLabel
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
process = cms.Process( 'TEST',ctpps_2018)

# LHCInfo plotter
process.load('Validation.CTPPS.ctppsLHCInfoPlotter_cff')
process.load("Validation.CTPPS.ctppsLHCInfoPlotter_cfi")
process.ctppsLHCInfoPlotter.outputFile = "alcareco_lhc_info_express.root"

# Load geometry from DB
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
process = cms.Process( 'TEST',ctpps_2018)

# LHCInfo plotter
process.load('Validation.CTPPS.ctppsLHCInfoPlotter_cff')
process.load("Validation.CTPPS.ctppsLHCInfoPlotter_cfi")
process.ctppsLHCInfoPlotter.outputFile = "alcareco_lhc_info_prompt.root"

# Load geometry from DB
Expand Down
7 changes: 2 additions & 5 deletions CondFormats/DataRecord/interface/CTPPSInterpolatedOpticsRcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@

#include "CondFormats/DataRecord/interface/CTPPSOpticsRcd.h"
#include "CondFormats/DataRecord/interface/LHCInfoRcd.h"
#include "CondFormats/DataRecord/interface/LHCInfoPerFillRcd.h"
#include "CondFormats/DataRecord/interface/LHCInfoPerLSRcd.h"

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

class CTPPSInterpolatedOpticsRcd
: public edm::eventsetup::DependentRecordImplementation<
CTPPSInterpolatedOpticsRcd,
edm::mpl::Vector<CTPPSOpticsRcd, LHCInfoRcd, LHCInfoPerFillRcd, LHCInfoPerLSRcd>> {};
: public edm::eventsetup::DependentRecordImplementation<CTPPSInterpolatedOpticsRcd,
edm::mpl::Vector<CTPPSOpticsRcd, LHCInfoRcd>> {};

#endif
1 change: 0 additions & 1 deletion CondFormats/RunInfo/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<use name="FWCore/Utilities"/>
<use name="CoralBase"/>
<use name="boost_serialization"/>
<use name="CondFormats/DataRecord"/>
<export>
<lib name="1"/>
</export>
82 changes: 0 additions & 82 deletions CondTools/RunInfo/interface/LHCInfoCombined.h

This file was deleted.

74 changes: 0 additions & 74 deletions CondTools/RunInfo/src/LHCInfoCombined.cc

This file was deleted.

1 change: 1 addition & 0 deletions DataFormats/ProtonReco/interface/ForwardProton.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ namespace reco {

/// chi-squared of the fit
float chi2() const { return chi2_; }
void setChi2(double chi2) { chi2_ = chi2; }
/// number of degrees of freedom for the track fit
unsigned int ndof() const { return ndof_; }
/// chi-squared divided by ndof (or chi-squared * 1e6 if ndof is zero)
Expand Down
Loading