test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EventAuxiliaryHistoryProducer.cc
Go to the documentation of this file.
8 #include <deque>
9 
10 namespace edm {
11 
13  public:
16 
17  static void fillDescriptions(ConfigurationDescriptions& descriptions);
18  virtual void produce(Event& e, EventSetup const& c) override;
19  void endJob() override;
20 
21  private:
22  unsigned int depth_;
23  std::deque<EventAuxiliary> history_;
24  };
25 
27  depth_(ps.getParameter<unsigned int>("historyDepth")),
28  history_() {
29  produces<std::vector<EventAuxiliary> > ();
30  }
31 
33  }
34 
36  EventAuxiliary aux(e.id(), "", e.time(), e.isRealData(), e.experimentType(),
38  //EventAuxiliary const& aux = e.auxiliary(); // when available
39  if(history_.size() > 0) {
40  if(history_.back().id().next(aux.luminosityBlock()) != aux.id()) history_.clear();
41  if(history_.size() >= depth_) history_.pop_front();
42  }
43 
44  history_.push_back(aux);
45 
46  //Serialize into std::vector
47  std::unique_ptr<std::vector<EventAuxiliary > > result(new std::vector<EventAuxiliary>);
48  for(size_t j = 0; j < history_.size(); ++j) {
49  result->push_back(history_[j]);
50  }
51  e.put(std::move(result));
52  }
53 
55  }
56 
57 
58  void
61  desc.add<unsigned int>("historyDepth");
62  descriptions.add("eventAuxiliaryHistory", desc);
63  }
64 }
65 
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
int bunchCrossing() const
Definition: EventBase.h:66
bool isRealData() const
Definition: EventBase.h:64
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
tuple result
Definition: query.py:137
def move
Definition: eostools.py:510
int j
Definition: DBlmapReader.cc:9
int orbitNumber() const
Definition: EventBase.h:67
ParameterDescriptionBase * add(U const &iLabel, T const &value)
virtual void produce(Event &e, EventSetup const &c) override
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
edm::EventAuxiliary::ExperimentType experimentType() const
Definition: EventBase.h:65
edm::Timestamp time() const
Definition: EventBase.h:61