49 pID=
reinterpret_cast<const SiPixelRecHit *
>(hit)->cluster().id();
51 const std::type_info &
type =
typeid(*hit);
62 }
else throw cms::Exception(
"Unknown RecHit Type") <<
"RecHit of type " << type.name() <<
" not supported. (use c++filt to demangle the name)";
74 produces<reco::TrackCollection>();
77 if (makeReKeyedSeeds_){
79 produces<TrajectorySeedCollection>();
83 produces<reco::TrackExtraCollection>();
84 produces<TrackingRecHitCollection>();
86 produces< std::vector<Trajectory> >();
87 produces< TrajTrackAssociationCollection >();
114 bool use_sharesInput =
true;
115 if ( epsilon > 0.0 )use_sharesInput =
false;
127 if (qualityStr !=
"") {
149 if (trackCollection1.
isValid()) {
150 TC1 = trackCollection1.
product();
161 if (trackCollection2.
isValid()) {
162 TC2 = trackCollection2.
product();
179 outputTrkHits->reserve((TC1->size()+TC2->size())*25);
188 outputTrajs = std::auto_ptr< std::vector<Trajectory> >(
new std::vector<Trajectory>());
208 std::vector<int> selected1;
for (
unsigned int i=0; i<tC1.size(); ++
i){selected1.push_back(1);}
212 for (reco::TrackCollection::const_iterator track=tC1.begin(); track!=tC1.end(); track++){
214 if ((
short unsigned)track->ndof() < 1){
219 if (track->normalizedChi2() > maxNormalizedChisq){
224 if (track->found() < minFound){
229 if (track->pt() < minPT){
238 std::vector<int> selected2;
for (
unsigned int i=0; i<tC2.size(); ++
i){selected2.push_back(1);}
242 for (reco::TrackCollection::const_iterator track=tC2.begin(); track!=tC2.end(); track++){
244 if ((
short unsigned)track->ndof() < 1){
249 if (track->normalizedChi2() > maxNormalizedChisq){
254 if (track->found() < minFound){
259 if (track->pt() < minPT){
267 std::map<reco::TrackCollection::const_iterator, std::vector<const TrackingRecHit*> > rh1;
268 std::map<reco::TrackCollection::const_iterator, std::vector<const TrackingRecHit*> > rh2;
269 for (reco::TrackCollection::const_iterator track=tC1.begin(); track!=tC1.end(); ++track){
274 rh1[track].push_back(hit);
277 for (reco::TrackCollection::const_iterator track=tC2.begin(); track!=tC2.end(); ++track){
282 rh2[track].push_back(hit);
286 if ( (0<tC1.size())&&(0<tC2.size()) ){
288 for (reco::TrackCollection::const_iterator track=tC1.begin(); track!=tC1.end(); ++track){
290 if (!selected1[i])
continue;
291 std::vector<const TrackingRecHit*>& iHits = rh1[track];
292 unsigned nh1 = iHits.size();
293 int qualityMaskT1 = track->qualityMask();
295 for (reco::TrackCollection::const_iterator track2=tC2.begin(); track2!=tC2.end(); ++track2){
297 if ((!selected2[j])||(!selected1[
i]))
continue;
298 std::vector<const TrackingRecHit*>& jHits = rh2[track2];
299 unsigned nh2 = jHits.size();
302 for (
unsigned ih=0; ih<nh1; ++ih ) {
306 for (
unsigned jh=0; jh<nh2; ++jh ) {
310 if (!use_sharesInput){
314 if ( allowFirstHitShare && ( ih == 0 ) && ( jh == 0 ) ) firstoverlap=1;
319 if ( allowFirstHitShare && ( ih == 0 ) && ( jh == 0 ) ) firstoverlap=1;
326 int newQualityMask = (qualityMaskT1 | track2->qualityMask());
327 int nhit1 = track->numberOfValidHits();
328 int nhit2 = track2->numberOfValidHits();
329 if ( (noverlap-firstoverlap) > (
std::min(nhit1,nhit2)-firstoverlap)*shareFrac ) {
330 double score1 = foundHitBonus*nhit1 - lostHitPenalty*track->numberOfLostHits() - track->chi2();
331 double score2 = foundHitBonus*nhit2 - lostHitPenalty*track2->numberOfLostHits() - track2->chi2();
332 const double almostSame = 1.001;
333 if ( score1 > almostSame * score2 ){
335 selected1[
i]=10+newQualityMask;
336 }
else if ( score2 > almostSame * score1 ){
338 selected2[
j]=10+newQualityMask;
340 if (track->algo() <= track2->algo()) {
342 selected1[
i]=10+newQualityMask;
345 selected2[
j]=10+newQualityMask;
357 std::vector<edm::RefToBase<TrajectorySeed> > seedsRefs(tC1.size()+tC2.size());
362 for (reco::TrackCollection::const_iterator track=tC1.begin(); track!=tC1.end();
371 if (selected1[i]>1 && promoteQuality){
372 outputTrks->back().setQualityMask(selected1[i]-10);
380 bool doRekeyOnThisSeed=
false;
384 if (origSeedRef->
nHits()!=0){
387 if (firstHit->isValid()){
397 doRekeyOnThisSeed=e.
getByLabel(clusterRemovalInfos,CRIh);
401 if (doRekeyOnThisSeed && !(clusterRemovalInfos==
edm::InputTag(
"")))
408 for (;iH!=iH_end;++iH){
410 refSetter.
reKey(&newRecHitContainer.
back());
432 seedsRefs[
current]=origSeedRef;
437 std::vector<const TrackingRecHit*>& iHits = rh1[track];
438 unsigned nh1 = iHits.size();
439 for (
unsigned ih=0; ih<nh1; ++ih ) {
460 for (
size_t i = 0,
n = hTraj1->size(); i <
n; ++
i) {
463 if (match != hTTAss1->end()) {
465 short oldKey =
static_cast<short>(trkRef.
key());
470 outputTrajs->back().setSeedRef( seedsRefs[oldKey] );
482 for (reco::TrackCollection::const_iterator track=tC2.begin(); track!=tC2.end();
491 if (selected2[i]>1 && promoteQuality){
492 outputTrks->back().setQualityMask(selected2[i]-10);
500 bool doRekeyOnThisSeed=
false;
504 if (origSeedRef->
nHits()!=0){
507 if (firstHit->isValid()){
516 doRekeyOnThisSeed=e.
getByLabel(clusterRemovalInfos,CRIh);
520 if (doRekeyOnThisSeed && !(clusterRemovalInfos==
edm::InputTag(
"")))
527 for (;iH!=iH_end;++iH){
529 refSetter.
reKey(&newRecHitContainer.
back());
550 seedsRefs[
current]=origSeedRef;
555 std::vector<const TrackingRecHit*>& jHits = rh2[track];
556 unsigned nh2 = jHits.size();
557 for (
unsigned jh=0; jh<nh2; ++jh ) {
575 for (
size_t i = 0,
n = hTraj2->size(); i <
n; ++
i) {
578 if (match != hTTAss2->end()) {
580 short oldKey =
static_cast<short>(trkRef.
key()) + offset;
585 outputTrajs->back().setSeedRef( seedsRefs[oldKey] );
PropagationDirection direction() const
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< std::vector< Trajectory > > trackProducer2TrajToken
friend struct const_iterator
std::auto_ptr< reco::TrackExtraCollection > outputTrkExtras
bool getByToken(EDGetToken token, Handle< PROD > &result) const
TrackQuality
track quality
void reKey(TrackingRecHit *hit) const
SimpleTrackListMerger(const edm::ParameterSet &conf)
std::vector< Track > TrackCollection
collection of Tracks
virtual bool sharesInput(const TrackingRecHit *other, SharedInputType what) const
virtual void produce(edm::Event &e, const edm::EventSetup &c) override
bool innerOk() const
return true if the innermost hit is valid
std::vector< reco::TrackRef > trackRefs
TrackingRecHitRefProd refTrkHits
edm::ProductID clusterProduct(const TrackingRecHit *hit)
std::string const & processName() const
const math::XYZPoint & outerPosition() const
position of the outermost hit
edm::EDGetTokenT< std::vector< Trajectory > > trackProducer1TrajToken
const math::XYZPoint & innerPosition() const
position of the innermost hit
std::string trackProducer2
edm::EDGetTokenT< TrajTrackAssociationCollection > trackProducer2AssToken
std::vector< TrajectorySeed > TrajectorySeedCollection
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
recHitContainer::const_iterator const_iterator
edm::Ref< TrackingRecHitCollection > TrackingRecHitRef
persistent reference to a TrackingRecHit
CovarianceMatrix outerStateCovariance() const
outermost trajectory state curvilinear errors
std::auto_ptr< TrajectorySeedCollection > outputSeeds
unsigned int outerDetId() const
DetId of the detector on which surface the outermost state is located.
std::auto_ptr< reco::TrackCollection > outputTrks
unsigned int offset(bool)
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) ...
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
RefProd< PROD > getRefBeforePut()
edm::EDGetTokenT< reco::TrackCollection > trackProducer1Token
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)
std::auto_ptr< TrackingRecHitCollection > outputTrkHits
ClusterRef cluster() const
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
bool outerOk() const
return true if the outermost hit is valid
edm::RefProd< TrajectorySeedCollection > refTrajSeeds
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
CovarianceMatrix innerStateCovariance() const
innermost trajectory state curvilinear errors
key_type key() const
Accessor for product key.
std::string const & moduleLabel() const
T const * product() const
reco::TrackExtraRefProd refTrkExtras
reco::TrackRefProd refTrks
unsigned int nHits() const
edm::ProductID id() const
edm::RefProd< std::vector< Trajectory > > refTrajs
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
const TrackResiduals & residuals() const
PropagationDirection seedDirection() const
direction of how the hits were sorted in the original seed
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
ProductID id() const
Accessor for product ID.
DetId geographicalId() const
std::string const & productInstanceName() const
std::string trackProducer1
Provenance getProvenance(BranchID const &theID) const
std::auto_ptr< std::vector< Trajectory > > outputTrajs
virtual LocalPoint localPosition() const =0
edm::EDGetTokenT< TrajTrackAssociationCollection > trackProducer1AssToken
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
virtual ~SimpleTrackListMerger()
std::auto_ptr< TrajTrackAssociationCollection > outputTTAss
edm::EDGetTokenT< reco::TrackCollection > trackProducer2Token