Go to the documentation of this file.00001
00002
00003
00004
00005
00015
00016 #include <memory>
00017
00018
00019 #include "FWCore/Framework/interface/Frameworkfwd.h"
00020 #include "FWCore/Framework/interface/EDAnalyzer.h"
00021
00022 #include "FWCore/Framework/interface/Event.h"
00023 #include "FWCore/Framework/interface/MakerMacros.h"
00024
00025 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00026
00027
00028 #include "FWCore/Framework/interface/ESHandle.h"
00029 #include "DataFormats/JetReco/interface/CaloJetCollection.h"
00030 #include "DataFormats/JetReco/interface/CaloJet.h"
00035
00036 #include "JetMETCorrections/TauJet/interface/TauJetCorrector.h"
00037
00038 #include "JetMETCorrections/Objects/interface/JetCorrector.h"
00039 #include "DataFormats/TrackReco/interface/Track.h"
00040 #include "DataFormats/BTauReco/interface/IsolatedTauTagInfo.h"
00041 #include "DataFormats/JetReco/interface/Jet.h"
00042 #include <DataFormats/Common/interface/RefVector.h>
00043 #include <DataFormats/Common/interface/RefVectorIterator.h>
00044 #include <DataFormats/Common/interface/Ref.h>
00045
00046
00047
00048 #include <iostream>
00049 #include <string>
00050
00051 #include <TFile.h>
00052 #include <TH1D.h>
00053 #include <TMath.h>
00054 #include <TTree.h>
00055 #include <TLorentzVector.h>
00056 #include <TVector3.h>
00057
00058
00059
00060
00061 class TauJetCorrectorExample : public edm::EDAnalyzer {
00062 public:
00063 explicit TauJetCorrectorExample(const edm::ParameterSet&);
00064 ~TauJetCorrectorExample();
00065
00066
00067 private:
00068 virtual void beginJob() ;
00069 virtual void analyze(const edm::Event&, const edm::EventSetup&);
00070 virtual void endJob() ;
00071
00072
00073 std::string jetname;
00074 std::string tauname;
00075 std::string tauCorrectorname;
00076
00077 int nEvt;
00078 int njets;
00079
00080 JetCorrector* taucorrector;
00081
00082 };
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097 using namespace reco;
00098
00099 TauJetCorrectorExample::TauJetCorrectorExample(const edm::ParameterSet& iConfig):
00100 jetname(iConfig.getUntrackedParameter<std::string>("JetHandle","iterativeCone5CaloJets")),
00101 tauname(iConfig.getUntrackedParameter<std::string>("TauHandle","coneIsolation")),
00102 tauCorrectorname(iConfig.getUntrackedParameter<std::string>("tauCorrHandle", "TauJetCorrectorIcone5")),
00103 nEvt(0), njets(0), taucorrector(0)
00104 {
00105
00106
00107 }
00108
00109
00110 TauJetCorrectorExample::~TauJetCorrectorExample()
00111 {
00112
00113
00114
00115
00116 }
00117
00118
00119
00120
00121
00122
00123
00124 void
00125 TauJetCorrectorExample::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00126 {
00127 taucorrector = const_cast<JetCorrector*>(JetCorrector::getJetCorrector(tauCorrectorname, iSetup));
00128
00129 using namespace edm;
00130
00131 #ifdef THIS_IS_AN_EVENT_EXAMPLE
00132 Handle<ExampleData> pIn;
00133 iEvent.getByLabel("example",pIn);
00134 #endif
00135
00136 #ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE
00137 ESHandle<SetupData> pSetup;
00138 iSetup.get<SetupRecord>().get(pSetup);
00139 #endif
00140 using namespace edm;
00141
00142
00143
00144 ++nEvt;
00145 if((nEvt%10==0 && nEvt<=100)||(nEvt%100==0 && nEvt>100))
00146 std::cout << "reading event " << nEvt << std::endl;
00147
00148
00149 Handle<reco::IsolatedTauTagInfoCollection> tauTagInfoHandle;
00150 iEvent.getByLabel(tauname,tauTagInfoHandle);
00151 reco::IsolatedTauTagInfoCollection::const_iterator tau=tauTagInfoHandle->begin();
00152
00153
00154
00155
00156
00157 njets=0;
00158
00159 std::cout << "starting tau loop" << std::endl;
00160 for(tau=tauTagInfoHandle->begin();tau!=tauTagInfoHandle->end() && njets<10;++tau) {
00161
00162
00163
00164 double pt = tau->jet().get()->et();
00165
00166
00167 double scale = taucorrector->correction(tau->jet().get()->p4());
00168 double ptcorr = tau->jet().get()->et() * scale;
00169
00170 std::cout << "Tau jet: Original Et = " << pt << " Corrected Et = " << ptcorr << std::endl;
00171
00172 ++njets;
00173 }
00174
00175
00176 }
00177
00178
00179
00180
00181 void
00182
00183 TauJetCorrectorExample::beginJob()
00184 {
00185
00186
00187
00188 }
00189
00190
00191 void
00192 TauJetCorrectorExample::endJob() {
00193 }
00194
00195
00196 DEFINE_FWK_MODULE(TauJetCorrectorExample);