test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 
21 // system include files
22 #include <memory>
23 
24 // user include files
27 
30 
33 
34 //#include "DPGAnalysis/SiStripTools/interface/TinyEvent.h"
36 
37 //
38 // class decleration
39 //
40 
42  public:
45 
46  private:
47  virtual void beginJob() override ;
48  virtual void produce(edm::Event&, const edm::EventSetup&) override;
49  virtual void endJob() override ;
50 
51  // ----------member data ---------------------------
52 
53  const unsigned int _depth;
55 };
56 
57 //
58 // constants, enums and typedefs
59 //
60 
61 
62 //
63 // static data member definitions
64 //
65 
66 //
67 // constructors and destructor
68 //
70  _depth(iConfig.getUntrackedParameter<unsigned int>("historyDepth")),
71  _prevHE()
72 {
73 
74  produces<EventWithHistory>();
75 
76  //now do what ever other initialization is needed
77 
78 }
79 
80 
82 {
83 
84  // do anything here that needs to be done at desctruction time
85  // (e.g. close files, deallocate resources etc.)
86 
87 }
88 
89 
90 //
91 // member functions
92 //
93 
94 // ------------ method called to produce the data ------------
95 void
97 {
98 
99  using namespace edm;
100 
101  std::auto_ptr<EventWithHistory> heOut(new EventWithHistory(iEvent.id().event(),iEvent.orbitNumber(),iEvent.bunchCrossing()));
102  heOut->add(_prevHE,_depth);
103 
104  if(*heOut < _prevHE) edm::LogInfo("EventsNotInOrder") << " Events not in order " << _prevHE._event;
105 
106  _prevHE = *heOut;
107  iEvent.put(heOut);
108 
109 }
110 
111 // ------------ method called once each job just before starting event loop ------------
112 void
114 {
115 }
116 
117 // ------------ method called once each job just after ending the event loop ------------
118 void
120 }
121 
122 //define this as a plug-in
EventNumber_t event() const
Definition: EventID.h:41
virtual void beginJob() override
EventWithHistoryProducer(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
int bunchCrossing() const
Definition: EventBase.h:65
virtual void produce(edm::Event &, const edm::EventSetup &) override
int iEvent
Definition: GenABIO.cc:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
int orbitNumber() const
Definition: EventBase.h:66
virtual void endJob() override
edm::EventID id() const
Definition: EventBase.h:59
edm::EventNumber_t _event
Definition: TinyEvent.h:87