CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
TemplatedInclusiveVertexFinder< InputContainer, VTX > Class Template Reference

#include <InclusiveVertexFinder.h>

Inheritance diagram for TemplatedInclusiveVertexFinder< InputContainer, VTX >:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef std::vector< VTX > Product
 
typedef InputContainer::value_type TRK
 
- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

virtual void produce (edm::Event &event, const edm::EventSetup &es) override
 
 TemplatedInclusiveVertexFinder (const edm::ParameterSet &params)
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

std::pair< std::vector< reco::TransientTrack >, GlobalPointnearTracks (const reco::TransientTrack &seed, const std::vector< reco::TransientTrack > &tracks, const reco::Vertex &primaryVertex) const
 
bool trackFilter (const reco::Track &track) const
 

Private Attributes

std::auto_ptr< TracksClusteringFromDisplacedSeedclusterizer
 
double fitterRatio
 
double fitterSigmacut
 
double fitterTini
 
double maxLIP
 
unsigned int maxNTracks
 
unsigned int minHits
 
double minPt
 
edm::EDGetTokenT< reco::BeamSpottoken_beamSpot
 
edm::EDGetTokenT< reco::VertexCollectiontoken_primaryVertex
 
edm::EDGetTokenT< InputContainer > token_tracks
 
bool useVertexFitter
 
bool useVertexReco
 
double vertexMinAngleCosine
 
double vertexMinDLen2DSig
 
double vertexMinDLenSig
 
std::auto_ptr< VertexReconstructorvtxReco
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

template<class InputContainer, class VTX>
class TemplatedInclusiveVertexFinder< InputContainer, VTX >

Definition at line 36 of file InclusiveVertexFinder.h.

Member Typedef Documentation

template<class InputContainer , class VTX >
typedef std::vector<VTX> TemplatedInclusiveVertexFinder< InputContainer, VTX >::Product

Definition at line 38 of file InclusiveVertexFinder.h.

template<class InputContainer , class VTX >
typedef InputContainer::value_type TemplatedInclusiveVertexFinder< InputContainer, VTX >::TRK

Definition at line 39 of file InclusiveVertexFinder.h.

Constructor & Destructor Documentation

template<class InputContainer , class VTX >
TemplatedInclusiveVertexFinder< InputContainer, VTX >::TemplatedInclusiveVertexFinder ( const edm::ParameterSet params)

Definition at line 68 of file InclusiveVertexFinder.h.

References edm::ParameterSet::getParameter(), TemplatedInclusiveVertexFinder< InputContainer, VTX >::token_beamSpot, TemplatedInclusiveVertexFinder< InputContainer, VTX >::token_primaryVertex, and TemplatedInclusiveVertexFinder< InputContainer, VTX >::token_tracks.

68  :
69  minHits(params.getParameter<unsigned int>("minHits")),
70  maxNTracks(params.getParameter<unsigned int>("maxNTracks")),
71  maxLIP(params.getParameter<double>("maximumLongitudinalImpactParameter")),
72  minPt(params.getParameter<double>("minPt")), //0.8
73  vertexMinAngleCosine(params.getParameter<double>("vertexMinAngleCosine")), //0.98
74  vertexMinDLen2DSig(params.getParameter<double>("vertexMinDLen2DSig")), //2.5
75  vertexMinDLenSig(params.getParameter<double>("vertexMinDLenSig")), //0.5
76  fitterSigmacut(params.getParameter<double>("fitterSigmacut")),
77  fitterTini(params.getParameter<double>("fitterTini")),
78  fitterRatio(params.getParameter<double>("fitterRatio")),
79  useVertexFitter(params.getParameter<bool>("useDirectVertexFitter")),
80  useVertexReco(params.getParameter<bool>("useVertexReco")),
83 
84 {
85  token_beamSpot = consumes<reco::BeamSpot>(params.getParameter<edm::InputTag>("beamSpot"));
86  token_primaryVertex = consumes<reco::VertexCollection>(params.getParameter<edm::InputTag>("primaryVertices"));
87  token_tracks = consumes<InputContainer>(params.getParameter<edm::InputTag>("tracks"));
88  produces<Product>();
89  //produces<reco::VertexCollection>("multi");
90 }
T getParameter(std::string const &) const
std::auto_ptr< TracksClusteringFromDisplacedSeed > clusterizer
edm::EDGetTokenT< InputContainer > token_tracks
edm::EDGetTokenT< reco::BeamSpot > token_beamSpot
edm::EDGetTokenT< reco::VertexCollection > token_primaryVertex
std::auto_ptr< VertexReconstructor > vtxReco

Member Function Documentation

template<class InputContainer , class VTX >
std::pair<std::vector<reco::TransientTrack>,GlobalPoint> TemplatedInclusiveVertexFinder< InputContainer, VTX >::nearTracks ( const reco::TransientTrack seed,
const std::vector< reco::TransientTrack > &  tracks,
const reco::Vertex primaryVertex 
) const
private
template<class InputContainer , class VTX >
void TemplatedInclusiveVertexFinder< InputContainer, VTX >::produce ( edm::Event event,
const edm::EventSetup es 
)
overridevirtual

Definition at line 103 of file InclusiveVertexFinder.h.

References funct::abs(), ecalDrivenElectronSeedsParameters_cff::beamSpot, tthelpers::buildTT(), TemplatedInclusiveVertexFinder< InputContainer, VTX >::clusterizer, fastPrimaryVertexProducer_cfi::clusters, gather_cfg::cout, reco::Vertex::covariance(), dir, VertexDistance3D::distance(), VertexDistanceXY::distance(), Vector3DBase< T, FrameTag >::dot(), reco::TrackBase::dz(), Measurement1D::error(), TemplatedInclusiveVertexFinder< InputContainer, VTX >::fitterRatio, TemplatedInclusiveVertexFinder< InputContainer, VTX >::fitterSigmacut, TemplatedInclusiveVertexFinder< InputContainer, VTX >::fitterTini, edm::EventSetup::get(), mps_fire::i, reco::TransientTrack::isValid(), TransientVertex::isValid(), TemplatedInclusiveVertexFinder< InputContainer, VTX >::maxLIP, TemplatedInclusiveVertexFinder< InputContainer, VTX >::maxNTracks, eostools::move(), reco::Vertex::position(), jets_cff::primaryVertices, MetAnalyzer::pv(), reco::TransientTrack::setBeamSpot(), Measurement1D::significance(), pfDeepBoostedJetPreprocessParams_cfi::sv, TemplatedInclusiveVertexFinder< InputContainer, VTX >::token_beamSpot, TemplatedInclusiveVertexFinder< InputContainer, VTX >::token_primaryVertex, TemplatedInclusiveVertexFinder< InputContainer, VTX >::token_tracks, HiIsolationCommonParameters_cff::track, reco::TransientTrack::track(), TemplatedInclusiveVertexFinder< InputContainer, VTX >::trackFilter(), l1t::tracks, groupFilesInBlocks::tt, csvLumiCalc::unit, Vector3DBase< T, FrameTag >::unit(), Unknown, TemplatedInclusiveVertexFinder< InputContainer, VTX >::useVertexFitter, TemplatedInclusiveVertexFinder< InputContainer, VTX >::useVertexReco, findQualityFiles::v, Measurement1D::value(), AdaptiveVertexFitter::vertex(), TemplatedInclusiveVertexFinder< InputContainer, VTX >::vertexMinAngleCosine, TemplatedInclusiveVertexFinder< InputContainer, VTX >::vertexMinDLen2DSig, TemplatedInclusiveVertexFinder< InputContainer, VTX >::vertexMinDLenSig, electrons_cff::vertices, TemplatedInclusiveVertexFinder< InputContainer, VTX >::vtxReco, and w.

104 {
105  using namespace reco;
106 
107  VertexDistance3D vdist;
108  VertexDistanceXY vdist2d;
109  MultiVertexFitter theMultiVertexFitter;
110  AdaptiveVertexFitter theAdaptiveFitter(
116 
117 
119  event.getByToken(token_beamSpot,beamSpot);
120 
122  event.getByToken(token_primaryVertex, primaryVertices);
123 
125  event.getByToken(token_tracks, tracks);
126 
128  es.get<TransientTrackRecord>().get("TransientTrackBuilder",
129  trackBuilder);
130 
131 
132  auto recoVertices = std::make_unique<Product>();
133  if(primaryVertices->size()!=0) {
134 
135  const reco::Vertex &pv = (*primaryVertices)[0];
136  GlobalPoint ppv(pv.position().x(),pv.position().y(),pv.position().z());
137 
138  std::vector<TransientTrack> tts;
139  //Fill transient track vector
140  for(typename InputContainer::const_iterator track = tracks->begin();
141  track != tracks->end(); ++track) {
142 //TransientTrack tt = trackBuilder->build(ref);
143 //TrackRef ref(tracks, track - tracks->begin());
144  TransientTrack tt(tthelpers::buildTT(tracks,trackBuilder, track - tracks->begin()));
145  if(!tt.isValid()) continue;
146  if (!trackFilter(tt.track()))
147  continue;
148  if( std::abs(tt.track().dz(pv.position())) > maxLIP)
149  continue;
150  tt.setBeamSpot(*beamSpot);
151  tts.push_back(tt);
152  }
153  std::vector<TracksClusteringFromDisplacedSeed::Cluster> clusters = clusterizer->clusters(pv,tts);
154 
155  //Create BS object from PV to feed in the AVR
157  for(unsigned int i = 0; i < 7; i++) {
158  for(unsigned int j = 0; j < 7; j++) {
159  if (i < 3 && j < 3)
160  cov(i, j) = pv.covariance(i, j);
161  else
162  cov(i, j) = 0.0;
163  }
164  }
165  BeamSpot bs(pv.position(), 0.0, 0.0, 0.0, 0.0, cov, BeamSpot::Unknown);
166 
167 
168  int i=0;
169 #ifdef VTXDEBUG
170 
171  std::cout << "CLUSTERS " << clusters.size() << std::endl;
172 #endif
173 
174  for(std::vector<TracksClusteringFromDisplacedSeed::Cluster>::iterator cluster = clusters.begin();
175  cluster != clusters.end(); ++cluster,++i)
176  {
177  if(cluster->tracks.size() < 2 || cluster->tracks.size() > maxNTracks )
178  continue;
179  std::vector<TransientVertex> vertices;
180  if(useVertexReco) {
181  vertices = vtxReco->vertices(cluster->tracks, bs); // attempt with config given reconstructor
182  }
183  TransientVertex singleFitVertex;
184  if(useVertexFitter) {
185  singleFitVertex = theAdaptiveFitter.vertex(cluster->tracks,cluster->seedPoint); //attempt with direct fitting
186  if(singleFitVertex.isValid())
187  vertices.push_back(singleFitVertex);
188  }
189  for(std::vector<TransientVertex>::const_iterator v = vertices.begin();
190  v != vertices.end(); ++v) {
191  Measurement1D dlen= vdist.distance(pv,*v);
192  Measurement1D dlen2= vdist2d.distance(pv,*v);
193 #ifdef VTXDEBUG
194  VTX vv(*v);
195  std::cout << "V chi2/n: " << v->normalisedChiSquared() << " ndof: " <<v->degreesOfFreedom() ;
196  std::cout << " dlen: " << dlen.value() << " error: " << dlen.error() << " signif: " << dlen.significance();
197  std::cout << " dlen2: " << dlen2.value() << " error2: " << dlen2.error() << " signif2: " << dlen2.significance();
198  std::cout << " pos: " << vv.position() << " error: " <<vv.xError() << " " << vv.yError() << " " << vv.zError() << std::endl;
199 #endif
200  GlobalVector dir;
201  std::vector<reco::TransientTrack> ts = v->originalTracks();
202  for(std::vector<reco::TransientTrack>::const_iterator i = ts.begin();
203  i != ts.end(); ++i) {
204  float w = v->trackWeight(*i);
205  if (w > 0.5) dir+=i->impactPointState().globalDirection();
206 #ifdef VTXDEBUG
207  std::cout << "\t[" << (*i).track().pt() << ": "
208  << (*i).track().eta() << ", "
209  << (*i).track().phi() << "], "
210  << w << std::endl;
211 #endif
212  }
213  GlobalPoint sv((*v).position().x(),(*v).position().y(),(*v).position().z());
214  float vscal = dir.unit().dot((sv-ppv).unit());
215  if(dlen.significance() > vertexMinDLenSig &&
216  ( (vertexMinAngleCosine > 0) ? (vscal > vertexMinAngleCosine) : (vscal < vertexMinAngleCosine) )
217  && v->normalisedChiSquared() < 10 && dlen2.significance() > vertexMinDLen2DSig)
218  {
219  recoVertices->push_back(*v);
220 
221 #ifdef VTXDEBUG
222  std::cout << "ADDED" << std::endl;
223 #endif
224  }
225 
226  }
227  }
228 #ifdef VTXDEBUG
229 
230  std::cout << "Final put " << recoVertices->size() << std::endl;
231 #endif
232  }
233 
234  event.put(std::move(recoVertices));
235 
236 }
math::Error< dimension >::type CovarianceMatrix
Definition: BeamSpot.h:31
std::auto_ptr< TracksClusteringFromDisplacedSeed > clusterizer
const double w
Definition: UKUtility.cc:23
double error() const
Definition: Measurement1D.h:30
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:107
double covariance(int i, int j) const
(i, j)-th element of error matrix, i, j = 0, ... 2
Definition: Vertex.h:130
const Point & position() const
position
Definition: Vertex.h:109
Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
def pv(vc)
Definition: MetAnalyzer.py:6
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::EDGetTokenT< InputContainer > token_tracks
bool trackFilter(const reco::Track &track) const
Vector3DBase unit() const
Definition: Vector3DBase.h:57
double significance() const
Definition: Measurement1D.h:32
primaryVertices
Definition: jets_cff.py:130
const T & get() const
Definition: EventSetup.h:55
double value() const
Definition: Measurement1D.h:28
significance
Definition: met_cff.py:30
fixed size matrix
edm::EDGetTokenT< reco::BeamSpot > token_beamSpot
dbl *** dir
Definition: mlp_gen.cc:35
edm::EDGetTokenT< reco::VertexCollection > token_primaryVertex
std::auto_ptr< VertexReconstructor > vtxReco
reco::TransientTrack buildTT(edm::Handle< reco::TrackCollection > &tracks, edm::ESHandle< TransientTrackBuilder > &trackbuilder, unsigned int k)
Definition: TTHelpers.h:8
bool isValid() const
def move(src, dest)
Definition: eostools.py:510
template<class InputContainer , class VTX >
bool TemplatedInclusiveVertexFinder< InputContainer, VTX >::trackFilter ( const reco::Track track) const
private

Definition at line 92 of file InclusiveVertexFinder.h.

References reco::TrackBase::hitPattern(), createfilelist::int, TemplatedInclusiveVertexFinder< InputContainer, VTX >::minHits, TemplatedInclusiveVertexFinder< InputContainer, VTX >::minPt, reco::HitPattern::numberOfValidHits(), and reco::TrackBase::pt().

Referenced by TemplatedInclusiveVertexFinder< InputContainer, VTX >::produce().

93 {
94  if (track.hitPattern().numberOfValidHits() < (int)minHits)
95  return false;
96  if (track.pt() < minPt )
97  return false;
98 
99  return true;
100 }
int numberOfValidHits() const
Definition: HitPattern.h:823
double pt() const
track transverse momentum
Definition: TrackBase.h:621
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:446

Member Data Documentation

template<class InputContainer , class VTX >
std::auto_ptr<TracksClusteringFromDisplacedSeed> TemplatedInclusiveVertexFinder< InputContainer, VTX >::clusterizer
private
template<class InputContainer , class VTX >
double TemplatedInclusiveVertexFinder< InputContainer, VTX >::fitterRatio
private
template<class InputContainer , class VTX >
double TemplatedInclusiveVertexFinder< InputContainer, VTX >::fitterSigmacut
private
template<class InputContainer , class VTX >
double TemplatedInclusiveVertexFinder< InputContainer, VTX >::fitterTini
private
template<class InputContainer , class VTX >
double TemplatedInclusiveVertexFinder< InputContainer, VTX >::maxLIP
private
template<class InputContainer , class VTX >
unsigned int TemplatedInclusiveVertexFinder< InputContainer, VTX >::maxNTracks
private
template<class InputContainer , class VTX >
unsigned int TemplatedInclusiveVertexFinder< InputContainer, VTX >::minHits
private
template<class InputContainer , class VTX >
double TemplatedInclusiveVertexFinder< InputContainer, VTX >::minPt
private
template<class InputContainer , class VTX >
edm::EDGetTokenT<reco::BeamSpot> TemplatedInclusiveVertexFinder< InputContainer, VTX >::token_beamSpot
private
template<class InputContainer , class VTX >
edm::EDGetTokenT<reco::VertexCollection> TemplatedInclusiveVertexFinder< InputContainer, VTX >::token_primaryVertex
private
template<class InputContainer , class VTX >
edm::EDGetTokenT<InputContainer> TemplatedInclusiveVertexFinder< InputContainer, VTX >::token_tracks
private
template<class InputContainer , class VTX >
bool TemplatedInclusiveVertexFinder< InputContainer, VTX >::useVertexFitter
private
template<class InputContainer , class VTX >
bool TemplatedInclusiveVertexFinder< InputContainer, VTX >::useVertexReco
private
template<class InputContainer , class VTX >
double TemplatedInclusiveVertexFinder< InputContainer, VTX >::vertexMinAngleCosine
private
template<class InputContainer , class VTX >
double TemplatedInclusiveVertexFinder< InputContainer, VTX >::vertexMinDLen2DSig
private
template<class InputContainer , class VTX >
double TemplatedInclusiveVertexFinder< InputContainer, VTX >::vertexMinDLenSig
private
template<class InputContainer , class VTX >
std::auto_ptr<VertexReconstructor> TemplatedInclusiveVertexFinder< InputContainer, VTX >::vtxReco
private