From 21f14fa511ee97b237e0898084e32305cc9d3cda Mon Sep 17 00:00:00 2001 From: Matthew Date: Mon, 24 Mar 2014 16:39:17 +0100 Subject: [PATCH] Added Mht/Ht to energy sums --- .../CaloStage2JetSumAlgorithmFirmwareImp1.cc | 53 +++++++++++++++++-- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/L1Trigger/L1TCalorimeter/src/firmware/CaloStage2JetSumAlgorithmFirmwareImp1.cc b/L1Trigger/L1TCalorimeter/src/firmware/CaloStage2JetSumAlgorithmFirmwareImp1.cc index f0065e225be80..16f9235384d75 100644 --- a/L1Trigger/L1TCalorimeter/src/firmware/CaloStage2JetSumAlgorithmFirmwareImp1.cc +++ b/L1Trigger/L1TCalorimeter/src/firmware/CaloStage2JetSumAlgorithmFirmwareImp1.cc @@ -26,8 +26,55 @@ l1t::CaloStage2JetSumAlgorithmFirmwareImp1::~CaloStage2JetSumAlgorithmFirmwareIm void l1t::CaloStage2JetSumAlgorithmFirmwareImp1::processEvent(const std::vector & jets, std::vector & etsums) { - - - + math::XYZTLorentzVector p4; + int32_t totalHt(0); + int32_t phiMissingHt; + int32_t missingHt; + int32_t coefficientX; + int32_t coefficientY; + int32_t ptJet; + int32_t htXComponent(0); + int32_t htYComponent(0); + int32_t intPhiMissingHt; + const float pi = acos(-1.); + float jetPhi; + + for(size_t jetNr=0;jetNr 28) continue; + if (jets[jetNr].hwPt() < 20) continue; + + ptJet = (jets[jetNr]).hwPt(); + jetPhi=((jets[jetNr]).hwPhi()*5.0-2.5)*pi/180.; + + coefficientX = int32_t(511.*cos(jetPhi)); + coefficientY = int32_t(511.*sin(jetPhi)); + + totalHt += ptJet; + htXComponent += coefficientX*ptJet; + htYComponent += coefficientY*ptJet; + } + + phiMissingHt = -atan2(htYComponent,htXComponent); + + if(phiMissingHt >= 0) + { + intPhiMissingHt = int32_t((36.*(phiMissingHt)+0.5)/pi); + } + else + { + intPhiMissingHt = int32_t((36.*(phiMissingHt+2.*pi)+0.5)/pi); + } + + missingHt = int32_t(sqrt(htXComponent*htXComponent+htYComponent*htYComponent)); + + l1t::EtSum::EtSumType typeTotalHt = l1t::EtSum::EtSumType::kTotalHt; + l1t::EtSum::EtSumType typeMissingHt = l1t::EtSum::EtSumType::kMissingHt; + + l1t::EtSum htSumTotalHt(p4,typeTotalHt,totalHt,0,0,0); + l1t::EtSum htSumMissingHt(p4,typeMissingHt,missingHt,0,intPhiMissingHt,0); + + etsums.push_back(htSumTotalHt); + etsums.push_back(htSumMissingHt); }