|
|
Go to the documentation of this file.
34 produces<std::vector<T>>();
46 desc.add<
bool>(
"computeMiniIso",
false)->setComment(
"Recompute miniIsolation");
47 desc.add<
bool>(
"fixDxySign",
false)->setComment(
"Fix the IP sign");
49 ->setComment(
"PackedCandidate collection used for miniIso");
51 desc.add<
bool>(
"recomputeMuonBasicSelectors",
false)
52 ->setComment(
"Recompute basic cut-based muon selector flags");
53 desc.addOptional<std::vector<double>>(
"miniIsoParams")
54 ->setComment(
"Parameters used for miniIso (as in PATMuonProducer)");
55 descriptions.
add(
"muonsUpdated",
desc);
57 desc.addOptional<std::vector<double>>(
"miniIsoParamsB")
58 ->setComment(
"Parameters used for miniIso in the barrel (as in PATElectronProducer)");
59 desc.addOptional<std::vector<double>>(
"miniIsoParamsE")
60 ->setComment(
"Parameters used for miniIso in the endcap (as in PATElectronProducer)");
61 descriptions.
add(
"electronsUpdated",
desc);
70 throw cms::Exception(
"ParameterError",
"miniIsoParams must have exactly 9 elements.\n");
104 miniIsoParams_[0] = iConfig.
getParameter<std::vector<double>>(
"miniIsoParamsB");
105 miniIsoParams_[1] = iConfig.
getParameter<std::vector<double>>(
"miniIsoParamsE");
106 if (miniIsoParams_[0].
size() != 9)
107 throw cms::Exception(
"ParameterError",
"miniIsoParamsB must have exactly 9 elements.\n");
108 if (miniIsoParams_[1].
size() != 9)
109 throw cms::Exception(
"ParameterError",
"miniIsoParamsE must have exactly 9 elements.\n");
113 return miniIsoParams_[lep.
isEE()];
116 template <
typename T>
119 const bool do_hip_mitigation_2016)
const {}
124 const bool do_hip_mitigation_2016)
const {
130 template <
typename T>
141 iEvent.getByToken(pcToken_, pc);
144 iEvent.getByToken(beamLineToken_, beamSpotHandle);
146 bool beamSpotIsValid =
false;
147 if (beamSpotHandle.
isValid()) {
149 beamSpotIsValid =
true;
151 edm::LogError(
"DataNotAvailable") <<
"No beam spot available \n";
154 std::unique_ptr<std::vector<T>>
out(
new std::vector<T>(*
src));
156 const bool do_hip_mitigation_2016 =
157 recomputeMuonBasicSelectors_ && (272728 <=
iEvent.run() &&
iEvent.run() <= 278808);
159 for (
unsigned int i = 0,
n =
src->size();
i <
n; ++
i) {
162 if (computeMiniIso_) {
175 lep.setMiniPFIsolation(miniiso);
177 if (recomputeMuonBasicSelectors_)
183 if (beamSpotIsValid) {
184 if constexpr (std::is_same_v<T, pat::Electron>)
185 signBS = copysign(1., lep.gsfTrack()->dxy(
beamSpot));
187 signBS = copysign(1., lep.bestTrack()->dxy(
beamSpot));
189 if constexpr (std::is_same_v<T, pat::Electron>)
190 signPV = copysign(1., lep.gsfTrack()->dxy(
pv.position()));
192 signPV = copysign(1., lep.bestTrack()->dxy(
pv.position()));
193 lep.setDB(
abs(lep.dB(T::PV2D)) * signPV, lep.edB(T::PV2D), T::PV2D);
194 lep.setDB(
abs(lep.dB(T::BS2D)) * signBS, lep.edB(T::BS2D), T::BS2D);
edm::EDGetTokenT< std::vector< T > > src_
edm::EDGetTokenT< std::vector< reco::Vertex > > vertices_
reco::TrackRef muonBestTrack() const override
Track selected to be the best measurement of the muon parameters (including PFlow global information)
const std::vector< double > & miniIsoParams(const T &lep) const
T const * product() const
~LeptonUpdater() override
recomputeMuonBasicSelectors
std::vector< double > miniIsoParams_[2]
reco::GsfTrackRef gsfTrack() const override
override the reco::GsfElectron::gsfTrack method, to access the internal storage of the supercluster
void produce(edm::StreamID, edm::Event &, edm::EventSetup const &) const override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Analysis-level muon class.
void setDB(double dB, double edB, IPTYPE type)
Set impact parameter of a certain type and its uncertainty.
#define DEFINE_FWK_MODULE(type)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
PFIsolation getMiniPFIsolation(const pat::PackedCandidateCollection *pfcands, const reco::Candidate::PolarLorentzVector &p4, float mindr=0.05, float maxdr=0.2, float kt_scale=10.0, float ptthresh=0.5, float deadcone_ch=0.0001, float deadcone_pu=0.01, float deadcone_ph=0.01, float deadcone_nh=0.01, float dZ_cut=0.0)
pat::LeptonUpdater< pat::Muon > PATMuonUpdater
void setDB(double dB, double edB, IPTYPE type=PV2D)
LeptonUpdater(const edm::ParameterSet &iConfig)
void recomputeMuonBasicSelectors(T &, const reco::Vertex &, const bool) const
edm::EDGetTokenT< reco::BeamSpot > beamLineToken_
bool recomputeMuonBasicSelectors_
Log< level::Error, false > LogError
edm::EDGetTokenT< pat::PackedCandidateCollection > pcToken_
reco::Muon::Selector makeSelectorBitset(reco::Muon const &muon, reco::Vertex const *vertex=nullptr, bool run2016_hip_mitigation=false)
void setDZ(T &lep, const reco::Vertex &pv) const
void readMiniIsoParams(const edm::ParameterSet &iConfig)
T getParameter(std::string const &) const
Analysis-level electron class.
Abs< T >::type abs(const T &t)
pat::LeptonUpdater< pat::Electron > PATElectronUpdater
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
void setSelectors(uint64_t selectors)