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

#include <RpcPatFinder.h>

Inheritance diagram for TrigL2MuonSA::RpcPatFinder:
Collaboration diagram for TrigL2MuonSA::RpcPatFinder:

Public Member Functions

void addHit (const std::string &stationName, int stationEta, bool measuresPhi, unsigned int gasGap, unsigned int doubletR, double gPosX, double gPosY, double gPosZ, TrigL2MuonSA::RpcLayerHits &rpcLayerHits) const
 
bool findPatternEta (std::array< std::reference_wrapper< double >, 3 > &result_aw, std::array< std::reference_wrapper< double >, 3 > &result_bw, const TrigL2MuonSA::RpcLayerHits &rpcLayerHits) const
 
bool findPatternPhi (double &phi_middle, double &phi_outer, const TrigL2MuonSA::RpcLayerHits &rpcLayerHits) const
 
 AthAlgTool (const std::string &type, const std::string &name, const IInterface *parent)
 Constructor with parameters: More...
 
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, V, H > &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

bool deltaOK (int l1, int l2, double x1, double x2, int isphi, double &delta) const
 
double calibR (const std::string &stationName, double R, double Phi) const
 
void abcal (const std::bitset< 8 > &result_pat, const std::array< size_t, 8 > &index, std::array< std::reference_wrapper< double >, 3 > &aw, std::array< std::reference_wrapper< double >, 3 > &bw, const TrigL2MuonSA::RpcLayerHits &rpcLayerHits) const
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

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 37 of file RpcPatFinder.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Member Function Documentation

◆ abcal()

void TrigL2MuonSA::RpcPatFinder::abcal ( const std::bitset< 8 > &  result_pat,
const std::array< size_t, 8 > &  index,
std::array< std::reference_wrapper< double >, 3 > &  aw,
std::array< std::reference_wrapper< double >, 3 > &  bw,
const TrigL2MuonSA::RpcLayerHits rpcLayerHits 
) const
private

Calculate inner and middle coefficients

Inner

Middle

Calculate outer coefficients

Definition at line 355 of file RpcPatFinder.cxx.

359  {
360  const float ZERO_LIMIT = 1.e-5;
361  const std::vector<std::vector<double>>& rpc_R {rpcLayerHits.hits_in_layer_R};
362  const std::vector<std::vector<double>>& rpc_Z {rpcLayerHits.hits_in_layer_Z};
363 
364  // doublet companion
365  auto getCompanion = [](const int& l) -> int {
366  return (l%2==0) ? l+1 : l-1;
367  };
368 
369  auto getAvgRZ= [&rpc_R, &rpc_Z, &result_pat, &index]
370  (double& R, double& Z, const int& l, const int& companion) -> void {
371 
372  if (result_pat.test(companion)){
373  R = (rpc_R.at(l).at(index[l]) + rpc_R.at(companion).at(index[companion])) / 2.0;
374  Z = (rpc_Z.at(l).at(index[l]) + rpc_Z.at(companion).at(index[companion])) / 2.0;
375  return;
376  }
377  R = rpc_R.at(l).at(index[l]);
378  Z = rpc_Z.at(l).at(index[l]);
379  };
380 
382  int l1 {4}, l2 {0};
383  double R1{0}, R2{0}, Z1{0}, Z2{0};
384  for(int i=0; i<4; i++){
385  if(!result_pat.test(i)) continue;
386  l1 = std::min(l1, i);
387  l2 = std::max(l2, i);
388  }
389  const int comp1{getCompanion(l1)}, comp2{getCompanion(l2)};
390  if (l1 != 4 and l1 != l2 and l2 != comp1){// we have two hits in BM and not in the same doublet
391 
392  getAvgRZ(R1, Z1, l1, comp1);
393  getAvgRZ(R2, Z2, l2, comp2);
394 
396  if(((result_pat & std::bitset<8>("00001111")).count() > 3) and std::abs(Z2-Z1) > ZERO_LIMIT){
397 
398  double theta_m {std::atan2(R1, Z1)};
399  double theta_t {std::atan2(R2-R1, Z2-Z1)};
400  double theta_f {(theta_m+theta_t)/2.};
401 
402  aw[0].get() = std::tan(theta_f);
403  bw[0].get() = R1 - Z1*aw[0].get();
404 
405  }else{
406  aw[0].get() = R1/Z1;
407  bw[0].get() = 0.;
408  }
409 
411  if (std::abs(Z2-Z1) > ZERO_LIMIT){
412  aw[1].get() = (R2-R1)/(Z2-Z1);
413  bw[1].get() = R2 - Z2*aw[1].get();
414  }
415  else{// if hits have very close z, we use only the earlier hit
416  aw[1].get() = R1/Z1;
417  bw[1].get() = 0.;
418  }
419  }
420  else if (l1 != 4){// either we have two hits in the same doublet or only one hit
421  getAvgRZ(R1, Z1, l1, comp1);
422  aw[0].get() = R1/Z1;
423  bw[0].get() = 0.;
424  aw[1].get() = aw[0].get();
425  bw[1].get() = 0.;
426 
427  }// if no hits in BM, we will extrapolate the inner and BM slope using the first hit in BO
428 
430  int l3 = 8, l4 = 0;
431  double R3{0}, R4{0}, Z3{0}, Z4{0};
432  for(int i=2; i<8; i++){
433  if(!result_pat.test(i)) continue;
434  l3 = std::min(l3, i);
435  l4 = std::max(l4, i);
436  }
437  const int comp3{getCompanion(l3)}, comp4{getCompanion(l4)};
438  if ( l3 != 8 and l3 != l4 and l4 != comp3){
439 
440  getAvgRZ(R3, Z3, l3, comp3);
441  getAvgRZ(R4, Z4, l4, comp4);
442 
443  if (std::abs(Z4-Z3) > ZERO_LIMIT){
444  aw[2].get() = (R4-R3)/(Z4-Z3);
445  bw[2].get() = R4 - Z4*aw[2].get();
446  }
447  else{// hits with very close Z, we use onl one hit.
448  aw[2].get() = R4/Z4;
449  bw[2].get() = 0.;
450  }
451  }
452  else if (l3 != 8){ // we have only one hit or they are in the same doublet
453  getAvgRZ(R3, Z3, l3, comp3);
454  aw[2].get() = R3/Z3;
455  bw[2].get() = 0.;
456  }// if no hits in outer layers, we will extrapolate the outer slope using the last hit in BM
457 
458  if (std::abs(aw[0].get()) < ZERO_LIMIT){ // if no hits in BM, we use the first in in BO
459  getAvgRZ(R3, Z3, l3, comp3);
460  aw[0].get() = R3/Z3;
461  aw[1].get() = aw[0].get();
462  }
463  if (std::abs(aw[2].get()) < ZERO_LIMIT){ // if no hits in outer layers, we use the last in BM
464  getAvgRZ(R2, Z2, l2, comp2);
465  aw[2].get() = R2/Z2;
466  }
467 
468 
469 }//abcal()

◆ addHit()

void TrigL2MuonSA::RpcPatFinder::addHit ( const std::string &  stationName,
int  stationEta,
bool  measuresPhi,
unsigned int  gasGap,
unsigned int  doubletR,
double  gPosX,
double  gPosY,
double  gPosZ,
TrigL2MuonSA::RpcLayerHits rpcLayerHits 
) const

Definition at line 22 of file RpcPatFinder.cxx.

30  {
31 
32  int ilay=0;
33  // BO
34  if (stationName.substr(0,2)=="BO") ilay=4;
35  // doubletR
36  ilay+=2*(doubletR-1);
37  // BML7 special chamber with 1 RPC doublet (doubletR=1 but RPC2) :
38  if (stationName.substr(0,3)=="BML" && stationEta==7) ilay+=2;
39  // gasGap
40  ilay+=gasGap-1;
41 
42  double R=std::sqrt(gPosX*gPosX+gPosY*gPosY);
43  const double Phi=std::atan2(gPosY,gPosX);
44 
45  if (!measuresPhi){
46  // if eta measurement then save Z/R
47  R = calibR(stationName,R, Phi);
48  double x=gPosZ/R;
49  rpcLayerHits.hits_in_layer_eta.at(ilay).push_back(x);
50  rpcLayerHits.hits_in_layer_R.at(ilay).push_back(R);//mod!
51  rpcLayerHits.hits_in_layer_Z.at(ilay).push_back(gPosZ);//mod!
52  }else{
53  // if phi measurement then save phi
54  rpcLayerHits.hits_in_layer_phi.at(ilay).push_back(Phi);
55  }
56 }

◆ AthAlgTool()

AthAlgTool::AthAlgTool

Constructor with parameters:

Definition at line 31 of file AthAlgTool.cxx.

18  :
20 {
21 }

◆ calibR()

double TrigL2MuonSA::RpcPatFinder::calibR ( const std::string &  stationName,
double  R,
double  Phi 
) const
private

Definition at line 326 of file RpcPatFinder.cxx.

326  {
327  double DeltaPhi, temp_phi;
328  double calibPhi = std::acos(std::cos(Phi)); // 0 < Phi < 2PI
329 
330  if(std::string::npos != stationName.rfind('L')){//For Large , SP
331  DeltaPhi= 999; temp_phi=9999;
332  for(int inum=0;inum < 8;inum++){
333  temp_phi = std::abs((inum * M_PI/4.0 )- calibPhi);
334  if(temp_phi < DeltaPhi) DeltaPhi = temp_phi;
335  }
336  }else if(std::string::npos != stationName.rfind('S') ||
337  std::string::npos != stationName.rfind('F') ||
338  std::string::npos != stationName.rfind('G') ){
339  DeltaPhi= 999; temp_phi=9999;
340 
341  for(int inum=0;inum < 8;inum++){
342  temp_phi = std::abs(inum *(M_PI/4.0 )+(M_PI/8.0) - calibPhi);
343  if(temp_phi < DeltaPhi) DeltaPhi = temp_phi;
344  }//for end
345  }else return R;
346 
347  double calibR = R *std::cos(DeltaPhi);
348 
349  return calibR;
350 }//calbR()

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > &  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, V, H > &  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, V, H > &  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, V, H > &  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, V, H > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

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

◆ deltaOK()

bool TrigL2MuonSA::RpcPatFinder::deltaOK ( int  l1,
int  l2,
double  x1,
double  x2,
int  isphi,
double &  delta 
) const
private

Definition at line 253 of file RpcPatFinder.cxx.

253  {
254 
255 
256  // ROAD tuned for ~20 GeV
257  /*
258  double delta_gasgap_eta = 0.004;
259  double delta_lowpt_eta = 0.005;
260  double delta_highpt_eta = 0.012;
261  double delta_feet_eta = 0.02;
262 
263  double delta_gasgap_phi = 0.004;
264  double delta_lowpt_phi = 0.005;
265  double delta_highpt_phi = 0.008;
266  double delta_feet_phi = 0.02;
267  */
268 
269  //OPEN road
270 
271  const double delta_gasgap_eta = 0.01;
272  const double delta_lowpt_eta = 0.05;
273  const double delta_highpt_eta = 0.1;
274  const double delta_feet_eta = 0.05;
275 
276  const double delta_gasgap_phi = 0.01;
277  const double delta_lowpt_phi = 0.03;
278  const double delta_highpt_phi = 0.04;
279  const double delta_feet_phi = 0.03;
280 
281  // calculate delta-eta or delta-phi
282  if(isphi) delta=std::abs(std::acos(std::cos(x2-x1)));
283  else delta=std::abs(x2-x1);
284 
285  double delta_max=0;
286  if (l1>l2) {
287  int tmp=l2;
288  l2=l1;
289  l1=tmp;
290  }
291  // calculate delta_max
292  if (isphi){
293  if (l2-l1==1&&(l1==0||l1==2||l1==4||l1==6)){
294  delta_max=delta_gasgap_phi;
295  } else if (l1<2&&l2<4) {
296  delta_max=delta_lowpt_phi;
297  }else if (l1<4&&l2>=4) {
298  delta_max=delta_highpt_phi;
299  }else if (l1<6&&l1>=4&&l2>=6) {
300  delta_max=delta_feet_phi;
301  }
302  } else {
303  if (l2-l1==1&&(l1==0||l1==2||l1==4||l1==6)){
304  delta_max=delta_gasgap_eta;
305  } else if (l1<2&&l2>=2&&l2<4) {
306  delta_max=delta_lowpt_eta;
307  }else if (l1<4&&l2>=4) {
308  delta_max=delta_highpt_eta;
309  }else if (l1<6&&l1>=4&&l2>=6) {
310  delta_max=delta_feet_eta;
311  }
312  }
313 
314  // evaluate the result
315 
316  bool OK=false;
317  if (delta<delta_max) OK=true;
318 
319  return OK;
320 
321 }

◆ 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; }

◆ 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

◆ findPatternEta()

bool TrigL2MuonSA::RpcPatFinder::findPatternEta ( std::array< std::reference_wrapper< double >, 3 > &  result_aw,
std::array< std::reference_wrapper< double >, 3 > &  result_bw,
const TrigL2MuonSA::RpcLayerHits rpcLayerHits 
) const

Definition at line 61 of file RpcPatFinder.cxx.

64  {
65 
66  const std::vector<std::vector<double>>& rpc_x {rpcLayerHits.hits_in_layer_eta};
67 
68  int layer_end {5};
69  if(rpc_x.at(6).size()+rpc_x.at(7).size() >0) layer_end = 7;//special "feet" towers
70 
71  // reset parameters
72  std::bitset<8> result_pat{};
73  double result_dMM{9999}, result_dMO{9999};
74  int nHits_pat{0};
75  std::array<size_t, 8> result_index{};
76 
77  // Loop on start layer
78  for (int l_start=0; l_start<layer_end; l_start++){
79  // Loop on hits of start layer, for each hit try a new pattern
80  for (size_t i_start = 0; i_start < rpc_x.at(l_start).size(); ++i_start){
81 
82  // Initialize a new pattern
83  int nHits=1;
84  std::bitset<8> pat (1<<l_start); // bit pattern of hit layers
85  std::array<size_t, 8> index {};
86  index[l_start] = i_start;
87  double dMO{9999}; // lowest deltaX between two consecutive hits, when having at least one of the two hit in BO
88  double dMM{9999}; // lowest deltaX between two consecutive hits, when having both hits in BM, or both in BO (but different doublets)
89 
90  int current_l = l_start;
91  double current_x = rpc_x.at(l_start).at(i_start); // set current_x to the starting hit
92 
93  // ----- add compatible hits in other layers ----//
94  // loop on test layers:
95  for (int l_test=l_start+1; l_test<=layer_end; l_test++){
96  double min_delta {999}; // min deltaX in this test laeyr
97  const std::vector<double>& test_layer_hits {rpc_x.at(l_test)};
98 
99  for (size_t i_test = 0; i_test < test_layer_hits.size(); ++i_test){
100  double delta=-1;
101  // check if within the road
102  if (deltaOK(current_l,l_test,current_x, test_layer_hits.at(i_test),false,delta)){
103  // if closest hit we keep it as best hit for this test layer
104  if (delta < min_delta) {
105  min_delta = delta;
106  index[l_test] = i_test;
107  }
108  }
109  }
110  if (min_delta < 998){ //we found at least one hit in the window
111  current_l = l_test;
112  current_x = test_layer_hits.at(index[l_test]);
113  nHits+=1;
114  pat.set(l_test);
115  dMO = (l_start<4 and l_test>=4) ? std::min(dMO, min_delta) : dMO;
116  dMM = (l_start<2 and l_test>=2 and l_test<4) or (l_start>=4 and l_start<5 and l_test>=6) ? std::min(dMM, min_delta) : dMM;
117  }
118  }//for l_test
119 
120  // if longest pattern found, update result
121  if (nHits>nHits_pat) {
122  nHits_pat=nHits;
123  result_pat=pat;
124  result_dMO=dMO;
125  result_dMM=dMM;
126  result_index=index;
127  }else if (nHits==nHits_pat) {
128  // if same lenght but smallest dMM/dMO, update result
129  if (dMM<result_dMM or (dMM==result_dMM and dMO<result_dMO)){
130  result_pat=pat;
131  result_dMO=dMO;
132  result_dMM=dMM;
133  result_index=index;
134  }
135  }
136  }//for i_start
137  }//for l_start
138 
139  if (nHits_pat>=2) {
140  abcal(result_pat, result_index, result_aw, result_bw, rpcLayerHits);
141  if(msgLevel(MSG::DEBUG)){
142  std::ostringstream ossR, ossZ;
143  bool isFirst{true};
144  for (int i=0; i<8; ++i){
145  if(result_pat.test(i)){
146  if (isFirst){
147  ossR << rpcLayerHits.hits_in_layer_R.at(i).at(result_index[i]);
148  ossZ << rpcLayerHits.hits_in_layer_Z.at(i).at(result_index[i]);
149  isFirst=false;
150  }else{
151  ossR << "," << rpcLayerHits.hits_in_layer_R.at(i).at(result_index[i]);
152  ossZ << "," << rpcLayerHits.hits_in_layer_Z.at(i).at(result_index[i]);
153  }
154  }
155  }
156  std::ostringstream oss;
157  std::copy(result_index.begin(), result_index.end(), std::ostream_iterator<int>(oss, " "));
158  ATH_MSG_DEBUG("patfinder: BEST pat= " << result_pat << " nHit: " << nHits_pat << " Idx: " << oss.str()
159  <<" dMM= "<<result_dMM <<" dMO= "<<result_dMO << " R_hits: " << ossR.str() << " Z_hits: " << ossZ.str()
160  <<" Slopes: " << result_aw[0] << "," << result_aw[1] << "," << result_aw[2] << " Offsets: " << result_bw[0] << "," << result_bw[1] << "," << result_bw[2]);
161  }
162  return true;
163  }
164  return false;
165 }

◆ findPatternPhi()

bool TrigL2MuonSA::RpcPatFinder::findPatternPhi ( double &  phi_middle,
double &  phi_outer,
const TrigL2MuonSA::RpcLayerHits rpcLayerHits 
) const

Definition at line 169 of file RpcPatFinder.cxx.

171  {
172  const int N_layers=8;
173 
174  const std::vector<std::vector<double>>& rpc_phi {rpcLayerHits.hits_in_layer_phi};
175 
176  int l_start_max=2; //max layer of first hit
177  if (rpc_phi.at(6).size()+rpc_phi.at(7).size()>0) l_start_max=5; // special "feet" towers
178 
179  // reset parameters
180  phi_middle=0;
181  phi_outer=0;
182  double result_dMM{9999}, result_dMO{9999};
183  int nHits_pat=0;
184 
185  // Loop on start layer
186  for (int l_start=0; l_start<=l_start_max; l_start++){
187  // Loop on hits of start layer, for each hit try a new pattern
188  for (const double& phi_start : rpc_phi.at(l_start)){
189  // Initialize a new pattern
190  int nHits=1;
191  double dMO{9999}; // lowest deltaX between two consecutive hits, when having at least one of the two hit in BO
192  double dMM{9999}; // lowest deltaX between two consecutive hits, when having both hits in BM, or both in BO (but different doublets)
193 
194  int current_l = l_start;
195  double current_phi = phi_start; // set current_x to the starting hit
196 
197  // ----- add compatible hits in other layers ----//
198  // loop on test layers:
199  for (int l_test=l_start+1; l_test<N_layers; l_test++){
200  double min_delta {999}; // min deltaX in this test laeyr
201  double layer_phi {0.};
202 
203  for (const double& phi_test : rpc_phi.at(l_test)){
204  double delta=-1;
205  // check if within the road
206  if (deltaOK(current_l,l_test,current_phi, phi_test,true,delta)){
207  // if closest hit we keep it as best hit for this test layer
208  if (delta < min_delta) {
209  min_delta = delta;
210  layer_phi = phi_test;
211  }
212  }
213  }
214  if (min_delta < 998){ //we found at least one hit in the window
215  current_l = l_test;
216  current_phi = layer_phi;
217  nHits+=1;
218  dMO = (l_start<4 and l_test>=4) ? std::min(dMO, min_delta) : dMO;
219  dMM = (l_start<2 and l_test>=2 and l_test<4) or (l_start>=4 and l_start<5 and l_test>=6) ? std::min(dMM, min_delta) : dMM;
220  }
221  }
222 
223  // if longest pattern found and the last hit is in a layer > BM doublet1, update result
224  if (nHits>nHits_pat and current_l > 1) {
225  nHits_pat=nHits;
226  result_dMO=dMO;
227  result_dMM=dMM;
228  phi_middle=phi_start;
229  phi_outer=current_phi;
230  }else if (nHits==nHits_pat and current_l > 1) {
231  // if same lenght but smallest dMM/dMO, update result
232  if (dMM<result_dMM or (dMM==result_dMM and dMO<result_dMO)){
233  result_dMO=dMO;
234  result_dMM=dMM;
235  phi_middle=phi_start;
236  phi_outer=current_phi;
237  }
238  }
239  }//for i_start
240  }//for l_start
241 
242  if (nHits_pat>2) {
243  ATH_MSG_DEBUG("patfinder: BEST phi path dMM= "<<result_dMM <<" dMO= "<<result_dMO
244  <<" phi_middle= "<<phi_middle <<" phi_outer= "<<phi_outer);
245  return true;
246  }
247  return false;
248 }

◆ 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_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::RpcLayerHits::hits_in_layer_phi
std::vector< std::vector< double > > hits_in_layer_phi
Definition: RpcPatFinder.h:22
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:215
dumpTgcDigiDeadChambers.gasGap
list gasGap
Definition: dumpTgcDigiDeadChambers.py:33
dumpTgcDigiDeadChambers.stationName
dictionary stationName
Definition: dumpTgcDigiDeadChambers.py:30
index
Definition: index.py:1
Monitored::Z
@ Z
Definition: HistogramFillerUtils.h:24
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
plotBeamSpotCompare.x2
x2
Definition: plotBeamSpotCompare.py:217
createCablingJSON.doubletR
int doubletR
Definition: createCablingJSON.py:15
M_PI
#define M_PI
Definition: ActiveFraction.h:11
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
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:157
Phi
@ Phi
Definition: RPCdef.h:8
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
x
#define x
TrigL2MuonSA::RpcLayerHits::hits_in_layer_Z
std::vector< std::vector< double > > hits_in_layer_Z
Definition: RpcPatFinder.h:23
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
XMLtoHeader.count
count
Definition: XMLtoHeader.py:84
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
TrigL2MuonSA::RpcPatFinder::abcal
void abcal(const std::bitset< 8 > &result_pat, const std::array< size_t, 8 > &index, std::array< std::reference_wrapper< double >, 3 > &aw, std::array< std::reference_wrapper< double >, 3 > &bw, const TrigL2MuonSA::RpcLayerHits &rpcLayerHits) const
Definition: RpcPatFinder.cxx:355
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
skel.l2
l2
Definition: skel.GENtoEVGEN.py:410
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition: AthCommonDataStore.h:145
TrigL2MuonSA::RpcLayerHits::hits_in_layer_eta
std::vector< std::vector< double > > hits_in_layer_eta
Definition: RpcPatFinder.h:21
test_pyathena.parent
parent
Definition: test_pyathena.py:15
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
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
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
ZERO_LIMIT
const float ZERO_LIMIT
Definition: VP1TriggerHandleL2.cxx:37
TrigL2MuonSA::RpcPatFinder::calibR
double calibR(const std::string &stationName, double R, double Phi) const
Definition: RpcPatFinder.cxx:326
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
dso-stats.pat
pat
Definition: dso-stats.py:37
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
DeMoScan.index
string index
Definition: DeMoScan.py:362
a
TList * a
Definition: liststreamerinfos.cxx:10
h
TrigL2MuonSA::RpcPatFinder::deltaOK
bool deltaOK(int l1, int l2, double x1, double x2, int isphi, double &delta) const
Definition: RpcPatFinder.cxx:253
DEBUG
#define DEBUG
Definition: page_access.h:11
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:629
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:801
calibdata.copy
bool copy
Definition: calibdata.py:26
skel.l1
l1
Definition: skel.GENtoEVGEN.py:409
Muon::nsw::STGTPSegments::moduleIDBits::stationEta
constexpr uint8_t stationEta
1 to 3
Definition: NSWSTGTPDecodeBitmaps.h:159
TrigL2MuonSA::RpcLayerHits::hits_in_layer_R
std::vector< std::vector< double > > hits_in_layer_R
Definition: RpcPatFinder.h:24
fitman.k
k
Definition: fitman.py:528