422 using namespace reco;
430 edm::LogInfo(
"OutputInfo") <<
" failed to retrieve data required by MET Task";
431 edm::LogInfo(
"OutputInfo") <<
" MET Task cannot continue...!";
435 calomet = &(calometcol->front());
441 double caloSumET = calomet->
sumEt();
442 double caloMETSig = calomet->
mEtSig();
443 double caloMET = calomet->
pt();
444 double caloMEx = calomet->
px();
445 double caloMEy = calomet->
py();
446 double caloMETPhi = calomet->
phi();
451 double caloHadEtInHB = calomet->
hadEtInHB();
452 double caloHadEtInHO = calomet->
hadEtInHO();
453 double caloHadEtInHE = calomet->
hadEtInHE();
454 double caloHadEtInHF = calomet->
hadEtInHF();
455 double caloEmEtInEB = calomet->
emEtInEB();
456 double caloEmEtInEE = calomet->
emEtInEE();
457 double caloEmEtInHF = calomet->
emEtInHF();
459 edm::LogInfo(
"OutputInfo") << caloMET <<
" " << caloSumET << std::endl;
460 me[
"hNevents"]->Fill(0.5);
461 me[
"hCaloMEx"]->Fill(caloMEx);
462 me[
"hCaloMEy"]->Fill(caloMEy);
463 me[
"hCaloMET"]->Fill(caloMET);
464 me[
"hCaloMETPhi"]->Fill(caloMETPhi);
465 me[
"hCaloSumET"]->Fill(caloSumET);
466 me[
"hCaloMETSig"]->Fill(caloMETSig);
467 me[
"hCaloMaxEtInEmTowers"]->Fill(caloMaxEtInEMTowers);
468 me[
"hCaloMaxEtInHadTowers"]->Fill(caloMaxEtInHadTowers);
469 me[
"hCaloEtFractionHadronic"]->Fill(caloEtFractionHadronic);
470 me[
"hCaloEmEtFraction"]->Fill(caloEmEtFraction);
471 me[
"hCaloHadEtInHB"]->Fill(caloHadEtInHB);
472 me[
"hCaloHadEtInHO"]->Fill(caloHadEtInHO);
473 me[
"hCaloHadEtInHE"]->Fill(caloHadEtInHE);
474 me[
"hCaloHadEtInHF"]->Fill(caloHadEtInHF);
475 me[
"hCaloEmEtInEB"]->Fill(caloEmEtInEB);
476 me[
"hCaloEmEtInEE"]->Fill(caloEmEtInEE);
477 me[
"hCaloEmEtInHF"]->Fill(caloEmEtInHF);
487 double genMET = genMetTrue->
pt();
488 double genMETPhi = genMetTrue->
phi();
490 me[
"hCaloMETResolution_GenMETTrue"]->Fill( caloMET - genMET );
491 me[
"hCaloMETPhiResolution_GenMETTrue"]->Fill( TMath::ACos( TMath::Cos( caloMETPhi - genMETPhi ) ) );
493 edm::LogInfo(
"OutputInfo") <<
" failed to retrieve data required by MET Task: genMetTrue";
502 double genMET = genMetCalo->
pt();
503 double genMETPhi = genMetCalo->
phi();
505 me[
"hCaloMETResolution_GenMETCalo"]->Fill( caloMET - genMET );
506 me[
"hCaloMETPhiResolution_GenMETCalo"]->Fill( TMath::ACos( TMath::Cos( caloMETPhi - genMETPhi ) ) );
508 edm::LogInfo(
"OutputInfo") <<
" failed to retrieve data required by MET Task: genMetCalo";
522 edm::LogInfo(
"OutputInfo") <<
" failed to retrieve data required by MET Task";
523 edm::LogInfo(
"OutputInfo") <<
" MET Task cannot continue...!";
527 genmet = &(genmetcol->front());
532 double genSumET = genmet->
sumEt();
533 double genMET = genmet->
pt();
534 double genMEx = genmet->
px();
535 double genMEy = genmet->
py();
536 double genMETPhi = genmet->
phi();
537 double genMETSig = genmet->
mEtSig();
552 me[
"hNevents"]->Fill(0);
553 me[
"hGenMEx"]->Fill(genMEx);
554 me[
"hGenMEy"]->Fill(genMEy);
555 me[
"hGenMET"]->Fill(genMET);
556 me[
"hGenMETPhi"]->Fill(genMETPhi);
557 me[
"hGenSumET"]->Fill(genSumET);
558 me[
"hGenMETSig"]->Fill(genMETSig);
561 me[
"hNeutralEMEtFraction"]->Fill( NeutralEMEtFraction );
562 me[
"hNeutralHadEtFraction"]->Fill( NeutralHadEtFraction );
563 me[
"hChargedEMEtFraction"]->Fill( ChargedEMEtFraction );
564 me[
"hChargedHadEtFraction"]->Fill( ChargedHadEtFraction );
565 me[
"hMuonEtFraction"]->Fill( MuonEtFraction );
566 me[
"hInvisibleEtFraction"]->Fill( InvisibleEtFraction );
568 me[
"hNevents"]->Fill(0.5);
576 edm::LogInfo(
"OutputInfo") <<
"falied to retrieve data require by MET Task";
577 edm::LogInfo(
"OutputInfo") <<
"MET Taks cannot continue...!";
583 pfmet = &(pfmetcol->front());
586 double SumET = pfmet->
sumEt();
587 double MET = pfmet->
pt();
588 double MEx = pfmet->
px();
589 double MEy = pfmet->
py();
590 double METPhi = pfmet->
phi();
591 double METSig = pfmet->
mEtSig();
592 me[
"hMEx"]->Fill(MEx);
593 me[
"hMEy"]->Fill(MEy);
594 me[
"hMET"]->Fill(MET);
595 me[
"hMETPhi"]->Fill(METPhi);
596 me[
"hSumET"]->Fill(SumET);
597 me[
"hMETSig"]->Fill(METSig);
598 me[
"hNevents"]->Fill(0.5);
604 const GenMET *genMetTrue = &(genmetcol->front());
605 double genMET = genMetTrue->
pt();
606 double genMETPhi = genMetTrue->
phi();
608 me[
"hMETResolution_GenMETTrue"]->Fill( MET - genMET );
609 me[
"hMETPhiResolution_GenMETTrue"]->Fill( TMath::ACos( TMath::Cos( METPhi - genMETPhi ) ) );
611 edm::LogInfo(
"OutputInfo") <<
" failed to retrieve data required by MET Task: genMetTrue";
619 const GenMET *genMetCalo = &(genmetcol->front());
620 double genMET = genMetCalo->
pt();
621 double genMETPhi = genMetCalo->
phi();
623 me[
"hMETResolution_GenMETCalo"]->Fill( MET - genMET );
624 me[
"hMETPhiResolution_GenMETCalo"]->Fill( TMath::ACos( TMath::Cos( METPhi - genMETPhi ) ) );
626 edm::LogInfo(
"OutputInfo") <<
" failed to retrieve data required by MET Task: genMetCalo";
639 edm::LogInfo(
"OutputInfo") <<
" failed to retrieve data required by MET Task";
640 edm::LogInfo(
"OutputInfo") <<
" MET Task cannot continue...!";
644 met = &(metcol->front());
648 double SumET = met->
sumEt();
649 double MET = met->
pt();
650 double MEx = met->
px();
651 double MEy = met->
py();
652 double METPhi = met->
phi();
653 double METSig = met->
mEtSig();
655 me[
"hMEx"]->Fill(MEx);
656 me[
"hMEy"]->Fill(MEy);
657 me[
"hMET"]->Fill(MET);
658 me[
"hMETPhi"]->Fill(METPhi);
659 me[
"hSumET"]->Fill(SumET);
660 me[
"hMETSig"]->Fill(METSig);
661 me[
"hNevents"]->Fill(0.5);
688 edm::LogInfo(
"OutputInfo") <<
"falied to retrieve data require by MET Task";
689 edm::LogInfo(
"OutputInfo") <<
"MET Taks cannot continue...!";
695 tcMet = &(tcMetcol->front());
699 edm::LogInfo(
"OutputInfo") <<
"falied to retrieve data require by MET Task";
700 edm::LogInfo(
"OutputInfo") <<
"MET Taks cannot continue...!";
706 caloMet = &(caloMetcol->front());
710 edm::LogInfo(
"OutputInfo") <<
"falied to retrieve muon data require by MET Task";
711 edm::LogInfo(
"OutputInfo") <<
"MET Taks cannot continue...!";
716 edm::LogInfo(
"OutputInfo") <<
"falied to retrieve track data require by MET Task";
717 edm::LogInfo(
"OutputInfo") <<
"MET Taks cannot continue...!";
722 edm::LogInfo(
"OutputInfo") <<
"falied to retrieve electron data require by MET Task";
723 edm::LogInfo(
"OutputInfo") <<
"MET Taks cannot continue...!";
728 edm::LogInfo(
"OutputInfo") <<
"falied to retrieve beam spot data require by MET Task";
729 edm::LogInfo(
"OutputInfo") <<
"MET Taks cannot continue...!";
736 double SumET = tcMet->
sumEt();
737 double MET = tcMet->
pt();
738 double MEx = tcMet->
px();
739 double MEy = tcMet->
py();
740 double METPhi = tcMet->
phi();
741 double METSig = tcMet->
mEtSig();
743 me[
"hMEx"]->Fill(MEx);
744 me[
"hMEy"]->Fill(MEy);
745 me[
"hMET"]->Fill(MET);
746 me[
"hMETPhi"]->Fill(METPhi);
747 me[
"hSumET"]->Fill(SumET);
748 me[
"hMETSig"]->Fill(METSig);
749 me[
"hNevents"]->Fill(0.5);
751 double caloMET = caloMet->
pt();
752 double caloMEx = caloMet->
px();
753 double caloMEy = caloMet->
py();
755 me[
"hdMETx"]->Fill(caloMEx-MEx);
756 me[
"hdMETy"]->Fill(caloMEy-MEy);
757 me[
"hdMET"]->Fill(caloMET-MET);
759 unsigned int nTracks = track_h->size();
760 unsigned int nCorrTracks = 0;
761 unsigned int trackCount = 0;
763 for( reco::TrackCollection::const_iterator trkit = track_h->begin(); trkit != track_h->end(); trkit++ ) {
765 me[
"htrkPt"]->Fill( trkit->pt() );
766 me[
"htrkEta"]->Fill( trkit->eta() );
767 me[
"htrkNhits"]->Fill( trkit->numberOfValidHits() );
768 me[
"htrkChi2"]->Fill( trkit->chi2() / trkit->ndof() );
770 double d0 = -1 * trkit->dxy( bspot );
772 me[
"htrkD0"]->Fill( d0 );
774 me[
"htrkQuality"]->Fill( trkit->qualityMask() );
775 me[
"htrkAlgo"]->Fill( trkit->algo() );
776 me[
"htrkPtErr"]->Fill( trkit->ptError() / trkit->pt() );
783 float frac = (float)nCorrTracks / (
float)nTracks;
784 me[
"hfracTrks"]->Fill(frac);
788 me[
"helePt"]->Fill( eleit->p4().pt() );
789 me[
"heleEta"]->Fill( eleit->p4().eta() );
790 me[
"heleHoE"]->Fill( eleit->hadronicOverEm() );
794 unsigned int ele_idx = el_track.
isNonnull() ? el_track.
key() : 99999;
796 if( eleit->hadronicOverEm() < 0.1 && ele_idx < nTracks )
800 me[
"hnEls"]->Fill(nEls);
802 for( reco::MuonCollection::const_iterator muonit = muon_h->begin(); muonit != muon_h->end(); muonit++ ) {
806 me[
"hmuPt"]->Fill( muonit->p4().pt() );
807 me[
"hmuEta"]->Fill( muonit->p4().eta() );
808 me[
"hmuNhits"]->Fill( siTrack.
isNonnull() ? siTrack->numberOfValidHits() : -999 );
809 me[
"hmuChi2"]->Fill( siTrack.
isNonnull() ? siTrack->chi2()/siTrack->ndof() : -999 );
811 double d0 = siTrack.
isNonnull() ? -1 * siTrack->dxy( bspot) : -999;
813 me[
"hmuD0"]->Fill( d0 );
817 iEvent.
getByLabel(
"muonTCMETValueMapProducer" ,
"muCorrData", tcMet_ValueMap_Handle);
820 iEvent.
getByLabel(
"muonMETValueMapProducer" ,
"muCorrData", muon_ValueMap_Handle);
822 const unsigned int nMuons = muon_h->size();
828 for(
unsigned int mus = 0; mus < nMuons; mus++ )
838 me[
"hMuonCorrectionFlag"]->
Fill(type);
840 if( type == 1 || type == 2 || type == 5 ) {
844 muDx += muonCorrData.
corrX() - muref->globalTrack()->px();
845 muDy += muonCorrData.
corrY() - muref->globalTrack()->py();
847 else if( type == 2 ) {
848 muDx += muonCorrData.
corrX() - muref->innerTrack()->px();
849 muDy += muonCorrData.
corrY() - muref->innerTrack()->py();
851 else if( type == 5 ) {
852 muDx += muonCorrData.
corrX() - muref->px();
853 muDy += muonCorrData.
corrY() - muref->py();
860 me[
"hnMus"]->Fill(nMus);
861 me[
"hnMusPis"]->Fill(nMusPis);
862 me[
"hdMUx"]->Fill(muDx);
863 me[
"hdMUy"]->Fill(muDy);
869 const GenMET *genMetTrue = &(genmetcol->front());
870 double genMET = genMetTrue->
pt();
871 double genMETPhi = genMetTrue->
phi();
873 me[
"hMETResolution_GenMETTrue"]->Fill( MET - genMET );
874 me[
"hMETPhiResolution_GenMETTrue"]->Fill( TMath::ACos( TMath::Cos( METPhi - genMETPhi ) ) );
876 edm::LogInfo(
"OutputInfo") <<
" failed to retrieve data required by MET Task: genMetTrue";
884 const GenMET *genMetCalo = &(genmetcol->front());
885 double genMET = genMetCalo->
pt();
886 double genMETPhi = genMetCalo->
phi();
888 me[
"hMETResolution_GenMETCalo"]->Fill( MET - genMET );
889 me[
"hMETPhiResolution_GenMETCalo"]->Fill( TMath::ACos( TMath::Cos( METPhi - genMETPhi ) ) );
891 edm::LogInfo(
"OutputInfo") <<
" failed to retrieve data required by MET Task: genMetCalo";
900 if(! hcorMetGlobalMuonscol.
isValid()){
901 edm::LogInfo(
"OutputInfo") <<
"hcorMetGlobalMuonscol is NOT Valid";
902 edm::LogInfo(
"OutputInfo") <<
"MET Taks continues anyway...!";
907 corMetGlobalMuons = &(corMetGlobalMuonscol->front());
911 double SumET = corMetGlobalMuons->
sumEt();
912 double MET = corMetGlobalMuons->
pt();
913 double MEx = corMetGlobalMuons->
px();
914 double MEy = corMetGlobalMuons->
py();
915 double METPhi = corMetGlobalMuons->
phi();
916 double METSig = corMetGlobalMuons->
mEtSig();
917 me[
"hMEx"]->Fill(MEx);
918 me[
"hMEy"]->Fill(MEy);
919 me[
"hMET"]->Fill(MET);
920 me[
"hMETPhi"]->Fill(METPhi);
921 me[
"hSumET"]->Fill(SumET);
922 me[
"hMETSig"]->Fill(METSig);
923 me[
"hNevents"]->Fill(0.5);
926 iEvent.
getByLabel(
"muonMETValueMapProducer" ,
"muCorrData", corMetGlobalMuons_ValueMap_Handle);
936 edm::LogInfo(
"OutputInfo") <<
"MET Taks continues anyway...!";
941 for( reco::MuonCollection::const_iterator muonit = muon_Handle->begin(); muonit != muon_Handle->end(); muonit++ ) {
946 me[
"hmuPt"]->Fill( muonit->p4().pt() );
947 me[
"hmuEta"]->Fill( muonit->p4().eta() );
948 me[
"hmuNhits"]->Fill( siTrack.
isNonnull() ? siTrack->numberOfValidHits() : -999 );
949 me[
"hmuChi2"]->Fill( siTrack.
isNonnull() ? siTrack->chi2()/siTrack->ndof() : -999 );
951 double d0 = siTrack.
isNonnull() ? -1 * siTrack->dxy( bspot) : -999;
953 me[
"hmuD0"]->Fill( d0 );
955 int nHits = globalTrack.
isNonnull() ? globalTrack->hitPattern().numberOfValidMuonHits() : -999;
957 me[
"hmuSAhits"]->Fill( nHits );
960 const unsigned int nMuons = muon_Handle->size();
961 for(
unsigned int mus = 0; mus < nMuons; mus++ )
968 me[
"hMuonCorrectionFlag"]->
Fill(muCorrData.
type());
975 const GenMET *genMetTrue = &(genmetcol->front());
976 double genMET = genMetTrue->
pt();
977 double genMETPhi = genMetTrue->
phi();
979 me[
"hMETResolution_GenMETTrue"]->Fill( MET - genMET );
980 me[
"hMETPhiResolution_GenMETTrue"]->Fill( TMath::ACos( TMath::Cos( METPhi - genMETPhi ) ) );
982 edm::LogInfo(
"OutputInfo") <<
" failed to retrieve data required by MET Task: genMetTrue";
990 const GenMET *genMetCalo = &(genmetcol->front());
991 double genMET = genMetCalo->
pt();
992 double genMETPhi = genMetCalo->
phi();
994 me[
"hMETResolution_GenMETCalo"]->Fill( MET - genMET );
995 me[
"hMETPhiResolution_GenMETCalo"]->Fill( TMath::ACos( TMath::Cos( METPhi - genMETPhi ) ) );
997 edm::LogInfo(
"OutputInfo") <<
" failed to retrieve data required by MET Task: genMetCalo";
edm::InputTag inputCaloMETLabel_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
edm::InputTag inputTrackLabel_
double maxEtInHadTowers() const
double MuonEtFraction() const
double maxEtInEmTowers() const
edm::InputTag inputElectronLabel_
bool isNonnull() const
Checks for non-null.
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
edm::InputTag inputBeamSpotLabel_
double ChargedEMEtFraction() const
edm::InputTag inputMuonLabel_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
double InvisibleEtFraction() const
double etFractionHadronic() 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
key_type key() const
Accessor for product key.
std::map< std::string, MonitorElement * > me
T const * product() const
double NeutralEMEtFraction() const
double NeutralHadEtFraction() const
bool isGoodTrack(const reco::TrackRef, float d0corr)
edm::InputTag inputMETLabel_
double ChargedHadEtFraction() const
virtual double phi() const
momentum azimuthal angle
virtual double py() const
y coordinate of momentum vector
double emEtFraction() const