CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 beginJob() override;
47  void produce(edm::Event&, const edm::EventSetup&) override;
48  void endJob() override;
49 
50  // ----------member data ---------------------------
51 
52  const unsigned int _depth;
54 };
55 
56 //
57 // constants, enums and typedefs
58 //
59 
60 //
61 // static data member definitions
62 //
63 
64 //
65 // constructors and destructor
66 //
68  : _depth(iConfig.getUntrackedParameter<unsigned int>("historyDepth")), _prevHE() {
69  produces<EventWithHistory>();
70 
71  //now do what ever other initialization is needed
72 }
73 
75  // do anything here that needs to be done at desctruction time
76  // (e.g. close files, deallocate resources etc.)
77 }
78 
79 //
80 // member functions
81 //
82 
83 // ------------ method called to produce the data ------------
85  using namespace edm;
86 
87  std::unique_ptr<EventWithHistory> heOut(
88  new EventWithHistory(iEvent.id().event(), iEvent.orbitNumber(), iEvent.bunchCrossing()));
89  heOut->add(_prevHE, _depth);
90 
91  if (*heOut < _prevHE)
92  edm::LogInfo("EventsNotInOrder") << " Events not in order " << _prevHE._event;
93 
94  _prevHE = *heOut;
95  iEvent.put(std::move(heOut));
96 }
97 
98 // ------------ method called once each job just before starting event loop ------------
100 
101 // ------------ method called once each job just after ending the event loop ------------
103 
104 //define this as a plug-in
EventNumber_t event() const
Definition: EventID.h:40
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
EventWithHistoryProducer(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
int bunchCrossing() const
Definition: EventBase.h:64
void produce(edm::Event &, const edm::EventSetup &) override
int iEvent
Definition: GenABIO.cc:224
def move
Definition: eostools.py:511
int orbitNumber() const
Definition: EventBase.h:65
Log< level::Info, false > LogInfo
edm::EventID id() const
Definition: EventBase.h:59
edm::EventNumber_t _event
Definition: TinyEvent.h:64