144 sort(sortRecHits.begin(), sortRecHits.end(),
lessPhi);
145 cout <<
"Sorted recHit's Phi: ";
146 for (ConstMuonRecHitContainer::const_iterator iter = sortRecHits.begin(); iter != sortRecHits.end(); iter++)
147 cout << (*iter)->globalPosition().phi() <<
", ";
152 if (sortRecHits.size() <= 1)
154 if (sortRecHits.size() == 2) {
155 ConstMuonRecHitContainer::const_iterator iter1 = sortRecHits.begin();
156 ConstMuonRecHitContainer::const_iterator iter2 = sortRecHits.begin();
158 deltaPhi = (((*iter2)->globalPosition().phi().value() - (*iter1)->globalPosition().phi().value()) >
M_PI)
159 ? (2 *
M_PI - ((*iter2)->globalPosition().phi().value() - (*iter1)->globalPosition().phi().value()))
160 : ((*iter2)->globalPosition().phi().value() - (*iter1)->globalPosition().phi().value());
165 for (ConstMuonRecHitContainer::const_iterator iter = sortRecHits.begin(); iter != sortRecHits.end(); iter++) {
166 cout <<
"Before this loop deltaPhi is " <<
deltaPhi << endl;
168 double deltaPhi_more = 0;
169 double deltaPhi_less = 0;
170 if (iter == sortRecHits.begin()) {
171 cout <<
"Calculateing frist loop..." << endl;
172 ConstMuonRecHitContainer::const_iterator iter_more = ++iter;
174 ConstMuonRecHitContainer::const_iterator iter_less = sortRecHits.end();
176 cout <<
"more_Phi: " << (*iter_more)->globalPosition().phi()
177 <<
", less_Phi: " << (*iter_less)->globalPosition().phi()
178 <<
", iter_Phi: " << (*iter)->globalPosition().phi() << endl;
180 (2 *
M_PI) - ((*iter_more)->globalPosition().phi().value() - (*iter)->globalPosition().phi().value());
181 deltaPhi_less = (*iter_less)->globalPosition().phi().value() - (*iter)->globalPosition().phi().value();
182 }
else if (iter == (--sortRecHits.end())) {
183 cout <<
"Calculateing last loop..." << endl;
184 ConstMuonRecHitContainer::const_iterator iter_less = --iter;
186 ConstMuonRecHitContainer::const_iterator iter_more = sortRecHits.begin();
187 cout <<
"more_Phi: " << (*iter_more)->globalPosition().phi()
188 <<
", less_Phi: " << (*iter_less)->globalPosition().phi()
189 <<
", iter_Phi: " << (*iter)->globalPosition().phi() << endl;
191 (2 *
M_PI) - ((*iter)->globalPosition().phi().value() - (*iter_less)->globalPosition().phi().value());
192 deltaPhi_more = (*iter)->globalPosition().phi().value() - (*iter_more)->globalPosition().phi().value();
194 cout <<
"Calculateing " <<
n <<
"st loop..." << endl;
195 ConstMuonRecHitContainer::const_iterator iter_less = --iter;
197 ConstMuonRecHitContainer::const_iterator iter_more = ++iter;
199 cout <<
"more_Phi: " << (*iter_more)->globalPosition().phi()
200 <<
", less_Phi: " << (*iter_less)->globalPosition().phi()
201 <<
", iter_Phi: " << (*iter)->globalPosition().phi() << endl;
203 (2 *
M_PI) - ((*iter)->globalPosition().phi().value() - (*iter_less)->globalPosition().phi().value());
205 (2 *
M_PI) - ((*iter_more)->globalPosition().phi().value() - (*iter)->globalPosition().phi().value());
212 cout <<
"For this loop deltaPhi_more is " << deltaPhi_more << endl;
213 cout <<
"For this loop deltaPhi_less is " << deltaPhi_less << endl;
214 cout <<
"For this loop deltaPhi is " <<
deltaPhi << endl;