File indexing completed on 2024-04-06 12:21:16
0001 #include "L1Trigger/L1TNtuples/interface/L1AnalysisRecoMet.h"
0002 #include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgo.h"
0003
0004 #include <TVector2.h>
0005
0006 L1Analysis::L1AnalysisRecoMet::L1AnalysisRecoMet() {}
0007
0008 L1Analysis::L1AnalysisRecoMet::~L1AnalysisRecoMet() {}
0009
0010 void L1Analysis::L1AnalysisRecoMet::SetMet(const edm::Handle<reco::CaloMETCollection> recoMet) {
0011 const reco::CaloMETCollection *metCol = recoMet.product();
0012 const reco::CaloMET theMet = metCol->front();
0013
0014 recoMet_.met = theMet.et();
0015 recoMet_.metPhi = theMet.phi();
0016 recoMet_.sumEt = theMet.sumEt();
0017 }
0018
0019 void L1Analysis::L1AnalysisRecoMet::SetHtMht(const edm::Handle<reco::CaloJetCollection> caloJets,
0020 float jetptThreshold) {
0021 float mHx = 0.;
0022 float mHy = 0.;
0023
0024 recoMet_.Ht = 0;
0025 recoMet_.mHt = -999;
0026 recoMet_.mHtPhi = -999;
0027
0028 for (reco::CaloJetCollection::const_iterator calojet = caloJets->begin(); calojet != caloJets->end(); ++calojet) {
0029 if (calojet->pt() > jetptThreshold) {
0030 mHx += -1. * calojet->px();
0031 mHy += -1. * calojet->py();
0032 recoMet_.Ht += calojet->pt();
0033 }
0034 }
0035
0036 TVector2 *tv2 = new TVector2(mHx, mHy);
0037
0038 recoMet_.mHt = tv2->Mod();
0039 recoMet_.mHtPhi = tv2->Phi();
0040 }
0041
0042 void L1Analysis::L1AnalysisRecoMet::SetECALFlags(const edm::ESHandle<EcalChannelStatus> chStatus,
0043 const edm::Handle<EcalRecHitCollection> ebRecHits,
0044 const edm::Handle<EcalRecHitCollection> eeRecHits,
0045 const EcalSeverityLevelAlgo *sevlv) {
0046 int ecalFlag = 0;
0047
0048
0049 for (EcalRecHitCollection::const_iterator rechit = ebRecHits->begin(); rechit != ebRecHits->end(); ++rechit) {
0050 EBDetId eid(rechit->id());
0051
0052
0053
0054
0055
0056 int flag = sevlv->severityLevel(eid, *ebRecHits);
0057 if (flag > ecalFlag)
0058 ecalFlag = flag;
0059 }
0060
0061
0062
0063 recoMet_.ecalFlag = ecalFlag;
0064 }