Core clustering routine that runs on a single RPC module (two gas-gaps) Strategy:
70 if(
col.empty() )
return false;
71 std::vector<const RpcPrepData*>::const_iterator cit_begin =
col.begin();
72 std::vector<const RpcPrepData*>::const_iterator cit_end =
col.end();
73 if( cit_begin == cit_end )
return false;
79 std::vector<const RpcPrepData*>::const_iterator cit = cit_begin;
81 for( ; cit!=cit_end;++cit ) {
91 if( !prd_first )
return false;
102 std::vector<Doublet>* channelsPtr =
nullptr;
104 for( ; cit!=cit_end;++cit ) {
119 if(
channel >= (
int)channelsPtr->size() ){
120 std::cout <<
"index channels out of range: " <<
channel <<
" max " << channelsPtr->size() << std::endl;
127 Doublet& doublet = (*channelsPtr)[
channel];
130 int channelClusterNumber = gasgap==1 ? doublet.first : doublet.second;
131 if( channelClusterNumber != -1 ){
133 std::cout <<
" secondary hit " <<
channel <<
" " << gasgap;
134 if( measuresPhi ) std::cout <<
" phi " << channelClusterNumber << std::endl;
135 else std::cout <<
" eta " << channelClusterNumber << std::endl;
138 if( !
cluster.addSecond(prd,gasgap) ){
142 std::vector<Id> neighbours;
145 neighbours.emplace_back(2,
channel );
147 if(
channel < (
int)channelsPtr->size()-1 ) neighbours.emplace_back(2,
channel+1 );
148 }
else if( gasgap == 2 ){
149 neighbours.emplace_back(1,
channel );
151 if(
channel < (
int)channelsPtr->size()-1 ) neighbours.emplace_back(1,
channel+1 );
155 if(
channel < (
int)channelsPtr->size()-1 ) neighbours.emplace_back(gasgap,
channel+1 );
158 std::cout <<
" adding new channel " <<
channel <<
" " << gasgap;
159 if( measuresPhi ) std::cout <<
" phi " <<
" neighbours " << neighbours.size() << std::endl;
160 else std::cout <<
" eta " <<
" neighbours " << neighbours.size() << std::endl;
164 RpcClusterObj* currentCluster =
nullptr;
165 int currentClusterId = -1;
166 for( ;nit!=nit_end;++nit ){
168 Doublet& doub = (*channelsPtr)[nit->ch];
170 int clusterNumber = nit->gp==1 ? doub.first : doub.second;
171 if( clusterNumber == -1 )
continue;
172 if(
debug ) std::cout <<
" new neighbour " << nit->gp <<
" " << nit->ch <<
" clusterid " << clusterNumber;
177 if( currentCluster ==
nullptr ){
180 if( gasgap==1 ) doublet.first = clusterNumber;
181 else doublet.second = clusterNumber;
182 currentClusterId = clusterNumber;
183 if(
debug ) std::cout <<
" adding hit to neighbour cluster with ID " << clusterNumber << std::endl;
184 }
else if( clusterNumber != currentClusterId ){
189 for( ;
h!=h_end;++
h ) {
193 Doublet& doub = (*channelsPtr)[
ch];
194 if( gp==1 ) doub.first = currentClusterId;
195 else doub.second = currentClusterId;
197 if(
debug ) std::cout <<
" found cluster overlap, merging clusters " << std::endl;
198 currentCluster->merge(
cluster);
200 if(
debug ) std::cout <<
" cluster overlap, same cluster " << std::endl;
204 if( currentCluster ==
nullptr ){
205 if(
debug ) std::cout <<
" no neighbouring hits, creating new cluster " <<
clusters.size() << std::endl;
208 Doublet& doub = (*channelsPtr)[
channel];
209 if( gasgap==1 ) doub.first =
clusters.size();
219 std::cout <<
" cluster " <<
cl.ngasgap1 <<
" " <<
cl.ngasgap2 <<
" hits " <<
cl.hitList.size() << std::endl;
220 for(
const auto *hit :
cl.hitList ){