CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
L1GTDoubleObjectCond Class Reference
Inheritance diagram for L1GTDoubleObjectCond:
edm::global::EDFilter<> edm::global::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 L1GTDoubleObjectCond (const edm::ParameterSet &)
 
 ~L1GTDoubleObjectCond () override=default
 
- Public Member Functions inherited from edm::global::EDFilter<>
 EDFilter ()=default
 
 EDFilter (const EDFilter &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDFilteroperator= (const EDFilter &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
bool wantsStreamLuminosityBlocks () const noexcept final
 
bool wantsStreamRuns () const noexcept final
 
- Public Member Functions inherited from edm::global::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
 
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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

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

Private Member Functions

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

Private Attributes

const L1GTSingleCollectionCut collection1Cuts_
 
const L1GTSingleCollectionCut collection2Cuts_
 
const L1GTCorrelationalCut deltaCuts_
 
const bool enable_sanity_checks_
 
const bool inv_mass_checks_
 
const edm::EDGetTokenT< P2GTCandidateCollectionprimVertToken_
 
const L1GTScales scales_
 
const edm::EDGetTokenT< P2GTCandidateCollectiontoken1_
 
const edm::EDGetTokenT< P2GTCandidateCollectiontoken2_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDFilterBase
typedef EDFilterBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
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)
 
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 ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 31 of file L1GTDoubleObjectCond.cc.

Constructor & Destructor Documentation

◆ L1GTDoubleObjectCond()

L1GTDoubleObjectCond::L1GTDoubleObjectCond ( const edm::ParameterSet config)
explicit

Definition at line 56 of file L1GTDoubleObjectCond.cc.

References collection1Cuts_, collection2Cuts_, edm::InputTag::instance(), inv_mass_checks_, and l1t::L1GTSingleCollectionCut::tag().

57  : scales_(config.getParameter<edm::ParameterSet>("scales")),
58  collection1Cuts_(config.getParameterSet("collection1"), config, scales_),
59  collection2Cuts_(config.getParameterSet("collection2"), config, scales_),
60  enable_sanity_checks_(config.getUntrackedParameter<bool>("sanity_checks")),
61  inv_mass_checks_(config.getUntrackedParameter<bool>("inv_mass_checks")),
63  token1_(consumes<P2GTCandidateCollection>(collection1Cuts_.tag())),
65  ? token1_
66  : consumes<P2GTCandidateCollection>(collection2Cuts_.tag())),
67  primVertToken_(consumes<P2GTCandidateCollection>(config.getParameter<edm::InputTag>("primVertTag"))) {
68  produces<P2GTCandidateVectorRef>(collection1Cuts_.tag().instance());
69 
70  if (!(collection1Cuts_.tag() == collection2Cuts_.tag())) {
71  produces<P2GTCandidateVectorRef>(collection2Cuts_.tag().instance());
72  }
73 
74  if (inv_mass_checks_) {
75  produces<InvariantMassErrorCollection>();
76  }
77 }
const edm::EDGetTokenT< P2GTCandidateCollection > token1_
const edm::EDGetTokenT< P2GTCandidateCollection > primVertToken_
const L1GTCorrelationalCut deltaCuts_
std::string const & instance() const
Definition: InputTag.h:37
const edm::InputTag & tag() const
Definition: config.py:1
const edm::EDGetTokenT< P2GTCandidateCollection > token2_
const L1GTSingleCollectionCut collection2Cuts_
dictionary config
Read in AllInOne config in JSON format.
Definition: DiMuonV_cfg.py:30
const L1GTSingleCollectionCut collection1Cuts_

◆ ~L1GTDoubleObjectCond()

L1GTDoubleObjectCond::~L1GTDoubleObjectCond ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

void L1GTDoubleObjectCond::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 79 of file L1GTDoubleObjectCond.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, and reco::modules::fillPSetDescription().

79  {
81 
82  edm::ParameterSetDescription collection1Desc;
84  desc.add<edm::ParameterSetDescription>("collection1", collection1Desc);
85 
86  edm::ParameterSetDescription collection2Desc;
88  desc.add<edm::ParameterSetDescription>("collection2", collection2Desc);
89 
90  desc.add<edm::InputTag>("primVertTag");
91 
92  desc.addUntracked<bool>("sanity_checks", false);
93  desc.addUntracked<bool>("inv_mass_checks", false);
94 
96  L1GTCorrelationalCut::fillLUTDescriptions(desc);
97 
100  desc.add<edm::ParameterSetDescription>("scales", scalesDesc);
101 
102  descriptions.addWithDefaultLabel(desc);
103 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
void fillPSetDescription(edm::ParameterSetDescription &desc)

◆ filter()

bool L1GTDoubleObjectCond::filter ( edm::StreamID  ,
edm::Event event,
const edm::EventSetup setup 
) const
overrideprivatevirtual

Implements edm::global::EDFilterBase.

Definition at line 105 of file L1GTDoubleObjectCond.cc.

References l1t::L1GTSingleCollectionCut::checkObject(), l1t::L1GTCorrelationalCut::checkObjects(), l1t::L1GTSingleCollectionCut::checkPrimaryVertices(), collection1Cuts_, collection2Cuts_, deltaCuts_, heavyIonCSV_trainingSettings::idx, edm::InputTag::instance(), inv_mass_checks_, eostools::move(), primVertToken_, edm::Handle< T >::product(), l1t::L1GTSingleCollectionCut::tag(), token1_, and token2_.

105  {
106  edm::Handle<P2GTCandidateCollection> col1 = event.getHandle(token1_);
107  edm::Handle<P2GTCandidateCollection> col2 = event.getHandle(token2_);
108  edm::Handle<P2GTCandidateCollection> primVertCol = event.getHandle(primVertToken_);
109 
110  bool condition_result = false;
111 
112  std::set<std::size_t> triggeredIdcs1;
113  std::set<std::size_t> triggeredIdcs2;
114 
115  InvariantMassErrorCollection massErrors;
116 
117  for (std::size_t idx1 = 0; idx1 < col1->size(); ++idx1) {
118  bool single1Pass = collection1Cuts_.checkObject(col1->at(idx1));
119  single1Pass &= collection1Cuts_.checkPrimaryVertices(col1->at(idx1), *primVertCol);
120 
121  for (std::size_t idx2 = 0; idx2 < col2->size(); ++idx2) {
122  // If we're looking at the same collection then we shouldn't use the same object in one comparison.
123  if (col1.product() == col2.product() && idx1 == idx2) {
124  continue;
125  }
126 
127  bool pass = single1Pass;
128  pass &= collection2Cuts_.checkObject(col2->at(idx2));
129  pass &= collection2Cuts_.checkPrimaryVertices(col2->at(idx2), *primVertCol);
130  pass &= deltaCuts_.checkObjects(col1->at(idx1), col2->at(idx2), massErrors);
131 
132  condition_result |= pass;
133 
134  if (pass) {
135  triggeredIdcs1.emplace(idx1);
136  if (col1.product() != col2.product()) {
137  triggeredIdcs2.emplace(idx2);
138  } else {
139  triggeredIdcs1.emplace(idx2);
140  }
141  }
142  }
143  }
144 
145  if (condition_result) {
146  std::unique_ptr<P2GTCandidateVectorRef> triggerCol1 = std::make_unique<P2GTCandidateVectorRef>();
147 
148  for (std::size_t idx : triggeredIdcs1) {
149  triggerCol1->push_back(P2GTCandidateRef(col1, idx));
150  }
151  event.put(std::move(triggerCol1), collection1Cuts_.tag().instance());
152 
153  if (col1.product() != col2.product()) {
154  std::unique_ptr<P2GTCandidateVectorRef> triggerCol2 = std::make_unique<P2GTCandidateVectorRef>();
155 
156  for (std::size_t idx : triggeredIdcs2) {
157  triggerCol2->push_back(P2GTCandidateRef(col2, idx));
158  }
159  event.put(std::move(triggerCol2), collection2Cuts_.tag().instance());
160  }
161  }
162 
163  if (inv_mass_checks_) {
164  event.put(std::make_unique<InvariantMassErrorCollection>(std::move(massErrors)), "");
165  }
166 
167  return condition_result;
168 }
const edm::EDGetTokenT< P2GTCandidateCollection > token1_
const edm::EDGetTokenT< P2GTCandidateCollection > primVertToken_
const L1GTCorrelationalCut deltaCuts_
bool checkObject(const P2GTCandidate &obj) const
std::string const & instance() const
Definition: InputTag.h:37
T const * product() const
Definition: Handle.h:70
const edm::InputTag & tag() const
edm::Ref< P2GTCandidateCollection > P2GTCandidateRef
Definition: P2GTCandidate.h:18
bool checkPrimaryVertices(const P2GTCandidate &obj, const P2GTCandidateCollection &primVertCol) const
std::vector< InvariantMassError > InvariantMassErrorCollection
bool checkObjects(const P2GTCandidate &obj1, const P2GTCandidate &obj2, InvariantMassErrorCollection &massErrors) const
const edm::EDGetTokenT< P2GTCandidateCollection > token2_
const L1GTSingleCollectionCut collection2Cuts_
const L1GTSingleCollectionCut collection1Cuts_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ collection1Cuts_

const L1GTSingleCollectionCut L1GTDoubleObjectCond::collection1Cuts_
private

Definition at line 43 of file L1GTDoubleObjectCond.cc.

Referenced by filter(), and L1GTDoubleObjectCond().

◆ collection2Cuts_

const L1GTSingleCollectionCut L1GTDoubleObjectCond::collection2Cuts_
private

Definition at line 44 of file L1GTDoubleObjectCond.cc.

Referenced by filter(), and L1GTDoubleObjectCond().

◆ deltaCuts_

const L1GTCorrelationalCut L1GTDoubleObjectCond::deltaCuts_
private

Definition at line 49 of file L1GTDoubleObjectCond.cc.

Referenced by filter().

◆ enable_sanity_checks_

const bool L1GTDoubleObjectCond::enable_sanity_checks_
private

Definition at line 46 of file L1GTDoubleObjectCond.cc.

◆ inv_mass_checks_

const bool L1GTDoubleObjectCond::inv_mass_checks_
private

Definition at line 47 of file L1GTDoubleObjectCond.cc.

Referenced by filter(), and L1GTDoubleObjectCond().

◆ primVertToken_

const edm::EDGetTokenT<P2GTCandidateCollection> L1GTDoubleObjectCond::primVertToken_
private

Definition at line 53 of file L1GTDoubleObjectCond.cc.

Referenced by filter().

◆ scales_

const L1GTScales L1GTDoubleObjectCond::scales_
private

Definition at line 41 of file L1GTDoubleObjectCond.cc.

◆ token1_

const edm::EDGetTokenT<P2GTCandidateCollection> L1GTDoubleObjectCond::token1_
private

Definition at line 51 of file L1GTDoubleObjectCond.cc.

Referenced by filter().

◆ token2_

const edm::EDGetTokenT<P2GTCandidateCollection> L1GTDoubleObjectCond::token2_
private

Definition at line 52 of file L1GTDoubleObjectCond.cc.

Referenced by filter().