ATLAS Offline Software
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
TrigL2MuonSA::MuFastPatternFinder Class Reference

#include <MuFastPatternFinder.h>

Inheritance diagram for TrigL2MuonSA::MuFastPatternFinder:
Collaboration diagram for TrigL2MuonSA::MuFastPatternFinder:

Public Member Functions

 MuFastPatternFinder (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual StatusCode initialize () override
 
StatusCode findPatterns (const TrigL2MuonSA::MuonRoad &muonRoad, TrigL2MuonSA::MdtHits &mdtHits, std::vector< TrigL2MuonSA::TrackPattern > &v_trackPatterns) const
 
StatusCode findPatterns (const TrigL2MuonSA::MuonRoad &muonRoad, TrigL2MuonSA::MdtHits &mdtHits, TrigL2MuonSA::StgcHits &stgcHits, TrigL2MuonSA::MmHits &mmHits, std::vector< TrigL2MuonSA::TrackPattern > &v_trackPatterns) const
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

double calc_residual (double aw, double bw, double x, double y) const
 
void doMdtCalibration (TrigL2MuonSA::MdtHitData &mdtHit, double track_phi, double phi0, bool isEndcap) const
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

ToolHandle< NswPatternFinderm_nswPatternFinder {this, "NswPatternFinder", "TrigL2MuonSA::NswPatternFinder"}
 
ToolHandle< IMdtCalibrationToolm_mdtCalibrationTool {this, "CalibrationTool", "MdtCalibrationTool"}
 
ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Definition at line 38 of file MuFastPatternFinder.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ MuFastPatternFinder()

TrigL2MuonSA::MuFastPatternFinder::MuFastPatternFinder ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 13 of file MuFastPatternFinder.cxx.

15  :
17 {
18 }

Member Function Documentation

◆ calc_residual()

double TrigL2MuonSA::MuFastPatternFinder::calc_residual ( double  aw,
double  bw,
double  x,
double  y 
) const
private

Definition at line 307 of file MuFastPatternFinder.cxx.

308 {
309  const double ZERO_LIMIT = 1e-4;
310  if( std::abs(aw) < ZERO_LIMIT ) return y-bw;
311  double ia = 1/aw;
312  double iaq = ia*ia;
313  double dz = x - (y-bw)*ia;
314  return dz/std::sqrt(1.+iaq);
315 }

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ detStore()

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ doMdtCalibration()

void TrigL2MuonSA::MuFastPatternFinder::doMdtCalibration ( TrigL2MuonSA::MdtHitData mdtHit,
double  track_phi,
double  phi0,
bool  isEndcap 
) const
private

Definition at line 33 of file MuFastPatternFinder.cxx.

34 {
35  int StationName = mdtHit.name;
36  int StationEta = mdtHit.StationEta;
37  int StationPhi = mdtHit.StationPhi;
38  int Multilayer = mdtHit.Multilayer;
39  int Layer = mdtHit.TubeLayer;
40  int Tube = mdtHit.Tube;
41 
42  ATH_MSG_DEBUG("...StationName/StationEta/StationPhi/Multilayer/Layer/Tube="
43  << StationName << "/" << StationEta << "/" << StationPhi << "/" << Multilayer << "/"
44  << Layer << "/" << Tube);
45 
46  Identifier id = ( mdtHit.Id.is_valid() ) ? mdtHit.Id : m_idHelperSvc->mdtIdHelper().channelID(StationName,StationEta,
47  StationPhi,Multilayer,Layer,Tube);
48 
49  int tdcCounts = (int)mdtHit.DriftTime;
50  int adcCounts = mdtHit.Adc;
51 
52  double R = mdtHit.R;
53  // double InCo = mdtHit.cInCo;
54  const double cosDphi = std::cos(std::abs(track_phi - phi0));
55  double InCo = cosDphi ? 1./ cosDphi: 0;
56  double X = (isEndcap)? R*std::cos(track_phi): R*InCo*std::cos(track_phi);
57  double Y = (isEndcap)? R*std::sin(track_phi): R*InCo*std::sin(track_phi);
58  double Z = mdtHit.Z;
59  const Amg::Vector3D point{X,Y,Z};
60 
61  MdtCalibInput calHit(id, adcCounts,tdcCounts, mdtHit.readEle);
62  calHit.setClosestApproach(point);
63  ATH_MSG_DEBUG("... MDT hit raw digit tdcCounts/adcCounts=" << tdcCounts << "/" << adcCounts);
64 
65  ATH_MSG_DEBUG("... MDT hit position X/Y/Z/track_phi/Multilayer/Layer/Tube="
66  << Amg::toString(point, 2) << "/" << track_phi << "/" << Multilayer << "/" << Layer << "/" << Tube);
67 
68  MdtCalibOutput calibOut = m_mdtCalibrationTool->calibrate(Gaudi::Hive::currentContext(), calHit, false);
69  double driftSpace = calibOut.driftRadius();
70  double driftSigma = calibOut.driftRadiusUncert();
71 
72  ATH_MSG_DEBUG("... MDT hit calibrated driftSpace/driftSigma=" << driftSpace << "/" << driftSigma);
73 
74  const double ZERO_LIMIT = 1e-4;
75 
76  if( std::abs(driftSpace) > ZERO_LIMIT ) {
77  mdtHit.DriftSpace = driftSpace;
78  mdtHit.DriftSigma = driftSigma;
79  }
80  else {
81  mdtHit.DriftSpace = 0;
82  mdtHit.DriftSigma = 0;
83  }
84 
85 }

◆ evtStore() [1/2]

ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ findPatterns() [1/2]

StatusCode TrigL2MuonSA::MuFastPatternFinder::findPatterns ( const TrigL2MuonSA::MuonRoad muonRoad,
TrigL2MuonSA::MdtHits mdtHits,
std::vector< TrigL2MuonSA::TrackPattern > &  v_trackPatterns 
) const

Definition at line 113 of file MuFastPatternFinder.cxx.

116 {
117 
118  // find only 1 track pattern
119  v_trackPatterns.clear();
120  TrigL2MuonSA::TrackPattern trackPattern;
121  for (int i=0; i<xAOD::L2MuonParameters::Chamber::MaxChamber; i++) trackPattern.mdtSegments[i].clear();
122 
123  // Saddress = pos1/3 = 0:Large, 1:Large-SP, 2:Small, 3:Small-SP
124  trackPattern.s_address = (muonRoad.isEndcap)? -1: muonRoad.Special + 2*muonRoad.LargeSmall;
125 
126  const unsigned int MAX_STATION = 11;
127  const unsigned int MAX_LAYER = 12;
128 
129  TrigL2MuonSA::MdtLayerHits v_mdtLayerHits[MAX_STATION][MAX_LAYER];
130 
131  for(unsigned int i_station=0; i_station<MAX_STATION; i_station++) {
132  for(unsigned int i_layer=0; i_layer<MAX_LAYER; i_layer++) {
133  v_mdtLayerHits[i_station][i_layer].ntot = 0;
134  v_mdtLayerHits[i_station][i_layer].ntot_all = 0;
135  v_mdtLayerHits[i_station][i_layer].ndigi = 0;
136  v_mdtLayerHits[i_station][i_layer].ndigi_all = 0;
137  v_mdtLayerHits[i_station][i_layer].ResSum = 0.;
138  }
139  }
140 
141  unsigned int i_layer_max = 0;
142  unsigned int chamber_max = 0;
143 
144  double trigger_phi = muonRoad.phiMiddle; // phi fit result to be used
145  double phi0; // phi at the first layer to be used
146 
147  for(unsigned int i_hit=0; i_hit<mdtHits.size(); i_hit++) {
148 
149  unsigned int chamber = mdtHits[i_hit].Chamber;
150 
151  if( chamber > chamber_max ) chamber_max = chamber;
153 
154  double aw = muonRoad.aw[chamber][0];
155  double bw = muonRoad.bw[chamber][0];
156  double Z = mdtHits[i_hit].Z;
157  double R = mdtHits[i_hit].R;
158  //
159  double residual = calc_residual(aw,bw,Z,R);
160  mdtHits[i_hit].R = R;
161  mdtHits[i_hit].Residual = residual;
162  mdtHits[i_hit].isOutlier = 0;
163  unsigned int i_layer = mdtHits[i_hit].Layer;
164  double rWidth = muonRoad.rWidth[chamber][i_layer];
165 
166  ATH_MSG_DEBUG("... chamber/Z/R/aw/bw/residual/rWidth="
167  << chamber << "/" << Z << "/" << R << "/" << aw << "/" << bw << "/" << residual << "/" << rWidth);
168 
169  int stationPhi = mdtHits[i_hit].StationPhi;
170  std::string name = m_idHelperSvc->mdtIdHelper().stationNameString(mdtHits[i_hit].name);
171  int chamber_this = 99;
172  int sector_this = 99;
173  bool isEndcap;
174  MdtRegionDefiner::find_station_sector(name, stationPhi, isEndcap, chamber_this, sector_this);
175  if( !isEndcap && sector_this != muonRoad.MDT_sector_trigger ) {
176  mdtHits[i_hit].isOutlier = 3;
177  continue;
178  }
179 
180  if( std::abs(residual) > rWidth ) {
181  mdtHits[i_hit].isOutlier = 2;
182  continue;
183  }
184 
185  ATH_MSG_DEBUG(" --> included at i_layer=" << i_layer);
186  if( mdtHits[i_hit].TubeLayer < 1 || i_layer > (MAX_LAYER-1) ) {
187  ATH_MSG_WARNING("strange i_layer=" << i_layer);
188  return StatusCode::FAILURE;
189  }
190  if( i_layer > i_layer_max ) i_layer_max = i_layer;
191  // v_mdtLayerHits[i_station][i_layer].indexes[v_mdtLayerHits[i_station][i_layer].ndigi] = i_hit;
192  v_mdtLayerHits[chamber][i_layer].indexes.push_back(i_hit);
193  v_mdtLayerHits[chamber][i_layer].ndigi++;
194  v_mdtLayerHits[chamber][i_layer].ndigi_all++;
195  v_mdtLayerHits[chamber][0].ntot++;
196  v_mdtLayerHits[chamber][0].ntot_all++;
197  v_mdtLayerHits[chamber][0].ResSum += residual;
198  }
199 
200 
201  const double DeltaMin = 0.025;
202 
203  for(unsigned int chamber=0; chamber<=chamber_max; chamber++) {
204 
205  ATH_MSG_DEBUG(" --- chamber=" << chamber);
206 
207  double ResMed = 0;
208 
209  ATH_MSG_DEBUG("removing outliers...");
210 
211  // remove outlier
212  while(1) {
213  if (chamber==9) break;//BME skips this loop
214  if (chamber==10) break;//BMG skips this loop
215  unsigned int layer = 999999;
216  double DistMax = 0.;
217  double Residual = 0.;
218  unsigned int i_hit_max = 999999;
219  ResMed = (v_mdtLayerHits[chamber][0].ntot!=0)?
220  v_mdtLayerHits[chamber][0].ResSum/v_mdtLayerHits[chamber][0].ntot : 0.;
221  for(unsigned int i_layer=0; i_layer<=i_layer_max; i_layer++) {
222  for(unsigned int idigi=0; idigi<v_mdtLayerHits[chamber][i_layer].ndigi_all;idigi++) {
223 
224  unsigned int i_hit = v_mdtLayerHits[chamber][i_layer].indexes[idigi];
225  if(mdtHits[i_hit].isOutlier > 0) continue;
226  double DistMed = std::abs(mdtHits[i_hit].Residual - ResMed);
227  if(DistMed>=DistMax) {
228  DistMax = DistMed;
229  Residual = mdtHits[i_hit].Residual;
230  layer = i_layer;
231  i_hit_max = i_hit;
232  }
233  }
234  }
235  ATH_MSG_DEBUG("ResMed=" << ResMed << ": DistMax/layer/i_hit_max/ntot="
236  << DistMax << "/" << layer << "/" << i_hit_max << "/" << v_mdtLayerHits[chamber][0].ntot);
237  // break conditions
238  if(layer == 999999) break;
239  if(v_mdtLayerHits[chamber][layer].ndigi==1) break;
240  double Mednew = (v_mdtLayerHits[chamber][0].ResSum - Residual)/(v_mdtLayerHits[chamber][0].ntot - 1);
241  double Delta = 2.*std::abs((ResMed - Mednew)/(ResMed + Mednew));
242  ATH_MSG_DEBUG("Mednew/Delta/DeltaMin=" << Mednew << "/" << Delta << "/" << DeltaMin);
243  if(Delta<=DeltaMin) break;
244 
245  // if not, delete the maxRes and continue;
246  v_mdtLayerHits[chamber][0].ResSum = v_mdtLayerHits[chamber][0].ResSum - Residual;
247  v_mdtLayerHits[chamber][0].ntot--;
248  v_mdtLayerHits[chamber][layer].ndigi--;
249  mdtHits[i_hit_max].isOutlier = 2;
250  }
251 
252  ATH_MSG_DEBUG("choosing one at each layer...");
253 
254  // choose one at each layer, and record it in segment
255  TrigL2MuonSA::MdtHits mdtSegment;
256  mdtSegment.clear();
257 
258  phi0 = 0;
259  for(unsigned int i_layer=0; i_layer<=i_layer_max; i_layer++) {
260 
261  ATH_MSG_DEBUG("i_layer=" << i_layer << ": ndigi=" << v_mdtLayerHits[chamber][i_layer].ndigi);
262 
263  // choose one at each layer
264  while( v_mdtLayerHits[chamber][i_layer].ndigi>=2 ) {
265  double ResMax = 0.;
266  unsigned int i_hit_max = 999999;
267  for(unsigned int idigi=0;idigi<v_mdtLayerHits[chamber][i_layer].ndigi_all;idigi++) {
268  unsigned int i_hit = v_mdtLayerHits[chamber][i_layer].indexes[idigi];
269  if( mdtHits[i_hit].isOutlier > 0 ) continue;
270  if( std::abs(mdtHits[i_hit].Residual) >= ResMax ) {
271  ResMax = std::abs(mdtHits[i_hit].Residual);
272  i_hit_max = i_hit;
273  }
274  }
275  ATH_MSG_DEBUG("ResMax=" << ResMax << ": i_hit_max=" << i_hit_max);
276  if( i_hit_max == 999999 ) break;
277  v_mdtLayerHits[chamber][0].ResSum = v_mdtLayerHits[chamber][0].ResSum - ResMax;
278  v_mdtLayerHits[chamber][0].ntot--;
279  v_mdtLayerHits[chamber][i_layer].ndigi--;
280  mdtHits[i_hit_max].isOutlier = 1;
281  }
282 
283  // record it into segement
284  for(unsigned int i_digi=0; i_digi< v_mdtLayerHits[chamber][i_layer].ndigi_all; i_digi++) {
285  unsigned int i_hit = v_mdtLayerHits[chamber][i_layer].indexes[i_digi];
286  if (i_layer==0) phi0 = mdtHits[i_hit].cPhi0;
287  doMdtCalibration(mdtHits[i_hit], trigger_phi, phi0, muonRoad.isEndcap);
288  if (mdtHits[i_hit].isOutlier > 1) continue;
289  mdtSegment.push_back(mdtHits[i_hit]);
290  }
291  }
292 
293  //
294  ATH_MSG_DEBUG("nr of hits in segment=" << mdtSegment.size());
295  trackPattern.mdtSegments[chamber] = mdtSegment;
296 
297  } // end loop on stations.
298 
299  v_trackPatterns.push_back(trackPattern);
300 
301  return StatusCode::SUCCESS;
302 }

◆ findPatterns() [2/2]

StatusCode TrigL2MuonSA::MuFastPatternFinder::findPatterns ( const TrigL2MuonSA::MuonRoad muonRoad,
TrigL2MuonSA::MdtHits mdtHits,
TrigL2MuonSA::StgcHits stgcHits,
TrigL2MuonSA::MmHits mmHits,
std::vector< TrigL2MuonSA::TrackPattern > &  v_trackPatterns 
) const

Definition at line 91 of file MuFastPatternFinder.cxx.

96 {
97  ATH_CHECK( findPatterns(muonRoad, mdtHits, v_trackPatterns) );
98  ATH_CHECK( m_nswPatternFinder->findPatterns(muonRoad, stgcHits, mmHits, v_trackPatterns.back()) );
99 
100  for(unsigned int i_hit=0; i_hit<v_trackPatterns.back().stgcSegment.size(); i_hit++) {
101  ATH_MSG_DEBUG("PatternFinder: output sTGC hits global eta/phi/r/z/layer/channelType/isOutlier " << v_trackPatterns.back().stgcSegment[i_hit].eta << "/" << v_trackPatterns.back().stgcSegment[i_hit].phi << "/" << v_trackPatterns.back().stgcSegment[i_hit].r << "/" << v_trackPatterns.back().stgcSegment[i_hit].z << "/" << v_trackPatterns.back().stgcSegment[i_hit].layerNumber << "/" << v_trackPatterns.back().stgcSegment[i_hit].channelType << "/" << v_trackPatterns.back().stgcSegment[i_hit].isOutlier);
102  }
103 
104  for(unsigned int i_hit=0; i_hit<v_trackPatterns.back().mmSegment.size(); i_hit++) {
105  ATH_MSG_DEBUG("PatternFinder: output MM hits global eta/phi/r/z/layer/isOutlier " << v_trackPatterns.back().mmSegment[i_hit].eta << "/" << v_trackPatterns.back().mmSegment[i_hit].phi << "/" << v_trackPatterns.back().mmSegment[i_hit].r << "/" << v_trackPatterns.back().mmSegment[i_hit].z << "/" << v_trackPatterns.back().mmSegment[i_hit].layerNumber << "/" << v_trackPatterns.back().mmSegment[i_hit].isOutlier);
106  }
107 
108  return StatusCode::SUCCESS;
109 
110 }

◆ initialize()

StatusCode TrigL2MuonSA::MuFastPatternFinder::initialize ( )
overridevirtual

Definition at line 23 of file MuFastPatternFinder.cxx.

24 {
25  ATH_CHECK( m_nswPatternFinder.retrieve() );
26  ATH_CHECK( m_idHelperSvc.retrieve() );
27  return StatusCode::SUCCESS;
28 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg() [1/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t<std::is_void_v<std::result_of_t<decltype(&T::renounce)(T)> > && !std::is_base_of_v<SG::VarHandleKeyArray, T> && std::is_base_of_v<Gaudi::DataHandle, T>, void> AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase &  )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308  {
309  // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310  // << " size: " << m_vhka.size() << endmsg;
311  for (auto &a : m_vhka) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> TrigL2MuonSA::MuFastPatternFinder::m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
private

Definition at line 70 of file MuFastPatternFinder.h.

◆ m_mdtCalibrationTool

ToolHandle<IMdtCalibrationTool> TrigL2MuonSA::MuFastPatternFinder::m_mdtCalibrationTool {this, "CalibrationTool", "MdtCalibrationTool"}
private

Definition at line 68 of file MuFastPatternFinder.h.

◆ m_nswPatternFinder

ToolHandle<NswPatternFinder> TrigL2MuonSA::MuFastPatternFinder::m_nswPatternFinder {this, "NswPatternFinder", "TrigL2MuonSA::NswPatternFinder"}
private

Definition at line 65 of file MuFastPatternFinder.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
TrigL2MuonSA::MdtHitData::DriftSigma
double DriftSigma
Definition: MdtData.h:40
Muon::nsw::STGTPSegments::moduleIDBits::stationPhi
constexpr uint8_t stationPhi
station Phi 1 to 8
Definition: NSWSTGTPDecodeBitmaps.h:161
TrigL2MuonSA::MdtHitData::readEle
const MuonGM::MdtReadoutElement * readEle
Definition: MdtData.h:51
MdtCalibInput
Definition: MdtCalibInput.h:35
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
TrigL2MuonSA::MuonRoad::phiMiddle
double phiMiddle
Definition: MuonRoad.h:79
ClusterSeg::residual
@ residual
Definition: ClusterNtuple.h:20
calibdata.chamber
chamber
Definition: calibdata.py:32
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
Monitored::Z
@ Z
Definition: HistogramFillerUtils.h:24
TrigL2MuonSA::MdtHitData::StationPhi
int StationPhi
Definition: MdtData.h:21
InDetAccessor::phi0
@ phi0
Definition: InDetAccessor.h:33
TrigL2MuonSA::MdtHits
std::vector< MdtHitData > MdtHits
Definition: MdtData.h:57
TrigL2MuonSA::MuonRoad::bw
double bw[N_STATION][N_SECTOR]
Definition: MuonRoad.h:82
TrigL2MuonSA::TrackPattern::s_address
int s_address
Definition: TrackData.h:72
TrigL2MuonSA::MuonRoad::isEndcap
bool isEndcap
Definition: MuonRoad.h:72
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
TrigL2MuonSA::MdtHitData::R
double R
Definition: MdtData.h:37
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
TrigL2MuonSA::MdtHitData::name
unsigned int name
Definition: MdtData.h:19
x
#define x
TrigL2MuonSA::MdtHitData::StationEta
int StationEta
Definition: MdtData.h:20
Identifier::is_valid
bool is_valid() const
Check if id is in a valid state.
python.RingerConstants.Layer
Layer
Definition: RingerConstants.py:42
TrigL2MuonSA::MuonRoad::aw
double aw[N_STATION][N_SECTOR]
Definition: MuonRoad.h:81
TrigL2MuonSA::MdtHitData::Multilayer
int Multilayer
Definition: MdtData.h:22
Monitored::X
@ X
Definition: HistogramFillerUtils.h:24
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
TrigL2MuonSA::TrackPattern
Definition: TrackData.h:16
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
TrigL2MuonSA::MdtHitData::TubeLayer
int TubeLayer
Definition: MdtData.h:24
TrigL2MuonSA::MuFastPatternFinder::calc_residual
double calc_residual(double aw, double bw, double x, double y) const
Definition: MuFastPatternFinder.cxx:307
TrigL2MuonSA::MdtLayerHits
Definition: MuFastPatternFinder.h:26
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
Amg::toString
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Definition: GeoPrimitivesToStringConverter.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TrigL2MuonSA::MdtHitData::Id
Identifier Id
Definition: MdtData.h:50
lumiFormat.i
int i
Definition: lumiFormat.py:85
xAOD::L2MuonParameters::MaxChamber
@ MaxChamber
Number of measurement point definitions.
Definition: TrigMuonDefs.h:27
TrigL2MuonSA::MuFastPatternFinder::m_nswPatternFinder
ToolHandle< NswPatternFinder > m_nswPatternFinder
Definition: MuFastPatternFinder.h:65
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Residual
Residual is a class that stores the residual, error, and type of residual.
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
TrigL2MuonSA::MuonRoad::MDT_sector_trigger
int MDT_sector_trigger
Definition: MuonRoad.h:86
TrigL2MuonSA::MdtHitData::DriftTime
double DriftTime
Definition: MdtData.h:38
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TrigL2MuonSA::MdtHitData::Adc
uint16_t Adc
Definition: MdtData.h:42
TrigL2MuonSA::MuFastPatternFinder::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MuFastPatternFinder.h:70
AnalysisUtils::Delta::R
double R(const INavigable4Momentum *p1, const double v_eta, const double v_phi)
Definition: AnalysisMisc.h:49
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
MdtCalibOutput
Definition: MdtCalibOutput.h:10
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
ZERO_LIMIT
const float ZERO_LIMIT
Definition: VP1TriggerHandleL2.cxx:37
TrigL2MuonSA::MdtRegionDefiner::find_station_sector
static void find_station_sector(const std::string &name, int phi, bool &endcap, int &chamber, int &sector)
Definition: MdtRegionDefiner.cxx:381
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
Monitored::Y
@ Y
Definition: HistogramFillerUtils.h:24
TrigL2MuonSA::MdtHitData::Tube
int Tube
Definition: MdtData.h:25
TrigL2MuonSA::MdtHitData::DriftSpace
double DriftSpace
Definition: MdtData.h:39
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
MdtCalibOutput::driftRadiusUncert
double driftRadiusUncert() const
Returns the uncertainty on the drift radius.
Definition: MdtCalibOutput.cxx:20
TrigL2MuonSA::MdtLayerHits::ntot
unsigned int ntot
Definition: MuFastPatternFinder.h:27
TrigL2MuonSA::MuonRoad::LargeSmall
int LargeSmall
Definition: MuonRoad.h:77
a
TList * a
Definition: liststreamerinfos.cxx:10
y
#define y
TrigL2MuonSA::MuonRoad::rWidth
double rWidth[N_STATION][N_LAYER]
Definition: MuonRoad.h:84
h
TrigL2MuonSA::MuFastPatternFinder::findPatterns
StatusCode findPatterns(const TrigL2MuonSA::MuonRoad &muonRoad, TrigL2MuonSA::MdtHits &mdtHits, std::vector< TrigL2MuonSA::TrackPattern > &v_trackPatterns) const
Definition: MuFastPatternFinder.cxx:113
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TrigL2MuonSA::MdtHitData::Z
double Z
Definition: MdtData.h:36
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
TrigL2MuonSA::MuFastPatternFinder::doMdtCalibration
void doMdtCalibration(TrigL2MuonSA::MdtHitData &mdtHit, double track_phi, double phi0, bool isEndcap) const
Definition: MuFastPatternFinder.cxx:33
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
TrigL2MuonSA::MuonRoad::Special
int Special
Definition: MuonRoad.h:78
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
TrigL2MuonSA::MuFastPatternFinder::m_mdtCalibrationTool
ToolHandle< IMdtCalibrationTool > m_mdtCalibrationTool
Definition: MuFastPatternFinder.h:68
MdtCalibOutput::driftRadius
double driftRadius() const
Returns the drift radius of the calibrated object.
Definition: MdtCalibOutput.cxx:19
fitman.k
k
Definition: fitman.py:528
TrigL2MuonSA::TrackPattern::mdtSegments
TrigL2MuonSA::MdtHits mdtSegments[s_NCHAMBER]
Definition: TrackData.h:57
Identifier
Definition: IdentifierFieldParser.cxx:14