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
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 141 of file TopProjector.cc.

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 147 of file TopProjector.cc.

◆ BottomFwdPtr

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

Definition at line 148 of file TopProjector.cc.

◆ BottomFwdPtrCollection

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

Definition at line 149 of file TopProjector.cc.

◆ TopCollection

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

Definition at line 143 of file TopProjector.cc.

◆ TopFwdPtr

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

Definition at line 144 of file TopProjector.cc.

◆ TopFwdPtrCollection

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

Definition at line 145 of file TopProjector.cc.

Constructor & Destructor Documentation

◆ TopProjector()

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

Definition at line 177 of file TopProjector.cc.

178  : match_(iConfig),
179  enable_(iConfig.getParameter<bool>("enable")),
180  name_(iConfig.getUntrackedParameter<std::string>("name", "No Name")),
181  tokenTop_(consumes<TopFwdPtrCollection>(iConfig.getParameter<edm::InputTag>("topCollection"))),
182  tokenBottom_(consumes<BottomFwdPtrCollection>(iConfig.getParameter<edm::InputTag>("bottomCollection"))) {
183  // will produce a collection of the unmasked candidates in the
184  // bottom collection
185  produces<BottomFwdPtrCollection>();
186 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const bool enable_
enable? if not, all candidates in the bottom collection are copied to the output collection ...
T getUntrackedParameter(std::string const &, T const &) const
const std::string name_
name of the top projection
const edm::EDGetTokenT< TopFwdPtrCollection > tokenTop_
input tag for the top (masking) collection
const edm::EDGetTokenT< BottomFwdPtrCollection > tokenBottom_
input tag for the masked collection.
Matcher match_
Matching method.

◆ ~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 189 of file TopProjector.cc.

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

189  {
191  psD.add<bool>("enable");
193  psD.add<double>("deltaR");
194  psD.addUntracked<std::string>("name", "No Name");
195  psD.add<edm::InputTag>("topCollection");
196  psD.add<edm::InputTag>("bottomCollection");
198  psD.add<bool>("matchByPtrDirect", false)->setComment("fast check by ptr() only");
199  desc.addWithDefaultLabel(psD);
200 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
This checks a slew of possible overlaps for FwdPtr<Candidate> and derivatives.
Definition: TopProjector.cc:38
Definition: value.py:1
ParameterDescriptionBase * add(U const &iLabel, T const &value)
This checks matching based on delta R.

◆ 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 203 of file TopProjector.cc.

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

203  {
204  // get the various collections
205 
206  // Access the masking collection
207  auto const& tops = iEvent.get(tokenTop_);
208  std::list<TopFwdPtr> topsList;
209 
210  for (auto const& top : tops) {
211  topsList.push_back(top);
212  }
213 
214  // Access the collection to
215  // be masked by the other ones
216  auto const& bottoms = iEvent.get(tokenBottom_);
217 
218  // output collection of FwdPtrs to objects,
219  // selected from the Bottom collection
220  std::unique_ptr<BottomFwdPtrCollection> pBottomFwdPtrOutput(new BottomFwdPtrCollection);
221 
222  LogDebug("TopProjection") << " Remaining candidates in the bottom collection ------ ";
223 
224  int iB = -1;
225  for (auto const& bottom : bottoms) {
226  iB++;
227  match_.setBottom(bottom);
228  auto found = topsList.end();
229  if (enable_) {
230  found = std::find_if(topsList.begin(), topsList.end(), match_);
231  }
232 
233  // If this is masked in the top projection, we remove it.
234  if (found != topsList.end()) {
235  LogDebug("TopProjection") << "X " << iB << *bottom;
236  topsList.erase(found);
237  continue;
238  }
239  // otherwise, we keep it.
240  else {
241  LogDebug("TopProjection") << "O " << iB << *bottom;
242  pBottomFwdPtrOutput->push_back(bottom);
243  }
244  }
245 
246  iEvent.put(std::move(pBottomFwdPtrOutput));
247 }
const bool enable_
enable? if not, all candidates in the bottom collection are copied to the output collection ...
int iEvent
Definition: GenABIO.cc:224
const edm::EDGetTokenT< TopFwdPtrCollection > tokenTop_
input tag for the top (masking) collection
const edm::EDGetTokenT< BottomFwdPtrCollection > tokenBottom_
input tag for the masked collection.
Matcher match_
Matching method.
std::vector< BottomFwdPtr > BottomFwdPtrCollection
def move(src, dest)
Definition: eostools.py:511
#define LogDebug(id)

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 164 of file TopProjector.cc.

◆ match_

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

Matching method.

Definition at line 161 of file TopProjector.cc.

◆ 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 167 of file TopProjector.cc.

◆ 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 173 of file TopProjector.cc.

◆ 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 170 of file TopProjector.cc.