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 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) 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 44 of file CollectionFromZLegProducer.cc.

45  : v_RecoCompositeCandidateToken_( consumes< std::vector<reco::CompositeCandidate> >( iConfig.getParameter<edm::InputTag>( "ZCandidateCollection" ) ) )
46 {
47  produces<std::vector<reco::CompositeCandidate> >("theTagLeg" );
48  produces<std::vector<reco::CompositeCandidate> >("theProbeLeg");
49 }
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 53 of file CollectionFromZLegProducer.cc.

54 {
55 }

Member Function Documentation

void CollectionFromZLegProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 62 of file CollectionFromZLegProducer.cc.

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

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

Member Data Documentation

std::string CollectionFromZLegProducer::OutputCollection_
private

Definition at line 33 of file CollectionFromZLegProducer.cc.

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

Definition at line 32 of file CollectionFromZLegProducer.cc.

Referenced by produce().