ATLAS Offline Software
MuFastStationFitter.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "MuFastStationFitter.h"
7 
8 #include <math.h>
9 #include <iomanip>
10 
11 #include "TMath.h"
12 
14 
16 
17 namespace{
18  constexpr double ZERO_LIMIT = 1.e-6;
19 }
20 
21 
22 // --------------------------------------------------------------------------------
23 // --------------------------------------------------------------------------------
24 
26  const std::string& name,
27  const IInterface* parent):
29 {
30 }
31 
32 // --------------------------------------------------------------------------------
33 // --------------------------------------------------------------------------------
34 
36 {
37  // BackExtrapolator services
38  ATH_CHECK( m_backExtrapolator.retrieve() );
39 
40  ATH_CHECK( m_alphaBetaEstimate.retrieve() );
41  ATH_MSG_DEBUG("Retrieved service " << m_alphaBetaEstimate);
42 
43  ATH_CHECK( m_ptFromAlphaBeta.retrieve() );
44  ATH_MSG_DEBUG("Retrieved service " << m_ptFromAlphaBeta);
45 
46  ATH_CHECK( m_nswStationFitter.retrieve(DisableTool{m_nswStationFitter.empty()}) );
47 
48  return StatusCode::SUCCESS;
49 }
50 
51 // --------------------------------------------------------------------------------
52 // --------------------------------------------------------------------------------
54 {
55  m_use_mcLUT = use_mcLUT;
56 
57  if (m_use_mcLUT) {
58  const ServiceHandle<TrigL2MuonSA::PtEndcapLUTSvc> ptEndcapLUTSvc("PtEndcapLUTSvc_MC", name());
59  if ( ptEndcapLUTSvc.retrieve().isFailure() ) {
60  ATH_MSG_ERROR("Could not find PtEndcaplLUTSvc");
61  return StatusCode::FAILURE;
62  }
63  // Calculation of alpha and beta
64  m_alphaBetaEstimate->setMCFlag(m_use_mcLUT, &*ptEndcapLUTSvc);
65  // conversion: alpha, beta -> pT
66  m_ptFromAlphaBeta->setMCFlag(m_use_mcLUT, &*ptEndcapLUTSvc);
67  } else {
68  const ServiceHandle<TrigL2MuonSA::PtEndcapLUTSvc> ptEndcapLUTSvc("PtEndcapLUTSvc", name());
69  if ( ptEndcapLUTSvc.retrieve().isFailure() ) {
70  ATH_MSG_ERROR("Could not find PtEndcaplLUTSvc");
71  return StatusCode::FAILURE;
72  }
73  // Calculation of alpha and beta
74  m_alphaBetaEstimate->setMCFlag(m_use_mcLUT, &*ptEndcapLUTSvc);
75  // conversion: alpha, beta -> pT
76  m_ptFromAlphaBeta->setMCFlag(m_use_mcLUT, &*ptEndcapLUTSvc);
77  }
78 
79  ATH_MSG_DEBUG( "Completed tp set " << (m_use_mcLUT?"MC":"not MC") << " flag" );
80 
81  return StatusCode::SUCCESS;
82 }
83 
84 //--------------------------------------------------------------------------------
85 // --------------------------------------------------------------------------------
86 
88  const TrigL2MuonSA::MuonRoad& muonRoad,
89  TrigL2MuonSA::RpcFitResult& rpcFitResult,
90  std::vector<TrigL2MuonSA::TrackPattern>& v_trackPatterns) const
91 {
92 
93  //
94  for (TrigL2MuonSA::TrackPattern& itTrack : v_trackPatterns) { // loop for track candidates
95 
96  if (rpcFitResult.isSuccess) {
97  // itTrack->phiMSDir = rpcFitResult.phiDir;
98  itTrack.phiMSDir = (std::abs(std::cos(rpcFitResult.phi)) > ZERO_LIMIT)? std::tan(rpcFitResult.phi): 0;
99  } else {
100  if ( std::abs(muonRoad.extFtfMiddlePhi) > ZERO_LIMIT ) { //inside-out
101  itTrack.phiMSDir = (std::abs(std::cos(muonRoad.extFtfMiddlePhi)) > ZERO_LIMIT)? std::tan(muonRoad.extFtfMiddlePhi): 0;
102  } else {
103  itTrack.phiMSDir = (std::abs(std::cos(p_roids->phi())) > ZERO_LIMIT)? std::tan(p_roids->phi()): 0;
104  }
105  itTrack.isRpcFailure = true;
106  }
107 
108  ATH_CHECK( superPointFitter(itTrack) );
109  }
110  //
111 
112  return StatusCode::SUCCESS;
113 }
114 
115 // --------------------------------------------------------------------------------
116 // --------------------------------------------------------------------------------
117 
119  const TrigL2MuonSA::MuonRoad& muonRoad,
120  TrigL2MuonSA::TgcFitResult& tgcFitResult,
121  std::vector<TrigL2MuonSA::TrackPattern>& v_trackPatterns,
122  TrigL2MuonSA::StgcHits& stgcHits,
123  TrigL2MuonSA::MmHits& mmHits) const
124 {
125 
126  for (TrigL2MuonSA::TrackPattern& itTrack : v_trackPatterns) { // loop for track candidates
127 
128  if (tgcFitResult.isSuccess) {
129  itTrack.phiMSDir = tgcFitResult.phiDir;
130  } else {
131  if ( std::abs(muonRoad.extFtfMiddlePhi) > ZERO_LIMIT ) { //insideout
132  itTrack.phiMSDir = (std::abs(std::cos(muonRoad.extFtfMiddlePhi)) > ZERO_LIMIT)? std::tan(muonRoad.extFtfMiddlePhi): 0;
133  } else {
134  itTrack.phiMSDir = (std::abs(std::cos(p_roids->phi())) > ZERO_LIMIT)? std::tan(p_roids->phi()): 0;
135  }
136  itTrack.isTgcFailure = true;
137  }
138 
139  ATH_CHECK( superPointFitter(itTrack) );
140 
141  if(!m_nswStationFitter.empty())
142  ATH_CHECK( m_nswStationFitter->superPointFitter(p_roids, itTrack, stgcHits, mmHits) );
143  }
144  //
145  return StatusCode::SUCCESS;
146 }
147 
148 // --------------------------------------------------------------------------------
149 // --------------------------------------------------------------------------------
150 
152  const TrigL2MuonSA::MuonRoad& muonRoad,
153  TrigL2MuonSA::TgcFitResult& tgcFitResult,
154  std::vector<TrigL2MuonSA::TrackPattern>& v_trackPatterns,
155  TrigL2MuonSA::StgcHits& stgcHits,
156  TrigL2MuonSA::MmHits& mmHits) const
157 {
158 
159  for (TrigL2MuonSA::TrackPattern& itTrack : v_trackPatterns) { // loop for track candidates
160 
161  if (tgcFitResult.isSuccess) {
162  itTrack.phiMSDir = tgcFitResult.phiDir;
163  } else {
164  itTrack.phiMSDir = (std::abs(std::cos(p_roids->phi())) > ZERO_LIMIT)? std::tan(p_roids->phi()): 0;
165  itTrack.isTgcFailure = true;
166  }
167 
168  ATH_CHECK( superPointFitter(itTrack, muonRoad) );
169 
170  makeReferenceLine(itTrack, muonRoad);
171  ATH_CHECK( m_alphaBetaEstimate->setAlphaBeta(p_roids, tgcFitResult, itTrack, muonRoad) );
172 
173  if ( itTrack.etaBin < -1 ) {
174  itTrack.etaBin = (int)((std::abs(muonRoad.extFtfMiddleEta)-1.)/0.05); // eta binning is the same as AlphaBetaEstimate
175  if(itTrack.etaBin <= -1) itTrack.etaBin = 0;
176  }
177 
178  ATH_CHECK( m_ptFromAlphaBeta->setPt(itTrack,tgcFitResult) );
179 
180  double exInnerA = fromAlphaPtToInn(tgcFitResult,itTrack);
181  double bw = muonRoad.bw[3][0];
182  double aw = muonRoad.aw[3][0];
183  if(std::abs(exInnerA) > ZERO_LIMIT) updateInnSP(itTrack, exInnerA, aw,bw);
184 
185  if(!m_nswStationFitter.empty())
186  ATH_CHECK( m_nswStationFitter->superPointFitter(p_roids, itTrack, stgcHits, mmHits) );
187 
188  }
189  //
190  return StatusCode::SUCCESS;
191 }
192 
193 // --------------------------------------------------------------------------------
194 
195 // --------------------------------------------------------------------------------
196 
198 {
199  int count;
200  int FitFlag;
201  float Xor, Yor, sigma, rm=0., phim=0;
202  float Ymid, Xmid, Amid;
203 
204  const unsigned int MAX_STATION = 10; // no BMG(Backup=10)
205  const float SIGMA = 0.0080;
206  const float DRIFTSPACE_LIMIT = 16.;
207  const int MIN_MDT_FOR_FIT = 3;
208 
209  TrigL2MuonSA::MdtHits* mdtSegment;
210  TrigL2MuonSA::SuperPoint* superPoint;
211  TrigL2MuonSA::PBFitResult pbFitResult;
212 
213  for (unsigned int chamber=0; chamber<MAX_STATION; chamber++) { // loop for station
214  if (chamber==9) continue;//skip BME chamber
215 
216  count = 0;
217  Xor = 0.;
218  Yor = 0.;
219  Amid = 0.;
220  Xmid = 0.;
221  Ymid = 0.;
222 
223  mdtSegment = &(trackPattern.mdtSegments[chamber]);
224  superPoint = &(trackPattern.superPoints[chamber]);
225 
226  if (mdtSegment->size()==0) continue;
227 
228  for (TrigL2MuonSA::MdtHitData& itMdtHit : *mdtSegment) { // loop for MDT hit
229 
230  if (count >= NMEAMX) continue;
231  if (itMdtHit.isOutlier) continue;
232 
233  superPoint->Ndigi++;
234 
235  if (!count) {
236  rm = itMdtHit.cYmid;
237  Amid = itMdtHit.cAmid;
238  Xmid = itMdtHit.cXmid;
239  Ymid = itMdtHit.cYmid;
240  }
241  if (!Xor) {
242  Xor = itMdtHit.R;
243  Yor = itMdtHit.Z;
244  }
245 
246  phim = itMdtHit.cPhip;
247  sigma = (std::abs(itMdtHit.DriftSigma) > ZERO_LIMIT)? itMdtHit.DriftSigma: SIGMA;
248 
249  int station = 0;
250  if (chamber == 0 || chamber == 3 ) station = 0;
251  if (chamber == 1 || chamber == 4 ) station = 1;
252  if (chamber == 2 || chamber == 5 ) station = 2;
253  if (chamber == 6 ) station = 3;
254  if ( std::abs(itMdtHit.DriftSpace) > ZERO_LIMIT &&
255  std::abs(itMdtHit.DriftSpace) < DRIFTSPACE_LIMIT &&
256  std::abs(itMdtHit.DriftTime) > ZERO_LIMIT ) {
257 
258  pbFitResult.XILIN[count] = itMdtHit.R - Xor;
259  pbFitResult.YILIN[count] = itMdtHit.Z - Yor;
260  pbFitResult.IGLIN[count] = 2;
261  pbFitResult.RILIN[count] = (std::abs(itMdtHit.DriftSpace) > ZERO_LIMIT)?
262  itMdtHit.DriftSpace: SetDriftSpace(itMdtHit.DriftTime, itMdtHit.R, itMdtHit.Z, phim, trackPattern.phiMSDir);
263  pbFitResult.WILIN[count] = 1/(sigma*sigma);
264  pbFitResult.JLINE[count] = count;
265  pbFitResult.IDMEA[count] = station*10 + itMdtHit.Layer;
266 
267  pbFitResult.DISTJ[count] = 0.;
268  pbFitResult.RESI[count] = 0.;
269 
270  count++;
271  pbFitResult.NPOI = count;
272 
273  } else {
274  superPoint->Ndigi--;
275  }
276 
277  } // end loop for MDT hits
278 
279  ATH_MSG_DEBUG("... MDT hit used in fit #=" << pbFitResult.NPOI);
280  for(int i=0;i<pbFitResult.NPOI;i++) {
281  ATH_MSG_DEBUG("i/XILIN[i]/YILIN[i]/RILIN[i]/WILIN[i] = "
282  << i << "/" << pbFitResult.XILIN[i] << "/" << pbFitResult.YILIN[i]
283  << "/" << pbFitResult.RILIN[i] << "/" << pbFitResult.WILIN[i]);
284  }
285 
286  if (count >= MIN_MDT_FOR_FIT) {
287 
288  FitFlag = Evlfit(1, pbFitResult);
289  ATH_MSG_DEBUG("FitFlag = " << FitFlag);
290 
291  float ac = Amid;
292  float bc = (Ymid - Xor) -ac*(Xmid - Yor);
293  float X = ( (pbFitResult.ALIN*bc)+pbFitResult.BLIN )/( 1-ac*pbFitResult.ALIN );
294 
295  superPoint->Npoint = pbFitResult.NPOI;
296 
297  if (trackPattern.s_address == -1) { // Endcap
298 
299  if (std::abs(pbFitResult.ALIN) > ZERO_LIMIT) {
300  superPoint->Z = rm;
301  superPoint->R = (rm-Yor)/pbFitResult.ALIN - pbFitResult.BLIN/pbFitResult.ALIN + Xor;
302  superPoint->Alin = 1./pbFitResult.ALIN;
303  superPoint->Blin = -pbFitResult.BLIN/pbFitResult.ALIN;
304 
305  if (chamber==0){//barrel inner
306  superPoint->R = ac*X + bc + Xor;
307  superPoint->Z = X + Yor;
308  superPoint->Alin = pbFitResult.ALIN;
309  superPoint->Blin = pbFitResult.BLIN;
310  }
311  }
312 
313  } else { // Barrel
314 
315  superPoint->R = ac*X + bc + Xor;
316  superPoint->Z = X + Yor;
317  superPoint->Alin = pbFitResult.ALIN;
318  superPoint->Blin = pbFitResult.BLIN;
319  if ( chamber == 3 ){
320  superPoint->Z = rm;
321  superPoint->R = (rm-Yor)/pbFitResult.ALIN - pbFitResult.BLIN/pbFitResult.ALIN + Xor;
322  superPoint->Alin = 1./pbFitResult.ALIN;
323  superPoint->Blin = -pbFitResult.BLIN/pbFitResult.ALIN;
324  }
325  }
326 
327  superPoint->Phim = phim;
328  superPoint->Xor = Xor;
329  superPoint->Yor = Yor;
330  superPoint->Chi2 = pbFitResult.CHI2;
331  superPoint->PChi2 = pbFitResult.PCHI2;
332  for(int i=0;i<pbFitResult.NPOI;i++) superPoint->Residual[i] = pbFitResult.RESI[i];
333 
334  }
335 
336  ATH_MSG_DEBUG("... Superpoint chamber/s_address/count/R/Z/Alin/Blin/Phim/Xor/Yor/Chi2/PChi2="
337  << chamber << "/" << trackPattern.s_address << "/" << count << "/"
338  << superPoint->R << "/" << superPoint->Z << "/" << superPoint->Alin << "/"
339  << superPoint->Blin << "/" << superPoint->Phim << "/" << superPoint->Xor << "/"
340  << superPoint->Yor << "/" << superPoint->Chi2 << "/" << superPoint->PChi2);
341 
342  } // end loop for stations
343 
344  //
345  return StatusCode::SUCCESS;
346 }
347 
348 // --------------------------------------------------------------------------------
349 //---------------------------------------------------------------------------------
351  const TrigL2MuonSA::MuonRoad& muonRoad) const
352 {
353  const unsigned int MAX_STATION = 10;
354  TrigL2MuonSA::MdtHits* mdtSegment;
355  TrigL2MuonSA::SuperPoint* superPoint;
356  TrigL2MuonSA::PBFitResult pbFitResult;
357 
358  for (unsigned int chamber=0; chamber<MAX_STATION; chamber++) { // loop for station
359  ATH_MSG_DEBUG(" superpoint fit station "<<chamber);
360 
361  if(chamber== 1 || chamber == 2 || chamber ==7 || chamber == 9) continue; // only loop for endcap Inner/Middle/Outer/EE/barrel inn
362 
363  mdtSegment = &(trackPattern.mdtSegments[chamber]);
364  superPoint = &(trackPattern.superPoints[chamber]);
365  if (mdtSegment->size()==0) continue;
366 
367  if (chamber==0 || chamber == 6 || chamber==8){
368  int count=0;
369  int FitFlag;
370  float Xor = 0.;
371  float Yor = 0.;
372  float sigma = 0.;
373  float rm = 0.;
374  float phim = 0.;
375  float Ymid = 0.;
376  float Xmid = 0.;
377  float Amid = 0.;
378  const float SIGMA = 0.0080;
379  const float DRIFTSPACE_LIMIT = 16.;
380  const int MIN_MDT_FOR_FIT = 3;
381 
382  for (TrigL2MuonSA::MdtHitData& itMdtHit : *mdtSegment) { // loop for MDT hit
383 
384  if (count >= NMEAMX) continue;
385  if (itMdtHit.isOutlier) continue;
386 
387  superPoint->Ndigi++;
388  if (!count) {
389  rm = itMdtHit.cYmid;
390  Amid = itMdtHit.cAmid;
391  Xmid = itMdtHit.cXmid;
392  Ymid = itMdtHit.cYmid;
393  }
394  if (!Xor) {
395  Xor = itMdtHit.R;
396  Yor = itMdtHit.Z;
397  }
398 
399  phim = itMdtHit.cPhip;
400  sigma = (std::abs(itMdtHit.DriftSigma) > ZERO_LIMIT)? itMdtHit.DriftSigma: SIGMA;
401 
402  int station = 0;
403  if (chamber == 6 ) station = 3;
404  if (chamber == 0 ) station = 0;
405  if ( std::abs(itMdtHit.DriftSpace) > ZERO_LIMIT &&
406  std::abs(itMdtHit.DriftSpace) < DRIFTSPACE_LIMIT &&
407  std::abs(itMdtHit.DriftTime) > ZERO_LIMIT ) {
408 
409  pbFitResult.XILIN[count] = itMdtHit.R - Xor;
410  pbFitResult.YILIN[count] = itMdtHit.Z - Yor;
411  pbFitResult.IGLIN[count] = 2;
412  pbFitResult.RILIN[count] = (std::abs(itMdtHit.DriftSpace) > ZERO_LIMIT)?
413  itMdtHit.DriftSpace: SetDriftSpace(itMdtHit.DriftTime, itMdtHit.R, itMdtHit.Z, phim, trackPattern.phiMSDir);
414  pbFitResult.WILIN[count] = 1/(sigma*sigma);
415  pbFitResult.JLINE[count] = count;
416  pbFitResult.IDMEA[count] = station*10 + itMdtHit.Layer;
417  pbFitResult.DISTJ[count] = 0.;
418  pbFitResult.RESI[count] = 0.;
419  count++;
420  pbFitResult.NPOI = count;
421  } else {
422  superPoint->Ndigi--;
423  }
424  } // end loop for MDT hits
425 
426  ATH_MSG_DEBUG("... MDT hit used in fit #=" << pbFitResult.NPOI);
427  for(int i=0;i<pbFitResult.NPOI;i++) {
428  ATH_MSG_DEBUG("i/XILIN[i]/YILIN[i]/RILIN[i]/WILIN[i] = "
429  << i << "/" << pbFitResult.XILIN[i] << "/" << pbFitResult.YILIN[i]
430  << "/" << pbFitResult.RILIN[i] << "/" << pbFitResult.WILIN[i]);
431  }
432  if (count >= MIN_MDT_FOR_FIT) {
433  FitFlag = Evlfit(1, pbFitResult);
434  ATH_MSG_DEBUG("FitFlag = " << FitFlag);
435 
436  float ac = Amid;
437  float bc = (Ymid - Xor) -ac*(Xmid - Yor);
438  float X = ( (pbFitResult.ALIN*bc)+pbFitResult.BLIN )/( 1-ac*pbFitResult.ALIN );
439 
440  superPoint->Npoint = pbFitResult.NPOI;
441  if (trackPattern.s_address == -1) { // Endcap
442  if (std::abs(pbFitResult.ALIN) > ZERO_LIMIT) {
443  superPoint->Z = rm;
444  superPoint->R = (rm-Yor)/pbFitResult.ALIN - pbFitResult.BLIN/pbFitResult.ALIN + Xor;
445  superPoint->Alin = 1./pbFitResult.ALIN;
446  superPoint->Blin = -pbFitResult.BLIN/pbFitResult.ALIN;
447  if (chamber==0 || chamber==8){//endcap barrel inner or BEE
448  superPoint->R = ac*X + bc + Xor;
449  superPoint->Z = X + Yor;
450  superPoint->Alin = pbFitResult.ALIN;
451  superPoint->Blin = pbFitResult.BLIN;
452  }
453  }
454  }
455  superPoint->Phim = phim;
456  superPoint->Xor = Xor;
457  superPoint->Yor = Yor;
458  superPoint->Chi2 = pbFitResult.CHI2;
459  superPoint->PChi2 = pbFitResult.PCHI2;
460  for(int i=0;i<pbFitResult.NPOI;i++) superPoint->Residual[i] = pbFitResult.RESI[i];
461 
462  }
463  ATH_MSG_DEBUG("...Special Superpoint chamber/s_address/count/R/Z/Alin/Blin/Phim/Xor/Yor/Chi2/PChi2="
464  << chamber << "/" << trackPattern.s_address << "/" << count << "/"
465  << superPoint->R << "/" << superPoint->Z << "/" << superPoint->Alin << "/"
466  << superPoint->Blin << "/" << superPoint->Phim << "/" << superPoint->Xor << "/"
467  << superPoint->Yor << "/" << superPoint->Chi2 << "/" << superPoint->PChi2);
468  continue;
469  }
470 
471  double aw = muonRoad.aw[chamber][0];
472  double bw = muonRoad.bw[chamber][0];
473  double nrWidth = 0.;
474  unsigned int sumN = 0;
475  //chamber=3/4/5 => Endcap Inner/Middle/Outer
476  if(chamber==3) {nrWidth = m_rwidth_Endcapinn_first;}
477  if(chamber==4) {nrWidth = m_rwidth_Endcapmid_first;}
478  if(chamber==5) {nrWidth = m_rwidth_Endcapout_first;}
479 
480  for (TrigL2MuonSA::MdtHitData& itMdtHit : *mdtSegment) { // loop for MDT hit
481  if (std::abs(itMdtHit.DriftSpace) < m_mdt_driftspace_downlimit ||
482  std::abs(itMdtHit.DriftSpace) > m_mdt_driftspace_uplimit){
483  itMdtHit.isOutlier = 2;
484  continue;
485  }
486 
487  if(itMdtHit.isOutlier > 1)continue;
488  double Z = itMdtHit.Z;
489  double R = itMdtHit.R;
490  double nbw = aw*Z + bw;
491  if (R>(nbw-nrWidth) && R<(nbw+nrWidth)){
492  itMdtHit.isOutlier = 0;
493  sumN++;
494  } else {
495  itMdtHit.isOutlier = 2;
496  continue;
497  }
498  }
499  if(sumN==0) continue;
500 
501  stationSPFit(mdtSegment, superPoint,pbFitResult, trackPattern.s_address,chamber,aw, trackPattern.phiMSDir);
502 
503  } // end loop for stations
504 
505  return StatusCode::SUCCESS;
506 }
507 // --------------------------------------------------------------------------------
508 // --------------------------------------------------------------------------------
510  TrigL2MuonSA::SuperPoint* superPoint,
511  TrigL2MuonSA::PBFitResult& pbFitResult,int s_address, int i_station,double aw, float phiDir) const{
512 
514 
515  unsigned int i_layer_max = 0;
516  int count;
517  //int FitFlag;
518  float Xor, Yor, sigma, rm=0., phim=0;
519  float Ymid, Xmid, Amid;
520 
521  const unsigned int MAX_STATION = 8;
522  const float SIGMA = 0.0080;
523  const float DRIFTSPACE_LIMIT = 16.;
524  const int MIN_MDT_FOR_FIT = 3;
525 
526  const unsigned int MAX_LAYER = 12;
527  //const unsigned int MAX_CAND = 6;
528  unsigned int MdtLayerHits[MAX_STATION][MAX_LAYER];
529  std:: vector<unsigned int> MdtLayerHits_index[MAX_STATION][MAX_LAYER];
530 
531  for (unsigned int i_st=0; i_st<MAX_STATION; i_st++) {
532  for (unsigned int i_ly=0; i_ly<MAX_LAYER; i_ly++) {
533  MdtLayerHits[i_st][i_ly] = 0;
534  MdtLayerHits_index[i_st][i_ly].clear();
535  }
536  }
537 
538  float Chbest = 1.e25;
539  double avZ[8];
540  double avR[8];
541  double sumZ[8];
542  double sumR[8];
543  unsigned int sumN[8];
544  double nsWidth=0.;
545 
546  for (unsigned int i_st=0; i_st<8; i_st++) {
547  avZ[i_st] = 0.;
548  avR[i_st] = 0.;
549  sumZ[i_st] = 0.;
550  sumR[i_st] = 0.;
551  sumN[i_st] = 0.;
552  }
553 
554  for (unsigned int i_hit=0; i_hit<mdtSegment->size(); i_hit++){
555  //unsigned int i_station =mdtSegment->at(i_hit).Chamber;
556 
557  if (mdtSegment->at(i_hit).isOutlier>1) continue;
558 
559  double Z = mdtSegment->at(i_hit).Z;
560  double R = mdtSegment->at(i_hit).R;
561 
562  sumZ[i_station] = sumZ[i_station] + Z;
563  sumR[i_station] = sumR[i_station] + R;
564  sumN[i_station]++;
565 
566  if (sumN[i_station]!=0) {
567  avZ[i_station] = sumZ[i_station]/sumN[i_station];
568  avR[i_station] = sumR[i_station]/sumN[i_station];
569  }
570  }
571 
572  if (sumN[i_station]==0) return;
573 
574  for (unsigned int i_hit=0; i_hit<mdtSegment->size(); i_hit++) {
575 
576  if (mdtSegment->at(i_hit).isOutlier>1) continue;
577 
578  double Z = mdtSegment->at(i_hit).Z;
579  double R = mdtSegment->at(i_hit).R;
580 
581  if (i_station==3) nsWidth = m_rwidth_Endcapinn_second;
582  if (i_station==4) nsWidth = m_rwidth_Endcapmid_second;
583  if (i_station==5) nsWidth = m_rwidth_Endcapout_second;
584 
585  double nbw = aw*Z+(avR[i_station]-aw*avZ[i_station]);
586 
587  if ( R>(nbw-nsWidth) && R<(nbw+nsWidth) ) {
588  mdtSegment->at(i_hit).isOutlier = 0;
589  } else {
590  mdtSegment->at(i_hit).isOutlier = 2;
591  continue;
592  }
593  }
594 
595  for (unsigned int i_hit=0; i_hit<mdtSegment->size(); i_hit++) {
596 
597  unsigned int i_layer =mdtSegment->at(i_hit).Layer;
598  if (mdtSegment->at(i_hit).isOutlier>1) continue;
599  if (i_layer > i_layer_max) i_layer_max = i_layer;
600 
601  MdtLayerHits[i_station][i_layer]++;
602  MdtLayerHits_index[i_station][i_layer].push_back(i_hit);
603  }
604 
605  std::vector<unsigned int> Ly_1st;
606  Ly_1st.clear();
607  std::vector<float> Line_A;
608  std::vector<float> Line_B;
609  std::vector<float> Line_Chi2;
610  std::vector<unsigned int> Line_count;
611  std::vector<float> Line_Xor;
612  std::vector<float>Line_Yor ;
613  std::vector<float>Line_Amid;
614  std::vector<float>Line_Xmid;
615  std::vector<float>Line_Ymid;
616  std::vector<float> Line_sum_Z;
617  std::vector<float> Line_sum_R;
618  std::vector<float> Line_rm;
619  std::vector<float> Line_phim;
620  std::vector<float> Maxlayers_A;
621  std::vector<float> Maxlayers_B;
622  std::vector<float> Maxlayers_Chi2;
623  std::vector<float> Maxlayers_RESI;
624  float Maxlayers_Phim = 0;
625  float Maxlayers_R = 0;
626  float Maxlayers_Z = 0;
627  float Maxlayers_Xor = 0;
628  float Maxlayers_Yor = 0;
629  float Maxlayers_PChi2 = 0;
630  int Maxlayers_N = 0;
631  Maxlayers_A.clear();
632  Maxlayers_B.clear();
633  Maxlayers_Chi2.clear();
634  Maxlayers_RESI.clear();
635 
636  for (unsigned int i_layer=0; i_layer<=i_layer_max; i_layer++) {
637 
638  if (MdtLayerHits[i_station][i_layer]==0) continue;
639 
640  Ly_1st.push_back(i_layer);
641  }
642 
643  const int real_layer= Ly_1st.size();
644  std::vector<std::vector<unsigned int> > Ly_flg;
645 
646  for (int pr=real_layer; pr>=3; pr--) {
647 
648  Ly_flg.clear();
649  Line_A.clear();
650  Line_B.clear();
651  Line_Chi2.clear();
652  Line_count.clear();
653  Line_Xor.clear();
654  Line_Yor .clear();
655  Line_Amid.clear();
656  Line_Xmid.clear();
657  Line_Ymid.clear();
658  Line_sum_Z.clear();
659  Line_sum_R.clear();
660  Line_rm.clear();
661  Line_phim.clear();
662 
663  int total_cp = 0;
664  findLayerCombination(Ly_1st, real_layer, pr,Ly_flg, total_cp);
665 
666  for (unsigned int i=0;i<Ly_flg.size(); i++) {
667 
668  std::vector<std::vector<int> >tID;
669  tID.clear();
670  std::vector<std::vector<int> >tIndex;
671  tIndex.clear();
672 
673  int tube_ID[NMEAMX][2];
674  int tubeindex[NMEAMX][2];
675 
676  for (int ti=0; ti<8; ti++) {
677  for (int tj=0; tj<2; tj++) {
678  tube_ID[ti][tj] = 0;
679  tubeindex[ti][tj] = 0;
680  }
681  }
682 
683  for (unsigned int j=0; j<Ly_flg[i].size(); j++) {
684 
685  int i_layer = Ly_flg[i][j];
686  std::vector<int> tid;
687  tid.clear();
688  std::vector<int> tindex;
689  tindex.clear();
690  if (MdtLayerHits[i_station][i_layer]==0) continue;
691 
692  float tube_1st = 999999.;
693  float tube_2nd = 999999.;
694  int layer_1st= 9999;
695  int layer_2nd = 9999;
696 
697  for (unsigned int i_hit=0; i_hit< MdtLayerHits[i_station][i_layer]; i_hit++) {
698 
699  unsigned int i_index = MdtLayerHits_index[i_station][i_layer].at(i_hit);
700 
701  if (mdtSegment->at(i_index).isOutlier>1) continue;
702 
703  float nbw3 = (mdtSegment->at(i_index).Z)*(aw) + (avR[i_station]-(aw)*avZ[i_station]) ;
704  float dis_tube = std::abs(std::abs(nbw3-mdtSegment->at(i_index).R)- mdtSegment->at(i_index).DriftSpace);
705 
706  if (dis_tube<tube_1st) {
707  tube_2nd = tube_1st;
708  layer_2nd = layer_1st;
709  tube_1st = dis_tube;
710  layer_1st = i_index;
711  } else if (dis_tube<tube_2nd) {
712  tube_2nd = dis_tube;
713  layer_2nd = i_index;
714  }
715  }
716 
717  if ( layer_1st != 9999 ) {
718  mdtSegment->at(layer_1st).isOutlier = 0;
719  tid.push_back(1);
720  tindex.push_back(layer_1st);
721  }
722 
723  if ( layer_2nd != 9999 ) {
724  mdtSegment->at(layer_2nd).isOutlier = 1;
725  tid.push_back(1);
726  tindex.push_back(layer_2nd);
727  }
728 
729  tID.push_back(tid);
730  tIndex.push_back(tindex);
731  }
732 
733  for (unsigned int ti=0; ti<tID.size();ti++) {
734  for (unsigned int tj=0; tj<tID[ti].size();tj++) {
735  tube_ID[ti][tj] = tID[ti][tj];
736  tubeindex[ti][tj] = tIndex[ti][tj];
737  }
738  }
739 
740  std::vector<int> isg;
741  std::vector<int> hitarray;
742  int sumid;
743  int ntry = (int)floor(pow(2.,pr))-1;
744 
745  for (int ntryi=0; ntryi<=ntry; ntryi++) {
746 
747  isg.clear();
748  hitarray.clear();
749  sumid = 1;
750 
751  for (int ntryj=1; ntryj<=pr; ntryj++) {
752  int yhit = 0;
753  int Isg = (ntryi&(int)pow(2.,ntryj-1))? 1 : 0;
754  isg.push_back(Isg);
755  if (tube_ID[ntryj-1][Isg] != 0) yhit = 1;
756  sumid = sumid * yhit;
757  }
758 
759  if (sumid==1) {
760  for (unsigned int tt=0;tt<isg.size(); tt++) {
761  int tindex = tubeindex[tt][isg[tt]];
762  hitarray.push_back(tindex);
763  }
764  }
765 
766  count = 0;
767  Xor = 0.;
768  Yor = 0.;
769  Amid = 0.;
770  Xmid = 0.;
771  Ymid = 0.;
772 
773  float sum_Z_used = 0.;
774  float sum_R_used = 0.;
775 
776  if (hitarray.size()==0) continue;
777 
778  for (itMdtHit=mdtSegment->begin(); itMdtHit!=mdtSegment->end(); ++itMdtHit) { // loop for MDT hit
779 
780  int hit_index = std::distance(mdtSegment->begin(),itMdtHit);
781 
782  if(mdtSegment->at(hit_index).isOutlier>1) continue;
783 
784  if (count >= NMEAMX) continue;
785 
786  int fd=0;
787 
788  for (unsigned int j=0; j<hitarray.size(); j++) {
789 
790  if (hitarray[j]==hit_index) {
791  fd=1;
792  break;
793  }
794  }
795 
796  if (fd==0) continue;
797 
798  superPoint->Ndigi++;
799 
800  if (!count) {
801  rm = itMdtHit->cYmid;
802  Amid = itMdtHit->cAmid;
803  Xmid = itMdtHit->cXmid;
804  Ymid = itMdtHit->cYmid;
805  }
806 
807  if (!Xor) {
808  Xor = itMdtHit->R;
809  Yor = itMdtHit->Z;
810  }
811 
812  phim = itMdtHit->cPhip;
813  sigma = (std::abs(itMdtHit->DriftSigma) > ZERO_LIMIT)? itMdtHit->DriftSigma: SIGMA;
814 
815  if ( std::abs(itMdtHit->DriftSpace) > ZERO_LIMIT &&
816  std::abs(itMdtHit->DriftSpace) < DRIFTSPACE_LIMIT &&
817  std::abs(itMdtHit->DriftTime) > ZERO_LIMIT ) {
818 
819  pbFitResult.XILIN[count] = itMdtHit->R - Xor;
820  pbFitResult.YILIN[count] = itMdtHit->Z - Yor;
821  pbFitResult.IGLIN[count] = 2;
822  pbFitResult.RILIN[count] = (std::abs(itMdtHit->DriftSpace) > ZERO_LIMIT)?
823  itMdtHit->DriftSpace: SetDriftSpace(itMdtHit->DriftTime, itMdtHit->R, itMdtHit->Z, phim, phiDir);//itMdtHit->DriftSpace ;//
824  pbFitResult.WILIN[count] = 1/(sigma*sigma);
825  pbFitResult.JLINE[count] = count;
826 
827  int i_st = 0;
828  if (i_station==3) i_st = 0;
829  if (i_station==4) i_st = 1;
830  if (i_station==5) i_st = 2;
831  pbFitResult.IDMEA[count] = i_st*10 + itMdtHit->Layer;
832  pbFitResult.DISTJ[count] = 0.;
833  pbFitResult.RESI[count] = 0.;
834 
835  count++;
836  pbFitResult.NPOI = count;
837 
838  sum_Z_used = sum_Z_used + itMdtHit->Z;
839  sum_R_used = sum_R_used + itMdtHit->R;
840  } else {
841  superPoint->Ndigi--;
842  }
843  } // end loop for MDT hits
844 
845  ATH_MSG_DEBUG("... MDT hit used in fit #=" << pbFitResult.NPOI);
846  for (int i=0;i<pbFitResult.NPOI;i++) {
847  ATH_MSG_DEBUG("i/XILIN[i]/YILIN[i]/RILIN[i]/WILIN[i] = "
848  << i << "/" << pbFitResult.XILIN[i] << "/" << pbFitResult.YILIN[i]
849  << "/" << pbFitResult.RILIN[i] << "/" << pbFitResult.WILIN[i]);
850  }
851 
852  if (count >= MIN_MDT_FOR_FIT) {
853  Circles(pbFitResult.NPOI,pbFitResult.XILIN,pbFitResult.YILIN,pbFitResult.RILIN,pbFitResult.WILIN,
854  pbFitResult.IGLIN,&pbFitResult.ALIN,&pbFitResult.BLIN,pbFitResult.DABLIN,&pbFitResult.CHI2,
855  &pbFitResult.PCHI2, pbFitResult.SlopeCand, pbFitResult.InterceptCand, pbFitResult.Chi2Cand);
856 
857  //FitFlag = Evlfit(1, pbFitResult);
858 
859  for (int cand=0; cand<6; cand++) {
860 
861  if (std::abs(pbFitResult.SlopeCand[cand]) > ZERO_LIMIT) {
862  Line_A.push_back(1/pbFitResult.SlopeCand[cand]);
863  Line_B.push_back(-pbFitResult.InterceptCand[cand]/pbFitResult.SlopeCand[cand]-Yor/pbFitResult.SlopeCand[cand]+Xor);
864  Line_Chi2.push_back(pbFitResult.Chi2Cand[cand]);
865  Line_count.push_back(pbFitResult.NPOI);
866  Line_Xor.push_back(Xor);
867  Line_Yor .push_back(Yor);
868  Line_Amid.push_back(Amid);
869  Line_Xmid.push_back(Xmid);
870  Line_Ymid.push_back(Ymid);
871  Line_sum_Z.push_back(sum_Z_used/count);
872  Line_sum_R.push_back(sum_R_used/count);
873  Line_rm.push_back(rm);
874  Line_phim.push_back(phim);
875  }
876  }
877  }
878  }
879  }//end one of cp
880 
881  if (Line_Chi2.size()==0) continue;
882 
883  std::multimap<float, int>chi_map;
884  chi_map.clear();
885  std::vector<float> t_A;
886  std::vector<float> t_B;
887  std::vector<float> t_Chi2;
888  std::vector<float> t_count;
889  std::vector<float> t_Xor;
890  std::vector<float> t_Yor;
891  std::vector<float> t_Amid;
892  std::vector<float> t_Xmid;
893  std::vector<float> t_Ymid;
894  std::vector<float> t_sum_Z;
895  std::vector<float> t_sum_R;
896  std::vector<float> t_rm;
897  std::vector<float> t_phim;
898 
899  t_A.clear();
900  t_B.clear();
901  t_Chi2.clear();
902  t_count.clear();
903  t_Xor.clear();
904  t_Yor.clear();
905  t_Amid.clear();
906  t_Xmid.clear();
907  t_Ymid.clear();
908  t_sum_Z.clear();
909  t_sum_R.clear();
910  t_rm.clear();
911  t_phim.clear();
912 
913  for (unsigned int ir=0; ir<Line_Chi2.size(); ir++) chi_map.insert(std::make_pair(Line_Chi2.at(ir), ir));
914 
915  for (std::multimap<float, int>::iterator jt = chi_map.begin(); jt != chi_map.end(); ++jt) {
916  t_A.push_back(Line_A.at(jt->second));
917  t_B.push_back(Line_B.at(jt->second));
918  t_Chi2.push_back(Line_Chi2.at(jt->second));
919  t_count.push_back(Line_count.at(jt->second));
920  t_Xor.push_back(Line_Xor.at(jt->second));
921  t_Yor.push_back(Line_Yor.at(jt->second));
922  t_Amid.push_back(Line_Amid.at(jt->second));
923  t_Xmid.push_back(Line_Xmid.at(jt->second));
924  t_Ymid.push_back(Line_Ymid.at(jt->second));
925  t_sum_Z.push_back(Line_sum_Z.at(jt->second));
926  t_sum_R.push_back(Line_sum_R.at(jt->second));
927  t_rm.push_back(Line_rm.at(jt->second));
928  t_phim.push_back(Line_phim.at(jt->second));
929  if(pr==real_layer){//save max layers information
930  Maxlayers_A.push_back(Line_A.at(jt->second));
931  Maxlayers_B.push_back(Line_B.at(jt->second));
932  Maxlayers_Chi2.push_back(Line_Chi2.at(jt->second));
933  }
934  }
935 
936  superPoint->Npoint = t_count[0];//pbFitResult.NPOI;
937  if(i_station==4 && pr==real_layer){
938  Maxlayers_Z = t_sum_Z[0];
939  Maxlayers_R = t_A[0]*t_sum_Z[0]+t_B[0];
940  Maxlayers_Phim = t_phim[0];
941  Maxlayers_Xor = t_Xor[0];
942  Maxlayers_Yor = t_Yor[0];
943  Maxlayers_PChi2 = pbFitResult.PCHI2;
944  Maxlayers_N = t_count[0];
945  }
946 
947  if (s_address == -1) { // Endcap
948 
949  if (std::abs(t_A[0]) > ZERO_LIMIT ) {
950  superPoint->Z = t_sum_Z[0];
951  superPoint->R = t_A[0]*t_sum_Z[0]+t_B[0];
952  superPoint->Alin =t_A[0];
953  superPoint->Blin =t_B[0];
954  }
955 
956  superPoint->Phim = t_phim[0];
957  superPoint->Xor = t_Xor[0];
958  superPoint->Yor = t_Yor[0];
959  superPoint->Chi2 = t_Chi2[0];
960  superPoint->PChi2 = pbFitResult.PCHI2;
961 
962  for (int i=0;i<pbFitResult.NPOI;i++) superPoint->Residual[i] = pbFitResult.RESI[i];
963 
964  for (int cand=0; cand<6; cand++) {
965  if (std::abs(t_A[cand]) > ZERO_LIMIT ) {
966  superPoint->SlopeCand[cand] = t_A[cand];
967  superPoint->InterceptCand[cand] = t_B[cand];
968  superPoint->Chi2Cand[cand] = t_Chi2[cand];
969  }
970  }
971  }
972 
973  Chbest=t_Chi2[0];
974 
975  if (real_layer>3) {
976  if ((i_station == 3 || i_station == 5) && pr==4 && Chbest > m_endcapmid_mdt_chi2_limit) {
977 
978  superPoint->Z =0.;
979  superPoint->R =0.;
980  superPoint->Alin=0.;
981  superPoint->Blin=0.;
982 
983  for (int cand=0; cand<6; cand++) {
984  superPoint->SlopeCand[cand] = 0.;
985  superPoint->InterceptCand[cand] = 0.;
986  superPoint->Chi2Cand[cand] = 0.;
987  }
988  return;
989  }
990  }
991  if (Chbest<m_endcapmid_mdt_chi2_limit){
992 
993  ATH_MSG_DEBUG("... Superpoint chamber/s_address/count/R/Z/Alin/Blin/Phim/Xor/Yor/Chi2/PChi2="
994  << i_station << "/" << s_address << "/" << count << "/"
995  << superPoint->R << "/" << superPoint->Z << "/" << superPoint->Alin << "/"
996  << superPoint->Blin << "/" << superPoint->Phim << "/" << superPoint->Xor << "/"
997  << superPoint->Yor << "/" << superPoint->Chi2 << "/" << superPoint->PChi2);
998 
999  break;//jump out all cp
1000  }else{
1001  if(i_station==4 && Maxlayers_A.size()>0){
1002  superPoint->Npoint = Maxlayers_N;
1003  superPoint->Z = Maxlayers_Z;
1004  superPoint->R = Maxlayers_R;
1005  superPoint->Alin =Maxlayers_A[0];
1006  superPoint->Blin =Maxlayers_B[0];
1007  superPoint->Phim = Maxlayers_Phim;
1008  superPoint->Xor = Maxlayers_Xor;
1009  superPoint->Yor = Maxlayers_Yor;
1010  superPoint->Chi2 = Maxlayers_Chi2[0];
1011  superPoint->PChi2 = Maxlayers_PChi2;
1012  for (int cand=0; cand<6; cand++) {
1013  if (std::abs(Maxlayers_A[cand]) > ZERO_LIMIT ) {
1014  superPoint->SlopeCand[cand] = Maxlayers_A[cand];
1015  superPoint->InterceptCand[cand] = Maxlayers_B[cand];
1016  superPoint->Chi2Cand[cand] = Maxlayers_Chi2[cand];
1017  }
1018  }
1019  }
1020  }
1021  }//end all cp
1022 
1023  return;
1024 }
1025 
1026 // --------------------------------------------------------------------------------
1027 //-----------------------------------------------------------------------------------
1029  const TrigL2MuonSA::MuonRoad& muonRoad) const{
1030 
1031  TrigL2MuonSA::SuperPoint* superPoint;
1032  const unsigned int MAX_STATION = 8;
1033  float aw[8];
1034  //float bw[8];
1035  float spZ[8];
1036  float spR[8];
1037  float A_cand[8][6];
1038  float B_cand[8][6];
1039  float Chi2_cand[8][6];
1040  float spA[8];
1041  float spB[8];
1042  float spChi2[8];
1043  const int middle = 4;
1044  const int outer = 5;
1045 
1046  for (unsigned int i_station=4; i_station<MAX_STATION; i_station++) {
1047 
1048  aw[i_station]=0.;
1049  //bw[i_station]=0.;
1050  spZ[i_station]=0.;
1051  spR[i_station]=0.;
1052  spA[i_station]=0.;
1053  spB[i_station]=0.;
1054  spChi2[i_station]=0.;
1055 
1056  for (unsigned int ci=0; ci<NCAND; ci++) {
1057  A_cand[i_station][ci] =0.;
1058  B_cand[i_station][ci] =0.;
1059  Chi2_cand[i_station][ci] =0.;
1060  }
1061 
1062  if (i_station<4 || i_station>5) continue; // only loop for endcap Inner/Middle/Outer
1063 
1064  superPoint = &(trackPattern.superPoints[i_station]);
1065  aw[i_station] = muonRoad.aw[i_station][0];
1066  //bw[i_station] = muonRoad.bw[i_station][0];
1067  spZ[i_station] = superPoint->Z;
1068  spR[i_station] = superPoint->R;
1069  spA[i_station] = superPoint->Alin;
1070  spB[i_station] = superPoint->Blin;
1071 
1072  for (unsigned int cand=0; cand<NCAND; cand++) {
1073  A_cand[i_station][cand] = superPoint->SlopeCand[cand];
1074  B_cand[i_station][cand] = superPoint->InterceptCand[cand];
1075  Chi2_cand[i_station][cand] = superPoint->Chi2Cand[cand];
1076  }
1077  }
1078 
1079  //A[station][candidate]
1080  float test_diff = 1.e25;
1081  float best_diff = 1.e25;
1082  float rmatched = 0.;
1083  float match_midA = 0.;
1084  float match_outA = 0.;
1085 
1086  if (std::abs(A_cand[middle][0]) < ZERO_LIMIT && std::abs(A_cand[middle][1]) < ZERO_LIMIT) {
1087  spZ[middle] = 0.;
1088  spR[middle] = 0.;
1089  spChi2[middle] = 0.;
1090  }
1091 
1092  if (std::abs(A_cand[outer][0]) < ZERO_LIMIT && std::abs(A_cand[outer][1]) < ZERO_LIMIT) {
1093  spZ[outer] = 0.;
1094  spR[outer] = 0.;
1095  spChi2[outer] = 0.;
1096  }
1097 
1098  if (std::abs(A_cand[middle][0]) > ZERO_LIMIT && std::abs(A_cand[outer][0]) < ZERO_LIMIT) {
1099 
1100  best_diff = 1.e25;
1101  test_diff = 1.e25;
1102 
1103  for (int m=0; m<6; m++) {
1104 
1105  test_diff = std::abs(A_cand[middle][m] - aw[middle]);
1106 
1107  if (test_diff<best_diff) {
1108  best_diff = test_diff;
1109  rmatched = A_cand[middle][m];
1110  spB[middle] = B_cand[middle][m];
1111  spChi2[middle] = Chi2_cand[middle][m];
1112  spR[middle] = rmatched * spZ[middle] + spB[middle];
1113 
1114  }
1115  }
1116  }
1117 
1118  if(std::abs(A_cand[outer][1]) > ZERO_LIMIT && std::abs(A_cand[outer][0]) > ZERO_LIMIT && std::abs(spA[outer]) > ZERO_LIMIT && std::abs(spZ[outer]) > ZERO_LIMIT && std::abs(spR[outer]) > ZERO_LIMIT &&
1119  std::abs(A_cand[middle][1]) > ZERO_LIMIT && std::abs(A_cand[middle][0]) > ZERO_LIMIT && std::abs(spA[middle]) > ZERO_LIMIT && std::abs(spZ[middle]) > ZERO_LIMIT && std::abs(spR[middle]) > ZERO_LIMIT){
1120 
1121  float sp_line = 0.;
1122  if(std::abs(spZ[outer]-spZ[middle]) > ZERO_LIMIT) sp_line = (spR[outer]-spR[middle])/(spZ[outer]-spZ[middle]);
1123 
1124  for (int t=0; t<2; ++t) {
1125  best_diff = 1.e25;
1126  test_diff = 1.e25;
1127  if (std::abs(sp_line)> ZERO_LIMIT) {
1128  for (int i=0; i<6; ++i) {
1129  if (t==0) test_diff = std::abs(A_cand[middle][i] - sp_line);
1130  else if (t==1) test_diff = std::abs(A_cand[outer][i] - sp_line);
1131  if (test_diff<best_diff) {
1132  best_diff = test_diff;
1133  if (t==0) {
1134  match_midA = A_cand[middle][i];
1135  spB[middle] = B_cand[middle][i];
1136  spChi2[middle] = Chi2_cand[middle][i];
1137  spR[middle] = match_midA * spZ[middle] + spB[middle];
1138  } else if(t==1) {
1139  match_outA = A_cand[outer][i];
1140  spB[outer] = B_cand[outer][i];
1141  spChi2[outer] = Chi2_cand[outer][i];
1142  spR[outer] = match_outA * spZ[outer] + spB[outer];
1143  }
1144  }
1145  }
1146  }
1147  }
1148  }
1149 
1150  if (std::abs(spA[middle]) > ZERO_LIMIT) {
1151  if (std::abs(match_midA) > ZERO_LIMIT) {
1152  spA[middle] = match_midA;
1153  } else if (std::abs(rmatched) > ZERO_LIMIT) {
1154  spA[middle] = rmatched;
1155  }
1156 
1157  if (std::abs(match_outA) > ZERO_LIMIT) spA[outer] = match_outA;
1158 
1159  }
1160 
1161  for (unsigned int i_station=4; i_station<MAX_STATION; i_station++) {
1162  if (i_station<4 || i_station>5) continue; // only loop for endcap Inner/Middle/Outer
1163  superPoint = &(trackPattern.superPoints[i_station]);
1164  if(std::abs(spA[i_station]) > ZERO_LIMIT){
1165  superPoint->Alin =spA[i_station];
1166  superPoint->Blin =spB[i_station];
1167  superPoint->Chi2 =spChi2[i_station];
1168  }
1169  }
1170  return;
1171 }
1172 
1173 //--------------------------------------------------------------------------------------
1174 
1176  TrigL2MuonSA::TrackPattern& trackPattern) const
1177 {
1178 
1179  TrigL2MuonSA::SuperPoint* superPoint;
1180  float MiddleSlope = 0;//float MiddleIntercept = 0;
1181  float OuterSlope = 0;//float OuterIntercept = 0;
1182  //float MiddleR = 0; float MiddleZ = 0;
1183  //float OuterR = 0;float OuterZ = 0;
1184 
1185  for (int i_station=4; i_station<6; i_station++) {
1186 
1187  int chamberID = -1;
1188 
1189  if ( i_station == 4 ) chamberID = xAOD::L2MuonParameters::Chamber::EndcapMiddle;
1190  if ( i_station == 5 ) chamberID = xAOD::L2MuonParameters::Chamber::EndcapOuter;
1191 
1192  superPoint = &(trackPattern.superPoints[chamberID]);
1193 
1194  if ( superPoint->Npoint > 2 && superPoint->R > 0.) {
1195  if ( i_station==4 ) {
1196  MiddleSlope = superPoint->Alin;
1197  //MiddleIntercept = superPoint->R - MiddleSlope*superPoint->Z;
1198  //MiddleR = superPoint->R;
1199  //MiddleZ = superPoint->Z;
1200  } if ( i_station==5 ) {
1201  OuterSlope = superPoint->Alin;
1202  //OuterIntercept = superPoint->R - OuterSlope*superPoint->Z;
1203  //OuterR = superPoint->R;
1204  //OuterZ = superPoint->Z;
1205  }
1206  }
1207  }
1208 
1209  double mdtpT = std::abs(tgcFitResult.tgcPT);
1210  double alpha_pt = std::abs(trackPattern.ptEndcapAlpha);
1211 
1212  if (std::abs(MiddleSlope) > ZERO_LIMIT && std::abs(OuterSlope) > ZERO_LIMIT) {
1213  mdtpT = alpha_pt;
1214  } else if (std::abs(tgcFitResult.tgcPT)>=8.0 && std::abs(MiddleSlope) > ZERO_LIMIT) {
1215  mdtpT = alpha_pt;
1216  }
1217 
1218  mdtpT = (std::abs(tgcFitResult.tgcPT)>1e-5)? mdtpT*(tgcFitResult.tgcPT/std::abs(tgcFitResult.tgcPT)) : 0;
1219  double etaMiddle = (tgcFitResult.tgcMid1[3])? tgcFitResult.tgcMid1[0] : tgcFitResult.tgcMid2[0];
1220  double phiMiddle = (tgcFitResult.tgcMid1[3])? tgcFitResult.tgcMid1[1] : tgcFitResult.tgcMid2[1];
1221  double eta;
1222  double sigma_eta;
1223  double extrInnerEta = 0;
1224  double naw = 0;
1226  muonSA->makePrivateStore();
1227  muonSA->setSAddress(-1);
1228  muonSA->setPt(mdtpT);
1229  muonSA->setEtaMS(etaMiddle);
1230  muonSA->setPhiMS(phiMiddle);
1231  muonSA->setRMS(0.);
1232  muonSA->setZMS(0.);
1233  double phi;
1234  double sigma_phi;
1235  double theta = 0.;
1236  StatusCode sc = m_backExtrapolator->give_eta_phi_at_vertex(muonSA, eta,sigma_eta,phi,sigma_phi,0.);
1237 
1238  if (sc.isSuccess() ){
1239  extrInnerEta = eta;
1240  } else {
1241  extrInnerEta = etaMiddle;
1242  }
1243 
1244  delete muonSA;
1245 
1246  if (std::abs(extrInnerEta) > ZERO_LIMIT) {
1247  theta = std::atan(std::exp(-std::abs(extrInnerEta)))*2.;
1248  naw = std::tan(theta)*(std::abs(extrInnerEta)/extrInnerEta);
1249  }
1250 
1251  return naw;
1252 
1253 }
1254 // --------------------------------------------------------------------------------
1255 //--------------------------------------------------------------------------------
1257  double &aw,
1258  double &tgc_aw,
1259  double &bw) const
1260 {
1261 
1262  double nrWidth = m_rwidth_Endcapinn_first;
1263  //double nsWidth = 80.;
1264  //double bw = 0.;
1265  unsigned int sumN[8];
1266 
1267  for (unsigned int i_st=0; i_st<8;i_st++) {
1268  sumN[i_st] = 0;
1269  }
1270 
1271  TrigL2MuonSA::MdtHits* mdtSegment;
1272  TrigL2MuonSA::SuperPoint* superPoint;
1273  TrigL2MuonSA::PBFitResult pbFitResult;
1274  const int i_station = 3;//endcap inner
1275  int chamberID = i_station;
1276 
1277  mdtSegment = &(trackPattern.mdtSegments[chamberID]);
1278  superPoint = &(trackPattern.superPoints[chamberID]);
1279 
1280  if (mdtSegment->size()==0) return;
1281 
1282  for (TrigL2MuonSA::MdtHitData& itMdtHit : *mdtSegment) { // loop for MDT hit
1283  if (std::abs(itMdtHit.DriftSpace) < m_mdt_driftspace_downlimit ||
1284  std::abs(itMdtHit.DriftSpace) > m_mdt_driftspace_uplimit){
1285  itMdtHit.isOutlier = 2;
1286  continue;
1287  }
1288 
1289  if (itMdtHit.isOutlier > 1) continue;
1290 
1291  double Z = itMdtHit.Z;
1292  double R = itMdtHit.R;
1293  double nbw = tgc_aw*Z + bw;
1294 
1295  if (R>(nbw-nrWidth) && R<(nbw+nrWidth)) {
1296  itMdtHit.isOutlier = 0;
1297  sumN[i_station]++;
1298  } else {
1299  itMdtHit.isOutlier = 2;
1300  continue;
1301  }
1302  }
1303 
1304  if (sumN[i_station]==0) return;
1305 
1306  stationSPFit(mdtSegment, superPoint,pbFitResult, trackPattern.s_address,i_station, aw, trackPattern.phiMSDir);
1307 
1308  float df=1.e25;
1309 
1310  for (int cand=0; cand<NCAND; cand++) {
1311  float ds=std::abs(superPoint->SlopeCand[cand]-aw);
1312  if (ds<df) {
1313  df=ds;
1314  superPoint->Alin = superPoint->SlopeCand[cand];
1315  superPoint->Blin = superPoint->InterceptCand[cand];
1316  superPoint->Chi2 = superPoint->Chi2Cand[cand];
1317  }
1318  }
1319 
1320  return;
1321 }
1322 
1323 // --------------------------------------------------------------------------------
1324 // --------------------------------------------------------------------------------
1325 
1327  int n,
1328  int r,
1329  std::vector<std::vector<unsigned int> > &c,
1330  int &nr) const
1331 {
1332  std::vector<unsigned int> b(r,0);
1333 
1334  findSubLayerCombination(a,n,r,b,0,r,c,nr);
1335 
1336  return;
1337 }
1338 
1339 // --------------------------------------------------------------------------------
1340 // --------------------------------------------------------------------------------
1341 
1343  int n,
1344  int r,
1345  std::vector<unsigned int> &b,
1346  int index,
1347  int num,
1348  std::vector<std::vector<unsigned int> > &c,
1349  int &nr) const
1350 {
1351  for (int i=index; i<n-num+1; i++) {
1352 
1353  b[r-num] = a[i];
1354  std::vector<unsigned int> t;
1355  t.clear();
1356 
1357  if (num==1) {
1358 
1359  for (int j = 0;j<r; j++) t.push_back(b[j]);
1360 
1361  c.push_back(t);
1362  nr++;
1363 
1364  } else {
1365 
1366  findSubLayerCombination(a,n,r,b,i+1,num-1,c,nr);
1367  }
1368  }
1369 
1370  return;
1371 }
1372 //-------------------------------------------------------------------------------
1373 
1374 // --------------------------------------------------------------------------------
1375 
1376 float TrigL2MuonSA::MuFastStationFitter::SetDriftSpace(float tdr, float rad, float zeta, float phim, float phiDir) const
1377 {
1378 
1379  const float CSPEED = 2.99979e+10; // light speed (cm/s)
1380  const float MDT_RED = 0.7;
1381  const float DRIFTVE = 0.00209; // 1.46/700 drif velocity (cm/ns)
1382 
1383  float flyspa,sy,x,y,phip,phis,prt,tof;
1384 
1385  sy = 1.;
1386 
1387  if(phim>=M_PI) {phim = phim - 2*M_PI; sy = -1.;}
1388 
1389  y = sy*std::abs(phiDir*rad*std::sqrt(1./(1.+phiDir*phiDir)));
1390  x = y/phiDir;
1391  phip = std::atan2(y,x);
1392  phis = std::tan(std::abs(phim-phip))*rad;
1393 
1394  if(phim>=phip) prt = - phis/(CSPEED*MDT_RED);
1395  else prt = + phis/(CSPEED*MDT_RED);
1396 
1397  flyspa = std::sqrt(rad*rad+zeta*zeta+phis*phis);
1398  tof = flyspa/CSPEED;
1399 
1400  return (tdr - tof*1.e+9 - prt*1.e+9)*DRIFTVE;
1401 }
1402 
1403 // --------------------------------------------------------------------------------
1404 // --------------------------------------------------------------------------------
1405 
1406 /*==============================================================================
1407 
1408  Call CIRCLES to fit a line, then rejects the worst point(s)
1409 
1410  IFIT = 0 ok, = 1 failure
1411  IFLA = 0 normal, = 1 do not try to exclude points
1412 
1413 ==============================================================================*/
1414 
1416 {
1417 
1418  int i,j,k,Ifit,Ntry,IGcur,Jbad;
1419  float Xnor,rlin,Xbad,test;
1420 
1421  pbFitResult.NDOF = -2;
1422  Ntry = 0;
1423  Ifit = 0;
1424 
1425  for(j=0;j<pbFitResult.NPOI;j++) if(pbFitResult.IGLIN[j]>=1) pbFitResult.NDOF++;
1426 
1427  while(pbFitResult.NDOF>=1) {
1428 
1429  // printf("pbFitResult.NDOF = %2d\n",pbFitResult.NDOF);
1430  Ntry++;
1431  Circles(pbFitResult.NPOI,pbFitResult.XILIN,pbFitResult.YILIN,pbFitResult.RILIN,pbFitResult.WILIN,
1432  pbFitResult.IGLIN,&pbFitResult.ALIN,&pbFitResult.BLIN,pbFitResult.DABLIN,&pbFitResult.CHI2,
1433  &pbFitResult.PCHI2);
1434 
1435  if(pbFitResult.CHI2<=ZERO_LIMIT) break;
1436 
1437  Xnor = 1. / std::sqrt(1. + pbFitResult.ALIN * pbFitResult.ALIN);
1438 
1439  for(i=0;i<pbFitResult.NPOI;i++) pbFitResult.RESI[i] = 0.;
1440 
1441  for(j=0;j<pbFitResult.NPOI;j++) {
1442 
1443  pbFitResult.DISTJ[j] = (pbFitResult.ALIN * pbFitResult.XILIN[j] + pbFitResult.BLIN - pbFitResult.YILIN[j]) * Xnor;
1444  IGcur = std::abs(pbFitResult.IGLIN[j])%100;
1445 
1446  if (IGcur==1) {
1447  pbFitResult.RESI[j] = pbFitResult.DISTJ[j];
1448  } else if (IGcur==2) {
1449  rlin = (pbFitResult.DISTJ[j]>=0.) ? pbFitResult.RILIN[j] : -pbFitResult.RILIN[j];
1450  pbFitResult.RESI[j] = pbFitResult.DISTJ[j] - rlin;
1451  } else if (IGcur==3) {
1452  pbFitResult.RESI[j] = pbFitResult.DISTJ[j] - pbFitResult.RILIN[j];
1453  }
1454  }
1455 
1456  if(pbFitResult.PCHI2>=0.01||Ifla==1) return Ifit;
1457 
1458  if (pbFitResult.NDOF<=1||Ntry>=6) {
1459 
1460  Ifit = 1;
1461  pbFitResult.NDOF = 0;
1462  pbFitResult.ALIN = 0.;
1463  pbFitResult.BLIN = 0.;
1464  pbFitResult.CHI2 = -1.;
1465  pbFitResult.PCHI2 = -.5;
1466 
1467  for (i=0;i<2;i++) {
1468  for(k=0;k<2;k++) {
1469  pbFitResult.DABLIN[i][k] = 0.;
1470  }
1471  }
1472 
1473  for(j=0;j<pbFitResult.NPOI;j++) pbFitResult.IGLIN[j] = - std::abs(pbFitResult.IGLIN[j])%100;
1474 
1475  return Ifit;
1476  }
1477 
1478  // Exclude the worst point
1479  Jbad = 0;
1480  Xbad = -1.;
1481  for (j=0;j<pbFitResult.NPOI;j++) {
1482  if (pbFitResult.IGLIN[j]>=1) {
1483  test = pbFitResult.RESI[j] * pbFitResult.RESI[j] * pbFitResult.WILIN[j];
1484  if (test>=Xbad) {
1485  Xbad = test;
1486  Jbad = j;
1487  }
1488  }
1489  }
1490 
1491  // Try again
1492 
1493  pbFitResult.IGLIN[Jbad] = - pbFitResult.IGLIN[Jbad] - 100;
1494  pbFitResult.NDOF = pbFitResult.NDOF - 1;
1495 
1496  }
1497 
1498  return Ifit;
1499 }
1500 
1501 // --------------------------------------------------------------------------------
1502 // --------------------------------------------------------------------------------
1503 
1504 /*==============================================================================
1505 
1506  Computes the best line tangent to many circles or points
1507 
1508  Version 1 - P.B. 960715 - First attempt
1509  Version 2 - P.B. 960910 - New algorithm for choice of the signs
1510 
1511  y = A x + b
1512 
1513  Input :
1514  =======
1515 
1516  NMEAS : number of meas
1517  IG(i) : for each meas, a flag.
1518 
1519  ---- if IG = 1 ---
1520  Xi, Yi : x, y of the points (i=1...NMEAS) (e.g. wire of a mwp)
1521  RRi : meaningless
1522 
1523  ---- if IG = 2 ---
1524  Xi, Yi : x, y of the centers (i=1...NMEAS) (i.e. wire of a mdt)
1525  RRi : distance line-center (i.e. measured drift distance)
1526 
1527  ---- if IG = 3 ---
1528  Xi, Yi : as above, for IG=2
1529  RRi : as above, but with +ve or -ve sign
1530 
1531  ---- if IG.le.0 ---> point NOT to be used
1532  Xi, Yi : meaningless
1533  RRi : meaningless
1534 
1535  Wi : weight for the i-th meas (= 1/sigma**2)
1536 
1537  Output :
1538  ========
1539 
1540  A,B,DAB : line coefficients (y = Ax + b) + error matrix (2x2)
1541  CHI2 : Chi square = Sum Wi * (RRi - dist) ** 2 (error if .lt.0)
1542  PCHI2 : P(chisquare,d.o.f.)
1543 
1544 ==============================================================================*/
1545 
1546 void TrigL2MuonSA::MuFastStationFitter::Circles (int Nmeas,float *XI,float *YI,float *RI,float *WI,int *IG,
1547  float *A,float *B,float DAB[2][2],float *Chi2,float *Pchi2) const
1548 {
1549 
1550  float RRi[NMEAMX],WIlim,CHbest,Abest,Bbest;
1551  float A0,B0,SAA,SBB,SAB,Square,Aj,Bj;
1552  int i,j,jj,Ntrue,Ngood,Nbest,Ntry,NOgo,Isig,Iflg,Ksign[4];
1553  int Ntrue2,Igg[NMEAMX];
1554 
1555 // Find the four "besrit" points (equispaced, wi.gt.1/2*wimax)
1556 
1557  *Chi2 = -1.;
1558  if (Nmeas<=2||Nmeas>=NMEAMX+1) return;
1559  Ntrue = 0;
1560  Ngood = 0;
1561  Nbest = 3;
1562  WIlim = 0.;
1563 
1564  Abest = 0.;
1565  Bbest = 0.;
1566 
1567  for(i=0;i<4;i++) Ksign[i] = -1;
1568 
1569  for (j=0;j<Nmeas;j++) {
1570  if (IG[j]>=1) {
1571  Ntrue++;
1572  WIlim = (WIlim>=WI[j])? WIlim : WI[j];
1573  }
1574  }
1575 
1576  if(Ntrue<=2) return;
1577 
1578  WIlim = 0.1 * WIlim;
1579 
1580  for(j=0;j<Nmeas;j++) if(IG[j]>=1&&WI[j]>=WIlim) Ngood++;
1581 
1582  for (j=0;j<Nmeas;j++) {
1583  if (IG[j]>=1&&(WI[j]>=WIlim||Ngood<=3)) {
1584  if (Ksign[0]==-1) {
1585  Ksign[0] = j;
1586  } else if (Ksign[1]==-1) {
1587  Ksign[1] = j;
1588  } else if(Ksign[2]==-1) {
1589  Ksign[2] = j;
1590  } else if(Ksign[3]==-1) {
1591  Ksign[3] = j;
1592  Nbest = 4;
1593  } else {
1594  Ksign[2] = Ksign[3];
1595  Ksign[3] = j;
1596  }
1597  }
1598  }
1599 
1600  // First attempt, try with a line through the centers
1601 
1602  Xline(XI,YI,WI,IG,Nmeas,&A0,&B0,&SAA,&SBB,&SAB,&Square);
1603 
1604  // Then try 16 times trough the best four points
1605 
1606  for (i=0;i<NMEAMX;i++) Igg[i] = -1;
1607 
1608  CHbest = 1.e25;
1609  Ntry = (int)floor(pow(2.,Nbest)) - 1; // 2**4 - 1 = 15
1610 
1611  for (j=0;j<=Ntry;j++) {
1612  NOgo = 0;
1613  for (jj=1;jj<=Nbest;jj++) {
1614  Isig = (j&(int)pow(2.,jj-1))? 1 : 0;
1615  // Isig = ibits(&j,&jj1,&one); // alternatively 0, 1
1616  Iflg = IG[Ksign[jj-1]];
1617  Igg[Ksign[jj-1]] = Iflg;
1618  RRi[Ksign[jj-1]] = RI[Ksign[jj-1]];
1619  if (Iflg==2) {
1620  Igg[Ksign[jj-1]] = 3;
1621  if (Isig==1) RRi[Ksign[jj-1]] = - RI[Ksign[jj-1]];
1622  } else if (Isig==1) {
1623  NOgo = 1;
1624  }
1625  }
1626 
1627  if (NOgo==0) {
1628  Aj = A0;
1629  Bj = B0;
1630  Circfit(Nmeas,XI,YI,RRi,WI,Igg,&Aj,&Bj,DAB,Chi2);
1631 
1632  if (*Chi2>=0.0&&*Chi2<=CHbest) {
1633  Abest = Aj;
1634  Bbest = Bj;
1635  CHbest = *Chi2;
1636  }
1637  }
1638  }
1639  // ... and finally with all the points
1640 
1641  *A = Abest;
1642  *B = Bbest;
1643  Circfit(Nmeas,XI,YI,RI,WI,IG,A,B,DAB,Chi2);
1644 
1645  if (*Chi2>=0.0) {
1646  Ntrue2 = Ntrue - 2;
1647  *Pchi2 = TMath::Prob(*Chi2, Ntrue2);
1648  }
1649 
1650  return;
1651 }
1652 
1653 // --------------------------------------------------------------------------------
1654 // --------------------------------------------------------------------------------
1655 
1656 /*==============================================================================
1657 
1658  Auxiliary to circles (see) - It makes the actual computations
1659 
1660  NB - A and B MUST contain on input a first approximation of
1661  their values
1662 
1663 ==============================================================================*/
1664 
1665 void TrigL2MuonSA::MuFastStationFitter::Circfit (int Nmeas,float *XI,float *YI,float *RI,float *WI,int *IG,
1666  float *A,float *B,float DAB[2][2],float *Chi2) const
1667 {
1668 
1669  float XX[NMEAMX],YY[NMEAMX],Test,Toll,Xnor,Aold,Bold,Epsi;
1670  float SAA,SAB,SBB,Square;
1671  int j,Niter;
1672 
1673  Toll = .1;
1674  Niter = 0;
1675  // *A = 0.;
1676  // *B = 0.;
1677  // SAA = 0.;
1678  // SAB = 0.;
1679  // SBB = 0.;
1680  Square = 0.;
1681 
1682  // Many iterations ...
1683 
1684  do {
1685  Niter++;
1686  Xnor = 1. / std::sqrt(1. + *A * *A);
1687  Aold = *A;
1688  Bold = *B;
1689  for(j=0;j<Nmeas;j++) {
1690  XX[j] = 0.;
1691  YY[j] = 0.;
1692  if(IG[j]==1) {
1693  XX[j] = XI[j];
1694  YY[j] = YI[j];
1695  } else if(IG[j]==2) {
1696  if(*A * XI[j] + *B - YI[j]>=0.) Epsi = 1.0; // mod 961017
1697  else Epsi = -1.0;
1698  XX[j] = XI[j] - Epsi * Xnor * std::abs(RI[j]) * *A;
1699  YY[j] = YI[j] + Epsi * Xnor * std::abs(RI[j]);
1700  } else if(IG[j]==3) {
1701  XX[j] = XI[j] - Xnor * RI[j] * *A;
1702  YY[j] = YI[j] + Xnor * RI[j];
1703  }
1704  }
1705 
1706  Xline(XX,YY,WI,IG,Nmeas,A,B,&SAA,&SBB,&SAB,&Square);
1707  if(Square<=0.) break;
1708  Test = ((Aold-*A)*(Aold-*A))/ SAA + ((Bold-*B)*(Bold-*B))/ SBB;
1709 
1710  } while(Test>=Toll&&Niter<=20);
1711 
1712 
1713  DAB[0][0] = SAA;
1714  DAB[0][1] = SAB;
1715  DAB[1][0] = SAB;
1716  DAB[1][1] = SBB;
1717  *Chi2 = Square;
1718 }
1719 
1720 // --------------------------------------------------------------------------------
1721 // --------------------------------------------------------------------------------
1722 
1723 /*==============================================================================
1724  A simple linear fit : y = A x + B (see PDG 94, 17.20-25)
1725 
1726  W = weights ( = 1./err**2)
1727  IG = flags (if .le.0, don't use)
1728 ==============================================================================*/
1729 
1730 void TrigL2MuonSA::MuFastStationFitter::Xline (float *X,float *Y,float *W,int *IG,int NP,
1731  float *A,float *B,float *SAA,float *SBB,float *SAB,float *Square) const
1732 {
1733 
1734  int j;
1735  float S1,SX,SY,SXX,SXY,SYY,Deter,DY;
1736 
1737  *Square = -7.;
1738  S1 = 0.;
1739  SX = 0.;
1740  SY = 0.;
1741  SXX = 0.;
1742  SXY = 0.;
1743  SYY = 0.;
1744 
1745  for(j=0;j<NP;j++) {
1746  if(IG[j]>=1) {
1747  S1 = S1 + W[j];
1748  SX = SX + W[j] * X[j];
1749  SY = SY + W[j] * Y[j];
1750  SXX = SXX + W[j] * X[j] * X[j];
1751  SXY = SXY + W[j] * X[j] * Y[j];
1752  SYY = SYY + W[j] * Y[j] * Y[j];
1753  }
1754  }
1755 
1756  Deter = S1 * SXX - SX * SX;
1757 
1758  if (std::abs(Deter) > ZERO_LIMIT) {
1759  *A = (S1 * SXY - SX * SY) / Deter;
1760  *B = (SY * SXX - SX * SXY) / Deter;
1761  *SAA = S1 / Deter;
1762  *SBB = SXX / Deter;
1763  *SAB = - SX / Deter;
1764  }
1765  else {
1766  if(S1 * SXY - SX * SY > 0.) {
1767  *A = 9.e+5;
1768  } else {
1769  *A = -9.e+5;
1770  }
1771  *B = SY/S1 - SX/S1 * *A;
1772  *SAA = *A;
1773  *SBB = *A;
1774  *SAB = - *A;
1775  }
1776  *Square = 0.;
1777  for(j=0;j<NP;j++) {
1778  if(IG[j]>=1) {
1779  DY =(Y[j] - *A * X[j] - *B)/std::sqrt(1 + *A * *A);
1780  //printf("Punto n.=%d , DY = %12.6f\n",j,DY);
1781  *Square = *Square + W[j] * DY * DY;
1782  }
1783  }
1784 
1785 }
1786 
1787 // --------------------------------------------------------------------------------
1788 // --------------------------------------------------------------------------------
1789  void TrigL2MuonSA::MuFastStationFitter::Circles (int Nmeas,float *XI,float *YI,float *RI,float *WI,int *IG,
1790  float *A,float *B,float DAB[2][2],float *Chi2,float *Pchi2,
1791  float *SlopeCand, float *InterceptCand, float *Chi2Cand) const
1792 {
1793  float RRi[NMEAMX],WIlim,CHbest,Abest,Bbest;
1794  float A0,B0,SAA,SBB,SAB,Square,Aj,Bj;
1795  int i,j,jj,Ntrue,Ngood,Nbest,Ntry,NOgo,Isig,Iflg,Ksign[4];
1796  int Ntrue2,Igg[NMEAMX];
1797 
1798  std::vector<float> st_chi2;
1799  std::vector<float> st_A;
1800  std::vector<float> st_B;
1801 
1802  for (int ii=0; ii<NCAND; ii++) {
1803  SlopeCand[ii] = 0.;//99999;
1804  InterceptCand[ii] = 0.;//99999;
1805  Chi2Cand[ii] = 0.;
1806  }
1807 
1808 // Find the four "besrit" points (equispaced, wi.gt.1/2*wimax)
1809 
1810  *Chi2 = -1.;
1811  if (Nmeas<=2||Nmeas>=NMEAMX+1) return;
1812  Ntrue = 0;
1813  Ngood = 0;
1814  Nbest = 3;
1815  WIlim = 0.;
1816 
1817  Abest = 0.;
1818  Bbest = 0.;
1819 
1820  for (i=0;i<4;i++) Ksign[i] = -1;
1821 
1822  for (j=0;j<Nmeas;j++) {
1823  if (IG[j]>=1) {
1824  Ntrue++;
1825  WIlim = (WIlim>=WI[j])? WIlim : WI[j];
1826  }
1827  }
1828 
1829  if (Ntrue<=2) return;
1830 
1831  WIlim = 0.1 * WIlim;
1832 
1833  for(j=0;j<Nmeas;j++) if(IG[j]>=1&&WI[j]>=WIlim) Ngood++;
1834 
1835  for (j=0;j<Nmeas;j++) {
1836  if (IG[j]>=1&&(WI[j]>=WIlim||Ngood<=3)) {
1837 
1838  if (Ksign[0]==-1) {
1839  Ksign[0] = j;
1840  } else if (Ksign[1]==-1) {
1841  Ksign[1] = j;
1842  } else if (Ksign[2]==-1) {
1843  Ksign[2] = j;
1844  } else if(Ksign[3]==-1) {
1845  Ksign[3] = j;
1846  Nbest = 4;
1847  } else {
1848  Ksign[2] = Ksign[3];
1849  Ksign[3] = j;
1850  }
1851  }
1852  }
1853 
1854  // First attempt, try with a line through the centers
1855 
1856  Xline(XI,YI,WI,IG,Nmeas,&A0,&B0,&SAA,&SBB,&SAB,&Square);
1857 
1858 // Then try 16 times trough the best four points
1859  st_A.clear(); st_B.clear(); st_chi2.clear();
1860 
1861  for (i=0;i<NMEAMX;i++) Igg[i] = -1;
1862 
1863  CHbest = 1.e25;
1864  Ntry = (int)floor(pow(2.,Nbest)) - 1; // 2**4 - 1 = 15
1865 
1866  for (j=0;j<=Ntry;j++) {
1867 
1868  NOgo = 0;
1869 
1870  for (jj=1;jj<=Nbest;jj++) {
1871  Isig = (j&(int)pow(2.,jj-1))? 1 : 0;
1872  // Isig = ibits(&j,&jj1,&one); // alternatively 0, 1
1873  Iflg = IG[Ksign[jj-1]];
1874  Igg[Ksign[jj-1]] = Iflg;
1875  RRi[Ksign[jj-1]] = RI[Ksign[jj-1]];
1876 
1877  if (Iflg==2) {
1878 
1879  Igg[Ksign[jj-1]] = 3;
1880 
1881  if (Isig==1) RRi[Ksign[jj-1]] = - RI[Ksign[jj-1]];
1882 
1883  } else if (Isig==1) {
1884 
1885  NOgo = 1;
1886 
1887  }
1888  }
1889 
1890  if (NOgo==0) {
1891 
1892  Aj = A0;
1893  Bj = B0;
1894  Circfit(Nmeas,XI,YI,RRi,WI,Igg,&Aj,&Bj,DAB,Chi2);
1895  Circfit(Nmeas,XI,YI,RI,WI,IG,&Aj,&Bj,DAB,Chi2);
1896  st_A.push_back(Aj); st_B.push_back(Bj); st_chi2.push_back(*Chi2);
1897 
1898  if (*Chi2>=0.0&&*Chi2<=CHbest) {
1899  Abest = Aj;
1900  Bbest = Bj;
1901  CHbest = *Chi2;
1902  }
1903  }
1904  }
1905 
1906  std::multimap<float, int>chi_map;
1907  chi_map.clear();
1908  std::vector<float> t_A;
1909  std::vector<float> t_B;
1910  std::vector<float> t_chi2;
1911  t_A.clear();
1912  t_B.clear();
1913  t_chi2.clear();
1914 
1915  for (unsigned int ir=0; ir<st_chi2.size(); ir++) chi_map.insert(std::make_pair(st_chi2.at(ir), ir));
1916 
1917  for (std::multimap<float, int>::iterator jt = chi_map.begin(); jt != chi_map.end(); ++jt) {
1918  t_A.push_back(st_A.at(jt->second));
1919  t_B.push_back(st_B.at(jt->second));
1920  t_chi2.push_back(st_chi2.at(jt->second));
1921  }
1922 
1923  for (int nv=0; nv<6; nv++) {
1924  SlopeCand[nv] = t_A[nv];
1925  InterceptCand[nv] = t_B[nv];
1926  Chi2Cand[nv] = t_chi2[nv];
1927  }
1928 
1929  // ... and finally with all the points
1930  *A = Abest;
1931  *B = Bbest;
1932  Circfit(Nmeas,XI,YI,RI,WI,IG,A,B,DAB,Chi2);
1933 
1934  if (*Chi2>=0.0) {
1935  Ntrue2 = Ntrue - 2;
1936  *Pchi2 = TMath::Prob(*Chi2, Ntrue2);
1937  }
1938 
1939  return;
1940 }
1941 
1942 // --------------------------------------------------------------------------------
1943 // --------------------------------------------------------------------------------
1944 
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
beamspotman.r
def r
Definition: beamspotman.py:676
TrigL2MuonSA::PBFitResult::NPOI
int NPOI
Definition: SuperPointData.h:61
TrigL2MuonSA::PBFitResult::RILIN
float RILIN[NMEAMX]
Definition: SuperPointData.h:53
S1
struct TBPatternUnitContext S1
checkxAOD.ds
ds
Definition: Tools/PyUtils/bin/checkxAOD.py:258
fitman.sy
sy
Definition: fitman.py:524
TrigL2MuonSA::PBFitResult::ALIN
float ALIN
Definition: SuperPointData.h:63
pdg_comparison.sigma
sigma
Definition: pdg_comparison.py:324
TrigL2MuonSA::TrackPattern::superPoints
TrigL2MuonSA::SuperPoint superPoints[s_NCHAMBER]
Definition: TrackData.h:60
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
NP
Definition: dumpNPs.cxx:34
AthMsgStreamMacros.h
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
TrigL2MuonSA::RpcFitResult::phi
double phi
Definition: RpcFitResult.h:44
TrigL2MuonSA::MuFastStationFitter::findSuperPoints
StatusCode findSuperPoints(const TrigRoiDescriptor *p_roids, const TrigL2MuonSA::MuonRoad &muonRoad, TrigL2MuonSA::RpcFitResult &rpcFitResult, std::vector< TrigL2MuonSA::TrackPattern > &v_trackPatterns) const
Definition: MuFastStationFitter.cxx:87
TrigL2MuonSA::RpcFitResult
Definition: RpcFitResult.h:14
xAOD::L2StandAloneMuon_v2
Class describing standalone muons reconstructed in the LVL2 trigger.
Definition: L2StandAloneMuon_v2.h:36
TrigL2MuonSA::PBFitResult::Chi2Cand
float Chi2Cand[NCAND]
Definition: SuperPointData.h:68
calibdata.chamber
chamber
Definition: calibdata.py:32
TrigL2MuonSA::PBFitResult::DABLIN
float DABLIN[2][2]
Definition: SuperPointData.h:65
index
Definition: index.py:1
JetTiledMap::W
@ W
Definition: TiledEtaPhiMap.h:44
TrigL2MuonSA::TgcFitResult
Definition: TgcFitResult.h:11
TrigL2MuonSA::PBFitResult::IGLIN
int IGLIN[NMEAMX]
Definition: SuperPointData.h:52
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
TrigL2MuonSA::MdtHits
std::vector< MdtHitData > MdtHits
Definition: MdtData.h:57
TrigL2MuonSA::MdtHitData
Definition: MdtData.h:18
TrigL2MuonSA::MuonRoad::bw
double bw[N_STATION][N_SECTOR]
Definition: MuonRoad.h:82
TrigL2MuonSA::TrackPattern::s_address
int s_address
Definition: TrackData.h:72
xAOD::L2StandAloneMuon_v2::setPt
void setPt(float pt)
Set the transverse momentum ( ) of the muon.
M_PI
#define M_PI
Definition: ActiveFraction.h:11
xAOD::L2StandAloneMuon_v2::setPhiMS
void setPhiMS(float value)
Set the phi at muon spectrometer.
xAOD::L2StandAloneMuon_v2::setEtaMS
void setEtaMS(float value)
Set the eta at muon spectrometer.
TrigRoiDescriptor
nope - should be used for standalone also, perhaps need to protect the class def bits #ifndef XAOD_AN...
Definition: TrigRoiDescriptor.h:56
TrigL2MuonSA::TgcFitResult::phiDir
double phiDir
Definition: TgcFitResult.h:68
TrigL2MuonSA::MuFastStationFitter::findLayerCombination
void findLayerCombination(std::vector< unsigned int > &a, int n, int r, std::vector< std::vector< unsigned int > > &c, int &nr) const
Definition: MuFastStationFitter.cxx:1326
TrigInDetValidation_Base.test
test
Definition: TrigInDetValidation_Base.py:147
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
TrigL2MuonSA::MuFastStationFitter::Evlfit
int Evlfit(int, TrigL2MuonSA::PBFitResult &fitres) const
Definition: MuFastStationFitter.cxx:1415
TrigL2MuonSA::PBFitResult::YILIN
float YILIN[NMEAMX]
Definition: SuperPointData.h:51
x
#define x
xAOD::L2StandAloneMuon_v2::setRMS
void setRMS(float value)
Set the R at muon spectrometer.
TrigL2MuonSA::SuperPoint::Blin
float Blin
Definition: SuperPointData.h:106
NMEAMX
#define NMEAMX
Definition: SuperPointData.h:8
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
TrigL2MuonSA::MuonRoad::aw
double aw[N_STATION][N_SECTOR]
Definition: MuonRoad.h:81
TrigL2MuonSA::SuperPoint::R
float R
Definition: SuperPointData.h:102
drawFromPickle.atan
atan
Definition: drawFromPickle.py:36
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
TrigL2MuonSA::MuFastStationFitter::Circfit
void Circfit(int, float *, float *, float *, float *, int *, float *, float *, float DAB[2][2], float *) const
Definition: MuFastStationFitter.cxx:1665
TrigL2MuonSA::MuFastStationFitter::stationSPFit
void stationSPFit(TrigL2MuonSA::MdtHits *mdtSegment, TrigL2MuonSA::SuperPoint *superPoint, TrigL2MuonSA::PBFitResult &pbFitResult, int s_address, int i_station, double aw, float phiDir) const
Definition: MuFastStationFitter.cxx:509
Monitored::X
@ X
Definition: HistogramFillerUtils.h:24
TrigL2MuonSA::TrackPattern
Definition: TrackData.h:16
TrigL2MuonSA::SuperPoint::Phim
float Phim
Definition: SuperPointData.h:104
TrigL2MuonSA::PBFitResult::NDOF
int NDOF
Definition: SuperPointData.h:62
TrigL2MuonSA::MdtLayerHits
Definition: MuFastPatternFinder.h:26
TrigL2MuonSA::SuperPoint::Yor
float Yor
Definition: SuperPointData.h:108
TrigL2MuonSA::SuperPoint::Residual
float Residual[NLAYER]
Definition: SuperPointData.h:111
A
TrigL2MuonSA::MuFastStationFitter::superPointFitter
StatusCode superPointFitter(TrigL2MuonSA::TrackPattern &trackPattern) const
Definition: MuFastStationFitter.cxx:197
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TrigL2MuonSA::TgcFitResult::tgcMid2
float tgcMid2[4]
Definition: TgcFitResult.h:46
TrigL2MuonSA::MuFastStationFitter::Circles
void Circles(int, float *, float *, float *, float *, int *, float *, float *, float DAB[2][2], float *, float *) const
Definition: MuFastStationFitter.cxx:1546
TrigL2MuonSA::TgcFitResult::isSuccess
bool isSuccess
Definition: TgcFitResult.h:39
TrigL2MuonSA::SuperPoint::Chi2
float Chi2
Definition: SuperPointData.h:109
lumiFormat.i
int i
Definition: lumiFormat.py:85
xAOD::L2StandAloneMuon_v2::setSAddress
void setSAddress(int value)
Set the station address of the muon.
TrigL2MuonSA::MuonRoad
Definition: MuonRoad.h:20
TrigL2MuonSA::SuperPoint::PChi2
float PChi2
Definition: SuperPointData.h:110
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TrigL2MuonSA::TrackPattern::ptEndcapAlpha
double ptEndcapAlpha
Definition: TrackData.h:97
TileDCSDataPlotter.pr
pr
Definition: TileDCSDataPlotter.py:922
TrigL2MuonSA::PBFitResult::IDMEA
int IDMEA[NMEAMX]
Definition: SuperPointData.h:46
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TrigL2MuonSA::MuFastStationFitter::Xline
void Xline(float *, float *, float *, int *, int, float *, float *, float *, float *, float *, float *) const
Definition: MuFastStationFitter.cxx:1730
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TrigL2MuonSA::TgcFitResult::tgcMid1
float tgcMid1[4]
Definition: TgcFitResult.h:45
TrigL2MuonSA::PBFitResult::XILIN
float XILIN[NMEAMX]
Definition: SuperPointData.h:50
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
TrigL2MuonSA::MuFastStationFitter::updateInnSP
void updateInnSP(TrigL2MuonSA::TrackPattern &trackPattern, double &aw, double &tgc_aw, double &bw) const
Definition: MuFastStationFitter.cxx:1256
TrigL2MuonSA::PBFitResult::InterceptCand
float InterceptCand[NCAND]
Definition: SuperPointData.h:67
TrigL2MuonSA::PBFitResult::JLINE
int JLINE[NMEAMX]
Definition: SuperPointData.h:56
TrigL2MuonSA::MuFastStationFitter::makeReferenceLine
void makeReferenceLine(TrigL2MuonSA::TrackPattern &trackPattern, const TrigL2MuonSA::MuonRoad &muonRoad) const
Definition: MuFastStationFitter.cxx:1028
ZERO_LIMIT
const float ZERO_LIMIT
Definition: VP1TriggerHandleL2.cxx:37
TrigL2MuonSA::SuperPoint::Ndigi
int Ndigi
Definition: SuperPointData.h:101
TrigL2MuonSA::MuFastStationFitter::setMCFlag
StatusCode setMCFlag(const BooleanProperty &use_mcLUT)
Definition: MuFastStationFitter.cxx:53
TrigL2MuonSA::MuFastStationFitter::findSuperPointsSimple
StatusCode findSuperPointsSimple(const TrigRoiDescriptor *p_roids, const TrigL2MuonSA::MuonRoad &muonRoad, TrigL2MuonSA::TgcFitResult &tgcFitResult, std::vector< TrigL2MuonSA::TrackPattern > &v_trackPatterns, TrigL2MuonSA::StgcHits &stgcHits, TrigL2MuonSA::MmHits &mmHits) const
Definition: MuFastStationFitter.cxx:118
TrigL2MuonSA::PBFitResult::BLIN
float BLIN
Definition: SuperPointData.h:64
trigbs_pickEvents.num
num
Definition: trigbs_pickEvents.py:76
ReadFromCoolCompare.fd
fd
Definition: ReadFromCoolCompare.py:196
Monitored::Y
@ Y
Definition: HistogramFillerUtils.h:24
xAOD::L2MuonParameters::EndcapMiddle
@ EndcapMiddle
Middle station in the endcap spectrometer.
Definition: TrigMuonDefs.h:20
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
TrigL2MuonSA::SuperPoint::SlopeCand
float SlopeCand[NCAND]
Definition: SuperPointData.h:112
SG::AuxElement::makePrivateStore
void makePrivateStore()
Create a new (empty) private store for this object.
Definition: AuxElement.cxx:172
TrigMuonDefs.h
xAOD::L2StandAloneMuon_v2::setZMS
void setZMS(float value)
Set the Z at muon spectrometer.
TrigL2MuonSA::PBFitResult::PCHI2
float PCHI2
Definition: SuperPointData.h:60
ir
int ir
counter of the current depth
Definition: fastadd.cxx:49
TrigL2MuonSA::RpcFitResult::isSuccess
bool isSuccess
Definition: RpcFitResult.h:38
TrigL2MuonSA::MuFastStationFitter::MuFastStationFitter
MuFastStationFitter(const std::string &type, const std::string &name, const IInterface *parent)
Definition: MuFastStationFitter.cxx:25
TrigL2MuonSA::TgcFitResult::tgcPT
float tgcPT
Definition: TgcFitResult.h:63
TrigL2MuonSA::SuperPoint::InterceptCand
float InterceptCand[NCAND]
Definition: SuperPointData.h:113
a
TList * a
Definition: liststreamerinfos.cxx:10
TrigL2MuonSA::MmHits
std::vector< MmHitData > MmHits
Definition: MmData.h:47
MuFastStationFitter.h
TrigL2MuonSA::SuperPoint::Xor
float Xor
Definition: SuperPointData.h:107
y
#define y
RoiDescriptor::phi
virtual double phi() const override final
Methods to retrieve data members.
Definition: RoiDescriptor.h:100
TrigL2MuonSA::TrackPattern::phiMSDir
double phiMSDir
Definition: TrackData.h:75
TrigL2MuonSA::SuperPoint::Npoint
int Npoint
Definition: SuperPointData.h:97
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TrigL2MuonSA::StgcHits
std::vector< StgcHitData > StgcHits
Definition: StgcData.h:49
TrigL2MuonSA::SuperPoint::Chi2Cand
float Chi2Cand[NCAND]
Definition: SuperPointData.h:114
Test
It is supposed to try out all the methods + do that from several threads to assure service robustness...
Definition: TestCaloDataAccess.h:12
TrigL2MuonSA::PBFitResult::CHI2
float CHI2
Definition: SuperPointData.h:59
TrigL2MuonSA::MuFastStationFitter::initialize
virtual StatusCode initialize() override
Definition: MuFastStationFitter.cxx:35
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
TrigL2MuonSA::MuonRoad::extFtfMiddlePhi
double extFtfMiddlePhi
Definition: MuonRoad.h:91
TrigL2MuonSA::MuFastStationFitter::findSubLayerCombination
void findSubLayerCombination(std::vector< unsigned int > &a, int n, int r, std::vector< unsigned int > &b, int index, int num, std::vector< std::vector< unsigned int > > &c, int &nr) const
Definition: MuFastStationFitter.cxx:1342
TrigL2MuonSA::PBFitResult::SlopeCand
float SlopeCand[NCAND]
Definition: SuperPointData.h:66
TrigL2MuonSA::SuperPoint::Z
float Z
Definition: SuperPointData.h:103
TrigL2MuonSA::SuperPoint
Definition: SuperPointData.h:74
TrigL2MuonSA::MuFastStationFitter::fromAlphaPtToInn
double fromAlphaPtToInn(TrigL2MuonSA::TgcFitResult &tgcFitResult, TrigL2MuonSA::TrackPattern &trackPattern) const
Definition: MuFastStationFitter.cxx:1175
TrigL2MuonSA::MuonRoad::extFtfMiddleEta
double extFtfMiddleEta
Definition: MuonRoad.h:90
AthAlgTool
Definition: AthAlgTool.h:26
xAOD::L2StandAloneMuon
L2StandAloneMuon_v2 L2StandAloneMuon
Define the latest version of the muon SA class.
Definition: L2StandAloneMuon.h:17
TrigL2MuonSA::MuFastStationFitter::SetDriftSpace
float SetDriftSpace(float tdr, float rad, float zeta, float phim, float phiDir) const
Definition: MuFastStationFitter.cxx:1376
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
TileDCSDataPlotter.tt
tt
Definition: TileDCSDataPlotter.py:874
python.compressB64.c
def c
Definition: compressB64.py:93
python.TriggerAPI.TriggerAPISession.df
df
Definition: TriggerAPISession.py:432
TrigL2MuonSA::SuperPoint::Alin
float Alin
Definition: SuperPointData.h:105
TrigL2MuonSA::PBFitResult::WILIN
float WILIN[NMEAMX]
Definition: SuperPointData.h:54
xAOD::L2MuonParameters::EndcapOuter
@ EndcapOuter
Outer station in the endcap spectrometer.
Definition: TrigMuonDefs.h:21
TrigL2MuonSA::PBFitResult
Definition: SuperPointData.h:15
NCAND
#define NCAND
Definition: SuperPointData.h:11
python.SystemOfUnits.rad
int rad
Definition: SystemOfUnits.py:111
fitman.k
k
Definition: fitman.py:528
L2StandAloneMuonAuxContainer.h
TrigL2MuonSA::TrackPattern::mdtSegments
TrigL2MuonSA::MdtHits mdtSegments[s_NCHAMBER]
Definition: TrackData.h:57
TrigL2MuonSA::PBFitResult::DISTJ
float DISTJ[NMEAMX]
Definition: SuperPointData.h:55
ServiceHandle
Definition: ClusterMakerTool.h:37
TrigL2MuonSA::PBFitResult::RESI
float RESI[NMEAMX]
Definition: SuperPointData.h:57