Get the analysis.
478 if(&triggerResults) {
485 int ntrigs = triggerResults.
size();
495 const unsigned int nTrig(triggerNames.
size());
496 for (
unsigned int i=0;
i<nTrig;++
i)
517 if (triggerIndex<triggerResults.
size()) {
518 if (triggerResults.
accept(triggerIndex)) {
531 edm::LogInfo(
"PFMetAnalyzer") <<
"TriggerResults::HLT not found, "
532 "automatically select events";
545 if(!pfmetcoll.
isValid())
return;
549 pfmet = &(pfmetcol->front());
557 if (!HRBXCollection.
isValid()) {
558 LogDebug(
"") <<
"PfMETAnalyzer: Could not find HcalNoiseRBX Collection" << std::endl;
559 if (
_verbose)
std::cout <<
"PfMETAnalyzer: Could not find HcalNoiseRBX Collection" << std::endl;
565 bool HBHENoiseFilterResult = *HBHENoiseFilterResultHandle;
566 if (!HBHENoiseFilterResultHandle.
isValid()) {
567 LogDebug(
"") <<
"PFMETAnalyzer: Could not find HBHENoiseFilterResult" << std::endl;
568 if (
_verbose)
std::cout <<
"PFMETAnalyzer: Could not find HBHENoiseFilterResult" << std::endl;
575 LogDebug(
"") <<
"PFMETAnalyzer: Could not find jet product" << std::endl;
576 if (
_verbose)
std::cout <<
"PFMETAnalyzer: Could not find jet product" << std::endl;
582 LogDebug(
"") <<
"PfMETAnalyzer: Could not find pfcandidates product" << std::endl;
583 if (
_verbose)
std::cout <<
"PfMETAnalyzer: Could not find pfcandidates product" << std::endl;
589 LogDebug(
"") <<
"PFMETAnalyzer: Could not find pfjet product" << std::endl;
590 if (
_verbose)
std::cout <<
"PFMETAnalyzer: Could not find pfjet product" << std::endl;
605 bool bJetIDMinimal=
true;
606 for (reco::CaloJetCollection::const_iterator cal = caloJets->begin();
607 cal!=caloJets->end(); ++cal){
610 if (fabs(cal->eta())<=2.6 &&
611 cal->emEnergyFraction()<=0.01) bJetIDMinimal=
false;
618 bool bJetIDLoose=
true;
619 for (reco::CaloJetCollection::const_iterator cal = caloJets->begin();
620 cal!=caloJets->end(); ++cal){
624 << cal->pt() << std::endl;
629 if (
jetID->
fHPD()>=0.98) bJetIDLoose=
false;
633 if (fabs(cal->eta())<2.55){
634 if (cal->emEnergyFraction()<=0.01) bJetIDLoose=
false;
638 if (cal->emEnergyFraction()<=-0.9) bJetIDLoose=
false;
640 if (cal->emEnergyFraction()>= 1.0) bJetIDLoose=
false;
649 bool bJetIDTight=
true;
650 bJetIDTight=bJetIDLoose;
651 for (reco::CaloJetCollection::const_iterator cal = caloJets->begin();
652 cal!=caloJets->end(); ++cal){
657 if (
jetID->
fHPD()>=0.95) bJetIDTight=
false;
660 if (fabs(cal->eta())>=1.00 && fabs(cal->eta())<1.75){
661 if (cal->pt()>80. && cal->emEnergyFraction()>=1.) bJetIDTight=
false;
665 else if (fabs(cal->eta())>=1.75 && fabs(cal->eta())<2.55){
666 if (cal->pt()>80. && cal->emEnergyFraction()>=1.) bJetIDTight=
false;
670 else if (fabs(cal->eta())>=2.55 && fabs(cal->eta())<3.25){
671 if (cal->pt()< 50. && cal->emEnergyFraction()<=-0.3) bJetIDTight=
false;
672 if (cal->pt()>=50. && cal->pt()< 80. && cal->emEnergyFraction()<=-0.2) bJetIDTight=
false;
673 if (cal->pt()>=80. && cal->pt()<340. && cal->emEnergyFraction()<=-0.1) bJetIDTight=
false;
674 if (cal->pt()>=340. && cal->emEnergyFraction()<=-0.1
675 && cal->emEnergyFraction()>=0.95) bJetIDTight=
false;
679 else if (fabs(cal->eta())>=3.25){
680 if (cal->pt()< 50. && cal->emEnergyFraction()<=-0.3
681 && cal->emEnergyFraction()>=0.90) bJetIDTight=
false;
682 if (cal->pt()>=50. && cal->pt()<130. && cal->emEnergyFraction()<=-0.2
683 && cal->emEnergyFraction()>=0.80) bJetIDTight=
false;
684 if (cal->pt()>=130. && cal->emEnergyFraction()<=-0.1
685 && cal->emEnergyFraction()>=0.70) bJetIDTight=
false;
696 bool bHcalNoiseFilter = HBHENoiseFilterResult;
703 bool bBeamHaloIDTightPass =
true;
704 bool bBeamHaloIDLoosePass =
true;
706 if(!TheBeamHaloSummary.
isValid()) {
712 bBeamHaloIDLoosePass =
false;
716 bBeamHaloIDTightPass =
false;
724 bool bPrimaryVertex =
true;
726 bPrimaryVertex =
false;
732 LogDebug(
"") <<
"CaloMETAnalyzer: Could not find vertex collection" << std::endl;
733 if (
_verbose)
std::cout <<
"CaloMETAnalyzer: Could not find vertex collection" << std::endl;
738 int vertex_number = vertexCollection.size();
739 VertexCollection::const_iterator
v = vertexCollection.begin();
740 for ( ; v != vertexCollection.end(); ++
v) {
741 double vertex_chi2 = v->normalizedChi2();
742 double vertex_ndof = v->ndof();
743 bool fakeVtx = v->isFake();
744 double vertex_Z = v->z();
751 bPrimaryVertex =
true;
762 if (!gtReadoutRecord.
isValid()) {
763 LogDebug(
"") <<
"CaloMETAnalyzer: Could not find GT readout record" << std::endl;
764 if (
_verbose)
std::cout <<
"CaloMETAnalyzer: Could not find GT readout record product" << std::endl;
767 bool bTechTriggers =
true;
768 bool bTechTriggersAND =
true;
769 bool bTechTriggersOR =
false;
770 bool bTechTriggersNOT =
false;
772 if (gtReadoutRecord.
isValid()) {
773 const TechnicalTriggerWord& technicalTriggerWordBeforeMask = gtReadoutRecord->technicalTriggerWord();
776 bTechTriggersAND =
true;
779 bTechTriggersAND = bTechTriggersAND && technicalTriggerWordBeforeMask.at(
_techTrigsAND.at(ttr));
783 bTechTriggersOR =
true;
785 for (
unsigned ttr = 0; ttr !=
_techTrigsOR.size(); ttr++) {
786 bTechTriggersOR = bTechTriggersOR || technicalTriggerWordBeforeMask.at(
_techTrigsOR.at(ttr));
789 bTechTriggersNOT =
false;
792 bTechTriggersNOT = bTechTriggersNOT || technicalTriggerWordBeforeMask.at(
_techTrigsNOT.at(ttr));
797 bTechTriggersAND =
true;
798 bTechTriggersOR =
true;
799 bTechTriggersNOT =
false;
803 bTechTriggersAND =
true;
805 bTechTriggersOR =
true;
807 bTechTriggersNOT =
false;
809 bTechTriggers = bTechTriggersAND && bTechTriggersOR && !bTechTriggersNOT;
814 bool bHcalNoise = bHcalNoiseFilter;
815 bool bBeamHaloID = bBeamHaloIDLoosePass;
816 bool bJetID = bJetIDMinimal;
818 bool bPhysicsDeclared =
true;
828 bool bBasicCleanup = bTechTriggers && bPrimaryVertex && bPhysicsDeclared;
829 bool bExtraCleanup = bBasicCleanup && bHcalNoise && bJetID && bBeamHaloID;
833 for (std::vector<std::string>::const_iterator ic =
_FolderNames.begin();
835 if (*ic==
"All")
fillMESet(iEvent, DirName+
"/"+*ic, *pfmet);
838 if (*ic==
"BasicCleanup" && bBasicCleanup)
fillMESet(iEvent, DirName+
"/"+*ic, *pfmet);
839 if (*ic==
"ExtraCleanup" && bExtraCleanup)
fillMESet(iEvent, DirName+
"/"+*ic, *pfmet);
842 if (*ic==
"HcalNoiseFilter" && bHcalNoiseFilter )
fillMESet(iEvent, DirName+
"/"+*ic, *pfmet);
843 if (*ic==
"JetIDMinimal" && bJetIDMinimal)
fillMESet(iEvent, DirName+
"/"+*ic, *pfmet);
844 if (*ic==
"JetIDLoose" && bJetIDLoose)
fillMESet(iEvent, DirName+
"/"+*ic, *pfmet);
845 if (*ic==
"JetIDTight" && bJetIDTight)
fillMESet(iEvent, DirName+
"/"+*ic, *pfmet);
846 if (*ic==
"BeamHaloIDTightPass" && bBeamHaloIDTightPass)
fillMESet(iEvent, DirName+
"/"+*ic, *pfmet);
847 if (*ic==
"BeamHaloIDLoosePass" && bBeamHaloIDLoosePass)
fillMESet(iEvent, DirName+
"/"+*ic, *pfmet);
848 if (*ic==
"Triggers" && bTechTriggers)
fillMESet(iEvent, DirName+
"/"+*ic, *pfmet);
849 if (*ic==
"PV" && bPrimaryVertex)
fillMESet(iEvent, DirName+
"/"+*ic, *pfmet);
const bool EcalTightHaloId() const
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
const bool HcalTightHaloId() const
const bool GlobalLooseHaloId() const
bool accept() const
Has at least one path accepted the event?
std::vector< Vertex > VertexCollection
collection of Vertex objects
Strings::size_type size() const
const bool GlobalTightHaloId() const
double restrictedEMF() const
const bool HcalLooseHaloId() const
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
const bool CSCTightHaloId() const
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
bool filter(const edm::Event &evt, const edm::EventSetup &es)
std::string const & triggerName(unsigned int index) const
T const * product() const
const bool CSCLooseHaloId() const
const bool EcalLooseHaloId() const
void calculate(const edm::Event &event, const reco::CaloJet &jet, const int iDbg=0)