CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
PFTauTransverseImpactParameters Class Reference
Inheritance diagram for PFTauTransverseImpactParameters:
edm::stream::EDProducer<>

Public Types

enum  CMSSWPerigee {
  aCurv = 0, aTheta, aPhi, aTip,
  aLip
}
 
- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Public Member Functions

 PFTauTransverseImpactParameters (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~PFTauTransverseImpactParameters () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

edm::EDGetTokenT< edm::AssociationVector< PFTauRefProd, std::vector< reco::VertexRef > > > PFTauPVAToken_
 
edm::EDGetTokenT< edm::AssociationVector< PFTauRefProd, std::vector< std::vector< reco::VertexRef > > > > PFTauSVAToken_
 
edm::EDGetTokenT< std::vector< reco::PFTau > > PFTauToken_
 
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecordtransTrackBuilderToken_
 
bool useFullCalculation_
 

Detailed Description

Definition at line 53 of file PFTauTransverseImpactParameters.cc.

Member Enumeration Documentation

◆ CMSSWPerigee

Constructor & Destructor Documentation

◆ PFTauTransverseImpactParameters()

PFTauTransverseImpactParameters::PFTauTransverseImpactParameters ( const edm::ParameterSet iConfig)
explicit

Definition at line 69 of file PFTauTransverseImpactParameters.cc.

70  : PFTauToken_(consumes<std::vector<reco::PFTau>>(iConfig.getParameter<edm::InputTag>("PFTauTag"))),
71  PFTauPVAToken_(consumes<edm::AssociationVector<PFTauRefProd, std::vector<reco::VertexRef>>>(
72  iConfig.getParameter<edm::InputTag>("PFTauPVATag"))),
73  PFTauSVAToken_(consumes<edm::AssociationVector<PFTauRefProd, std::vector<std::vector<reco::VertexRef>>>>(
74  iConfig.getParameter<edm::InputTag>("PFTauSVATag"))),
75  transTrackBuilderToken_(esConsumes(edm::ESInputTag{"", "TransientTrackBuilder"})),
76  useFullCalculation_(iConfig.getParameter<bool>("useFullCalculation")) {
77  produces<edm::AssociationVector<PFTauRefProd, std::vector<reco::PFTauTransverseImpactParameterRef>>>();
78  produces<PFTauTransverseImpactParameterCollection>("PFTauTIP");
79 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< std::vector< reco::PFTau > > PFTauToken_
edm::EDGetTokenT< edm::AssociationVector< PFTauRefProd, std::vector< reco::VertexRef > > > PFTauPVAToken_
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > transTrackBuilderToken_
edm::EDGetTokenT< edm::AssociationVector< PFTauRefProd, std::vector< std::vector< reco::VertexRef > > > > PFTauSVAToken_

◆ ~PFTauTransverseImpactParameters()

PFTauTransverseImpactParameters::~PFTauTransverseImpactParameters ( )
override

Definition at line 81 of file PFTauTransverseImpactParameters.cc.

81 {}

Member Function Documentation

◆ fillDescriptions()

void PFTauTransverseImpactParameters::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 193 of file PFTauTransverseImpactParameters.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

193  {
194  // PFTauTransverseImpactParameters
196  desc.add<edm::InputTag>("PFTauPVATag", edm::InputTag("PFTauPrimaryVertexProducer"));
197  desc.add<bool>("useFullCalculation", false);
198  desc.add<edm::InputTag>("PFTauTag", edm::InputTag("hpsPFTauProducer"));
199  desc.add<edm::InputTag>("PFTauSVATag", edm::InputTag("PFTauSecondaryVertexProducer"));
200  descriptions.add("PFTauTransverseImpactParameters", desc);
201 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void PFTauTransverseImpactParameters::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 102 of file PFTauTransverseImpactParameters.cc.

References RecoVertex::convertPos(), reco::Vertex::dimension, PVValHelper::dxy, reco::TransientTrack::field(), edm::EventSetup::getData(), getTrack(), mps_fire::i, iEvent, reco::TransientTrack::impactPointState(), electrons_cff::ip3d, edm::Ref< C, T, F >::isNonnull(), dqmiolumiharvest::j, edm::Ref< C, T, F >::key(), eostools::move(), PFTauPVAToken_, PFTauSVAToken_, PFTauToken_, IPTools::signedImpactParameter3D(), IPTools::signedTransverseImpactParameter(), met_cff::significance, nanoDQM_cfi::SV, L1TRate_Offline_cfi::Tau, HLT_2023v12_cff::track, transTrackBuilderToken_, useFullCalculation_, and findQualityFiles::v.

102  {
103  // Obtain Collections
104  auto const& transTrackBuilder = iSetup.getData(transTrackBuilderToken_);
105 
107  iEvent.getByToken(PFTauToken_, Tau);
108 
110  iEvent.getByToken(PFTauPVAToken_, PFTauPVA);
111 
113  iEvent.getByToken(PFTauSVAToken_, PFTauSVA);
114 
115  // Set Association Map
116  auto AVPFTauTIP =
117  std::make_unique<edm::AssociationVector<PFTauRefProd, std::vector<reco::PFTauTransverseImpactParameterRef>>>(
118  PFTauRefProd(Tau));
119  auto TIPCollection_out = std::make_unique<PFTauTransverseImpactParameterCollection>();
121  iEvent.getRefBeforePut<reco::PFTauTransverseImpactParameterCollection>("PFTauTIP");
122 
123  // For each Tau Run Algorithim
124  if (Tau.isValid()) {
125  for (reco::PFTauCollection::size_type iPFTau = 0; iPFTau < Tau->size(); iPFTau++) {
126  reco::PFTauRef RefPFTau(Tau, iPFTau);
127  const reco::VertexRef PV = PFTauPVA->value(RefPFTau.key());
128  const std::vector<reco::VertexRef> SV = PFTauSVA->value(RefPFTau.key());
129  double dxy(-999), dxy_err(-999);
130  reco::Vertex::Point poca(0, 0, 0);
131  double ip3d(-999), ip3d_err(-999);
132  reco::Vertex::Point ip3d_poca(0, 0, 0);
133  if (RefPFTau->leadChargedHadrCand().isNonnull()) {
134  const reco::Track* track = getTrack(*RefPFTau->leadChargedHadrCand());
135  if (track != nullptr) {
136  if (useFullCalculation_) {
137  reco::TransientTrack transTrk = transTrackBuilder.build(*track);
138  GlobalVector direction(
139  RefPFTau->p4().px(), RefPFTau->p4().py(), RefPFTau->p4().pz()); //To compute sign of IP
140  std::pair<bool, Measurement1D> signed_IP2D =
141  IPTools::signedTransverseImpactParameter(transTrk, direction, (*PV));
142  dxy = signed_IP2D.second.value();
143  dxy_err = signed_IP2D.second.error();
144  std::pair<bool, Measurement1D> signed_IP3D = IPTools::signedImpactParameter3D(transTrk, direction, (*PV));
145  ip3d = signed_IP3D.second.value();
146  ip3d_err = signed_IP3D.second.error();
147  TransverseImpactPointExtrapolator extrapolator(transTrk.field());
148  GlobalPoint pos =
149  extrapolator.extrapolate(transTrk.impactPointState(), RecoVertex::convertPos(PV->position()))
150  .globalPosition();
151  poca = reco::Vertex::Point(pos.x(), pos.y(), pos.z());
152  AnalyticalImpactPointExtrapolator extrapolator3D(transTrk.field());
153  GlobalPoint pos3d =
154  extrapolator3D.extrapolate(transTrk.impactPointState(), RecoVertex::convertPos(PV->position()))
155  .globalPosition();
156  ip3d_poca = reco::Vertex::Point(pos3d.x(), pos3d.y(), pos3d.z());
157  } else {
158  dxy_err = track->d0Error();
159  dxy = track->dxy(PV->position());
160  ip3d_err = track->dzError(); //store dz, ip3d not available
161  ip3d = track->dz(PV->position()); //store dz, ip3d not available
162  }
163  }
164  }
165  if (!SV.empty()) {
167  reco::Vertex::Point v(SV.at(0)->x() - PV->x(), SV.at(0)->y() - PV->y(), SV.at(0)->z() - PV->z());
168  for (int i = 0; i < reco::Vertex::dimension; i++) {
169  for (int j = 0; j < reco::Vertex::dimension; j++) {
170  cov(i, j) = SV.at(0)->covariance(i, j) + PV->covariance(i, j);
171  }
172  }
173  GlobalVector direction(RefPFTau->px(), RefPFTau->py(), RefPFTau->pz());
174  double vSig = SecondaryVertex::computeDist3d(*PV, *SV.at(0), direction, true).significance();
175  reco::PFTauTransverseImpactParameter TIPV(poca, dxy, dxy_err, ip3d_poca, ip3d, ip3d_err, PV, v, vSig, SV.at(0));
177  reco::PFTauTransverseImpactParameterRef(TIPRefProd_out, TIPCollection_out->size());
178  TIPCollection_out->push_back(TIPV);
179  AVPFTauTIP->setValue(iPFTau, TIPVRef);
180  } else {
181  reco::PFTauTransverseImpactParameter TIPV(poca, dxy, dxy_err, ip3d_poca, ip3d, ip3d_err, PV);
183  reco::PFTauTransverseImpactParameterRef(TIPRefProd_out, TIPCollection_out->size());
184  TIPCollection_out->push_back(TIPV);
185  AVPFTauTIP->setValue(iPFTau, TIPVRef);
186  }
187  }
188  }
189  iEvent.put(std::move(TIPCollection_out), "PFTauTIP");
190  iEvent.put(std::move(AVPFTauTIP));
191 }
reco::Vertex::Point convertPos(const GlobalPoint &p)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
std::pair< bool, Measurement1D > signedTransverseImpactParameter(const reco::TransientTrack &track, const GlobalVector &direction, const reco::Vertex &vertex)
Definition: IPTools.cc:57
std::pair< bool, Measurement1D > signedImpactParameter3D(const reco::TransientTrack &track, const GlobalVector &direction, const reco::Vertex &vertex)
Definition: IPTools.cc:81
edm::RefProd< PFTauCollection > PFTauRefProd
references to PFTau collection
Definition: PFTauFwd.h:15
uint16_t size_type
math::Error< dimension >::type CovarianceMatrix
covariance error matrix (3x3)
Definition: Vertex.h:47
edm::EDGetTokenT< std::vector< reco::PFTau > > PFTauToken_
edm::EDGetTokenT< edm::AssociationVector< PFTauRefProd, std::vector< reco::VertexRef > > > PFTauPVAToken_
int iEvent
Definition: GenABIO.cc:224
const MagneticField * field() const
math::XYZPoint Point
point in the space
Definition: Vertex.h:40
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > transTrackBuilderToken_
edm::EDGetTokenT< edm::AssociationVector< PFTauRefProd, std::vector< std::vector< reco::VertexRef > > > > PFTauSVAToken_
Definition: Tau.py:1
static const TrackGhostTrackState * getTrack(const BasicGhostTrackState *basic)
edm::Ref< PFTauTransverseImpactParameterCollection > PFTauTransverseImpactParameterRef
presistent reference to a PFTauTransverseImpactParameter
significance
Definition: met_cff.py:15
static constexpr int dimension
error matrix dimension
Definition: Vertex.h:42
std::vector< reco::PFTauTransverseImpactParameter > PFTauTransverseImpactParameterCollection
collection of PFTauTransverseImpactParameter objects
Definition: PV.py:1
def move(src, dest)
Definition: eostools.py:511
TrajectoryStateOnSurface impactPointState() const

Member Data Documentation

◆ PFTauPVAToken_

edm::EDGetTokenT<edm::AssociationVector<PFTauRefProd, std::vector<reco::VertexRef> > > PFTauTransverseImpactParameters::PFTauPVAToken_
private

Definition at line 63 of file PFTauTransverseImpactParameters.cc.

Referenced by produce().

◆ PFTauSVAToken_

edm::EDGetTokenT<edm::AssociationVector<PFTauRefProd, std::vector<std::vector<reco::VertexRef> > > > PFTauTransverseImpactParameters::PFTauSVAToken_
private

Definition at line 64 of file PFTauTransverseImpactParameters.cc.

Referenced by produce().

◆ PFTauToken_

edm::EDGetTokenT<std::vector<reco::PFTau> > PFTauTransverseImpactParameters::PFTauToken_
private

Definition at line 62 of file PFTauTransverseImpactParameters.cc.

Referenced by produce().

◆ transTrackBuilderToken_

const edm::ESGetToken<TransientTrackBuilder, TransientTrackRecord> PFTauTransverseImpactParameters::transTrackBuilderToken_
private

Definition at line 65 of file PFTauTransverseImpactParameters.cc.

Referenced by produce().

◆ useFullCalculation_

bool PFTauTransverseImpactParameters::useFullCalculation_
private

Definition at line 66 of file PFTauTransverseImpactParameters.cc.

Referenced by produce().