64 std::vector<float> trkChi2Map(nCand, 0);
67 for (
size_t i = 0;
i < trks->size();
i++) {
69 const auto& lostTrack = (*tracks2LT)[trk];
70 if (lostTrack.isNonnull()) {
71 const float nChi2 = trk->normalizedChi2();
72 trkChi2Map.at(lostTrack.key()) = MiniFloatConverter::reduceMantissaToNbitsRounding<roundingPrecision>(nChi2);
76 for (
size_t i = 0;
i < nCand;
i++) {
80 if (cand->charge() == 0 || !cand->hasTrackDetails())
83 const auto& candTrack = (*candidate2PF)[cand]->trackRef();
85 if (candTrack.isNonnull()) {
86 const float nChi2 = candTrack->normalizedChi2();
88 trkChi2Map.at(
i) = MiniFloatConverter::reduceMantissaToNbitsRounding<roundingPrecision>(nChi2);
94 std::unique_ptr<FloatMap> valueMap = std::make_unique<FloatMap>();
96 filler.insert(
candidates, trkChi2Map.begin(), trkChi2Map.end());
105 ->setComment(
"packed candidate input collection");
107 desc.
add<
bool>(
"doLostTracks",
false);
108 descriptions.
add(
"packedPFCandidateTrackChi2", desc);
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
std::vector< pat::PackedCandidate > PackedCandidateCollection
std::vector< Track > TrackCollection
collection of Tracks
const edm::EDGetTokenT< pat::PackedCandidateCollection > candidateToken_
edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > track2LostTrackToken_
edm::EDGetTokenT< edm::Association< reco::PFCandidateCollection > > candidate2PFToken_
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
static void fillDescriptions(edm::ConfigurationDescriptions &)
edm::Ref< pat::PackedCandidateCollection > PackedCandidateRef
bool get(ProductID const &oid, Handle< PROD > &result) const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::ValueMap< float > FloatMap
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
T getParameter(std::string const &) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const edm::EDGetTokenT< reco::TrackCollection > trackToken_
static const uint8_t roundingPrecision
void produce(edm::Event &, const edm::EventSetup &) override
PackedCandidateTrackChi2Producer(const edm::ParameterSet &iConfig)