CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DuplicateListMerger.cc
Go to the documentation of this file.
1 
27 #include <vector>
28 #include <algorithm>
29 #include <string>
30 #include <iostream>
31 #include <map>
32 
33 #include "TMVA/Reader.h"
34 
35 using namespace reco;
36 
38  public:
40  explicit DuplicateListMerger(const edm::ParameterSet& iPara);
42  virtual ~DuplicateListMerger();
43 
45  typedef std::pair<TrackCandidate,std::pair<reco::TrackRef,reco::TrackRef> > DuplicateRecord;
47  protected:
49  void produce( edm::Event &, const edm::EventSetup &) override;
50 
51  private:
52  int matchCandidateToTrack(TrackCandidate,edm::Handle<reco::TrackCollection>);
53 
55  return reinterpret_cast<const BaseTrackerRecHit *>(hit)->firstClusterRef().id();
56  }
57 
59  struct ThreeTokens {
66  tag(tag_), tk(tk_), traj(traj_), tass(tass_) {}
67  };
69  return ThreeTokens(tag, consumes<reco::TrackCollection>(tag), consumes<std::vector<Trajectory> >(tag), consumes<TrajTrackAssociationCollection >(tag));
70  }
71  ThreeTokens mergedTrackSource_, originalTrackSource_;
73 
78 
80  unsigned int diffHitsCut_;
84  };
85 
86 
92 
95 
96 
98 {
99  diffHitsCut_ = 9999;
100  minTrkProbCut_ = 0.0;
101  if(iPara.exists("diffHitsCut"))diffHitsCut_ = iPara.getParameter<int>("diffHitsCut");
102  if(iPara.exists("minTrkProbCut"))minTrkProbCut_ = iPara.getParameter<double>("minTrkProbCut");
103  if(iPara.exists("mergedSource")) mergedTrackSource_ = threeTokens(iPara.getParameter<edm::InputTag>("mergedSource"));
104  if(iPara.exists("originalSource"))originalTrackSource_ = threeTokens(iPara.getParameter<edm::InputTag>("originalSource"));
105  if(iPara.exists("candidateSource"))candidateSource_ = consumes<edm::View<DuplicateRecord> >(iPara.getParameter<edm::InputTag>("candidateSource"));
106 
107 
108  if(iPara.exists("mergedMVAVals")){
109  mergedMVAVals_ = iPara.getParameter<edm::InputTag>("mergedMVAVals");
110  }else{
111  mergedMVAVals_ = edm::InputTag(mergedTrackSource_.tag.label(),"MVAVals");
112  }
113  mergedMVAValsToken_ = consumes<edm::ValueMap<float> >(mergedMVAVals_);
114  if(iPara.exists("originalMVAVals")){
115  originalMVAVals_ = iPara.getParameter<edm::InputTag>("originalMVAVals");
116  }else{
117  originalMVAVals_ = edm::InputTag(originalTrackSource_.tag.label(),"MVAVals");
118  }
119  originalMVAValsToken_ = consumes<edm::ValueMap<float> >(originalMVAVals_);
120 
121  copyExtras_ = iPara.getUntrackedParameter<bool>("copyExtras",true);
122  qualityToSet_ = reco::TrackBase::undefQuality;
123  if (iPara.exists("newQuality")) {
124  std::string qualityStr = iPara.getParameter<std::string>("newQuality");
125  if (qualityStr != "") {
126  qualityToSet_ = reco::TrackBase::qualityByName(qualityStr);
127  }
128  }
129 
130  produces<std::vector<reco::Track> >();
131  produces< std::vector<Trajectory> >();
132  produces< TrajTrackAssociationCollection >();
133 
134  produces<edm::ValueMap<float> >("MVAVals");
135 
136  makeReKeyedSeeds_ = iPara.getUntrackedParameter<bool>("makeReKeyedSeeds",false);
137  if (makeReKeyedSeeds_){
138  copyExtras_=true;
139  produces<TrajectorySeedCollection>();
140  }
141  if(copyExtras_){
142  produces<reco::TrackExtraCollection>();
143  produces<TrackingRecHitCollection>();
144  }
145 
146 }
147 
149 {
150 
151  /* no op */
152 
153 }
154 
156 {
158  iEvent.getByToken(originalTrackSource_.tk,originalHandle);
160  iEvent.getByToken(mergedTrackSource_.tk,mergedHandle);
161 
162  const reco::TrackCollection& mergedTracks(*mergedHandle);
163  reco::TrackRefProd originalTrackRefs(originalHandle);
164  reco::TrackRefProd mergedTrackRefs(mergedHandle);
165 
166  edm::Handle< std::vector<Trajectory> > mergedTrajHandle;
167  iEvent.getByToken(mergedTrackSource_.traj,mergedTrajHandle);
168  edm::Handle< TrajTrackAssociationCollection > mergedTrajTrackHandle;
169  iEvent.getByToken(mergedTrackSource_.tass,mergedTrajTrackHandle);
170 
171  edm::Handle< std::vector<Trajectory> > originalTrajHandle;
172  iEvent.getByToken(originalTrackSource_.traj,originalTrajHandle);
173  edm::Handle< TrajTrackAssociationCollection > originalTrajTrackHandle;
174  iEvent.getByToken(originalTrackSource_.tass,originalTrajTrackHandle);
175 
176  edm::Handle<edm::View<DuplicateRecord> > candidateHandle;
177  iEvent.getByToken(candidateSource_,candidateHandle);
178 
179  std::auto_ptr<std::vector<reco::Track> > out_generalTracks(new std::vector<reco::Track>());
180  out_generalTracks->reserve(originalHandle->size());
182  std::auto_ptr< std::vector<Trajectory> > outputTrajs = std::auto_ptr< std::vector<Trajectory> >(new std::vector<Trajectory>());
183  outputTrajs->reserve(originalTrajHandle->size()+mergedTrajHandle->size());
185  std::auto_ptr< TrajTrackAssociationCollection > outputTTAss = std::auto_ptr< TrajTrackAssociationCollection >(new TrajTrackAssociationCollection());
186  //std::auto_ptr< TrajectorySeedCollection > outputSeeds
187 
188  std::auto_ptr<reco::TrackExtraCollection> outputTrkExtras;
189  reco::TrackExtraRefProd refTrkExtras;
190  std::auto_ptr<TrackingRecHitCollection> outputTrkHits;
191  TrackingRecHitRefProd refTrkHits;
192  std::auto_ptr<TrajectorySeedCollection> outputSeeds;
194 
195  edm::Handle<edm::ValueMap<float> > originalMVAStore;
196  edm::Handle<edm::ValueMap<float> > mergedMVAStore;
197 
198  iEvent.getByToken(originalMVAValsToken_,originalMVAStore);
199  iEvent.getByToken(mergedMVAValsToken_,mergedMVAStore);
200 
201  std::auto_ptr<edm::ValueMap<float> > vmMVA(new edm::ValueMap<float>);
202  edm::ValueMap<float>::Filler fillerMVA(*vmMVA);
203  std::vector<float> mvaVec;
204 
205 
206  if(copyExtras_){
207  outputTrkExtras = std::auto_ptr<reco::TrackExtraCollection>(new reco::TrackExtraCollection);
208  outputTrkExtras->reserve(originalHandle->size());
209  refTrkExtras = iEvent.getRefBeforePut<reco::TrackExtraCollection>();
210  outputTrkHits = std::auto_ptr<TrackingRecHitCollection>(new TrackingRecHitCollection);
211  outputTrkHits->reserve(originalHandle->size()*25);
212  refTrkHits = iEvent.getRefBeforePut<TrackingRecHitCollection>();
213  if (makeReKeyedSeeds_){
214  outputSeeds = std::auto_ptr<TrajectorySeedCollection>(new TrajectorySeedCollection);
215  outputSeeds->reserve(originalHandle->size());
216  refTrajSeeds = iEvent.getRefBeforePut<TrajectorySeedCollection>();
217  }
218  }
219 
220  //match new tracks to their candidates
221  std::vector<std::pair<int,const DuplicateRecord*> > matches;
222  for(int i = 0; i < (int)candidateHandle->size(); i++){
223  const DuplicateRecord& duplicateRecord = candidateHandle->at(i);
224  int matchTrack = matchCandidateToTrack(duplicateRecord.first,mergedHandle);
225  if(matchTrack < 0)continue;
226  const reco::Track& matchedTrack(mergedTracks[matchTrack]);
227  if( ChiSquaredProbability(matchedTrack.chi2(),matchedTrack.ndof()) < minTrkProbCut_)continue;
228  unsigned int dHits = (duplicateRecord.first.recHits().second - duplicateRecord.first.recHits().first) - matchedTrack.recHitsSize();
229  if(dHits > diffHitsCut_)continue;
230  matches.push_back(std::pair<int,const DuplicateRecord*>(matchTrack,&duplicateRecord));
231  }
232 
233  //check for candidates/tracks that share merged tracks, select minimum chi2, remove the rest
234  std::vector<std::pair<int,const DuplicateRecord*> >::iterator matchIter0 = matches.begin();
235  std::vector<std::pair<int,const DuplicateRecord*> >::iterator matchIter1;
236  while(matchIter0 != matches.end()){
237  double nchi2 = mergedTracks[matchIter0->first].normalizedChi2();
238  bool advance = true;
239  for(matchIter1 = matchIter0+1; matchIter1 != matches.end(); matchIter1++){
240  const reco::Track& match0first = *(matchIter0->second->second.first.get());
241  const reco::Track& match0second = *(matchIter0->second->second.second.get());
242  const reco::Track& match1first = *(matchIter1->second->second.first.get());
243  const reco::Track& match1second = *(matchIter1->second->second.second.get());
244  if(match1first.seedRef() == match0first.seedRef() ||
245  match1first.seedRef() == match0second.seedRef() ||
246  match1second.seedRef() == match0first.seedRef() ||
247  match1second.seedRef() == match0second.seedRef()){
248  double nchi2_1 = mergedTracks[matchIter1->first].normalizedChi2();
249  advance = false;
250  if(nchi2_1 < nchi2){
251  matches.erase(matchIter0);
252  }else{
253  matches.erase(matchIter1);
254  }
255  break;
256  }
257  }
258  if(advance)matchIter0++;
259  }
260 
261  //add the good merged tracks to the output list, remove input tracks
262  std::vector<reco::Track> inputTracks;
263 
264  refTrajs = iEvent.getRefBeforePut< std::vector<Trajectory> >();
265 
266  for(matchIter0 = matches.begin(); matchIter0 != matches.end(); matchIter0++){
267  reco::TrackRef inTrkRef1 = matchIter0->second->second.first;
268  reco::TrackRef inTrkRef2 = matchIter0->second->second.second;
269  const reco::Track& inTrk1 = *(inTrkRef1.get());
270  const reco::Track& inTrk2 = *(inTrkRef2.get());
271  reco::TrackBase::TrackAlgorithm newTrkAlgo = std::min(inTrk1.algo(),inTrk2.algo());
272  int combinedQualityMask = (inTrk1.qualityMask() | inTrk2.qualityMask());
273  inputTracks.push_back(inTrk1);
274  inputTracks.push_back(inTrk2);
275  out_generalTracks->push_back(mergedTracks[matchIter0->first]);
276  reco::TrackRef curTrackRef = reco::TrackRef(refTrks, out_generalTracks->size() - 1);
277  float mergedMVA = (*mergedMVAStore)[reco::TrackRef(mergedTrackRefs,matchIter0->first)];
278  mvaVec.push_back(mergedMVA);
279  out_generalTracks->back().setAlgorithm(newTrkAlgo);
280  out_generalTracks->back().setQualityMask(combinedQualityMask);
281  out_generalTracks->back().setQuality(qualityToSet_);
282  edm::RefToBase<TrajectorySeed> origSeedRef;
283  if(copyExtras_){
284  const reco::Track& track = mergedTracks[matchIter0->first];
285  origSeedRef = track.seedRef();
286  //creating a seed with rekeyed clusters if required
287  if (makeReKeyedSeeds_){
288  bool doRekeyOnThisSeed=false;
289 
290  edm::InputTag clusterRemovalInfos("");
291  //grab on of the hits of the seed
292  if (origSeedRef->nHits()!=0){
293  TrajectorySeed::const_iterator firstHit=origSeedRef->recHits().first;
294  const TrackingRecHit *hit = &*firstHit;
295  if (firstHit->isValid()){
296  edm::ProductID pID=clusterProductB(hit);
297  // the cluster collection either produced a removalInfo or mot
298  //get the clusterremoval info from the provenance: will rekey if this is found
300  edm::Provenance prov=iEvent.getProvenance(pID);
301  clusterRemovalInfos=edm::InputTag(prov.moduleLabel(),
302  prov.productInstanceName(),
303  prov.processName());
304  doRekeyOnThisSeed=iEvent.getByLabel(clusterRemovalInfos,CRIh);
305  }//valid hit
306  }//nhit!=0
307 
308  if (doRekeyOnThisSeed && !(clusterRemovalInfos==edm::InputTag(""))) {
309  ClusterRemovalRefSetter refSetter(iEvent,clusterRemovalInfos);
310  TrajectorySeed::recHitContainer newRecHitContainer;
311  newRecHitContainer.reserve(origSeedRef->nHits());
312  TrajectorySeed::const_iterator iH=origSeedRef->recHits().first;
313  TrajectorySeed::const_iterator iH_end=origSeedRef->recHits().second;
314  for (;iH!=iH_end;++iH){
315  newRecHitContainer.push_back(*iH);
316  refSetter.reKey(&newRecHitContainer.back());
317  }
318  outputSeeds->push_back( TrajectorySeed( origSeedRef->startingState(),
319  newRecHitContainer,
320  origSeedRef->direction()));
321  }
322  //doRekeyOnThisSeed=true
323  else{
324  //just copy the one we had before
325  outputSeeds->push_back( TrajectorySeed(*origSeedRef));
326  }
327  edm::Ref<TrajectorySeedCollection> pureRef(refTrajSeeds, outputSeeds->size()-1);
328  origSeedRef=edm::RefToBase<TrajectorySeed>( pureRef);
329  }//creating a new seed and rekeying it rechit clusters.
330  // Fill TrackExtra collection
331  outputTrkExtras->push_back( reco::TrackExtra(
332  track.outerPosition(), track.outerMomentum(), track.outerOk(),
333  track.innerPosition(), track.innerMomentum(), track.innerOk(),
334  track.outerStateCovariance(), track.outerDetId(),
335  track.innerStateCovariance(), track.innerDetId(),
336  track.seedDirection(), origSeedRef ) );
337  out_generalTracks->back().setExtra( reco::TrackExtraRef( refTrkExtras, outputTrkExtras->size() - 1) );
338  reco::TrackExtra & tx = outputTrkExtras->back();
339  tx.setResiduals(track.residuals());
340  // fill TrackingRecHits
341  unsigned nh1=track.recHitsSize();
342  auto const firstTrackIndex = outputTrkHits->size();
343  for ( unsigned ih=0; ih<nh1; ++ih ) {
344  //const TrackingRecHit*hit=&((*(track->recHit(ih))));
345  outputTrkHits->push_back( track.recHit(ih)->clone() );
346  }
347  tx.setHits( refTrkHits, firstTrackIndex, outputTrkHits->size() - firstTrackIndex );
348  }
349  edm::Ref< std::vector<Trajectory> > trajRef(mergedTrajHandle, (*matchIter0).first);
350  TrajTrackAssociationCollection::const_iterator match = mergedTrajTrackHandle->find(trajRef);
351  if (match != mergedTrajTrackHandle->end()) {
352  if(curTrackRef.isNonnull()){
353  outputTrajs->push_back( *trajRef );
354  if (copyExtras_ && makeReKeyedSeeds_)
355  outputTrajs->back().setSeedRef( origSeedRef );
356  outputTTAss->insert(edm::Ref< std::vector<Trajectory> >(refTrajs, outputTrajs->size() - 1),curTrackRef );
357  }
358  }
359  }
360 
361  for(int i = 0; i < (int)originalHandle->size(); i++){
362  bool good = true;
363  const reco::Track& origTrack = originalHandle->at(i);
364  for(int j = 0; j < (int)inputTracks.size() && good; j++){
365  const reco::Track& inputTrack = inputTracks[j];
366  if(origTrack.seedRef() != inputTrack.seedRef())continue;
367  if(origTrack.charge() != inputTrack.charge())continue;
368  if(origTrack.momentum() != inputTrack.momentum())continue;
369  if(origTrack.referencePoint() != inputTrack.referencePoint())continue;
370  good = false;
371  }
372 
373  if(good){
374  out_generalTracks->push_back(origTrack);
375  reco::TrackRef curTrackRef = reco::TrackRef(refTrks, out_generalTracks->size() - 1);
376  edm::RefToBase<TrajectorySeed> origSeedRef;
377  reco::TrackRef origTrackRef = reco::TrackRef(originalHandle,i);
378  mvaVec.push_back((*originalMVAStore)[origTrackRef]);
379  //mvaVec.push_back((*originalMVAStore)[reco::TrackRef(originalTrackRefs,i)]);
380  if(copyExtras_){
381  const reco::Track& track = origTrack;
382  origSeedRef = track.seedRef();
383  //creating a seed with rekeyed clusters if required
384  if (makeReKeyedSeeds_){
385  bool doRekeyOnThisSeed=false;
386 
387  edm::InputTag clusterRemovalInfos("");
388  //grab on of the hits of the seed
389  if (origSeedRef->nHits()!=0){
390  TrajectorySeed::const_iterator firstHit=origSeedRef->recHits().first;
391  const TrackingRecHit *hit = &*firstHit;
392  if (firstHit->isValid()){
393  edm::ProductID pID=clusterProductB(hit);
394  // the cluster collection either produced a removalInfo or mot
395  //get the clusterremoval info from the provenance: will rekey if this is found
397  edm::Provenance prov=iEvent.getProvenance(pID);
398  clusterRemovalInfos=edm::InputTag(prov.moduleLabel(),
399  prov.productInstanceName(),
400  prov.processName());
401  doRekeyOnThisSeed=iEvent.getByLabel(clusterRemovalInfos,CRIh);
402  }//valid hit
403  }//nhit!=0
404 
405  if (doRekeyOnThisSeed && !(clusterRemovalInfos==edm::InputTag(""))) {
406  ClusterRemovalRefSetter refSetter(iEvent,clusterRemovalInfos);
407  TrajectorySeed::recHitContainer newRecHitContainer;
408  newRecHitContainer.reserve(origSeedRef->nHits());
409  TrajectorySeed::const_iterator iH=origSeedRef->recHits().first;
410  TrajectorySeed::const_iterator iH_end=origSeedRef->recHits().second;
411  for (;iH!=iH_end;++iH){
412  newRecHitContainer.push_back(*iH);
413  refSetter.reKey(&newRecHitContainer.back());
414  }
415  outputSeeds->push_back( TrajectorySeed( origSeedRef->startingState(),
416  newRecHitContainer,
417  origSeedRef->direction()));
418  }
419  //doRekeyOnThisSeed=true
420  else{
421  //just copy the one we had before
422  outputSeeds->push_back( TrajectorySeed(*origSeedRef));
423  }
424  edm::Ref<TrajectorySeedCollection> pureRef(refTrajSeeds, outputSeeds->size()-1);
425  origSeedRef=edm::RefToBase<TrajectorySeed>( pureRef);
426  }//creating a new seed and rekeying it rechit clusters.
427 
428  // Fill TrackExtra collection
429  outputTrkExtras->push_back( reco::TrackExtra(
430  track.outerPosition(), track.outerMomentum(), track.outerOk(),
431  track.innerPosition(), track.innerMomentum(), track.innerOk(),
432  track.outerStateCovariance(), track.outerDetId(),
433  track.innerStateCovariance(), track.innerDetId(),
434  track.seedDirection(), origSeedRef ) );
435  out_generalTracks->back().setExtra( reco::TrackExtraRef( refTrkExtras, outputTrkExtras->size() - 1) );
436  reco::TrackExtra & tx = outputTrkExtras->back();
437  tx.setResiduals(track.residuals());
438 
439  // fill TrackingRecHits
440  unsigned nh1=track.recHitsSize();
441  tx.setHits(refTrkHits,outputTrkHits->size(),nh1);
442  for (auto hh = track.recHitsBegin(), eh=track.recHitsEnd(); hh!=eh; ++hh ) {
443  outputTrkHits->push_back( (*hh)->clone() );
444  }
445 
446  }
447 
448  edm::Ref< std::vector<Trajectory> > trajRef(originalTrajHandle, i);
449  TrajTrackAssociationCollection::const_iterator match = originalTrajTrackHandle->find(trajRef);
450  if (match != originalTrajTrackHandle->end()) {
451  if(curTrackRef.isNonnull()){
452  outputTrajs->push_back( *trajRef );
453  if (copyExtras_ && makeReKeyedSeeds_)
454  outputTrajs->back().setSeedRef( origSeedRef );
455  outputTTAss->insert(edm::Ref< std::vector<Trajectory> >(refTrajs, outputTrajs->size() - 1),curTrackRef );
456  }
457  }
458  }
459  }
460 
461  edm::ProductID nPID = refTrks.id();
462  edm::TestHandle<TrackCollection> out_gtHandle(out_generalTracks.get(),nPID);
463 
464  fillerMVA.insert(out_gtHandle,mvaVec.begin(),mvaVec.end());
465  fillerMVA.fill();
466  iEvent.put(vmMVA,"MVAVals");
467 
468  out_generalTracks->shrink_to_fit(); iEvent.put(out_generalTracks);
469  if (copyExtras_) {
470  outputTrkExtras->shrink_to_fit(); iEvent.put(outputTrkExtras);
471  outputTrkHits->shrink_to_fit(); iEvent.put(outputTrkHits);
472  if (makeReKeyedSeeds_) {
473  outputSeeds->shrink_to_fit(); iEvent.put(outputSeeds);
474  }
475  }
476  outputTrajs->shrink_to_fit(); iEvent.put(outputTrajs);
477  iEvent.put(outputTTAss);
478 }
479 
480 //------------------------------------------------------------
481 //------------------------------------------------------------
482 //------------------------------------------------------------
483 //------------------------------------------------------------
485  int track = -1;
486  std::vector<int> rawIds;
487  RecHitContainer::const_iterator candBegin = candidate.recHits().first;
488  RecHitContainer::const_iterator candEnd = candidate.recHits().second;
489  for(; candBegin != candEnd; candBegin++){
490  rawIds.push_back((*(candBegin)).rawId());
491  }
492 
493 
494  for(int i = 0; i < (int)tracks->size() && track < 0;i++){
495  if( (*tracks)[i].seedRef() != candidate.seedRef())continue;
496  int match = 0;
497  trackingRecHit_iterator trackRecBegin = (*tracks)[i].recHitsBegin();
498  trackingRecHit_iterator trackRecEnd = (*tracks)[i].recHitsEnd();
499  for(;trackRecBegin != trackRecEnd; trackRecBegin++){
500  if(std::find(rawIds.begin(),rawIds.end(),(*(trackRecBegin))->rawId()) != rawIds.end()) match++;
501  }
502  if(match != (int)( (*tracks)[i].recHitsSize() ) ) continue;
503  track = i;
504  }
505 
506  return track;
507 }
508 
511 
PropagationDirection direction() const
T getParameter(std::string const &) const
#define dso_hidden
T getUntrackedParameter(std::string const &, T const &) const
edm::OwnVector< TrackingRecHit > RecHitContainer
const Point & referencePoint() const
Reference point on the track.
Definition: TrackBase.h:729
int i
Definition: DBlmapReader.cc:9
reference back()
Definition: OwnVector.h:327
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
edm::EDGetTokenT< TrajTrackAssociationCollection > tass
range recHits() const
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
Definition: TrackBase.h:609
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
TrackQuality
track quality
Definition: TrackBase.h:133
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
size_t recHitsSize() const
Get number of RecHits. (Warning, this includes invalid hits, which are not physical hits)...
Definition: Track.h:119
void setHits(TrackingRecHitRefProd const &prod, unsigned firstH, unsigned int nH)
edm::EDGetTokenT< edm::ValueMap< float > > originalMVAValsToken_
void reKey(TrackingRecHit *hit) const
void insert(const H &h, I begin, I end)
Definition: ValueMap.h:52
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:13
edm::EDGetTokenT< std::vector< Trajectory > > traj
bool exists(std::string const &parameterName) const
checks if a parameter exists
bool innerOk() const
return true if the innermost hit is valid
Definition: Track.h:50
std::pair< TrackCandidate, std::pair< reco::TrackRef, reco::TrackRef > > DuplicateRecord
typedef container of candidate and input tracks
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:723
std::string const & processName() const
Definition: Provenance.h:61
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
const math::XYZPoint & outerPosition() const
position of the outermost hit
Definition: Track.h:65
TrackAlgorithm
track algorithm
Definition: TrackBase.h:97
const math::XYZPoint & innerPosition() const
position of the innermost hit
Definition: Track.h:55
TrackAlgorithm algo() const
Definition: TrackBase.h:423
void produce(edm::Event &, const edm::EventSetup &) override
produce one event
void push_back(D *&d)
Definition: OwnVector.h:280
int iEvent
Definition: GenABIO.cc:230
virtual ~DuplicateListMerger()
destructor
edm::EDGetTokenT< edm::View< DuplicateRecord > > candidateSource_
ThreeTokens originalTrackSource_
std::vector< TrajectorySeed > TrajectorySeedCollection
double chi2() const
chi-squared of the fit
Definition: TrackBase.h:597
edm::InputTag originalMVAVals_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
recHitContainer::const_iterator const_iterator
double ndof() const
number of degrees of freedom of the fit
Definition: TrackBase.h:603
DuplicateListMerger(const edm::ParameterSet &iPara)
constructor
CovarianceMatrix outerStateCovariance() const
outermost trajectory state curvilinear errors
Definition: Track.h:75
edm::InputTag mergedMVAVals_
int qualityMask() const
Definition: TrackBase.h:904
unsigned int outerDetId() const
DetId of the detector on which surface the outermost state is located.
Definition: Track.h:94
int j
Definition: DBlmapReader.cc:9
float ChiSquaredProbability(double chiSquared, double nrDOF)
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:242
T min(T a, T b)
Definition: MathUtil.h:58
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
Definition: Track.h:104
edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > > TrajTrackAssociationCollection
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:405
RefProd< PROD > getRefBeforePut()
Definition: Event.h:133
ThreeTokens threeTokens(const edm::InputTag &tag)
edm::EDGetTokenT< reco::TrackCollection > tk
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:11
edm::OwnVector< TrackingRecHit > TrackingRecHitCollection
collection of TrackingRecHits
edm::RefToBase< TrajectorySeed > seedRef() const
Definition: Track.h:213
int matchCandidateToTrack(TrackCandidate, edm::Handle< reco::TrackCollection >)
PTrajectoryStateOnDet const & startingState() const
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:108
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
Definition: Track.h:70
bool outerOk() const
return true if the outermost hit is valid
Definition: Track.h:45
tuple tracks
Definition: testEve_cfg.py:39
reco::TrackBase::TrackQuality qualityToSet_
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:19
CovarianceMatrix innerStateCovariance() const
innermost trajectory state curvilinear errors
Definition: Track.h:80
range recHits() const
std::string const & moduleLabel() const
Definition: Provenance.h:60
edm::ProductID clusterProductB(const TrackingRecHit *hit)
ThreeTokens(const edm::InputTag &tag_, edm::EDGetTokenT< reco::TrackCollection > &&tk_, edm::EDGetTokenT< std::vector< Trajectory > > &&traj_, edm::EDGetTokenT< TrajTrackAssociationCollection > &&tass_)
unsigned int nHits() const
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
Definition: Track.h:60
TrackingRecHitRef recHit(size_t i) const
Get i-th hit on the track.
Definition: Track.h:114
ProductID id() const
Accessor for product ID.
Definition: RefProd.h:140
const TrackResiduals & residuals() const
Definition: Track.h:220
PropagationDirection seedDirection() const
direction of how the hits were sorted in the original seed
Definition: Track.h:204
int charge() const
track electric charge
Definition: TrackBase.h:615
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
edm::EDGetTokenT< edm::ValueMap< float > > mergedMVAValsToken_
std::string const & productInstanceName() const
Definition: Provenance.h:62
Provenance getProvenance(BranchID const &theID) const
Definition: Event.cc:73
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
Definition: Track.h:99
edm::RefToBase< TrajectorySeed > seedRef() const
void reserve(size_t)
Definition: OwnVector.h:274
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
Definition: Track.h:109
void setResiduals(const TrackResiduals &r)
set the residuals
Definition: TrackExtra.h:178