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 306 of file MuFastPatternFinder.cxx.

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

◆ 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, point};
62  ATH_MSG_DEBUG("... MDT hit raw digit tdcCounts/adcCounts=" << tdcCounts << "/" << adcCounts);
63 
64  ATH_MSG_DEBUG("... MDT hit position X/Y/Z/track_phi/Multilayer/Layer/Tube="
65  << Amg::toString(point, 2) << "/" << track_phi << "/" << Multilayer << "/" << Layer << "/" << Tube);
66 
67  MdtCalibOutput calibOut = m_mdtCalibrationTool->calibrate(Gaudi::Hive::currentContext(), calHit, false);
68  double driftSpace = calibOut.driftRadius();
69  double driftSigma = calibOut.driftRadiusUncert();
70 
71  ATH_MSG_DEBUG("... MDT hit calibrated driftSpace/driftSigma=" << driftSpace << "/" << driftSigma);
72 
73  const double ZERO_LIMIT = 1e-4;
74 
75  if( std::abs(driftSpace) > ZERO_LIMIT ) {
76  mdtHit.DriftSpace = driftSpace;
77  mdtHit.DriftSigma = driftSigma;
78  }
79  else {
80  mdtHit.DriftSpace = 0;
81  mdtHit.DriftSigma = 0;
82  }
83 
84 }

◆ 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 112 of file MuFastPatternFinder.cxx.

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

◆ 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 90 of file MuFastPatternFinder.cxx.

95 {
96  ATH_CHECK( findPatterns(muonRoad, mdtHits, v_trackPatterns) );
97  ATH_CHECK( m_nswPatternFinder->findPatterns(muonRoad, stgcHits, mmHits, v_trackPatterns.back()) );
98 
99  for(unsigned int i_hit=0; i_hit<v_trackPatterns.back().stgcSegment.size(); i_hit++) {
100  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);
101  }
102 
103  for(unsigned int i_hit=0; i_hit<v_trackPatterns.back().mmSegment.size(); i_hit++) {
104  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);
105  }
106 
107  return StatusCode::SUCCESS;
108 
109 }

◆ 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:
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:129
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
IDTPM::R
float R(const U &p)
Definition: TrackParametersHelper.h:101
MdtCalibInput
Definition: MdtCalibInput.h:27
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
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:306
TrigL2MuonSA::MdtLayerHits
Definition: MuFastPatternFinder.h:26
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:92
xAOD::L2MuonParameters::MaxChamber
@ MaxChamber
Number of measurement point definitions.
Definition: TrigMuonDefs.h:27
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
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
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
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:191
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
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
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
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:112
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:616
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
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:790
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