forked from cms-sw/cmssw
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make proton reco use LHCInfoCombined
- Loading branch information
Showing
24 changed files
with
343 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,4 +22,5 @@ | |
<use name="Utilities/Xerces"/> | ||
|
||
<use name="clhep"/> | ||
<use name="CondTools/RunInfo"/> | ||
</library> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
CalibPPS/ESProducers/python/ctppsInterpolatedOpticalFunctionsESSource_cff.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from CalibPPS.ESProducers.ctppsInterpolatedOpticalFunctionsESSource_cfi import * | ||
from Configuration.Eras.Modifier_run3_common_cff import run3_common | ||
run3_common.toModify(ctppsInterpolatedOpticalFunctionsESSource, useNewLHCInfo = True) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#ifndef CondTools_RunInfo_LHCInfoCombined_H | ||
#define CondTools_RunInfo_LHCInfoCombined_H | ||
|
||
#include "FWCore/Framework/interface/EventSetup.h" | ||
#include "FWCore/Framework/interface/DependentRecordImplementation.h" | ||
|
||
#include "CondFormats/RunInfo/interface/LHCInfo.h" | ||
#include "CondFormats/RunInfo/interface/LHCInfoPerLS.h" | ||
#include "CondFormats/RunInfo/interface/LHCInfoPerFill.h" | ||
|
||
#include "CondFormats/DataRecord/interface/LHCInfoPerLSRcd.h" | ||
#include "CondFormats/DataRecord/interface/LHCInfoPerFillRcd.h" | ||
#include "CondFormats/DataRecord/interface/LHCInfoRcd.h" | ||
|
||
#include <bitset> | ||
#include <iostream> | ||
#include <string> | ||
#include <sstream> | ||
#include <vector> | ||
|
||
class LHCInfoCombined { | ||
public: | ||
LHCInfoCombined() = default; | ||
|
||
LHCInfoCombined(const LHCInfo& lhcInfo); | ||
LHCInfoCombined(const LHCInfoPerLS& infoPerLS, const LHCInfoPerFill& infoPerFill); | ||
LHCInfoCombined(const edm::EventSetup& iSetup, | ||
const edm::ESGetToken<LHCInfoPerLS, LHCInfoPerLSRcd>& tokenInfoPerLS, | ||
const edm::ESGetToken<LHCInfoPerFill, LHCInfoPerFillRcd>& tokenInfoPerFill, | ||
const edm::ESGetToken<LHCInfo, LHCInfoRcd>& tokenInfo, | ||
bool useNewLHCInfo); | ||
|
||
//this factory method is necessary because constructor can't be a template | ||
template <class RecordT, class ListT> | ||
static LHCInfoCombined createLHCInfoCombined( | ||
const edm::eventsetup::DependentRecordImplementation<RecordT, ListT>& iRecord, | ||
const edm::ESGetToken<LHCInfoPerLS, LHCInfoPerLSRcd>& tokenInfoPerLS, | ||
const edm::ESGetToken<LHCInfoPerFill, LHCInfoPerFillRcd>& tokenInfoPerFill, | ||
const edm::ESGetToken<LHCInfo, LHCInfoRcd>& tokenInfo, | ||
bool useNewLHCInfo); | ||
|
||
void setFromLHCInfo(const LHCInfo& lhcInfo); | ||
void setFromPerLS(const LHCInfoPerLS& infoPerLS); | ||
void setFromPerFill(const LHCInfoPerFill& infoPerFill); | ||
|
||
float crossingAngle(); | ||
static constexpr float crossingAngleInvalid = -1.; | ||
bool isCrossingAngleInvalid(); | ||
|
||
float crossingAngleX; | ||
float crossingAngleY; | ||
float betaStarX; | ||
float betaStarY; | ||
float energy; | ||
unsigned short fillNumber; | ||
|
||
void print(std::ostream& os) const; | ||
}; | ||
|
||
std::ostream& operator<<(std::ostream& os, LHCInfoCombined beamInfo); | ||
|
||
template <class RecordT, class ListT> | ||
LHCInfoCombined LHCInfoCombined::createLHCInfoCombined( | ||
const edm::eventsetup::DependentRecordImplementation<RecordT, ListT>& iRecord, | ||
const edm::ESGetToken<LHCInfoPerLS, LHCInfoPerLSRcd>& tokenInfoPerLS, | ||
const edm::ESGetToken<LHCInfoPerFill, LHCInfoPerFillRcd>& tokenInfoPerFill, | ||
const edm::ESGetToken<LHCInfo, LHCInfoRcd>& tokenInfo, | ||
bool useNewLHCInfo) { | ||
LHCInfoCombined lhcInfoCombined; | ||
if (useNewLHCInfo) { | ||
LHCInfoPerLS const& lhcInfoPerLS = iRecord.get(tokenInfoPerLS); | ||
LHCInfoPerFill const& lhcInfoPerFill = iRecord.get(tokenInfoPerFill); | ||
lhcInfoCombined.setFromPerLS(lhcInfoPerLS); | ||
lhcInfoCombined.setFromPerFill(lhcInfoPerFill); | ||
} else { | ||
LHCInfo const& lhcInfo = iRecord.get(tokenInfo); | ||
lhcInfoCombined.setFromLHCInfo(lhcInfo); | ||
} | ||
return lhcInfoCombined; | ||
} | ||
|
||
#endif // CondTools_RunInfo_LHCInfoCombined_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#include "CondTools/RunInfo/interface/LHCInfoCombined.h" | ||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
|
||
LHCInfoCombined::LHCInfoCombined(const LHCInfo& lhcInfo) { setFromLHCInfo(lhcInfo); } | ||
|
||
LHCInfoCombined::LHCInfoCombined(const LHCInfoPerLS& infoPerLS, const LHCInfoPerFill& infoPerFill) { | ||
setFromPerLS(infoPerLS); | ||
setFromPerFill(infoPerFill); | ||
} | ||
|
||
LHCInfoCombined::LHCInfoCombined(const edm::EventSetup& iSetup, | ||
const edm::ESGetToken<LHCInfoPerLS, LHCInfoPerLSRcd>& tokenInfoPerLS, | ||
const edm::ESGetToken<LHCInfoPerFill, LHCInfoPerFillRcd>& tokenInfoPerFill, | ||
const edm::ESGetToken<LHCInfo, LHCInfoRcd>& tokenInfo, | ||
bool useNewLHCInfo) { | ||
if (useNewLHCInfo) { | ||
edm::ESHandle<LHCInfoPerLS> hLHCInfoPerLS = iSetup.getHandle(tokenInfoPerLS); | ||
edm::ESHandle<LHCInfoPerFill> hLHCInfoFill = iSetup.getHandle(tokenInfoPerFill); | ||
setFromPerLS(*hLHCInfoPerLS); | ||
setFromPerFill(*hLHCInfoFill); | ||
} else { | ||
edm::ESHandle<LHCInfo> hLHCInfo = iSetup.getHandle(tokenInfo); | ||
setFromLHCInfo(*hLHCInfo); | ||
} | ||
} | ||
|
||
void LHCInfoCombined::setFromLHCInfo(const LHCInfo& lhcInfo) { | ||
crossingAngleX = lhcInfo.crossingAngle(); | ||
crossingAngleY = 0; | ||
betaStarX = lhcInfo.betaStar(); | ||
betaStarY = lhcInfo.betaStar(); | ||
energy = lhcInfo.energy(); | ||
fillNumber = lhcInfo.fillNumber(); | ||
} | ||
void LHCInfoCombined::setFromPerLS(const LHCInfoPerLS& infoPerLS) { | ||
crossingAngleX = infoPerLS.crossingAngleX(); | ||
crossingAngleY = infoPerLS.crossingAngleY(); | ||
betaStarX = infoPerLS.betaStarX(); | ||
betaStarY = infoPerLS.betaStarY(); | ||
} | ||
void LHCInfoCombined::setFromPerFill(const LHCInfoPerFill& infoPerFill) { | ||
energy = infoPerFill.energy(); | ||
fillNumber = infoPerFill.fillNumber(); | ||
} | ||
|
||
float LHCInfoCombined::crossingAngle() { | ||
if (crossingAngleX == 0. && crossingAngleY == 0.) { | ||
return crossingAngleInvalid; | ||
} | ||
if (crossingAngleX != 0. && crossingAngleY != 0.) { | ||
edm::LogWarning("LHCInfoCombined") << "crossingAngleX and crossingAngleY are both different from 0"; | ||
return crossingAngleInvalid; | ||
} | ||
return crossingAngleX == 0. ? crossingAngleY : crossingAngleX; | ||
} | ||
|
||
//Comparison with the -1 value from LHC when crossing angle is not set | ||
bool LHCInfoCombined::isCrossingAngleInvalid() { | ||
float comparisonTolerance = 1e-6; | ||
return fabs(crossingAngle() - crossingAngleInvalid) <= comparisonTolerance; | ||
} | ||
|
||
void LHCInfoCombined::print(std::ostream& os) const { | ||
os << "Crossing angle x (urad): " << crossingAngleX << std::endl | ||
<< "Crossing angle y (urad): " << crossingAngleY << std::endl | ||
<< "Beta star x (m): " << betaStarX << std::endl | ||
<< "Beta star y (m): " << betaStarY << std::endl | ||
<< "Energy (GeV): " << energy << std::endl; | ||
} | ||
|
||
std::ostream& operator<<(std::ostream& os, LHCInfoCombined beamInfo) { | ||
beamInfo.print(os); | ||
return os; | ||
} |
Oops, something went wrong.