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
CollectionFromZLegProducer Class Reference
Inheritance diagram for CollectionFromZLegProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 CollectionFromZLegProducer (const edm::ParameterSet &iConfig)
 
void endJob () override
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
virtual ~CollectionFromZLegProducer ()
 
- 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

std::string OutputCollection_
 
edm::EDGetTokenT< std::vector
< reco::CompositeCandidate > > 
v_RecoCompositeCandidateToken_
 

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 21 of file CollectionFromZLegProducer.cc.

Constructor & Destructor Documentation

CollectionFromZLegProducer::CollectionFromZLegProducer ( const edm::ParameterSet iConfig)

Definition at line 45 of file CollectionFromZLegProducer.cc.

46  : v_RecoCompositeCandidateToken_( consumes< std::vector<reco::CompositeCandidate> >( iConfig.getParameter<edm::InputTag>( "ZCandidateCollection" ) ) )
47 {
48  produces<std::vector<reco::CompositeCandidate> >("theTagLeg" );
49  produces<std::vector<reco::CompositeCandidate> >("theProbeLeg");
50 }
T getParameter(std::string const &) const
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< std::vector< reco::CompositeCandidate > > v_RecoCompositeCandidateToken_
CollectionFromZLegProducer::~CollectionFromZLegProducer ( )
virtual

Definition at line 54 of file CollectionFromZLegProducer.cc.

55 {
56 }

Member Function Documentation

void CollectionFromZLegProducer::endJob ( void  )
overridevirtual

Reimplemented from edm::EDProducer.

Definition at line 98 of file CollectionFromZLegProducer.cc.

99 {
100 }
void CollectionFromZLegProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 63 of file CollectionFromZLegProducer.cc.

References trackerHits::c, edm::Event::getByToken(), edm::Event::put(), and v_RecoCompositeCandidateToken_.

64 {
65  std::auto_ptr<std::vector<reco::CompositeCandidate> > theTagLeg(new std::vector<reco::CompositeCandidate>) ;
66  std::auto_ptr<std::vector<reco::CompositeCandidate> > theProbeLeg(new std::vector<reco::CompositeCandidate>) ;
67 
69  iEvent.getByToken( v_RecoCompositeCandidateToken_,theZHandle );
70 
71  // this is specific for our 'tag and probe'
72 
73  for (std::vector<reco::CompositeCandidate>::const_iterator Zit = theZHandle->begin() ;
74  Zit != theZHandle->end() ;
75  ++Zit )
76  {
77  int c = 0;
78 
79  for(reco::CompositeCandidate::const_iterator Daug =(*Zit).begin();
80  Daug!=(*Zit).end() ;
81  ++Daug )
82  {
83  if (c == 0){
84  reco::CompositeCandidate candT(*Daug) ;
85  theTagLeg->push_back(candT) ;
86  }
87  if (c == 1){
88  reco::CompositeCandidate candP(*Daug) ;
89  theProbeLeg->push_back(candP) ;
90  }
91  c++ ;
92  }
93  }
94  iEvent.put(theTagLeg , "theTagLeg" ) ;
95  iEvent.put(theProbeLeg, "theProbeLeg" ) ;
96 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
edm::EDGetTokenT< std::vector< reco::CompositeCandidate > > v_RecoCompositeCandidateToken_

Member Data Documentation

std::string CollectionFromZLegProducer::OutputCollection_
private

Definition at line 34 of file CollectionFromZLegProducer.cc.

edm::EDGetTokenT< std::vector<reco::CompositeCandidate> > CollectionFromZLegProducer::v_RecoCompositeCandidateToken_
private

Definition at line 33 of file CollectionFromZLegProducer.cc.

Referenced by produce().