CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CollectionFromZLegProducer.cc
Go to the documentation of this file.
1 // Includes
9 
11 
12 #include <memory>
13 #include <vector>
14 #include <sstream>
15 
16 //#include "Validation/RecoTau/interface/prettyPrint.h" debugging putpose
17 
19 // class definition
22 {
23 public:
24  // construction/destruction
27 
28  void produce(edm::Event& iEvent,const edm::EventSetup& iSetup) override;
29  void endJob() override;
30 
31 private:
32  // member data
35 
36 };
37 
38 
39 
41 // construction/destruction
43 
44 //______________________________________________________________________________
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 }
51 
52 
53 //______________________________________________________________________________
55 {
56 }
57 
59 // implementation of member functions
61 
62 //______________________________________________________________________________
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 }
97 
99 {
100 }
101 
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
CollectionFromZLegProducer(const edm::ParameterSet &iConfig)
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
edm::EDGetTokenT< std::vector< reco::CompositeCandidate > > v_RecoCompositeCandidateToken_