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:
24 
25 private:
27  const edm::IOVSyncValue &,
28  edm::ValidityInterval &) override;
29 
31 
33  double m_beamEnergy;
34  double m_betaStar;
35  double m_xangle;
36 
38 };
39 
40 //----------------------------------------------------------------------------------------------------
41 //----------------------------------------------------------------------------------------------------
42 
44  : m_label(conf.getParameter<std::string>("label")),
45  m_validityRange(conf.getParameter<edm::EventRange>("validityRange")),
46  m_beamEnergy(conf.getParameter<double>("beamEnergy")),
47  m_betaStar(conf.getParameter<double>("betaStar")),
48  m_xangle(conf.getParameter<double>("xangle")),
49  m_insideValidityRange(false) {
50  setWhatProduced(this, m_label);
51  findingRecord<LHCInfoRcd>();
52 }
53 
54 //----------------------------------------------------------------------------------------------------
55 
58 
59  desc.add<std::string>("label", "")->setComment("label of the LHCInfo record");
60 
61  desc.add<edm::EventRange>("validityRange", edm::EventRange())->setComment("interval of validity");
62 
63  desc.add<double>("beamEnergy", 0.)->setComment("beam energy");
64  desc.add<double>("betaStar", 0.)->setComment("beta*");
65  desc.add<double>("xangle", 0.)->setComment("crossing angle");
66 
67  descriptions.add("ctppsLHCInfoESSource", desc);
68 }
69 
70 //----------------------------------------------------------------------------------------------------
71 
73  const edm::IOVSyncValue &iosv,
74  edm::ValidityInterval &oValidity) {
75  if (edm::contains(m_validityRange, iosv.eventID())) {
76  m_insideValidityRange = true;
79  } else {
80  m_insideValidityRange = false;
81 
82  if (iosv.eventID() < m_validityRange.startEventID()) {
85  edm::EventID endEvent =
86  (lb > 1) ? edm::EventID(run, lb - 1, 0) : edm::EventID(run - 1, edm::EventID::maxLuminosityBlockNumber(), 0);
87 
89  } else {
92  edm::EventID beginEvent = (lb < edm::EventID::maxLuminosityBlockNumber() - 1) ? edm::EventID(run, lb + 1, 0)
93  : edm::EventID(run + 1, 0, 0);
94 
96  }
97  }
98 }
99 
100 //----------------------------------------------------------------------------------------------------
101 
103  auto output = std::make_unique<LHCInfo>();
104 
105  if (m_insideValidityRange) {
106  output->setEnergy(m_beamEnergy);
107  output->setBetaStar(m_betaStar);
108  output->setCrossingAngle(m_xangle);
109  } else {
110  output->setEnergy(0.);
111  output->setBetaStar(0.);
112  output->setCrossingAngle(0.);
113  }
114 
116 }
117 
118 //----------------------------------------------------------------------------------------------------
119 
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:37
funct::false
false
Definition: Factorize.h:29
ESHandle.h
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
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:163
CTPPSLHCInfoESSource::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &)
Definition: CTPPSLHCInfoESSource.cc:56
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::ValidityInterval
Definition: ValidityInterval.h:28
LHCInfo.h
ESProducer.h
CTPPSLHCInfoESSource::produce
edm::ESProducts< std::unique_ptr< LHCInfo > > produce(const LHCInfoRcd &)
Definition: CTPPSLHCInfoESSource.cc:102
CTPPSLHCInfoESSource::m_label
std::string m_label
Definition: CTPPSLHCInfoESSource.cc:30
edm::ESProducts
Definition: ESProducts.h:105
CTPPSLHCInfoESSource::m_betaStar
double m_betaStar
Definition: CTPPSLHCInfoESSource.cc:34
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
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
CTPPSLHCInfoESSource::CTPPSLHCInfoESSource
CTPPSLHCInfoESSource(const edm::ParameterSet &)
Definition: CTPPSLHCInfoESSource.cc:43
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:35
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
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:47
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
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
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:32
edm::ESProducer
Definition: ESProducer.h:104
ParameterSet.h
LHCInfoRcd.h
edm::EventID
Definition: EventID.h:31
CTPPSLHCInfoESSource::m_beamEnergy
double m_beamEnergy
Definition: CTPPSLHCInfoESSource.cc:33
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:72