48 if ( IFVVertexCollection_.
label()==
"" ) {
49 LogWarning(
"PF_PU_AssoMapAlgos::PF_PU_AssoMapAlgos") <<
"No InputTag for IV's given --> skipping reconstruction of inclusive vertices !!" << endl;
105 LogWarning(
"PF_PU_AssoMapAlgos::GetInputCollections") <<
"No Extra objects available in input file --> skipping reconstruction of displaced vertices !!" << endl;
119 LogWarning(
"PF_PU_AssoMapAlgos::GetInputCollections") <<
"No Extra objects available in input file --> skipping reconstruction of ifv vertices !!" << endl;
139 std::auto_ptr<TrackToVertexAssMap>
146 int num_vertices =
vtxcollH->size();
147 if ( num_vertices < num_associations) num_associations = num_vertices;
150 for (
size_t idxTrack = 0; idxTrack < trkcollH->size(); ++idxTrack ) {
156 transtrk.
setES(iSetup);
163 for (
int assoc_ite = 0; assoc_ite < num_associations; ++assoc_ite ) {
166 VertexRef associatedVertex = assocVtx.first;
167 int step = assocVtx.second;
171 distances.push_back( make_pair(step, distance) );
179 track2vertex->insert( associatedVertex, make_pair(trackref, quality) );
198 std::auto_ptr<VertexToTrackAssMap>
205 int num_vertices =
vtxcollH->size();
206 if ( num_vertices < num_associations) num_associations = num_vertices;
209 for (
size_t idxTrack = 0; idxTrack < trkcollH->size(); ++idxTrack ) {
215 transtrk.
setES(iSetup);
220 for (
int assoc_ite = 0; assoc_ite < num_associations; ++assoc_ite ) {
223 VertexRef associatedVertex = assocVtx.first;
224 int step = assocVtx.second;
228 distances.push_back( make_pair(step, distance) );
235 vertex2track->insert( trackref, make_pair(associatedVertex, quality) );
253 auto_ptr<TrackToVertexAssMap>
274 for(
unsigned int trckcoll_ite=0; trckcoll_ite<trckcoll.size(); trckcoll_ite++){
276 trackref = trckcoll[trckcoll_ite].first;
277 int quality = trckcoll[trckcoll_ite].second;
279 if ( quality<=2 )
continue;
281 double man_pT = trackref->pt() - trackref->ptError();
282 if(man_pT>0.) ptsum+=man_pT*man_pT;
286 vertexptsumvector.push_back(make_pair(assomap_vertexref,ptsum));
290 while (vertexptsumvector.size()!=0){
293 float highestpT = 0.;
294 int highestpT_index = 0;
296 for(
unsigned int vtxptsumvec_ite=0; vtxptsumvec_ite<vertexptsumvector.size(); vtxptsumvec_ite++){
298 if(vertexptsumvector[vtxptsumvec_ite].
second>highestpT){
300 vertexref_highestpT = vertexptsumvector[vtxptsumvec_ite].first;
301 highestpT = vertexptsumvector[vtxptsumvec_ite].second;
302 highestpT_index = vtxptsumvec_ite;
316 if(assomap_vertexref==vertexref_highestpT)
317 for(
unsigned int trckcoll_ite=0; trckcoll_ite<trckcoll.size(); trckcoll_ite++)
318 trackvertexassOutput->insert(assomap_vertexref,trckcoll[trckcoll_ite]);
322 vertexptsumvector.erase(vertexptsumvector.begin()+highestpT_index);
326 return trackvertexassOutput;
340 std::vector<reco::VertexRef>*
344 vector<VertexRef>*
output =
new vector<VertexRef>();
346 for(
unsigned int index_vtx=0; index_vtx<vtxcollH->size(); ++index_vtx){
349 output->push_back(vertexref);
365 for(
unsigned int index_vtx=0; index_vtx<vtxcollV->size(); ++index_vtx){
367 VertexRef vertexref = vtxcollV->at(index_vtx);
369 if ( vertexref == toErase ){
370 vtxcollV->erase(vtxcollV->begin()+index_vtx);
387 double ztrack = trkref->vertex().z();
389 VertexRef foundVertexRef = vtxcollV->at(0);
394 for(
unsigned int index_vtx=0; index_vtx<vtxcollV->size(); ++index_vtx){
396 VertexRef vertexref = vtxcollV->at(index_vtx);
398 double nTracks =
sqrt( vertexref->tracksSize() );
401 double distance = fabs(ztrack - vertexref->z());
403 double weightedDistance = distance-tWeight*nTracks;
405 if(weightedDistance<dzmin) {
406 dzmin = weightedDistance;
407 foundVertexRef = vertexref;
412 return foundVertexRef;
425 VertexRef foundVertexRef = vtxcollV->at(0);
430 for (
unsigned int index_vtx=0; index_vtx<vtxcollV->size(); ++index_vtx ) {
432 VertexRef vertexref = vtxcollV->at( index_vtx );
434 double nTracks = vertexref->tracksSize();
436 double distance = 1e5;
439 if ( IpPair.first ) distance = IpPair.second.value();
441 double weightedDistance = distance-tWeight*nTracks;
443 if ( weightedDistance<d3min ) {
444 d3min = weightedDistance;
445 foundVertexRef = vertexref;
450 return foundVertexRef;
459 auto_ptr<ConversionCollection>
465 for (
unsigned int convcoll_idx=0; convcoll_idx<convCollH->size(); convcoll_idx++ ){
469 if ( !cleanedColl ) {
470 cleanedConvColl->push_back(*convref);
474 if ( convref->quality( Conversion::highPurity ) ){
476 cleanedConvColl->push_back(*convref);
482 return cleanedConvColl;
495 for(
unsigned int convcoll_ite=0; convcoll_ite<cleanedConvColl.size(); convcoll_ite++){
499 *gamma = cleanedConvColl.at(convcoll_ite);
525 Track photon( trackref->chi2(), trackref->ndof(), conv_pos, conv_mom, 0, trackref->covariance() );
528 transpho.setBeamSpot( *bsH );
529 transpho.setES( iSetup );
539 auto_ptr<VertexCompositeCandidateCollection>
545 for (
unsigned int kscoll_idx=0; kscoll_idx<KshortsH->size(); kscoll_idx++ ) {
549 if ( !cleanedColl ) {
550 cleanedKaonColl->push_back(*ksref);
556 GlobalError decayVertexError =
GlobalError(ksref->vertexCovariance(0,0), ksref->vertexCovariance(0,1), ksref->vertexCovariance(1,1), ksref->vertexCovariance(0,2), ksref->vertexCovariance(1,2), ksref->vertexCovariance(2,2));
560 if ( ( ksref->vertexNormalizedChi2()<=7. ) &&
561 ( fabs(ksref->mass() -
kMass)<=0.06 ) &&
562 ( kaon_significance>25. ) ) {
564 cleanedKaonColl->push_back(*ksref);
570 return cleanedKaonColl;
578 auto_ptr<VertexCompositeCandidateCollection>
584 for (
unsigned int lambdacoll_idx=0; lambdacoll_idx<LambdasH->size(); lambdacoll_idx++ ) {
588 if ( !cleanedColl ) {
589 cleanedLambdaColl->push_back(*lambdaref);
595 GlobalError decayVertexError =
GlobalError(lambdaref->vertexCovariance(0,0), lambdaref->vertexCovariance(0,1), lambdaref->vertexCovariance(1,1), lambdaref->vertexCovariance(0,2), lambdaref->vertexCovariance(1,2), lambdaref->vertexCovariance(2,2));
599 if ( ( lambdaref->vertexNormalizedChi2()<=7. ) &&
600 ( fabs(lambdaref->mass() -
lamMass)<=0.04 ) &&
601 ( lambda_significance>26. ) ){
603 cleanedLambdaColl->push_back(*lambdaref);
609 return cleanedLambdaColl;
622 for(VertexCompositeCandidateCollection::const_iterator iV0=cleanedVCCC.begin(); iV0!=cleanedVCCC.end(); iV0++){
629 if ( (trackref==dauTk1) || (trackref==dauTk2) ) {
657 Track V0(trackref->chi2(), trackref->ndof(), dec_pos, dec_mom, 0, trackref->covariance());
660 transV0.setBeamSpot( *bsH );
661 transV0.setES( iSetup );
672 auto_ptr<PFDisplacedVertexCollection>
678 for ( PFDisplacedVertexCollection::const_iterator niref=NuclIntH->begin(); niref!=NuclIntH->end(); niref++ ) {
680 if ( !cleanedColl ) {
681 cleanedNIColl->push_back(*niref);
690 if ( ( !niref->isFake() ) &&
691 ( niref->isNucl() ) &&
692 ( niref->normalizedChi2()<=2. ) &&
693 ( niref->tracksSize()>=2 ) &&
694 ( nuclint_distance>3. ) ) {
696 cleanedNIColl->push_back(*niref);
702 return cleanedNIColl;
715 for ( PFDisplacedVertexCollection::const_iterator iDisplV=cleanedNI.begin(); iDisplV!=cleanedNI.end(); iDisplV++ ) {
717 if ( iDisplV->trackWeight(trackref)>1.e-5 ) {
719 *displVtx = *iDisplV;
743 for ( TrackCollection::const_iterator trkcoll_ite=refittedTracks.begin(); trkcoll_ite!=refittedTracks.end(); trkcoll_ite++ ) {
749 VertexRef bestvertexref = vtxcollV->at(0);
750 float bestweight = 0.;
752 for (
unsigned int index_vtx=0; index_vtx<vtxcollV->size(); ++index_vtx ) {
754 VertexRef vertexref = vtxcollV->at(index_vtx);
757 float weight = vertexref->trackWeight(retrackbaseref);
758 if(weight>bestweight){
760 bestvertexref = vertexref;
765 if ( bestweight>1.
e-5 )
return bestvertexref;
769 transIncom.
setES( iSetup );
788 auto_ptr<VertexCollection>
794 for ( VertexCollection::const_iterator ivfref=ifvH->begin(); ivfref!=ifvH->end(); ivfref++ ) {
796 if ( !cleanedColl ) {
797 cleanedIVFColl->push_back(*ivfref);
806 if ( ( ivfref->isValid() ) &&
807 ( !ivfref->isFake() ) &&
808 ( ivfref->chi2()<=10. ) &&
809 ( ivfref->nTracks(0.)>=2 ) &&
810 ( ivf_significance>=5. ) ) {
812 cleanedIVFColl->push_back(*ivfref);
818 return cleanedIVFColl;
830 for(VertexCollection::const_iterator iInclV=cleanedIVF.begin(); iInclV!=cleanedIVF.end(); iInclV++){
832 if(iInclV->trackWeight(trackref)>1.e-5){
856 ivfVtx.
p4(0.1, 0.).y(),
857 ivfVtx.
p4(0.1, 0.).z() );
859 Track incom(trackref->chi2(), trackref->ndof(), iv_pos, iv_mom, 0, trackref->covariance());
862 transIncom.setBeamSpot( *bsH );
863 transIncom.setES( iSetup );
878 VertexRef bestvertexref = vtxcollV->at(0);
879 float bestweight = 0.;
882 for(
unsigned int index_vtx=0; index_vtx<vtxcollV->size(); ++index_vtx){
884 VertexRef vertexref = vtxcollV->at(index_vtx);
887 float weight = vertexref->trackWeight(trackbaseRef);
888 if(weight>bestweight){
890 bestvertexref = vertexref;
895 return bestvertexref;
911 transtrk.
setES(iSetup);
917 if ( assocNum>0 )
goto finalStep;
923 if ( foundVertex->trackWeight(trackbaseRef) >= 1.e-5 ){
924 return make_pair( foundVertex, 0. );
939 return make_pair( foundVertex, 1. );
948 return make_pair( foundVertex, 1. );
958 return make_pair( foundVertex, 1. );
970 return make_pair( foundVertex, 1. );
1000 transtrk.
setES(iSetup);
1010 foundVertex = vtxColl->at(0);
1017 return make_pair( foundVertex, 2. );
1030 int assoc_ite = distances.size();
1032 if ( assoc_ite >= 2 )
return 0;
1066 if ( assoc_ite == 0 ) {
1081 int firstDistance = distances.at(0).second;
1083 switch ( firstStep ) {
1126 if ( assoc_ite == 0 ) {
1141 int firstDistance = distances.at(0).second;
1143 switch ( firstStep ) {
1192 if ( assoc_ite == 0 ) {
1207 int firstDistance = distances.at(0).second;
1209 switch ( firstStep ) {
const reco::Vertex & conversionVertex() const
returns the reco conversion vertex
VertexStepPair FindAssociation(const reco::TrackRef &, std::vector< reco::VertexRef > *, edm::ESHandle< MagneticField >, const edm::EventSetup &, edm::Handle< reco::BeamSpot >, int)
reco::Vertex::Point convertPos(const GlobalPoint &p)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual std::auto_ptr< reco::VertexCompositeCandidateCollection > GetCleanedLambda(edm::Handle< reco::VertexCompositeCandidateCollection >, bool)
edm::InputTag IFVVertexCollection_
std::vector< PFDisplacedVertex > PFDisplacedVertexCollection
collection of PFDisplacedVertex objects
std::vector< TrackQualityPair > TrackQualityPairVector
edm::ESHandle< MagneticField > bFieldH
std::vector< VertexCompositeCandidate > VertexCompositeCandidateCollection
collection of Candidate objects
edm::InputTag ConversionsCollection_
virtual std::auto_ptr< reco::ConversionCollection > GetCleanedConversions(edm::Handle< reco::ConversionCollection >, bool)
const double fz_1st_70_cum
const double f1_1st_50_cum
const double sc_2nd_f3_0_cum
const bool isTherePrimaryTracks() const
--—— Provide useful information --—— ///
const_iterator end() const
last iterator over the map (read only)
const double sc_2nd_f3_1_cum
void setBeamSpot(const reco::BeamSpot &beamSpot)
TrackBaseRef originalTrack(const Track &refTrack) const
static bool ComesFromNI(const reco::TrackRef, const reco::PFDisplacedVertexCollection &, reco::PFDisplacedVertex *)
static reco::VertexRef FindConversionVertex(const reco::TrackRef, const reco::Conversion &, edm::ESHandle< MagneticField >, const edm::EventSetup &, edm::Handle< reco::BeamSpot >, std::vector< reco::VertexRef > *, double)
virtual const Point & vertex() const
vertex position (overwritten by PF...)
edm::InputTag KshortCollection_
int input_MaxNumAssociations_
bool input_doReassociation_
void EraseVertex(std::vector< reco::VertexRef > *, reco::VertexRef)
reco::Vertex::Error convertError(const GlobalError &ge)
edm::InputTag LambdaCollection_
std::vector< Track > TrackCollection
collection of Tracks
static reco::VertexRef FindClosest3D(reco::TransientTrack, std::vector< reco::VertexRef > *, double tWeight=0.)
VertexDistanceXY distanceComputerXY
const bool isIncomingTrack(const reco::TrackBaseRef &originalTrack) const
Is primary or merged track.
std::vector< Vertex > VertexCollection
collection of Vertex objects
const double sc_2nd_f1_1_cum
const double f3_1st_50_cum
edm::InputTag input_VertexCollection_
std::auto_ptr< TrackToVertexAssMap > CreateTrackToVertexMap(edm::Handle< reco::TrackCollection >, const edm::EventSetup &)
tuple firstStep
First step, triplets, r=0.2 cm.
const std::vector< Track > & refittedTracks() const
Returns the container of refitted tracks.
static reco::VertexRef FindNIVertex(const reco::TrackRef, const reco::PFDisplacedVertex &, edm::ESHandle< MagneticField >, const edm::EventSetup &, edm::Handle< reco::BeamSpot >, std::vector< reco::VertexRef > *, double, reco::TransientTrack)
const double sc_1st_70_cum
const Point & position() const
position
const double fz_2nd_fz_cum
std::pair< reco::VertexRef, int > VertexStepPair
std::vector< Conversion > ConversionCollection
collectin of Conversion objects
edm::Handle< reco::VertexCollection > ivfVertexCollH
U second(std::pair< T, U > const &p)
static reco::VertexRef FindV0Vertex(const reco::TrackRef, const reco::VertexCompositeCandidate &, edm::ESHandle< MagneticField >, const edm::EventSetup &, edm::Handle< reco::BeamSpot >, std::vector< reco::VertexRef > *, double)
GlobalErrorBase< double, ErrorMatrixTag > GlobalError
std::auto_ptr< reco::VertexCollection > cleanedIVFCollP
const double sc_2nd_fz_0_cum
std::vector< VertexPtsumPair > VertexPtsumVector
const double tw_2nd_fz_cum
static reco::VertexRef FindClosestZ(const reco::TrackRef, std::vector< reco::VertexRef > *, double tWeight=0.)
edm::InputTag input_BeamSpot_
edm::InputTag NIVertexCollection_
edm::RefToBase< reco::Track > TrackBaseRef
persistent reference to a Track, using views
const double tw_1st_90_cum
VertexState BSVertexState
const double sc_2nd_f1_0_cum
const double f1_1st_70_cum
edm::Handle< reco::PFDisplacedVertexCollection > displVertexCollH
virtual void GetInputCollections(edm::Event &, const edm::EventSetup &)
virtual ~PF_PU_AssoMapAlgos()
std::auto_ptr< reco::VertexCompositeCandidateCollection > cleanedKshortCollP
static reco::VertexRef FindIVFVertex(const reco::TrackRef, const reco::Vertex &, edm::ESHandle< MagneticField >, const edm::EventSetup &, edm::Handle< reco::BeamSpot >, std::vector< reco::VertexRef > *, double)
static reco::VertexRef TrackWeightAssociation(const reco::TrackBaseRef &, std::vector< reco::VertexRef > *)
edm::AssociationMap< edm::OneToManyWithQuality< reco::VertexCollection, reco::TrackCollection, int > > TrackToVertexAssMap
virtual Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const
std::auto_ptr< reco::VertexCompositeCandidateCollection > cleanedLambdaCollP
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
const double tw_2nd_f3_cum
void setES(const edm::EventSetup &es)
edm::Handle< reco::VertexCollection > vtxcollH
std::auto_ptr< TrackToVertexAssMap > SortAssociationMap(TrackToVertexAssMap *)
bool ignoremissingpfcollection_
std::auto_ptr< reco::PFDisplacedVertexCollection > cleanedNICollP
const double fz_1st_50_cum
math::XYZTLorentzVectorF refittedPair4Momentum() const
Conversion track pair 4-momentum from the tracks refitted with vertex constraint. ...
int input_FinalAssociation_
virtual std::auto_ptr< reco::VertexCompositeCandidateCollection > GetCleanedKshort(edm::Handle< reco::VertexCompositeCandidateCollection >, bool)
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
math::XYZTLorentzVectorD p4(float mass=0.13957018, float minWeight=0.5) const
Returns the four momentum of the sum of the tracks, assuming the given mass for the decay products...
virtual std::auto_ptr< reco::VertexCollection > GetCleanedIVF(edm::Handle< reco::VertexCollection >, bool)
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
virtual Vector momentum() const GCC11_FINAL
spatial momentum vector
key_type key() const
Accessor for product key.
edm::Handle< reco::VertexCompositeCandidateCollection > vertCompCandCollLambdaH
virtual reco::TrackRef track() const
reference to a track
std::vector< reco::VertexRef > * CreateVertexVector(edm::Handle< reco::VertexCollection >)
const double tw_2nd_f1_cum
int DefineQuality(StepDistancePairVector, int, double)
static bool ComesFromConversion(const reco::TrackRef, const reco::ConversionCollection &, reco::Conversion *)
virtual std::auto_ptr< reco::PFDisplacedVertexCollection > GetCleanedNI(edm::Handle< reco::PFDisplacedVertexCollection >, bool)
static bool ComesFromV0Decay(const reco::TrackRef, const reco::VertexCompositeCandidateCollection &, reco::VertexCompositeCandidate *)
const double f3_1st_70_cum
edm::Handle< reco::BeamSpot > beamspotH
const_iterator begin() const
first iterator over the map (read only)
const double f3_2nd_f3_cum
static bool ComesFromIVF(const reco::TrackRef, const reco::VertexCollection &, reco::Vertex *)
edm::Handle< reco::ConversionCollection > convCollH
const bool isThereMergedTracks() const
If a merged track was identified.
const double sc_2nd_fz_1_cum
std::auto_ptr< VertexToTrackAssMap > CreateVertexToTrackMap(edm::Handle< reco::TrackCollection >, const edm::EventSetup &)
edm::AssociationMap< edm::OneToManyWithQuality< reco::TrackCollection, reco::VertexCollection, int > > VertexToTrackAssMap
edm::Handle< reco::VertexCompositeCandidateCollection > vertCompCandCollKshortH
PF_PU_AssoMapAlgos(const edm::ParameterSet &)
std::vector< StepDistancePair > StepDistancePairVector
std::auto_ptr< reco::ConversionCollection > cleanedConvCollP