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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 10 of file ShallowEventDataProducer.h.

Constructor & Destructor Documentation

◆ ShallowEventDataProducer()

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

Definition at line 8 of file ShallowEventDataProducer.cc.

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 }

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

Member Function Documentation

◆ produce()

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

Implements edm::EDProducer.

Definition at line 24 of file ShallowEventDataProducer.cc.

24  {
25  auto run = std::make_unique<unsigned int>(iEvent.id().run());
26  auto event = std::make_unique<unsigned int>(iEvent.id().event());
27  auto bx = std::make_unique<unsigned int>(iEvent.bunchCrossing());
28  auto lumi = std::make_unique<unsigned int>(iEvent.luminosityBlock());
29 
31  iEvent.getByToken(trig_token_, gtRecord);
32 
33 #ifdef ExtendedCALIBTree
34  std::vector<bool> TrigTech_(64, false);
35  std::vector<bool> TrigPh_(128, false);
36 #endif
37 
38 #ifdef ExtendedCALIBTree
39  // Get dWord after masking disabled bits
40  DecisionWord dWord = gtRecord->decisionWord();
41  if (!dWord.empty()) { // if board not there this is zero
42  // loop over dec. bit to get total rate (no overlap)
43  for (int i = 0; i < 64; ++i) {
44  TrigPh_[i] = dWord[i];
45  }
46  }
47 
48  TechnicalTriggerWord tw = gtRecord->technicalTriggerWord();
49  if (!tw.empty()) {
50  // loop over dec. bit to get total rate (no overlap)
51  for (int i = 0; i < 64; ++i) {
52  TrigTech_[i] = tw[i];
53  }
54  }
55 
56  auto TrigTech = std::make_unique<std::vector<bool>>(TrigTech_);
57  auto TrigPh = std::make_unique<std::vector<bool>>(TrigPh_);
58 #endif
59 
60  // Luminosity informations
62  float instLumi_ = 0;
63  float PU_ = 0;
64  iEvent.getByToken(scalerToken_, lumiScalers);
65  if (lumiScalers.isValid()) {
66  if (lumiScalers->begin() != lumiScalers->end()) {
67  instLumi_ = lumiScalers->begin()->instantLumi();
68  PU_ = lumiScalers->begin()->pileup();
69  }
70  } else {
71  edm::LogInfo("ShallowEventDataProducer")
72  << "LumiScalers collection not found in the event; will write dummy values";
73  }
74 
75  auto instLumi = std::make_unique<float>(instLumi_);
76  auto PU = std::make_unique<float>(PU_);
77 
78  iEvent.put(std::move(run), "run");
79  iEvent.put(std::move(event), "event");
80  iEvent.put(std::move(bx), "bx");
81  iEvent.put(std::move(lumi), "lumi");
82 #ifdef ExtendedCALIBTree
83  iEvent.put(std::move(TrigTech), "TrigTech");
84  iEvent.put(std::move(TrigPh), "TrigPh");
85 #endif
86  iEvent.put(std::move(instLumi), "instLumi");
87  iEvent.put(std::move(PU), "PU");
88 }

References simKBmtfDigis_cfi::bx, mps_fire::i, iEvent, muonGEMDigis_cfi::instLumi, V0Monitor_cfi::lumiScalers, eostools::move(), JetPlusTrackCorrections_cff::PU, writedatasetfile::run, scalerToken_, and trig_token_.

Member Data Documentation

◆ scalerToken_

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

Definition at line 17 of file ShallowEventDataProducer.h.

Referenced by produce(), and ShallowEventDataProducer().

◆ trig_token_

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

Definition at line 16 of file ShallowEventDataProducer.h.

Referenced by produce(), and ShallowEventDataProducer().

mps_fire.i
i
Definition: mps_fire.py:355
V0Monitor_cfi.lumiScalers
lumiScalers
Definition: V0Monitor_cfi.py:9
edm::LogInfo
Definition: MessageLogger.h:254
edm::Handle
Definition: AssociativeIterator.h:50
JetPlusTrackCorrections_cff.PU
PU
Definition: JetPlusTrackCorrections_cff.py:25
simKBmtfDigis_cfi.bx
bx
Definition: simKBmtfDigis_cfi.py:55
iEvent
int iEvent
Definition: GenABIO.cc:224
muonGEMDigis_cfi.instLumi
instLumi
Definition: muonGEMDigis_cfi.py:10
DecisionWord
std::vector< bool > DecisionWord
typedefs
Definition: L1GlobalTriggerReadoutSetupFwd.h:34
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
ShallowEventDataProducer::trig_token_
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > trig_token_
Definition: ShallowEventDataProducer.h:16
eostools.move
def move(src, dest)
Definition: eostools.py:511
writedatasetfile.run
run
Definition: writedatasetfile.py:27
ShallowEventDataProducer::scalerToken_
edm::EDGetTokenT< LumiScalersCollection > scalerToken_
Definition: ShallowEventDataProducer.h:17
TechnicalTriggerWord
std::vector< bool > TechnicalTriggerWord
technical trigger bits (64 bits)
Definition: L1GlobalTriggerReadoutSetupFwd.h:41
event
Definition: event.py:1
lumi
Definition: LumiSectionData.h:20
edm::InputTag
Definition: InputTag.h:15