160 sort(sortRecHits.begin(), sortRecHits.end(),
lessPhi);
161 cout <<
"Sorted recHit's Phi: ";
162 for(ConstMuonRecHitContainer::const_iterator iter = sortRecHits.begin(); iter != sortRecHits.end(); iter++)
163 cout << (*iter)->globalPosition().phi() <<
", ";
168 if(sortRecHits.size() <= 1)
170 if(sortRecHits.size() == 2)
172 ConstMuonRecHitContainer::const_iterator iter1 = sortRecHits.begin();
173 ConstMuonRecHitContainer::const_iterator iter2 = sortRecHits.begin();
175 deltaPhi = (((*iter2)->globalPosition().phi().value() - (*iter1)->globalPosition().phi().value()) >
M_PI) ? (2 *
M_PI - ((*iter2)->globalPosition().phi().value() - (*iter1)->globalPosition().phi().value())) : ((*iter2)->globalPosition().phi().value() - (*iter1)->globalPosition().phi().value());
182 for(ConstMuonRecHitContainer::const_iterator iter = sortRecHits.begin(); iter != sortRecHits.end(); iter++)
184 cout <<
"Before this loop deltaPhi is " << deltaPhi << endl;
186 double deltaPhi_more = 0;
187 double deltaPhi_less = 0;
188 if(iter == sortRecHits.begin())
190 cout <<
"Calculateing frist loop..." << endl;
191 ConstMuonRecHitContainer::const_iterator iter_more = ++iter;
193 ConstMuonRecHitContainer::const_iterator iter_less = sortRecHits.end();
195 cout <<
"more_Phi: " << (*iter_more)->globalPosition().phi() <<
", less_Phi: " << (*iter_less)->globalPosition().phi() <<
", iter_Phi: " << (*iter)->globalPosition().phi() << endl;
196 deltaPhi_more = (2 *
M_PI) - ((*iter_more)->globalPosition().phi().value() - (*iter)->globalPosition().phi().value());
197 deltaPhi_less = (*iter_less)->globalPosition().phi().value() - (*iter)->globalPosition().phi().value();
199 else if(iter == (--sortRecHits.end()))
201 cout <<
"Calculateing last loop..." << endl;
202 ConstMuonRecHitContainer::const_iterator iter_less = --iter;
204 ConstMuonRecHitContainer::const_iterator iter_more = sortRecHits.begin();
205 cout <<
"more_Phi: " << (*iter_more)->globalPosition().phi() <<
", less_Phi: " << (*iter_less)->globalPosition().phi() <<
", iter_Phi: " << (*iter)->globalPosition().phi() << endl;
206 deltaPhi_less = (2 *
M_PI) - ((*iter)->globalPosition().phi().value() - (*iter_less)->globalPosition().phi().value());
207 deltaPhi_more = (*iter)->globalPosition().phi().value() - (*iter_more)->globalPosition().phi().value();
211 cout <<
"Calculateing " << n <<
"st loop..." << endl;
212 ConstMuonRecHitContainer::const_iterator iter_less = --iter;
214 ConstMuonRecHitContainer::const_iterator iter_more = ++iter;
216 cout <<
"more_Phi: " << (*iter_more)->globalPosition().phi() <<
", less_Phi: " << (*iter_less)->globalPosition().phi() <<
", iter_Phi: " << (*iter)->globalPosition().phi() << endl;
217 deltaPhi_less = (2 *
M_PI) - ((*iter)->globalPosition().phi().value() - (*iter_less)->globalPosition().phi().value());
218 deltaPhi_more = (2 *
M_PI) - ((*iter_more)->globalPosition().phi().value() - (*iter)->globalPosition().phi().value());
220 if(deltaPhi > deltaPhi_more)
221 deltaPhi = deltaPhi_more;
222 if(deltaPhi > deltaPhi_less)
223 deltaPhi = deltaPhi_less;
225 cout <<
"For this loop deltaPhi_more is " << deltaPhi_more << endl;
226 cout <<
"For this loop deltaPhi_less is " << deltaPhi_less << endl;
227 cout <<
"For this loop deltaPhi is " << deltaPhi << endl;
bool lessPhi(const MuonTransientTrackingRecHit::ConstMuonRecHitPointer &it1, const MuonTransientTrackingRecHit::ConstMuonRecHitPointer &it2)
MuonTransientTrackingRecHit::ConstMuonRecHitContainer ConstMuonRecHitContainer
ConstMuonRecHitContainer therecHits