CMS 3D CMS Logo

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::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 EventWithHistoryProducerFromL1ABC (const edm::ParameterSet &)
 
 ~EventWithHistoryProducerFromL1ABC ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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

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

Definition at line 178 of file EventWithHistoryProducerFromL1ABC.cc.

References _offsets, DEFINE_FWK_MODULE, and PFRecoTauDiscriminationByIsolation_cfi::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
void EventWithHistoryProducerFromL1ABC::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

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(), eostools::move(), 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::unique_ptr<EventWithHistory> pOut(new EventWithHistory(iEvent));
111  iEvent.put(std::move(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::unique_ptr<EventWithHistory> pOut(new EventWithHistory(iEvent,*pIn,orbitoffset,bxoffset));
134  iEvent.put(std::move(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
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
int bunchCrossing() const
Definition: EventBase.h:66
std::map< edm::EventNumber_t, long long > _offsets
RunNumber_t run() const
Definition: Event.h:94
int orbitNumber() const
Definition: EventBase.h:67
edm::EDGetTokenT< L1AcceptBunchCrossingCollection > _l1abccollectionToken
edm::EventID id() const
Definition: EventBase.h:60
HLT enums.
def move(src, dest)
Definition: eostools.py:510

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().