87 e.
getByLabel(trackProducer1, trackCollection1);
88 TC1 = trackCollection1.
product();
93 if ( x.
history().size() == 1 ) {
96 edm::LogWarning(
"TrackListMerger") <<
"1st TrackCollection " << trackProducer1 <<
" not found; will only clean 2nd TrackCollection " << trackProducer2 ;
105 e.
getByLabel(trackProducer2, trackCollection2);
106 TC2 = trackCollection2.
product();
111 if ( x.
history().size() == 1 ) {
114 edm::LogWarning(
"TrackListMerger") <<
"2nd TrackCollection " << trackProducer2 <<
" not found; will only clean 1st TrackCollection " << trackProducer1 ;
138 std::vector<int> selected1;
for (
unsigned int i=0; i<tC1.size(); ++
i){selected1.push_back(1);}
142 for (reco::TrackCollection::const_iterator
track=tC1.begin();
track!=tC1.end();
track++){
144 if ((
short unsigned)
track->ndof() < 1){
149 if (
track->normalizedChi2() > maxNormalizedChisq){
154 if (
track->found() < minFound){
159 if (
track->pt() < minPT){
168 std::vector<int> selected2;
for (
unsigned int i=0; i<tC2.size(); ++
i){selected2.push_back(1);}
172 for (reco::TrackCollection::const_iterator
track=tC2.begin();
track!=tC2.end();
track++){
174 if ((
short unsigned)
track->ndof() < 1){
179 if (
track->normalizedChi2() > maxNormalizedChisq){
184 if (
track->found() < minFound){
189 if (
track->pt() < minPT){
202 for (reco::TrackCollection::const_iterator
track=tC1.begin();
track!=tC1.end();
track++){
205 if (!selected1[i])
continue;
207 for (reco::TrackCollection::const_iterator track2=tC1.begin(); track2!=tC1.end(); track2++){
209 if ((j<=i)||(!selected1[
j])||(!selected1[i]))
continue;
212 if ((*it)->isValid()){
214 if ((*jt)->isValid()){
215 if (((*it)->geographicalId()==(*jt)->geographicalId())&&((*it)->localPosition().x()==(*jt)->localPosition().x()))noverlap++;
220 float fi=float(noverlap)/float(
track->recHitsSize());
float fj=float(noverlap)/float(track2->recHitsSize());
222 if ((fi>shareFrac)||(fj>shareFrac)){
232 if (
track->normalizedChi2() > track2->normalizedChi2()){selected1[
i]=0;}
else{selected1[
j]=0;}
245 for (reco::TrackCollection::const_iterator
track=tC2.begin();
track!=tC2.end();
track++){
248 if (!selected2[i])
continue;
250 for (reco::TrackCollection::const_iterator track2=tC2.begin(); track2!=tC2.end(); track2++){
252 if ((j<=i)||(!selected2[
j])||(!selected2[i]))
continue;
255 if ((*it)->isValid()){
257 if ((*jt)->isValid()){
258 if (((*it)->geographicalId()==(*jt)->geographicalId())&&((*it)->localPosition().x()==(*jt)->localPosition().x()))noverlap++;
263 float fi=float(noverlap)/float(
track->recHitsSize());
float fj=float(noverlap)/float(track2->recHitsSize());
265 if ((fi>shareFrac)||(fj>shareFrac)){
275 if (
track->normalizedChi2() > track2->normalizedChi2()){selected2[
i]=0;}
else{selected2[
j]=0;}
286 if ( (0<tC1.size())&&(0<tC2.size()) ){
288 for (reco::TrackCollection::const_iterator
track=tC1.begin();
track!=tC1.end();
track++){
291 if (!selected1[i])
continue;
293 for (reco::TrackCollection::const_iterator track2=tC2.begin(); track2!=tC2.end(); track2++){
295 if ((!selected2[j])||(!selected1[
i]))
continue;
298 if ((*it)->isValid()){
300 if ((*jt)->isValid()){
301 float delta = fabs ( (*it)->localPosition().x()-(*jt)->localPosition().x() );
302 if (((*it)->geographicalId()==(*jt)->geographicalId())&&(delta<epsilon))noverlap++;
307 float fi=float(noverlap)/float(
track->recHitsSize());
float fj=float(noverlap)/float(track2->recHitsSize());
309 if ((fi>shareFrac)||(fj>shareFrac)){
319 if (
track->normalizedChi2() > track2->normalizedChi2()){selected1[
i]=0;}
else{selected2[
j]=0;}
332 for (reco::TrackCollection::const_iterator
track=tC1.begin();
track!=tC1.end();
track++){
333 i++;
if (!selected1[i])
continue;
335 (
short unsigned)
track->ndof(),
336 track->innerPosition(),
337 track->innerMomentum(),
339 track->innerStateCovariance());
342 theTrack->
setExtra(theTrackExtraRef);
344 output->push_back(*theTrack);
350 for (reco::TrackCollection::const_iterator
track=tC2.begin();
track!=tC2.end();
track++){
351 i++;
if (!selected2[i])
continue;
353 (
short unsigned)
track->ndof(),
354 track->innerPosition(),
355 track->innerMomentum(),
357 track->innerStateCovariance());
360 theTrack->
setExtra(theTrackExtraRef);
362 output->push_back(*theTrack);
Code categoryCode() const
T getParameter(std::string const &) const
std::vector< Track > TrackCollection
collection of Tracks
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
CategoryList const & history() const
void setHitPattern(const C &c)
set hit patterns from vector of hit references
void setExtra(const TrackExtraRef &ref)
set reference to "extra" object
T const * product() const