31 std::string trackQualityType = config.
getParameter<std::string>(
"trackQuality");
67 std::map<TrackingVertexRef,std::pair<double, std::size_t> > matches;
69 std::cout <<
"reco::VertexCollection size = " << recoVertexes->size();
70 std::cout <<
" ; TrackingVertexCollection size = " << trackingVertexes->size() << std::endl << std::endl;
73 for (std::size_t recoIndex = 0; recoIndex < recoVertexes->size(); ++recoIndex)
79 double recoDaughterWeight = 0.;
94 std::vector<std::pair<TrackingParticleRef,double> > associations = associator[*recoDaughter];
98 std::vector<std::pair<TrackingParticleRef,double> >::const_iterator association = associations.begin();
99 association != associations.end();
106 matches[trackingVertex].first += recoVertex->
trackWeight(*recoDaughter);
107 matches[trackingVertex].second++;
111 recoDaughterWeight += recoVertex->
trackWeight(*recoDaughter);
114 std::size_t assoIndex = 0;
119 match != matches.end();
125 double matchedDaughterWeight =
match->second.first;
126 std::size_t matchedDaughterCounter =
match->second.second;
129 std::size_t simDaughterCounter = 0;
133 simDaughter != trackingVertex->daughterTracks_end();
136 if (
selector_(**simDaughter) ) simDaughterCounter++;
139 if ( simDaughterCounter < matchedDaughterCounter )
140 simDaughterCounter = matchedDaughterCounter;
145 double quality = (double)matchedDaughterWeight/recoDaughterWeight;
150 outputCollection.
insert(recoVertex, std::make_pair(trackingVertex, quality));
153 std::cout <<
" ; SimDaughterCounter = " << simDaughterCounter;
154 std::cout <<
" ; RecoDaughterWeight = " << recoDaughterWeight;
155 std::cout <<
" ; MatchedDaughterCounter = " << matchedDaughterCounter;
156 std::cout <<
" ; MatchedDaughterWeight = " << matchedDaughterWeight;
157 std::cout <<
" ; quality = " << quality << std::endl;
164 std::cout <<
"RecoToSim OUTPUT COLLECTION: outputCollection.size() = " << outputCollection.
size() << std::endl << std::endl;
166 return outputCollection;
181 std::map<std::size_t,std::pair<double, std::size_t> > matches;
184 for (std::size_t simIndex = 0; simIndex < trackingVertexes->size(); ++simIndex)
190 std::size_t simDaughterCounter = 0;
195 simDaughter != trackingVertex->daughterTracks_end();
200 if ( !
selector_(**simDaughter) )
continue;
205 std::vector<std::pair<reco::TrackBaseRef, double> > associations = associator[*simDaughter];
209 std::vector<std::pair<reco::TrackBaseRef,double> >::const_iterator association = associations.begin();
210 association != associations.end();
216 for (std::size_t recoIndex = 0; recoIndex < recoVertexes->size(); ++recoIndex)
228 recoDaughter->id() == recoTrack.
id() &&
229 recoDaughter->key() == recoTrack.
key()
232 matches[recoIndex].first += recoVertex->
trackWeight(*recoDaughter);
233 matches[recoIndex].second++;
240 simDaughterCounter++;
243 std::size_t assoIndex = 0;
247 std::map<std::size_t,std::pair<double,std::size_t> >::const_iterator
match = matches.begin();
248 match != matches.end();
254 double matchedDaughterWeight =
match->second.first;
255 std::size_t matchedDaughterCounter =
match->second.second;
257 double recoDaughterWeight = 0.;
266 recoDaughterWeight += recoVertex->
trackWeight(*recoDaughter);
269 if ( recoDaughterWeight < matchedDaughterWeight )
270 recoDaughterWeight = matchedDaughterWeight;
275 double quality = (double)matchedDaughterCounter/simDaughterCounter;
280 outputCollection.
insert(trackingVertex, std::make_pair(recoVertex, quality));
283 std::cout <<
" ; SimDaughterCounter = " << simDaughterCounter;
284 std::cout <<
" ; RecoDaughterWeight = " << recoDaughterWeight;
285 std::cout <<
" ; MatchedDaughterCounter = " << matchedDaughterCounter;
286 std::cout <<
" ; MatchedDaughterWeight = " << matchedDaughterWeight;
287 std::cout <<
" ; quality = " << quality << std::endl;
293 std::cout <<
"SimToReco OUTPUT COLLECTION: outputCollection.size() = " << outputCollection.
size() << std::endl << std::endl;
295 return outputCollection;
T getParameter(std::string const &) const
trackRef_iterator tracks_end() const
last iterator over tracks
double S2RMatchedRecoRatio_
reco::TrackBase::TrackQuality trackQuality_
double R2SMatchedRecoRatio_
double S2RMatchedSimRatio_
TrackingParticleSelector selector_
reco::VertexSimToRecoCollection associateSimToReco(edm::Handle< edm::View< reco::Vertex > > &, edm::Handle< TrackingVertexCollection > &, const edm::Event &, reco::SimToRecoCollection &) const
double R2SMatchedSimRatio_
size_type numberOfAssociations(const key_type &k) const
number of associations to a key
reco::VertexRecoToSimCollection associateRecoToSim(edm::Handle< edm::View< reco::Vertex > > &, edm::Handle< TrackingVertexCollection > &, const edm::Event &, reco::RecoToSimCollection &) const
SingleObjectSelector< TrackingParticleCollection,::TrackingParticleSelector > TrackingParticleSelector
float trackWeight(const TrackBaseRef &r) const
returns the weight with which a Track has contributed to the vertex-fit.
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
static TrackQuality qualityByName(const std::string &name)
size_type size() const
map size
void insert(const key_type &k, const data_type &v)
insert an association
VertexAssociatorByTracks(const edm::ParameterSet &)
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
~VertexAssociatorByTracks()
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
trackRef_iterator tracks_begin() const
first iterator over tracks