105 pID=
reinterpret_cast<const SiPixelRecHit *
>(hit)->cluster().id();
107 const std::type_info &
type =
typeid(*hit);
118 }
else throw cms::Exception(
"Unknown RecHit Type") <<
"RecHit of type " << type.name() <<
" not supported. (use c++filt to demangle the name)";
130 edm::LogWarning(
"SimpleTrackListMerger") <<
"this class is obsolete, please use TrackListMerger";
134 produces<reco::TrackCollection>();
137 if (makeReKeyedSeeds_){
139 produces<TrajectorySeedCollection>();
143 produces<reco::TrackExtraCollection>();
144 produces<TrackingRecHitCollection>();
146 produces< std::vector<Trajectory> >();
147 produces< TrajTrackAssociationCollection >();
174 bool use_sharesInput =
true;
175 if ( epsilon > 0.0 )use_sharesInput =
false;
187 if (qualityStr !=
"") {
209 if (trackCollection1.
isValid()) {
210 TC1 = trackCollection1.
product();
221 if (trackCollection2.
isValid()) {
222 TC2 = trackCollection2.
product();
239 outputTrkHits->reserve((TC1->size()+TC2->size())*25);
248 outputTrajs = std::auto_ptr< std::vector<Trajectory> >(
new std::vector<Trajectory>());
268 std::vector<int> selected1;
for (
unsigned int i=0; i<tC1.size(); ++
i){selected1.push_back(1);}
272 for (reco::TrackCollection::const_iterator track=tC1.begin(); track!=tC1.end(); track++){
274 if ((
short unsigned)track->ndof() < 1){
279 if (track->normalizedChi2() > maxNormalizedChisq){
284 if (track->found() < minFound){
289 if (track->pt() <
minPT){
298 std::vector<int> selected2;
for (
unsigned int i=0; i<tC2.size(); ++
i){selected2.push_back(1);}
302 for (reco::TrackCollection::const_iterator track=tC2.begin(); track!=tC2.end(); track++){
304 if ((
short unsigned)track->ndof() < 1){
309 if (track->normalizedChi2() > maxNormalizedChisq){
314 if (track->found() < minFound){
319 if (track->pt() <
minPT){
327 std::map<reco::TrackCollection::const_iterator, std::vector<const TrackingRecHit*> > rh1;
328 std::map<reco::TrackCollection::const_iterator, std::vector<const TrackingRecHit*> > rh2;
329 for (reco::TrackCollection::const_iterator track=tC1.begin(); track!=tC1.end(); ++track){
334 rh1[track].push_back(hit);
337 for (reco::TrackCollection::const_iterator track=tC2.begin(); track!=tC2.end(); ++track){
342 rh2[track].push_back(hit);
346 if ( (0<tC1.size())&&(0<tC2.size()) ){
348 for (reco::TrackCollection::const_iterator track=tC1.begin(); track!=tC1.end(); ++track){
350 if (!selected1[i])
continue;
351 std::vector<const TrackingRecHit*>& iHits = rh1[track];
352 unsigned nh1 = iHits.size();
353 int qualityMaskT1 = track->qualityMask();
355 for (reco::TrackCollection::const_iterator track2=tC2.begin(); track2!=tC2.end(); ++track2){
357 if ((!selected2[j])||(!selected1[
i]))
continue;
358 std::vector<const TrackingRecHit*>& jHits = rh2[track2];
359 unsigned nh2 = jHits.size();
362 for (
unsigned ih=0; ih<nh1; ++ih ) {
366 for (
unsigned jh=0; jh<nh2; ++jh ) {
370 if (!use_sharesInput){
374 if ( allowFirstHitShare && ( ih == 0 ) && ( jh == 0 ) ) firstoverlap=1;
379 if ( allowFirstHitShare && ( ih == 0 ) && ( jh == 0 ) ) firstoverlap=1;
386 int newQualityMask = (qualityMaskT1 | track2->qualityMask());
387 int nhit1 = track->numberOfValidHits();
388 int nhit2 = track2->numberOfValidHits();
389 if ( (noverlap-firstoverlap) > (
std::min(nhit1,nhit2)-firstoverlap)*shareFrac ) {
390 double score1 = foundHitBonus*nhit1 - lostHitPenalty*track->numberOfLostHits() - track->chi2();
391 double score2 = foundHitBonus*nhit2 - lostHitPenalty*track2->numberOfLostHits() - track2->chi2();
392 const double almostSame = 1.001;
393 if ( score1 > almostSame * score2 ){
395 selected1[
i]=10+newQualityMask;
396 }
else if ( score2 > almostSame * score1 ){
398 selected2[
j]=10+newQualityMask;
400 if (track->algo() <= track2->algo()) {
402 selected1[
i]=10+newQualityMask;
405 selected2[
j]=10+newQualityMask;
417 std::vector<edm::RefToBase<TrajectorySeed> > seedsRefs(tC1.size()+tC2.size());
422 for (reco::TrackCollection::const_iterator track=tC1.begin(); track!=tC1.end();
431 if (selected1[i]>1 && promoteQuality){
432 outputTrks->back().setQualityMask(selected1[i]-10);
440 bool doRekeyOnThisSeed=
false;
444 if (origSeedRef->
nHits()!=0){
447 if (firstHit->isValid()){
457 doRekeyOnThisSeed=e.
getByLabel(clusterRemovalInfos,CRIh);
461 if (doRekeyOnThisSeed && !(clusterRemovalInfos==
edm::InputTag(
"")))
468 for (;iH!=iH_end;++iH){
470 refSetter.
reKey(&newRecHitContainer.
back());
492 seedsRefs[
current]=origSeedRef;
497 std::vector<const TrackingRecHit*>& iHits = rh1[track];
498 unsigned nh1 = iHits.size();
500 for (
unsigned ih=0; ih<nh1; ++ih ) {
521 for (
size_t i = 0,
n = hTraj1->size(); i <
n; ++
i) {
524 if (match != hTTAss1->end()) {
526 short oldKey =
static_cast<short>(trkRef.
key());
531 outputTrajs->back().setSeedRef( seedsRefs[oldKey] );
543 for (reco::TrackCollection::const_iterator track=tC2.begin(); track!=tC2.end();
552 if (selected2[i]>1 && promoteQuality){
553 outputTrks->back().setQualityMask(selected2[i]-10);
561 bool doRekeyOnThisSeed=
false;
565 if (origSeedRef->
nHits()!=0){
568 if (firstHit->isValid()){
577 doRekeyOnThisSeed=e.
getByLabel(clusterRemovalInfos,CRIh);
581 if (doRekeyOnThisSeed && !(clusterRemovalInfos==
edm::InputTag(
"")))
588 for (;iH!=iH_end;++iH){
590 refSetter.
reKey(&newRecHitContainer.
back());
611 seedsRefs[
current]=origSeedRef;
616 std::vector<const TrackingRecHit*>& jHits = rh2[track];
617 unsigned nh2 = jHits.size();
619 for (
unsigned jh=0; jh<nh2; ++jh ) {
637 for (
size_t i = 0,
n = hTraj2->size(); i <
n; ++
i) {
640 if (match != hTTAss2->end()) {
642 short oldKey =
static_cast<short>(trkRef.
key()) + offset;
647 outputTrajs->back().setSeedRef( seedsRefs[oldKey] );
PropagationDirection direction() const
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::auto_ptr< TrackingRecHitCollection > outputTrkHits
virtual void produce(edm::Event &e, const edm::EventSetup &c) override
std::auto_ptr< TrajTrackAssociationCollection > outputTTAss
friend struct const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
TrackQuality
track quality
#define DEFINE_FWK_MODULE(type)
void reKey(TrackingRecHit *hit) const
std::vector< Track > TrackCollection
collection of Tracks
virtual bool sharesInput(const TrackingRecHit *other, SharedInputType what) const
TrackingRecHitRefProd refTrkHits
bool innerOk() const
return true if the innermost hit is valid
key_type key() const
Accessor for product key.
std::string const & processName() const
const math::XYZPoint & outerPosition() const
position of the outermost hit
edm::EDGetTokenT< std::vector< Trajectory > > trackProducer1TrajToken
ProductID id() const
Accessor for product ID.
std::auto_ptr< reco::TrackCollection > outputTrks
const math::XYZPoint & innerPosition() const
position of the innermost hit
edm::EDGetTokenT< std::vector< Trajectory > > trackProducer2TrajToken
std::string trackProducer2
edm::RefProd< TrajectorySeedCollection > refTrajSeeds
std::auto_ptr< TrajectorySeedCollection > outputSeeds
std::vector< TrajectorySeed > TrajectorySeedCollection
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
recHitContainer::const_iterator const_iterator
CovarianceMatrix outerStateCovariance() const
outermost trajectory state curvilinear errors
edm::EDGetTokenT< TrajTrackAssociationCollection > trackProducer1AssToken
unsigned int outerDetId() const
DetId of the detector on which surface the outermost state is located.
std::auto_ptr< reco::TrackExtraCollection > outputTrkExtras
OmniClusterRef const & monoClusterRef() const
edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > > TrajTrackAssociationCollection
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
edm::RefProd< std::vector< Trajectory > > refTrajs
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
reco::TrackRefProd refTrks
std::string trackProducer1
RefProd< PROD > getRefBeforePut()
virtual TrackingRecHit * clone() const =0
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
edm::OwnVector< TrackingRecHit > TrackingRecHitCollection
collection of TrackingRecHits
edm::RefToBase< TrajectorySeed > seedRef() const
PTrajectoryStateOnDet const & startingState() const
static TrackQuality qualityByName(const std::string &name)
ClusterRef cluster() const
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
T const * product() const
bool outerOk() const
return true if the outermost hit is valid
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
CovarianceMatrix innerStateCovariance() const
innermost trajectory state curvilinear errors
std::string const & moduleLabel() const
std::auto_ptr< std::vector< Trajectory > > outputTrajs
edm::EDGetTokenT< reco::TrackCollection > trackProducer1Token
unsigned int nHits() const
edm::ProductID id() const
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
SimpleTrackListMerger(const edm::ParameterSet &conf)
edm::EDGetTokenT< reco::TrackCollection > trackProducer2Token
const TrackResiduals & residuals() const
PropagationDirection seedDirection() const
direction of how the hits were sorted in the original seed
virtual ~SimpleTrackListMerger()
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
std::vector< reco::TrackRef > trackRefs
DetId geographicalId() const
edm::EDGetTokenT< TrajTrackAssociationCollection > trackProducer2AssToken
std::string const & productInstanceName() const
Provenance getProvenance(BranchID const &theID) const
virtual LocalPoint localPosition() const =0
reco::TrackExtraRefProd refTrkExtras
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection