CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
OtherObjectVariableComputer< T > Class Template Reference

Matcher of number of reconstructed objects in the event to probe. More...

Inheritance diagram for OtherObjectVariableComputer< T >:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 OtherObjectVariableComputer (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~OtherObjectVariableComputer () override
 
- 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
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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

double default_
 
bool doSort_
 
StringCutObjectSelector< T, true > objCut_
 
edm::EDGetTokenT< edm::View< T > > objectsToken_
 
StringObjectFunction< T, true > objSort_
 
StringObjectFunction< T, true > objVar_
 
edm::EDGetTokenT< edm::View< reco::Candidate > > probesToken_
 

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 wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
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 = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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

template<typename T>
class OtherObjectVariableComputer< T >

Matcher of number of reconstructed objects in the event to probe.

Author
Kalanand Mishra

Definition at line 27 of file OtherObjectVariableComputer.cc.

Constructor & Destructor Documentation

◆ OtherObjectVariableComputer()

template<typename T >
OtherObjectVariableComputer< T >::OtherObjectVariableComputer ( const edm::ParameterSet iConfig)
explicit

Definition at line 45 of file OtherObjectVariableComputer.cc.

48  objVar_(iConfig.getParameter<std::string>("expression")),
49  default_(iConfig.getParameter<double>("default")),
50  objCut_(
51  iConfig.existsAs<std::string>("objectSelection") ? iConfig.getParameter<std::string>("objectSelection") : "",
52  true),
53  doSort_(iConfig.existsAs<std::string>("objectSortDescendingBy")),
54  objSort_(doSort_ ? iConfig.getParameter<std::string>("objectSortDescendingBy") : "1", true) {
55  produces<edm::ValueMap<float>>();
56 }

◆ ~OtherObjectVariableComputer()

template<typename T >
OtherObjectVariableComputer< T >::~OtherObjectVariableComputer ( )
override

Definition at line 59 of file OtherObjectVariableComputer.cc.

59 {}

Member Function Documentation

◆ produce()

template<typename T >
void OtherObjectVariableComputer< T >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 62 of file OtherObjectVariableComputer.cc.

62  {
63  using namespace edm;
64 
65  // read input
68  iEvent.getByToken(probesToken_, probes);
69  iEvent.getByToken(objectsToken_, objects);
70 
71  // fill
72  std::vector<std::pair<double, double>> selected;
73  typename View<T>::const_iterator object, endobjects = objects->end();
74  for (object = objects->begin(); object != endobjects; ++object) {
75  if (objCut_(*object)) {
76  selected.push_back(std::pair<double, double>(objSort_(*object), objVar_(*object)));
77  if (!doSort_)
78  break; // if we take just the first one, there's no need of computing the others
79  }
80  }
81  if (doSort_ && selected.size() > 1)
82  std::sort(selected.begin(), selected.end()); // sorts (ascending)
83 
84  // prepare vector for output
85  std::vector<float> values(probes->size(), (selected.empty() ? default_ : selected.back().second));
86 
87  // convert into ValueMap and store
88  auto valMap = std::make_unique<ValueMap<float>>();
90  filler.insert(probes, values.begin(), values.end());
91  filler.fill();
92  iEvent.put(std::move(valMap));
93 }

References trigObjTnPSource_cfi::filler, iEvent, eostools::move(), resolutioncreator_cfi::object, hgcalPerformanceValidation::objects, and contentValuesCheck::values.

Member Data Documentation

◆ default_

template<typename T >
double OtherObjectVariableComputer< T >::default_
private

Definition at line 38 of file OtherObjectVariableComputer.cc.

◆ doSort_

template<typename T >
bool OtherObjectVariableComputer< T >::doSort_
private

Definition at line 40 of file OtherObjectVariableComputer.cc.

◆ objCut_

template<typename T >
StringCutObjectSelector<T, true> OtherObjectVariableComputer< T >::objCut_
private

Definition at line 39 of file OtherObjectVariableComputer.cc.

◆ objectsToken_

template<typename T >
edm::EDGetTokenT<edm::View<T> > OtherObjectVariableComputer< T >::objectsToken_
private

Definition at line 36 of file OtherObjectVariableComputer.cc.

◆ objSort_

template<typename T >
StringObjectFunction<T, true> OtherObjectVariableComputer< T >::objSort_
private

Definition at line 41 of file OtherObjectVariableComputer.cc.

◆ objVar_

template<typename T >
StringObjectFunction<T, true> OtherObjectVariableComputer< T >::objVar_
private

Definition at line 37 of file OtherObjectVariableComputer.cc.

◆ probesToken_

template<typename T >
edm::EDGetTokenT<edm::View<reco::Candidate> > OtherObjectVariableComputer< T >::probesToken_
private

Definition at line 35 of file OtherObjectVariableComputer.cc.

resolutioncreator_cfi.object
object
Definition: resolutioncreator_cfi.py:4
OtherObjectVariableComputer::doSort_
bool doSort_
Definition: OtherObjectVariableComputer.cc:40
OtherObjectVariableComputer::objVar_
StringObjectFunction< T, true > objVar_
Definition: OtherObjectVariableComputer.cc:37
edm
HLT enums.
Definition: AlignableModifier.h:19
OtherObjectVariableComputer::objSort_
StringObjectFunction< T, true > objSort_
Definition: OtherObjectVariableComputer.cc:41
objects
Definition: __init__.py:1
edm::ParameterSet::existsAs
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
edm::Handle
Definition: AssociativeIterator.h:50
OtherObjectVariableComputer::default_
double default_
Definition: OtherObjectVariableComputer.cc:38
contentValuesCheck.values
values
Definition: contentValuesCheck.py:38
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::View
Definition: CaloClusterFwd.h:14
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
iEvent
int iEvent
Definition: GenABIO.cc:224
OtherObjectVariableComputer::objectsToken_
edm::EDGetTokenT< edm::View< T > > objectsToken_
Definition: OtherObjectVariableComputer.cc:36
hgcalPerformanceValidation.objects
objects
Definition: hgcalPerformanceValidation.py:695
eostools.move
def move(src, dest)
Definition: eostools.py:511
OtherObjectVariableComputer::probesToken_
edm::EDGetTokenT< edm::View< reco::Candidate > > probesToken_
Definition: OtherObjectVariableComputer.cc:35
edm::ValueMap
Definition: ValueMap.h:107
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
OtherObjectVariableComputer::objCut_
StringCutObjectSelector< T, true > objCut_
Definition: OtherObjectVariableComputer.cc:39
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:153
edm::InputTag
Definition: InputTag.h:15