File indexing completed on 2024-04-06 12:06:35
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #include <memory>
0022
0023
0024 #include "FWCore/Framework/interface/Frameworkfwd.h"
0025 #include "FWCore/Framework/interface/stream/EDProducer.h"
0026
0027 #include "FWCore/Framework/interface/Event.h"
0028 #include "FWCore/Framework/interface/MakerMacros.h"
0029
0030 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0031 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0032
0033
0034 #include "DPGAnalysis/SiStripTools/interface/EventWithHistory.h"
0035
0036
0037
0038
0039
0040 class EventWithHistoryProducer : public edm::stream::EDProducer<> {
0041 public:
0042 explicit EventWithHistoryProducer(const edm::ParameterSet&);
0043 ~EventWithHistoryProducer() override;
0044
0045 private:
0046 void produce(edm::Event&, const edm::EventSetup&) override;
0047
0048
0049
0050 const unsigned int _depth;
0051 EventWithHistory _prevHE;
0052 };
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065 EventWithHistoryProducer::EventWithHistoryProducer(const edm::ParameterSet& iConfig)
0066 : _depth(iConfig.getUntrackedParameter<unsigned int>("historyDepth")), _prevHE() {
0067 produces<EventWithHistory>();
0068
0069
0070 }
0071
0072 EventWithHistoryProducer::~EventWithHistoryProducer() {
0073
0074
0075 }
0076
0077
0078
0079
0080
0081
0082 void EventWithHistoryProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
0083 using namespace edm;
0084
0085 std::unique_ptr<EventWithHistory> heOut(
0086 new EventWithHistory(iEvent.id().event(), iEvent.orbitNumber(), iEvent.bunchCrossing()));
0087 heOut->add(_prevHE, _depth);
0088
0089 if (*heOut < _prevHE)
0090 edm::LogInfo("EventsNotInOrder") << " Events not in order " << _prevHE._event;
0091
0092 _prevHE = *heOut;
0093 iEvent.put(std::move(heOut));
0094 }
0095
0096
0097 DEFINE_FWK_MODULE(EventWithHistoryProducer);