58 std::vector<edm::EDGetTokenT<l1t::PFClusterCollection>>
emCands_;
59 std::vector<edm::EDGetTokenT<l1t::PFClusterCollection>>
hadCands_;
88 debug_(iConfig.getUntrackedParameter<
int>(
"debug", 0)),
89 useStandaloneMuons_(iConfig.getParameter<
bool>(
"useStandaloneMuons")),
90 useTrackerMuons_(iConfig.getParameter<
bool>(
"useTrackerMuons")),
94 trkPt_(iConfig.getParameter<double>(
"trkPtCut")),
95 trkMaxChi2_(iConfig.getParameter<double>(
"trkMaxChi2")),
96 trkMinStubs_(iConfig.getParameter<unsigned>(
"trkMinStubs")),
99 emPtCut_(iConfig.getParameter<double>(
"emPtCut")),
100 hadPtCut_(iConfig.getParameter<double>(
"hadPtCut")),
104 regionDumpName_(iConfig.getUntrackedParameter<
std::
string>(
"dumpFileName",
"")),
105 regionCOEName_(iConfig.getUntrackedParameter<
std::
string>(
"coeFileName",
"")),
106 fRegionDump_(nullptr),
107 fRegionCOE_(nullptr),
108 neventscoemax_(iConfig.getUntrackedParameter<unsigned
int>(
"neventscoemax_", 0)),
110 debugEta_(iConfig.getUntrackedParameter<double>(
"debugEta", 0)),
111 debugPhi_(iConfig.getUntrackedParameter<double>(
"debugPhi", 0)),
112 debugR_(iConfig.getUntrackedParameter<double>(
"debugR", -1)) {
113 produces<l1t::PFCandidateCollection>(
"PF");
114 produces<l1t::PFCandidateCollection>(
"Puppi");
116 produces<l1t::PFCandidateCollection>(
"EmCalo");
117 produces<l1t::PFCandidateCollection>(
"Calo");
118 produces<l1t::PFCandidateCollection>(
"TK");
119 produces<l1t::PFCandidateCollection>(
"TKVtx");
121 produces<float>(
"z0");
123 for (
const auto&
tag : iConfig.
getParameter<std::vector<edm::InputTag>>(
"emClusters")) {
124 emCands_.push_back(consumes<l1t::PFClusterCollection>(
tag));
126 for (
const auto&
tag : iConfig.
getParameter<std::vector<edm::InputTag>>(
"hadClusters")) {
127 hadCands_.push_back(consumes<l1t::PFClusterCollection>(
tag));
131 if (
algo ==
"PFAlgo3") {
132 l1pfalgo_ = std::make_unique<l1tpf_impl::PFAlgo3>(iConfig);
133 }
else if (
algo ==
"PFAlgo2HGC") {
134 l1pfalgo_ = std::make_unique<l1tpf_impl::PFAlgo2HGC>(iConfig);
135 }
else if (
algo ==
"BitwisePFAlgo") {
136 l1pfalgo_ = std::make_unique<l1tpf_impl::BitwisePFAlgo>(iConfig);
141 if (pualgo ==
"Puppi") {
142 l1pualgo_ = std::make_unique<l1tpf_impl::PuppiAlgo>(iConfig);
143 }
else if (pualgo ==
"LinearizedPuppi") {
144 l1pualgo_ = std::make_unique<l1tpf_impl::LinearizedPuppiAlgo>(iConfig);
153 else if (
vtxAlgo ==
"external") {
164 produces<float>(
label);
203 <<
"Job running with multiple streams, but dump file will have only events on stream zero.";
211 <<
"Job running with multiple streams, but COE file will dump only events on stream zero.";
225 const auto&
tracks = *htracks;
226 for (
unsigned int itk = 0, ntk =
tracks.size(); itk < ntk; ++itk) {
227 const auto& tk =
tracks[itk];
242 "setting useStandaloneMuons=True && useTrackerMuons=True is not to be done, as it would duplicate all muons\n");
248 for (
auto it =
muons->begin(0), ed =
muons->end(0); it != ed; ++it) {
259 for (
auto it =
muons->begin(), ed =
muons->end(); it != ed; ++it) {
271 const auto& calos = *caloHandle;
272 for (
unsigned int ic = 0, nc = calos.size(); ic < nc; ++ic) {
273 const auto&
calo = calos[ic];
282 const auto& calos = *caloHandle;
283 for (
unsigned int ic = 0, nc = calos.size(); ic < nc; ++ic) {
284 const auto&
calo = calos[ic];
322 if (ptsum == 0 ||
vtx.sum() > ptsum) {
328 throw cms::Exception(
"LogicError",
"Inconsistent vertex configuration");
331 iEvent.put(std::make_unique<float>(
z0),
"z0");
337 float genZ = genOrigin.Z();
353 std::vector<float> puGlobals;
355 const std::vector<std::string>& puGlobalNames =
l1pualgo_->puGlobalNames();
356 if (puGlobals.size() != puGlobalNames.size())
357 throw cms::Exception(
"LogicError",
"Mismatch in the number of global pileup inputs");
358 for (
unsigned int i = 0,
n = puGlobalNames.size();
i <
n; ++
i) {
359 iEvent.put(std::make_unique<float>(puGlobals[
i]), puGlobalNames[
i]);
367 l1pualgo_->runNeutralsPU(l1region, -1., puGlobals);
396 iEvent.put(std::make_unique<unsigned>(
value), iLabel);
std::unique_ptr< l1t::PFCandidateCollection > fetchCalo(float ptMin=0.01, bool emcalo=false) const
T getParameter(std::string const &) const
unsigned int neventsproduced_
void addMuon(const l1t::Muon &t)
std::unique_ptr< l1tpf_impl::PFAlgoBase > l1pfalgo_
void writeManyToFile(const std::vector< T > &objs, FILE *file)
std::unique_ptr< std::vector< unsigned > > vecOutput(int type, bool puppi) const
#define DEFINE_FWK_MODULE(type)
const std::string regionDumpName_
constexpr bool isUninitialized() const noexcept
std::unique_ptr< l1t::PFCandidateCollection > fetchTracks(float ptMin=0.01, bool fromPV=false) const
std::pair< unsigned, unsigned > totAndMaxOutput(int type, bool puppi) const
~L1TPFProducer() override
edm::EDGetTokenT< l1t::MuonBxCollection > muCands_
edm::EDGetTokenT< math::XYZPointF > TokGenOrigin_
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float > > XYZPointF
point in space with cartesian internal representation
static const char * outputTypeName(int outputType)
unsigned int neventscoemax_
const std::string regionCOEName_
l1tpf_impl::PUAlgoBase::VertexAlgo vtxAlgo_
static const char * inputTypeName(int inputType)
edm::EDGetTokenT< l1t::TkMuonCollection > tkMuCands_
edm::EDGetTokenT< l1t::PFTrackCollection > tkCands_
std::unique_ptr< l1tpf_impl::COEFile > fRegionCOE_
std::unique_ptr< l1tpf_impl::PUAlgoBase > l1pualgo_
void addUInt(unsigned int value, std::string iLabel, edm::Event &iEvent)
void beginStream(edm::StreamID) override
void addTrack(const l1t::PFTrack &t)
void addCalo(const l1t::PFCluster &t)
std::vector< TkMuon > TkMuonCollection
std::pair< unsigned, unsigned > totAndMaxInput(int type) const
edm::ParameterSet config_
BXVector< Muon > MuonBxCollection
std::unique_ptr< std::vector< unsigned > > vecInput(int type) const
auto const & tracks
cannot be loose
unsigned long long uint64_t
edm::EDGetTokenT< std::vector< l1t::TkPrimaryVertex > > extTkVtx_
std::vector< Region > & regions()
void addEmCalo(const l1t::PFCluster &t)
std::vector< l1t::PFTrack > PFTrackCollection
l1tpf_impl::RegionMapper l1regions_
L1TPFProducer(const edm::ParameterSet &)
std::vector< edm::EDGetTokenT< l1t::PFClusterCollection > > emCands_
Log< level::Warning, false > LogWarning
std::vector< edm::EDGetTokenT< l1t::PFClusterCollection > > hadCands_
void produce(edm::Event &, const edm::EventSetup &) override
std::unique_ptr< l1t::PFCandidateCollection > fetch(bool puppi=true, float ptMin=0.01) const
VertexAlgo
global operations