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 #include "trackAlgoPriorityOrder.h"
36 
37 using namespace reco;
38 
40  public:
42  explicit DuplicateListMerger(const edm::ParameterSet& iPara);
44  virtual ~DuplicateListMerger();
45 
47  typedef std::pair<TrackCandidate,std::pair<reco::TrackRef,reco::TrackRef> > DuplicateRecord;
49  protected:
51  void produce( edm::Event &, const edm::EventSetup &) override;
52 
53  private:
54  int matchCandidateToTrack(TrackCandidate,edm::Handle<reco::TrackCollection>);
55 
57  return reinterpret_cast<const BaseTrackerRecHit *>(hit)->firstClusterRef().id();
58  }
59 
61  struct ThreeTokens {
68  tag(tag_), tk(tk_), traj(traj_), tass(tass_) {}
69  };
71  return ThreeTokens(tag, consumes<reco::TrackCollection>(tag), consumes<std::vector<Trajectory> >(tag), consumes<TrajTrackAssociationCollection >(tag));
72  }
73  ThreeTokens mergedTrackSource_, originalTrackSource_;
75 
80 
82  unsigned int diffHitsCut_;
86  };
87 
88 
94 
97 
98 
100 {
101  diffHitsCut_ = 9999;
102  minTrkProbCut_ = 0.0;
103  if(iPara.exists("diffHitsCut"))diffHitsCut_ = iPara.getParameter<int>("diffHitsCut");
104  if(iPara.exists("minTrkProbCut"))minTrkProbCut_ = iPara.getParameter<double>("minTrkProbCut");
105  if(iPara.exists("mergedSource")) mergedTrackSource_ = threeTokens(iPara.getParameter<edm::InputTag>("mergedSource"));
106  if(iPara.exists("originalSource"))originalTrackSource_ = threeTokens(iPara.getParameter<edm::InputTag>("originalSource"));
107  if(iPara.exists("candidateSource"))candidateSource_ = consumes<edm::View<DuplicateRecord> >(iPara.getParameter<edm::InputTag>("candidateSource"));
108 
109 
110  if(iPara.exists("mergedMVAVals")){
111  mergedMVAVals_ = iPara.getParameter<edm::InputTag>("mergedMVAVals");
112  }else{
113  mergedMVAVals_ = edm::InputTag(mergedTrackSource_.tag.label(),"MVAVals");
114  }
115  mergedMVAValsToken_ = consumes<edm::ValueMap<float> >(mergedMVAVals_);
116  if(iPara.exists("originalMVAVals")){
117  originalMVAVals_ = iPara.getParameter<edm::InputTag>("originalMVAVals");
118  }else{
119  originalMVAVals_ = edm::InputTag(originalTrackSource_.tag.label(),"MVAVals");
120  }
121  originalMVAValsToken_ = consumes<edm::ValueMap<float> >(originalMVAVals_);
122 
123  copyExtras_ = iPara.getUntrackedParameter<bool>("copyExtras",true);
124  qualityToSet_ = reco::TrackBase::undefQuality;
125  if (iPara.exists("newQuality")) {
126  std::string qualityStr = iPara.getParameter<std::string>("newQuality");
127  if (qualityStr != "") {
128  qualityToSet_ = reco::TrackBase::qualityByName(qualityStr);
129  }
130  }
131 
132  produces<std::vector<reco::Track> >();
133  produces< std::vector<Trajectory> >();
134  produces< TrajTrackAssociationCollection >();
135 
136  produces<edm::ValueMap<float> >("MVAVals");
137 
138  makeReKeyedSeeds_ = iPara.getUntrackedParameter<bool>("makeReKeyedSeeds",false);
139  if (makeReKeyedSeeds_){
140  copyExtras_=true;
141  produces<TrajectorySeedCollection>();
142  }
143  if(copyExtras_){
144  produces<reco::TrackExtraCollection>();
145  produces<TrackingRecHitCollection>();
146  }
147 
148 }
149 
151 {
152 
153  /* no op */
154 
155 }
156 
158 {
160  iEvent.getByToken(originalTrackSource_.tk,originalHandle);
162  iEvent.getByToken(mergedTrackSource_.tk,mergedHandle);
163 
164  const reco::TrackCollection& mergedTracks(*mergedHandle);
165  reco::TrackRefProd originalTrackRefs(originalHandle);
166  reco::TrackRefProd mergedTrackRefs(mergedHandle);
167 
168  edm::Handle< std::vector<Trajectory> > mergedTrajHandle;
169  iEvent.getByToken(mergedTrackSource_.traj,mergedTrajHandle);
170  edm::Handle< TrajTrackAssociationCollection > mergedTrajTrackHandle;
171  iEvent.getByToken(mergedTrackSource_.tass,mergedTrajTrackHandle);
172 
173  edm::Handle< std::vector<Trajectory> > originalTrajHandle;
174  iEvent.getByToken(originalTrackSource_.traj,originalTrajHandle);
175  edm::Handle< TrajTrackAssociationCollection > originalTrajTrackHandle;
176  iEvent.getByToken(originalTrackSource_.tass,originalTrajTrackHandle);
177 
178  edm::Handle<edm::View<DuplicateRecord> > candidateHandle;
179  iEvent.getByToken(candidateSource_,candidateHandle);
180 
181  std::auto_ptr<std::vector<reco::Track> > out_generalTracks(new std::vector<reco::Track>());
182  out_generalTracks->reserve(originalHandle->size());
184  std::auto_ptr< std::vector<Trajectory> > outputTrajs = std::auto_ptr< std::vector<Trajectory> >(new std::vector<Trajectory>());
185  outputTrajs->reserve(originalTrajHandle->size()+mergedTrajHandle->size());
187  //std::auto_ptr< TrajectorySeedCollection > outputSeeds
188 
189  std::auto_ptr<reco::TrackExtraCollection> outputTrkExtras;
190  reco::TrackExtraRefProd refTrkExtras;
191  std::auto_ptr<TrackingRecHitCollection> outputTrkHits;
192  TrackingRecHitRefProd refTrkHits;
193  std::auto_ptr<TrajectorySeedCollection> outputSeeds;
195 
196  edm::Handle<edm::ValueMap<float> > originalMVAStore;
197  edm::Handle<edm::ValueMap<float> > mergedMVAStore;
198 
199  iEvent.getByToken(originalMVAValsToken_,originalMVAStore);
200  iEvent.getByToken(mergedMVAValsToken_,mergedMVAStore);
201 
202  std::auto_ptr<edm::ValueMap<float> > vmMVA(new edm::ValueMap<float>);
203  edm::ValueMap<float>::Filler fillerMVA(*vmMVA);
204  std::vector<float> mvaVec;
205 
206 
207  if(copyExtras_){
208  outputTrkExtras = std::auto_ptr<reco::TrackExtraCollection>(new reco::TrackExtraCollection);
209  outputTrkExtras->reserve(originalHandle->size());
210  refTrkExtras = iEvent.getRefBeforePut<reco::TrackExtraCollection>();
211  outputTrkHits = std::auto_ptr<TrackingRecHitCollection>(new TrackingRecHitCollection);
212  outputTrkHits->reserve(originalHandle->size()*25);
213  refTrkHits = iEvent.getRefBeforePut<TrackingRecHitCollection>();
214  if (makeReKeyedSeeds_){
215  outputSeeds = std::auto_ptr<TrajectorySeedCollection>(new TrajectorySeedCollection);
216  outputSeeds->reserve(originalHandle->size());
217  refTrajSeeds = iEvent.getRefBeforePut<TrajectorySeedCollection>();
218  }
219  }
220 
221  //match new tracks to their candidates
222  std::vector<std::pair<int,const DuplicateRecord*> > matches;
223  for(int i = 0; i < (int)candidateHandle->size(); i++){
224  const DuplicateRecord& duplicateRecord = candidateHandle->at(i);
225  int matchTrack = matchCandidateToTrack(duplicateRecord.first,mergedHandle);
226  if(matchTrack < 0)continue;
227  const reco::Track& matchedTrack(mergedTracks[matchTrack]);
228  if( ChiSquaredProbability(matchedTrack.chi2(),matchedTrack.ndof()) < minTrkProbCut_)continue;
229  unsigned int dHits = (duplicateRecord.first.recHits().second - duplicateRecord.first.recHits().first) - matchedTrack.recHitsSize();
230  if(dHits > diffHitsCut_)continue;
231  matches.push_back(std::pair<int,const DuplicateRecord*>(matchTrack,&duplicateRecord));
232  }
233 
234  //check for candidates/tracks that share merged tracks, select minimum chi2, remove the rest
235  std::vector<std::pair<int,const DuplicateRecord*> >::iterator matchIter0 = matches.begin();
236  std::vector<std::pair<int,const DuplicateRecord*> >::iterator matchIter1;
237  while(matchIter0 != matches.end()){
238  double nchi2 = mergedTracks[matchIter0->first].normalizedChi2();
239  bool advance = true;
240  for(matchIter1 = matchIter0+1; matchIter1 != matches.end(); matchIter1++){
241  const reco::Track& match0first = *(matchIter0->second->second.first.get());
242  const reco::Track& match0second = *(matchIter0->second->second.second.get());
243  const reco::Track& match1first = *(matchIter1->second->second.first.get());
244  const reco::Track& match1second = *(matchIter1->second->second.second.get());
245  if(match1first.seedRef() == match0first.seedRef() ||
246  match1first.seedRef() == match0second.seedRef() ||
247  match1second.seedRef() == match0first.seedRef() ||
248  match1second.seedRef() == match0second.seedRef()){
249  double nchi2_1 = mergedTracks[matchIter1->first].normalizedChi2();
250  advance = false;
251  if(nchi2_1 < nchi2){
252  matches.erase(matchIter0);
253  }else{
254  matches.erase(matchIter1);
255  }
256  break;
257  }
258  }
259  if(advance)matchIter0++;
260  }
261 
262  //add the good merged tracks to the output list, remove input tracks
263  std::vector<reco::Track> inputTracks;
264 
265  refTrajs = iEvent.getRefBeforePut< std::vector<Trajectory> >();
266 
267  std::auto_ptr< TrajTrackAssociationCollection > outputTTAss = std::auto_ptr< TrajTrackAssociationCollection >(new TrajTrackAssociationCollection(refTrajs, refTrks));
268 
269  for(matchIter0 = matches.begin(); matchIter0 != matches.end(); matchIter0++){
270  reco::TrackRef inTrkRef1 = matchIter0->second->second.first;
271  reco::TrackRef inTrkRef2 = matchIter0->second->second.second;
272  const reco::Track& inTrk1 = *(inTrkRef1.get());
273  const reco::Track& inTrk2 = *(inTrkRef2.get());
274  reco::TrackBase::TrackAlgorithm newTrkAlgo = std::min(inTrk1.algo(),inTrk2.algo(),
277  });
278  int combinedQualityMask = (inTrk1.qualityMask() | inTrk2.qualityMask());
279  inputTracks.push_back(inTrk1);
280  inputTracks.push_back(inTrk2);
281  out_generalTracks->push_back(mergedTracks[matchIter0->first]);
282  reco::TrackRef curTrackRef = reco::TrackRef(refTrks, out_generalTracks->size() - 1);
283  float mergedMVA = (*mergedMVAStore)[reco::TrackRef(mergedTrackRefs,matchIter0->first)];
284  mvaVec.push_back(mergedMVA);
285  out_generalTracks->back().setAlgorithm(newTrkAlgo);
286  out_generalTracks->back().setQualityMask(combinedQualityMask);
287  out_generalTracks->back().setQuality(qualityToSet_);
288  edm::RefToBase<TrajectorySeed> origSeedRef;
289  if(copyExtras_){
290  const reco::Track& track = mergedTracks[matchIter0->first];
291  origSeedRef = track.seedRef();
292  //creating a seed with rekeyed clusters if required
293  if (makeReKeyedSeeds_){
294  bool doRekeyOnThisSeed=false;
295 
296  edm::InputTag clusterRemovalInfos("");
297  //grab on of the hits of the seed
298  if (origSeedRef->nHits()!=0){
299  TrajectorySeed::const_iterator firstHit=origSeedRef->recHits().first;
300  const TrackingRecHit *hit = &*firstHit;
301  if (firstHit->isValid()){
302  edm::ProductID pID=clusterProductB(hit);
303  // the cluster collection either produced a removalInfo or mot
304  //get the clusterremoval info from the provenance: will rekey if this is found
306  edm::Provenance prov=iEvent.getProvenance(pID);
307  clusterRemovalInfos=edm::InputTag(prov.moduleLabel(),
308  prov.productInstanceName(),
309  prov.processName());
310  doRekeyOnThisSeed=iEvent.getByLabel(clusterRemovalInfos,CRIh);
311  }//valid hit
312  }//nhit!=0
313 
314  if (doRekeyOnThisSeed && !(clusterRemovalInfos==edm::InputTag(""))) {
315  ClusterRemovalRefSetter refSetter(iEvent,clusterRemovalInfos);
316  TrajectorySeed::recHitContainer newRecHitContainer;
317  newRecHitContainer.reserve(origSeedRef->nHits());
318  TrajectorySeed::const_iterator iH=origSeedRef->recHits().first;
319  TrajectorySeed::const_iterator iH_end=origSeedRef->recHits().second;
320  for (;iH!=iH_end;++iH){
321  newRecHitContainer.push_back(*iH);
322  refSetter.reKey(&newRecHitContainer.back());
323  }
324  outputSeeds->push_back( TrajectorySeed( origSeedRef->startingState(),
325  newRecHitContainer,
326  origSeedRef->direction()));
327  }
328  //doRekeyOnThisSeed=true
329  else{
330  //just copy the one we had before
331  outputSeeds->push_back( TrajectorySeed(*origSeedRef));
332  }
333  edm::Ref<TrajectorySeedCollection> pureRef(refTrajSeeds, outputSeeds->size()-1);
334  origSeedRef=edm::RefToBase<TrajectorySeed>( pureRef);
335  }//creating a new seed and rekeying it rechit clusters.
336  // Fill TrackExtra collection
337  outputTrkExtras->push_back( reco::TrackExtra(
338  track.outerPosition(), track.outerMomentum(), track.outerOk(),
339  track.innerPosition(), track.innerMomentum(), track.innerOk(),
340  track.outerStateCovariance(), track.outerDetId(),
341  track.innerStateCovariance(), track.innerDetId(),
342  track.seedDirection(), origSeedRef ) );
343  out_generalTracks->back().setExtra( reco::TrackExtraRef( refTrkExtras, outputTrkExtras->size() - 1) );
344  reco::TrackExtra & tx = outputTrkExtras->back();
345  tx.setResiduals(track.residuals());
346  // fill TrackingRecHits
347  unsigned nh1=track.recHitsSize();
348  auto const firstTrackIndex = outputTrkHits->size();
349  for ( unsigned ih=0; ih<nh1; ++ih ) {
350  //const TrackingRecHit*hit=&((*(track->recHit(ih))));
351  outputTrkHits->push_back( track.recHit(ih)->clone() );
352  }
353  tx.setHits( refTrkHits, firstTrackIndex, outputTrkHits->size() - firstTrackIndex );
354  }
355  edm::Ref< std::vector<Trajectory> > trajRef(mergedTrajHandle, (*matchIter0).first);
356  TrajTrackAssociationCollection::const_iterator match = mergedTrajTrackHandle->find(trajRef);
357  if (match != mergedTrajTrackHandle->end()) {
358  if(curTrackRef.isNonnull()){
359  outputTrajs->push_back( *trajRef );
360  if (copyExtras_ && makeReKeyedSeeds_)
361  outputTrajs->back().setSeedRef( origSeedRef );
362  outputTTAss->insert(edm::Ref< std::vector<Trajectory> >(refTrajs, outputTrajs->size() - 1),curTrackRef );
363  }
364  }
365  }
366 
367  for(int i = 0; i < (int)originalHandle->size(); i++){
368  bool good = true;
369  const reco::Track& origTrack = originalHandle->at(i);
370  for(int j = 0; j < (int)inputTracks.size() && good; j++){
371  const reco::Track& inputTrack = inputTracks[j];
372  if(origTrack.seedRef() != inputTrack.seedRef())continue;
373  if(origTrack.charge() != inputTrack.charge())continue;
374  if(origTrack.momentum() != inputTrack.momentum())continue;
375  if(origTrack.referencePoint() != inputTrack.referencePoint())continue;
376  good = false;
377  }
378 
379  if(good){
380  out_generalTracks->push_back(origTrack);
381  reco::TrackRef curTrackRef = reco::TrackRef(refTrks, out_generalTracks->size() - 1);
382  edm::RefToBase<TrajectorySeed> origSeedRef;
383  reco::TrackRef origTrackRef = reco::TrackRef(originalHandle,i);
384  mvaVec.push_back((*originalMVAStore)[origTrackRef]);
385  //mvaVec.push_back((*originalMVAStore)[reco::TrackRef(originalTrackRefs,i)]);
386  if(copyExtras_){
387  const reco::Track& track = origTrack;
388  origSeedRef = track.seedRef();
389  //creating a seed with rekeyed clusters if required
390  if (makeReKeyedSeeds_){
391  bool doRekeyOnThisSeed=false;
392 
393  edm::InputTag clusterRemovalInfos("");
394  //grab on of the hits of the seed
395  if (origSeedRef->nHits()!=0){
396  TrajectorySeed::const_iterator firstHit=origSeedRef->recHits().first;
397  const TrackingRecHit *hit = &*firstHit;
398  if (firstHit->isValid()){
399  edm::ProductID pID=clusterProductB(hit);
400  // the cluster collection either produced a removalInfo or mot
401  //get the clusterremoval info from the provenance: will rekey if this is found
403  edm::Provenance prov=iEvent.getProvenance(pID);
404  clusterRemovalInfos=edm::InputTag(prov.moduleLabel(),
405  prov.productInstanceName(),
406  prov.processName());
407  doRekeyOnThisSeed=iEvent.getByLabel(clusterRemovalInfos,CRIh);
408  }//valid hit
409  }//nhit!=0
410 
411  if (doRekeyOnThisSeed && !(clusterRemovalInfos==edm::InputTag(""))) {
412  ClusterRemovalRefSetter refSetter(iEvent,clusterRemovalInfos);
413  TrajectorySeed::recHitContainer newRecHitContainer;
414  newRecHitContainer.reserve(origSeedRef->nHits());
415  TrajectorySeed::const_iterator iH=origSeedRef->recHits().first;
416  TrajectorySeed::const_iterator iH_end=origSeedRef->recHits().second;
417  for (;iH!=iH_end;++iH){
418  newRecHitContainer.push_back(*iH);
419  refSetter.reKey(&newRecHitContainer.back());
420  }
421  outputSeeds->push_back( TrajectorySeed( origSeedRef->startingState(),
422  newRecHitContainer,
423  origSeedRef->direction()));
424  }
425  //doRekeyOnThisSeed=true
426  else{
427  //just copy the one we had before
428  outputSeeds->push_back( TrajectorySeed(*origSeedRef));
429  }
430  edm::Ref<TrajectorySeedCollection> pureRef(refTrajSeeds, outputSeeds->size()-1);
431  origSeedRef=edm::RefToBase<TrajectorySeed>( pureRef);
432  }//creating a new seed and rekeying it rechit clusters.
433 
434  // Fill TrackExtra collection
435  outputTrkExtras->push_back( reco::TrackExtra(
436  track.outerPosition(), track.outerMomentum(), track.outerOk(),
437  track.innerPosition(), track.innerMomentum(), track.innerOk(),
438  track.outerStateCovariance(), track.outerDetId(),
439  track.innerStateCovariance(), track.innerDetId(),
440  track.seedDirection(), origSeedRef ) );
441  out_generalTracks->back().setExtra( reco::TrackExtraRef( refTrkExtras, outputTrkExtras->size() - 1) );
442  reco::TrackExtra & tx = outputTrkExtras->back();
443  tx.setResiduals(track.residuals());
444 
445  // fill TrackingRecHits
446  unsigned nh1=track.recHitsSize();
447  tx.setHits(refTrkHits,outputTrkHits->size(),nh1);
448  for (auto hh = track.recHitsBegin(), eh=track.recHitsEnd(); hh!=eh; ++hh ) {
449  outputTrkHits->push_back( (*hh)->clone() );
450  }
451 
452  }
453 
454  edm::Ref< std::vector<Trajectory> > trajRef(originalTrajHandle, i);
455  TrajTrackAssociationCollection::const_iterator match = originalTrajTrackHandle->find(trajRef);
456  if (match != originalTrajTrackHandle->end()) {
457  if(curTrackRef.isNonnull()){
458  outputTrajs->push_back( *trajRef );
459  if (copyExtras_ && makeReKeyedSeeds_)
460  outputTrajs->back().setSeedRef( origSeedRef );
461  outputTTAss->insert(edm::Ref< std::vector<Trajectory> >(refTrajs, outputTrajs->size() - 1),curTrackRef );
462  }
463  }
464  }
465  }
466 
467  edm::ProductID nPID = refTrks.id();
468  edm::TestHandle<TrackCollection> out_gtHandle(out_generalTracks.get(),nPID);
469 
470  fillerMVA.insert(out_gtHandle,mvaVec.begin(),mvaVec.end());
471  fillerMVA.fill();
472  iEvent.put(vmMVA,"MVAVals");
473 
474  out_generalTracks->shrink_to_fit(); iEvent.put(out_generalTracks);
475  if (copyExtras_) {
476  outputTrkExtras->shrink_to_fit(); iEvent.put(outputTrkExtras);
477  outputTrkHits->shrink_to_fit(); iEvent.put(outputTrkHits);
478  if (makeReKeyedSeeds_) {
479  outputSeeds->shrink_to_fit(); iEvent.put(outputSeeds);
480  }
481  }
482  outputTrajs->shrink_to_fit(); iEvent.put(outputTrajs);
483  iEvent.put(outputTTAss);
484 }
485 
486 //------------------------------------------------------------
487 //------------------------------------------------------------
488 //------------------------------------------------------------
489 //------------------------------------------------------------
491  int track = -1;
492  std::vector<int> rawIds;
493  RecHitContainer::const_iterator candBegin = candidate.recHits().first;
494  RecHitContainer::const_iterator candEnd = candidate.recHits().second;
495  for(; candBegin != candEnd; candBegin++){
496  rawIds.push_back((*(candBegin)).rawId());
497  }
498 
499 
500  for(int i = 0; i < (int)tracks->size() && track < 0;i++){
501  if( (*tracks)[i].seedRef() != candidate.seedRef())continue;
502  int match = 0;
503  trackingRecHit_iterator trackRecBegin = (*tracks)[i].recHitsBegin();
504  trackingRecHit_iterator trackRecEnd = (*tracks)[i].recHitsEnd();
505  for(;trackRecBegin != trackRecEnd; trackRecBegin++){
506  if(std::find(rawIds.begin(),rawIds.end(),(*(trackRecBegin))->rawId()) != rawIds.end()) match++;
507  }
508  if(match != (int)( (*tracks)[i].recHitsSize() ) ) continue;
509  track = i;
510  }
511 
512  return track;
513 }
514 
517 
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:644
int i
Definition: DBlmapReader.cc:9
reference back()
Definition: OwnVector.h:327
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
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:524
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
TrackQuality
track quality
Definition: TrackBase.h:149
#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:638
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:99
const math::XYZPoint & innerPosition() const
position of the innermost hit
Definition: Track.h:55
TrackAlgorithm algo() const
Definition: TrackBase.h:460
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:512
edm::InputTag originalMVAVals_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:115
recHitContainer::const_iterator const_iterator
double ndof() const
number of degrees of freedom of the fit
Definition: TrackBase.h:518
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:825
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:244
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:413
RefProd< PROD > getRefBeforePut()
Definition: Event.h:135
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:123
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
std::array< unsigned int, reco::TrackBase::algoSize > trackAlgoPriorityOrder
range recHits() const
double b
Definition: hdecay.h:120
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
double a
Definition: hdecay.h:121
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:137
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:530
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:78
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:179