47 _hlt_HighPtJet = highptjetparms.
getParameter<std::string>(
"hltDBKey");
48 _hlt_LowPtJet = lowptjetparms .getParameter<std::string>(
"hltDBKey");
49 _hlt_MinBias = minbiasparms .getParameter<std::string>(
"hltDBKey");
50 _hlt_HighMET = highmetparms .getParameter<std::string>(
"hltDBKey");
51 _hlt_LowMET = lowmetparms .getParameter<std::string>(
"hltDBKey");
52 _hlt_Ele = eleparms .getParameter<std::string>(
"hltDBKey");
53 _hlt_Muon = muonparms .getParameter<std::string>(
"hltDBKey");
69 delete _HighPtJetEventFlag;
70 delete _LowPtJetEventFlag;
71 delete _MinBiasEventFlag;
72 delete _HighMETEventFlag;
73 delete _LowMETEventFlag;
75 delete _MuonEventFlag;
85 HLTPathsJetMBByName_ =
parameters.getParameter<std::vector<std::string > >(
"HLTPathsJetMB");
91 _techTrigsAND = theCleaningParameters.getParameter<std::vector<unsigned > >(
"techTrigsAND");
92 _techTrigsOR = theCleaningParameters.getParameter<std::vector<unsigned > >(
"techTrigsOR");
93 _techTrigsNOT = theCleaningParameters.getParameter<std::vector<unsigned > >(
"techTrigsNOT");
95 _doHLTPhysicsOn = theCleaningParameters.getParameter<
bool>(
"doHLTPhysicsOn");
96 _hlt_PhysDec = theCleaningParameters.getParameter<std::string>(
"HLT_PhysDec");
98 _tightBHFiltering = theCleaningParameters.getParameter<
bool>(
"tightBHFiltering");
99 _tightJetIDFiltering = theCleaningParameters.getParameter<
int>(
"tightJetIDFiltering");
100 _tightHcalFiltering = theCleaningParameters.getParameter<
bool>(
"tightHcalFiltering");
108 _doPVCheck = theCleaningParameters.getParameter<
bool>(
"doPrimaryVertexCheck");
109 vertexTag = theCleaningParameters.getParameter<
edm::InputTag>(
"vertexLabel");
112 _nvtx_min = theCleaningParameters.getParameter<
int>(
"nvtx_min");
113 _nvtxtrks_min = theCleaningParameters.getParameter<
int>(
"nvtxtrks_min");
114 _vtxndof_min = theCleaningParameters.getParameter<
int>(
"vtxndof_min");
115 _vtxchi2_max = theCleaningParameters.getParameter<
double>(
"vtxchi2_max");
116 _vtxz_max = theCleaningParameters.getParameter<
double>(
"vtxz_max");
121 _source =
parameters.getParameter<std::string>(
"Source");
123 if (theMETCollectionLabel.label() ==
"tcMet" ) {
137 _verbose =
parameters.getParameter<
int>(
"verbose");
138 _etThreshold =
parameters.getParameter<
double>(
"etThreshold");
139 _allhist =
parameters.getParameter<
bool>(
"allHist");
140 _allSelection =
parameters.getParameter<
bool>(
"allSelection");
141 _cleanupSelection =
parameters.getParameter<
bool>(
"cleanupSelection");
143 _FolderName =
parameters.getUntrackedParameter<std::string>(
"FolderName");
145 _highPtJetThreshold =
parameters.getParameter<
double>(
"HighPtJetThreshold");
146 _lowPtJetThreshold =
parameters.getParameter<
double>(
"LowPtJetThreshold");
147 _highMETThreshold =
parameters.getParameter<
double>(
"HighMETThreshold");
148 _lowMETThreshold =
parameters.getParameter<
double>(
"LowMETThreshold");
155 std::string
DirName = _FolderName+_source;
158 hmetME = dbe->
book1D(
"metReco",
"metReco", 4, 1, 5);
163 _FolderNames.push_back(
"All");
164 _FolderNames.push_back(
"BasicCleanup");
165 _FolderNames.push_back(
"ExtraCleanup");
166 _FolderNames.push_back(
"HcalNoiseFilter");
167 _FolderNames.push_back(
"HcalNoiseFilterTight");
168 _FolderNames.push_back(
"JetIDMinimal");
169 _FolderNames.push_back(
"JetIDLoose");
170 _FolderNames.push_back(
"JetIDTight");
171 _FolderNames.push_back(
"BeamHaloIDTightPass");
172 _FolderNames.push_back(
"BeamHaloIDLoosePass");
173 _FolderNames.push_back(
"Triggers");
174 _FolderNames.push_back(
"PV");
176 for (std::vector<std::string>::const_iterator ic = _FolderNames.begin();
177 ic != _FolderNames.end(); ic++){
178 if (*ic==
"All") bookMESet(DirName+
"/"+*ic);
179 if (_cleanupSelection){
180 if (*ic==
"BasicCleanup") bookMESet(DirName+
"/"+*ic);
181 if (*ic==
"ExtraCleanup") bookMESet(DirName+
"/"+*ic);
184 if (*ic==
"HcalNoiseFilter") bookMESet(DirName+
"/"+*ic);
185 if (*ic==
"HcalNoiseFilterTight") bookMESet(DirName+
"/"+*ic);
186 if (*ic==
"JetIDMinimal") bookMESet(DirName+
"/"+*ic);
187 if (*ic==
"JetIDLoose") bookMESet(DirName+
"/"+*ic);
188 if (*ic==
"JetIDTight") bookMESet(DirName+
"/"+*ic);
189 if (*ic==
"BeamHaloIDTightPass") bookMESet(DirName+
"/"+*ic);
190 if (*ic==
"BeamHaloIDLoosePass") bookMESet(DirName+
"/"+*ic);
191 if (*ic==
"Triggers") bookMESet(DirName+
"/"+*ic);
192 if (*ic==
"PV") bookMESet(DirName+
"/"+*ic);
209 bool bLumiSecPlot=
false;
210 if (DirName.find(
"All")!=std::string::npos) bLumiSecPlot=
true;
212 bookMonitorElement(DirName,bLumiSecPlot);
214 if ( _HighPtJetEventFlag->on() ) {
215 bookMonitorElement(DirName+
"/"+
"HighPtJet",
false);
216 hTriggerName_HighPtJet = _dbe->bookString(
"triggerName_HighPtJet", _hlt_HighPtJet);
219 if ( _LowPtJetEventFlag->on() ) {
220 bookMonitorElement(DirName+
"/"+
"LowPtJet",
false);
221 hTriggerName_LowPtJet = _dbe->bookString(
"triggerName_LowPtJet", _hlt_LowPtJet);
224 if ( _MinBiasEventFlag->on() ) {
225 bookMonitorElement(DirName+
"/"+
"MinBias",
false);
226 hTriggerName_MinBias = _dbe->bookString(
"triggerName_MinBias", _hlt_MinBias);
229 if ( _HighMETEventFlag->on() ) {
230 bookMonitorElement(DirName+
"/"+
"HighMET",
false);
231 hTriggerName_HighMET = _dbe->bookString(
"triggerName_HighMET", _hlt_HighMET);
234 if ( _LowMETEventFlag->on() ) {
235 bookMonitorElement(DirName+
"/"+
"LowMET",
false);
236 hTriggerName_LowMET = _dbe->bookString(
"triggerName_LowMET", _hlt_LowMET);
239 if ( _EleEventFlag->on() ) {
240 bookMonitorElement(DirName+
"/"+
"Ele",
false);
241 hTriggerName_Ele = _dbe->bookString(
"triggerName_Ele", _hlt_Ele);
244 if ( _MuonEventFlag->on() ) {
245 bookMonitorElement(DirName+
"/"+
"Muon",
false);
246 hTriggerName_Muon = _dbe->bookString(
"triggerName_Muon", _hlt_Muon);
254 if (_verbose)
std::cout <<
"bookMonitorElement " << DirName << std::endl;
255 _dbe->setCurrentFolder(DirName);
257 hNevents = _dbe->book1D(
"METTask_Nevents",
"METTask_Nevents" ,1,0,1);
258 hMEx = _dbe->book1D(
"METTask_MEx",
"METTask_MEx" ,500,-500,500);
259 hMEx->setAxisTitle(
"MEx [GeV]",1);
260 hMEy = _dbe->book1D(
"METTask_MEy",
"METTask_MEy" ,500,-500,500);
261 hMEy->setAxisTitle(
"MEy [GeV]",1);
262 hEz = _dbe->book1D(
"METTask_Ez",
"METTask_Ez" ,500,-500,500);
263 hEz->setAxisTitle(
"MEz [GeV]",1);
264 hMETSig = _dbe->book1D(
"METTask_METSig",
"METTask_METSig",51,0,51);
265 hMETSig->setAxisTitle(
"CaloMETSig",1);
266 hMET = _dbe->book1D(
"METTask_MET",
"METTask_MET" ,500,0,1000);
267 hMET->setAxisTitle(
"MET [GeV]",1);
268 hMETPhi = _dbe->book1D(
"METTask_METPhi",
"METTask_METPhi",80,-
TMath::Pi(),
TMath::Pi());
269 hMETPhi->setAxisTitle(
"METPhi [rad]",1);
270 hSumET = _dbe->book1D(
"METTask_SumET",
"METTask_SumET" ,500,0,2000);
271 hSumET->setAxisTitle(
"SumET [GeV]",1);
273 hMET_logx = _dbe->book1D(
"METTask_MET_logx",
"METTask_MET_logx" ,40,-1.,7.);
274 hMET_logx->setAxisTitle(
"log(MET) [GeV]",1);
275 hSumET_logx = _dbe->book1D(
"METTask_SumET_logx",
"METTask_SumET_logx" ,40,-1.,7.);
276 hSumET_logx->setAxisTitle(
"log(SumET) [GeV]",1);
278 hMETIonFeedbck = _dbe->book1D(
"METTask_METIonFeedbck",
"METTask_METIonFeedbck" ,500,0,1000);
279 hMETIonFeedbck->setAxisTitle(
"MET [GeV]",1);
280 hMETHPDNoise = _dbe->book1D(
"METTask_METHPDNoise",
"METTask_METHPDNoise" ,500,0,1000);
281 hMETHPDNoise->setAxisTitle(
"MET [GeV]",1);
282 hMETRBXNoise = _dbe->book1D(
"METTask_METRBXNoise",
"METTask_METRBXNoise" ,500,0,1000);
283 hMETRBXNoise->setAxisTitle(
"MET [GeV]",1);
287 hMExLS = _dbe->book2D(
"METTask_MEx_LS",
"METTask_MEx_LS",200,-200,200,50,0.,500.);
288 hMExLS->setAxisTitle(
"MEx [GeV]",1);
289 hMExLS->setAxisTitle(
"Lumi Section",2);
290 hMEyLS = _dbe->book2D(
"METTask_MEy_LS",
"METTask_MEy_LS",200,-200,200,50,0.,500.);
291 hMEyLS->setAxisTitle(
"MEy [GeV]",1);
292 hMEyLS->setAxisTitle(
"Lumi Section",2);
296 if (theMETCollectionLabel.label() ==
"tcMet" ) {
297 htrkPt = _dbe->book1D(
"METTask_trackPt",
"METTask_trackPt", 50, 0, 500);
298 htrkEta = _dbe->book1D(
"METTask_trackEta",
"METTask_trackEta", 60, -3.0, 3.0);
299 htrkNhits = _dbe->book1D(
"METTask_trackNhits",
"METTask_trackNhits", 50, 0, 50);
300 htrkChi2 = _dbe->book1D(
"METTask_trackNormalizedChi2",
"METTask_trackNormalizedChi2", 20, 0, 20);
301 htrkD0 = _dbe->book1D(
"METTask_trackD0",
"METTask_trackd0", 50, -1, 1);
302 helePt = _dbe->book1D(
"METTask_electronPt",
"METTask_electronPt", 50, 0, 500);
303 heleEta = _dbe->book1D(
"METTask_electronEta",
"METTask_electronEta", 60, -3.0, 3.0);
304 heleHoE = _dbe->book1D(
"METTask_electronHoverE",
"METTask_electronHoverE", 25, 0, 0.5);
305 hmuPt = _dbe->book1D(
"METTask_muonPt",
"METTask_muonPt", 50, 0, 500);
306 hmuEta = _dbe->book1D(
"METTask_muonEta",
"METTask_muonEta", 60, -3.0, 3.0);
307 hmuNhits = _dbe->book1D(
"METTask_muonNhits",
"METTask_muonNhits", 50, 0, 50);
308 hmuChi2 = _dbe->book1D(
"METTask_muonNormalizedChi2",
"METTask_muonNormalizedChi2", 20, 0, 20);
309 hmuD0 = _dbe->book1D(
"METTask_muonD0",
"METTask_muonD0", 50, -1, 1);
312 hMExCorrection = _dbe->book1D(
"METTask_MExCorrection",
"METTask_MExCorrection", 100, -500.0,500.0);
313 hMEyCorrection = _dbe->book1D(
"METTask_MEyCorrection",
"METTask_MEyCorrection", 100, -500.0,500.0);
314 hMuonCorrectionFlag = _dbe->book1D(
"METTask_CorrectionFlag",
"METTask_CorrectionFlag", 5, -0.5, 4.5);
321 if ( _HighPtJetEventFlag->on() ) _HighPtJetEventFlag->initRun( iRun, iSetup );
322 if ( _LowPtJetEventFlag ->on() ) _LowPtJetEventFlag ->initRun( iRun, iSetup );
323 if ( _MinBiasEventFlag ->on() ) _MinBiasEventFlag ->initRun( iRun, iSetup );
324 if ( _HighMETEventFlag ->on() ) _HighMETEventFlag ->initRun( iRun, iSetup );
325 if ( _LowMETEventFlag ->on() ) _LowMETEventFlag ->initRun( iRun, iSetup );
326 if ( _EleEventFlag ->on() ) _EleEventFlag ->initRun( iRun, iSetup );
327 if ( _MuonEventFlag ->on() ) _MuonEventFlag ->initRun( iRun, iSetup );
338 std::string
dirName = _FolderName+_source+
"/";
339 _dbe->setCurrentFolder(dirName);
344 meLumiSec = _dbe->get(
"JetMET/lumisec");
349 tlumisec = meLumiSec->
getTH1F();
350 for (
int i=0;
i<500;
i++){
351 if (tlumisec->GetBinContent(
i+1)) totlsec++;
353 totltime = double(totlsec*90);
356 if (totltime==0.) totltime=1.;
361 for (std::vector<std::string>::const_iterator ic = _FolderNames.begin(); ic != _FolderNames.end(); ic++)
365 DirName = dirName+*ic;
367 makeRatePlot(DirName,totltime);
368 if ( _HighPtJetEventFlag->on() )
369 makeRatePlot(DirName+
"/"+
"triggerName_HighJetPt",totltime);
370 if ( _LowPtJetEventFlag->on() )
371 makeRatePlot(DirName+
"/"+
"triggerName_LowJetPt",totltime);
372 if ( _MinBiasEventFlag->on() )
373 makeRatePlot(DirName+
"/"+
"triggerName_MinBias",totltime);
374 if ( _HighMETEventFlag->on() )
375 makeRatePlot(DirName+
"/"+
"triggerName_HighMET",totltime);
376 if ( _LowMETEventFlag->on() )
377 makeRatePlot(DirName+
"/"+
"triggerName_LowMET",totltime);
378 if ( _EleEventFlag->on() )
379 makeRatePlot(DirName+
"/"+
"triggerName_Ele",totltime);
380 if ( _MuonEventFlag->on() )
381 makeRatePlot(DirName+
"/"+
"triggerName_Muon",totltime);
389 _dbe->setCurrentFolder(DirName);
400 tMETRate = (TH1F*) tMET->Clone(
"METTask_METRate");
401 for (
int i = tMETRate->GetNbinsX()-1;
i>=0;
i--){
402 tMETRate->SetBinContent(
i+1,tMETRate->GetBinContent(
i+2)+tMET->GetBinContent(
i+1));
404 for (
int i = 0;
i<tMETRate->GetNbinsX();
i++){
405 tMETRate->SetBinContent(
i+1,tMETRate->GetBinContent(
i+1)/double(totltime));
408 tMETRate->SetName(
"METTask_METRate");
409 tMETRate->SetTitle(
"METTask_METRate");
410 hMETRate = _dbe->book1D(
"METTask_METRate",tMETRate);
418 if (_verbose)
std::cout <<
"METAnalyzer analyze" << std::endl;
420 std::string
DirName = _FolderName+_source;
438 if(&triggerResults) {
445 int ntrigs = triggerResults.
size();
446 if (_verbose)
std::cout <<
"ntrigs=" << ntrigs << std::endl;
456 for (
unsigned int i=0;
i!=HLTPathsJetMBByName_.size();
i++) {
457 unsigned int triggerIndex = triggerNames.
triggerIndex(HLTPathsJetMBByName_[
i]);
458 if (triggerIndex<triggerResults.
size()) {
459 if (triggerResults.
accept(triggerIndex)) {
465 if (HLTPathsJetMBByName_.size()==0) _trig_JetMB=triggerResults.
size()-1;
478 if ( _HighPtJetEventFlag->on() && _HighPtJetEventFlag->accept( iEvent, iSetup ) )
481 if ( _LowPtJetEventFlag->on() && _LowPtJetEventFlag->accept( iEvent, iSetup ) )
484 if ( _MinBiasEventFlag->on() && _MinBiasEventFlag->accept( iEvent, iSetup ) )
487 if ( _HighMETEventFlag->on() && _HighMETEventFlag->accept( iEvent, iSetup ) )
490 if ( _LowMETEventFlag->on() && _LowMETEventFlag->accept( iEvent, iSetup ) )
493 if ( _EleEventFlag->on() && _EleEventFlag->accept( iEvent, iSetup ) )
496 if ( _MuonEventFlag->on() && _MuonEventFlag->accept( iEvent, iSetup ) )
504 edm::LogInfo(
"MetAnalyzer") <<
"TriggerResults::HLT not found, "
505 "automatically select events";
516 iEvent.
getByLabel(theMETCollectionLabel, metcoll);
519 std::cout<<
"Unable to find MET results for MET collection "<<theMETCollectionLabel<<std::endl;
525 met = &(metcol->front());
532 if (theMETCollectionLabel.label() ==
"tcMet" ) {
536 iEvent.
getByLabel(inputElectronLabel, electron_h);
537 iEvent.
getByLabel(inputBeamSpotLabel, beamSpot_h);
538 iEvent.
getByLabel(
"muonTCMETValueMapProducer" ,
"muCorrData", tcMet_ValueMap_Handle);
540 if(!muon_h.isValid())
edm::LogInfo(
"OutputInfo") <<
"falied to retrieve muon data require by MET Task";
541 if(!track_h.isValid())
edm::LogInfo(
"OutputInfo") <<
"falied to retrieve track data require by MET Task";
542 if(!electron_h.isValid())
edm::LogInfo(
"OutputInfo") <<
"falied to retrieve electron data require by MET Task";
543 if(!beamSpot_h.isValid())
edm::LogInfo(
"OutputInfo") <<
"falied to retrieve beam spot data require by MET Task";
545 bspot = ( beamSpot_h.isValid() ) ? beamSpot_h->position() :
math::XYZPoint(0, 0, 0);
554 iEvent.
getByLabel(HcalNoiseRBXCollectionTag,HRBXCollection);
555 if (!HRBXCollection.
isValid()) {
556 LogDebug(
"") <<
"METAnalyzer: Could not find HcalNoiseRBX Collection" << std::endl;
557 if (_verbose)
std::cout <<
"METAnalyzer: Could not find HcalNoiseRBX Collection" << std::endl;
561 iEvent.
getByLabel(HcalNoiseSummaryTag,HNoiseSummary);
562 if (!HNoiseSummary.
isValid()) {
563 LogDebug(
"") <<
"METAnalyzer: Could not find Hcal NoiseSummary product" << std::endl;
564 if (_verbose)
std::cout <<
"METAnalyzer: Could not find Hcal NoiseSummary product" << std::endl;
568 iEvent.
getByLabel(theJetCollectionLabel, caloJets);
570 LogDebug(
"") <<
"METAnalyzer: Could not find jet product" << std::endl;
571 if (_verbose)
std::cout <<
"METAnalyzer: Could not find jet product" << std::endl;
582 if (_verbose)
std::cout <<
"JetID starts" << std::endl;
587 bool bJetIDMinimal=
true;
588 for (reco::CaloJetCollection::const_iterator cal = caloJets->begin();
589 cal!=caloJets->end(); ++cal){
590 jetID->calculate(iEvent, *cal);
592 if (fabs(cal->eta())<=2.6 &&
593 cal->emEnergyFraction()<=0.01) bJetIDMinimal=
false;
600 bool bJetIDLoose=
true;
601 for (reco::CaloJetCollection::const_iterator cal = caloJets->begin();
602 cal!=caloJets->end(); ++cal){
603 jetID->calculate(iEvent, *cal);
604 if (_verbose)
std::cout << jetID->n90Hits() <<
" "
605 << jetID->restrictedEMF() <<
" "
606 << cal->pt() << std::endl;
610 if (jetID->n90Hits()<2) bJetIDLoose=
false;
611 if (jetID->fHPD()>=0.98) bJetIDLoose=
false;
615 if (fabs(cal->eta())<2.55){
616 if (cal->emEnergyFraction()<=0.01) bJetIDLoose=
false;
620 if (cal->emEnergyFraction()<=-0.9) bJetIDLoose=
false;
622 if (cal->emEnergyFraction()>= 1.0) bJetIDLoose=
false;
631 bool bJetIDTight=
true;
632 bJetIDTight=bJetIDLoose;
633 for (reco::CaloJetCollection::const_iterator cal = caloJets->begin();
634 cal!=caloJets->end(); ++cal){
635 jetID->calculate(iEvent, *cal);
639 if (jetID->fHPD()>=0.95) bJetIDTight=
false;
642 if (fabs(cal->eta())>=1.00 && fabs(cal->eta())<1.75){
643 if (cal->pt()>80. && cal->emEnergyFraction()>=1.) bJetIDTight=
false;
647 else if (fabs(cal->eta())>=1.75 && fabs(cal->eta())<2.55){
648 if (cal->pt()>80. && cal->emEnergyFraction()>=1.) bJetIDTight=
false;
652 else if (fabs(cal->eta())>=2.55 && fabs(cal->eta())<3.25){
653 if (cal->pt()< 50. && cal->emEnergyFraction()<=-0.3) bJetIDTight=
false;
654 if (cal->pt()>=50. && cal->pt()< 80. && cal->emEnergyFraction()<=-0.2) bJetIDTight=
false;
655 if (cal->pt()>=80. && cal->pt()<340. && cal->emEnergyFraction()<=-0.1) bJetIDTight=
false;
656 if (cal->pt()>=340. && cal->emEnergyFraction()<=-0.1
657 && cal->emEnergyFraction()>=0.95) bJetIDTight=
false;
661 else if (fabs(cal->eta())>=3.25){
662 if (cal->pt()< 50. && cal->emEnergyFraction()<=-0.3
663 && cal->emEnergyFraction()>=0.90) bJetIDTight=
false;
664 if (cal->pt()>=50. && cal->pt()<130. && cal->emEnergyFraction()<=-0.2
665 && cal->emEnergyFraction()>=0.80) bJetIDTight=
false;
666 if (cal->pt()>=130. && cal->emEnergyFraction()<=-0.1
667 && cal->emEnergyFraction()>=0.70) bJetIDTight=
false;
672 if (_verbose)
std::cout <<
"JetID ends" << std::endl;
678 bool bHcalNoiseFilter = HNoiseSummary->passLooseNoiseFilter();
679 bool bHcalNoiseFilterTight = HNoiseSummary->passTightNoiseFilter();
684 iEvent.
getByLabel(BeamHaloSummaryTag, TheBeamHaloSummary) ;
686 if (!TheBeamHaloSummary.
isValid()) {
687 std::cout <<
"BeamHaloSummary doesn't exist" << std::endl;
690 bool bBeamHaloIDTightPass =
true;
691 bool bBeamHaloIDLoosePass =
true;
693 if(!TheBeamHaloSummary.
isValid()) {
699 bBeamHaloIDLoosePass =
false;
703 bBeamHaloIDTightPass =
false;
710 bool bPrimaryVertex =
true;
712 bPrimaryVertex =
false;
718 LogDebug(
"") <<
"CaloMETAnalyzer: Could not find vertex collection" << std::endl;
719 if (_verbose)
std::cout <<
"CaloMETAnalyzer: Could not find vertex collection" << std::endl;
724 int vertex_number = vertexCollection.size();
725 VertexCollection::const_iterator
v = vertexCollection.begin();
726 double vertex_chi2 = v->normalizedChi2();
727 double vertex_ndof = v->ndof();
728 bool fakeVtx = v->isFake();
729 double vertex_Z = v->z();
732 && vertex_number>=_nvtx_min
733 && vertex_ndof >_vtxndof_min
734 && vertex_chi2 <_vtxchi2_max
735 && fabs(vertex_Z)<_vtxz_max ) bPrimaryVertex =
true;
743 if (!gtReadoutRecord.
isValid()) {
744 LogDebug(
"") <<
"CaloMETAnalyzer: Could not find GT readout record" << std::endl;
745 if (_verbose)
std::cout <<
"CaloMETAnalyzer: Could not find GT readout record product" << std::endl;
748 bool bTechTriggers =
true;
749 bool bTechTriggersAND =
true;
750 bool bTechTriggersOR =
false;
751 bool bTechTriggersNOT =
false;
753 if (gtReadoutRecord.
isValid()) {
754 const TechnicalTriggerWord& technicalTriggerWordBeforeMask = gtReadoutRecord->technicalTriggerWord();
756 if (_techTrigsAND.size() == 0)
757 bTechTriggersAND =
true;
759 for (
unsigned ttr = 0; ttr != _techTrigsAND.size(); ttr++) {
760 bTechTriggersAND = bTechTriggersAND && technicalTriggerWordBeforeMask.at(_techTrigsAND.at(ttr));
763 if (_techTrigsAND.size() == 0)
764 bTechTriggersOR =
true;
766 for (
unsigned ttr = 0; ttr != _techTrigsOR.size(); ttr++) {
767 bTechTriggersOR = bTechTriggersOR || technicalTriggerWordBeforeMask.at(_techTrigsOR.at(ttr));
769 if (_techTrigsNOT.size() == 0)
770 bTechTriggersNOT =
false;
772 for (
unsigned ttr = 0; ttr != _techTrigsNOT.size(); ttr++) {
773 bTechTriggersNOT = bTechTriggersNOT || technicalTriggerWordBeforeMask.at(_techTrigsNOT.at(ttr));
778 bTechTriggersAND =
true;
779 bTechTriggersOR =
true;
780 bTechTriggersNOT =
false;
783 if (_techTrigsAND.size()==0)
784 bTechTriggersAND =
true;
785 if (_techTrigsOR.size()==0)
786 bTechTriggersOR =
true;
787 if (_techTrigsNOT.size()==0)
788 bTechTriggersNOT =
false;
790 bTechTriggers = bTechTriggersAND && bTechTriggersOR && !bTechTriggersNOT;
795 bool bHcalNoise = bHcalNoiseFilter;
796 bool bBeamHaloID = bBeamHaloIDLoosePass;
799 bool bPhysicsDeclared =
true;
800 if(_doHLTPhysicsOn) bPhysicsDeclared =_trig_PhysDec;
803 if (_tightHcalFiltering) bHcalNoise = bHcalNoiseFilterTight;
804 if (_tightBHFiltering) bBeamHaloID = bBeamHaloIDTightPass;
806 if (_tightJetIDFiltering==1) bJetID = bJetIDMinimal;
807 else if (_tightJetIDFiltering==2) bJetID = bJetIDLoose;
808 else if (_tightJetIDFiltering==3) bJetID = bJetIDTight;
809 else if (_tightJetIDFiltering==-1) bJetID =
true;
811 bool bBasicCleanup = bTechTriggers && bPrimaryVertex && bPhysicsDeclared;
812 bool bExtraCleanup = bBasicCleanup && bHcalNoise && bJetID && bBeamHaloID;
816 for (std::vector<std::string>::const_iterator ic = _FolderNames.begin();
817 ic != _FolderNames.end(); ic++){
818 if (*ic==
"All") fillMESet(iEvent, DirName+
"/"+*ic, *met);
819 if (DCSFilter->filter(iEvent, iSetup)) {
820 if (_cleanupSelection){
821 if (*ic==
"BasicCleanup" && bBasicCleanup) fillMESet(iEvent, DirName+
"/"+*ic, *met);
822 if (*ic==
"ExtraCleanup" && bExtraCleanup) fillMESet(iEvent, DirName+
"/"+*ic, *met);
825 if (*ic==
"HcalNoiseFilter" && bHcalNoiseFilter ) fillMESet(iEvent, DirName+
"/"+*ic, *met);
826 if (*ic==
"HcalNoiseFilterTight" && bHcalNoiseFilterTight ) fillMESet(iEvent, DirName+
"/"+*ic, *met);
827 if (*ic==
"JetIDMinimal" && bJetIDMinimal) fillMESet(iEvent, DirName+
"/"+*ic, *met);
828 if (*ic==
"JetIDLoose" && bJetIDLoose) fillMESet(iEvent, DirName+
"/"+*ic, *met);
829 if (*ic==
"JetIDTight" && bJetIDTight) fillMESet(iEvent, DirName+
"/"+*ic, *met);
830 if (*ic==
"BeamHaloIDTightPass" && bBeamHaloIDTightPass) fillMESet(iEvent, DirName+
"/"+*ic, *met);
831 if (*ic==
"BeamHaloIDLoosePass" && bBeamHaloIDLoosePass) fillMESet(iEvent, DirName+
"/"+*ic, *met);
832 if (*ic==
"Triggers" && bTechTriggers) fillMESet(iEvent, DirName+
"/"+*ic, *met);
833 if (*ic==
"PV" && bPrimaryVertex) fillMESet(iEvent, DirName+
"/"+*ic, *met);
844 _dbe->setCurrentFolder(DirName);
846 bool bLumiSecPlot=
false;
847 if (DirName.find(
"All")) bLumiSecPlot=
true;
849 if (_trig_JetMB) fillMonitorElement(iEvent,DirName,
"",met, bLumiSecPlot);
850 if (_hlt_HighPtJet.size() && _trig_HighPtJet) fillMonitorElement(iEvent,DirName,
"HighPtJet",met,
false);
851 if (_hlt_LowPtJet.size() && _trig_LowPtJet) fillMonitorElement(iEvent,DirName,
"LowPtJet",met,
false);
852 if (_hlt_MinBias.size() && _trig_MinBias) fillMonitorElement(iEvent,DirName,
"MinBias",met,
false);
853 if (_hlt_HighMET.size() && _trig_HighMET) fillMonitorElement(iEvent,DirName,
"HighMET",met,
false);
854 if (_hlt_LowMET.size() && _trig_LowMET) fillMonitorElement(iEvent,DirName,
"LowMET",met,
false);
855 if (_hlt_Ele.size() && _trig_Ele) fillMonitorElement(iEvent,DirName,
"Ele",met,
false);
856 if (_hlt_Muon.size() && _trig_Muon) fillMonitorElement(iEvent,DirName,
"Muon",met,
false);
861 std::string TriggerTypeName,
865 if (TriggerTypeName==
"HighPtJet") {
866 if (!selectHighPtJetEvent(iEvent))
return;
868 else if (TriggerTypeName==
"LowPtJet") {
869 if (!selectLowPtJetEvent(iEvent))
return;
871 else if (TriggerTypeName==
"HighMET") {
872 if (met.
pt()<_highMETThreshold)
return;
874 else if (TriggerTypeName==
"LowMET") {
875 if (met.
pt()<_lowMETThreshold)
return;
877 else if (TriggerTypeName==
"Ele") {
878 if (!selectWElectronEvent(iEvent))
return;
880 else if (TriggerTypeName==
"Muon") {
881 if (!selectWMuonEvent(iEvent))
return;
885 double SumET = met.
sumEt();
886 double METSig = met.
mEtSig();
888 double MET = met.
pt();
889 double MEx = met.
px();
890 double MEy = met.
py();
891 double METPhi = met.
phi();
894 int myLuminosityBlock;
899 if (TriggerTypeName!=
"") DirName = DirName +
"/"+TriggerTypeName;
901 if (_verbose)
std::cout <<
"_etThreshold = " << _etThreshold << std::endl;
902 if (SumET>_etThreshold){
904 hMEx = _dbe->get(DirName+
"/"+
"METTask_MEx");
if (hMEx && hMEx->getRootObject()) hMEx ->Fill(MEx);
905 hMEy = _dbe->get(DirName+
"/"+
"METTask_MEy");
if (hMEy && hMEy->getRootObject()) hMEy ->Fill(MEy);
906 hMET = _dbe->get(DirName+
"/"+
"METTask_MET");
if (hMET && hMET->getRootObject()) hMET ->Fill(MET);
907 hMETPhi = _dbe->get(DirName+
"/"+
"METTask_METPhi");
if (hMETPhi && hMETPhi->getRootObject()) hMETPhi ->Fill(METPhi);
908 hSumET = _dbe->get(DirName+
"/"+
"METTask_SumET");
if (hSumET && hSumET->getRootObject()) hSumET ->Fill(SumET);
909 hMETSig = _dbe->get(DirName+
"/"+
"METTask_METSig");
if (hMETSig && hMETSig->getRootObject()) hMETSig ->Fill(METSig);
910 hEz = _dbe->get(DirName+
"/"+
"METTask_Ez");
if (hEz && hEz->getRootObject()) hEz ->Fill(Ez);
912 hMET_logx = _dbe->get(DirName+
"/"+
"METTask_MET_logx");
if (hMET_logx && hMET_logx->getRootObject()) hMET_logx->Fill(log10(MET));
913 hSumET_logx = _dbe->get(DirName+
"/"+
"METTask_SumET_logx");
if (hSumET_logx && hSumET_logx->getRootObject()) hSumET_logx->Fill(log10(SumET));
915 hMETIonFeedbck = _dbe->get(DirName+
"/"+
"METTask_METIonFeedbck");
if (hMETIonFeedbck && hMETIonFeedbck->getRootObject()) hMETIonFeedbck->Fill(MET);
916 hMETHPDNoise = _dbe->get(DirName+
"/"+
"METTask_METHPDNoise");
if (hMETHPDNoise && hMETHPDNoise->getRootObject()) hMETHPDNoise->Fill(MET);
920 hMExLS = _dbe->get(DirName+
"/"+
"METTask_MExLS");
if (hMExLS && hMExLS->getRootObject()) hMExLS->Fill(MEx,myLuminosityBlock);
921 hMEyLS = _dbe->get(DirName+
"/"+
"METTask_MEyLS");
if (hMEyLS && hMEyLS->getRootObject()) hMEyLS->Fill(MEy,myLuminosityBlock);
926 if (theMETCollectionLabel.label() ==
"tcMet" ) {
928 if(track_h.isValid()) {
930 htrkPt = _dbe->get(DirName+
"/"+
"METTask_trkPt");
if (htrkPt && htrkPt->getRootObject()) htrkPt->Fill( trkit->pt() );
931 htrkEta = _dbe->get(DirName+
"/"+
"METTask_trkEta");
if (htrkEta && htrkEta->getRootObject()) htrkEta->Fill( trkit->eta() );
932 htrkNhits = _dbe->get(DirName+
"/"+
"METTask_trkNhits");
if (htrkNhits && htrkNhits->getRootObject()) htrkNhits->Fill( trkit->numberOfValidHits() );
933 htrkChi2 = _dbe->get(DirName+
"/"+
"METTask_trkChi2");
if (htrkChi2 && htrkChi2->getRootObject()) htrkChi2->Fill( trkit->chi2() / trkit->ndof() );
934 double d0 = -1 * trkit->dxy( bspot );
935 htrkD0 = _dbe->get(DirName+
"/"+
"METTask_trkD0");
if (htrkD0 && htrkD0->getRootObject()) htrkD0->Fill( d0 );
939 if(electron_h.isValid()) {
941 helePt = _dbe->get(DirName+
"/"+
"METTask_helePt");
if (helePt && helePt->getRootObject()) helePt->Fill( eleit->p4().pt() );
942 heleEta = _dbe->get(DirName+
"/"+
"METTask_heleEta");
if (heleEta && heleEta->getRootObject()) heleEta->Fill( eleit->p4().eta() );
943 heleHoE = _dbe->get(DirName+
"/"+
"METTask_heleHoE");
if (heleHoE && heleHoE->getRootObject()) heleHoE->Fill( eleit->hadronicOverEm() );
947 if(muon_h.isValid()) {
948 for( reco::MuonCollection::const_iterator muonit = muon_h->begin(); muonit != muon_h->end(); muonit++ ) {
950 hmuPt = _dbe->
get(DirName+
"/"+
"METTask_muPt");
if (hmuPt && hmuPt->getRootObject()) hmuPt ->Fill( muonit->p4().pt() );
951 hmuEta = _dbe->get(DirName+
"/"+
"METTask_muEta");
if (hmuEta && hmuEta->getRootObject()) hmuEta ->Fill( muonit->p4().eta() );
952 hmuNhits = _dbe->get(DirName+
"/"+
"METTask_muNhits");
if (hmuNhits && hmuNhits->getRootObject()) hmuNhits->Fill( siTrack.
isNonnull() ? siTrack->numberOfValidHits() : -999 );
953 hmuChi2 = _dbe->get(DirName+
"/"+
"METTask_muChi2");
if (hmuChi2 && hmuChi2->getRootObject()) hmuChi2 ->Fill( siTrack.
isNonnull() ? siTrack->chi2()/siTrack->ndof() : -999 );
954 double d0 = siTrack.
isNonnull() ? -1 * siTrack->dxy( bspot) : -999;
955 hmuD0 = _dbe->
get(DirName+
"/"+
"METTask_muD0");
if (hmuD0 && hmuD0->getRootObject()) hmuD0->Fill( d0 );
958 const unsigned int nMuons = muon_h->size();
959 for(
unsigned int mus = 0; mus < nMuons; mus++ ) {
962 hMExCorrection = _dbe->get(DirName+
"/"+
"METTask_MExCorrection");
if (hMExCorrection && hMExCorrection->getRootObject()) hMExCorrection-> Fill(muCorrData.
corrY());
963 hMEyCorrection = _dbe->get(DirName+
"/"+
"METTask_MEyCorrection");
if (hMEyCorrection && hMEyCorrection->getRootObject()) hMEyCorrection-> Fill(muCorrData.
corrX());
964 hMuonCorrectionFlag = _dbe->get(DirName+
"/"+
"METTask_MuonCorrectionFlag");
if (hMuonCorrectionFlag && hMuonCorrectionFlag->getRootObject()) hMuonCorrectionFlag-> Fill(muCorrData.
type());
976 bool return_value=
false;
979 iEvent.
getByLabel(theJetCollectionLabel, caloJets);
981 LogDebug(
"") <<
"METAnalyzer: Could not find jet product" << std::endl;
982 if (_verbose)
std::cout <<
"METAnalyzer: Could not find jet product" << std::endl;
985 for (reco::CaloJetCollection::const_iterator cal = caloJets->begin();
986 cal!=caloJets->end(); ++cal){
987 if (cal->pt()>_highPtJetThreshold){
998 bool return_value=
false;
1001 iEvent.
getByLabel(theJetCollectionLabel, caloJets);
1003 LogDebug(
"") <<
"METAnalyzer: Could not find jet product" << std::endl;
1004 if (_verbose)
std::cout <<
"METAnalyzer: Could not find jet product" << std::endl;
1007 for (reco::CaloJetCollection::const_iterator cal = caloJets->begin();
1008 cal!=caloJets->end(); ++cal){
1009 if (cal->pt()>_lowPtJetThreshold){
1014 return return_value;
1022 bool return_value=
true;
1028 return return_value;
1035 bool return_value=
true;
1041 return return_value;
const bool EcalTightHaloId() const
T getParameter(std::string const &) const
double e_longitudinal() const
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
const bool HcalTightHaloId() const
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
const bool GlobalLooseHaloId() const
const std::string metname
bool accept() const
Has at least one path accepted the event?
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
edm::LuminosityBlockNumber_t luminosityBlock() const
std::vector< Vertex > VertexCollection
collection of Vertex objects
Provides a code based selection for trigger and DCS information in order to have no failing filters i...
Strings::size_type size() const
const bool GlobalTightHaloId() const
const bool HcalLooseHaloId() const
const bool CSCTightHaloId() const
bool isNonnull() const
Checks for non-null.
unsigned int triggerIndex(std::string const &name) const
unsigned int size() const
Get number of paths stored.
std::vector< bool > TechnicalTriggerWord
technical trigger bits (64 bits)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
TObject * getRootObject(void) const
virtual double px() const
x coordinate of momentum vector
virtual double pt() const
transverse momentum
XYZPointD XYZPoint
point in space with cartesian internal representation
TH1F * getTH1F(void) const
T const * product() const
const bool CSCLooseHaloId() const
T const * get() const
Returns C++ pointer to the item.
virtual double phi() const
momentum azimuthal angle
const bool EcalLooseHaloId() const
virtual double py() const
y coordinate of momentum vector
void setCurrentFolder(const std::string &fullpath)