CMS 3D CMS Logo

EventAuxiliaryHistoryProducer.cc
Go to the documentation of this file.
9 #include <deque>
10 
11 namespace edm {
12 
14  public:
16 
17  static void fillDescriptions(ConfigurationDescriptions& descriptions);
18  void produce(Event& e, EventSetup const& c) override;
19  void endJob() override;
20 
21  private:
22  unsigned int depth_;
23  std::deque<EventAuxiliary> history_;
25  };
26 
28  : depth_(ps.getParameter<unsigned int>("historyDepth")),
29  history_(),
30  token_{produces<std::vector<EventAuxiliary>>()} {}
31 
33  EventAuxiliary aux(e.id(),
34  "",
35  e.time(),
36  e.isRealData(),
37  e.experimentType(),
38  e.bunchCrossing(),
40  e.orbitNumber());
41  //EventAuxiliary const& aux = e.auxiliary(); // when available
42  if (!history_.empty()) {
43  if (history_.back().id().next(aux.luminosityBlock()) != aux.id())
44  history_.clear();
45  if (history_.size() >= depth_)
46  history_.pop_front();
47  }
48 
49  history_.push_back(aux);
50 
51  e.emplace(token_, history_.begin(), history_.end());
52  }
53 
55 
58  desc.add<unsigned int>("historyDepth");
59  descriptions.add("eventAuxiliaryHistory", desc);
60  }
61 } // namespace edm
62 
EDPutTokenT< std::vector< EventAuxiliary > > token_
int bunchCrossing() const
Definition: EventBase.h:64
bool isRealData() const
Definition: EventBase.h:62
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
int orbitNumber() const
Definition: EventBase.h:65
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void produce(Event &e, EventSetup const &c) override
OrphanHandle< PROD > emplace(EDPutTokenT< PROD > token, Args &&...args)
puts a new product
Definition: Event.h:413
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(ConfigurationDescriptions &descriptions)
edm::EventID id() const
Definition: EventBase.h:59
static int const invalidStoreNumber
HLT enums.
edm::EventAuxiliary::ExperimentType experimentType() const
Definition: EventBase.h:63
edm::Timestamp time() const
Definition: EventBase.h:60