CMS 3D CMS Logo

CTPPSLHCInfoESSource.cc
Go to the documentation of this file.
1 // Original Author: Jan Kašpar
2 
10 
13 
14 //----------------------------------------------------------------------------------------------------
15 
20 public:
23 
24 private:
26  const edm::IOVSyncValue &,
27  edm::ValidityInterval &) override;
28 
30 
32  double m_beamEnergy;
33  double m_xangle;
34 
36 };
37 
38 //----------------------------------------------------------------------------------------------------
39 //----------------------------------------------------------------------------------------------------
40 
42  : m_label(conf.getParameter<std::string>("label")),
43  m_validityRange(conf.getParameter<edm::EventRange>("validityRange")),
44  m_beamEnergy(conf.getParameter<double>("beamEnergy")),
45  m_xangle(conf.getParameter<double>("xangle")),
46  m_insideValidityRange(false) {
47  setWhatProduced(this, m_label);
48  findingRecord<LHCInfoRcd>();
49 }
50 
51 //----------------------------------------------------------------------------------------------------
52 
54  const edm::IOVSyncValue &iosv,
55  edm::ValidityInterval &oValidity) {
56  if (edm::contains(m_validityRange, iosv.eventID())) {
57  m_insideValidityRange = true;
60  } else {
61  m_insideValidityRange = false;
62 
63  if (iosv.eventID() < m_validityRange.startEventID()) {
66  edm::EventID endEvent =
67  (lb > 1) ? edm::EventID(run, lb - 1, 0) : edm::EventID(run - 1, edm::EventID::maxLuminosityBlockNumber(), 0);
68 
70  } else {
73  edm::EventID beginEvent = (lb < edm::EventID::maxLuminosityBlockNumber() - 1) ? edm::EventID(run, lb + 1, 0)
74  : edm::EventID(run + 1, 0, 0);
75 
77  }
78  }
79 }
80 
81 //----------------------------------------------------------------------------------------------------
82 
84  auto output = std::make_unique<LHCInfo>();
85 
87  output->setEnergy(m_beamEnergy);
88  output->setCrossingAngle(m_xangle);
89  } else {
90  output->setEnergy(0.);
91  output->setCrossingAngle(0.);
92  }
93 
95 }
96 
97 //----------------------------------------------------------------------------------------------------
98 
edm::EventRange::startEventID
EventID startEventID() const
Definition: EventRange.h:46
edm::RunNumber_t
unsigned int RunNumber_t
Definition: RunLumiEventNumber.h:14
CTPPSLHCInfoESSource::m_insideValidityRange
bool m_insideValidityRange
Definition: CTPPSLHCInfoESSource.cc:35
funct::false
false
Definition: Factorize.h:34
ESHandle.h
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::EventRange::endEventID
EventID endEventID() const
Definition: EventRange.h:47
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
edm::ValidityInterval
Definition: ValidityInterval.h:28
LHCInfo.h
ESProducer.h
CTPPSLHCInfoESSource::produce
edm::ESProducts< std::unique_ptr< LHCInfo > > produce(const LHCInfoRcd &)
Definition: CTPPSLHCInfoESSource.cc:83
CTPPSLHCInfoESSource::m_label
std::string m_label
Definition: CTPPSLHCInfoESSource.cc:29
edm::ESProducts
Definition: ESProducts.h:105
edm::EventID::luminosityBlock
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:39
edm::LuminosityBlockNumber_t
unsigned int LuminosityBlockNumber_t
Definition: RunLumiEventNumber.h:13
edm::EventSetupRecordIntervalFinder
Definition: EventSetupRecordIntervalFinder.h:33
edm::eventsetup::EventSetupRecordKey
Definition: EventSetupRecordKey.h:30
edm::es::products
ESProducts< std::remove_reference_t< TArgs >... > products(TArgs &&... args)
Definition: ESProducts.h:128
MakerMacros.h
edm::EventID::maxLuminosityBlockNumber
static LuminosityBlockNumber_t maxLuminosityBlockNumber()
Definition: EventID.h:94
CTPPSLHCInfoESSource::CTPPSLHCInfoESSource
CTPPSLHCInfoESSource(const edm::ParameterSet &)
Definition: CTPPSLHCInfoESSource.cc:41
LHCInfoRcd
Definition: LHCInfoRcd.h:24
edm::IOVSyncValue
Definition: IOVSyncValue.h:31
edm::EventID::run
RunNumber_t run() const
Definition: EventID.h:38
DEFINE_FWK_EVENTSETUP_SOURCE
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Definition: SourceFactory.h:91
EventSetupRecordIntervalFinder.h
CTPPSLHCInfoESSource::m_xangle
double m_xangle
Definition: CTPPSLHCInfoESSource.cc:33
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ESProducts.h
SourceFactory.h
edm::IOVSyncValue::eventID
const EventID & eventID() const
Definition: IOVSyncValue.h:40
edm::ParameterSet
Definition: ParameterSet.h:36
edm::IOVSyncValue::endOfTime
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
edm::contains
bool contains(EventRange const &lh, EventID const &rh)
Definition: EventRange.cc:37
cond::ValidityInterval
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:17
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
writedatasetfile.run
run
Definition: writedatasetfile.py:27
edm::IOVSyncValue::beginOfTime
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
CTPPSLHCInfoESSource
Provides LHCInfo data necessary for CTPPS reconstruction (and direct simulation).
Definition: CTPPSLHCInfoESSource.cc:19
CTPPSLHCInfoESSource::m_validityRange
edm::EventRange m_validityRange
Definition: CTPPSLHCInfoESSource.cc:31
edm::ESProducer
Definition: ESProducer.h:101
ParameterSet.h
LHCInfoRcd.h
edm::EventID
Definition: EventID.h:31
CTPPSLHCInfoESSource::m_beamEnergy
double m_beamEnergy
Definition: CTPPSLHCInfoESSource.cc:32
edm::EventRange
Definition: EventRange.h:31
crabWrapper.key
key
Definition: crabWrapper.py:19
CTPPSLHCInfoESSource::setIntervalFor
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
Definition: CTPPSLHCInfoESSource.cc:53