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

Phase2 L1 ParticleFlow #30510

Merged
merged 9 commits into from Jul 3, 2020
1 change: 1 addition & 0 deletions DataFormats/L1Trigger/src/classes_def.xml
Expand Up @@ -261,4 +261,5 @@
<class name="std::vector<l1t::L1DataEmulResult>"/>
<class name="edm::Wrapper<l1t::L1DataEmulResultBxCollection>"/>

<class name="edm::Ptr<l1t::L1Candidate>"/>
</lcgdict>
50 changes: 46 additions & 4 deletions L1Trigger/Configuration/python/SimL1Emulator_cff.py
Expand Up @@ -58,19 +58,42 @@
# soon to be removed when availble in GTs
from L1Trigger.L1TTwinMux.fakeTwinMuxParams_cff import *

# Customisation for the phase2_hgcal era. Includes the HGCAL L1 trigger
from L1Trigger.L1THGCal.hgcalTriggerPrimitives_cff import *
_phase2_siml1emulator = SimL1EmulatorTask.copy()

# ########################################################################
# ########################################################################
#
# Phase-2
#
# ########################################################################
# ########################################################################

# ########################################################################
# Phase-2 Trigger Primitives
# ########################################################################

# HGCAL TP
# ########################################################################
from L1Trigger.L1THGCal.hgcalTriggerPrimitives_cff import *
_phase2_siml1emulator.add(hgcalTriggerPrimitivesTask)

# ########################################################################
# Phase 2 L1T
# ########################################################################

# Barrel and EndCap EGamma
# ########################################################################

#%% # Barrel EGamma
#%% # ########################################################################
from L1Trigger.L1CaloTrigger.L1EGammaCrystalsEmulatorProducer_cfi import *
_phase2_siml1emulator.add(L1EGammaClusterEmuProducer)

from L1Trigger.L1CaloTrigger.l1EGammaEEProducer_cfi import *
_phase2_siml1emulator.add(l1EGammaEEProducer)

# ########################################################################
# Phase-2 L1T - TrackTrigger dependent modules
# ########################################################################

# Tk + StandaloneObj, including L1TkPrimaryVertex
# ########################################################################
from L1Trigger.L1TTrackMatch.L1TkObjectProducers_cff import *
Expand All @@ -90,7 +113,26 @@

_phase2_siml1emulator.add( L1TkMuons )

# PF Candidates
# ########################################################################
from L1Trigger.Phase2L1ParticleFlow.l1ParticleFlow_cff import *
_phase2_siml1emulator.add(l1ParticleFlowTask)

# PF JetMET
# ########################################################################
from L1Trigger.Phase2L1ParticleFlow.l1pfJetMet_cff import *
# Describe here l1PFJets Task
# ###############################
l1PFJetsTask = cms.Task(
ak4PFL1Calo , ak4PFL1PF , ak4PFL1Puppi ,
ak4PFL1CaloCorrected , ak4PFL1PFCorrected , ak4PFL1PuppiCorrected)
_phase2_siml1emulator.add(l1PFJetsTask)
# Describe here l1PFMets Task
# ###############################
l1PFMetsTask = cms.Task(l1PFMetCalo , l1PFMetPF , l1PFMetPuppi)
_phase2_siml1emulator.add(l1PFMetsTask)

# --> add modules
from Configuration.Eras.Modifier_phase2_trigger_cff import phase2_trigger
from Configuration.Eras.Modifier_phase2_trackerV14_cff import phase2_trackerV14
(phase2_trigger & phase2_trackerV14).toReplaceWith( SimL1EmulatorTask , _phase2_siml1emulator)
17 changes: 17 additions & 0 deletions L1Trigger/Phase2L1ParticleFlow/BuildFile.xml
@@ -0,0 +1,17 @@
<use name="FWCore/Framework"/>
<use name="FWCore/ParameterSet"/>
<use name="FWCore/Utilities"/>
<use name="DataFormats/L1TParticleFlow"/>
<use name="CommonTools/BaseParticlePropagator"/>
<use name="FastSimulation/Particle"/>
<use name="DataFormats/ParticleFlowReco"/>

<use name="L1Trigger/L1THGCal"/>
<use name="CommonTools/Utils"/>
<use name="CommonTools/MVAUtils"/>
<use name="roottmva"/>
<use name="hls"/>
<export>
<lib name="1"/>
</export>
<flags ADD_SUBDIR="1"/>
22 changes: 22 additions & 0 deletions L1Trigger/Phase2L1ParticleFlow/interface/BitwisePFAlgo.h
@@ -0,0 +1,22 @@
#ifndef L1Trigger_Phase2L1ParticleFlow_BitwisePFAlgo_h
#define L1Trigger_Phase2L1ParticleFlow_BitwisePFAlgo_h

#include "L1Trigger/Phase2L1ParticleFlow/interface/PFAlgoBase.h"

struct pfalgo_config;

namespace l1tpf_impl {
class BitwisePFAlgo : public PFAlgoBase {
public:
BitwisePFAlgo(const edm::ParameterSet&);
~BitwisePFAlgo() override;
void runPF(Region& r) const override;

protected:
enum class AlgoChoice { algo3, algo2hgc } algo_;
std::shared_ptr<pfalgo_config> config_;
};

} // namespace l1tpf_impl

#endif
44 changes: 44 additions & 0 deletions L1Trigger/Phase2L1ParticleFlow/interface/COEFile.h
@@ -0,0 +1,44 @@
#ifndef L1Trigger_Phase2L1ParticleFlow_CoeFile_h
#define L1Trigger_Phase2L1ParticleFlow_CoeFile_h

// system include files
#include <vector>
#include <string>
#include <numeric>
#include <cstdio>
#include <boost/dynamic_bitset.hpp>
#include <boost/multiprecision/cpp_int.hpp>

// user include files
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "DataFormats/L1TParticleFlow/interface/PFCandidate.h"
#include "L1Trigger/Phase2L1ParticleFlow/interface/DiscretePFInputs.h"
#include "L1Trigger/Phase2L1ParticleFlow/interface/Region.h"

namespace l1tpf_impl {
class COEFile {
public:
COEFile(const edm::ParameterSet&);
~COEFile();

void close() { fclose(file); }
template <typename T>
bool getBit(T value, unsigned bit) {
return (value >> bit) & 1;
}
bool is_open() { return (file != nullptr); }
void writeHeaderToFile();
void writeTracksToFile(const std::vector<Region>& regions, bool print = false);

protected:
FILE* file;
std::string coeFileName, bset_string_;
unsigned int ntracksmax, phiSlices;
static constexpr unsigned int tracksize = 96;
boost::dynamic_bitset<> bset_;
const std::vector<uint32_t> track_word_block_sizes = {14, 1, 12, 16, 12, 13, 4, 3, 7, 14};
int debug_;
};
} // namespace l1tpf_impl

#endif