18 return (it1->globalPosition().phi() < it2->globalPosition().phi());
39 MaxDeltaPhi = iConfig.
getParameter<
double>(
"MaxDeltaPhi");
40 ClusterSet = iConfig.
getParameter<std::vector<int> >(
"ClusterSet");
65 cout <<
"Not set the IO or not configured yet" << endl;
68 cout <<
"Now fill recHits from Layers: ";
69 for (
unsigned int k = 0;
k < LayersinRPC.size();
k++)
70 cout << LayersinRPC[
k] <<
" ";
72 unsigned int LayerIndex = 0;
83 for (MuonRecHitContainer::const_iterator it = recHitsRPC[LayersinRPC[LayerIndex]]->begin();
84 it != recHitsRPC[LayersinRPC[LayerIndex]]->end();
86 cout <<
"Completing layer[" << LayersinRPC[LayerIndex] <<
"]." << endl;
89 if (!(*it)->isValid())
98 delete thisTrackingRecHit;
100 if ((
unsigned int)
abs(
BX) > BxRange)
103 bool Clustercheck =
false;
104 if (ClusterSet.empty())
106 for (std::vector<int>::const_iterator CluIter = ClusterSet.begin(); CluIter != ClusterSet.end(); CluIter++)
109 if (Clustercheck !=
true)
114 cout <<
"Phi: " <<
Phi << endl;
116 therecHits.push_back(*it);
117 double deltaPhi = getdeltaPhifromrecHits();
119 therecHits.pop_back();
124 therecHits.push_back(*it);
125 cout <<
"RecHit's global position: " <<
pos.x() <<
", " <<
pos.y() <<
", " <<
pos.z() << endl;
129 if (LayerIndex == (LayersinRPC.size() - 1)) {
130 cout <<
"Check and fill one seed." << endl;
135 complete(LayerIndex + 1);
138 therecHits.pop_back();
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;
221 if (therecHits.size() >= 3) {
222 theSeed->setrecHits(therecHits);
225 cout <<
"Layer less than 3, could not fill a RPCSeedFinder" << endl;
T getParameter(std::string const &) const
void configure(const edm::ParameterSet &iConfig)
bool lessPhi(const MuonTransientTrackingRecHit::ConstMuonRecHitPointer &it1, const MuonTransientTrackingRecHit::ConstMuonRecHitPointer &it2)
MuonTransientTrackingRecHit::ConstMuonRecHitContainer ConstMuonRecHitContainer
void setInput(MuonRecHitContainer(&recHits)[12])
void complete(unsigned int LayerIndex)
MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer
Abs< T >::type abs(const T &t)
double getdeltaPhifromrecHits()
virtual TrackingRecHit * clone() const =0
void setOutput(RPCSeedFinder *Seed)
virtual TrackingRecHit const * hit() const
std::shared_ptr< MuonTransientTrackingRecHit const > ConstMuonRecHitPointer
void setLayers(const std::vector< unsigned int > &Layers)