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
 
const bool _forceNoOffset
 
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)
 
static void prevalidate (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 76 of file EventWithHistoryProducerFromL1ABC.cc.

References _forceNoOffset.

76  :
77  _l1abccollection(iConfig.getParameter<edm::InputTag>("l1ABCCollection")),
78  _forceNoOffset(iConfig.getUntrackedParameter<bool>("forceNoOffset",false)),
80 {
81 
82  if(_forceNoOffset) edm::LogWarning("NoOffsetComputation") << "Orbit and BX offset will NOT be computed: Be careful!";
83 
84  produces<EventWithHistory>();
85 
86  //now do what ever other initialization is needed
87 
88 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::map< unsigned int, long long > _offsets
EventWithHistoryProducerFromL1ABC::~EventWithHistoryProducerFromL1ABC ( )

Definition at line 91 of file EventWithHistoryProducerFromL1ABC.cc.

92 {
93 
94  // do anything here that needs to be done at desctruction time
95  // (e.g. close files, deallocate resources etc.)
96 
97 }

Member Function Documentation

void EventWithHistoryProducerFromL1ABC::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 171 of file EventWithHistoryProducerFromL1ABC.cc.

172 {
173 }
void EventWithHistoryProducerFromL1ABC::beginRun ( edm::Run ,
const edm::EventSetup  
)
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 176 of file EventWithHistoryProducerFromL1ABC.cc.

References _offsets.

177 {
178  // reset offset vector
179 
180  _offsets.clear();
181  edm::LogInfo("AbsoluteBXOffsetReset") << "Absolute BX offset map reset";
182 
183 }
std::map< unsigned int, long long > _offsets
void EventWithHistoryProducerFromL1ABC::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 199 of file EventWithHistoryProducerFromL1ABC.cc.

199  {
200 }
void EventWithHistoryProducerFromL1ABC::endRun ( edm::Run ,
const edm::EventSetup  
)
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 186 of file EventWithHistoryProducerFromL1ABC.cc.

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

187 {
188  // summary of absolute bx offset vector
189 
190  edm::LogInfo("AbsoluteBXOffsetSummary") << "Absolute BX offset summary:";
191  for(std::map<unsigned int, long long>::const_iterator offset=_offsets.begin();offset!=_offsets.end();++offset) {
192  edm::LogVerbatim("AbsoluteBXOffsetSummary") << offset->first << " " << offset->second;
193  }
194 
195 }
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 106 of file EventWithHistoryProducerFromL1ABC.cc.

References _curroffevent, _curroffset, _forceNoOffset, _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 JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

107 {
108  using namespace edm;
109 
110  if(iEvent.run() < 110878 ) {
111 
112  std::auto_ptr<EventWithHistory> pOut(new EventWithHistory(iEvent));
113  iEvent.put(pOut);
114 
115  }
116  else {
117 
119  iEvent.getByLabel(_l1abccollection,pIn);
120 
121  // offset computation
122 
123  long long orbitoffset = 0;
124  int bxoffset = 0;
125  if(!_forceNoOffset) {
126  for(L1AcceptBunchCrossingCollection::const_iterator l1abc=pIn->begin();l1abc!=pIn->end();++l1abc) {
127  if(l1abc->l1AcceptOffset()==0) {
128  orbitoffset = (long long)l1abc->orbitNumber() - (long long)iEvent.orbitNumber();
129  bxoffset = l1abc->bunchCrossing() - iEvent.bunchCrossing();
130  }
131  }
132  }
133 
134 
135  std::auto_ptr<EventWithHistory> pOut(new EventWithHistory(iEvent,*pIn,orbitoffset,bxoffset));
136  iEvent.put(pOut);
137 
138  // monitor offset
139 
140  long long absbxoffset = orbitoffset*3564 + bxoffset;
141 
142  if(_offsets.size()==0) {
143  _curroffset = absbxoffset;
144  _curroffevent = iEvent.id().event();
145  _offsets[iEvent.id().event()] = absbxoffset;
146  }
147  else {
148  if(_curroffset != absbxoffset || iEvent.id().event() < _curroffevent ) {
149 
150  if( _curroffset != absbxoffset) {
151  edm::LogInfo("AbsoluteBXOffsetChanged") << "Absolute BX offset changed from "
152  << _curroffset << " to "
153  << absbxoffset << " at orbit "
154  << iEvent.orbitNumber() << " and BX "
155  << iEvent.bunchCrossing();
156  for(L1AcceptBunchCrossingCollection::const_iterator l1abc=pIn->begin();l1abc!=pIn->end();++l1abc) {
157  edm::LogVerbatim("AbsoluteBXOffsetChanged") << *l1abc;
158  }
159  }
160 
161  _curroffset = absbxoffset;
162  _curroffevent = iEvent.id().event();
163  _offsets[iEvent.id().event()] = absbxoffset;
164  }
165  }
166  }
167 }
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:85
RunNumber_t run() const
Definition: Event.h:67
int orbitNumber() const
Definition: EventBase.h:63
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
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 61 of file EventWithHistoryProducerFromL1ABC.cc.

Referenced by produce().

long long EventWithHistoryProducerFromL1ABC::_curroffset
private

Definition at line 60 of file EventWithHistoryProducerFromL1ABC.cc.

Referenced by produce().

const bool EventWithHistoryProducerFromL1ABC::_forceNoOffset
private
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 59 of file EventWithHistoryProducerFromL1ABC.cc.

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