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 
30 private:
31  // member data
34 
35 };
36 
37 
38 
40 // construction/destruction
42 
43 //______________________________________________________________________________
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 }
50 
51 
52 //______________________________________________________________________________
54 {
55 }
56 
58 // implementation of member functions
60 
61 //______________________________________________________________________________
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 }
96 
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
int iEvent
Definition: GenABIO.cc:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
CollectionFromZLegProducer(const edm::ParameterSet &iConfig)
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
edm::EDGetTokenT< std::vector< reco::CompositeCandidate > > v_RecoCompositeCandidateToken_