test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
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
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

std::pair< std::vector
< reco::TransientTrack >
, GlobalPoint
nearTracks (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
< TracksClusteringFromDisplacedSeed
clusterizer
 
double fitterRatio
 
double fitterSigmacut
 
double fitterTini
 
double maxLIP
 
unsigned int maxNTracks
 
unsigned int minHits
 
double minPt
 
edm::EDGetTokenT< reco::BeamSpottoken_beamSpot
 
edm::EDGetTokenT
< reco::VertexCollection
token_primaryVertex
 
edm::EDGetTokenT< InputContainer > token_tracks
 
bool useVertexFitter
 
bool useVertexReco
 
double vertexMinAngleCosine
 
double vertexMinDLen2DSig
 
double vertexMinDLenSig
 
std::auto_ptr
< VertexReconstructor
vtxReco
 

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

Implements edm::stream::EDProducerBase.

Definition at line 103 of file InclusiveVertexFinder.h.

References funct::abs(), SiPixelRawToDigiRegional_cfi::beamSpot, tthelpers::buildTT(), HLT_25ns10e33_v2_cff::clusterizer, HLT_25ns10e33_v2_cff::clusters, gather_cfg::cout, reco::Vertex::covariance(), dir, Vector3DBase< T, FrameTag >::dot(), reco::TrackBase::dz(), Measurement1D::error(), HLT_25ns10e33_v2_cff::fitterRatio, HLT_25ns10e33_v2_cff::fitterSigmacut, HLT_25ns10e33_v2_cff::fitterTini, edm::EventSetup::get(), i, TransientVertex::isValid(), reco::TransientTrack::isValid(), j, HLT_25ns10e33_v2_cff::maxNTracks, reco::Vertex::position(), HLT_25ns10e33_v2_cff::primaryVertices, MetAnalyzer::pv(), dt_dqm_sourceclient_common_cff::reco, reco::TransientTrack::setBeamSpot(), Measurement1D::significance(), reco::TransientTrack::track(), valSkim_cff::trackFilter, testEve_cfg::tracks, groupFilesInBlocks::tt, csvLumiCalc::unit, Vector3DBase< T, FrameTag >::unit(), reco::BeamSpot::Unknown, HLT_25ns10e33_v2_cff::useVertexReco, findQualityFiles::v, Measurement1D::value(), AdaptiveVertexFitter::vertex(), HLT_25ns10e33_v2_cff::vertexMinAngleCosine, HLT_25ns10e33_v2_cff::vertexMinDLen2DSig, HLT_25ns10e33_v2_cff::vertexMinDLenSig, HLT_25ns10e33_v2_cff::vertices, 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  std::auto_ptr<Product> recoVertices(new 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  // std::cout << "Vscal: " << vscal << std::endl;
216  if(dlen.significance() > vertexMinDLenSig && vscal > vertexMinAngleCosine && v->normalisedChiSquared() < 10 && dlen2.significance() > vertexMinDLen2DSig)
217  {
218  recoVertices->push_back(*v);
219 #ifdef VTXDEBUG
220  std::cout << "ADDED" << std::endl;
221 #endif
222  }
223 
224  }
225  }
226 #ifdef VTXDEBUG
227 
228  std::cout << "Final put " << recoVertices->size() << std::endl;
229 #endif
230  }
231 
232  event.put(recoVertices);
233 
234 }
math::Error< dimension >::type CovarianceMatrix
Definition: BeamSpot.h:31
int i
Definition: DBlmapReader.cc:9
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:116
const Point & position() const
position
Definition: Vertex.h:99
string unit
Definition: csvLumiCalc.py:46
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
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
tuple tracks
Definition: testEve_cfg.py:39
const T & get() const
Definition: EventSetup.h:56
double value() const
Definition: Measurement1D.h:28
edm::EDGetTokenT< reco::BeamSpot > token_beamSpot
tuple cout
Definition: gather_cfg.py:145
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:4
bool isValid() const
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(), OccupancyClient_cfi::minHits, HLT_25ns10e33_v2_cff::minPt, reco::HitPattern::numberOfValidHits(), and reco::TrackBase::pt().

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:616
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:445

Member Data Documentation

template<class InputContainer , class VTX >
std::auto_ptr<TracksClusteringFromDisplacedSeed> TemplatedInclusiveVertexFinder< InputContainer, VTX >::clusterizer
private

Definition at line 64 of file InclusiveVertexFinder.h.

template<class InputContainer , class VTX >
double TemplatedInclusiveVertexFinder< InputContainer, VTX >::fitterRatio
private

Definition at line 60 of file InclusiveVertexFinder.h.

template<class InputContainer , class VTX >
double TemplatedInclusiveVertexFinder< InputContainer, VTX >::fitterSigmacut
private

Definition at line 58 of file InclusiveVertexFinder.h.

template<class InputContainer , class VTX >
double TemplatedInclusiveVertexFinder< InputContainer, VTX >::fitterTini
private

Definition at line 59 of file InclusiveVertexFinder.h.

template<class InputContainer , class VTX >
double TemplatedInclusiveVertexFinder< InputContainer, VTX >::maxLIP
private

Definition at line 53 of file InclusiveVertexFinder.h.

template<class InputContainer , class VTX >
unsigned int TemplatedInclusiveVertexFinder< InputContainer, VTX >::maxNTracks
private

Definition at line 52 of file InclusiveVertexFinder.h.

template<class InputContainer , class VTX >
unsigned int TemplatedInclusiveVertexFinder< InputContainer, VTX >::minHits
private

Definition at line 51 of file InclusiveVertexFinder.h.

template<class InputContainer , class VTX >
double TemplatedInclusiveVertexFinder< InputContainer, VTX >::minPt
private

Definition at line 54 of file InclusiveVertexFinder.h.

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

Definition at line 61 of file InclusiveVertexFinder.h.

template<class InputContainer , class VTX >
bool TemplatedInclusiveVertexFinder< InputContainer, VTX >::useVertexReco
private

Definition at line 62 of file InclusiveVertexFinder.h.

template<class InputContainer , class VTX >
double TemplatedInclusiveVertexFinder< InputContainer, VTX >::vertexMinAngleCosine
private

Definition at line 55 of file InclusiveVertexFinder.h.

template<class InputContainer , class VTX >
double TemplatedInclusiveVertexFinder< InputContainer, VTX >::vertexMinDLen2DSig
private

Definition at line 56 of file InclusiveVertexFinder.h.

template<class InputContainer , class VTX >
double TemplatedInclusiveVertexFinder< InputContainer, VTX >::vertexMinDLenSig
private

Definition at line 57 of file InclusiveVertexFinder.h.

template<class InputContainer , class VTX >
std::auto_ptr<VertexReconstructor> TemplatedInclusiveVertexFinder< InputContainer, VTX >::vtxReco
private

Definition at line 63 of file InclusiveVertexFinder.h.