CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
EventWithHistoryProducerFromL1ABC Class Reference

#include <DPGAnalysis/SiStripTools/src/EventWithHistoryProducerFromL1ABC.cc>

Inheritance diagram for EventWithHistoryProducerFromL1ABC:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 EventWithHistoryProducerFromL1ABC (const edm::ParameterSet &)
 
 ~EventWithHistoryProducerFromL1ABC ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

virtual void beginJob ()
 
virtual void beginRun (edm::Run &, const edm::EventSetup &)
 
virtual void endJob ()
 
virtual void endRun (edm::Run &, const edm::EventSetup &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 

Private Attributes

unsigned int _curroffevent
 
long long _curroffset
 
edm::InputTag _l1abccollection
 
std::map< unsigned int, long long > _offsets
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 43 of file EventWithHistoryProducerFromL1ABC.cc.

Constructor & Destructor Documentation

EventWithHistoryProducerFromL1ABC::EventWithHistoryProducerFromL1ABC ( const edm::ParameterSet iConfig)
explicit

Definition at line 75 of file EventWithHistoryProducerFromL1ABC.cc.

75  :
76  _l1abccollection(iConfig.getParameter<edm::InputTag>("l1ABCCollection")),
78 {
79  produces<EventWithHistory>();
80 
81  //now do what ever other initialization is needed
82 
83 }
T getParameter(std::string const &) const
std::map< unsigned int, long long > _offsets
EventWithHistoryProducerFromL1ABC::~EventWithHistoryProducerFromL1ABC ( )

Definition at line 86 of file EventWithHistoryProducerFromL1ABC.cc.

87 {
88 
89  // do anything here that needs to be done at desctruction time
90  // (e.g. close files, deallocate resources etc.)
91 
92 }

Member Function Documentation

void EventWithHistoryProducerFromL1ABC::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 164 of file EventWithHistoryProducerFromL1ABC.cc.

165 {
166 }
void EventWithHistoryProducerFromL1ABC::beginRun ( edm::Run ,
const edm::EventSetup  
)
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 169 of file EventWithHistoryProducerFromL1ABC.cc.

References _offsets.

170 {
171  // reset offset vector
172 
173  _offsets.clear();
174  edm::LogInfo("AbsoluteBXOffsetReset") << "Absolute BX offset map reset";
175 
176 }
std::map< unsigned int, long long > _offsets
void EventWithHistoryProducerFromL1ABC::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 192 of file EventWithHistoryProducerFromL1ABC.cc.

192  {
193 }
void EventWithHistoryProducerFromL1ABC::endRun ( edm::Run ,
const edm::EventSetup  
)
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 179 of file EventWithHistoryProducerFromL1ABC.cc.

References _offsets, and evf::evtn::offset().

180 {
181  // summary of absolute bx offset vector
182 
183  edm::LogInfo("AbsoluteBXOffsetSummary") << "Absolute BX offset summary:";
184  for(std::map<unsigned int, long long>::const_iterator offset=_offsets.begin();offset!=_offsets.end();++offset) {
185  edm::LogVerbatim("AbsoluteBXOffsetSummary") << offset->first << " " << offset->second;
186  }
187 
188 }
unsigned int offset(bool)
std::map< unsigned int, long long > _offsets
void EventWithHistoryProducerFromL1ABC::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 101 of file EventWithHistoryProducerFromL1ABC.cc.

References _curroffevent, _curroffset, _l1abccollection, _offsets, edm::EventBase::bunchCrossing(), edm::EventID::event(), edm::Event::getByLabel(), edm::EventBase::id(), edm::EventBase::orbitNumber(), edm::Event::put(), and edm::Event::run().

Referenced by python.JSONExport.JsonExport::export(), and python.HTMLExport.HTMLExport::export().

102 {
103  using namespace edm;
104 
105  if(iEvent.run() < 110878 ) {
106 
107  std::auto_ptr<EventWithHistory> pOut(new EventWithHistory(iEvent));
108  iEvent.put(pOut);
109 
110  }
111  else {
112 
114  iEvent.getByLabel(_l1abccollection,pIn);
115 
116  // offset computation
117 
118  long long orbitoffset = 0;
119  int bxoffset = 0;
120  for(L1AcceptBunchCrossingCollection::const_iterator l1abc=pIn->begin();l1abc!=pIn->end();++l1abc) {
121  if(l1abc->l1AcceptOffset()==0) {
122  orbitoffset = (long long)l1abc->orbitNumber() - (long long)iEvent.orbitNumber();
123  bxoffset = l1abc->bunchCrossing() - iEvent.bunchCrossing();
124  }
125  }
126 
127 
128  std::auto_ptr<EventWithHistory> pOut(new EventWithHistory(iEvent,*pIn,orbitoffset,bxoffset));
129  iEvent.put(pOut);
130 
131  // monitor offset
132 
133  long long absbxoffset = orbitoffset*3564 + bxoffset;
134 
135  if(_offsets.size()==0) {
136  _curroffset = absbxoffset;
137  _curroffevent = iEvent.id().event();
138  _offsets[iEvent.id().event()] = absbxoffset;
139  }
140  else {
141  if(_curroffset != absbxoffset || iEvent.id().event() < _curroffevent ) {
142 
143  if( _curroffset != absbxoffset) {
144  edm::LogInfo("AbsoluteBXOffsetChanged") << "Absolute BX offset changed from "
145  << _curroffset << " to "
146  << absbxoffset << " at orbit "
147  << iEvent.orbitNumber() << " and BX "
148  << iEvent.bunchCrossing();
149  for(L1AcceptBunchCrossingCollection::const_iterator l1abc=pIn->begin();l1abc!=pIn->end();++l1abc) {
150  edm::LogVerbatim("AbsoluteBXOffsetChanged") << *l1abc;
151  }
152  }
153 
154  _curroffset = absbxoffset;
155  _curroffevent = iEvent.id().event();
156  _offsets[iEvent.id().event()] = absbxoffset;
157  }
158  }
159  }
160 }
EventNumber_t event() const
Definition: EventID.h:44
int bunchCrossing() const
Definition: EventBase.h:62
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
RunNumber_t run() const
Definition: Event.h:66
int orbitNumber() const
Definition: EventBase.h:63
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
edm::EventID id() const
Definition: EventBase.h:56
std::map< unsigned int, long long > _offsets

Member Data Documentation

unsigned int EventWithHistoryProducerFromL1ABC::_curroffevent
private

Definition at line 60 of file EventWithHistoryProducerFromL1ABC.cc.

Referenced by produce().

long long EventWithHistoryProducerFromL1ABC::_curroffset
private

Definition at line 59 of file EventWithHistoryProducerFromL1ABC.cc.

Referenced by produce().

edm::InputTag EventWithHistoryProducerFromL1ABC::_l1abccollection
private

Definition at line 57 of file EventWithHistoryProducerFromL1ABC.cc.

Referenced by produce().

std::map<unsigned int, long long> EventWithHistoryProducerFromL1ABC::_offsets
private

Definition at line 58 of file EventWithHistoryProducerFromL1ABC.cc.

Referenced by beginRun(), endRun(), and produce().