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  {
32  }
33 
35  EventAuxiliary aux(e.id(), "", e.time(), e.isRealData(), e.experimentType(),
37  //EventAuxiliary const& aux = e.auxiliary(); // when available
38  if(!history_.empty()) {
39  if(history_.back().id().next(aux.luminosityBlock()) != aux.id()) history_.clear();
40  if(history_.size() >= depth_) history_.pop_front();
41  }
42 
43  history_.push_back(aux);
44 
45  e.emplace(token_,history_.begin(), history_.end());
46  }
47 
49  }
50 
51 
52  void
55  desc.add<unsigned int>("historyDepth");
56  descriptions.add("eventAuxiliaryHistory", desc);
57  }
58 }
59 
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
EDPutTokenT< std::vector< EventAuxiliary > > token_
int bunchCrossing() const
Definition: EventBase.h:66
bool isRealData() const
Definition: EventBase.h:64
int orbitNumber() const
Definition: EventBase.h:67
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:453
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(ConfigurationDescriptions &descriptions)
edm::EventID id() const
Definition: EventBase.h:60
static int const invalidStoreNumber
HLT enums.
edm::EventAuxiliary::ExperimentType experimentType() const
Definition: EventBase.h:65
edm::Timestamp time() const
Definition: EventBase.h:61