Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HF Minimum Bias algorithm to Stage1 Emulator (backport 74X #10695) #10697

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -25,6 +25,18 @@

namespace l1t {

class Stage1Layer2HFMinimumBias : public Stage1Layer2HFBitCountAlgorithm {
public:
Stage1Layer2HFMinimumBias(CaloParamsStage1* params);
virtual ~Stage1Layer2HFMinimumBias();
virtual void processEvent(const std::vector<l1t::CaloRegion> & regions,
const std::vector<l1t::CaloEmCand> & EMCands,
l1t::CaloSpare * spare);

private:
CaloParamsStage1* params_;
};

}

#endif
Expand Up @@ -79,7 +79,7 @@ L1TCaloRCTToUpgradeConverter::produce(edm::Event& iEvent, const edm::EventSetup&

EmCand.setHwIso((int) em->isolated());
//std::cout<<"ISO: "<<EmCand.hwIso()<<" "<<em->isolated()<<std::endl;

// create new format
emcands->push_back( em->bx(), EmCand );

Expand All @@ -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<ROOT::Math::PxPyPzE4D<double> > p4(0,0,0,0);
Expand Down
21 changes: 20 additions & 1 deletion L1Trigger/L1TCalorimeter/plugins/L1TCaloUpgradeToGCTConverter.cc
Expand Up @@ -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");
Expand Down
62 changes: 62 additions & 0 deletions 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<l1t::CaloRegion> & regions,
const std::vector<l1t::CaloEmCand> & EMCands,
l1t::CaloSpare * spare) {

int sumBits[4] = {0,0,0,0};

for(std::vector<CaloRegion>::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;
}
}
Expand Up @@ -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);
}
Expand All @@ -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")
Expand Down