18 const std::string&
name,
40 return StatusCode::SUCCESS;
55 bool isMiddleFailure =
true;
58 const double R_WIDTH_DEFAULT = 100;
59 const double R_WIDTH_INNER_NO_HIT = 200;
82 if (tgcHits.size()>0) {
86 if( ! prepareTgcPoints(tgcHits, tgcStripInnPoints, tgcWireInnPoints, tgcStripMidPoints, tgcWireMidPoints) ) {
88 return StatusCode::FAILURE;
93 isMiddleFailure =
false;
94 TgcFit::Status status = m_tgcFit->runTgcMiddle(tgcStripMidPoints, tgcWireMidPoints, tgcFitResult);
97 isMiddleFailure =
true;
100 ATH_MSG_DEBUG(
"Fit to TGC middle station returns only a point");
104 status = m_tgcFit->runTgcInner(tgcStripInnPoints, tgcWireInnPoints, tgcFitResult);
109 ATH_MSG_DEBUG(
"Fit to TGC inner station returns only a point");
113 <<
"/" << tgcFitResult.
tgcInn[2] <<
"/" << tgcFitResult.
tgcInn[3]);
115 <<
"/" << tgcFitResult.
tgcMid1[2] <<
"/" << tgcFitResult.
tgcMid1[3]);
117 <<
"/" << tgcFitResult.
tgcMid2[2] <<
"/" << tgcFitResult.
tgcMid2[3]);
122 if (tgcHits.size()>0 && !isMiddleFailure){
127 const double PHI_RANGE = 12./(
M_PI/8.);
129 double alpha = (*m_ptEndcapLUT)->alpha(tgcFitResult.
tgcMid1[3], tgcFitResult.
tgcMid1[2],
133 double PhiInOctant = std::abs(tgcFitResult.
tgcMid1[1] - Octant * (
M_PI/4.));
134 if (PhiInOctant > (
M_PI/8.)) PhiInOctant = (
M_PI/4.) - PhiInOctant;
136 int phiBin =
static_cast<int>(PhiInOctant * PHI_RANGE);
137 int etaBin =
static_cast<int>((std::abs(tgcFitResult.
tgcMid1[0]) - 1.)/0.05);
148 if (std::abs(tgcFitResult.
tgcMid1[3])>=0.) tgcFitResult.
phi = tgcFitResult.
tgcMid1[1];
149 if (std::abs(tgcFitResult.
tgcMid2[3])>=0.) tgcFitResult.
phi = tgcFitResult.
tgcMid2[1];
158 double tmp1 = (tgcFitResult.
tgcMid1[1]>0)?
185 muonRoad.
aw[endcap_middle][0] = tgcFitResult.
slope;
186 muonRoad.
bw[endcap_middle][0] = tgcFitResult.
intercept;
187 muonRoad.
aw[endcap_outer][0] = tgcFitResult.
slope;
188 muonRoad.
bw[endcap_outer][0] = tgcFitResult.
intercept;
189 muonRoad.
aw[endcap_extra][0] = tgcFitResult.
slope;
190 muonRoad.
bw[endcap_extra][0] = tgcFitResult.
intercept;
191 muonRoad.
aw[bee][0] = tgcFitResult.
slope;
193 for (
int i_layer=0; i_layer<
N_LAYER; i_layer++) {
194 muonRoad.
rWidth[endcap_middle][i_layer] = R_WIDTH_DEFAULT;
195 muonRoad.
rWidth[endcap_outer][i_layer] = R_WIDTH_DEFAULT;
196 muonRoad.
rWidth[endcap_extra][i_layer] = R_WIDTH_DEFAULT;
197 muonRoad.
rWidth[bee][i_layer] = R_WIDTH_DEFAULT;
201 muonRoad.
aw[endcap_inner][0] = tgcFitResult.
tgcInn[2]/tgcFitResult.
tgcInn[3];
202 muonRoad.
aw[barrel_inner][0] = tgcFitResult.
tgcInn[2]/tgcFitResult.
tgcInn[3];
203 muonRoad.
aw[csc][0] = tgcFitResult.
tgcInn[2]/tgcFitResult.
tgcInn[3];
204 for (
int i_layer=0; i_layer<
N_LAYER; i_layer++) muonRoad.
rWidth[endcap_inner][i_layer] = R_WIDTH_DEFAULT;
205 for (
int i_layer=0; i_layer<
N_LAYER; i_layer++) muonRoad.
rWidth[barrel_inner][i_layer] = R_WIDTH_DEFAULT;
206 for (
int i_layer=0; i_layer<
N_LAYER; i_layer++) muonRoad.
rWidth[csc][i_layer] = R_WIDTH_DEFAULT;
214 double extrInnerEta = 0;
228 if (m_backExtrapolatorTool) {
230 = (*m_backExtrapolatorTool)->give_eta_phi_at_vertex(muonSA, eta,sigma_eta,phi,sigma_phi,0.);
231 if (
sc.isSuccess() ){
234 extrInnerEta = etaMiddle;
238 return StatusCode::FAILURE;
241 if (muonSA)
delete muonSA;
244 if (extrInnerEta != 0.) {
246 muonRoad.
aw[endcap_inner][0] =
std::tan(theta)*(std::abs(extrInnerEta)/extrInnerEta);
247 muonRoad.
aw[barrel_inner][0] =
std::tan(theta)*(std::abs(extrInnerEta)/extrInnerEta);
248 muonRoad.
aw[csc][0] =
std::tan(theta)*(std::abs(extrInnerEta)/extrInnerEta);
250 muonRoad.
aw[endcap_inner][0] = 0;
251 muonRoad.
aw[barrel_inner][0] = 0;
252 muonRoad.
aw[csc][0] = 0;
255 for (
int i_layer=0; i_layer<
N_LAYER; i_layer++) muonRoad.
rWidth[endcap_inner][i_layer] = R_WIDTH_INNER_NO_HIT;
256 for (
int i_layer=0; i_layer<
N_LAYER; i_layer++) muonRoad.
rWidth[barrel_inner][i_layer] = R_WIDTH_INNER_NO_HIT;
257 for (
int i_layer=0; i_layer<
N_LAYER; i_layer++) muonRoad.
rWidth[csc][i_layer] = R_WIDTH_INNER_NO_HIT;
261 muonRoad.
bw[endcap_inner][0] = 0.;
262 muonRoad.
bw[barrel_inner][0] = 0.;
263 muonRoad.
bw[csc][0] = 0.;
268 ATH_MSG_DEBUG(
"Because no TGC hits are available, estimate the road from RoI");
274 muonRoad.
aw[endcap_inner][0] = aw;
275 muonRoad.
bw[endcap_inner][0] = 0;
276 muonRoad.
aw[endcap_middle][0] = aw;
277 muonRoad.
bw[endcap_middle][0] = 0;
278 muonRoad.
aw[endcap_outer][0] = aw;
279 muonRoad.
bw[endcap_outer][0] = 0;
280 muonRoad.
aw[endcap_extra][0] = aw;
281 muonRoad.
bw[endcap_extra][0] = 0;
282 muonRoad.
aw[barrel_inner][0] = aw;
283 muonRoad.
bw[barrel_inner][0] = 0;
284 muonRoad.
aw[bee][0] = aw;
285 muonRoad.
bw[bee][0] = 0;
286 muonRoad.
aw[csc][0] = aw;
287 muonRoad.
bw[csc][0] = 0;
288 for (
int i_layer=0; i_layer<
N_LAYER; i_layer++) {
290 muonRoad.
rWidth[endcap_inner][i_layer] = 300;
291 muonRoad.
rWidth[endcap_middle][i_layer] = 400;
292 muonRoad.
rWidth[endcap_outer][i_layer] = 600;
293 muonRoad.
rWidth[endcap_extra][i_layer] = 400;
294 muonRoad.
rWidth[barrel_inner][i_layer] = 250;
295 muonRoad.
rWidth[bee][i_layer] = 500;
296 muonRoad.
rWidth[csc][i_layer] = 200;
298 muonRoad.
rWidth[endcap_inner][i_layer] = m_rWidth_TGC_Failed;
299 muonRoad.
rWidth[endcap_middle][i_layer] = m_rWidth_TGC_Failed;
300 muonRoad.
rWidth[endcap_outer][i_layer] = m_rWidth_TGC_Failed;
301 muonRoad.
rWidth[endcap_extra][i_layer] = m_rWidth_TGC_Failed;
302 muonRoad.
rWidth[barrel_inner][i_layer] = m_rWidth_TGC_Failed;
303 muonRoad.
rWidth[bee][i_layer] = m_rWidth_TGC_Failed;
304 muonRoad.
rWidth[csc][i_layer] = m_rWidth_TGC_Failed;
310 muonRoad.
aw[
i][1] = muonRoad.
aw[
i][0];
311 muonRoad.
bw[
i][1] = muonRoad.
bw[
i][0];
317 if( ! isMiddleFailure ) {
319 phiMiddle = tgcFitResult.
tgcMid1[1];
321 side = (p_roids->
eta()<0.)? 0 : 1;
322 phiMiddle = p_roids->
phi();
328 int sector_trigger = 99;
329 int sector_overlap = 99;
332 float tempDeltaPhi=99;
333 std::vector<Identifier> stationList;
334 std::vector<IdentifierHash> mdtHashList;
337 IdContext context = m_idHelperSvc->mdtIdHelper().module_context();
343 if(phiMax >
M_PI) phiMax -=
M_PI*2.;
344 if(phiMin <
M_PI*-1) phiMin +=
M_PI*2.;
347 if (iroi) m_regionSelector->HashIDList(*iroi, mdtHashList);
350 m_regionSelector->HashIDList(fullscan_roi, mdtHashList);
356 int convert = m_idHelperSvc->mdtIdHelper().get_id(i_hash,
id, &context);
361 std::string
name = m_idHelperSvc->mdtIdHelper().stationNameString(m_idHelperSvc->mdtIdHelper().stationName(
id));
362 if (
name.substr(0, 1) ==
"B" )
continue;
363 if (
name.substr(1, 1) !=
"M" )
continue;
364 int stationPhi = m_idHelperSvc->mdtIdHelper().stationPhi(
id);
365 float floatPhi = (stationPhi-1)*
M_PI/4;
366 if (
name[2]==
'S' ||
name[2]==
'E') floatPhi = floatPhi +
M_PI/8;
367 tempDeltaPhi = std::abs(floatPhi-muonRoad.
phiMiddle);
368 if (phiMiddle<0) tempDeltaPhi = std::abs(floatPhi-muonRoad.
phiMiddle-2*
M_PI);
369 if(tempDeltaPhi >
M_PI) tempDeltaPhi = std::abs(tempDeltaPhi - 2*
M_PI);
372 if(
name[2]==
'S' ||
name[2]==
'E') LargeSmall = 1;
373 int sector = (stationPhi-1)*2 + LargeSmall;
374 if(sector_trigger == 99)
375 sector_trigger = sector;
376 else if(sector_trigger != sector)
377 sector_overlap = sector;
381 temp_sector = sector;
386 if(temp_sector != sector_trigger){
387 sector_overlap = sector_trigger;
388 sector_trigger = temp_sector;
398 for (
int i_sector=0; i_sector<
N_SECTOR; i_sector++) {
400 muonRoad.
aw[endcap_inner][i_sector] = muonRoad.
aw_ftf[3][0];
401 muonRoad.
bw[endcap_inner][i_sector] = muonRoad.
bw_ftf[3][0];
402 muonRoad.
aw[endcap_middle][i_sector] = muonRoad.
aw_ftf[4][0];
403 muonRoad.
bw[endcap_middle][i_sector] = muonRoad.
bw_ftf[4][0];
404 muonRoad.
aw[endcap_outer][i_sector] = muonRoad.
aw_ftf[5][0];
405 muonRoad.
bw[endcap_outer][i_sector] = muonRoad.
bw_ftf[5][0];
406 muonRoad.
aw[endcap_extra][i_sector] = muonRoad.
aw_ftf[6][0];
407 muonRoad.
bw[endcap_extra][i_sector] = muonRoad.
bw_ftf[6][0];
408 muonRoad.
aw[csc][i_sector] = muonRoad.
aw_ftf[7][0];
409 muonRoad.
bw[csc][i_sector] = muonRoad.
bw_ftf[7][0];
410 muonRoad.
aw[bee][i_sector] = muonRoad.
aw_ftf[8][0];
411 muonRoad.
bw[bee][i_sector] = muonRoad.
bw_ftf[8][0];
412 muonRoad.
aw[barrel_inner][i_sector] = muonRoad.
aw_ftf[0][0];
413 muonRoad.
bw[barrel_inner][i_sector] = muonRoad.
bw_ftf[0][0];
418 return StatusCode::SUCCESS;
430 const double PHI_BOUNDARY = 0.2;
432 tgcStripMidPoints.clear();
433 tgcStripInnPoints.clear();
434 tgcWireMidPoints.clear();
435 tgcWireInnPoints.clear();
439 for (iHit = 0; iHit < tgcHits.size(); iHit++)
452 double phi = hit.
phi;
453 if( phi < 0 && ( (
M_PI+phi)<PHI_BOUNDARY) ) phi +=
M_PI*2;
455 else if ( hit.
sta ==3 ) { tgcStripInnPoints.push_back(
TgcFit::Point(iHit + 1, hit.
sta, hit.
z, phi,
w)); }
460 else if ( hit.
sta ==3 ) { tgcWireInnPoints.push_back(
TgcFit::Point(iHit + 1, hit.
sta, hit.
z, hit.
r,
w)); }
464 ATH_MSG_DEBUG(
", tgcStripMidPoints.size()=" << tgcStripMidPoints.size() <<
465 ", tgcStripInnPoints.size()=" << tgcStripInnPoints.size() <<
466 ", tgcWireMidPoints.size()=" << tgcWireMidPoints.size() <<
467 ", tgcWireInnPoints.size()=" << tgcWireInnPoints.size());