CMS 3D CMS Logo

LHCInfoProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: PhysicsTools/NanoAOD
4 // Class: LHCInfoProducer
5 //
11 //
12 // Original Author: Justin Williams
13 // Created: 05 Jul 2019 14:06:12 GMT
14 //
15 //
16 
17 // System include files
18 #include <memory>
19 #include <map>
20 #include <string>
21 #include <vector>
22 #include <iostream>
23 
24 // user include files
27 
30 
36 
39 
43 
45 
48 
49 class LHCInfoProducer : public edm::global::EDProducer<edm::BeginLuminosityBlockProducer> {
50 public:
52  produces<nanoaod::MergeableCounterTable, edm::Transition::BeginLuminosityBlock>();
53  }
54  ~LHCInfoProducer() override {}
55 
56  // ------------ method called to produce the data ------------
57  void produce(edm::StreamID id, edm::Event& iEvent, const edm::EventSetup& iSetup) const override {}
58 
59  void globalBeginLuminosityBlockProduce(edm::LuminosityBlock& iLumi, edm::EventSetup const& iSetup) const override {
60  edm::ESHandle<LHCInfo> lhcInfo;
61  iSetup.get<LHCInfoRcd>().get(lhcInfo);
62  const LHCInfo* info = lhcInfo.product();
63  auto out = std::make_unique<nanoaod::MergeableCounterTable>();
64  out->addFloat("crossingAngle", "LHC crossing angle", info->crossingAngle());
65  out->addFloat("betaStar", "LHC beta star", info->betaStar());
66  out->addFloat("energy", "LHC beam energy", info->energy());
67  iLumi.put(std::move(out));
68  }
69 
70  // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
71  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
73  desc.setUnknown();
74  descriptions.addDefault(desc);
75  }
76 };
77 
static const TGPicture * info(bool iBackgroundIsBlack)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void produce(edm::StreamID id, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
float const crossingAngle() const
Definition: LHCInfo.cc:176
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void addDefault(ParameterSetDescription const &psetDescription)
void put(std::unique_ptr< PROD > product)
Put a new product.
LHCInfoProducer(edm::ParameterSet const &)
float const betaStar() const
Definition: LHCInfo.cc:180
T get() const
Definition: EventSetup.h:71
float const energy() const
Definition: LHCInfo.cc:192
~LHCInfoProducer() override
void globalBeginLuminosityBlockProduce(edm::LuminosityBlock &iLumi, edm::EventSetup const &iSetup) const override
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:511