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::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 EventWithHistoryProducerFromL1ABC (const edm::ParameterSet &)
 
 ~EventWithHistoryProducerFromL1ABC ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

edm::EventNumber_t _curroffevent
 
long long _curroffset
 
const bool _forceNoOffset
 
edm::EDGetTokenT
< L1AcceptBunchCrossingCollection
_l1abccollectionToken
 
std::map< edm::EventNumber_t,
long long > 
_offsets
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- 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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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 74 of file EventWithHistoryProducerFromL1ABC.cc.

References _forceNoOffset.

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

Definition at line 89 of file EventWithHistoryProducerFromL1ABC.cc.

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

Member Function Documentation

void EventWithHistoryProducerFromL1ABC::beginRun ( const edm::Run ,
const edm::EventSetup  
)
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 168 of file EventWithHistoryProducerFromL1ABC.cc.

References _offsets.

169 {
170  // reset offset vector
171 
172  _offsets.clear();
173  edm::LogInfo("AbsoluteBXOffsetReset") << "Absolute BX offset map reset";
174 
175 }
std::map< edm::EventNumber_t, long long > _offsets
void EventWithHistoryProducerFromL1ABC::endRun ( const edm::Run ,
const edm::EventSetup  
)
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 178 of file EventWithHistoryProducerFromL1ABC.cc.

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

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

Implements edm::EDProducer.

Definition at line 104 of file EventWithHistoryProducerFromL1ABC.cc.

References _curroffevent, _curroffset, _forceNoOffset, _l1abccollectionToken, _offsets, edm::EventBase::bunchCrossing(), edm::EventID::event(), edm::Event::getByToken(), 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().

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

Member Data Documentation

edm::EventNumber_t EventWithHistoryProducerFromL1ABC::_curroffevent
private

Definition at line 59 of file EventWithHistoryProducerFromL1ABC.cc.

Referenced by produce().

long long EventWithHistoryProducerFromL1ABC::_curroffset
private

Definition at line 58 of file EventWithHistoryProducerFromL1ABC.cc.

Referenced by produce().

const bool EventWithHistoryProducerFromL1ABC::_forceNoOffset
private
edm::EDGetTokenT<L1AcceptBunchCrossingCollection> EventWithHistoryProducerFromL1ABC::_l1abccollectionToken
private

Definition at line 55 of file EventWithHistoryProducerFromL1ABC.cc.

Referenced by produce().

std::map<edm::EventNumber_t, long long> EventWithHistoryProducerFromL1ABC::_offsets
private

Definition at line 57 of file EventWithHistoryProducerFromL1ABC.cc.

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