CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
PileupSummaryInfoSlimmer Class Reference
Inheritance diagram for PileupSummaryInfoSlimmer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PileupSummaryInfoSlimmer (const edm::ParameterSet &conf)
 
void produce (edm::StreamID, edm::Event &, edm::EventSetup const &) const final
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () 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 Attributes

const std::vector< int > keepDetailedInfoFor_
 
const edm::EDGetTokenT< std::vector< PileupSummaryInfo > > src_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase 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::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 PileupSummaryInfoSlimmer.cc.

Constructor & Destructor Documentation

◆ PileupSummaryInfoSlimmer()

PileupSummaryInfoSlimmer::PileupSummaryInfoSlimmer ( const edm::ParameterSet conf)
inline

Definition at line 12 of file PileupSummaryInfoSlimmer.cc.

13  : src_(consumes<std::vector<PileupSummaryInfo>>(conf.getParameter<edm::InputTag>("src"))),
14  keepDetailedInfoFor_(conf.getParameter<std::vector<int32_t>>("keepDetailedInfoFor")) {
15  produces<std::vector<PileupSummaryInfo>>();
16  }

Member Function Documentation

◆ produce()

void PileupSummaryInfoSlimmer::produce ( edm::StreamID  ,
edm::Event evt,
edm::EventSetup const &  es 
) const
finalvirtual

Implements edm::global::EDProducerBase.

Definition at line 25 of file PileupSummaryInfoSlimmer.cc.

25  {
27  auto output = std::make_unique<std::vector<PileupSummaryInfo>>();
28 
29  evt.getByToken(src_, input);
30 
31  for (const auto& psu : *input) {
32  const int bunchCrossing = psu.getBunchCrossing();
33  const int bunchSpacing = psu.getBunchSpacing();
34  const int num_PU_vertices = psu.getPU_NumInteractions();
35  const float TrueNumInteractions = psu.getTrueNumInteractions();
36 
37  std::vector<float> zpositions;
38  std::vector<float> times;
39  std::vector<float> sumpT_lowpT;
40  std::vector<float> sumpT_highpT;
41  std::vector<int> ntrks_lowpT;
42  std::vector<int> ntrks_highpT;
43  std::vector<edm::EventID> eventInfo;
44  std::vector<float> pT_hats;
45 
46  const bool keep_details = std::find(keepDetailedInfoFor_.begin(), keepDetailedInfoFor_.end(), bunchCrossing) !=
48 
49  if (keep_details) {
50  zpositions = psu.getPU_zpositions();
51  times = psu.getPU_times();
52  sumpT_lowpT = psu.getPU_sumpT_lowpT();
53  sumpT_highpT = psu.getPU_sumpT_highpT();
54  ntrks_lowpT = psu.getPU_ntrks_lowpT();
55  ntrks_highpT = psu.getPU_ntrks_highpT();
56  eventInfo = psu.getPU_EventID();
57  pT_hats = psu.getPU_pT_hats();
58  }
59  // insert the slimmed vertex info
60  output->emplace_back(num_PU_vertices,
61  zpositions,
62  times,
63  sumpT_lowpT,
64  sumpT_highpT,
65  ntrks_lowpT,
66  ntrks_highpT,
67  eventInfo,
68  pT_hats,
69  bunchCrossing,
70  TrueNumInteractions,
71  bunchSpacing);
72  }
73 
74  evt.put(std::move(output));
75 }

References ZMuMuAnalysisNtupler_cff::eventInfo, spr::find(), edm::Event::getByToken(), input, keepDetailedInfoFor_, eostools::move(), convertSQLitetoXML_cfg::output, edm::Event::put(), and src_.

Member Data Documentation

◆ keepDetailedInfoFor_

const std::vector<int> PileupSummaryInfoSlimmer::keepDetailedInfoFor_
private

Definition at line 22 of file PileupSummaryInfoSlimmer.cc.

Referenced by produce().

◆ src_

const edm::EDGetTokenT<std::vector<PileupSummaryInfo> > PileupSummaryInfoSlimmer::src_
private

Definition at line 21 of file PileupSummaryInfoSlimmer.cc.

Referenced by produce().

input
static const std::string input
Definition: EdmProvDump.cc:48
PileupSummaryInfoSlimmer::keepDetailedInfoFor_
const std::vector< int > keepDetailedInfoFor_
Definition: PileupSummaryInfoSlimmer.cc:22
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
PileupSummaryInfoSlimmer::src_
const edm::EDGetTokenT< std::vector< PileupSummaryInfo > > src_
Definition: PileupSummaryInfoSlimmer.cc:21
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
edm::Handle
Definition: AssociativeIterator.h:50
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
ZMuMuAnalysisNtupler_cff.eventInfo
eventInfo
Definition: ZMuMuAnalysisNtupler_cff.py:15
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:132
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:126
edm::InputTag
Definition: InputTag.h:15