36 const std::vector<const Muon::RpcPrepDataCollection*>& rpcCols,
38 const ToolHandle<ClusterPatFinder>* clusterPatFinder,
43 std::map<Identifier,pattern> digits;
48 if(theCollection->size()>0){
50 if(
buildPatterns(doMultiMuon, p_roids, theCollection, digits)){
57 return StatusCode::SUCCESS;
66 std::map<Identifier, pattern>& digits)
const
68 ATH_MSG_DEBUG(
"start building patterns of RPC hits for clustering");
71 float dynamic_add = 0.02;
78 if( !
m_recRPCRoiTool->RoIsize(p_roids->
roiWord(), RoiEtaMin, RoiEtaMax, RoiPhiMin, RoiPhiMax).isSuccess() ){
81 ATH_MSG_DEBUG(
" ... RoI Phi min = " << RoiPhiMin <<
" RoI Phi max = " << RoiPhiMax <<
" RoI Eta min = " << RoiEtaMin <<
" RoI Eta max = " << RoiEtaMax );
82 deta_thr = std::abs( RoiEtaMax - RoiEtaMin )/2. + dynamic_add;
83 dphi_thr = std::abs( std::acos( std::cos( RoiPhiMax - RoiPhiMin ) ) )/2. + dynamic_add;
84 ATH_MSG_DEBUG(
"## deta/dphi threshold = " << deta_thr <<
"/" << dphi_thr);
94 const int doubletZ =
m_idHelperSvc->rpcIdHelper().doubletZ(
id);
95 const int doubletPhi =
m_idHelperSvc->rpcIdHelper().doubletPhi(
id);
97 const bool measPhi =
m_idHelperSvc->rpcIdHelper().measuresPhi(
id);
101 const double hitx=globalpos.x();
102 const double hity=globalpos.y();
103 const double hitz=globalpos.z();
105 const float r2 = hitx*hitx+hity*hity;
106 float phi = std::atan2(hity,hitx);
107 const float l = std::sqrt(hitz*hitz+r2);
108 const float tan = std::sqrt( (l-hitz)/(l+hitz) );
109 const float eta = -std::log(tan);
110 const float deta = std::abs(p_roids->
eta() -
eta);
113 ATH_MSG_DEBUG(
" ... RPC hit deta/dphi frm RoI = " << deta <<
"/" << dphi <<
", x/y/z = " << hitx <<
"/" << hity <<
"/" << hitz);
118 if ( deta<deta_thr && dphi<dphi_thr){
119 if(digits.find(panelId)==digits.end()){
121 newPatt[nstrip]=rpcDigit;
122 digits[panelId]=newPatt;
126 if(digits[panelId].
find(nstrip)==digits[panelId].end()){
127 digits[panelId][nstrip]=rpcDigit;
128 }
else if(digits[panelId][nstrip]->time()> rpcDigit->time()){
129 digits[panelId][nstrip]=rpcDigit;
135 return digits.size();
142 std::map<Identifier, pattern>& digits,
147 std::map<Identifier, pattern >::iterator patt_it=digits.begin();
149 for(;patt_it!=digits.end();++patt_it){
153 const bool measphi =
m_idHelperSvc->rpcIdHelper().measuresPhi(panelId);
154 std::map<int, const Muon::RpcPrepData*, std::less<int> >
::iterator dig_it=digits[panelId].begin();
156 std::vector<Identifier> theIDs;
159 unsigned int count=0;
162 for(;dig_it!=digits[panelId].end();++dig_it){
166 const int doubletR =
m_idHelperSvc->rpcIdHelper().doubletR((*dig_it).second->identify());
167 const int gasGap =
m_idHelperSvc->rpcIdHelper().gasGap((*dig_it).second->identify());
168 const int stationEta =
m_idHelperSvc->rpcIdHelper().stationEta((*dig_it).second->identify());
169 std::string stationName =
m_idHelperSvc->rpcIdHelper().stationNameString(
m_idHelperSvc->rpcIdHelper().stationName((*dig_it).second->identify()));
172 lastStrip=(*dig_it).first;
173 theIDs.push_back((*dig_it).second->identify());
174 globalPosition+=descriptor->
stripPos((*dig_it).second->identify());
175 ATH_MSG_DEBUG(
">> first hit of a cluster, id = " << lastStrip <<
", RPChit x/y/z/ = " << descriptor->
stripPos((*dig_it).second->identify()).x() <<
"/" << descriptor->
stripPos((*dig_it).second->identify()).y() <<
"/" << descriptor->
stripPos((*dig_it).second->identify()).z());
177 }
else if(std::abs(lastStrip-(*dig_it).first)==1){
179 lastStrip=(*dig_it).first;
180 theIDs.push_back((*dig_it).second->identify());
181 globalPosition+=descriptor->
stripPos((*dig_it).second->identify());
182 ATH_MSG_DEBUG(
" ... still on the same cluster, id = " << lastStrip <<
", RPChit x/y/z/ = " << descriptor->
stripPos((*dig_it).second->identify()).x() <<
"/" << descriptor->
stripPos((*dig_it).second->identify()).y() <<
"/" << descriptor->
stripPos((*dig_it).second->identify()).z());
186 globalPosition=globalPosition*(1/(float)theIDs.size());
188 ATH_MSG_DEBUG(
" ... close the cluster ---> cluster at " << stationName <<
", x/y/z = " << globalPosition.x() <<
"/" << globalPosition.y() <<
"/" << globalPosition.z());
189 (*clusterPatFinder)->addCluster(stationName, stationEta, measphi, gasGap, doubletR, globalPosition.x(), globalPosition.y(), globalPosition.z(), rpcLayerClusters);
192 lastStrip=(*dig_it).first;
195 theIDs.push_back((*dig_it).second->identify());
196 globalPosition=descriptor->
stripPos((*dig_it).second->identify());
202 if(
count==digits[panelId].size()-1&&theIDs.size()>0){
203 globalPosition=globalPosition*(1/(float)theIDs.size());
206 ATH_MSG_DEBUG(
" ... close the cluster ---> cluster at " << stationName <<
", x/y/z = " << globalPosition.x() <<
"/" << globalPosition.y() <<
"/" << globalPosition.z());
208 (*clusterPatFinder)->addCluster(stationName, stationEta, measphi, gasGap, doubletR, globalPosition.x(), globalPosition.y(), globalPosition.z(), rpcLayerClusters);