53 if (transTrk.size() < 2)
56 transVtx = kvf.
vertex(transTrk);
78 pvChoice_(
cfg.getParameter<
int>(
"pvChoice")) {
79 produces<TrackTimeLifeInfoMap>();
95 std::vector<TrackTimeLifeInfo>
infos;
98 for (
const auto& lepton : *
leptons) {
102 if (!selector_(lepton)) {
107 if (pvChoice_ == useClosestInDz &&
getTrack(lepton) !=
nullptr) {
112 if (dz_tmp < dz_min) {
122 produceAndFillIPInfo(lepton, transTrackBuilder,
pv,
info);
125 produceAndFillSVInfo(lepton, transTrackBuilder,
pv,
info);
130 auto infoMap = std::make_unique<TrackTimeLifeInfoMap>();
141 return electron.gsfTrack().isNonnull() ?
electron.gsfTrack().get() :
nullptr;
146 return muon.innerTrack().isNonnull() ?
muon.innerTrack().get() :
nullptr;
152 if (
tau.leadChargedHadrCand().isNonnull())
153 track =
tau.leadChargedHadrCand()->bestTrack();
157 template <
typename T>
163 if (
track !=
nullptr) {
173 GlobalError pca_cov = closestState.cartesianError().position();
178 if (ip_vec.
dot(
GlobalVector(lepton.px(), lepton.py(), lepton.pz())) < 0)
182 info.setPCA(pca, pca_cov);
183 info.setIP(ip_vec, ip_cov);
184 info.setIPLength(ip_mes);
188 template <
typename T>
201 if (
tau.signalChargedHadrCands().size() +
tau.signalLostTracks().size() > 1) {
203 std::vector<reco::TransientTrack> transTrks;
205 for (
const auto&
cand :
tau.signalChargedHadrCands()) {
209 if (
track !=
nullptr)
210 transTrks.push_back(transTrackBuilder.
build(
track));
212 for (
const auto&
cand :
tau.signalLostTracks()) {
216 if (
track !=
nullptr)
217 transTrks.push_back(transTrackBuilder.
build(
track));
220 fitOK = fitVertex(transTrks, transVtx) ? 1 : -1;
235 info.setFlightVector(flight_vec, flight_cov);
236 info.setFlightLength(flightLength_mes);
241 template <
typename T>
248 lepCollName =
"slimmedElectrons";
250 lepCollName =
"slimmedMuons";
252 lepCollName =
"slimmedTaus";
255 desc.add<
std::string>(
"selection",
"")->setComment(
"Selection required to produce and store time-life information");
256 desc.add<
int>(
"pvChoice", useFront)
258 "Define PV to compute IP: 0: first PV, 1: PV with the smallest dz of the tau leading track (default: " +
reco::Vertex::Point convertPos(const GlobalPoint &p)
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
GlobalError positionError() const
void produce(edm::Event &, const edm::EventSetup &) override
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
PATLeptonTimeLifeInfoProducer(const edm::ParameterSet &)
void produceAndFillSVInfo(const T &, const TransientTrackBuilder &, const reco::Vertex &, TrackTimeLifeInfo &)
Global3DPoint GlobalPoint
GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
GlobalErrorBase< double, ErrorMatrixTag > GlobalError
bool getByToken(EDGetToken token, Handle< PROD > &result) const
~PATLeptonTimeLifeInfoProducer() override
edm::EDGetTokenT< reco::VertexCollection > pvToken_
std::vector< Vertex > VertexCollection
edm::EDGetTokenT< std::vector< T > > leptonsToken_
PATLeptonTimeLifeInfoProducer< pat::Electron > PATElectronTimeLifeInfoProducer
static std::string to_string(const XMLCh *ch)
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &tracks) const override
reco::TransientTrack build(const reco::Track *p) const
PATLeptonTimeLifeInfoProducer< pat::Muon > PATMuonTimeLifeInfoProducer
static bool fitVertex(const std::vector< reco::TransientTrack > &transTrk, TransientVertex &transVtx)
const MagneticField * field() const
Abs< T >::type abs(const T &t)
#define DEFINE_FWK_MODULE(type)
Analysis-level tau class.
static const TrackGhostTrackState * getTrack(const BasicGhostTrackState *basic)
const MagneticField * field() const
const StringCutObjectSelector< T > selector_
bool hasRefittedTracks() const
void produceAndFillIPInfo(const T &, const TransientTrackBuilder &, const reco::Vertex &, TrackTimeLifeInfo &)
Analysis-level electron class.
const reco::Track * getTrack(const T &)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Analysis-level muon class.
Structure to hold time-life information.
PATLeptonTimeLifeInfoProducer< pat::Tau > PATTauTimeLifeInfoProducer
edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > transTrackBuilderToken_
TrajectoryStateOnSurface impactPointState() const
Global3DVector GlobalVector
std::vector< reco::TransientTrack > const & refittedTracks() const
Produces lepton life-time information.