38 std::vector<reco::TransientTrack> inOutTrk = _inOutTrk;
40 LogDebug(
"ConversionTrackPairFinder") <<
"ConversionTrackPairFinder::run " <<
"\n";
42 std::vector<reco::TransientTrack> selectedOutInTk;
43 std::vector<reco::TransientTrack> selectedInOutTk;
44 std::vector<reco::TransientTrack> allSelectedTk;
45 std::map<reco::TransientTrack, reco::CaloClusterPtr,CompareTwoTracks> scTrkAssocMap;
46 std::multimap<int,reco::TransientTrack,std::greater<int> > auxMap;
54 for( std::vector<reco::TransientTrack>::const_iterator iTk = outInTrk.begin(); iTk != outInTrk.end(); iTk++) {
58 if ( iTk->numberOfValidHits() <3 || iTk->normalizedChi2() > 5000 )
continue;
59 if ( fabs(iTk->impactPointState().globalPosition().x()) > 110 ||
60 fabs(iTk->impactPointState().globalPosition().y()) > 110 ||
61 fabs(iTk->impactPointState().globalPosition().z()) > 280 )
continue;
74 int nHits=iTk->recHitsSize();
75 scTrkAssocMap[*iTk]= aClus;
76 auxMap.insert(std::pair<int,reco::TransientTrack >(nHits,(*iTk)) );
77 selectedOutInTk.push_back(*iTk);
78 allSelectedTk.push_back(*iTk);
86 for( std::vector<reco::TransientTrack>::const_iterator iTk = inOutTrk.begin(); iTk != inOutTrk.end(); iTk++) {
90 if ( iTk->numberOfValidHits() <3 || iTk->normalizedChi2() >5000 )
continue;
91 if ( fabs(iTk->impactPointState().globalPosition().x()) > 110 ||
92 fabs(iTk->impactPointState().globalPosition().y()) > 110 ||
93 fabs(iTk->impactPointState().globalPosition().z()) > 280 )
continue;
106 scTrkAssocMap[*iTk]= aClus;
107 int nHits=iTk->recHitsSize();
108 auxMap.insert(std::pair<int,reco::TransientTrack >(nHits,(*iTk)) );
109 selectedInOutTk.push_back(*iTk);
110 allSelectedTk.push_back(*iTk);
120 if(!selectedOutInTk.empty())
121 std::stable_sort(selectedOutInTk.begin(), selectedOutInTk.end(), ByNumOfHits());
122 if(!selectedInOutTk.empty())
123 std::stable_sort(selectedInOutTk.begin(), selectedInOutTk.end(), ByNumOfHits());
124 if(!allSelectedTk.empty())
125 std::stable_sort(allSelectedTk.begin(), allSelectedTk.end(), ByNumOfHits());
142 std::vector<reco::TransientTrack > thePair(2);
143 std::vector<std::vector<reco::TransientTrack> > allPairs;
147 std::map<reco::TransientTrack, reco::CaloClusterPtr>::const_iterator iMap1;
148 std::map<reco::TransientTrack, reco::CaloClusterPtr>::const_iterator iMap2;
150 for( iMap1 = scTrkAssocMap.begin(); iMap1 != scTrkAssocMap.end(); ++iMap1) {
156 std::multimap<int, reco::TransientTrack>::const_iterator iAux;
166 if ( scTrkAssocMap.size() > 2 ){
169 for( iMap1 = scTrkAssocMap.begin(); iMap1 != scTrkAssocMap.end(); ++iMap1) {
170 for( iMap2 = iMap1; iMap2 != scTrkAssocMap.end(); ++iMap2) {
173 if ( (iMap1->second) != (iMap2->second) )
continue;
175 if ( ((iMap1->first)).
charge() * ((iMap2->first)).charge() < 0 ) {
184 thePair.push_back( iMap1->first );
185 thePair.push_back( iMap2->first );
186 allPairs.push_back ( thePair );
187 allPairSCAss[thePair]= iMap1->second;
195 if ( allPairSCAss.empty()) {
198 for( iMap1 = scTrkAssocMap.begin(); iMap1 != scTrkAssocMap.end(); ++iMap1) {
201 thePair.push_back(iMap1->first);
202 allPairs.push_back ( thePair );
203 allPairSCAss[thePair]= iMap1->second;
213 }
else if ( (scTrkAssocMap.size() ==2) ) {
215 iMap1=scTrkAssocMap.begin();
218 if ( (iMap1->second) == (iMap2->second) ) {
219 if ( (iMap1->first).charge() * (iMap2->first).
charge() < 0 ) {
232 thePair.push_back( iMap1->first );
233 thePair.push_back( iMap2->first );
234 allPairs.push_back ( thePair );
236 allPairSCAss[thePair]= iMap1->second;
241 if ( ((iMap1->first)).recHitsSize() > ((iMap2->first)).recHitsSize() ) {
243 thePair.push_back(iMap1->first);
244 allPairs.push_back ( thePair );
245 allPairSCAss[thePair]= iMap1->second;
248 thePair.push_back(iMap2->first);
249 allPairs.push_back ( thePair );
250 allPairSCAss[thePair]= iMap2->second;
256 }
else if (scTrkAssocMap.size() ==1 ) {
269 iMap1=scTrkAssocMap.begin();
273 thePair.push_back(iMap1->first);
274 allPairs.push_back ( thePair );
275 allPairSCAss[thePair]= iMap1->second;
283 allPairSCAss.clear();
289 for( iMap1 = scTrkAssocMap.begin(); iMap1 != scTrkAssocMap.end(); ++iMap1) {
292 for (
std::map<std::vector<reco::TransientTrack>, reco::CaloClusterPtr>::const_iterator iPair= allPairSCAss.begin(); iPair!= allPairSCAss.end(); ++iPair ) {
293 if ( (iMap1->second) == (iPair->second) ) nFound++;
299 for( iAux = auxMap.begin(); iAux!= auxMap.end(); ++iAux) {
300 if ( (iMap1->first) == (iAux->second) && iList==0 ) {
302 thePair.push_back(iAux->second);
303 allPairSCAss[thePair]= iMap1->second;
317 for (
std::map<std::vector<reco::TransientTrack>, reco::CaloClusterPtr>::const_iterator iPair= allPairSCAss.begin(); iPair!= allPairSCAss.end(); ++iPair ) {
319 if ( (iPair->first).size() ==2 ) {
320 if (
sqrt((iPair->first)[0].track().innerMomentum().perp2()) >
sqrt((iPair->first)[1].track().innerMomentum().perp2()) ) {
321 thePair.push_back((iPair->first)[0]);
322 thePair.push_back((iPair->first)[1]);
324 thePair.push_back((iPair->first)[1]);
325 thePair.push_back((iPair->first)[0]);
328 thePair.push_back((iPair->first)[0]);
331 allPairOrdInPtSCAss[thePair]=iPair->second;
347 return allPairOrdInPtSCAss;
edm::Ptr< CaloCluster > CaloClusterPtr
TrackRef persistentTrackRef() const