CMS 3D CMS Logo

EventWithHistoryProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: EventWithHistoryProducer
4 // Class: EventWithHistoryProducer
5 //
13 //
14 // Original Author: Andrea Venturi
15 // Created: Sun Nov 30 19:05:41 CET 2008
16 // $Id: EventWithHistoryProducer.cc,v 1.2 2010/01/12 09:13:04 venturia Exp $
17 //
18 //
19 
20 // system include files
21 #include <memory>
22 
23 // user include files
26 
29 
32 
33 //#include "DPGAnalysis/SiStripTools/interface/TinyEvent.h"
35 
36 //
37 // class decleration
38 //
39 
41 public:
43  ~EventWithHistoryProducer() override;
44 
45 private:
46  void produce(edm::Event&, const edm::EventSetup&) override;
47 
48  // ----------member data ---------------------------
49 
50  const unsigned int _depth;
52 };
53 
54 //
55 // constants, enums and typedefs
56 //
57 
58 //
59 // static data member definitions
60 //
61 
62 //
63 // constructors and destructor
64 //
66  : _depth(iConfig.getUntrackedParameter<unsigned int>("historyDepth")), _prevHE() {
67  produces<EventWithHistory>();
68 
69  //now do what ever other initialization is needed
70 }
71 
73  // do anything here that needs to be done at desctruction time
74  // (e.g. close files, deallocate resources etc.)
75 }
76 
77 //
78 // member functions
79 //
80 
81 // ------------ method called to produce the data ------------
83  using namespace edm;
84 
85  std::unique_ptr<EventWithHistory> heOut(
86  new EventWithHistory(iEvent.id().event(), iEvent.orbitNumber(), iEvent.bunchCrossing()));
87  heOut->add(_prevHE, _depth);
88 
89  if (*heOut < _prevHE)
90  edm::LogInfo("EventsNotInOrder") << " Events not in order " << _prevHE._event;
91 
92  _prevHE = *heOut;
93  iEvent.put(std::move(heOut));
94 }
95 
96 //define this as a plug-in
EventWithHistoryProducer(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void produce(edm::Event &, const edm::EventSetup &) override
int iEvent
Definition: GenABIO.cc:224
Log< level::Info, false > LogInfo
HLT enums.
edm::EventNumber_t _event
Definition: TinyEvent.h:64
def move(src, dest)
Definition: eostools.py:511