45 HLTPathsJetMBByName_ =
parameters.getParameter<std::vector<std::string > >(
"HLTPathsJetMB");
47 _hlt_HighPtJet =
parameters.getParameter<std::string>(
"HLT_HighPtJet");
48 _hlt_LowPtJet =
parameters.getParameter<std::string>(
"HLT_LowPtJet");
49 _hlt_HighMET =
parameters.getParameter<std::string>(
"HLT_HighMET");
51 _hlt_Ele =
parameters.getParameter<std::string>(
"HLT_Ele");
52 _hlt_Muon =
parameters.getParameter<std::string>(
"HLT_Muon");
56 _source =
parameters.getParameter<std::string>(
"Source");
64 _verbose =
parameters.getParameter<
int>(
"verbose");
65 _etThreshold =
parameters.getParameter<
double>(
"etThreshold");
66 _allhist =
parameters.getParameter<
bool>(
"allHist");
67 _allSelection=
parameters.getParameter<
bool>(
"allSelection");
69 _highPtTcJetThreshold =
parameters.getParameter<
double>(
"HighPtTcJetThreshold");
70 _lowPtTcJetThreshold =
parameters.getParameter<
double>(
"LowPtTcJetThreshold");
71 _highTcMETThreshold =
parameters.getParameter<
double>(
"HighTcMETThreshold");
72 _lowTcMETThreshold =
parameters.getParameter<
double>(
"LowTcMETThreshold");
79 std::string
DirName =
"JetMET/MET/"+_source;
82 metME = dbe->
book1D(
"metReco",
"metReco", 4, 1, 5);
87 _FolderNames.push_back(
"All");
88 _FolderNames.push_back(
"Cleanup");
89 _FolderNames.push_back(
"HcalNoiseFilter");
90 _FolderNames.push_back(
"JetID");
91 _FolderNames.push_back(
"JetIDTight");
93 for (std::vector<std::string>::const_iterator ic = _FolderNames.begin();
94 ic != _FolderNames.end(); ic++){
95 if (*ic==
"All") bookMESet(DirName+
"/"+*ic);
96 if (*ic==
"Cleanup") bookMESet(DirName+
"/"+*ic);
98 if (*ic==
"HcalNoiseFilter") bookMESet(DirName+
"/"+*ic);
99 if (*ic==
"JetID") bookMESet(DirName+
"/"+*ic);
100 if (*ic==
"JetIDTight") bookMESet(DirName+
"/"+*ic);
116 bool bLumiSecPlot=
false;
117 if (DirName.find(
"All")!=std::string::npos) bLumiSecPlot=
true;
119 bookMonitorElement(DirName,bLumiSecPlot);
121 if (_hlt_HighPtJet.size()){
122 bookMonitorElement(DirName+
"/"+
"HighPtJet",
false);
123 meTriggerName_HighPtJet = _dbe->bookString(
"triggerName_HighPtJet", _hlt_HighPtJet);
126 if (_hlt_LowPtJet.size()){
127 bookMonitorElement(DirName+
"/"+
"LowPtJet",
false);
128 meTriggerName_LowPtJet = _dbe->bookString(
"triggerName_LowPtJet", _hlt_LowPtJet);
131 if (_hlt_HighMET.size()){
132 bookMonitorElement(DirName+
"/"+
"HighMET",
false);
133 meTriggerName_HighMET = _dbe->bookString(
"triggerName_HighMET", _hlt_HighMET);
141 if (_hlt_Ele.size()){
142 bookMonitorElement(DirName+
"/"+
"Ele",
false);
143 meTriggerName_Ele = _dbe->bookString(
"triggerName_Ele", _hlt_Ele);
146 if (_hlt_Muon.size()){
147 bookMonitorElement(DirName+
"/"+
"Muon",
false);
148 meTriggerName_Muon = _dbe->bookString(
"triggerName_Muon", _hlt_Muon);
157 if (_verbose)
std::cout <<
"booMonitorElement " << DirName << std::endl;
158 _dbe->setCurrentFolder(DirName);
160 meTcMEx = _dbe->book1D(
"METTask_TcMEx",
"METTask_TcMEx", 200, -500, 500);
161 meTcMEy = _dbe->book1D(
"METTask_TcMEy",
"METTask_TcMEy", 200, -500, 500);
162 meTcEz = _dbe->book1D(
"METTask_TcEz",
"METTask_TcEz", 200, -500, 500);
163 meTcMETSig = _dbe->book1D(
"METTask_TcMETSig",
"METTask_TcMETSig", 51, 0, 51);
164 meTcMET = _dbe->book1D(
"METTask_TcMET",
"METTask_TcMET", 200, 0, 1000);
165 meTcMETPhi = _dbe->book1D(
"METTask_TcMETPhi",
"METTask_TcMETPhi", 60, -3.2, 3.2);
166 meTcSumET = _dbe->book1D(
"METTask_TcSumET",
"METTask_TcSumET", 400, 0, 4000);
168 meTcNeutralEMFraction = _dbe->book1D(
"METTask_TcNeutralEMFraction",
"METTask_TcNeutralEMFraction" ,50,0.,1.);
169 meTcNeutralHadFraction = _dbe->book1D(
"METTask_TcNeutralHadFraction",
"METTask_TcNeutralHadFraction",50,0.,1.);
170 meTcChargedEMFraction = _dbe->book1D(
"METTask_TcChargedEMFraction",
"METTask_TcChargedEMFraction" ,50,0.,1.);
171 meTcChargedHadFraction = _dbe->book1D(
"METTask_TcChargedHadFraction",
"METTask_TcChargedHadFraction",50,0.,1.);
172 meTcMuonFraction = _dbe->book1D(
"METTask_TcMuonFraction",
"METTask_TcMuonFraction" ,50,0.,1.);
174 meTcMETIonFeedbck = _dbe->book1D(
"METTask_TcMETIonFeedbck",
"METTask_TcMETIonFeedbck" ,500,0,1000);
175 meTcMETHPDNoise = _dbe->book1D(
"METTask_TcMETHPDNoise",
"METTask_TcMETHPDNoise" ,500,0,1000);
176 meTcMETRBXNoise = _dbe->book1D(
"METTask_TcMETRBXNoise",
"METTask_TcMETRBXNoise" ,500,0,1000);
180 meTcMExLS = _dbe->book2D(
"METTask_TcMEx_LS",
"METTask_TcMEx_LS",200,-200,200,50,0.,500.);
181 meTcMEyLS = _dbe->book2D(
"METTask_TcMEy_LS",
"METTask_TcMEy_LS",200,-200,200,50,0.,500.);
199 std::string
dirName =
"JetMET/MET/"+_source+
"/";
200 _dbe->setCurrentFolder(dirName);
205 meLumiSec = _dbe->get(
"JetMET/lumisec");
210 tlumisec = meLumiSec->
getTH1F();
211 for (
int i=0;
i<500;
i++){
212 if (tlumisec->GetBinContent(
i+1)) totlsec++;
214 totltime = double(totlsec*90);
217 if (totltime==0.) totltime=1.;
222 for (std::vector<std::string>::const_iterator ic = _FolderNames.begin(); ic != _FolderNames.end(); ic++)
226 DirName = dirName+*ic;
228 makeRatePlot(DirName,totltime);
229 if (_hlt_HighPtJet.size()) makeRatePlot(DirName+
"/"+_hlt_HighPtJet,totltime);
230 if (_hlt_LowPtJet.size()) makeRatePlot(DirName+
"/"+_hlt_LowPtJet,totltime);
231 if (_hlt_HighMET.size()) makeRatePlot(DirName+
"/"+_hlt_HighMET,totltime);
233 if (_hlt_Ele.size()) makeRatePlot(DirName+
"/"+_hlt_Ele,totltime);
234 if (_hlt_Muon.size()) makeRatePlot(DirName+
"/"+_hlt_Muon,totltime);
244 _dbe->setCurrentFolder(DirName);
255 tTcMETRate = (TH1F*) tTcMET->Clone(
"METTask_TcMETRate");
256 for (
int i = tTcMETRate->GetNbinsX()-1;
i>=0;
i--){
257 tTcMETRate->SetBinContent(
i+1,tTcMETRate->GetBinContent(
i+2)+tTcMET->GetBinContent(
i+1));
259 for (
int i = 0;
i<tTcMETRate->GetNbinsX();
i++){
260 tTcMETRate->SetBinContent(
i+1,tTcMETRate->GetBinContent(
i+1)/double(totltime));
263 meTcMETRate = _dbe->book1D(
"METTask_TcMETRate",tTcMETRate);
273 if (_verbose)
std::cout <<
"TcMETAnalyzer analyze" << std::endl;
288 if (&triggerResults) {
295 int ntrigs = triggerResults.
size();
296 if (_verbose)
std::cout <<
"ntrigs=" << ntrigs << std::endl;
306 for (
unsigned int i=0;
i!=HLTPathsJetMBByName_.size();
i++) {
307 unsigned int triggerIndex = triggerNames.
triggerIndex(HLTPathsJetMBByName_[
i]);
308 if (triggerIndex<triggerResults.
size()) {
309 if (triggerResults.
accept(triggerIndex)) {
315 if (HLTPathsJetMBByName_.size()==0) _trig_JetMB=triggerResults.
size()-1;
318 if (_verbose)
std::cout <<
"triggerNames size" <<
" " << triggerNames.
size() << std::endl;
319 if (_verbose)
std::cout << _hlt_HighPtJet <<
" " << triggerNames.
triggerIndex(_hlt_HighPtJet) << std::endl;
320 if (_verbose)
std::cout << _hlt_LowPtJet <<
" " << triggerNames.
triggerIndex(_hlt_LowPtJet) << std::endl;
321 if (_verbose)
std::cout << _hlt_HighMET <<
" " << triggerNames.
triggerIndex(_hlt_HighMET) << std::endl;
346 edm::LogInfo(
"TcMetAnalyzer") <<
"TriggerResults::HLT not found, "
347 "automatically select events";
358 iEvent.
getByLabel(theTcMETCollectionLabel, tcmetcoll);
360 if(!tcmetcoll.
isValid())
return;
364 tcmet = &(tcmetcol->front());
371 iEvent.
getByLabel(HcalNoiseRBXCollectionTag,HRBXCollection);
372 if (!HRBXCollection.
isValid()) {
373 LogDebug(
"") <<
"TcMETAnalyzer: Could not find HcalNoiseRBX Collection" << std::endl;
374 if (_verbose)
std::cout <<
"TcMETAnalyzer: Could not find HcalNoiseRBX Collection" << std::endl;
379 iEvent.
getByLabel(HBHENoiseFilterResultTag, HBHENoiseFilterResultHandle);
380 bool HBHENoiseFilterResult = *HBHENoiseFilterResultHandle;
381 if (!HBHENoiseFilterResultHandle.
isValid()) {
382 LogDebug(
"") <<
"TcMETAnalyzer: Could not find HBHENoiseFilterResult" << std::endl;
383 if (_verbose)
std::cout <<
"TcMETAnalyzer: Could not find HBHENoiseFilterResult" << std::endl;
388 iEvent.
getByLabel(theJetCollectionLabel, caloJets);
390 LogDebug(
"") <<
"TcMETAnalyzer: Could not find jet product" << std::endl;
391 if (_verbose)
std::cout <<
"TcMETAnalyzer: Could not find jet product" << std::endl;
402 if (_verbose)
std::cout <<
"JetID starts" << std::endl;
408 for (reco::CaloJetCollection::const_iterator cal = caloJets->begin();
409 cal!=caloJets->end(); ++cal){
410 jetID->calculate(iEvent, *cal);
411 if (_verbose)
std::cout << jetID->n90Hits() <<
" "
412 << jetID->restrictedEMF() <<
" "
413 << cal->pt() << std::endl;
417 if (jetID->n90Hits()<2) bJetID=
false;
418 if (jetID->fHPD()>=0.98) bJetID=
false;
422 if (fabs(cal->eta())<2.55){
423 if (cal->emEnergyFraction()<=0.01) bJetID=
false;
427 if (cal->emEnergyFraction()<=-0.9) bJetID=
false;
429 if (cal->emEnergyFraction()>= 1.0) bJetID=
false;
438 bool bJetIDTight=
true;
440 for (reco::CaloJetCollection::const_iterator cal = caloJets->begin();
441 cal!=caloJets->end(); ++cal){
442 jetID->calculate(iEvent, *cal);
446 if (jetID->fHPD()>=0.95) bJetIDTight=
false;
449 if (fabs(cal->eta())>=1.00 && fabs(cal->eta())<1.75){
450 if (cal->pt()>80. && cal->emEnergyFraction()>=1.) bJetIDTight=
false;
454 else if (fabs(cal->eta())>=1.75 && fabs(cal->eta())<2.55){
455 if (cal->pt()>80. && cal->emEnergyFraction()>=1.) bJetIDTight=
false;
459 else if (fabs(cal->eta())>=2.55 && fabs(cal->eta())<3.25){
460 if (cal->pt()< 50. && cal->emEnergyFraction()<=-0.3) bJetIDTight=
false;
461 if (cal->pt()>=50. && cal->pt()< 80. && cal->emEnergyFraction()<=-0.2) bJetIDTight=
false;
462 if (cal->pt()>=80. && cal->pt()<340. && cal->emEnergyFraction()<=-0.1) bJetIDTight=
false;
463 if (cal->pt()>=340. && cal->emEnergyFraction()<=-0.1
464 && cal->emEnergyFraction()>=0.95) bJetIDTight=
false;
468 else if (fabs(cal->eta())>=3.25){
469 if (cal->pt()< 50. && cal->emEnergyFraction()<=-0.3
470 && cal->emEnergyFraction()>=0.90) bJetIDTight=
false;
471 if (cal->pt()>=50. && cal->pt()<130. && cal->emEnergyFraction()<=-0.2
472 && cal->emEnergyFraction()>=0.80) bJetIDTight=
false;
473 if (cal->pt()>=130. && cal->emEnergyFraction()<=-0.1
474 && cal->emEnergyFraction()>=0.70) bJetIDTight=
false;
479 if (_verbose)
std::cout <<
"JetID ends" << std::endl;
485 bool bHcalNoiseFilter = HBHENoiseFilterResult;
490 std::string
DirName =
"JetMET/MET/"+_source;
492 for (std::vector<std::string>::const_iterator ic = _FolderNames.begin();
493 ic != _FolderNames.end(); ic++){
494 if (*ic==
"All") fillMESet(iEvent, DirName+
"/"+*ic, *tcmet);
495 if (*ic==
"Cleanup" && bHcalNoiseFilter && bJetID) fillMESet(iEvent, DirName+
"/"+*ic, *tcmet);
497 if (*ic==
"HcalNoiseFilter" && bHcalNoiseFilter ) fillMESet(iEvent, DirName+
"/"+*ic, *tcmet);
498 if (*ic==
"JetID" && bJetID) fillMESet(iEvent, DirName+
"/"+*ic, *tcmet);
499 if (*ic==
"JetIDTight" && bJetIDTight) fillMESet(iEvent, DirName+
"/"+*ic, *tcmet);
509 _dbe->setCurrentFolder(DirName);
511 bool bLumiSecPlot=
false;
512 if (DirName.find(
"All")) bLumiSecPlot=
true;
514 if (_trig_JetMB) fillMonitorElement(iEvent,DirName,
"",tcmet, bLumiSecPlot);
515 if (_hlt_HighPtJet.size() && _trig_HighPtJet) fillMonitorElement(iEvent,DirName,
"HighPtJet",tcmet,
false);
516 if (_hlt_LowPtJet.size() && _trig_LowPtJet) fillMonitorElement(iEvent,DirName,
"LowPtJet",tcmet,
false);
517 if (_hlt_HighMET.size() && _trig_HighMET) fillMonitorElement(iEvent,DirName,
"HighMET",tcmet,
false);
519 if (_hlt_Ele.size() && _trig_Ele) fillMonitorElement(iEvent,DirName,
"Ele",tcmet,
false);
520 if (_hlt_Muon.size() && _trig_Muon) fillMonitorElement(iEvent,DirName,
"Muon",tcmet,
false);
525 std::string TriggerTypeName,
526 const reco::MET& tcmet,
bool bLumiSecPlot)
529 if (TriggerTypeName==
"HighPtJet") {
530 if (!selectHighPtJetEvent(iEvent))
return;
532 else if (TriggerTypeName==
"LowPtJet") {
533 if (!selectLowPtJetEvent(iEvent))
return;
535 else if (TriggerTypeName==
"HighMET") {
536 if (tcmet.
pt()<_highTcMETThreshold)
return;
541 else if (TriggerTypeName==
"Ele") {
542 if (!selectWElectronEvent(iEvent))
return;
544 else if (TriggerTypeName==
"Muon") {
545 if (!selectWMuonEvent(iEvent))
return;
549 double tcSumET = tcmet.
sumEt();
550 double tcMETSig = tcmet.
mEtSig();
552 double tcMET = tcmet.
pt();
553 double tcMEx = tcmet.
px();
554 double tcMEy = tcmet.
py();
555 double tcMETPhi = tcmet.
phi();
558 int myLuminosityBlock;
563 if (TriggerTypeName!=
"") DirName = DirName +
"/"+TriggerTypeName;
565 if (_verbose)
std::cout <<
"_etThreshold = " << _etThreshold << std::endl;
566 if (tcMET>_etThreshold){
568 meTcMEx = _dbe->get(DirName+
"/"+
"METTask_TcMEx");
if (meTcMEx && meTcMEx->getRootObject()) meTcMEx->Fill(tcMEx);
569 meTcMEy = _dbe->get(DirName+
"/"+
"METTask_TcMEy");
if (meTcMEy && meTcMEy->getRootObject()) meTcMEy->Fill(tcMEy);
570 meTcMET = _dbe->get(DirName+
"/"+
"METTask_TcMET");
if (meTcMET && meTcMET->getRootObject()) meTcMET->Fill(tcMET);
571 meTcMETPhi = _dbe->get(DirName+
"/"+
"METTask_TcMETPhi");
if (meTcMETPhi && meTcMETPhi->getRootObject()) meTcMETPhi->Fill(tcMETPhi);
572 meTcSumET = _dbe->get(DirName+
"/"+
"METTask_TcSumET");
if (meTcSumET && meTcSumET->getRootObject()) meTcSumET->Fill(tcSumET);
573 meTcMETSig = _dbe->get(DirName+
"/"+
"METTask_TcMETSig");
if (meTcMETSig && meTcMETSig->getRootObject()) meTcMETSig->Fill(tcMETSig);
574 meTcEz = _dbe->get(DirName+
"/"+
"METTask_TcEz");
if (meTcEz && meTcEz->getRootObject()) meTcEz->Fill(tcEz);
576 meTcMETIonFeedbck = _dbe->get(DirName+
"/"+
"METTask_TcMETIonFeedbck");
if (meTcMETIonFeedbck && meTcMETIonFeedbck->getRootObject()) meTcMETIonFeedbck->Fill(tcMET);
577 meTcMETHPDNoise = _dbe->get(DirName+
"/"+
"METTask_TcMETHPDNoise");
if (meTcMETHPDNoise && meTcMETHPDNoise->getRootObject()) meTcMETHPDNoise->Fill(tcMET);
578 meTcMETRBXNoise = _dbe->get(DirName+
"/"+
"METTask_TcMETRBXNoise");
if (meTcMETRBXNoise && meTcMETRBXNoise->getRootObject()) meTcMETRBXNoise->Fill(tcMET);
582 meTcMExLS = _dbe->get(DirName+
"/"+
"METTask_TcMExLS");
if (meTcMExLS && meTcMExLS->getRootObject()) meTcMExLS->Fill(tcMEx,myLuminosityBlock);
583 meTcMEyLS = _dbe->get(DirName+
"/"+
"METTask_TcMEyLS");
if (meTcMEyLS && meTcMEyLS->getRootObject()) meTcMEyLS->Fill(tcMEy,myLuminosityBlock);
593 bool return_value=
false;
596 iEvent.
getByLabel(theJetCollectionLabel, caloJets);
598 LogDebug(
"") <<
"TcMETAnalyzer: Could not find jet product" << std::endl;
599 if (_verbose)
std::cout <<
"TcMETAnalyzer: Could not find jet product" << std::endl;
602 for (reco::CaloJetCollection::const_iterator cal = caloJets->begin();
603 cal!=caloJets->end(); ++cal){
604 if (cal->pt()>_highPtTcJetThreshold){
615 bool return_value=
false;
618 iEvent.
getByLabel(theJetCollectionLabel, caloJets);
620 LogDebug(
"") <<
"TcMETAnalyzer: Could not find jet product" << std::endl;
621 if (_verbose)
std::cout <<
"TcMETAnalyzer: Could not find jet product" << std::endl;
624 for (reco::CaloJetCollection::const_iterator cal = caloJets->begin();
625 cal!=caloJets->end(); ++cal){
626 if (cal->pt()>_lowPtTcJetThreshold){
638 bool return_value=
false;
651 bool return_value=
false;
double e_longitudinal() const
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
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
Strings::size_type size() const
unsigned int triggerIndex(std::string const &name) const
unsigned int size() const
Get number of paths stored.
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
TH1F * getTH1F(void) const
T const * product() const
virtual double phi() const
momentum azimuthal angle
virtual double py() const
y coordinate of momentum vector
void setCurrentFolder(const std::string &fullpath)