diff --git a/L1Trigger/L1TCalorimeter/interface/Stage1Layer2HFBitCountAlgorithmImp.h b/L1Trigger/L1TCalorimeter/interface/Stage1Layer2HFBitCountAlgorithmImp.h index 11c9b3ef75364..80f4bc4a81ef7 100644 --- a/L1Trigger/L1TCalorimeter/interface/Stage1Layer2HFBitCountAlgorithmImp.h +++ b/L1Trigger/L1TCalorimeter/interface/Stage1Layer2HFBitCountAlgorithmImp.h @@ -25,6 +25,18 @@ namespace l1t { + class Stage1Layer2HFMinimumBias : public Stage1Layer2HFBitCountAlgorithm { + public: + Stage1Layer2HFMinimumBias(CaloParamsStage1* params); + virtual ~Stage1Layer2HFMinimumBias(); + virtual void processEvent(const std::vector & regions, + const std::vector & EMCands, + l1t::CaloSpare * spare); + + private: + CaloParamsStage1* params_; + }; + } #endif diff --git a/L1Trigger/L1TCalorimeter/plugins/L1TCaloRCTToUpgradeConverter.cc b/L1Trigger/L1TCalorimeter/plugins/L1TCaloRCTToUpgradeConverter.cc index 5310d00691615..98ff410699ddd 100644 --- a/L1Trigger/L1TCalorimeter/plugins/L1TCaloRCTToUpgradeConverter.cc +++ b/L1Trigger/L1TCalorimeter/plugins/L1TCaloRCTToUpgradeConverter.cc @@ -79,7 +79,7 @@ L1TCaloRCTToUpgradeConverter::produce(edm::Event& iEvent, const edm::EventSetup& EmCand.setHwIso((int) em->isolated()); //std::cout<<"ISO: "<isolated()<push_back( em->bx(), EmCand ); @@ -94,7 +94,7 @@ L1TCaloRCTToUpgradeConverter::produce(edm::Event& iEvent, const edm::EventSetup& // double phi = 0.; //math::PtEtaPhiMLorentzVector p4( pt+1.e-6, eta, phi, 0 ); - bool tauVeto = rgn->tauVeto(); + bool tauVeto = rgn->fineGrain(); //equivalent to tauVeto for HB/HE, includes extra info for HF int hwQual = (int) tauVeto; ROOT::Math::LorentzVector > p4(0,0,0,0); diff --git a/L1Trigger/L1TCalorimeter/plugins/L1TCaloUpgradeToGCTConverter.cc b/L1Trigger/L1TCalorimeter/plugins/L1TCaloUpgradeToGCTConverter.cc index 3e4be6bed4ed4..8e0c0306b19f1 100644 --- a/L1Trigger/L1TCalorimeter/plugins/L1TCaloUpgradeToGCTConverter.cc +++ b/L1Trigger/L1TCalorimeter/plugins/L1TCaloUpgradeToGCTConverter.cc @@ -305,10 +305,29 @@ L1TCaloUpgradeToGCTConverter::produce(Event& e, const EventSetup& es) hfRingEtSumResult->push_back(sum); hfRingEtSumResult->resize(1*bxCounter); - //no hfBitCounts yet + } + + bxCounter = 0; + for(int itBX=HfCounts->getFirstBX(); itBX<=HfCounts->getLastBX(); ++itBX){ + + bxCounter++; + L1GctHFBitCounts count = L1GctHFBitCounts::fromGctEmulator(itBX, + 0, + 0, + 0, + 0); + for (CaloSpareBxCollection::const_iterator itCaloSpare = HfCounts->begin(itBX); + itCaloSpare != HfCounts->end(itBX); ++itCaloSpare){ + for(int i = 0; i < 4; i++) + { + count.setBitCount(i, itCaloSpare->GetRing(i)); + } + } + hfBitCountResult->push_back(count); hfBitCountResult->resize(1*bxCounter); } + e.put(isoEmResult,"isoEm"); e.put(nonIsoEmResult,"nonIsoEm"); e.put(cenJetResult,"cenJets"); diff --git a/L1Trigger/L1TCalorimeter/src/firmware/Stage1Layer2HFMinimumBias.cc b/L1Trigger/L1TCalorimeter/src/firmware/Stage1Layer2HFMinimumBias.cc new file mode 100644 index 0000000000000..8f42e536d7415 --- /dev/null +++ b/L1Trigger/L1TCalorimeter/src/firmware/Stage1Layer2HFMinimumBias.cc @@ -0,0 +1,62 @@ +/// +/// \class l1t::Stage1Layer2CentralityAlgorithm +/// +/// \authors: Gian Michele Innocenti +/// R. Alex Barbieri +/// +/// Description: Centrality Algorithm HI + +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "L1Trigger/L1TCalorimeter/interface/Stage1Layer2HFBitCountAlgorithmImp.h" +#include "L1Trigger/L1TCalorimeter/interface/legacyGtHelper.h" + +l1t::Stage1Layer2HFMinimumBias::Stage1Layer2HFMinimumBias(CaloParamsStage1* params) + : params_(params) +{} + + +l1t::Stage1Layer2HFMinimumBias::~Stage1Layer2HFMinimumBias() +{} + + +void l1t::Stage1Layer2HFMinimumBias::processEvent(const std::vector & regions, + const std::vector & EMCands, + l1t::CaloSpare * spare) { + + int sumBits[4] = {0,0,0,0}; + + for(std::vector::const_iterator region = regions.begin(); region != regions.end(); region++) { + switch(region->hwEta() ) + { + case 0: //1- + sumBits[1] += region->hwQual(); + break; + case 1: //2- + sumBits[3] += region->hwQual(); + break; + case 20: //2+ + sumBits[2] += region->hwQual(); + break; + case 21: //1+ + sumBits[0] += region->hwQual(); + break; + default: + break; + } + } + + for(int i = 0; i < 4; i++) + { + if(sumBits[i] > 0x7) + sumBits[i] = 0x7; + + spare->SetRing(i, sumBits[i]); + } + + const bool verbose = false; + if(verbose) + { + std::cout << "HF Bit Counts (HFMinimumBias)" << std::endl; + std::cout << bitset<12>(spare->hwPt()).to_string() << std::endl; + } +} diff --git a/L1Trigger/L1TCalorimeter/src/firmware/Stage1Layer2MainProcessorFirmwareImp1.cc b/L1Trigger/L1TCalorimeter/src/firmware/Stage1Layer2MainProcessorFirmwareImp1.cc index 97e4c2e6b1081..6f52d8926c802 100644 --- a/L1Trigger/L1TCalorimeter/src/firmware/Stage1Layer2MainProcessorFirmwareImp1.cc +++ b/L1Trigger/L1TCalorimeter/src/firmware/Stage1Layer2MainProcessorFirmwareImp1.cc @@ -26,7 +26,7 @@ Stage1Layer2MainProcessorFirmwareImp1::Stage1Layer2MainProcessorFirmwareImp1(con m_jetAlgo = new Stage1Layer2JetAlgorithmImpHI(m_db); //fwv =1 => HI algo m_tauAlgo = new Stage1Layer2SingleTrackHI(m_db); //fwv=1 => single track seed m_hfRingAlgo = new Stage1Layer2CentralityAlgorithm(m_db); - m_hfBitAlgo = NULL; + m_hfBitAlgo = new Stage1Layer2HFMinimumBias(m_db); // m_hfRingAlgo = new Stage1Layer2FlowAlgorithm(m_db); // m_hfBitAlgo = new Stage1Layer2CentralityAlgorithm(m_db); } @@ -46,7 +46,7 @@ Stage1Layer2MainProcessorFirmwareImp1::Stage1Layer2MainProcessorFirmwareImp1(con m_sumAlgo = new Stage1Layer2EtSumAlgorithmImpHW(m_db); m_tauAlgo = new Stage1Layer2TauAlgorithmImpHW(m_db); m_hfRingAlgo = new Stage1Layer2DiTauAlgorithm(m_db); - m_hfBitAlgo = NULL; + m_hfBitAlgo = new Stage1Layer2HFMinimumBias(m_db); } else{ // undefined fwv version edm::LogError("FWVersionError")