14 const std::string&
name,
29 return StatusCode::SUCCESS;
36 std::vector<TrigL2MuonSA::MuonRoad>& clusterRoad,
38 const ToolHandle<ClusterPatFinder>* clusterPatFinder,
39 std::vector<TrigL2MuonSA::RpcFitResult>& clusterFitResults,
43 double roiEtaMaxHigh)
const
52 std::vector< std::vector< double > > aw, bw;
53 std::vector< double > clearRoad;
58 if ( (*clusterPatFinder)->findPatternEta(aw, bw, rpcLayerClusters) ) {
59 for(
unsigned int iClus = 0; iClus < aw[1].size(); iClus++){
61 clusFitResult.
Clear();
69 ATH_MSG_DEBUG(
"==========================================================");
76 clusterFitResults.push_back(clusFitResult);
78 ATH_MSG_DEBUG(
"==========================================================");
81 clusFitResult.
Clear();
83 clusterFitResults.push_back(clusFitResult);
87 std::vector<double> phi_middle, phi_outer;
88 phi_middle.clear(); phi_outer.clear();
89 if ( (*clusterPatFinder)->findPatternPhi(phi_middle, phi_outer, rpcLayerClusters) ){
90 double phi_middle_tot = 0;
91 double phi_outer_tot = 0;
92 size_t npatternPhi = phi_middle.size();
94 for(
double& phi : phi_middle){
95 phi_middle_tot = phi_middle_tot + phi;
97 for(
double& phi : phi_outer){
98 phi_outer_tot = phi_outer_tot + phi;
100 double phi_middle_center = phi_middle_tot/npatternPhi;
101 double phi_outer_center = phi_outer_tot/npatternPhi;
102 ATH_MSG_DEBUG(
"center of phi middle/outer = " << phi_middle_center <<
"/" << phi_outer_center);
103 for(
unsigned int iClus_fit = 0; iClus_fit < clusterFitResults.size(); iClus_fit++){
104 clusterFitResults.at(iClus_fit).phi = phi_middle_center;
105 clusterFitResults.at(iClus_fit).phi_middle = phi_middle_center;
106 clusterFitResults.at(iClus_fit).phi_outer = phi_outer_center;
109 for(
unsigned int iClus_fit = 0; iClus_fit < clusterFitResults.size(); iClus_fit++){
110 clusterFitResults.at(iClus_fit).phi = p_roi->
phi();
111 clusterFitResults.at(iClus_fit).phi_middle = p_roi->
phi();
112 clusterFitResults.at(iClus_fit).phi_outer = p_roi->
phi();
116 for(
unsigned int iClus_fit = 0; iClus_fit < clusterFitResults.size(); iClus_fit++){
117 clusterFitResults.at(iClus_fit).phi = p_roi->
phi();
121 if(clusterFitResults.empty()){
123 clusFitResult.
Clear();
125 clusFitResult.
phi = p_roi->
phi();
126 clusterFitResults.push_back(clusFitResult);
129 ATH_MSG_DEBUG(
"stored cluster eta/phi pattern to clusterRoad");
130 for(
unsigned int iClus_fit = 0; iClus_fit < clusterFitResults.size(); iClus_fit++){
136 muonRoad.
phiMiddle = clusterFitResults.at(iClus_fit).phi;
138 muonRoad.
side = (p_roi->
phi()<0.)? 0 : 1;
141 int PhysicsSector = ((p_roi->
sectorID() + 1)/4 )%8 + 1;
144 if (muonRoad.
LargeSmall == 0 && (PhysicsSector == 6 || PhysicsSector == 8 ))
146 else if (muonRoad.
LargeSmall == 1 && (PhysicsSector == 6 || PhysicsSector == 7 ))
150 for (
int i_station=0; i_station<6; i_station++) {
151 for (
int i_layer=0; i_layer<8; i_layer++) {
152 if(!clusterFitResults.at(iClus_fit).isSuccess) {
153 if (i_station==0) muonRoad.
rWidth[i_station][i_layer] = 500;
154 else if (i_station==1) muonRoad.
rWidth[i_station][i_layer] = 650;
155 else if (i_station==2) muonRoad.
rWidth[i_station][i_layer] = 800;
156 else if (i_station==3) muonRoad.
rWidth[i_station][i_layer] = 500;
157 else if (i_station==4) muonRoad.
rWidth[9][i_layer] = 650;
158 else if (i_station==5) muonRoad.
rWidth[10][i_layer] = 650;
159 else muonRoad.
rWidth[i_station][i_layer] = m_rWidth_RPC_Failed;
162 if (i_station==0) muonRoad.
rWidth[i_station][i_layer] = 400;
163 else if (i_station==1) muonRoad.
rWidth[i_station][i_layer] = 200;
164 else if (i_station==2) muonRoad.
rWidth[i_station][i_layer] = 400;
165 else if (i_station==3) muonRoad.
rWidth[i_station][i_layer] = 400;
166 else if (i_station==4) muonRoad.
rWidth[9][i_layer] = m_rWidth_RPC_Failed;
167 else if (i_station==5) muonRoad.
rWidth[10][i_layer] = m_rWidth_RPC_Failed;
168 else muonRoad.
rWidth[i_station][i_layer] = m_rWidth_RPC_Failed;
172 int sector_trigger = 99;
173 int sector_overlap = 99;
174 std::vector<Identifier> stationList;
175 std::vector<IdentifierHash> mdtHashList;
178 IdContext context = m_idHelperSvc->mdtIdHelper().module_context();
184 if(phiMax >
M_PI) phiMax -=
M_PI*2.;
185 if(phiMin <
M_PI*-1) phiMin +=
M_PI*2.;
191 if (iroi) m_regionSelector->lookup( Gaudi::Hive::currentContext() )->HashIDList(*iroi, mdtHashList);
194 m_regionSelector->lookup( Gaudi::Hive::currentContext() )->HashIDList(fullscan_roi, mdtHashList);
202 const int convert = m_idHelperSvc->mdtIdHelper().get_id(
hash,
id, &context);
207 const int stationPhi = m_idHelperSvc->mdtIdHelper().stationPhi(
id);
208 std::string
name = m_idHelperSvc->mdtIdHelper().stationNameString(m_idHelperSvc->mdtIdHelper().stationName(
id));
210 if (
name[1]==
'M' &&
name[2]==
'E' )
continue;
211 else if (
name[1]==
'M' &&
name[2]==
'G' )
continue;
214 if(
name[2]==
'S' ||
name[2]==
'F' ||
name[2]==
'G' ) LargeSmall = 1;
215 int sector = (stationPhi-1)*2 + LargeSmall;
216 if(sector_trigger == 99)
217 sector_trigger = sector;
218 else if(sector_trigger != sector)
219 sector_overlap = sector;
222 int MDT_tr = (PhysicsSector - 1)*2 + muonRoad.
LargeSmall;
223 if (MDT_tr == sector_overlap) {
224 sector_overlap = sector_trigger;
225 sector_trigger = MDT_tr;
231 if (clusterFitResults.at(iClus_fit).isSuccess) {
232 for (
int i_sector=0; i_sector<
N_SECTOR; i_sector++) {
233 muonRoad.
aw[0][i_sector] = clusterFitResults.at(iClus_fit).slope_inner;
234 muonRoad.
bw[0][i_sector] = clusterFitResults.at(iClus_fit).offset_inner;
235 muonRoad.
aw[1][i_sector] = clusterFitResults.at(iClus_fit).slope_middle;
236 muonRoad.
bw[1][i_sector] = clusterFitResults.at(iClus_fit).offset_middle;
237 muonRoad.
aw[2][i_sector] = clusterFitResults.at(iClus_fit).slope_outer;
238 muonRoad.
bw[2][i_sector] = clusterFitResults.at(iClus_fit).offset_outer;
239 muonRoad.
aw[3][i_sector] = clusterFitResults.at(iClus_fit).slope_inner;
240 muonRoad.
bw[3][i_sector] = clusterFitResults.at(iClus_fit).offset_inner;
241 muonRoad.
aw[9][i_sector] = clusterFitResults.at(iClus_fit).slope_middle;
242 muonRoad.
bw[9][i_sector] = clusterFitResults.at(iClus_fit).offset_middle;
243 muonRoad.
aw[10][i_sector] = clusterFitResults.at(iClus_fit).slope_middle;
244 muonRoad.
bw[10][i_sector] = clusterFitResults.at(iClus_fit).offset_middle;
247 double roiEtaLow = (roiEtaMinLow + roiEtaMaxLow) * 0.5;
248 double roiEtaHigh = (roiEtaMinHigh + roiEtaMaxHigh) * 0.5;
251 double awLow = (std::abs(roiEtaLow) >
ZERO_LIMIT)?
std::tan(thetaLow)*(std::abs(roiEtaLow)/roiEtaLow): 0.;
252 double awHigh = (std::abs(roiEtaHigh) >
ZERO_LIMIT)?
std::tan(thetaHigh)*(std::abs(roiEtaHigh)/roiEtaHigh): 0.;
254 for (
int i_station=0; i_station<
N_LAYER; i_station++) {
255 for (
int i_sector=0; i_sector<
N_SECTOR; i_sector++) {
256 muonRoad.
aw[i_station][i_sector] = awLow;
257 muonRoad.
bw[i_station][i_sector] = 0;
258 if (i_station==2) muonRoad.
aw[i_station][i_sector] = awHigh;
259 else if (i_station==3) muonRoad.
aw[i_station][i_sector] = awLow;
260 else if (i_station==4) muonRoad.
aw[9][i_sector] = awLow;
261 else if (i_station==5) muonRoad.
aw[10][i_sector] = awLow;
265 clusterRoad.push_back(muonRoad);
267 ATH_MSG_DEBUG(
"finished ClusterRoadDefiner algorithm... leave");
268 return StatusCode::SUCCESS;
275 std::vector<TrigL2MuonSA::MuonRoad>& clusterRoad,
277 const ToolHandle<ClusterPatFinder>* clusterPatFinder,
278 std::vector<TrigL2MuonSA::RpcFitResult>& clusterFitResults,
281 double roiEtaMinHigh,
282 double roiEtaMaxHigh)
const
291 std::vector< std::vector< double > > aw, bw;
292 std::vector< double > clearRoad;
297 if ( (*clusterPatFinder)->findPatternEta(aw, bw, rpcLayerClusters) ) {
298 for(
unsigned int iClus = 0; iClus < aw[1].size(); iClus++){
300 clusFitResult.
Clear();
308 ATH_MSG_DEBUG(
"==========================================================");
315 clusterFitResults.push_back(clusFitResult);
317 ATH_MSG_DEBUG(
"==========================================================");
320 clusFitResult.
Clear();
322 clusterFitResults.push_back(clusFitResult);
326 std::vector<double> phi_middle, phi_outer;
327 phi_middle.clear(); phi_outer.clear();
328 if ( (*clusterPatFinder)->findPatternPhi(phi_middle, phi_outer, rpcLayerClusters) ){
329 double phi_middle_tot = 0;
330 double phi_outer_tot = 0;
331 size_t npatternPhi = phi_middle.size();
333 for(
double& phi : phi_middle){
334 phi_middle_tot = phi_middle_tot + phi;
336 for(
double& phi : phi_outer){
337 phi_outer_tot = phi_outer_tot + phi;
339 double phi_middle_center = phi_middle_tot/npatternPhi;
340 double phi_outer_center = phi_outer_tot/npatternPhi;
341 ATH_MSG_DEBUG(
"center of phi middle/outer = " << phi_middle_center <<
"/" << phi_outer_center);
342 for(
unsigned int iClus_fit = 0; iClus_fit < clusterFitResults.size(); iClus_fit++){
343 clusterFitResults.at(iClus_fit).phi = phi_middle_center;
344 clusterFitResults.at(iClus_fit).phi_middle = phi_middle_center;
345 clusterFitResults.at(iClus_fit).phi_outer = phi_outer_center;
348 for(
unsigned int iClus_fit = 0; iClus_fit < clusterFitResults.size(); iClus_fit++){
349 clusterFitResults.at(iClus_fit).phi = p_roi->
phi();
350 clusterFitResults.at(iClus_fit).phi_middle = p_roi->
phi();
351 clusterFitResults.at(iClus_fit).phi_outer = p_roi->
phi();
355 for(
unsigned int iClus_fit = 0; iClus_fit < clusterFitResults.size(); iClus_fit++){
356 clusterFitResults.at(iClus_fit).phi = p_roi->
phi();
360 if(clusterFitResults.empty()){
362 clusFitResult.
Clear();
364 clusFitResult.
phi = p_roi->
phi();
365 clusterFitResults.push_back(clusFitResult);
368 ATH_MSG_DEBUG(
"stored cluster eta/phi pattern to clusterRoad");
369 for(
unsigned int iClus_fit = 0; iClus_fit < clusterFitResults.size(); iClus_fit++){
375 muonRoad.
phiMiddle = clusterFitResults.at(iClus_fit).phi;
377 muonRoad.
side = (p_roi->
phi()<0.)? 0 : 1;
380 int PhysicsSector = ((p_roi->
getSectorID() + 1)/4 )%8 + 1;
383 if (muonRoad.
LargeSmall == 0 && (PhysicsSector == 6 || PhysicsSector == 8 ))
385 else if (muonRoad.
LargeSmall == 1 && (PhysicsSector == 6 || PhysicsSector == 7 ))
389 for (
int i_station=0; i_station<6; i_station++) {
390 for (
int i_layer=0; i_layer<8; i_layer++) {
391 if(!clusterFitResults.at(iClus_fit).isSuccess) {
392 if (i_station==0) muonRoad.
rWidth[i_station][i_layer] = 500;
393 else if (i_station==1) muonRoad.
rWidth[i_station][i_layer] = 650;
394 else if (i_station==2) muonRoad.
rWidth[i_station][i_layer] = 800;
395 else if (i_station==3) muonRoad.
rWidth[i_station][i_layer] = 500;
396 else if (i_station==4) muonRoad.
rWidth[9][i_layer] = 650;
397 else if (i_station==5) muonRoad.
rWidth[10][i_layer] = 650;
398 else muonRoad.
rWidth[i_station][i_layer] = m_rWidth_RPC_Failed;
401 if (i_station==0) muonRoad.
rWidth[i_station][i_layer] = 400;
402 else if (i_station==1) muonRoad.
rWidth[i_station][i_layer] = 200;
403 else if (i_station==2) muonRoad.
rWidth[i_station][i_layer] = 400;
404 else if (i_station==3) muonRoad.
rWidth[i_station][i_layer] = 400;
405 else if (i_station==4) muonRoad.
rWidth[9][i_layer] = m_rWidth_RPC_Failed;
406 else if (i_station==5) muonRoad.
rWidth[10][i_layer] = m_rWidth_RPC_Failed;
407 else muonRoad.
rWidth[i_station][i_layer] = m_rWidth_RPC_Failed;
411 int sector_trigger = 99;
412 int sector_overlap = 99;
413 std::vector<Identifier> stationList;
414 std::vector<IdentifierHash> mdtHashList;
417 IdContext context = m_idHelperSvc->mdtIdHelper().module_context();
423 if(phiMax >
M_PI) phiMax -=
M_PI*2.;
424 if(phiMin <
M_PI*-1) phiMin +=
M_PI*2.;
430 if (iroi) m_regionSelector->lookup( Gaudi::Hive::currentContext() )->HashIDList(*iroi, mdtHashList);
433 m_regionSelector->lookup( Gaudi::Hive::currentContext() )->HashIDList(fullscan_roi, mdtHashList);
441 const int convert = m_idHelperSvc->mdtIdHelper().get_id(
hash,
id, &context);
446 const int stationPhi = m_idHelperSvc->mdtIdHelper().stationPhi(
id);
447 std::string
name = m_idHelperSvc->mdtIdHelper().stationNameString(m_idHelperSvc->mdtIdHelper().stationName(
id));
449 if (
name[1]==
'M' &&
name[2]==
'E' )
continue;
450 else if (
name[1]==
'M' &&
name[2]==
'G' )
continue;
453 if(
name[2]==
'S' ||
name[2]==
'F' ||
name[2]==
'G' ) LargeSmall = 1;
454 int sector = (stationPhi-1)*2 + LargeSmall;
455 if(sector_trigger == 99)
456 sector_trigger = sector;
457 else if(sector_trigger != sector)
458 sector_overlap = sector;
461 int MDT_tr = (PhysicsSector - 1)*2 + muonRoad.
LargeSmall;
462 if (MDT_tr == sector_overlap) {
463 sector_overlap = sector_trigger;
464 sector_trigger = MDT_tr;
470 if (clusterFitResults.at(iClus_fit).isSuccess) {
471 for (
int i_sector=0; i_sector<
N_SECTOR; i_sector++) {
472 muonRoad.
aw[0][i_sector] = clusterFitResults.at(iClus_fit).slope_inner;
473 muonRoad.
bw[0][i_sector] = clusterFitResults.at(iClus_fit).offset_inner;
474 muonRoad.
aw[1][i_sector] = clusterFitResults.at(iClus_fit).slope_middle;
475 muonRoad.
bw[1][i_sector] = clusterFitResults.at(iClus_fit).offset_middle;
476 muonRoad.
aw[2][i_sector] = clusterFitResults.at(iClus_fit).slope_outer;
477 muonRoad.
bw[2][i_sector] = clusterFitResults.at(iClus_fit).offset_outer;
478 muonRoad.
aw[3][i_sector] = clusterFitResults.at(iClus_fit).slope_inner;
479 muonRoad.
bw[3][i_sector] = clusterFitResults.at(iClus_fit).offset_inner;
480 muonRoad.
aw[9][i_sector] = clusterFitResults.at(iClus_fit).slope_middle;
481 muonRoad.
bw[9][i_sector] = clusterFitResults.at(iClus_fit).offset_middle;
482 muonRoad.
aw[10][i_sector] = clusterFitResults.at(iClus_fit).slope_middle;
483 muonRoad.
bw[10][i_sector] = clusterFitResults.at(iClus_fit).offset_middle;
486 double roiEtaLow = (roiEtaMinLow + roiEtaMaxLow) * 0.5;
487 double roiEtaHigh = (roiEtaMinHigh + roiEtaMaxHigh) * 0.5;
490 double awLow = (std::abs(roiEtaLow) >
ZERO_LIMIT)?
std::tan(thetaLow)*(std::abs(roiEtaLow)/roiEtaLow): 0.;
491 double awHigh = (std::abs(roiEtaHigh) >
ZERO_LIMIT)?
std::tan(thetaHigh)*(std::abs(roiEtaHigh)/roiEtaHigh): 0.;
493 for (
int i_station=0; i_station<
N_LAYER; i_station++) {
494 for (
int i_sector=0; i_sector<
N_SECTOR; i_sector++) {
495 muonRoad.
aw[i_station][i_sector] = awLow;
496 muonRoad.
bw[i_station][i_sector] = 0;
497 if (i_station==2) muonRoad.
aw[i_station][i_sector] = awHigh;
498 else if (i_station==3) muonRoad.
aw[i_station][i_sector] = awLow;
499 else if (i_station==4) muonRoad.
aw[9][i_sector] = awLow;
500 else if (i_station==5) muonRoad.
aw[10][i_sector] = awLow;
504 clusterRoad.push_back(muonRoad);
506 ATH_MSG_DEBUG(
"finished ClusterRoadDefiner algorithm... leave");
507 return StatusCode::SUCCESS;