CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
TopProjector< Top, Bottom, Matcher > Class Template Reference

#include <TopProjector.h>

Inheritance diagram for TopProjector< Top, Bottom, Matcher >:
edm::stream::EDProducer<>

Public Types

typedef std::vector< Bottom > BottomCollection
 
typedef edm::FwdPtr< Bottom > BottomFwdPtr
 
typedef std::vector< BottomFwdPtrBottomFwdPtrCollection
 
typedef std::vector< Top > TopCollection
 
typedef edm::FwdPtr< Top > TopFwdPtr
 
typedef std::vector< TopFwdPtrTopFwdPtrCollection
 
- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 
 TopProjector (const edm::ParameterSet &)
 
 ~TopProjector () override=default
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=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 EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

const bool enable_
 enable? if not, all candidates in the bottom collection are copied to the output collection More...
 
Matcher match_
 Matching method. More...
 
const std::string name_
 name of the top projection More...
 
const edm::EDGetTokenT< BottomFwdPtrCollectiontokenBottom_
 input tag for the masked collection. More...
 
const edm::EDGetTokenT< TopFwdPtrCollectiontokenTop_
 input tag for the top (masking) collection More...
 

Detailed Description

template<class Top, class Bottom, class Matcher = TopProjectorFwdPtrOverlap<Top, Bottom>>
class TopProjector< Top, Bottom, Matcher >

Author
Colin Bernet
Date
february 2008

Definition at line 144 of file TopProjector.h.

Member Typedef Documentation

◆ BottomCollection

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top, Bottom>>
typedef std::vector<Bottom> TopProjector< Top, Bottom, Matcher >::BottomCollection

Definition at line 150 of file TopProjector.h.

◆ BottomFwdPtr

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top, Bottom>>
typedef edm::FwdPtr<Bottom> TopProjector< Top, Bottom, Matcher >::BottomFwdPtr

Definition at line 151 of file TopProjector.h.

◆ BottomFwdPtrCollection

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top, Bottom>>
typedef std::vector<BottomFwdPtr> TopProjector< Top, Bottom, Matcher >::BottomFwdPtrCollection

Definition at line 152 of file TopProjector.h.

◆ TopCollection

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top, Bottom>>
typedef std::vector<Top> TopProjector< Top, Bottom, Matcher >::TopCollection

Definition at line 146 of file TopProjector.h.

◆ TopFwdPtr

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top, Bottom>>
typedef edm::FwdPtr<Top> TopProjector< Top, Bottom, Matcher >::TopFwdPtr

Definition at line 147 of file TopProjector.h.

◆ TopFwdPtrCollection

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top, Bottom>>
typedef std::vector<TopFwdPtr> TopProjector< Top, Bottom, Matcher >::TopFwdPtrCollection

Definition at line 148 of file TopProjector.h.

Constructor & Destructor Documentation

◆ TopProjector()

template<class Top , class Bottom , class Matcher >
TopProjector< Top, Bottom, Matcher >::TopProjector ( const edm::ParameterSet iConfig)

Definition at line 180 of file TopProjector.h.

181  : match_(iConfig),
182  enable_(iConfig.getParameter<bool>("enable")),
183  name_(iConfig.getUntrackedParameter<std::string>("name", "No Name")),
184  tokenTop_(consumes<TopFwdPtrCollection>(iConfig.getParameter<edm::InputTag>("topCollection"))),
185  tokenBottom_(consumes<BottomFwdPtrCollection>(iConfig.getParameter<edm::InputTag>("bottomCollection"))) {
186  // will produce a collection of the unmasked candidates in the
187  // bottom collection
188  produces<BottomFwdPtrCollection>();
189 }

◆ ~TopProjector()

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top, Bottom>>
TopProjector< Top, Bottom, Matcher >::~TopProjector ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

template<class Top , class Bottom , class Matcher >
void TopProjector< Top, Bottom, Matcher >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 192 of file TopProjector.h.

192  {
194  psD.add<bool>("enable");
196  psD.add<double>("deltaR");
197  psD.addUntracked<std::string>("name", "No Name");
198  psD.add<edm::InputTag>("topCollection");
199  psD.add<edm::InputTag>("bottomCollection");
201  psD.add<bool>("matchByPtrDirect", false)->setComment("fast check by ptr() only");
202  desc.addWithDefaultLabel(psD);
203 }

References edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addUntracked(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ produce()

template<class Top , class Bottom , class Matcher >
void TopProjector< Top, Bottom, Matcher >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 206 of file TopProjector.h.

206  {
207  // get the various collections
208 
209  // Access the masking collection
210  auto const& tops = iEvent.get(tokenTop_);
211  std::list<TopFwdPtr> topsList;
212 
213  for (auto const& top : tops) {
214  topsList.push_back(top);
215  }
216 
217  // Access the collection to
218  // be masked by the other ones
219  auto const& bottoms = iEvent.get(tokenBottom_);
220 
221  // output collection of FwdPtrs to objects,
222  // selected from the Bottom collection
223  std::unique_ptr<BottomFwdPtrCollection> pBottomFwdPtrOutput(new BottomFwdPtrCollection);
224 
225  LogDebug("TopProjection") << " Remaining candidates in the bottom collection ------ ";
226 
227  int iB = -1;
228  for (auto const& bottom : bottoms) {
229  iB++;
230  match_.setBottom(bottom);
231  auto found = topsList.end();
232  if (enable_) {
233  found = std::find_if(topsList.begin(), topsList.end(), match_);
234  }
235 
236  // If this is masked in the top projection, we remove it.
237  if (found != topsList.end()) {
238  LogDebug("TopProjection") << "X " << iB << *bottom;
239  topsList.erase(found);
240  continue;
241  }
242  // otherwise, we keep it.
243  else {
244  LogDebug("TopProjection") << "O " << iB << *bottom;
245  pBottomFwdPtrOutput->push_back(bottom);
246  }
247  }
248 
249  iEvent.put(std::move(pBottomFwdPtrOutput));
250 }

References newFWLiteAna::found, iEvent, LogDebug, and eostools::move().

Member Data Documentation

◆ enable_

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top, Bottom>>
const bool TopProjector< Top, Bottom, Matcher >::enable_
private

enable? if not, all candidates in the bottom collection are copied to the output collection

Definition at line 167 of file TopProjector.h.

◆ match_

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top, Bottom>>
Matcher TopProjector< Top, Bottom, Matcher >::match_
private

Matching method.

Definition at line 164 of file TopProjector.h.

◆ name_

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top, Bottom>>
const std::string TopProjector< Top, Bottom, Matcher >::name_
private

name of the top projection

Definition at line 170 of file TopProjector.h.

◆ tokenBottom_

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top, Bottom>>
const edm::EDGetTokenT<BottomFwdPtrCollection> TopProjector< Top, Bottom, Matcher >::tokenBottom_
private

input tag for the masked collection.

Definition at line 176 of file TopProjector.h.

◆ tokenTop_

template<class Top , class Bottom , class Matcher = TopProjectorFwdPtrOverlap<Top, Bottom>>
const edm::EDGetTokenT<TopFwdPtrCollection> TopProjector< Top, Bottom, Matcher >::tokenTop_
private

input tag for the top (masking) collection

Definition at line 173 of file TopProjector.h.

edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
TopProjectorFwdPtrOverlap
This checks a slew of possible overlaps for FwdPtr<Candidate> and derivatives.
Definition: TopProjector.h:41
TopProjector::name_
const std::string name_
name of the top projection
Definition: TopProjector.h:170
TopProjector::BottomFwdPtrCollection
std::vector< BottomFwdPtr > BottomFwdPtrCollection
Definition: TopProjector.h:152
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
TopProjector::enable_
const bool enable_
enable? if not, all candidates in the bottom collection are copied to the output collection
Definition: TopProjector.h:167
edm::ParameterSetDescription::addUntracked
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:100
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
iEvent
int iEvent
Definition: GenABIO.cc:224
value
Definition: value.py:1
TopProjector::match_
Matcher match_
Matching method.
Definition: TopProjector.h:164
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TopProjector::tokenBottom_
const edm::EDGetTokenT< BottomFwdPtrCollection > tokenBottom_
input tag for the masked collection.
Definition: TopProjector.h:176
TopProjector::tokenTop_
const edm::EDGetTokenT< TopFwdPtrCollection > tokenTop_
input tag for the top (masking) collection
Definition: TopProjector.h:173
TopProjectorDeltaROverlap
This checks matching based on delta R.
Definition: TopProjector.h:106
edm::InputTag
Definition: InputTag.h:15
Matcher
Definition: Matcher.py:1