CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ShallowEventDataProducer Class Reference

#include <ShallowEventDataProducer.h>

Inheritance diagram for ShallowEventDataProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 ShallowEventDataProducer (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- 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 ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
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, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- 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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::EDGetTokenT< LumiScalersCollectionscalerToken_
 
edm::EDGetTokenT< L1GlobalTriggerReadoutRecordtrig_token_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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

Definition at line 10 of file ShallowEventDataProducer.h.

Constructor & Destructor Documentation

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

Definition at line 8 of file ShallowEventDataProducer.cc.

References edm::ParameterSet::getParameter(), produce(), scalerToken_, and trig_token_.

8  {
9  produces <unsigned int> ( "run" );
10  produces <unsigned int> ( "event" );
11  produces <unsigned int> ( "bx" );
12  produces <unsigned int> ( "lumi" );
13  produces <float> ( "instLumi" );
14  produces <float> ( "PU" );
15  #ifdef ExtendedCALIBTree
16  produces <std::vector<bool> > ( "TrigTech" );
17  produces <std::vector<bool> > ( "TrigPh" );
18  #endif
19 
20  trig_token_ = consumes<L1GlobalTriggerReadoutRecord>(iConfig.getParameter<edm::InputTag>("trigRecord"));
21  scalerToken_ = consumes< LumiScalersCollection >(iConfig.getParameter<edm::InputTag>("lumiScalers"));
22 
23 }
T getParameter(std::string const &) const
edm::EDGetTokenT< LumiScalersCollection > scalerToken_
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > trig_token_

Member Function Documentation

void ShallowEventDataProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 26 of file ShallowEventDataProducer.cc.

References edm::EventBase::bunchCrossing(), edm::EventID::event(), edm::Event::getByToken(), mps_fire::i, edm::EventBase::id(), muonGEMDigis_cfi::instLumi, edm::EventBase::luminosityBlock(), eostools::move(), JetPlusTrackCorrections_cff::PU, edm::Event::put(), writedatasetfile::run, edm::EventID::run(), scalerToken_, and trig_token_.

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

26  {
27 
28 
29  auto run = std::make_unique<unsigned int>(iEvent.id().run() );
30  auto event = std::make_unique<unsigned int>(iEvent.id().event() );
31  auto bx = std::make_unique<unsigned int>(iEvent.bunchCrossing() );
32  auto lumi = std::make_unique<unsigned int>(iEvent.luminosityBlock() );
33 
35  iEvent.getByToken(trig_token_, gtRecord);
36 
37  #ifdef ExtendedCALIBTree
38  std::vector<bool> TrigTech_(64,false);
39  std::vector<bool> TrigPh_(128,false);
40  #endif
41 
42  #ifdef ExtendedCALIBTree
43  // Get dWord after masking disabled bits
44  DecisionWord dWord = gtRecord->decisionWord();
45  if ( ! dWord.empty() ) { // if board not there this is zero
46  // loop over dec. bit to get total rate (no overlap)
47  for ( int i = 0; i < 64; ++i ) {
48  TrigPh_[i]= dWord[i];
49  }
50  }
51 
52  TechnicalTriggerWord tw = gtRecord->technicalTriggerWord();
53  if ( ! tw.empty() ) {
54  // loop over dec. bit to get total rate (no overlap)
55  for ( int i = 0; i < 64; ++i ) {
56  TrigTech_[i]=tw[i];
57  }
58  }
59 
60  auto TrigTech = std::make_unique<std::vector<bool>>(TrigTech_);
61  auto TrigPh = std::make_unique<std::vector<bool>>(TrigPh_);
62  #endif
63 
64  // Luminosity informations
66  float instLumi_=0; float PU_=0;
67  iEvent.getByToken(scalerToken_, lumiScalers);
68  if(lumiScalers.isValid()){
69  if (lumiScalers->begin() != lumiScalers->end()) {
70  instLumi_ = lumiScalers->begin()->instantLumi();
71  PU_ = lumiScalers->begin()->pileup();
72  }
73  } else {
74  edm::LogInfo("ShallowEventDataProducer")
75  << "LumiScalers collection not found in the event; will write dummy values";
76  }
77 
78  auto instLumi = std::make_unique<float>(instLumi_);
79  auto PU = std::make_unique<float>(PU_);
80 
81  iEvent.put(std::move(run), "run" );
82  iEvent.put(std::move(event), "event" );
83  iEvent.put(std::move(bx), "bx" );
84  iEvent.put(std::move(lumi), "lumi" );
85  #ifdef ExtendedCALIBTree
86  iEvent.put(std::move(TrigTech), "TrigTech" );
87  iEvent.put(std::move(TrigPh), "TrigPh" );
88  #endif
89  iEvent.put(std::move(instLumi), "instLumi");
90  iEvent.put(std::move(PU), "PU");
91 }
RunNumber_t run() const
Definition: EventID.h:39
EventNumber_t event() const
Definition: EventID.h:41
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
edm::EDGetTokenT< LumiScalersCollection > scalerToken_
int bunchCrossing() const
Definition: EventBase.h:64
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:61
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > trig_token_
std::vector< bool > DecisionWord
typedefs
std::vector< bool > TechnicalTriggerWord
technical trigger bits (64 bits)
edm::EventID id() const
Definition: EventBase.h:59
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1

Member Data Documentation

edm::EDGetTokenT< LumiScalersCollection > ShallowEventDataProducer::scalerToken_
private

Definition at line 16 of file ShallowEventDataProducer.h.

Referenced by produce(), and ShallowEventDataProducer().

edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > ShallowEventDataProducer::trig_token_
private

Definition at line 15 of file ShallowEventDataProducer.h.

Referenced by produce(), and ShallowEventDataProducer().