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 {
21  public:
24 
25  private:
27 
29 
31  double m_beamEnergy;
32  double m_xangle;
33 
35 };
36 
37 //----------------------------------------------------------------------------------------------------
38 //----------------------------------------------------------------------------------------------------
39 
41  m_label(conf.getParameter<std::string>("label")),
42  m_validityRange(conf.getParameter<edm::EventRange>("validityRange")),
43  m_beamEnergy(conf.getParameter<double>("beamEnergy")),
44  m_xangle(conf.getParameter<double>("xangle")),
46 {
47  setWhatProduced(this, m_label);
48  findingRecord<LHCInfoRcd>();
49 }
50 
51 //----------------------------------------------------------------------------------------------------
52 
54  const edm::IOVSyncValue& iosv, edm::ValidityInterval& oValidity)
55 {
57  {
58  m_insideValidityRange = true;
60  } else {
61  m_insideValidityRange = false;
62 
63  if (iosv.eventID() < m_validityRange.startEventID())
64  {
67  edm::EventID endEvent = (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) : edm::EventID(run+1, 0, 0);
74 
76  }
77  }
78 }
79 
80 //----------------------------------------------------------------------------------------------------
81 
83 {
84  auto output = std::make_unique<LHCInfo>();
85 
87  {
88  output->setEnergy(m_beamEnergy);
89  output->setCrossingAngle(m_xangle);
90  } else {
91  output->setEnergy(0.);
92  output->setCrossingAngle(0.);
93  }
94 
96 }
97 
98 //----------------------------------------------------------------------------------------------------
99 
101 
RunNumber_t run() const
Definition: EventID.h:39
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:124
bool contains(EventRange const &lh, EventID const &rh)
Definition: EventRange.cc:38
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:19
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:40
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:107
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
EventID startEventID() const
Definition: EventRange.h:44
EventID endEventID() const
Definition: EventRange.h:45
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