43 HLTPathsJetMBByName_ =
parameters.getParameter<std::vector<std::string > >(
"HLTPathsJetMB");
62 _verbose =
parameters.getParameter<
int>(
"verbose");
63 _etThreshold =
parameters.getParameter<
double>(
"etThreshold");
64 _allhist =
parameters.getParameter<
bool>(
"allHist");
65 _allSelection=
parameters.getParameter<
bool>(
"allSelection");
67 _highPtTcJetThreshold =
parameters.getParameter<
double>(
"HighPtTcJetThreshold");
68 _lowPtTcJetThreshold =
parameters.getParameter<
double>(
"LowPtTcJetThreshold");
69 _highTcMETThreshold =
parameters.getParameter<
double>(
"HighTcMETThreshold");
70 _lowTcMETThreshold =
parameters.getParameter<
double>(
"LowTcMETThreshold");
80 metME = dbe->
book1D(
"metReco",
"metReco", 4, 1, 5);
85 _FolderNames.push_back(
"All");
86 _FolderNames.push_back(
"Cleanup");
87 _FolderNames.push_back(
"HcalNoiseFilter");
88 _FolderNames.push_back(
"JetID");
89 _FolderNames.push_back(
"JetIDTight");
91 for (std::vector<std::string>::const_iterator ic = _FolderNames.begin();
92 ic != _FolderNames.end(); ic++){
93 if (*ic==
"All") bookMESet(DirName+
"/"+*ic);
94 if (*ic==
"Cleanup") bookMESet(DirName+
"/"+*ic);
96 if (*ic==
"HcalNoiseFilter") bookMESet(DirName+
"/"+*ic);
97 if (*ic==
"JetID") bookMESet(DirName+
"/"+*ic);
98 if (*ic==
"JetIDTight") bookMESet(DirName+
"/"+*ic);
114 bool bLumiSecPlot=
false;
115 if (DirName.find(
"All")!=std::string::npos) bLumiSecPlot=
true;
117 bookMonitorElement(DirName,bLumiSecPlot);
119 if (_hlt_HighPtJet.size()){
120 bookMonitorElement(DirName+
"/"+
"HighPtJet",
false);
121 meTriggerName_HighPtJet = _dbe->bookString(
"triggerName_HighPtJet", _hlt_HighPtJet);
124 if (_hlt_LowPtJet.size()){
125 bookMonitorElement(DirName+
"/"+
"LowPtJet",
false);
126 meTriggerName_LowPtJet = _dbe->bookString(
"triggerName_LowPtJet", _hlt_LowPtJet);
129 if (_hlt_HighMET.size()){
130 bookMonitorElement(DirName+
"/"+
"HighMET",
false);
131 meTriggerName_HighMET = _dbe->bookString(
"triggerName_HighMET", _hlt_HighMET);
139 if (_hlt_Ele.size()){
140 bookMonitorElement(DirName+
"/"+
"Ele",
false);
141 meTriggerName_Ele = _dbe->bookString(
"triggerName_Ele", _hlt_Ele);
144 if (_hlt_Muon.size()){
145 bookMonitorElement(DirName+
"/"+
"Muon",
false);
146 meTriggerName_Muon = _dbe->bookString(
"triggerName_Muon", _hlt_Muon);
155 if (_verbose)
std::cout <<
"booMonitorElement " << DirName << std::endl;
156 _dbe->setCurrentFolder(DirName);
158 meTcMEx = _dbe->book1D(
"METTask_TcMEx",
"METTask_TcMEx", 200, -500, 500);
159 meTcMEy = _dbe->book1D(
"METTask_TcMEy",
"METTask_TcMEy", 200, -500, 500);
160 meTcEz = _dbe->book1D(
"METTask_TcEz",
"METTask_TcEz", 200, -500, 500);
161 meTcMETSig = _dbe->book1D(
"METTask_TcMETSig",
"METTask_TcMETSig", 51, 0, 51);
162 meTcMET = _dbe->book1D(
"METTask_TcMET",
"METTask_TcMET", 200, 0, 1000);
163 meTcMETPhi = _dbe->book1D(
"METTask_TcMETPhi",
"METTask_TcMETPhi", 60, -3.2, 3.2);
164 meTcSumET = _dbe->book1D(
"METTask_TcSumET",
"METTask_TcSumET", 400, 0, 4000);
166 meTcNeutralEMFraction = _dbe->book1D(
"METTask_TcNeutralEMFraction",
"METTask_TcNeutralEMFraction" ,50,0.,1.);
167 meTcNeutralHadFraction = _dbe->book1D(
"METTask_TcNeutralHadFraction",
"METTask_TcNeutralHadFraction",50,0.,1.);
168 meTcChargedEMFraction = _dbe->book1D(
"METTask_TcChargedEMFraction",
"METTask_TcChargedEMFraction" ,50,0.,1.);
169 meTcChargedHadFraction = _dbe->book1D(
"METTask_TcChargedHadFraction",
"METTask_TcChargedHadFraction",50,0.,1.);
170 meTcMuonFraction = _dbe->book1D(
"METTask_TcMuonFraction",
"METTask_TcMuonFraction" ,50,0.,1.);
172 meTcMETIonFeedbck = _dbe->book1D(
"METTask_TcMETIonFeedbck",
"METTask_TcMETIonFeedbck" ,500,0,1000);
173 meTcMETHPDNoise = _dbe->book1D(
"METTask_TcMETHPDNoise",
"METTask_TcMETHPDNoise" ,500,0,1000);
174 meTcMETRBXNoise = _dbe->book1D(
"METTask_TcMETRBXNoise",
"METTask_TcMETRBXNoise" ,500,0,1000);
178 meTcMExLS = _dbe->book2D(
"METTask_TcMEx_LS",
"METTask_TcMEx_LS",200,-200,200,50,0.,500.);
179 meTcMEyLS = _dbe->book2D(
"METTask_TcMEy_LS",
"METTask_TcMEy_LS",200,-200,200,50,0.,500.);
198 _dbe->setCurrentFolder(dirName);
203 meLumiSec = _dbe->get(
"JetMET/lumisec");
208 tlumisec = meLumiSec->
getTH1F();
209 for (
int i=0;
i<500;
i++){
210 if (tlumisec->GetBinContent(
i+1)) totlsec++;
212 totltime = double(totlsec*90);
215 if (totltime==0.) totltime=1.;
220 for (std::vector<std::string>::const_iterator ic = _FolderNames.begin(); ic != _FolderNames.end(); ic++)
224 DirName = dirName+*ic;
226 makeRatePlot(DirName,totltime);
227 if (_hlt_HighPtJet.size()) makeRatePlot(DirName+
"/"+_hlt_HighPtJet,totltime);
228 if (_hlt_LowPtJet.size()) makeRatePlot(DirName+
"/"+_hlt_LowPtJet,totltime);
229 if (_hlt_HighMET.size()) makeRatePlot(DirName+
"/"+_hlt_HighMET,totltime);
231 if (_hlt_Ele.size()) makeRatePlot(DirName+
"/"+_hlt_Ele,totltime);
232 if (_hlt_Muon.size()) makeRatePlot(DirName+
"/"+_hlt_Muon,totltime);
242 _dbe->setCurrentFolder(DirName);
253 tTcMETRate = (TH1F*) tTcMET->Clone(
"METTask_TcMETRate");
254 for (
int i = tTcMETRate->GetNbinsX()-1;
i>=0;
i--){
255 tTcMETRate->SetBinContent(
i+1,tTcMETRate->GetBinContent(
i+2)+tTcMET->GetBinContent(
i+1));
257 for (
int i = 0;
i<tTcMETRate->GetNbinsX();
i++){
258 tTcMETRate->SetBinContent(
i+1,tTcMETRate->GetBinContent(
i+1)/double(totltime));
261 meTcMETRate = _dbe->book1D(
"METTask_TcMETRate",tTcMETRate);
271 if (_verbose)
std::cout <<
"TcMETAnalyzer analyze" << std::endl;
286 if (&triggerResults) {
293 int ntrigs = triggerResults.
size();
294 if (_verbose)
std::cout <<
"ntrigs=" << ntrigs << std::endl;
304 for (
unsigned int i=0;
i!=HLTPathsJetMBByName_.size();
i++) {
305 unsigned int triggerIndex = triggerNames.
triggerIndex(HLTPathsJetMBByName_[
i]);
306 if (triggerIndex<triggerResults.
size()) {
307 if (triggerResults.
accept(triggerIndex)) {
313 if (HLTPathsJetMBByName_.size()==0) _trig_JetMB=triggerResults.
size()-1;
316 if (_verbose)
std::cout <<
"triggerNames size" <<
" " << triggerNames.
size() << std::endl;
317 if (_verbose)
std::cout << _hlt_HighPtJet <<
" " << triggerNames.
triggerIndex(_hlt_HighPtJet) << std::endl;
318 if (_verbose)
std::cout << _hlt_LowPtJet <<
" " << triggerNames.
triggerIndex(_hlt_LowPtJet) << std::endl;
319 if (_verbose)
std::cout << _hlt_HighMET <<
" " << triggerNames.
triggerIndex(_hlt_HighMET) << std::endl;
344 edm::LogInfo(
"TcMetAnalyzer") <<
"TriggerResults::HLT not found, "
345 "automatically select events";
356 iEvent.
getByLabel(theTcMETCollectionLabel, tcmetcoll);
358 if(!tcmetcoll.
isValid())
return;
362 tcmet = &(tcmetcol->front());
369 iEvent.
getByLabel(HcalNoiseRBXCollectionTag,HRBXCollection);
370 if (!HRBXCollection.
isValid()) {
371 LogDebug(
"") <<
"TcMETAnalyzer: Could not find HcalNoiseRBX Collection" << std::endl;
372 if (_verbose)
std::cout <<
"TcMETAnalyzer: Could not find HcalNoiseRBX Collection" << std::endl;
377 iEvent.
getByLabel(HBHENoiseFilterResultTag, HBHENoiseFilterResultHandle);
378 bool HBHENoiseFilterResult = *HBHENoiseFilterResultHandle;
379 if (!HBHENoiseFilterResultHandle.
isValid()) {
380 LogDebug(
"") <<
"TcMETAnalyzer: Could not find HBHENoiseFilterResult" << std::endl;
381 if (_verbose)
std::cout <<
"TcMETAnalyzer: Could not find HBHENoiseFilterResult" << std::endl;
386 iEvent.
getByLabel(theJetCollectionLabel, caloJets);
388 LogDebug(
"") <<
"TcMETAnalyzer: Could not find jet product" << std::endl;
389 if (_verbose)
std::cout <<
"TcMETAnalyzer: Could not find jet product" << std::endl;
400 if (_verbose)
std::cout <<
"JetID starts" << std::endl;
406 for (reco::CaloJetCollection::const_iterator cal = caloJets->begin();
407 cal!=caloJets->end(); ++cal){
408 jetID->calculate(iEvent, *cal);
410 <<
jetID->restrictedEMF() <<
" "
411 << cal->pt() << std::endl;
415 if (
jetID->n90Hits()<2) bJetID=
false;
416 if (
jetID->fHPD()>=0.98) bJetID=
false;
420 if (fabs(cal->eta())<2.55){
421 if (cal->emEnergyFraction()<=0.01) bJetID=
false;
425 if (cal->emEnergyFraction()<=-0.9) bJetID=
false;
427 if (cal->emEnergyFraction()>= 1.0) bJetID=
false;
436 bool bJetIDTight=
true;
438 for (reco::CaloJetCollection::const_iterator cal = caloJets->begin();
439 cal!=caloJets->end(); ++cal){
440 jetID->calculate(iEvent, *cal);
444 if (
jetID->fHPD()>=0.95) bJetIDTight=
false;
447 if (fabs(cal->eta())>=1.00 && fabs(cal->eta())<1.75){
448 if (cal->pt()>80. && cal->emEnergyFraction()>=1.) bJetIDTight=
false;
452 else if (fabs(cal->eta())>=1.75 && fabs(cal->eta())<2.55){
453 if (cal->pt()>80. && cal->emEnergyFraction()>=1.) bJetIDTight=
false;
457 else if (fabs(cal->eta())>=2.55 && fabs(cal->eta())<3.25){
458 if (cal->pt()< 50. && cal->emEnergyFraction()<=-0.3) bJetIDTight=
false;
459 if (cal->pt()>=50. && cal->pt()< 80. && cal->emEnergyFraction()<=-0.2) bJetIDTight=
false;
460 if (cal->pt()>=80. && cal->pt()<340. && cal->emEnergyFraction()<=-0.1) bJetIDTight=
false;
461 if (cal->pt()>=340. && cal->emEnergyFraction()<=-0.1
462 && cal->emEnergyFraction()>=0.95) bJetIDTight=
false;
466 else if (fabs(cal->eta())>=3.25){
467 if (cal->pt()< 50. && cal->emEnergyFraction()<=-0.3
468 && cal->emEnergyFraction()>=0.90) bJetIDTight=
false;
469 if (cal->pt()>=50. && cal->pt()<130. && cal->emEnergyFraction()<=-0.2
470 && cal->emEnergyFraction()>=0.80) bJetIDTight=
false;
471 if (cal->pt()>=130. && cal->emEnergyFraction()<=-0.1
472 && cal->emEnergyFraction()>=0.70) bJetIDTight=
false;
477 if (_verbose)
std::cout <<
"JetID ends" << std::endl;
483 bool bHcalNoiseFilter = HBHENoiseFilterResult;
490 for (std::vector<std::string>::const_iterator ic = _FolderNames.begin();
491 ic != _FolderNames.end(); ic++){
492 if (*ic==
"All") fillMESet(iEvent, DirName+
"/"+*ic, *tcmet);
493 if (*ic==
"Cleanup" && bHcalNoiseFilter && bJetID) fillMESet(iEvent, DirName+
"/"+*ic, *tcmet);
495 if (*ic==
"HcalNoiseFilter" && bHcalNoiseFilter ) fillMESet(iEvent, DirName+
"/"+*ic, *tcmet);
496 if (*ic==
"JetID" && bJetID) fillMESet(iEvent, DirName+
"/"+*ic, *tcmet);
497 if (*ic==
"JetIDTight" && bJetIDTight) fillMESet(iEvent, DirName+
"/"+*ic, *tcmet);
507 _dbe->setCurrentFolder(DirName);
509 bool bLumiSecPlot=
false;
510 if (DirName.find(
"All")) bLumiSecPlot=
true;
512 if (_trig_JetMB) fillMonitorElement(iEvent,DirName,
"",tcmet, bLumiSecPlot);
513 if (_hlt_HighPtJet.size() && _trig_HighPtJet) fillMonitorElement(iEvent,DirName,
"HighPtJet",tcmet,
false);
514 if (_hlt_LowPtJet.size() && _trig_LowPtJet) fillMonitorElement(iEvent,DirName,
"LowPtJet",tcmet,
false);
515 if (_hlt_HighMET.size() && _trig_HighMET) fillMonitorElement(iEvent,DirName,
"HighMET",tcmet,
false);
517 if (_hlt_Ele.size() && _trig_Ele) fillMonitorElement(iEvent,DirName,
"Ele",tcmet,
false);
518 if (_hlt_Muon.size() && _trig_Muon) fillMonitorElement(iEvent,DirName,
"Muon",tcmet,
false);
524 const reco::MET& tcmet,
bool bLumiSecPlot)
527 if (TriggerTypeName==
"HighPtJet") {
528 if (!selectHighPtJetEvent(iEvent))
return;
530 else if (TriggerTypeName==
"LowPtJet") {
531 if (!selectLowPtJetEvent(iEvent))
return;
533 else if (TriggerTypeName==
"HighMET") {
534 if (tcmet.
pt()<_highTcMETThreshold)
return;
539 else if (TriggerTypeName==
"Ele") {
540 if (!selectWElectronEvent(iEvent))
return;
542 else if (TriggerTypeName==
"Muon") {
543 if (!selectWMuonEvent(iEvent))
return;
547 double tcSumET = tcmet.
sumEt();
548 double tcMETSig = tcmet.
mEtSig();
550 double tcMET = tcmet.
pt();
551 double tcMEx = tcmet.
px();
552 double tcMEy = tcmet.
py();
553 double tcMETPhi = tcmet.
phi();
556 int myLuminosityBlock;
561 if (TriggerTypeName!=
"") DirName = DirName +
"/"+TriggerTypeName;
563 if (_verbose)
std::cout <<
"_etThreshold = " << _etThreshold << std::endl;
564 if (tcMET>_etThreshold){
566 meTcMEx = _dbe->get(DirName+
"/"+
"METTask_TcMEx");
if (meTcMEx && meTcMEx->getRootObject()) meTcMEx->Fill(tcMEx);
567 meTcMEy = _dbe->get(DirName+
"/"+
"METTask_TcMEy");
if (meTcMEy && meTcMEy->getRootObject()) meTcMEy->Fill(tcMEy);
568 meTcMET = _dbe->get(DirName+
"/"+
"METTask_TcMET");
if (meTcMET && meTcMET->getRootObject()) meTcMET->Fill(tcMET);
569 meTcMETPhi = _dbe->get(DirName+
"/"+
"METTask_TcMETPhi");
if (meTcMETPhi && meTcMETPhi->getRootObject()) meTcMETPhi->Fill(tcMETPhi);
570 meTcSumET = _dbe->get(DirName+
"/"+
"METTask_TcSumET");
if (meTcSumET && meTcSumET->getRootObject()) meTcSumET->Fill(tcSumET);
571 meTcMETSig = _dbe->get(DirName+
"/"+
"METTask_TcMETSig");
if (meTcMETSig && meTcMETSig->getRootObject()) meTcMETSig->Fill(tcMETSig);
572 meTcEz = _dbe->get(DirName+
"/"+
"METTask_TcEz");
if (meTcEz && meTcEz->getRootObject()) meTcEz->Fill(tcEz);
574 meTcMETIonFeedbck = _dbe->get(DirName+
"/"+
"METTask_TcMETIonFeedbck");
if (meTcMETIonFeedbck && meTcMETIonFeedbck->getRootObject()) meTcMETIonFeedbck->Fill(tcMET);
575 meTcMETHPDNoise = _dbe->get(DirName+
"/"+
"METTask_TcMETHPDNoise");
if (meTcMETHPDNoise && meTcMETHPDNoise->getRootObject()) meTcMETHPDNoise->Fill(tcMET);
576 meTcMETRBXNoise = _dbe->get(DirName+
"/"+
"METTask_TcMETRBXNoise");
if (meTcMETRBXNoise && meTcMETRBXNoise->getRootObject()) meTcMETRBXNoise->Fill(tcMET);
580 meTcMExLS = _dbe->get(DirName+
"/"+
"METTask_TcMExLS");
if (meTcMExLS && meTcMExLS->getRootObject()) meTcMExLS->Fill(tcMEx,myLuminosityBlock);
581 meTcMEyLS = _dbe->get(DirName+
"/"+
"METTask_TcMEyLS");
if (meTcMEyLS && meTcMEyLS->getRootObject()) meTcMEyLS->Fill(tcMEy,myLuminosityBlock);
591 bool return_value=
false;
594 iEvent.
getByLabel(theJetCollectionLabel, caloJets);
596 LogDebug(
"") <<
"TcMETAnalyzer: Could not find jet product" << std::endl;
597 if (_verbose)
std::cout <<
"TcMETAnalyzer: Could not find jet product" << std::endl;
600 for (reco::CaloJetCollection::const_iterator cal = caloJets->begin();
601 cal!=caloJets->end(); ++cal){
602 if (cal->pt()>_highPtTcJetThreshold){
613 bool return_value=
false;
616 iEvent.
getByLabel(theJetCollectionLabel, caloJets);
618 LogDebug(
"") <<
"TcMETAnalyzer: Could not find jet product" << std::endl;
619 if (_verbose)
std::cout <<
"TcMETAnalyzer: Could not find jet product" << std::endl;
622 for (reco::CaloJetCollection::const_iterator cal = caloJets->begin();
623 cal!=caloJets->end(); ++cal){
624 if (cal->pt()>_lowPtTcJetThreshold){
636 bool return_value=
false;
649 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
virtual double py() const GCC11_FINAL
y coordinate of momentum vector
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
unsigned int triggerIndex(std::string const &name) const
unsigned int size() const
Get number of paths stored.
virtual double px() const GCC11_FINAL
x coordinate of momentum vector
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
TObject * getRootObject(void) const
static std::string const triggerResults("TriggerResults")
TH1F * getTH1F(void) const
T const * product() const
virtual float pt() const GCC11_FINAL
transverse momentum
void setCurrentFolder(const std::string &fullpath)