63 int trackerOnlyPreferCollection =
conf_.
getParameter<
int>(
"trackerOnlyPreferCollection");
64 int arbitratedEcalSeededPreferCollection =
conf_.
getParameter<
int>(
"arbitratedEcalSeededPreferCollection");
65 int arbitratedMergedPreferCollection =
conf_.
getParameter<
int>(
"arbitratedMergedPreferCollection");
66 int arbitratedMergedEcalGeneralPreferCollection =
conf_.
getParameter<
int>(
"arbitratedMergedEcalGeneralPreferCollection");
76 e.
getByLabel(trackProducer1, trackCollection1);
77 if (trackCollection1.
isValid()) {
78 TC1 = trackCollection1.
product();
82 edm::LogWarning(
"ConversionTrackMerger") <<
"1st TrackCollection " << trackProducer1 <<
" not found; will only clean 2nd TrackCollection " << trackProducer2 ;
88 e.
getByLabel(trackProducer2, trackCollection2);
89 if (trackCollection2.
isValid()) {
90 TC2 = trackCollection2.
product();
94 edm::LogWarning(
"ConversionTrackMerger") <<
"2nd TrackCollection " << trackProducer2 <<
" not found; will only clean 1st TrackCollection " << trackProducer1 ;
102 std::vector<int> selected1;
for (
unsigned int i=0; i<tC1.size(); ++
i){selected1.push_back(1);}
103 std::vector<int> selected2;
for (
unsigned int i=0; i<tC2.size(); ++
i){selected2.push_back(1);}
106 std::map<reco::ConversionTrackCollection::const_iterator, std::vector<const TrackingRecHit*> > rh1;
107 std::map<reco::ConversionTrackCollection::const_iterator, std::vector<const TrackingRecHit*> > rh2;
108 for (reco::ConversionTrackCollection::const_iterator
track=tC1.begin();
track!=tC1.end(); ++
track){
113 rh1[
track].push_back(hit);
116 for (reco::ConversionTrackCollection::const_iterator
track=tC2.begin();
track!=tC2.end(); ++
track){
121 rh2[
track].push_back(hit);
125 if ( (0<tC1.size())&&(0<tC2.size()) ){
127 for (reco::ConversionTrackCollection::const_iterator
track=tC1.begin();
track!=tC1.end(); ++
track){
129 std::vector<const TrackingRecHit*>& iHits = rh1[
track];
130 unsigned nh1 = iHits.size();
132 for (reco::ConversionTrackCollection::const_iterator track2=tC2.begin(); track2!=tC2.end(); ++track2){
134 std::vector<const TrackingRecHit*>& jHits = rh2[track2];
135 unsigned nh2 = jHits.size();
138 for (
unsigned ih=0; ih<nh1; ++ih ) {
142 for (
unsigned jh=0; jh<nh2; ++jh ) {
148 if ( allowFirstHitShare && ( ih == 0 ) && ( jh == 0 ) ) firstoverlap=1;
154 int nhit1 =
track->track()->numberOfValidHits();
155 int nhit2 = track2->track()->numberOfValidHits();
157 if ( (noverlap-firstoverlap) > (
std::min(nhit1,nhit2)-firstoverlap)*shareFrac ) {
158 if ( nhit1 > nhit2 ){
162 if ( nhit1 < nhit2 ){
167 if (
track->track()->normalizedChi2() > track2->track()->normalizedChi2()) {
185 for (reco::ConversionTrackCollection::const_iterator
track=tC1.begin();
track!=tC1.end();
188 if ( outputPreferCollection==0 || ( (outputPreferCollection==3 || outputPreferCollection==2) && !selected1[i]) ){
194 if ( trackerOnlyPreferCollection==0 || ( (trackerOnlyPreferCollection==3 || trackerOnlyPreferCollection==2) && !selected1[i]) ){
197 if ( arbitratedEcalSeededPreferCollection==0 || ( (arbitratedEcalSeededPreferCollection==3 || arbitratedEcalSeededPreferCollection==2) && !selected1[i]) ){
198 outputTrks->back().setIsArbitratedEcalSeeded(
false);
200 if ( arbitratedMergedPreferCollection==0 || ( (arbitratedMergedPreferCollection==3 || arbitratedMergedPreferCollection==2) && !selected1[i]) ){
201 outputTrks->back().setIsArbitratedMerged(
false);
203 if ( arbitratedMergedEcalGeneralPreferCollection==0 || ( (arbitratedMergedEcalGeneralPreferCollection==3 || arbitratedMergedEcalGeneralPreferCollection==2) && !selected1[i]) ){
204 outputTrks->back().setIsArbitratedMergedEcalGeneral(
false);
214 for (reco::ConversionTrackCollection::const_iterator
track=tC2.begin();
track!=tC2.end();
217 if ( outputPreferCollection==0 || ( (outputPreferCollection==3 || outputPreferCollection==1) && !selected2[i]) ){
223 if ( trackerOnlyPreferCollection==0 || ( (trackerOnlyPreferCollection==3 || trackerOnlyPreferCollection==1) && !selected2[i]) ){
226 if ( arbitratedEcalSeededPreferCollection==0 || ( (arbitratedEcalSeededPreferCollection==3 || arbitratedEcalSeededPreferCollection==1) && !selected2[i]) ){
227 outputTrks->back().setIsArbitratedEcalSeeded(
false);
229 if ( arbitratedMergedPreferCollection==0 || ( (arbitratedMergedPreferCollection==3 || arbitratedMergedPreferCollection==1) && !selected2[i]) ){
230 outputTrks->back().setIsArbitratedMerged(
false);
232 if ( arbitratedMergedEcalGeneralPreferCollection==0 || ( (arbitratedMergedEcalGeneralPreferCollection==3 || arbitratedMergedEcalGeneralPreferCollection==1) && !selected2[i]) ){
233 outputTrks->back().setIsArbitratedMergedEcalGeneral(
false);
T getParameter(std::string const &) const
std::auto_ptr< reco::ConversionTrackCollection > outputTrks
virtual bool sharesInput(const TrackingRecHit *other, SharedInputType what) const
std::vector< ConversionTrack > ConversionTrackCollection
collection of ConversionTracks
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
T const * product() const