00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "DQMOffline/JetMET/interface/METAnalyzer.h"
00011 #include "DataFormats/Common/interface/Handle.h"
00012 #include "FWCore/Common/interface/TriggerNames.h"
00013
00014 #include "DataFormats/Math/interface/LorentzVector.h"
00015
00016 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00017
00018 #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h"
00019 #include "DataFormats/CaloTowers/interface/CaloTowerDetId.h"
00020 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
00021 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
00022
00023 #include "DataFormats/Math/interface/LorentzVector.h"
00024
00025 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h"
00026 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetup.h"
00027 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
00028
00029 #include <string>
00030 using namespace edm;
00031 using namespace reco;
00032 using namespace math;
00033
00034
00035 METAnalyzer::METAnalyzer(const edm::ParameterSet& pSet) {
00036
00037 parameters = pSet;
00038
00039 edm::ParameterSet highptjetparms = parameters.getParameter<edm::ParameterSet>("highPtJetTrigger");
00040 edm::ParameterSet lowptjetparms = parameters.getParameter<edm::ParameterSet>("lowPtJetTrigger" );
00041 edm::ParameterSet minbiasparms = parameters.getParameter<edm::ParameterSet>("minBiasTrigger" );
00042 edm::ParameterSet highmetparms = parameters.getParameter<edm::ParameterSet>("highMETTrigger" );
00043
00044 edm::ParameterSet eleparms = parameters.getParameter<edm::ParameterSet>("eleTrigger" );
00045 edm::ParameterSet muonparms = parameters.getParameter<edm::ParameterSet>("muonTrigger" );
00046
00047
00048 _HighPtJetEventFlag = new GenericTriggerEventFlag( highptjetparms );
00049 _LowPtJetEventFlag = new GenericTriggerEventFlag( lowptjetparms );
00050 _MinBiasEventFlag = new GenericTriggerEventFlag( minbiasparms );
00051 _HighMETEventFlag = new GenericTriggerEventFlag( highmetparms );
00052
00053 _EleEventFlag = new GenericTriggerEventFlag( eleparms );
00054 _MuonEventFlag = new GenericTriggerEventFlag( muonparms );
00055
00056 highPtJetExpr_ = highptjetparms.getParameter<std::vector<std::string> >("hltPaths");
00057 lowPtJetExpr_ = lowptjetparms .getParameter<std::vector<std::string> >("hltPaths");
00058 highMETExpr_ = highmetparms .getParameter<std::vector<std::string> >("hltPaths");
00059
00060 muonExpr_ = muonparms .getParameter<std::vector<std::string> >("hltPaths");
00061 elecExpr_ = eleparms .getParameter<std::vector<std::string> >("hltPaths");
00062 minbiasExpr_ = minbiasparms .getParameter<std::vector<std::string> >("hltPaths");
00063
00064 }
00065
00066
00067 METAnalyzer::~METAnalyzer() {
00068
00069 delete _HighPtJetEventFlag;
00070 delete _LowPtJetEventFlag;
00071 delete _MinBiasEventFlag;
00072 delete _HighMETEventFlag;
00073
00074 delete _EleEventFlag;
00075 delete _MuonEventFlag;
00076
00077 }
00078
00079 void METAnalyzer::beginJob(DQMStore * dbe) {
00080
00081 evtCounter = 0;
00082 metname = "METAnalyzer";
00083
00084
00085 HLTPathsJetMBByName_ = parameters.getParameter<std::vector<std::string > >("HLTPathsJetMB");
00086
00087 theCleaningParameters = parameters.getParameter<ParameterSet>("CleaningParameters"),
00088
00089
00090 gtTag = theCleaningParameters.getParameter<edm::InputTag>("gtLabel");
00091 _techTrigsAND = theCleaningParameters.getParameter<std::vector<unsigned > >("techTrigsAND");
00092 _techTrigsOR = theCleaningParameters.getParameter<std::vector<unsigned > >("techTrigsOR");
00093 _techTrigsNOT = theCleaningParameters.getParameter<std::vector<unsigned > >("techTrigsNOT");
00094
00095 _doHLTPhysicsOn = theCleaningParameters.getParameter<bool>("doHLTPhysicsOn");
00096 _hlt_PhysDec = theCleaningParameters.getParameter<std::string>("HLT_PhysDec");
00097
00098 _tightBHFiltering = theCleaningParameters.getParameter<bool>("tightBHFiltering");
00099 _tightJetIDFiltering = theCleaningParameters.getParameter<int>("tightJetIDFiltering");
00100
00101
00102
00103
00104 DCSFilter = new JetMETDQMDCSFilter(parameters.getParameter<ParameterSet>("DCSFilter"));
00105
00106
00107 _doPVCheck = theCleaningParameters.getParameter<bool>("doPrimaryVertexCheck");
00108 vertexTag = theCleaningParameters.getParameter<edm::InputTag>("vertexLabel");
00109
00110 if (_doPVCheck) {
00111 _nvtx_min = theCleaningParameters.getParameter<int>("nvtx_min");
00112 _nvtxtrks_min = theCleaningParameters.getParameter<int>("nvtxtrks_min");
00113 _vtxndof_min = theCleaningParameters.getParameter<int>("vtxndof_min");
00114 _vtxchi2_max = theCleaningParameters.getParameter<double>("vtxchi2_max");
00115 _vtxz_max = theCleaningParameters.getParameter<double>("vtxz_max");
00116 }
00117
00118
00119 theMETCollectionLabel = parameters.getParameter<edm::InputTag>("METCollectionLabel");
00120 _source = parameters.getParameter<std::string>("Source");
00121
00122 if (theMETCollectionLabel.label() == "tcMet" ) {
00123 inputTrackLabel = parameters.getParameter<edm::InputTag>("InputTrackLabel");
00124 inputMuonLabel = parameters.getParameter<edm::InputTag>("InputMuonLabel");
00125 inputElectronLabel = parameters.getParameter<edm::InputTag>("InputElectronLabel");
00126 inputBeamSpotLabel = parameters.getParameter<edm::InputTag>("InputBeamSpotLabel");
00127 }
00128
00129
00130 theJetCollectionLabel = parameters.getParameter<edm::InputTag>("JetCollectionLabel");
00131 HcalNoiseRBXCollectionTag = parameters.getParameter<edm::InputTag>("HcalNoiseRBXCollection");
00132 BeamHaloSummaryTag = parameters.getParameter<edm::InputTag>("BeamHaloSummaryLabel");
00133 HBHENoiseFilterResultTag = parameters.getParameter<edm::InputTag>("HBHENoiseFilterResultLabel");
00134
00135
00136 _verbose = parameters.getParameter<int>("verbose");
00137 _etThreshold = parameters.getParameter<double>("etThreshold");
00138 _allhist = parameters.getParameter<bool>("allHist");
00139 _allSelection = parameters.getParameter<bool>("allSelection");
00140 _cleanupSelection = parameters.getParameter<bool>("cleanupSelection");
00141
00142 _FolderName = parameters.getUntrackedParameter<std::string>("FolderName");
00143
00144 _highPtJetThreshold = parameters.getParameter<double>("HighPtJetThreshold");
00145 _lowPtJetThreshold = parameters.getParameter<double>("LowPtJetThreshold");
00146 _highMETThreshold = parameters.getParameter<double>("HighMETThreshold");
00147
00148
00149
00150 jetID = new reco::helper::JetIDHelper(parameters.getParameter<ParameterSet>("JetIDParams"));
00151
00152
00153 LogTrace(metname)<<"[METAnalyzer] Parameters initialization";
00154 std::string DirName = _FolderName+_source;
00155 dbe->setCurrentFolder(DirName);
00156
00157 hmetME = dbe->book1D("metReco", "metReco", 4, 1, 5);
00158 hmetME->setBinLabel(2,"MET",1);
00159
00160 _dbe = dbe;
00161
00162 _FolderNames.push_back("All");
00163 _FolderNames.push_back("BasicCleanup");
00164 _FolderNames.push_back("ExtraCleanup");
00165 _FolderNames.push_back("HcalNoiseFilter");
00166 _FolderNames.push_back("JetIDMinimal");
00167 _FolderNames.push_back("JetIDLoose");
00168 _FolderNames.push_back("JetIDTight");
00169 _FolderNames.push_back("BeamHaloIDTightPass");
00170 _FolderNames.push_back("BeamHaloIDLoosePass");
00171 _FolderNames.push_back("Triggers");
00172 _FolderNames.push_back("PV");
00173
00174 for (std::vector<std::string>::const_iterator ic = _FolderNames.begin();
00175 ic != _FolderNames.end(); ic++){
00176 if (*ic=="All") bookMESet(DirName+"/"+*ic);
00177 if (_cleanupSelection){
00178 if (*ic=="BasicCleanup") bookMESet(DirName+"/"+*ic);
00179 if (*ic=="ExtraCleanup") bookMESet(DirName+"/"+*ic);
00180 }
00181 if (_allSelection){
00182 if (*ic=="HcalNoiseFilter") bookMESet(DirName+"/"+*ic);
00183 if (*ic=="JetIDMinimal") bookMESet(DirName+"/"+*ic);
00184 if (*ic=="JetIDLoose") bookMESet(DirName+"/"+*ic);
00185 if (*ic=="JetIDTight") bookMESet(DirName+"/"+*ic);
00186 if (*ic=="BeamHaloIDTightPass") bookMESet(DirName+"/"+*ic);
00187 if (*ic=="BeamHaloIDLoosePass") bookMESet(DirName+"/"+*ic);
00188 if (*ic=="Triggers") bookMESet(DirName+"/"+*ic);
00189 if (*ic=="PV") bookMESet(DirName+"/"+*ic);
00190 }
00191 }
00192 }
00193
00194
00195 void METAnalyzer::endJob() {
00196
00197 delete jetID;
00198 delete DCSFilter;
00199
00200 }
00201
00202
00203 void METAnalyzer::bookMESet(std::string DirName)
00204 {
00205
00206 bool bLumiSecPlot=false;
00207 if (DirName.find("All")!=std::string::npos) bLumiSecPlot=true;
00208
00209 bookMonitorElement(DirName,bLumiSecPlot);
00210
00211 if ( _HighPtJetEventFlag->on() ) {
00212 bookMonitorElement(DirName+"/"+"HighPtJet",false);
00213 hTriggerName_HighPtJet = _dbe->bookString("triggerName_HighPtJet", highPtJetExpr_[0]);
00214 }
00215
00216 if ( _LowPtJetEventFlag->on() ) {
00217 bookMonitorElement(DirName+"/"+"LowPtJet",false);
00218 hTriggerName_LowPtJet = _dbe->bookString("triggerName_LowPtJet", lowPtJetExpr_[0]);
00219 }
00220
00221 if ( _MinBiasEventFlag->on() ) {
00222 bookMonitorElement(DirName+"/"+"MinBias",false);
00223 hTriggerName_MinBias = _dbe->bookString("triggerName_MinBias", minbiasExpr_[0]);
00224 if (_verbose) std::cout << "_MinBiasEventFlag is on, folder created\n";
00225 }
00226
00227 if ( _HighMETEventFlag->on() ) {
00228 bookMonitorElement(DirName+"/"+"HighMET",false);
00229 hTriggerName_HighMET = _dbe->bookString("triggerName_HighMET", highMETExpr_[0]);
00230 }
00231
00232
00233
00234
00235
00236
00237 if ( _EleEventFlag->on() ) {
00238 bookMonitorElement(DirName+"/"+"Ele",false);
00239 hTriggerName_Ele = _dbe->bookString("triggerName_Ele", elecExpr_[0]);
00240 if (_verbose) std::cout << "_EleEventFlag is on, folder created\n";
00241 }
00242
00243 if ( _MuonEventFlag->on() ) {
00244 bookMonitorElement(DirName+"/"+"Muon",false);
00245 hTriggerName_Muon = _dbe->bookString("triggerName_Muon", muonExpr_[0]);
00246 if (_verbose) std::cout << "_MuonEventFlag is on, folder created\n";
00247 }
00248 }
00249
00250
00251 void METAnalyzer::bookMonitorElement(std::string DirName, bool bLumiSecPlot=false)
00252 {
00253 if (_verbose) std::cout << "bookMonitorElement " << DirName << std::endl;
00254
00255 _dbe->setCurrentFolder(DirName);
00256
00257
00258 hMEx = _dbe->book1D("METTask_MEx", "METTask_MEx", 200, -500, 500);
00259 hMEy = _dbe->book1D("METTask_MEy", "METTask_MEy", 200, -500, 500);
00260 hMET = _dbe->book1D("METTask_MET", "METTask_MET", 200, 0, 1000);
00261 hSumET = _dbe->book1D("METTask_SumET", "METTask_SumET", 400, 0, 4000);
00262 hMETSig = _dbe->book1D("METTask_METSig", "METTask_METSig", 51, 0, 51);
00263 hMETPhi = _dbe->book1D("METTask_METPhi", "METTask_METPhi", 60, -3.2, 3.2);
00264 hMET_logx = _dbe->book1D("METTask_MET_logx", "METTask_MET_logx", 40, -1, 7);
00265 hSumET_logx = _dbe->book1D("METTask_SumET_logx", "METTask_SumET_logx", 40, -1, 7);
00266
00267 hMEx ->setAxisTitle("MEx [GeV]", 1);
00268 hMEy ->setAxisTitle("MEy [GeV]", 1);
00269 hMET ->setAxisTitle("MET [GeV]", 1);
00270 hSumET ->setAxisTitle("SumET [GeV]", 1);
00271 hMETSig ->setAxisTitle("CaloMETSig", 1);
00272 hMETPhi ->setAxisTitle("METPhi [rad]", 1);
00273 hMET_logx ->setAxisTitle("log(MET) [GeV]", 1);
00274 hSumET_logx->setAxisTitle("log(SumET) [GeV]", 1);
00275
00276
00277 if (_allhist){
00278 if (bLumiSecPlot){
00279 hMExLS = _dbe->book2D("METTask_MEx_LS","METTask_MEx_LS",200,-200,200,50,0.,500.);
00280 hMExLS->setAxisTitle("MEx [GeV]",1);
00281 hMExLS->setAxisTitle("Lumi Section",2);
00282 hMEyLS = _dbe->book2D("METTask_MEy_LS","METTask_MEy_LS",200,-200,200,50,0.,500.);
00283 hMEyLS->setAxisTitle("MEy [GeV]",1);
00284 hMEyLS->setAxisTitle("Lumi Section",2);
00285 }
00286 }
00287
00288 if (theMETCollectionLabel.label() == "tcMet" ) {
00289 htrkPt = _dbe->book1D("METTask_trackPt", "METTask_trackPt", 50, 0, 500);
00290 htrkEta = _dbe->book1D("METTask_trackEta", "METTask_trackEta", 60, -3.0, 3.0);
00291 htrkNhits = _dbe->book1D("METTask_trackNhits", "METTask_trackNhits", 50, 0, 50);
00292 htrkChi2 = _dbe->book1D("METTask_trackNormalizedChi2", "METTask_trackNormalizedChi2", 20, 0, 20);
00293 htrkD0 = _dbe->book1D("METTask_trackD0", "METTask_trackd0", 50, -1, 1);
00294 helePt = _dbe->book1D("METTask_electronPt", "METTask_electronPt", 50, 0, 500);
00295 heleEta = _dbe->book1D("METTask_electronEta", "METTask_electronEta", 60, -3.0, 3.0);
00296 heleHoE = _dbe->book1D("METTask_electronHoverE", "METTask_electronHoverE", 25, 0, 0.5);
00297 hmuPt = _dbe->book1D("METTask_muonPt", "METTask_muonPt", 50, 0, 500);
00298 hmuEta = _dbe->book1D("METTask_muonEta", "METTask_muonEta", 60, -3.0, 3.0);
00299 hmuNhits = _dbe->book1D("METTask_muonNhits", "METTask_muonNhits", 50, 0, 50);
00300 hmuChi2 = _dbe->book1D("METTask_muonNormalizedChi2", "METTask_muonNormalizedChi2", 20, 0, 20);
00301 hmuD0 = _dbe->book1D("METTask_muonD0", "METTask_muonD0", 50, -1, 1);
00302 }
00303
00304 hMExCorrection = _dbe->book1D("METTask_MExCorrection", "METTask_MExCorrection", 100, -500.0,500.0);
00305 hMEyCorrection = _dbe->book1D("METTask_MEyCorrection", "METTask_MEyCorrection", 100, -500.0,500.0);
00306 hMuonCorrectionFlag = _dbe->book1D("METTask_CorrectionFlag","METTask_CorrectionFlag", 5, -0.5, 4.5);
00307
00308 }
00309
00310
00311 void METAnalyzer::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup)
00312 {
00313 if ( _HighPtJetEventFlag->on() ) _HighPtJetEventFlag->initRun( iRun, iSetup );
00314 if ( _LowPtJetEventFlag ->on() ) _LowPtJetEventFlag ->initRun( iRun, iSetup );
00315 if ( _MinBiasEventFlag ->on() ) _MinBiasEventFlag ->initRun( iRun, iSetup );
00316 if ( _HighMETEventFlag ->on() ) _HighMETEventFlag ->initRun( iRun, iSetup );
00317
00318 if ( _EleEventFlag ->on() ) _EleEventFlag ->initRun( iRun, iSetup );
00319 if ( _MuonEventFlag ->on() ) _MuonEventFlag ->initRun( iRun, iSetup );
00320
00321 if (_HighPtJetEventFlag->on() && _HighPtJetEventFlag->expressionsFromDB(_HighPtJetEventFlag->hltDBKey(), iSetup)[0] != "CONFIG_ERROR")
00322 highPtJetExpr_ = _HighPtJetEventFlag->expressionsFromDB(_HighPtJetEventFlag->hltDBKey(), iSetup);
00323 if (_LowPtJetEventFlag->on() && _LowPtJetEventFlag->expressionsFromDB(_LowPtJetEventFlag->hltDBKey(), iSetup)[0] != "CONFIG_ERROR")
00324 lowPtJetExpr_ = _LowPtJetEventFlag->expressionsFromDB(_LowPtJetEventFlag->hltDBKey(), iSetup);
00325 if (_HighMETEventFlag->on() && _HighMETEventFlag->expressionsFromDB(_HighMETEventFlag->hltDBKey(), iSetup)[0] != "CONFIG_ERROR")
00326 highMETExpr_ = _HighMETEventFlag->expressionsFromDB(_HighMETEventFlag->hltDBKey(), iSetup);
00327
00328
00329 if (_MuonEventFlag->on() && _MuonEventFlag->expressionsFromDB(_MuonEventFlag->hltDBKey(), iSetup)[0] != "CONFIG_ERROR")
00330 muonExpr_ = _MuonEventFlag->expressionsFromDB(_MuonEventFlag->hltDBKey(), iSetup);
00331 if (_EleEventFlag->on() && _EleEventFlag->expressionsFromDB(_EleEventFlag->hltDBKey(), iSetup)[0] != "CONFIG_ERROR")
00332 elecExpr_ = _EleEventFlag->expressionsFromDB(_EleEventFlag->hltDBKey(), iSetup);
00333 if (_MinBiasEventFlag->on() && _MinBiasEventFlag->expressionsFromDB(_MinBiasEventFlag->hltDBKey(), iSetup)[0] != "CONFIG_ERROR")
00334 minbiasExpr_ = _MinBiasEventFlag->expressionsFromDB(_MinBiasEventFlag->hltDBKey(), iSetup);
00335
00336 }
00337
00338
00339 void METAnalyzer::endRun(const edm::Run& iRun, const edm::EventSetup& iSetup, DQMStore * dbe)
00340 {
00341
00342
00343
00344
00345 std::string dirName = _FolderName+_source+"/";
00346 _dbe->setCurrentFolder(dirName);
00347
00348 TH1F* tlumisec;
00349
00350 MonitorElement *meLumiSec = _dbe->get("aaa");
00351 meLumiSec = _dbe->get("JetMET/lumisec");
00352
00353 int totlsec=0;
00354 double totltime=0.;
00355 if ( meLumiSec->getRootObject() ) {
00356 tlumisec = meLumiSec->getTH1F();
00357 for (int i=0; i<500; i++){
00358 if (tlumisec->GetBinContent(i+1)) totlsec++;
00359 }
00360 totltime = double(totlsec*90);
00361 }
00362
00363 if (totltime==0.) totltime=1.;
00364
00365
00366
00367
00368 for (std::vector<std::string>::const_iterator ic = _FolderNames.begin(); ic != _FolderNames.end(); ic++)
00369 {
00370
00371 std::string DirName;
00372 DirName = dirName+*ic;
00373
00374 makeRatePlot(DirName,totltime);
00375 if ( _HighPtJetEventFlag->on() )
00376 makeRatePlot(DirName+"/"+"triggerName_HighJetPt",totltime);
00377 if ( _LowPtJetEventFlag->on() )
00378 makeRatePlot(DirName+"/"+"triggerName_LowJetPt",totltime);
00379 if ( _MinBiasEventFlag->on() )
00380 makeRatePlot(DirName+"/"+"triggerName_MinBias",totltime);
00381 if ( _HighMETEventFlag->on() )
00382 makeRatePlot(DirName+"/"+"triggerName_HighMET",totltime);
00383
00384
00385 if ( _EleEventFlag->on() )
00386 makeRatePlot(DirName+"/"+"triggerName_Ele",totltime);
00387 if ( _MuonEventFlag->on() )
00388 makeRatePlot(DirName+"/"+"triggerName_Muon",totltime);
00389 }
00390 }
00391
00392
00393
00394 void METAnalyzer::makeRatePlot(std::string DirName, double totltime)
00395 {
00396
00397 _dbe->setCurrentFolder(DirName);
00398 MonitorElement *meMET = _dbe->get(DirName+"/"+"METTask_MET");
00399
00400 TH1F* tMET;
00401 TH1F* tMETRate;
00402
00403 if ( meMET )
00404 if ( meMET->getRootObject() ) {
00405 tMET = meMET->getTH1F();
00406
00407
00408 tMETRate = (TH1F*) tMET->Clone("METTask_METRate");
00409 for (int i = tMETRate->GetNbinsX()-1; i>=0; i--){
00410 tMETRate->SetBinContent(i+1,tMETRate->GetBinContent(i+2)+tMET->GetBinContent(i+1));
00411 }
00412 for (int i = 0; i<tMETRate->GetNbinsX(); i++){
00413 tMETRate->SetBinContent(i+1,tMETRate->GetBinContent(i+1)/double(totltime));
00414 }
00415
00416 tMETRate->SetName("METTask_METRate");
00417 tMETRate->SetTitle("METTask_METRate");
00418 hMETRate = _dbe->book1D("METTask_METRate",tMETRate);
00419 }
00420 }
00421
00422
00423 void METAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup,
00424 const edm::TriggerResults& triggerResults) {
00425
00426 if (_verbose) std::cout << "METAnalyzer analyze" << std::endl;
00427
00428 std::string DirName = _FolderName+_source;
00429
00430 LogTrace(metname)<<"[METAnalyzer] Analyze MET";
00431
00432 hmetME->Fill(2);
00433
00434
00435
00436
00437 _trig_JetMB=0;
00438 _trig_HighPtJet=0;
00439 _trig_LowPtJet=0;
00440 _trig_MinBias=0;
00441 _trig_HighMET=0;
00442
00443 _trig_Ele=0;
00444 _trig_Muon=0;
00445 _trig_PhysDec=0;
00446 if(&triggerResults) {
00447
00449
00450
00451
00452
00453 int ntrigs = triggerResults.size();
00454 if (_verbose) std::cout << "ntrigs=" << ntrigs << std::endl;
00455
00456
00457
00458
00459 const edm::TriggerNames & triggerNames = iEvent.triggerNames(triggerResults);
00460
00461
00462
00463 const unsigned int nTrig(triggerNames.size());
00464 for (unsigned int i=0;i<nTrig;++i)
00465 {
00466 if (triggerNames.triggerName(i).find(highPtJetExpr_[0].substr(0,highPtJetExpr_[0].rfind("_v")+2))!=std::string::npos && triggerResults.accept(i))
00467 _trig_HighPtJet=true;
00468 else if (triggerNames.triggerName(i).find(lowPtJetExpr_[0].substr(0,lowPtJetExpr_[0].rfind("_v")+2))!=std::string::npos && triggerResults.accept(i))
00469 _trig_LowPtJet=true;
00470 else if (triggerNames.triggerName(i).find(highMETExpr_[0].substr(0,highMETExpr_[0].rfind("_v")+2))!=std::string::npos && triggerResults.accept(i))
00471 _trig_HighMET=true;
00472
00473
00474 else if (triggerNames.triggerName(i).find(muonExpr_[0].substr(0,muonExpr_[0].rfind("_v")+2))!=std::string::npos && triggerResults.accept(i))
00475 _trig_Muon=true;
00476 else if (triggerNames.triggerName(i).find(elecExpr_[0].substr(0,elecExpr_[0].rfind("_v")+2))!=std::string::npos && triggerResults.accept(i))
00477 _trig_Ele=true;
00478 else if (triggerNames.triggerName(i).find(minbiasExpr_[0].substr(0,minbiasExpr_[0].rfind("_v")+2))!=std::string::npos && triggerResults.accept(i))
00479 _trig_MinBias=true;
00480 }
00481
00482
00483 for (unsigned int i=0; i!=HLTPathsJetMBByName_.size(); i++) {
00484 unsigned int triggerIndex = triggerNames.triggerIndex(HLTPathsJetMBByName_[i]);
00485 if (triggerIndex<triggerResults.size()) {
00486 if (triggerResults.accept(triggerIndex)) {
00487 _trig_JetMB++;
00488 }
00489 }
00490 }
00491
00492 if (HLTPathsJetMBByName_.size()==0) _trig_JetMB=triggerResults.size()-1;
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516 if (triggerNames.triggerIndex(_hlt_PhysDec) != triggerNames.size() &&
00517 triggerResults.accept(triggerNames.triggerIndex(_hlt_PhysDec))) _trig_PhysDec=1;
00518 } else {
00519
00520 edm::LogInfo("MetAnalyzer") << "TriggerResults::HLT not found, "
00521 "automatically select events";
00522
00523
00524 _trig_JetMB=1;
00525 }
00526
00527
00528
00529
00530
00531 edm::Handle<reco::METCollection> metcoll;
00532 iEvent.getByLabel(theMETCollectionLabel, metcoll);
00533
00534 if(!metcoll.isValid()) {
00535 std::cout<<"Unable to find MET results for MET collection "<<theMETCollectionLabel<<std::endl;
00536 return;
00537 }
00538
00539 const METCollection *metcol = metcoll.product();
00540 const MET *met;
00541 met = &(metcol->front());
00542
00543 LogTrace(metname)<<"[METAnalyzer] Call to the MET analyzer";
00544
00545
00546
00547
00548 if (theMETCollectionLabel.label() == "tcMet" ) {
00549
00550 iEvent.getByLabel(inputMuonLabel, muon_h);
00551 iEvent.getByLabel(inputTrackLabel, track_h);
00552 iEvent.getByLabel(inputElectronLabel, electron_h);
00553 iEvent.getByLabel(inputBeamSpotLabel, beamSpot_h);
00554 iEvent.getByLabel("muonTCMETValueMapProducer" , "muCorrData", tcMet_ValueMap_Handle);
00555
00556 if(!muon_h.isValid()) edm::LogInfo("OutputInfo") << "falied to retrieve muon data require by MET Task";
00557 if(!track_h.isValid()) edm::LogInfo("OutputInfo") << "falied to retrieve track data require by MET Task";
00558 if(!electron_h.isValid()) edm::LogInfo("OutputInfo") << "falied to retrieve electron data require by MET Task";
00559 if(!beamSpot_h.isValid()) edm::LogInfo("OutputInfo") << "falied to retrieve beam spot data require by MET Task";
00560
00561 bspot = ( beamSpot_h.isValid() ) ? beamSpot_h->position() : math::XYZPoint(0, 0, 0);
00562
00563 }
00564
00565
00566
00567
00568 edm::Handle<HcalNoiseRBXCollection> HRBXCollection;
00569 iEvent.getByLabel(HcalNoiseRBXCollectionTag,HRBXCollection);
00570 if (!HRBXCollection.isValid()) {
00571 LogDebug("") << "METAnalyzer: Could not find HcalNoiseRBX Collection" << std::endl;
00572 if (_verbose) std::cout << "METAnalyzer: Could not find HcalNoiseRBX Collection" << std::endl;
00573 }
00574
00575
00576 edm::Handle<bool> HBHENoiseFilterResultHandle;
00577 iEvent.getByLabel(HBHENoiseFilterResultTag, HBHENoiseFilterResultHandle);
00578 bool HBHENoiseFilterResult = *HBHENoiseFilterResultHandle;
00579 if (!HBHENoiseFilterResultHandle.isValid()) {
00580 LogDebug("") << "METAnalyzer: Could not find HBHENoiseFilterResult" << std::endl;
00581 if (_verbose) std::cout << "METAnalyzer: Could not find HBHENoiseFilterResult" << std::endl;
00582 }
00583
00584
00585 edm::Handle<reco::CaloJetCollection> caloJets;
00586 iEvent.getByLabel(theJetCollectionLabel, caloJets);
00587 if (!caloJets.isValid()) {
00588 LogDebug("") << "METAnalyzer: Could not find jet product" << std::endl;
00589 if (_verbose) std::cout << "METAnalyzer: Could not find jet product" << std::endl;
00590 }
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600 if (_verbose) std::cout << "JetID starts" << std::endl;
00601
00602
00603
00604
00605 bool bJetIDMinimal=true;
00606 for (reco::CaloJetCollection::const_iterator cal = caloJets->begin();
00607 cal!=caloJets->end(); ++cal){
00608 jetID->calculate(iEvent, *cal);
00609 if (cal->pt()>10.){
00610 if (fabs(cal->eta())<=2.6 &&
00611 cal->emEnergyFraction()<=0.01) bJetIDMinimal=false;
00612 }
00613 }
00614
00615
00616
00617
00618 bool bJetIDLoose=true;
00619 for (reco::CaloJetCollection::const_iterator cal = caloJets->begin();
00620 cal!=caloJets->end(); ++cal){
00621 jetID->calculate(iEvent, *cal);
00622 if (_verbose) std::cout << jetID->n90Hits() << " "
00623 << jetID->restrictedEMF() << " "
00624 << cal->pt() << std::endl;
00625 if (cal->pt()>10.){
00626
00627
00628 if (jetID->n90Hits()<2) bJetIDLoose=false;
00629 if (jetID->fHPD()>=0.98) bJetIDLoose=false;
00630
00631
00632
00633 if (fabs(cal->eta())<2.55){
00634 if (cal->emEnergyFraction()<=0.01) bJetIDLoose=false;
00635 }
00636
00637 else {
00638 if (cal->emEnergyFraction()<=-0.9) bJetIDLoose=false;
00639 if (cal->pt()>80.){
00640 if (cal->emEnergyFraction()>= 1.0) bJetIDLoose=false;
00641 }
00642 }
00643 }
00644 }
00645
00646
00647
00648
00649 bool bJetIDTight=true;
00650 bJetIDTight=bJetIDLoose;
00651 for (reco::CaloJetCollection::const_iterator cal = caloJets->begin();
00652 cal!=caloJets->end(); ++cal){
00653 jetID->calculate(iEvent, *cal);
00654 if (cal->pt()>25.){
00655
00656
00657 if (jetID->fHPD()>=0.95) bJetIDTight=false;
00658
00659
00660 if (fabs(cal->eta())>=1.00 && fabs(cal->eta())<1.75){
00661 if (cal->pt()>80. && cal->emEnergyFraction()>=1.) bJetIDTight=false;
00662 }
00663
00664
00665 else if (fabs(cal->eta())>=1.75 && fabs(cal->eta())<2.55){
00666 if (cal->pt()>80. && cal->emEnergyFraction()>=1.) bJetIDTight=false;
00667 }
00668
00669
00670 else if (fabs(cal->eta())>=2.55 && fabs(cal->eta())<3.25){
00671 if (cal->pt()< 50. && cal->emEnergyFraction()<=-0.3) bJetIDTight=false;
00672 if (cal->pt()>=50. && cal->pt()< 80. && cal->emEnergyFraction()<=-0.2) bJetIDTight=false;
00673 if (cal->pt()>=80. && cal->pt()<340. && cal->emEnergyFraction()<=-0.1) bJetIDTight=false;
00674 if (cal->pt()>=340. && cal->emEnergyFraction()<=-0.1
00675 && cal->emEnergyFraction()>=0.95) bJetIDTight=false;
00676 }
00677
00678
00679 else if (fabs(cal->eta())>=3.25){
00680 if (cal->pt()< 50. && cal->emEnergyFraction()<=-0.3
00681 && cal->emEnergyFraction()>=0.90) bJetIDTight=false;
00682 if (cal->pt()>=50. && cal->pt()<130. && cal->emEnergyFraction()<=-0.2
00683 && cal->emEnergyFraction()>=0.80) bJetIDTight=false;
00684 if (cal->pt()>=130. && cal->emEnergyFraction()<=-0.1
00685 && cal->emEnergyFraction()>=0.70) bJetIDTight=false;
00686 }
00687 }
00688 }
00689
00690 if (_verbose) std::cout << "JetID ends" << std::endl;
00691
00692
00693
00694
00695
00696 bool bHcalNoiseFilter = HBHENoiseFilterResult;
00697
00698
00699
00700 edm::Handle<BeamHaloSummary> TheBeamHaloSummary ;
00701 iEvent.getByLabel(BeamHaloSummaryTag, TheBeamHaloSummary) ;
00702
00703 if (!TheBeamHaloSummary.isValid()) {
00704 std::cout << "BeamHaloSummary doesn't exist" << std::endl;
00705 }
00706
00707 bool bBeamHaloIDTightPass = true;
00708 bool bBeamHaloIDLoosePass = true;
00709
00710 if(!TheBeamHaloSummary.isValid()) {
00711
00712 const BeamHaloSummary TheSummary = (*TheBeamHaloSummary.product() );
00713
00714 if( !TheSummary.EcalLooseHaloId() && !TheSummary.HcalLooseHaloId() &&
00715 !TheSummary.CSCLooseHaloId() && !TheSummary.GlobalLooseHaloId() )
00716 bBeamHaloIDLoosePass = false;
00717
00718 if( !TheSummary.EcalTightHaloId() && !TheSummary.HcalTightHaloId() &&
00719 !TheSummary.CSCTightHaloId() && !TheSummary.GlobalTightHaloId() )
00720 bBeamHaloIDTightPass = false;
00721
00722 }
00723
00724
00725
00726
00727 bool bPrimaryVertex = true;
00728 if(_doPVCheck){
00729 bPrimaryVertex = false;
00730 Handle<VertexCollection> vertexHandle;
00731
00732 iEvent.getByLabel(vertexTag, vertexHandle);
00733
00734 if (!vertexHandle.isValid()) {
00735 LogDebug("") << "CaloMETAnalyzer: Could not find vertex collection" << std::endl;
00736 if (_verbose) std::cout << "CaloMETAnalyzer: Could not find vertex collection" << std::endl;
00737 }
00738
00739 if ( vertexHandle.isValid() ){
00740 VertexCollection vertexCollection = *(vertexHandle.product());
00741 int vertex_number = vertexCollection.size();
00742 VertexCollection::const_iterator v = vertexCollection.begin();
00743 for ( ; v != vertexCollection.end(); ++v) {
00744 double vertex_chi2 = v->normalizedChi2();
00745 double vertex_ndof = v->ndof();
00746 bool fakeVtx = v->isFake();
00747 double vertex_Z = v->z();
00748
00749 if ( !fakeVtx
00750 && vertex_number>=_nvtx_min
00751 && vertex_ndof >_vtxndof_min
00752 && vertex_chi2 <_vtxchi2_max
00753 && fabs(vertex_Z)<_vtxz_max )
00754 bPrimaryVertex = true;
00755 }
00756 }
00757 }
00758
00759
00760 edm::Handle< L1GlobalTriggerReadoutRecord > gtReadoutRecord;
00761 iEvent.getByLabel( gtTag, gtReadoutRecord);
00762
00763 if (!gtReadoutRecord.isValid()) {
00764 LogDebug("") << "CaloMETAnalyzer: Could not find GT readout record" << std::endl;
00765 if (_verbose) std::cout << "CaloMETAnalyzer: Could not find GT readout record product" << std::endl;
00766 }
00767
00768 bool bTechTriggers = true;
00769 bool bTechTriggersAND = true;
00770 bool bTechTriggersOR = false;
00771 bool bTechTriggersNOT = false;
00772
00773 if (gtReadoutRecord.isValid()) {
00774 const TechnicalTriggerWord& technicalTriggerWordBeforeMask = gtReadoutRecord->technicalTriggerWord();
00775
00776 if (_techTrigsAND.size() == 0)
00777 bTechTriggersAND = true;
00778 else
00779 for (unsigned ttr = 0; ttr != _techTrigsAND.size(); ttr++) {
00780 bTechTriggersAND = bTechTriggersAND && technicalTriggerWordBeforeMask.at(_techTrigsAND.at(ttr));
00781 }
00782
00783 if (_techTrigsAND.size() == 0)
00784 bTechTriggersOR = true;
00785 else
00786 for (unsigned ttr = 0; ttr != _techTrigsOR.size(); ttr++) {
00787 bTechTriggersOR = bTechTriggersOR || technicalTriggerWordBeforeMask.at(_techTrigsOR.at(ttr));
00788 }
00789 if (_techTrigsNOT.size() == 0)
00790 bTechTriggersNOT = false;
00791 else
00792 for (unsigned ttr = 0; ttr != _techTrigsNOT.size(); ttr++) {
00793 bTechTriggersNOT = bTechTriggersNOT || technicalTriggerWordBeforeMask.at(_techTrigsNOT.at(ttr));
00794 }
00795 }
00796 else
00797 {
00798 bTechTriggersAND = true;
00799 bTechTriggersOR = true;
00800 bTechTriggersNOT = false;
00801 }
00802
00803 if (_techTrigsAND.size()==0)
00804 bTechTriggersAND = true;
00805 if (_techTrigsOR.size()==0)
00806 bTechTriggersOR = true;
00807 if (_techTrigsNOT.size()==0)
00808 bTechTriggersNOT = false;
00809
00810 bTechTriggers = bTechTriggersAND && bTechTriggersOR && !bTechTriggersNOT;
00811
00812
00813
00814
00815 bool bHcalNoise = bHcalNoiseFilter;
00816 bool bBeamHaloID = bBeamHaloIDLoosePass;
00817 bool bJetID = true;
00818
00819 bool bPhysicsDeclared = true;
00820 if(_doHLTPhysicsOn) bPhysicsDeclared =_trig_PhysDec;
00821
00822
00823 if (_tightBHFiltering) bBeamHaloID = bBeamHaloIDTightPass;
00824
00825 if (_tightJetIDFiltering==1) bJetID = bJetIDMinimal;
00826 else if (_tightJetIDFiltering==2) bJetID = bJetIDLoose;
00827 else if (_tightJetIDFiltering==3) bJetID = bJetIDTight;
00828 else if (_tightJetIDFiltering==-1) bJetID = true;
00829
00830 bool bBasicCleanup = bTechTriggers && bPrimaryVertex && bPhysicsDeclared;
00831 bool bExtraCleanup = bBasicCleanup && bHcalNoise && bJetID && bBeamHaloID;
00832
00833
00834
00835 for (std::vector<std::string>::const_iterator ic = _FolderNames.begin();
00836 ic != _FolderNames.end(); ic++){
00837 if (*ic=="All") fillMESet(iEvent, DirName+"/"+*ic, *met);
00838 if (DCSFilter->filter(iEvent, iSetup)) {
00839 if (_cleanupSelection){
00840 if (*ic=="BasicCleanup" && bBasicCleanup) fillMESet(iEvent, DirName+"/"+*ic, *met);
00841 if (*ic=="ExtraCleanup" && bExtraCleanup) fillMESet(iEvent, DirName+"/"+*ic, *met);
00842 }
00843 if (_allSelection) {
00844 if (*ic=="HcalNoiseFilter" && bHcalNoiseFilter ) fillMESet(iEvent, DirName+"/"+*ic, *met);
00845 if (*ic=="JetIDMinimal" && bJetIDMinimal) fillMESet(iEvent, DirName+"/"+*ic, *met);
00846 if (*ic=="JetIDLoose" && bJetIDLoose) fillMESet(iEvent, DirName+"/"+*ic, *met);
00847 if (*ic=="JetIDTight" && bJetIDTight) fillMESet(iEvent, DirName+"/"+*ic, *met);
00848 if (*ic=="BeamHaloIDTightPass" && bBeamHaloIDTightPass) fillMESet(iEvent, DirName+"/"+*ic, *met);
00849 if (*ic=="BeamHaloIDLoosePass" && bBeamHaloIDLoosePass) fillMESet(iEvent, DirName+"/"+*ic, *met);
00850 if (*ic=="Triggers" && bTechTriggers) fillMESet(iEvent, DirName+"/"+*ic, *met);
00851 if (*ic=="PV" && bPrimaryVertex) fillMESet(iEvent, DirName+"/"+*ic, *met);
00852 }
00853 }
00854 }
00855 }
00856
00857
00858
00859 void METAnalyzer::fillMESet(const edm::Event& iEvent, std::string DirName,
00860 const reco::MET& met)
00861 {
00862
00863 _dbe->setCurrentFolder(DirName);
00864
00865 bool bLumiSecPlot=false;
00866 if (DirName.find("All")) bLumiSecPlot=true;
00867
00868 if (_trig_JetMB)
00869 fillMonitorElement(iEvent,DirName,"",met, bLumiSecPlot);
00870 if (_trig_HighPtJet)
00871 fillMonitorElement(iEvent,DirName,"HighPtJet",met,false);
00872 if (_trig_LowPtJet)
00873 fillMonitorElement(iEvent,DirName,"LowPtJet",met,false);
00874 if (_trig_MinBias)
00875 fillMonitorElement(iEvent,DirName,"MinBias",met,false);
00876 if (_trig_HighMET)
00877 fillMonitorElement(iEvent,DirName,"HighMET",met,false);
00878
00879
00880 if (_trig_Ele)
00881 fillMonitorElement(iEvent,DirName,"Ele",met,false);
00882 if (_trig_Muon)
00883 fillMonitorElement(iEvent,DirName,"Muon",met,false);
00884 }
00885
00886
00887 void METAnalyzer::fillMonitorElement(const edm::Event& iEvent, std::string DirName,
00888 std::string TriggerTypeName,
00889 const reco::MET& met, bool bLumiSecPlot)
00890 {
00891
00892 if (TriggerTypeName=="HighPtJet") {
00893 if (!selectHighPtJetEvent(iEvent)) return;
00894 }
00895 else if (TriggerTypeName=="LowPtJet") {
00896 if (!selectLowPtJetEvent(iEvent)) return;
00897 }
00898 else if (TriggerTypeName=="HighMET") {
00899 if (met.pt()<_highMETThreshold) return;
00900 }
00901
00902
00903
00904 else if (TriggerTypeName=="Ele") {
00905 if (!selectWElectronEvent(iEvent)) return;
00906 }
00907 else if (TriggerTypeName=="Muon") {
00908 if (!selectWMuonEvent(iEvent)) return;
00909 }
00910
00911
00912 double SumET = met.sumEt();
00913 double METSig = met.mEtSig();
00914
00915 double MET = met.pt();
00916 double MEx = met.px();
00917 double MEy = met.py();
00918 double METPhi = met.phi();
00919
00920
00921 int myLuminosityBlock;
00922
00923 myLuminosityBlock = iEvent.luminosityBlock();
00924
00925
00926 if (TriggerTypeName!="") DirName = DirName +"/"+TriggerTypeName;
00927
00928 if (_verbose) std::cout << "_etThreshold = " << _etThreshold << std::endl;
00929 if (SumET>_etThreshold){
00930
00931 hMEx = _dbe->get(DirName+"/"+"METTask_MEx"); if (hMEx && hMEx->getRootObject()) hMEx ->Fill(MEx);
00932 hMEy = _dbe->get(DirName+"/"+"METTask_MEy"); if (hMEy && hMEy->getRootObject()) hMEy ->Fill(MEy);
00933 hMET = _dbe->get(DirName+"/"+"METTask_MET"); if (hMET && hMET->getRootObject()) hMET ->Fill(MET);
00934 hMETPhi = _dbe->get(DirName+"/"+"METTask_METPhi"); if (hMETPhi && hMETPhi->getRootObject()) hMETPhi ->Fill(METPhi);
00935 hSumET = _dbe->get(DirName+"/"+"METTask_SumET"); if (hSumET && hSumET->getRootObject()) hSumET ->Fill(SumET);
00936 hMETSig = _dbe->get(DirName+"/"+"METTask_METSig"); if (hMETSig && hMETSig->getRootObject()) hMETSig ->Fill(METSig);
00937
00938
00939 hMET_logx = _dbe->get(DirName+"/"+"METTask_MET_logx"); if (hMET_logx && hMET_logx->getRootObject()) hMET_logx->Fill(log10(MET));
00940 hSumET_logx = _dbe->get(DirName+"/"+"METTask_SumET_logx"); if (hSumET_logx && hSumET_logx->getRootObject()) hSumET_logx->Fill(log10(SumET));
00941
00942
00943
00944
00945 if (_allhist){
00946 if (bLumiSecPlot){
00947 hMExLS = _dbe->get(DirName+"/"+"METTask_MExLS"); if (hMExLS && hMExLS->getRootObject()) hMExLS->Fill(MEx,myLuminosityBlock);
00948 hMEyLS = _dbe->get(DirName+"/"+"METTask_MEyLS"); if (hMEyLS && hMEyLS->getRootObject()) hMEyLS->Fill(MEy,myLuminosityBlock);
00949 }
00950 }
00951
00953 if (theMETCollectionLabel.label() == "tcMet" ) {
00954
00955 if(track_h.isValid()) {
00956 for( edm::View<reco::Track>::const_iterator trkit = track_h->begin(); trkit != track_h->end(); trkit++ ) {
00957 htrkPt = _dbe->get(DirName+"/"+"METTask_trackPt"); if (htrkPt && htrkPt->getRootObject()) htrkPt->Fill( trkit->pt() );
00958 htrkEta = _dbe->get(DirName+"/"+"METTask_trackEta"); if (htrkEta && htrkEta->getRootObject()) htrkEta->Fill( trkit->eta() );
00959 htrkNhits = _dbe->get(DirName+"/"+"METTask_trackNhits"); if (htrkNhits && htrkNhits->getRootObject()) htrkNhits->Fill( trkit->numberOfValidHits() );
00960 htrkChi2 = _dbe->get(DirName+"/"+"METTask_trackNormalizedChi2"); if (htrkChi2 && htrkChi2->getRootObject()) htrkChi2->Fill( trkit->chi2() / trkit->ndof() );
00961 double d0 = -1 * trkit->dxy( bspot );
00962 htrkD0 = _dbe->get(DirName+"/"+"METTask_trackD0"); if (htrkD0 && htrkD0->getRootObject()) htrkD0->Fill( d0 );
00963 }
00964 }
00965
00966 if(electron_h.isValid()) {
00967 for( edm::View<reco::GsfElectron>::const_iterator eleit = electron_h->begin(); eleit != electron_h->end(); eleit++ ) {
00968 helePt = _dbe->get(DirName+"/"+"METTask_electronPt"); if (helePt && helePt->getRootObject()) helePt->Fill( eleit->p4().pt() );
00969 heleEta = _dbe->get(DirName+"/"+"METTask_electronEta"); if (heleEta && heleEta->getRootObject()) heleEta->Fill( eleit->p4().eta() );
00970 heleHoE = _dbe->get(DirName+"/"+"METTask_electronHoverE"); if (heleHoE && heleHoE->getRootObject()) heleHoE->Fill( eleit->hadronicOverEm() );
00971 }
00972 }
00973
00974 if(muon_h.isValid()) {
00975 for( reco::MuonCollection::const_iterator muonit = muon_h->begin(); muonit != muon_h->end(); muonit++ ) {
00976 const reco::TrackRef siTrack = muonit->innerTrack();
00977 hmuPt = _dbe->get(DirName+"/"+"METTask_muonPt"); if (hmuPt && hmuPt->getRootObject()) hmuPt ->Fill( muonit->p4().pt() );
00978 hmuEta = _dbe->get(DirName+"/"+"METTask_muonEta"); if (hmuEta && hmuEta->getRootObject()) hmuEta ->Fill( muonit->p4().eta() );
00979 hmuNhits = _dbe->get(DirName+"/"+"METTask_muonNhits"); if (hmuNhits && hmuNhits->getRootObject()) hmuNhits->Fill( siTrack.isNonnull() ? siTrack->numberOfValidHits() : -999 );
00980 hmuChi2 = _dbe->get(DirName+"/"+"METTask_muonNormalizedChi2"); if (hmuChi2 && hmuChi2->getRootObject()) hmuChi2 ->Fill( siTrack.isNonnull() ? siTrack->chi2()/siTrack->ndof() : -999 );
00981 double d0 = siTrack.isNonnull() ? -1 * siTrack->dxy( bspot) : -999;
00982 hmuD0 = _dbe->get(DirName+"/"+"METTask_muonD0"); if (hmuD0 && hmuD0->getRootObject()) hmuD0->Fill( d0 );
00983 }
00984
00985 const unsigned int nMuons = muon_h->size();
00986 for( unsigned int mus = 0; mus < nMuons; mus++ ) {
00987 reco::MuonRef muref( muon_h, mus);
00988 reco::MuonMETCorrectionData muCorrData = (*tcMet_ValueMap_Handle)[muref];
00989 hMExCorrection = _dbe->get(DirName+"/"+"METTask_MExCorrection"); if (hMExCorrection && hMExCorrection->getRootObject()) hMExCorrection-> Fill(muCorrData.corrY());
00990 hMEyCorrection = _dbe->get(DirName+"/"+"METTask_MEyCorrection"); if (hMEyCorrection && hMEyCorrection->getRootObject()) hMEyCorrection-> Fill(muCorrData.corrX());
00991 hMuonCorrectionFlag = _dbe->get(DirName+"/"+"METTask_CorrectionFlag"); if (hMuonCorrectionFlag && hMuonCorrectionFlag->getRootObject()) hMuonCorrectionFlag-> Fill(muCorrData.type());
00992 }
00993 }
00994 }
00995
00996 }
00997
00998 }
00999
01000
01001 bool METAnalyzer::selectHighPtJetEvent(const edm::Event& iEvent){
01002
01003 bool return_value=false;
01004
01005 edm::Handle<reco::CaloJetCollection> caloJets;
01006 iEvent.getByLabel(theJetCollectionLabel, caloJets);
01007 if (!caloJets.isValid()) {
01008 LogDebug("") << "METAnalyzer: Could not find jet product" << std::endl;
01009 if (_verbose) std::cout << "METAnalyzer: Could not find jet product" << std::endl;
01010 }
01011
01012 for (reco::CaloJetCollection::const_iterator cal = caloJets->begin();
01013 cal!=caloJets->end(); ++cal){
01014 if (cal->pt()>_highPtJetThreshold){
01015 return_value=true;
01016 }
01017 }
01018
01019 return return_value;
01020 }
01021
01022
01023 bool METAnalyzer::selectLowPtJetEvent(const edm::Event& iEvent){
01024
01025 bool return_value=false;
01026
01027 edm::Handle<reco::CaloJetCollection> caloJets;
01028 iEvent.getByLabel(theJetCollectionLabel, caloJets);
01029 if (!caloJets.isValid()) {
01030 LogDebug("") << "METAnalyzer: Could not find jet product" << std::endl;
01031 if (_verbose) std::cout << "METAnalyzer: Could not find jet product" << std::endl;
01032 }
01033
01034 for (reco::CaloJetCollection::const_iterator cal = caloJets->begin();
01035 cal!=caloJets->end(); ++cal){
01036 if (cal->pt()>_lowPtJetThreshold){
01037 return_value=true;
01038 }
01039 }
01040
01041 return return_value;
01042
01043 }
01044
01045
01046
01047 bool METAnalyzer::selectWElectronEvent(const edm::Event& iEvent){
01048
01049 bool return_value=true;
01050
01051
01052
01053
01054
01055 return return_value;
01056
01057 }
01058
01059
01060 bool METAnalyzer::selectWMuonEvent(const edm::Event& iEvent){
01061
01062 bool return_value=true;
01063
01064
01065
01066
01067
01068 return return_value;
01069
01070 }
01071