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")),
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 
RunNumber_t run() const
Definition: EventID.h:38
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
bool contains(EventRange const &lh, EventID const &rh)
Definition: EventRange.cc:37
const EventID & eventID() const
Definition: IOVSyncValue.h:40
CTPPSLHCInfoESSource(const edm::ParameterSet &)
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:17
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:39
unsigned int LuminosityBlockNumber_t
ESProducts< std::remove_reference_t< TArgs >... > products(TArgs &&...args)
Definition: ESProducts.h:128
edm::ESProducts< std::unique_ptr< LHCInfo > > produce(const LHCInfoRcd &)
edm::EventRange m_validityRange
Provides LHCInfo data necessary for CTPPS reconstruction (and direct simulation). ...
static LuminosityBlockNumber_t maxLuminosityBlockNumber()
Definition: EventID.h:94
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
EventID startEventID() const
Definition: EventRange.h:46
EventID endEventID() const
Definition: EventRange.h:47
HLT enums.
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Definition: SourceFactory.h:91
unsigned int RunNumber_t
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
def move(src, dest)
Definition: eostools.py:511