55 for(
unsigned i=0;
i<inCands.size();
i++) {
58 inCands[
i].setSourceCandidatePtr( motherPtr );
68 std::auto_ptr<PFCandToVertexAssMap>
76 if ( num_vertices < num_associations) num_associations = num_vertices;
78 for(
unsigned i=0;
i<pfCandH->size();
i++ ) {
87 TrackRef PFCtrackref = candref->trackRef();
89 if ( PFCtrackref.
isNull() ){
91 for (
int assoc_ite = 0; assoc_ite < num_associations; ++assoc_ite ) {
93 int quality = -1 - assoc_ite;
100 pfcand2vertex->insert( vtxColl_help->at(0), make_pair(candref, quality) );
110 transtrk.
setES(iSetup);
112 for (
int assoc_ite = 0; assoc_ite < num_associations; ++assoc_ite ) {
115 VertexRef associatedVertex = assocVtx.first;
116 int step = assocVtx.second;
120 distances.push_back( make_pair(step, distance) );
127 pfcand2vertex->insert( associatedVertex, make_pair(candref, quality) );
139 return pfcand2vertex;
147 std::auto_ptr<VertexToPFCandAssMap>
154 int num_vertices =
vtxcollH->size();
155 if ( num_vertices < num_associations) num_associations = num_vertices;
157 for(
unsigned i=0;
i<pfCandH->size();
i++ ) {
166 TrackRef PFCtrackref = candref->trackRef();
168 if ( PFCtrackref.
isNull() ) {
170 for (
int assoc_ite = 0; assoc_ite < num_associations; ++assoc_ite ) {
172 int quality = -1 - assoc_ite;
179 vertex2pfcand->insert( candref, make_pair(vtxColl_help->at(0), quality) );
189 transtrk.
setES(iSetup);
191 for (
int assoc_ite = 0; assoc_ite < num_associations; ++assoc_ite ) {
194 VertexRef associatedVertex = assocVtx.first;
195 int step = assocVtx.second;
199 distances.push_back( make_pair(step, distance) );
206 vertex2pfcand->insert( candref, make_pair(associatedVertex, quality) );
218 return vertex2pfcand;
226 std::auto_ptr<PFCandToVertexAssMap>
247 for(
unsigned int pfccoll_ite=0; pfccoll_ite<pfccoll.size(); pfccoll_ite++){
249 pfcandref = pfccoll[pfccoll_ite].first;
250 int quality = pfccoll[pfccoll_ite].second;
252 if ( (quality<=2) && (quality!=-1) )
continue;
254 double man_pT = pfcandref->pt();
255 if(man_pT>0.) ptsum+=man_pT*man_pT;
259 vertexptsumvector.push_back(make_pair(assomap_vertexref,ptsum));
263 while (vertexptsumvector.size()!=0){
266 float highestpT = 0.;
267 int highestpT_index = 0;
269 for(
unsigned int vtxptsumvec_ite=0; vtxptsumvec_ite<vertexptsumvector.size(); vtxptsumvec_ite++){
271 if(vertexptsumvector[vtxptsumvec_ite].
second>highestpT){
273 vertexref_highestpT = vertexptsumvector[vtxptsumvec_ite].first;
274 highestpT = vertexptsumvector[vtxptsumvec_ite].second;
275 highestpT_index = vtxptsumvec_ite;
289 if (assomap_vertexref==vertexref_highestpT) {
290 for(
unsigned int pfccoll_ite=0; pfccoll_ite<pfccoll.size(); pfccoll_ite++) {
291 pfcvertexassOutput->insert(assomap_vertexref,pfccoll[pfccoll_ite]);
297 vertexptsumvector.erase(vertexptsumvector.begin()+highestpT_index);
301 return pfcvertexassOutput;
VertexStepPair FindAssociation(const reco::TrackRef &, std::vector< reco::VertexRef > *, edm::ESHandle< MagneticField >, const edm::EventSetup &, edm::Handle< reco::BeamSpot >, int)
T getParameter(std::string const &) const
int input_MaxNumAssociations_
const_iterator end() const
last iterator over the map (read only)
void setBeamSpot(const reco::BeamSpot &beamSpot)
edm::AssociationMap< edm::OneToManyWithQuality< reco::PFCandidateCollection, reco::VertexCollection, int > > VertexToPFCandAssMap
edm::InputTag input_BeamSpot_
std::pair< reco::VertexRef, PFCandQualityPair > VertexPfcQuality
void EraseVertex(std::vector< reco::VertexRef > *, reco::VertexRef)
edm::AssociationMap< edm::OneToManyWithQuality< reco::VertexCollection, reco::PFCandidateCollection, int > > PFCandToVertexAssMap
std::pair< reco::VertexRef, int > VertexStepPair
U second(std::pair< T, U > const &p)
std::vector< VertexPtsumPair > VertexPtsumVector
bool isNull() const
Checks for null.
std::auto_ptr< VertexToPFCandAssMap > CreateVertexToPFCandMap(edm::Handle< reco::PFCandidateCollection >, const edm::EventSetup &)
std::auto_ptr< PFCandToVertexAssMap > CreatePFCandToVertexMap(edm::Handle< reco::PFCandidateCollection >, const edm::EventSetup &)
edm::InputTag input_VertexCollection_
std::auto_ptr< PFCandToVertexAssMap > SortPFCandAssociationMap(PFCandToVertexAssMap *)
void SetMotherPointer(edm::Handle< reco::PFCandidateCollection > &)
virtual void GetInputCollections(edm::Event &, const edm::EventSetup &)
std::vector< PFCandQualityPair > PFCandQualityPairVector
edm::Handle< reco::BeamSpot > beamspotH
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
void setES(const edm::EventSetup &es)
PFCand_AssoMapAlgos(const edm::ParameterSet &)
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
edm::ESHandle< MagneticField > bFieldH
key_type key() const
Accessor for product key.
void GetPFCandInputCollections(edm::Event &, const edm::EventSetup &)
std::vector< reco::VertexRef > * CreateVertexVector(edm::Handle< reco::VertexCollection >)
int DefineQuality(StepDistancePairVector, int, double)
edm::Handle< reco::VertexCollection > vtxcollH
const_iterator begin() const
first iterator over the map (read only)
std::vector< StepDistancePair > StepDistancePairVector