00001
00002
00003
00004
00005
00006
00007
00008 #include "DataFormats/Common/interface/Handle.h"
00009
00010 #include "DQMServices/Core/interface/DQMStore.h"
00011 #include "DQMServices/Core/interface/MonitorElement.h"
00012
00013 #include "FWCore/Framework/interface/Frameworkfwd.h"
00014 #include "FWCore/Framework/interface/Event.h"
00015 #include "FWCore/Framework/interface/MakerMacros.h"
00016 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00017 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00018 #include "FWCore/ServiceRegistry/interface/Service.h"
00019
00020
00021
00022
00023 #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h"
00024 #include "DataFormats/CaloTowers/interface/CaloTowerDetId.h"
00025 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
00026 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
00027
00028 #include "DataFormats/JetReco/interface/CaloJet.h"
00029 #include "DataFormats/JetReco/interface/CaloJetCollection.h"
00030 #include "DataFormats/JetReco/interface/PFJet.h"
00031 #include "DataFormats/JetReco/interface/PFJetCollection.h"
00032 #include "DataFormats/JetReco/interface/JPTJet.h"
00033 #include "DataFormats/JetReco/interface/JPTJetCollection.h"
00034
00035 #include "DataFormats/METReco/interface/MET.h"
00036 #include "DataFormats/METReco/interface/METCollection.h"
00037 #include "DataFormats/METReco/interface/CaloMETCollection.h"
00038 #include "DataFormats/METReco/interface/CaloMET.h"
00039 #include "DataFormats/METReco/interface/PFMET.h"
00040 #include "DataFormats/METReco/interface/PFMETCollection.h"
00041 #include "DataFormats/METReco/interface/PFMETFwd.h"
00042
00043
00044
00045
00046 #include "DataFormats/Math/interface/LorentzVector.h"
00047 #include "DQMOffline/JetMET/interface/SUSYDQMAnalyzer.h"
00048 #include "DQMOffline/JetMET/interface/SusyDQM/alpha_T.h"
00049 #include "DQMOffline/JetMET/interface/SusyDQM/HT.h"
00050
00051
00052
00053
00054 #include "TH1.h"
00055 #include "TVector2.h"
00056 #include "TLorentzVector.h"
00057
00058
00059
00060
00061 #include <cmath>
00062 #include <vector>
00063 #include <fstream>
00064 #include <sstream>
00065 #include <string>
00066
00067 using namespace edm;
00068 using namespace reco;
00069 using namespace math;
00070 using namespace std;
00071
00072 SUSYDQMAnalyzer::SUSYDQMAnalyzer( const edm::ParameterSet& pSet)
00073 {
00074 iConfig = pSet;
00075
00076 SUSYFolder = iConfig.getParameter<std::string>("folderName");
00077 dqm = edm::Service<DQMStore>().operator->();
00078
00079 }
00080
00081
00082 void SUSYDQMAnalyzer::beginJob(void){
00083
00084
00085
00086 thePFMETCollectionLabel = iConfig.getParameter<edm::InputTag>("PFMETCollectionLabel");
00087 theCaloMETCollectionLabel = iConfig.getParameter<edm::InputTag>("CaloMETCollectionLabel");
00088 theTCMETCollectionLabel = iConfig.getParameter<edm::InputTag>("TCMETCollectionLabel");
00089
00090 theCaloJetCollectionLabel = iConfig.getParameter<edm::InputTag>("CaloJetCollectionLabel");
00091 theJPTJetCollectionLabel = iConfig.getParameter<edm::InputTag>("JPTJetCollectionLabel");
00092 thePFJetCollectionLabel = iConfig.getParameter<edm::InputTag>("PFJetCollectionLabel");
00093
00094 _ptThreshold = iConfig.getParameter<double>("ptThreshold");
00095 _maxNJets = iConfig.getParameter<double>("maxNJets");
00096 _maxAbsEta = iConfig.getParameter<double>("maxAbsEta");
00097
00098
00099
00100 }
00101
00102 void SUSYDQMAnalyzer::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup){
00103
00104 if( dqm ) {
00105
00106
00107
00108
00109 std::string dir=SUSYFolder;
00110 dir+="HT";
00111 dqm->setCurrentFolder(dir);
00112 hCaloHT = dqm->book1D("Calo_HT", "", 500, 0., 2000);
00113 hPFHT = dqm->book1D("PF_HT" , "", 500, 0., 2000);
00114 hJPTHT = dqm->book1D("JPT_HT" , "", 500, 0., 2000);
00115
00116
00117
00118
00119 dir=SUSYFolder;
00120 dir+="MET";
00121 dqm->setCurrentFolder(dir);
00122 hCaloMET = dqm->book1D("Calo_MET", "", 500, 0., 1000);
00123 hPFMET = dqm->book1D("PF_MET" , "", 500, 0., 1000);
00124 hTCMET = dqm->book1D("TC_MET" , "", 500, 0., 1000);
00125
00126
00127
00128
00129 dir=SUSYFolder;
00130 dir+="MHT";
00131 dqm->setCurrentFolder(dir);
00132 hCaloMHT = dqm->book1D("Calo_MHT", "", 500, 0., 1000);
00133 hPFMHT = dqm->book1D("PF_MHT" , "", 500, 0., 1000);
00134 hJPTMHT = dqm->book1D("JPT_MHT" , "", 500, 0., 1000);
00135
00136
00137
00138
00139 dir=SUSYFolder;
00140 dir+="Alpha_T";
00141 dqm->setCurrentFolder(dir);
00142 hCaloAlpha_T = dqm->book1D("Calo_AlphaT", "", 100, 0., 1.);
00143 hJPTAlpha_T = dqm->book1D("PF_AlphaT" , "", 100, 0., 1.);
00144 hPFAlpha_T = dqm->book1D("JPT_AlphaT" , "", 100, 0., 1.);
00145
00146 }
00147 }
00148
00149 void SUSYDQMAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00150 {
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166 edm::Handle<reco::CaloJetCollection> CaloJetcoll;
00167
00168 iEvent.getByLabel(theCaloJetCollectionLabel, CaloJetcoll);
00169
00170 if(!CaloJetcoll.isValid()) return;
00171
00172 std::vector<math::XYZTLorentzVector> Ps;
00173 for (reco::CaloJetCollection::const_iterator jet = CaloJetcoll->begin(); jet!=CaloJetcoll->end(); ++jet){
00174 if ((jet->pt()>_ptThreshold) && (abs(jet->eta()) < _maxAbsEta)){
00175 if(Ps.size()>_maxNJets) {
00176 std::cout<<"NMax Jets exceded.."<<std::endl;
00177 break;
00178 }
00179 Ps.push_back(jet->p4());
00180 }
00181 }
00182
00183 hCaloAlpha_T->Fill( alpha_T()(Ps));
00184
00185
00186 HT< reco::CaloJetCollection > CaloHT(CaloJetcoll, _ptThreshold, _maxAbsEta);
00187
00188
00189
00190 hCaloHT->Fill(CaloHT.ScalarSum);
00191 hCaloMHT->Fill(CaloHT.v.Mod());
00192
00193
00194
00195
00196 edm::Handle<reco::PFJetCollection> PFjetcoll;
00197
00198 iEvent.getByLabel(thePFJetCollectionLabel, PFjetcoll);
00199
00200 if(!PFjetcoll.isValid()) return;
00201
00202 Ps.clear();
00203 for (reco::PFJetCollection::const_iterator jet = PFjetcoll->begin(); jet!=PFjetcoll->end(); ++jet){
00204 if ((jet->pt()>_ptThreshold) && (abs(jet->eta()) < _maxAbsEta)){
00205 if(Ps.size()>_maxNJets) {
00206 std::cout<<"NMax Jets exceded.."<<std::endl;
00207 break;
00208 }
00209 Ps.push_back(jet->p4());
00210 }
00211 }
00212
00213 hPFAlpha_T->Fill( alpha_T()(Ps));
00214
00215
00216 HT<reco::PFJetCollection> PFHT(PFjetcoll, _ptThreshold, _maxAbsEta);
00217
00218
00219
00220 hPFHT->Fill(PFHT.ScalarSum);
00221 hPFMHT->Fill(PFHT.v.Mod());
00222
00223
00224
00225
00226 edm::Handle<reco::JPTJetCollection> JPTjetcoll;
00227
00228 iEvent.getByLabel(theJPTJetCollectionLabel, JPTjetcoll);
00229
00230 if(!JPTjetcoll.isValid()) return;
00231
00232 Ps.clear();
00233 for (reco::JPTJetCollection::const_iterator jet = JPTjetcoll->begin(); jet!=JPTjetcoll->end(); ++jet){
00234 if ((jet->pt()>_ptThreshold) && (abs(jet->eta())<_maxAbsEta)){
00235 if(Ps.size()>_maxNJets) {
00236 std::cout<<"NMax Jets exceded..."<<std::endl;
00237 break;
00238 }
00239 Ps.push_back(jet->p4());
00240 }
00241 }
00242 hJPTAlpha_T->Fill( alpha_T()(Ps));
00243
00244
00245 HT<reco::JPTJetCollection> JPTHT(JPTjetcoll, _ptThreshold, _maxAbsEta);
00246
00247
00248
00249 hJPTHT->Fill(JPTHT.ScalarSum);
00250 hJPTMHT->Fill(JPTHT.v.Mod());
00251
00252
00253
00254
00255
00256
00257
00258 edm::Handle<reco::CaloMETCollection> calometcoll;
00259 iEvent.getByLabel(theCaloMETCollectionLabel, calometcoll);
00260
00261 if(!calometcoll.isValid()) return;
00262
00263 const CaloMETCollection *calometcol = calometcoll.product();
00264 const CaloMET *calomet;
00265 calomet = &(calometcol->front());
00266
00267 hCaloMET->Fill(calomet->pt());
00268
00269
00270
00271
00272
00273 edm::Handle<reco::PFMETCollection> pfmetcoll;
00274 iEvent.getByLabel(thePFMETCollectionLabel, pfmetcoll);
00275
00276 if(!pfmetcoll.isValid()) return;
00277
00278 const PFMETCollection *pfmetcol = pfmetcoll.product();
00279 const PFMET *pfmet;
00280 pfmet = &(pfmetcol->front());
00281
00282 hPFMET->Fill(pfmet->pt());
00283
00284
00285
00286
00287
00288 edm::Handle<reco::METCollection> tcmetcoll;
00289 iEvent.getByLabel(theTCMETCollectionLabel, tcmetcoll);
00290
00291 if(!tcmetcoll.isValid()) return;
00292
00293 const METCollection *tcmetcol = tcmetcoll.product();
00294 const MET *tcmet;
00295 tcmet = &(tcmetcol->front());
00296
00297 hTCMET->Fill(tcmet->pt());
00298
00299
00300 }
00301
00302 void SUSYDQMAnalyzer::endRun(const edm::Run&, const edm::EventSetup&){
00303 }
00304
00305 SUSYDQMAnalyzer::~SUSYDQMAnalyzer(){
00306 }