CMS 3D CMS Logo

Public Member Functions | Private Attributes

CollectionFromZLegProducer Class Reference

Inheritance diagram for CollectionFromZLegProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 CollectionFromZLegProducer (const edm::ParameterSet &iConfig)
void endJob ()
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
virtual ~CollectionFromZLegProducer ()

Private Attributes

std::string OutputCollection_
edm::InputTag srcTheZ_

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.

  : srcTheZ_(iConfig.getParameter<edm::InputTag>("ZCandidateCollection"))
{
  produces<std::vector<reco::CompositeCandidate> >("theTagLeg"  );
  produces<std::vector<reco::CompositeCandidate> >("theProbeLeg");
}
CollectionFromZLegProducer::~CollectionFromZLegProducer ( ) [virtual]

Definition at line 54 of file CollectionFromZLegProducer.cc.

{
}

Member Function Documentation

void CollectionFromZLegProducer::endJob ( void  ) [virtual]

Reimplemented from edm::EDProducer.

Definition at line 98 of file CollectionFromZLegProducer.cc.

{
}
void CollectionFromZLegProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDProducer.

Definition at line 63 of file CollectionFromZLegProducer.cc.

References trackerHits::c, edm::Event::getByLabel(), edm::Event::put(), and srcTheZ_.

{  
  std::auto_ptr<std::vector<reco::CompositeCandidate> > theTagLeg(new std::vector<reco::CompositeCandidate>) ;       
  std::auto_ptr<std::vector<reco::CompositeCandidate> > theProbeLeg(new std::vector<reco::CompositeCandidate>) ;             
  
  edm::Handle< std::vector<reco::CompositeCandidate> > theZHandle;
  iEvent.getByLabel(srcTheZ_,theZHandle);
  
  // this is specific for our 'tag and probe'
  
  for (std::vector<reco::CompositeCandidate>::const_iterator Zit  = theZHandle->begin() ; 
                                                             Zit != theZHandle->end()   ; 
                                                             ++Zit                      )
  {
        int c = 0;
        
        for(reco::CompositeCandidate::const_iterator Daug =(*Zit).begin(); 
                                                 Daug!=(*Zit).end()  ; 
                                                 ++Daug              )
        {
          if (c == 0){
            reco::CompositeCandidate candT(*Daug) ;
            theTagLeg->push_back(candT) ;
          }
          if (c == 1){
            reco::CompositeCandidate candP(*Daug) ;
            theProbeLeg->push_back(candP) ;
          }
          c++ ;
        }
  } 
  iEvent.put(theTagLeg  , "theTagLeg"   ) ;
  iEvent.put(theProbeLeg, "theProbeLeg" ) ;
}

Member Data Documentation

Definition at line 34 of file CollectionFromZLegProducer.cc.

Definition at line 33 of file CollectionFromZLegProducer.cc.

Referenced by produce().