CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
CandPtrProjector Class Reference
Inheritance diagram for CandPtrProjector:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 CandPtrProjector (const edm::ParameterSet &iConfig)
 
virtual void endJob () override
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~CandPtrProjector ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

edm::EDGetTokenT< edm::View
< reco::Candidate > > 
candSrcToken_
 
edm::EDGetTokenT< edm::View
< reco::Candidate > > 
vetoSrcToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 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

Definition at line 17 of file CandPtrProjector.cc.

Constructor & Destructor Documentation

CandPtrProjector::CandPtrProjector ( const edm::ParameterSet iConfig)
explicit

Definition at line 30 of file CandPtrProjector.cc.

30  :
33 {
34  produces<edm::PtrVector<reco::Candidate> >();
35 }
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::View< reco::Candidate > > vetoSrcToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< edm::View< reco::Candidate > > candSrcToken_
CandPtrProjector::~CandPtrProjector ( )

Definition at line 37 of file CandPtrProjector.cc.

38 {
39 }

Member Function Documentation

void CandPtrProjector::endJob ( void  )
overridevirtual

Reimplemented from edm::EDProducer.

Definition at line 67 of file CandPtrProjector.cc.

68 {
69 }
void CandPtrProjector::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 42 of file CandPtrProjector.cc.

References trackerHits::c, candSrcToken_, edm::Event::getByToken(), i, j, n, edm::Event::put(), query::result, and vetoSrcToken_.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

43 {
44  using namespace edm;
46  iEvent.getByToken(candSrcToken_, cands);
48  iEvent.getByToken(vetoSrcToken_, vetos);
49 
50  std::auto_ptr<PtrVector<reco::Candidate> > result(new PtrVector<reco::Candidate>());
51  std::set<reco::CandidatePtr> vetoedPtrs;
52  for(size_t i = 0; i< vetos->size(); ++i) {
53  for(size_t j=0,n=(*vetos)[i].numberOfSourceCandidatePtrs(); j<n;j++ ) {
54  vetoedPtrs.insert((*vetos)[i].sourceCandidatePtr(j));
55  }
56  }
57  for(size_t i = 0; i< cands->size(); ++i) {
58  reco::CandidatePtr c = cands->ptrAt(i);
59  if(vetoedPtrs.find(c)==vetoedPtrs.end())
60  {
61  result->push_back(c);
62  }
63  }
64  iEvent.put(result);
65 }
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
edm::EDGetTokenT< edm::View< reco::Candidate > > vetoSrcToken_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
tuple result
Definition: query.py:137
int j
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< edm::View< reco::Candidate > > candSrcToken_

Member Data Documentation

edm::EDGetTokenT<edm::View<reco::Candidate> > CandPtrProjector::candSrcToken_
private

Definition at line 26 of file CandPtrProjector.cc.

Referenced by produce().

edm::EDGetTokenT<edm::View<reco::Candidate> > CandPtrProjector::vetoSrcToken_
private

Definition at line 27 of file CandPtrProjector.cc.

Referenced by produce().