CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TauMET.cc
Go to the documentation of this file.
1 // Package: TauMET
2 // Class: TauMET
3 //
4 // Original Authors: Alfredo Gurrola, Chi Nhan Nguyen
5 
7 
13 
18 
20 
21 using namespace reco;
22 using namespace std;
23 namespace cms
24 {
25 
26  TauMET::TauMET(const edm::ParameterSet& iConfig) : _algo() {
27 
28  _InputTausLabel = iConfig.getParameter<std::string>("InputTausLabel");
29  _tauType = iConfig.getParameter<std::string>("tauType");
30  _InputCaloJetsLabel = iConfig.getParameter<std::string>("InputCaloJetsLabel");
31  _jetPTthreshold = iConfig.getParameter<double>("jetPTthreshold");
32  _jetEMfracLimit = iConfig.getParameter<double>("jetEMfracLimit");
33  _correctorLabel = iConfig.getParameter<std::string>("correctorLabel");
34  _InputMETLabel = iConfig.getParameter<std::string>("InputMETLabel");
35  _metType = iConfig.getParameter<std::string>("metType");
36  _JetMatchDeltaR = iConfig.getParameter<double>("JetMatchDeltaR");
37  _TauMinEt = iConfig.getParameter<double>("TauMinEt");
38  _TauEtaMax = iConfig.getParameter<double>("TauEtaMax");
39  _UseSeedTrack = iConfig.getParameter<bool>("UseSeedTrack");
40  _seedTrackPt = iConfig.getParameter<double>("seedTrackPt");
41  _UseTrackIsolation = iConfig.getParameter<bool>("UseTrackIsolation");
42  _trackIsolationMinPt = iConfig.getParameter<double>("trackIsolationMinPt");
43  _UseECALIsolation = iConfig.getParameter<bool>("UseECALIsolation");
44  _gammaIsolationMinPt = iConfig.getParameter<double>("gammaIsolationMinPt");
45  _UseProngStructure = iConfig.getParameter<bool>("UseProngStructure");
46 
47  if( _metType == "recoMET" ) {
48  produces< METCollection >();
49  } else {
50  produces< CaloMETCollection >();
51  }
52 
53  }
54 
55 
57  // do anything here that needs to be done at desctruction time
58  // (e.g. close files, deallocate resources etc.)
59  }
60 
61  // ------------ method called to produce the data ------------
63 
64  using namespace edm;
65 
66  Handle<CaloJetCollection> calojetHandle;
67  iEvent.getByLabel(_InputCaloJetsLabel, calojetHandle);
68  const JetCorrector* correctedjets = JetCorrector::getJetCorrector (_correctorLabel, iSetup);
69 
70  Handle<PFTauCollection> tauHandle;
71  iEvent.getByLabel(_InputTausLabel,tauHandle);
72 
73  if( _metType == "recoCaloMET" ) {
74  Handle<CaloMETCollection> metHandle;
75  iEvent.getByLabel(_InputMETLabel,metHandle);
76  std::auto_ptr< CaloMETCollection > output( new CaloMETCollection() );
77  _algo.run(iEvent,iSetup,tauHandle,calojetHandle,_jetPTthreshold,_jetEMfracLimit,*correctedjets,*(metHandle.product()),
81  iEvent.put( output );
82  } else if( _metType == "recoMET" ) {
83  Handle<METCollection> metHandle;
84  iEvent.getByLabel(_InputMETLabel,metHandle);
85  std::auto_ptr< METCollection > output( new METCollection() );
86  _algo.run(iEvent,iSetup,tauHandle,calojetHandle,_jetPTthreshold,_jetEMfracLimit,*correctedjets,*(metHandle.product()),
90  iEvent.put( output );
91  } else {
92  std::cerr << "Incorrect Met Type!!! " << std::endl;
93  std::cerr << "Please re-run and set the metType to 'recoCaloMET' or 'recoMET' " << std::endl;
94  return;
95  }
96 
97  }
98 
99  // ------------ method called once each job just before starting event loop ------------
100  void TauMET::beginJob() { }
101 
102  // ------------ method called once each job just after ending the event loop ------------
103  void TauMET::endJob() { }
104 
105  DEFINE_FWK_MODULE(TauMET); //define this as a plug-in
106 
107 } //end namespace cms
108 
109 
T getParameter(std::string const &) const
std::string _InputCaloJetsLabel
Definition: TauMET.h:37
virtual void beginJob()
Definition: TauMET.cc:100
double _trackIsolationMinPt
Definition: TauMET.h:49
DEFINE_FWK_MODULE(TauMET)
std::string _metType
Definition: TauMET.h:42
bool _UseECALIsolation
Definition: TauMET.h:50
virtual void endJob()
Definition: TauMET.cc:103
std::vector< reco::MET > METCollection
collection of MET objects
Definition: METCollection.h:23
double _jetEMfracLimit
Definition: TauMET.h:39
std::string _InputTausLabel
Definition: TauMET.h:35
double _TauEtaMax
Definition: TauMET.h:45
int iEvent
Definition: GenABIO.cc:243
std::string _correctorLabel
Definition: TauMET.h:40
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
std::string _tauType
Definition: TauMET.h:36
virtual void produce(edm::Event &, const edm::EventSetup &)
Definition: TauMET.cc:62
bool _UseProngStructure
Definition: TauMET.h:52
std::string _InputMETLabel
Definition: TauMET.h:41
double _TauMinEt
Definition: TauMET.h:44
TauMETAlgo _algo
Definition: TauMET.h:54
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
double _gammaIsolationMinPt
Definition: TauMET.h:51
bool _UseTrackIsolation
Definition: TauMET.h:48
std::vector< reco::CaloMET > CaloMETCollection
collection of CaloMET objects
static const JetCorrector * getJetCorrector(const std::string &fName, const edm::EventSetup &fSetup)
retrieve corrector from the event setup. troughs exception if something is missing ...
Definition: JetCorrector.cc:51
T const * product() const
Definition: Handle.h:74
bool _UseSeedTrack
Definition: TauMET.h:46
double _jetPTthreshold
Definition: TauMET.h:38
virtual void run(edm::Event &, const edm::EventSetup &, edm::Handle< reco::PFTauCollection >, edm::Handle< reco::CaloJetCollection >, double, double, const JetCorrector &, const std::vector< reco::CaloMET > &, double, double, double, bool, double, bool, double, bool, double, bool, std::vector< reco::CaloMET > *corrMET)
Definition: TauMETAlgo.cc:17
double _seedTrackPt
Definition: TauMET.h:47
double _JetMatchDeltaR
Definition: TauMET.h:43