20 return (it1->globalPosition().phi() < it2->globalPosition().phi());
45 MaxDeltaPhi = iConfig.
getParameter<
double>(
"MaxDeltaPhi");
46 ClusterSet = iConfig.
getParameter< std::vector<int> >(
"ClusterSet");
79 cout <<
"Not set the IO or not configured yet" << endl;
82 cout <<
"Now fill recHits from Layers: ";
83 for(
unsigned int k = 0;
k < LayersinRPC.size();
k++)
84 cout << LayersinRPC[
k] <<
" ";
86 unsigned int LayerIndex = 0;
98 for(MuonRecHitContainer::const_iterator it = recHitsRPC[LayersinRPC[LayerIndex]]->
begin(); it != recHitsRPC[LayersinRPC[LayerIndex]]->end(); it++)
100 cout <<
"Completing layer[" << LayersinRPC[LayerIndex] <<
"]." << endl;
103 if(!(*it)->isValid())
112 delete thisTrackingRecHit;
114 if((
unsigned int)
abs(BX) > BxRange)
117 bool Clustercheck =
false;
118 if(ClusterSet.size() == 0)
120 for(std::vector<int>::const_iterator CluIter = ClusterSet.begin(); CluIter != ClusterSet.end(); CluIter++)
121 if(ClusterSize == (*CluIter))
123 if(Clustercheck !=
true)
128 cout <<
"Phi: " << Phi << endl;
130 therecHits.push_back(*it);
131 double deltaPhi = getdeltaPhifromrecHits();
132 cout <<
"Delta phi: "<< deltaPhi << endl;
133 therecHits.pop_back();
134 if(deltaPhi > MaxDeltaPhi)
138 therecHits.push_back(*it);
139 cout <<
"RecHit's global position: " << pos.
x() <<
", " << pos.
y() <<
", " << pos.
z() << endl;
143 if(LayerIndex == (LayersinRPC.size()-1))
145 cout <<
"Check and fill one seed." << endl;
150 complete(LayerIndex+1);
153 therecHits.pop_back();
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;
235 if(therecHits.size() >= 3)
237 theSeed->setrecHits(therecHits);
241 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
Geom::Phi< T > phi() const
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)