32 std::vector<reco::TransientTrack> inOutTrk = _inOutTrk;
34 LogDebug(
"ConversionTrackPairFinder") <<
"ConversionTrackPairFinder::run "
37 std::vector<reco::TransientTrack> selectedOutInTk;
38 std::vector<reco::TransientTrack> selectedInOutTk;
39 std::vector<reco::TransientTrack> allSelectedTk;
40 std::map<reco::TransientTrack, reco::CaloClusterPtr, CompareTwoTracks> scTrkAssocMap;
41 std::multimap<int, reco::TransientTrack, std::greater<int> > auxMap;
47 for (std::vector<reco::TransientTrack>::const_iterator iTk = outInTrk.begin(); iTk != outInTrk.end(); iTk++) {
51 if (iTk->numberOfValidHits() < 3 || iTk->normalizedChi2() > 5000)
53 if (fabs(iTk->impactPointState().globalPosition().x()) > 110 ||
54 fabs(iTk->impactPointState().globalPosition().y()) > 110 ||
55 fabs(iTk->impactPointState().globalPosition().z()) > 280)
69 int nHits = iTk->recHitsSize();
70 scTrkAssocMap[*iTk] = aClus;
71 auxMap.insert(std::pair<int, reco::TransientTrack>(
nHits, (*iTk)));
72 selectedOutInTk.push_back(*iTk);
73 allSelectedTk.push_back(*iTk);
77 for (std::vector<reco::TransientTrack>::const_iterator iTk = inOutTrk.begin(); iTk != inOutTrk.end(); iTk++) {
81 if (iTk->numberOfValidHits() < 3 || iTk->normalizedChi2() > 5000)
83 if (fabs(iTk->impactPointState().globalPosition().x()) > 110 ||
84 fabs(iTk->impactPointState().globalPosition().y()) > 110 ||
85 fabs(iTk->impactPointState().globalPosition().z()) > 280)
99 scTrkAssocMap[*iTk] = aClus;
100 int nHits = iTk->recHitsSize();
101 auxMap.insert(std::pair<int, reco::TransientTrack>(
nHits, (*iTk)));
102 selectedInOutTk.push_back(*iTk);
103 allSelectedTk.push_back(*iTk);
109 if (!selectedOutInTk.empty())
110 std::stable_sort(selectedOutInTk.begin(), selectedOutInTk.end(), ByNumOfHits());
111 if (!selectedInOutTk.empty())
112 std::stable_sort(selectedInOutTk.begin(), selectedInOutTk.end(), ByNumOfHits());
113 if (!allSelectedTk.empty())
114 std::stable_sort(allSelectedTk.begin(), allSelectedTk.end(), ByNumOfHits());
126 std::vector<reco::TransientTrack> thePair(2);
127 std::vector<std::vector<reco::TransientTrack> > allPairs;
131 std::map<reco::TransientTrack, reco::CaloClusterPtr>::const_iterator iMap1;
132 std::map<reco::TransientTrack, reco::CaloClusterPtr>::const_iterator iMap2;
134 for (iMap1 = scTrkAssocMap.begin(); iMap1 != scTrkAssocMap.end(); ++iMap1) {
138 std::multimap<int, reco::TransientTrack>::const_iterator iAux;
147 if (scTrkAssocMap.size() > 2) {
148 for (iMap1 = scTrkAssocMap.begin(); iMap1 != scTrkAssocMap.end(); ++iMap1) {
149 for (iMap2 = iMap1; iMap2 != scTrkAssocMap.end(); ++iMap2) {
152 if ((iMap1->second) != (iMap2->second))
155 if (((iMap1->first)).
charge() * ((iMap2->first)).charge() < 0) {
161 thePair.push_back(iMap1->first);
162 thePair.push_back(iMap2->first);
163 allPairs.push_back(thePair);
164 allPairSCAss[thePair] = iMap1->second;
171 if (allPairSCAss.empty()) {
174 for (iMap1 = scTrkAssocMap.begin(); iMap1 != scTrkAssocMap.end(); ++iMap1) {
176 thePair.push_back(iMap1->first);
177 allPairs.push_back(thePair);
178 allPairSCAss[thePair] = iMap1->second;
182 }
else if ((scTrkAssocMap.size() == 2)) {
183 iMap1 = scTrkAssocMap.begin();
186 if ((iMap1->second) == (iMap2->second)) {
187 if ((iMap1->first).charge() * (iMap2->first).
charge() < 0) {
199 thePair.push_back(iMap1->first);
200 thePair.push_back(iMap2->first);
201 allPairs.push_back(thePair);
203 allPairSCAss[thePair] = iMap1->second;
207 if (((iMap1->first)).recHitsSize() > ((iMap2->first)).recHitsSize()) {
209 thePair.push_back(iMap1->first);
210 allPairs.push_back(thePair);
211 allPairSCAss[thePair] = iMap1->second;
214 thePair.push_back(iMap2->first);
215 allPairs.push_back(thePair);
216 allPairSCAss[thePair] = iMap2->second;
221 }
else if (scTrkAssocMap.size() == 1) {
232 iMap1 = scTrkAssocMap.begin();
236 thePair.push_back(iMap1->first);
237 allPairs.push_back(thePair);
238 allPairSCAss[thePair] = iMap1->second;
246 allPairSCAss.clear();
250 for (iMap1 = scTrkAssocMap.begin(); iMap1 != scTrkAssocMap.end(); ++iMap1) {
253 iPair != allPairSCAss.end();
255 if ((iMap1->second) == (iPair->second))
262 for (iAux = auxMap.begin(); iAux != auxMap.end(); ++iAux) {
263 if ((iMap1->first) == (iAux->second) && iList == 0) {
265 thePair.push_back(iAux->second);
266 allPairSCAss[thePair] = iMap1->second;
276 iPair != allPairSCAss.end();
279 if ((iPair->first).size() == 2) {
280 if (
sqrt((iPair->first)[0].track().innerMomentum().perp2()) >
281 sqrt((iPair->first)[1].track().innerMomentum().perp2())) {
282 thePair.push_back((iPair->first)[0]);
283 thePair.push_back((iPair->first)[1]);
285 thePair.push_back((iPair->first)[1]);
286 thePair.push_back((iPair->first)[0]);
289 thePair.push_back((iPair->first)[0]);
292 allPairOrdInPtSCAss[thePair] = iPair->second;
305 return allPairOrdInPtSCAss;