CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CATopJetTagger.cc
Go to the documentation of this file.
1 #include "CATopJetTagger.h"
4 
5 using namespace std;
6 using namespace reco;
7 using namespace edm;
8 //
9 // constants, enums and typedefs
10 //
11 
12 //
13 // static data member definitions
14 //
15 
16 
17 //
18 // constructors and destructor
19 //
21  src_(iConfig.getParameter<InputTag>("src") ),
22  TopMass_(iConfig.getParameter<double>("TopMass") ),
23  WMass_(iConfig.getParameter<double>("WMass") ),
24  verbose_(iConfig.getParameter<bool>("verbose") ),
25  input_jet_token_(consumes<edm::View<reco::Jet> >(src_))
26 {
27  produces<CATopJetTagInfoCollection>();
28 }
29 
30 
32 {
33 }
34 
35 
36 //
37 // member functions
38 //
39 
40 // ------------ method called to for each event ------------
41 void
43 {
44 
45  // Set up output list
46  auto_ptr<CATopJetTagInfoCollection> tagInfos(new CATopJetTagInfoCollection() );
47 
48  // Get the input list of basic jets corresponding to the hard jets
49  Handle<View<Jet> > pBasicJets;
50  iEvent.getByToken(input_jet_token_, pBasicJets);
51 
52  // Get a convenient handle
53  View<Jet> const & hardJets = *pBasicJets;
54 
55  CATopJetHelper helper( TopMass_, WMass_ );
56 
57  // Now loop over the hard jets and do kinematic cuts
58  View<Jet>::const_iterator ihardJet = hardJets.begin(),
59  ihardJetEnd = hardJets.end();
60  size_t iihardJet = 0;
61  for ( ; ihardJet != ihardJetEnd; ++ihardJet, ++iihardJet ) {
62 
63  if ( verbose_ ) edm::LogInfo("CATopJetTagger") << "Processing ihardJet with pt = " << ihardJet->pt() << endl;
64 
65  // Initialize output variables
66  // Get a ref to the hard jet
67  RefToBase<Jet> ref( pBasicJets, iihardJet );
68  // Get properties
69  CATopJetProperties properties = helper( *ihardJet );
70 
72  tagInfo.insert( ref, properties );
73  tagInfos->push_back( tagInfo );
74  }// end loop over hard jets
75 
76  iEvent.put( tagInfos );
77 
78  return;
79 }
80 
81 //define this as a plug-in
const double TopMass_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
Base class for all types of Jets.
Definition: Jet.h:20
void insert(const edm::RefToBase< Jet > &jet, const CATopJetProperties &properties)
const edm::EDGetTokenT< edm::View< reco::Jet > > input_jet_token_
const bool verbose_
int iEvent
Definition: GenABIO.cc:230
const_iterator begin() const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
std::vector< CATopJetTagInfo > CATopJetTagInfoCollection
CATopJetTagger(const edm::ParameterSet &)
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:85
const double WMass_
const_iterator end() const
virtual void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override