CMS 3D CMS Logo

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

#include <L1Trigger/L1TCommon/plugins/L1TComparisonResultFilter.cc>

Inheritance diagram for L1TComparisonResultFilter< T >:
edm::stream::EDFilter<> edm::stream::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 L1TComparisonResultFilter (const edm::ParameterSet &)
 
 ~L1TComparisonResultFilter () override=default
 
- Public Member Functions inherited from edm::stream::EDFilter<>
 EDFilter ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
- Public Member Functions inherited from edm::stream::EDFilterBase
 EDFilterBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilterBase () 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)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDFilterBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void beginStream (edm::StreamID) override
 
void endStream () override
 
bool filter (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::EDGetTokenT< l1t::ObjectRefBxCollection< T > > coll1Token_
 
edm::EDGetTokenT< l1t::ObjectRefBxCollection< T > > coll2Token_
 
edm::InputTag inputTag_
 
const bool invert_
 
const int maxBxRangeDiff_
 
const int maxExcess_
 
const int maxSize_
 
edm::EDGetTokenT< l1t::ObjectRefPairBxCollection< T > > pairCollToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDFilter<>
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::EDFilterBase
typedef EDFilterAdaptorBase 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
 
- 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

template<typename T>
class L1TComparisonResultFilter< T >

Description: Filters on result of L1T object comparison. Events where the collections match are passing.

Implementation: [Notes on implementation]

Definition at line 41 of file L1TComparisonResultFilter.cc.

Constructor & Destructor Documentation

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

Definition at line 74 of file L1TComparisonResultFilter.cc.

References L1TComparisonResultFilter< T >::coll1Token_, L1TComparisonResultFilter< T >::coll2Token_, L1TComparisonResultFilter< T >::inputTag_, edm::InputTag::label(), L1TComparisonResultFilter< T >::maxBxRangeDiff_, L1TComparisonResultFilter< T >::maxExcess_, L1TComparisonResultFilter< T >::maxSize_, and L1TComparisonResultFilter< T >::pairCollToken_.

75  : inputTag_(iConfig.getParameter<edm::InputTag>("objComparisonColl")),
76  maxBxRangeDiff_(iConfig.getParameter<int>("maxBxRangeDiff")),
77  maxExcess_(iConfig.getParameter<int>("maxExcess")),
78  maxSize_(iConfig.getParameter<int>("maxSize")),
79  invert_(iConfig.getParameter<bool>("invert"))
80 {
81  if (maxBxRangeDiff_ > -1 || maxExcess_ > -1) {
82  // Take all input tags needed from the same module
83  edm::InputTag coll1Tag(inputTag_.label(), "collection1ExcessObjects");
84  edm::InputTag coll2Tag(inputTag_.label(), "collection2ExcessObjects");
85  coll1Token_ = consumes<l1t::ObjectRefBxCollection<T>>(coll1Tag);
86  coll2Token_ = consumes<l1t::ObjectRefBxCollection<T>>(coll2Tag);
87  }
88  if (maxSize_ > -1) {
89  pairCollToken_ = consumes<l1t::ObjectRefPairBxCollection<T>>(inputTag_);
90  }
91 }
T getParameter(std::string const &) const
edm::EDGetTokenT< l1t::ObjectRefBxCollection< T > > coll2Token_
edm::EDGetTokenT< l1t::ObjectRefPairBxCollection< T > > pairCollToken_
edm::EDGetTokenT< l1t::ObjectRefBxCollection< T > > coll1Token_
std::string const & label() const
Definition: InputTag.h:36
template<typename T >
L1TComparisonResultFilter< T >::~L1TComparisonResultFilter ( )
overridedefault

Member Function Documentation

template<typename T >
void L1TComparisonResultFilter< T >::beginStream ( edm::StreamID  )
inlineoverrideprivatevirtual

Reimplemented from edm::stream::EDFilterBase.

Definition at line 49 of file L1TComparisonResultFilter.cc.

References L1TComparisonResultFilter< T >::filter().

49 { };
template<typename T >
void L1TComparisonResultFilter< T >::endStream ( )
inlineoverrideprivatevirtual

Reimplemented from edm::stream::EDFilterBase.

Definition at line 51 of file L1TComparisonResultFilter.cc.

51 { };
template<typename T >
void L1TComparisonResultFilter< T >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 147 of file L1TComparisonResultFilter.cc.

References edm::ParameterSetDescription::add(), and edm::ConfigurationDescriptions::addWithDefaultLabel().

147  {
149  desc.add<edm::InputTag>("objComparisonColl", edm::InputTag("objComparisonColl"))->setComment("Object comparison collection");
150  desc.add<int>("maxBxRangeDiff", -1)->setComment("Maximal BX range difference");
151  desc.add<int>("maxExcess", -1)->setComment("Maximal allowed excess objects per BX");
152  desc.add<int>("maxSize", -1)->setComment("Maximal allowed mismatches");
153  desc.add<bool>("invert", false)->setComment("Invert final result");
154  descriptions.addWithDefaultLabel(desc);
155 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
template<typename T >
bool L1TComparisonResultFilter< T >::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 101 of file L1TComparisonResultFilter.cc.

References funct::abs(), L1TComparisonResultFilter< T >::coll1Token_, L1TComparisonResultFilter< T >::coll2Token_, edm::Event::getByToken(), L1TComparisonResultFilter< T >::invert_, SiStripPI::max, L1TComparisonResultFilter< T >::maxBxRangeDiff_, L1TComparisonResultFilter< T >::maxExcess_, L1TComparisonResultFilter< T >::maxSize_, min(), and L1TComparisonResultFilter< T >::pairCollToken_.

Referenced by L1TComparisonResultFilter< T >::beginStream().

102 {
103  bool pass = true;
104 
105  if (maxBxRangeDiff_ > -1 || maxExcess_ > -1) {
108  iEvent.getByToken(coll1Token_, bxColl1);
109  iEvent.getByToken(coll2Token_, bxColl2);
110 
111  // Check if BX ranges match
112  if (maxBxRangeDiff_ > -1) {
113  const auto bxRange1 = bxColl1->getLastBX() - bxColl1->getFirstBX() + 1;
114  const auto bxRange2 = bxColl2->getLastBX() - bxColl2->getFirstBX() + 1;
115  pass &= (std::abs(bxRange1 - bxRange2) <= maxBxRangeDiff_);
116  }
117 
118  // If the BX range check passed check if number of objects per BX matches
119  if (pass && maxExcess_ > -1) {
120  const auto firstCommonBx = std::max(bxColl1->getFirstBX(), bxColl2->getFirstBX());
121  const auto lastCommonBx = std::min(bxColl1->getLastBX(), bxColl2->getLastBX());
122  for (auto iBx = firstCommonBx; iBx <= lastCommonBx; ++iBx) {
123  pass &= (bxColl1->size(iBx) <= static_cast<unsigned>(maxExcess_));
124  pass &= (bxColl2->size(iBx) <= static_cast<unsigned>(maxExcess_));
125  if (!pass) break;
126  }
127  }
128  }
129 
130  // If the previous checks passed check if there are mismatching objects
131  if (pass && maxSize_ > -1) {
133  iEvent.getByToken(pairCollToken_, bxPairColl);
134 
135  pass &= (bxPairColl->size() <= static_cast<unsigned>(maxSize_));
136  }
137 
138  if (invert_) {
139  return !pass;
140  }
141  return pass;
142 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
edm::EDGetTokenT< l1t::ObjectRefBxCollection< T > > coll2Token_
edm::EDGetTokenT< l1t::ObjectRefPairBxCollection< T > > pairCollToken_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::EDGetTokenT< l1t::ObjectRefBxCollection< T > > coll1Token_
T min(T a, T b)
Definition: MathUtil.h:58

Member Data Documentation

template<typename T >
edm::EDGetTokenT<l1t::ObjectRefBxCollection<T> > L1TComparisonResultFilter< T >::coll1Token_
private
template<typename T >
edm::EDGetTokenT<l1t::ObjectRefBxCollection<T> > L1TComparisonResultFilter< T >::coll2Token_
private
template<typename T >
edm::InputTag L1TComparisonResultFilter< T >::inputTag_
private
template<typename T >
const bool L1TComparisonResultFilter< T >::invert_
private

Definition at line 67 of file L1TComparisonResultFilter.cc.

Referenced by L1TComparisonResultFilter< T >::filter().

template<typename T >
const int L1TComparisonResultFilter< T >::maxBxRangeDiff_
private
template<typename T >
const int L1TComparisonResultFilter< T >::maxExcess_
private
template<typename T >
const int L1TComparisonResultFilter< T >::maxSize_
private
template<typename T >
edm::EDGetTokenT<l1t::ObjectRefPairBxCollection<T> > L1TComparisonResultFilter< T >::pairCollToken_
private