52{
55
56 bool isMiddleFailure = true;
57
58
59 const double R_WIDTH_DEFAULT = 100;
60 const double R_WIDTH_INNER_NO_HIT = 200;
61
63
65
69 double aw;
77
82
83 if (tgcHits.size()>0) {
84
85
86
87 if( !
prepareTgcPoints(tgcHits, tgcStripInnPoints, tgcWireInnPoints, tgcStripMidPoints, tgcWireMidPoints) ) {
89 return StatusCode::FAILURE;
90 }
91
92
93
94 isMiddleFailure = false;
98 isMiddleFailure = true;
99 }
101 ATH_MSG_DEBUG(
"Fit to TGC middle station returns only a point");
102 }
103
104
105 status =
m_tgcFit->runTgcInner(tgcStripInnPoints, tgcWireInnPoints, tgcFitResult);
108 }
110 ATH_MSG_DEBUG(
"Fit to TGC inner station returns only a point");
111 }
112
114 <<
"/" << tgcFitResult.
tgcInn[2] <<
"/" << tgcFitResult.
tgcInn[3]);
116 <<
"/" << tgcFitResult.
tgcMid1[2] <<
"/" << tgcFitResult.
tgcMid1[3]);
118 <<
"/" << tgcFitResult.
tgcMid2[2] <<
"/" << tgcFitResult.
tgcMid2[3]);
119 } else {
121 }
122
123 if (tgcHits.size()>0 && !isMiddleFailure){
124
126
127
128 const double PHI_RANGE = 12./(
M_PI/8.);
132
134 double PhiInOctant = std::abs(tgcFitResult.
tgcMid1[1] - Octant * (
M_PI/4.));
135 if (PhiInOctant > (
M_PI/8.)) PhiInOctant = (
M_PI/4.) - PhiInOctant;
136
137 int phiBin =
static_cast<int>(PhiInOctant * PHI_RANGE);
138 int etaBin =
static_cast<int>((std::abs(tgcFitResult.
tgcMid1[0]) - 1.)/0.05);
139
141
144
145
147
149 if (std::abs(tgcFitResult.
tgcMid1[3])>=0.) tgcFitResult.
phi = tgcFitResult.
tgcMid1[1];
150 if (std::abs(tgcFitResult.
tgcMid2[3])>=0.) tgcFitResult.
phi = tgcFitResult.
tgcMid2[1];
151
152 } else {
153
155
158
159 double tmp1 = (tgcFitResult.
tgcMid1[1]>0)?
161
164
166
168 (tmp2-tmp1)/std::abs(tgcFitResult.
tgcMid2[3]-tgcFitResult.
tgcMid1[3]): 0;
169
171
172 } else {
173
177
178 }
179 }
180 float X1 = tgcFitResult.
tgcMid1[3] * std::cos(tgcFitResult.
tgcMid1[1]);
181 float Y1 = tgcFitResult.
tgcMid1[3] * std::sin(tgcFitResult.
tgcMid1[1]);
182 float X2 = tgcFitResult.
tgcMid2[3] * std::cos(tgcFitResult.
tgcMid2[1]);
183 float Y2 = tgcFitResult.
tgcMid2[3] * std::sin(tgcFitResult.
tgcMid2[1]);
185
186 muonRoad.
aw[endcap_middle][0] = tgcFitResult.
slope;
187 muonRoad.
bw[endcap_middle][0] = tgcFitResult.
intercept;
188 muonRoad.
aw[endcap_outer][0] = tgcFitResult.
slope;
189 muonRoad.
bw[endcap_outer][0] = tgcFitResult.
intercept;
190 muonRoad.
aw[endcap_extra][0] = tgcFitResult.
slope;
191 muonRoad.
bw[endcap_extra][0] = tgcFitResult.
intercept;
192 muonRoad.
aw[bee][0] = tgcFitResult.
slope;
194 for (
int i_layer=0; i_layer<
N_LAYER; i_layer++) {
195 muonRoad.
rWidth[endcap_middle][i_layer] = R_WIDTH_DEFAULT;
196 muonRoad.
rWidth[endcap_outer][i_layer] = R_WIDTH_DEFAULT;
197 muonRoad.
rWidth[endcap_extra][i_layer] = R_WIDTH_DEFAULT;
198 muonRoad.
rWidth[bee][i_layer] = R_WIDTH_DEFAULT;
199 }
200
202 muonRoad.
aw[endcap_inner][0] = tgcFitResult.
tgcInn[2]/tgcFitResult.
tgcInn[3];
203 muonRoad.
aw[barrel_inner][0] = tgcFitResult.
tgcInn[2]/tgcFitResult.
tgcInn[3];
204 muonRoad.
aw[csc][0] = tgcFitResult.
tgcInn[2]/tgcFitResult.
tgcInn[3];
205 for (
int i_layer=0; i_layer<
N_LAYER; i_layer++) muonRoad.
rWidth[endcap_inner][i_layer] = R_WIDTH_DEFAULT;
206 for (
int i_layer=0; i_layer<
N_LAYER; i_layer++) muonRoad.
rWidth[barrel_inner][i_layer] = R_WIDTH_DEFAULT;
207 for (
int i_layer=0; i_layer<
N_LAYER; i_layer++) muonRoad.
rWidth[csc][i_layer] = R_WIDTH_DEFAULT;
208 } else {
209
210
211 double etaMiddle = (tgcFitResult.
tgcMid1[3])? tgcFitResult.
tgcMid1[0] : tgcFitResult.tgcMid2[0];
212 double phiMiddle = (tgcFitResult.
tgcMid1[3])? tgcFitResult.
tgcMid1[1] : tgcFitResult.tgcMid2[1];
214 double sigma_eta;
215 double extrInnerEta = 0;
216
218 muonSA->makePrivateStore();
225
227 double sigma_phi;
228
231 = (*m_backExtrapolatorTool)->give_eta_phi_at_vertex(muonSA,
eta,sigma_eta,
phi,sigma_phi,0.);
232 if (
sc.isSuccess() ){
234 } else {
235 extrInnerEta = etaMiddle;
236 }
237 } else {
239 delete muonSA;
240 return StatusCode::FAILURE;
241 }
242
243 delete muonSA;
244
246 if (extrInnerEta != 0.) {
247 theta = std::atan(std::exp(-std::abs(extrInnerEta)))*2.;
248 muonRoad.
aw[endcap_inner][0] = std::tan(
theta)*(std::abs(extrInnerEta)/extrInnerEta);
249 muonRoad.
aw[barrel_inner][0] = std::tan(
theta)*(std::abs(extrInnerEta)/extrInnerEta);
250 muonRoad.
aw[csc][0] = std::tan(
theta)*(std::abs(extrInnerEta)/extrInnerEta);
251 } else {
252 muonRoad.
aw[endcap_inner][0] = 0;
253 muonRoad.
aw[barrel_inner][0] = 0;
254 muonRoad.
aw[csc][0] = 0;
255 }
256
257 for (
int i_layer=0; i_layer<
N_LAYER; i_layer++) muonRoad.
rWidth[endcap_inner][i_layer] = R_WIDTH_INNER_NO_HIT;
258 for (
int i_layer=0; i_layer<
N_LAYER; i_layer++) muonRoad.
rWidth[barrel_inner][i_layer] = R_WIDTH_INNER_NO_HIT;
259 for (
int i_layer=0; i_layer<
N_LAYER; i_layer++) muonRoad.
rWidth[csc][i_layer] = R_WIDTH_INNER_NO_HIT;
260
261 }
262
263 muonRoad.
bw[endcap_inner][0] = 0.;
264 muonRoad.
bw[barrel_inner][0] = 0.;
265 muonRoad.
bw[csc][0] = 0.;
266
267 } else {
268
269
270 ATH_MSG_DEBUG(
"Because no TGC hits are available, estimate the road from RoI");
271
273 theta = std::atan(std::exp(-std::abs(roiEta)))*2.;
275
276 muonRoad.
aw[endcap_inner][0] = aw;
277 muonRoad.
bw[endcap_inner][0] = 0;
278 muonRoad.
aw[endcap_middle][0] = aw;
279 muonRoad.
bw[endcap_middle][0] = 0;
280 muonRoad.
aw[endcap_outer][0] = aw;
281 muonRoad.
bw[endcap_outer][0] = 0;
282 muonRoad.
aw[endcap_extra][0] = aw;
283 muonRoad.
bw[endcap_extra][0] = 0;
284 muonRoad.
aw[barrel_inner][0] = aw;
285 muonRoad.
bw[barrel_inner][0] = 0;
286 muonRoad.
aw[bee][0] = aw;
287 muonRoad.
bw[bee][0] = 0;
288 muonRoad.
aw[csc][0] = aw;
289 muonRoad.
bw[csc][0] = 0;
290 for (
int i_layer=0; i_layer<
N_LAYER; i_layer++) {
291 if(insideOut) {
292 muonRoad.
rWidth[endcap_inner][i_layer] = 300;
293 muonRoad.
rWidth[endcap_middle][i_layer] = 400;
294 muonRoad.
rWidth[endcap_outer][i_layer] = 600;
295 muonRoad.
rWidth[endcap_extra][i_layer] = 400;
296 muonRoad.
rWidth[barrel_inner][i_layer] = 250;
297 muonRoad.
rWidth[bee][i_layer] = 500;
298 muonRoad.
rWidth[csc][i_layer] = 200;
299 } else {
307 }
308 }
309 }
310
312 muonRoad.
aw[
i][1] = muonRoad.
aw[
i][0];
313 muonRoad.
bw[
i][1] = muonRoad.
bw[
i][0];
314 }
315
316
318 float phiMiddle = 0;
319 if( ! isMiddleFailure ) {
321 phiMiddle = tgcFitResult.
tgcMid1[1];
322 } else {
323 side = (p_roids->
eta()<0.)? 0 : 1;
324 phiMiddle = p_roids->
phi();
325 }
329
330 int sector_trigger = 99;
331 int sector_overlap = 99;
332 int temp_sector=99;
334 float tempDeltaPhi=99;
335 std::vector<Identifier> stationList;
336 std::vector<IdentifierHash> mdtHashList;
337
338
340
345 if(phiMax >
M_PI) phiMax -=
M_PI*2.;
346 if(phiMin <
M_PI*-1) phiMin +=
M_PI*2.;
348 const IRoiDescriptor* iroi = static_cast<IRoiDescriptor*> (roi);
350 else {
353 }
354 if(roi) delete roi;
355
356 for(const IdentifierHash& i_hash : mdtHashList ){
359
360 if(convert!=0)
ATH_MSG_ERROR(
"problem converting hash list to id");
361
364 if (
name.substr(0, 1) ==
"B" )
continue;
365 if (
name.substr(1, 1) !=
"M" )
continue;
368 if (name[2]==
'S' || name[2]==
'E') floatPhi = floatPhi +
M_PI/8;
369 tempDeltaPhi = std::abs(floatPhi-muonRoad.
phiMiddle);
370 if (phiMiddle<0) tempDeltaPhi = std::abs(floatPhi-muonRoad.
phiMiddle-2*
M_PI);
371 if(tempDeltaPhi >
M_PI) tempDeltaPhi = std::abs(tempDeltaPhi - 2*
M_PI);
372
373 int LargeSmall = 0;
374 if(name[2]=='S' || name[2]=='E') LargeSmall = 1;
376 if(sector_trigger == 99)
377 sector_trigger = sector;
378 else if(sector_trigger != sector)
379 sector_overlap = sector;
380
383 temp_sector = sector;
385 }
386
387 }
388 if(temp_sector != sector_trigger){
389 sector_overlap = sector_trigger;
390 sector_trigger = temp_sector;
391 }
392
395
396 if (insideOut) {
400 for (
int i_sector=0; i_sector<
N_SECTOR; i_sector++) {
402 muonRoad.
aw[endcap_inner][i_sector] = muonRoad.
aw_ftf[3][0];
403 muonRoad.
bw[endcap_inner][i_sector] = muonRoad.
bw_ftf[3][0];
404 muonRoad.
aw[endcap_middle][i_sector] = muonRoad.
aw_ftf[4][0];
405 muonRoad.
bw[endcap_middle][i_sector] = muonRoad.
bw_ftf[4][0];
406 muonRoad.
aw[endcap_outer][i_sector] = muonRoad.
aw_ftf[5][0];
407 muonRoad.
bw[endcap_outer][i_sector] = muonRoad.
bw_ftf[5][0];
408 muonRoad.
aw[endcap_extra][i_sector] = muonRoad.
aw_ftf[6][0];
409 muonRoad.
bw[endcap_extra][i_sector] = muonRoad.
bw_ftf[6][0];
410 muonRoad.
aw[csc][i_sector] = muonRoad.
aw_ftf[7][0];
411 muonRoad.
bw[csc][i_sector] = muonRoad.
bw_ftf[7][0];
412 muonRoad.
aw[bee][i_sector] = muonRoad.
aw_ftf[8][0];
413 muonRoad.
bw[bee][i_sector] = muonRoad.
bw_ftf[8][0];
414 muonRoad.
aw[barrel_inner][i_sector] = muonRoad.
aw_ftf[0][0];
415 muonRoad.
bw[barrel_inner][i_sector] = muonRoad.
bw_ftf[0][0];
416 }
417 }
418
419
420 return StatusCode::SUCCESS;
421}
Scalar eta() const
pseudorapidity method
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
Scalar phi() const
phi method
Scalar theta() const
theta method
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
double charge(const T &p)
Athena::TPCnvVers::Current TrigRoiDescriptor
virtual double phi() const override final
Methods to retrieve data members.
virtual double eta() const override final
std::vector< Identifier > stationList
double aw[N_STATION][N_SECTOR]
double bw_ftf[N_STATION][N_SECTOR]
double aw_ftf[N_STATION][N_SECTOR]
double bw[N_STATION][N_SECTOR]
double rWidth[N_STATION][N_LAYER]
std::vector< Point > PointArray
const ToolHandle< ITrigMuonBackExtrapolator > * m_backExtrapolatorTool
double m_rWidth_TGC_Failed
bool prepareTgcPoints(const TrigL2MuonSA::TgcHits &tgcHits, TrigL2MuonSA::TgcFit::PointArray &tgcStripInnPoints, TrigL2MuonSA::TgcFit::PointArray &tgcWireInnPoints, TrigL2MuonSA::TgcFit::PointArray &tgcStripMidPoints, TrigL2MuonSA::TgcFit::PointArray &tgcWireMidPoints) const
ToolHandle< TgcFit > m_tgcFit
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
ToolHandle< IRegSelTool > m_regionSelector
void setEtaMS(float value)
Set the eta at muon spectrometer.
void setRMS(float value)
Set the R at muon spectrometer.
void setSAddress(int value)
Set the station address of the muon.
void setPhiMS(float value)
Set the phi at muon spectrometer.
void setPt(float pt)
Set the transverse momentum ( ) of the muon.
void setZMS(float value)
Set the Z at muon spectrometer.
::StatusCode StatusCode
StatusCode definition for legacy code.
constexpr uint8_t stationPhi
station Phi 1 to 8
std::unique_ptr< MVAUtils::BDT > convert(TMVA::MethodBDT *bdt, bool isRegression=true, bool useYesNoLeaf=false)
@ BarrelInner
Inner station in the barrel spectrometer.
@ EndcapOuter
Outer station in the endcap spectrometer.
@ CSC
CSC measurement point.
@ EndcapMiddle
Middle station in the endcap spectrometer.
@ BEE
BEE measurement point.
@ EndcapExtra
Extra station in the endcap spectrometer.
@ EndcapInner
Inner station in the endcap spectrometer.
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setPhiMap phiBin
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap etaBin
L2StandAloneMuon_v2 L2StandAloneMuon
Define the latest version of the muon SA class.
setTeId setLumiBlock setRoiId setRoiSubsystem setRoiNumber roiEta