134 std::vector<const reco::TrackCollection *> trackColls;
135 std::vector<edm::Handle<reco::TrackCollection> > trackHandles(
trackProducers_.size());
137 trackColls.push_back(0);
140 if (trackHandles[i].isValid()) {
141 trackColls[
i]= trackHandles[
i].product();
144 trackColls[
i]=&s_empty;
148 unsigned int rSize=0;
149 unsigned int trackCollSizes[trackColls.size()];
150 unsigned int trackCollFirsts[trackColls.size()];
151 for (
unsigned int i=0; i<trackColls.size(); i++) {
152 trackCollSizes[
i]=trackColls[
i]->size();
153 trackCollFirsts[
i]=rSize;
154 rSize+=trackCollSizes[
i];
164 bool trkUpdated[rSize];
165 int trackCollNum[rSize];
166 int trackQuals[rSize];
167 for (
unsigned int j=0;
j<rSize;
j++) {
168 selected[
j]=1; trkUpdated[
j]=
false; trackCollNum[
j]=0; trackQuals[
j]=0;
171 for (
unsigned int j=0;
j< trackColls.size();
j++) {
179 if ( 0<tC1->size() ){
181 for (reco::TrackCollection::const_iterator track=tC1->begin(); track!=tC1->end(); track++){
184 trackQuals[
i]=track->qualityMask();
188 int qual=(*trackSelColl)[trkRef];
199 selected[
i]=trackQuals[
i]+10;
200 if ((
short unsigned)track->ndof() < 1){
212 if (track->pt() <
minPT_){
224 std::vector<const TrackingRecHit*> rh1[rSize];
225 int validHits[rSize];
227 for (
unsigned int i=0; i<rSize; i++) {
230 if (selected[i]==0)
continue;
231 unsigned int collNum=trackCollNum[
i];
232 unsigned int trackNum=i-trackCollFirsts[collNum];
233 const reco::Track *track=&((trackColls[collNum])->
at(trackNum));
240 rh1[
i].push_back(hit);
246 if ( rSize==0 )
continue;
247 int saveSelected[rSize];
248 for (
unsigned int i=0; i<rSize; i++) saveSelected[i]=selected[i];
251 for (
unsigned int i=0; i<rSize-1; i++) {
252 if (selected[i]==0)
continue;
253 unsigned int collNum=trackCollNum[
i];
255 if (collNum==(rSize-1))
continue;
260 unsigned int trackNum=i-trackCollFirsts[collNum];
261 const reco::Track *track=&((trackColls[collNum])->
at(trackNum));
262 unsigned nh1=rh1[
i].size();
263 int qualityMaskT1 = trackQuals[
i];
265 int nhit1 = validHits[
i];
266 int lhit1 = lostHits[
i];
268 for (
unsigned int j=i+1;
j<rSize;
j++) {
269 if (selected[
j]==0)
continue;
270 unsigned int collNum2=trackCollNum[
j];
271 if ( collNum == collNum2)
continue;
277 unsigned int trackNum2=
j-trackCollFirsts[collNum2];
278 const reco::Track *track2=&((trackColls[collNum2])->
at(trackNum2));
285 for (
unsigned ih=0; ih<nh1; ++ih ) {
288 for (
unsigned jh=0; jh<nh2; ++jh ) {
307 int newQualityMask = -9;
309 int maskT1= saveSelected[
i]>1? saveSelected[
i]-10 : qualityMaskT1;
310 int maskT2= saveSelected[
j]>1? saveSelected[
j]-10 : trackQuals[
j];
311 newQualityMask =(maskT1 | maskT2);
313 int nhit2 = validHits[
j];
314 int lhit2 = lostHits[
j];
319 const double almostSame = 1.001;
320 if ( score1 > almostSame * score2 ) {
322 selected[
i]=10+newQualityMask;
324 }
else if ( score2 > almostSame * score1 ) {
326 selected[
j]=10+newQualityMask;
330 if (track->
algo() <= track2->
algo()) {
332 selected[
i]=10+newQualityMask;
336 selected[
j]=10+newQualityMask;
342 if (selected[i]==0)
break;
351 std::auto_ptr<edm::ValueMap<int> > vm = std::auto_ptr<edm::ValueMap<int> >(
new edm::ValueMap<int>);
354 unsigned int tSize=trackColls[0]->size();
355 std::vector<int> finalQuals(tSize,-1);
356 for (
unsigned int i=0; i<rSize; i++) {
357 unsigned int tNum=i%tSize;
359 if (selected[i]>1 ) {
360 finalQuals[tNum]=selected[
i]-10;
364 if ( selected[i]==1 )
365 finalQuals[tNum]=trackQuals[
i];
368 filler.insert(trackHandles[0], finalQuals.begin(),finalQuals.end());
381 std::vector<edm::RefToBase<TrajectorySeed> > seedsRefs(rSize);
383 unsigned int nToWrite=0;
384 for (
unsigned int i=0; i<rSize; i++)
385 if (selected[i]!=0) nToWrite++;
397 outputTrkHits->reserve(nToWrite*25);
407 outputTrajs = std::auto_ptr< std::vector<Trajectory> >(
new std::vector<Trajectory>());
413 for (
unsigned int i=0; i<rSize; i++) {
414 if (selected[i]==0) {
419 unsigned int collNum=trackCollNum[
i];
420 unsigned int trackNum=i-trackCollFirsts[collNum];
421 const reco::Track *track=&((trackColls[collNum])->
at(trackNum));
423 if (selected[i]>1 ) {
424 outputTrks->back().setQualityMask(selected[i]-10);
429 if ( selected[i]==1 )
430 outputTrks->back().setQualityMask(trackQuals[i]);
439 bool doRekeyOnThisSeed=
false;
443 if (origSeedRef->
nHits()!=0){
446 if (firstHit->isValid()){
455 doRekeyOnThisSeed=e.
getByLabel(clusterRemovalInfos,CRIh);
459 if (doRekeyOnThisSeed && !(clusterRemovalInfos==
edm::InputTag(
""))) {
465 for (;iH!=iH_end;++iH){
467 refSetter.reKey(&newRecHitContainer.
back());
489 seedsRefs[
i]=origSeedRef;
496 for (
unsigned ih=0; ih<nh1; ++ih ) {
498 outputTrkHits->push_back( track->
recHit(ih)->clone() );
510 for (
unsigned int ti=0; ti<trackColls.size(); ti++) {
518 for (
size_t i = 0,
n = hTraj1->size(); i <
n; ++
i) {
521 if (match != hTTAss1->end()) {
523 short oldKey = trackCollFirsts[ti]+
static_cast<short>(trkRef.
key());
528 outputTrajs->back().setSeedRef( seedsRefs[oldKey] );
539 e.
put(outputTrkHits);
PropagationDirection direction() const
std::auto_ptr< TrajectorySeedCollection > outputSeeds
std::auto_ptr< std::vector< Trajectory > > outputTrajs
size_t recHitsSize() const
Get number of RecHits. (Warning, this includes invalid hits, which are not physical hits)...
std::auto_ptr< reco::TrackCollection > outputTrks
std::vector< Track > TrackCollection
collection of Tracks
virtual bool sharesInput(const TrackingRecHit *other, SharedInputType what) const
bool innerOk() const
return true if the innermost hit is valid
unsigned short numberOfLostHits() const
number of cases where track crossed a layer without getting a hit.
std::vector< std::vector< int > > listsToMerge_
std::string const & processName() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const math::XYZPoint & outerPosition() const
position of the outermost hit
const math::XYZPoint & innerPosition() const
position of the innermost hit
TrackAlgorithm algo() const
double maxNormalizedChisq_
std::vector< TrajectorySeed > TrajectorySeedCollection
double chi2() const
chi-squared of the fit
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
TrackingRecHitRefProd refTrkHits
CovarianceMatrix outerStateCovariance() const
outermost trajectory state curvilinear errors
unsigned int outerDetId() const
DetId of the detector on which surface the outermost state is located.
edm::RefProd< TrajectorySeedCollection > refTrajSeeds
edm::ProductID clusterProductB(const TrackingRecHit *hit)
reco::TrackRefProd refTrks
unsigned short numberOfValidHits() const
number of valid hits found
std::auto_ptr< reco::TrackExtraCollection > outputTrkExtras
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > > TrajTrackAssociationCollection
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
RefProd< PROD > getRefBeforePut()
std::vector< edm::InputTag > selectors_
std::vector< edm::InputTag > trackProducers_
reco::TrackExtraRefProd refTrkExtras
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
edm::OwnVector< TrackingRecHit > TrackingRecHitCollection
collection of TrackingRecHits
edm::RefToBase< TrajectorySeed > seedRef() const
PTrajectoryStateOnDet const & startingState() const
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
bool outerOk() const
return true if the outermost hit is valid
std::vector< bool > promoteQuality_
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
std::vector< reco::TrackRef > trackRefs
unsigned int nHits() const
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
TrackingRecHitRef recHit(size_t i) const
Get i-th hit on the track.
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.
std::auto_ptr< TrackingRecHitCollection > outputTrkHits
DetId geographicalId() const
std::string const & productInstanceName() const
Provenance getProvenance(BranchID const &theID) const
reco::TrackBase::TrackQuality qualityToSet_
virtual LocalPoint localPosition() const =0
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
edm::RefProd< std::vector< Trajectory > > refTrajs
std::vector< int > hasSelector_
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
std::auto_ptr< TrajTrackAssociationCollection > outputTTAss