25 produces<edm::ValueMap<float>>(
"muonBSConstrainedPt");
26 produces<edm::ValueMap<float>>(
"muonBSConstrainedPtErr");
27 produces<edm::ValueMap<float>>(
"muonBSConstrainedChi2");
37 ->setComment(
"Primary vertex collection");
52 std::vector<float>
pts, ptErrs, chi2s;
54 ptErrs.reserve(
muons->size());
55 chi2s.reserve(
muons->size());
60 double BeamWidthX = beamSpotHandle->
BeamWidthX();
62 double BeamWidthY = beamSpotHandle->
BeamWidthY();
67 if ((BeamWidthXError / BeamWidthX < 0.3) && (BeamWidthYError / BeamWidthY < 0.3)) {
70 if (std::get<0>(btft)) {
72 pts.push_back(trkBS.
pt());
73 ptErrs.push_back(trkBS.
ptError());
74 chi2s.push_back(std::get<2>(btft));
85 if (pvHandle.
isValid() && !pvHandle->empty()) {
86 auto pv = pvHandle->at(0);
90 if (std::get<0>(btft)) {
92 pts.push_back(trkBS.
pt());
93 ptErrs.push_back(trkBS.
ptError());
94 chi2s.push_back(std::get<2>(btft));
103 ptErrs.push_back(
muon.bestTrack()->ptError());
104 chi2s.push_back(-1.
f);
113 event.put(
std::move(valueMap),
"muonBSConstrainedPt");
119 filler.insert(
muons, ptErrs.begin(), ptErrs.end());
121 event.put(
std::move(valueMap),
"muonBSConstrainedPtErr");
129 event.put(
std::move(valueMap),
"muonBSConstrainedChi2");
double BeamWidthX() const
beam width X
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
void produce(edm::StreamID streamID, edm::Event &event, const edm::EventSetup &setup) const override
double BeamWidthYError() const
error on beam width Y, assume error in X = Y
double ptError() const
error on Pt (set to 1000 TeV if charge==0 for safety)
std::tuple< bool, reco::TransientTrack, float > BTFtuple
Global3DPoint GlobalPoint
GlobalErrorBase< double, ErrorMatrixTag > GlobalError
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > ttbToken_
std::vector< Vertex > VertexCollection
std::vector< Muon > MuonCollection
collection of Muon objects
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
BTFtuple constrain(const reco::TransientTrack &track, const GlobalPoint &priorPos, const GlobalError &priorError) const
reco::TransientTrack build(const reco::Track *p) const
static const double pts[33]
double pt() const
track transverse momentum
MuonBeamspotConstraintValueMapProducer(const edm::ParameterSet &config)
double BeamWidthY() const
beam width Y
#define DEFINE_FWK_MODULE(type)
SingleTrackVertexConstraint stvc
edm::EDGetTokenT< pat::MuonCollection > muonToken_
double BeamWidthXError() const
error on beam width X, assume error in X = Y
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::EDGetTokenT< reco::VertexCollection > PrimaryVertexToken_
~MuonBeamspotConstraintValueMapProducer() override=default