Skip to content

Commit

Permalink
Merge pull request cms-sw#10 from mcitron2/l1t-devel-CMSSW_7_1_0_pre2
Browse files Browse the repository at this point in the history
 Added Mht/Ht to energy sums
  • Loading branch information
jimbrooke committed Mar 24, 2014
2 parents 8f2e028 + 21f14fa commit 485e8b6
Showing 1 changed file with 50 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,55 @@ l1t::CaloStage2JetSumAlgorithmFirmwareImp1::~CaloStage2JetSumAlgorithmFirmwareIm

void l1t::CaloStage2JetSumAlgorithmFirmwareImp1::processEvent(const std::vector<l1t::Jet> & jets,
std::vector<l1t::EtSum> & 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<jets.size();jetNr++)
{
if (abs(jets[jetNr].hwEta()) > 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);
}

0 comments on commit 485e8b6

Please sign in to comment.