CMS 3D CMS Logo

L1ObjectKeysOnlineProdBase.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: L1ObjectKeysOnlineProdBase
4 // Class: L1ObjectKeysOnlineProdBase
5 //
13 //
14 // Original Author: Werner Man-Li Sun
15 // Created: Fri Aug 22 19:51:36 CEST 2008
16 // $Id: L1ObjectKeysOnlineProdBase.cc,v 1.1 2008/09/19 19:22:59 wsun Exp $
17 //
18 //
19 
20 // system include files
21 
22 // user include files
24 
26 
29 
31 
32 //
33 // class declaration
34 //
35 
36 //
37 // constants, enums and typedefs
38 //
39 
40 //
41 // static data member definitions
42 //
43 
44 //
45 // constructors and destructor
46 //
48  : m_omdsReader(iConfig.getParameter<std::string>("onlineDB"),
49  iConfig.getParameter<std::string>("onlineAuthentication")) {
50  //the following line is needed to tell the framework what
51  // data is being produced
52 
53  // The subsystemLabel is used by L1TriggerKeyOnlineProd to identify the
54  // L1TriggerKeys to concatenate.
55  auto cc = setWhatProduced(this, iConfig.getParameter<std::string>("subsystemLabel"));
56 
57  //now do what ever other initialization is needed
58  l1TriggerKeyToken_ = cc.consumes(edm::ESInputTag("", "SubsystemKeysOnly"));
59 }
60 
62  // do anything here that needs to be done at desctruction time
63  // (e.g. close files, deallocate resources etc.)
64 }
65 
66 //
67 // member functions
68 //
69 
70 // ------------ method called to produce the data ------------
72  // Get L1TriggerKey with label "SubsystemKeysOnly". Re-throw exception if
73  // not present.
74  edm::ESHandle<L1TriggerKey> subsystemKeys;
75  try {
76  subsystemKeys = iRecord.getHandle(l1TriggerKeyToken_);
77  } catch (l1t::DataAlreadyPresentException& ex) {
78  throw ex;
79  }
80 
81  // Copy L1TriggerKey to new object.
82  std::unique_ptr<L1TriggerKey> pL1TriggerKey = std::make_unique<L1TriggerKey>(*subsystemKeys);
83 
84  // Get object keys.
85  fillObjectKeys(pL1TriggerKey.get());
86 
87  return pL1TriggerKey;
88 }
89 
90 //define this as a plug-in
91 //DEFINE_FWK_EVENTSETUP_MODULE(L1ObjectKeysOnlineProdBase);
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::unique_ptr< L1TriggerKey > ReturnType
ReturnType produce(const L1TriggerKeyRcd &)
edm::ESGetToken< L1TriggerKey, L1TriggerKeyRcd > l1TriggerKeyToken_
ESHandle< ProductT > getHandle(ESGetToken< ProductT, DepRecordT > const &iToken) const
virtual void fillObjectKeys(FillType)=0
L1ObjectKeysOnlineProdBase(const edm::ParameterSet &)