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

#include <TgcDataPreparator.h>

Inheritance diagram for TrigL2MuonSA::TgcDataPreparator:
Collaboration diagram for TrigL2MuonSA::TgcDataPreparator:

Classes

struct  tgcRawData
 

Public Member Functions

 TgcDataPreparator (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual StatusCode initialize () override
 
StatusCode prepareData (const LVL1::RecMuonRoI *p_roi, TrigL2MuonSA::TgcHits &tgcHits) const
 
StatusCode prepareData (const xAOD::MuonRoI *p_roi, TrigL2MuonSA::TgcHits &tgcHits) const
 
void setOptions (const TrigL2MuonSA::TgcDataPreparatorOptions &options)
 
void setRoIBasedDataAccess (bool use_RoIBasedDataAccess)
 
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

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

ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
 
TrigL2MuonSA::TgcDataPreparatorOptions m_options {}
 
TrigL2MuonSA::RecMuonRoIUtils m_recMuonRoIUtils {}
 
SG::ReadHandleKey< Muon::TgcPrepDataContainerm_tgcContainerKey
 
bool m_use_RoIBasedDataAccess = false
 
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 29 of file TgcDataPreparator.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

◆ TgcDataPreparator()

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

Definition at line 13 of file TgcDataPreparator.cxx.

15  :
17 {
18 }

Member Function Documentation

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

◆ 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

◆ initialize()

StatusCode TrigL2MuonSA::TgcDataPreparator::initialize ( )
overridevirtual

Definition at line 23 of file TgcDataPreparator.cxx.

24 {
25  ATH_CHECK(m_idHelperSvc.retrieve());
26 
27  ATH_CHECK(m_tgcContainerKey.initialize());
28 
29  return StatusCode::SUCCESS;
30 }

◆ 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.

◆ prepareData() [1/2]

StatusCode TrigL2MuonSA::TgcDataPreparator::prepareData ( const LVL1::RecMuonRoI p_roi,
TrigL2MuonSA::TgcHits tgcHits 
) const

Definition at line 35 of file TgcDataPreparator.cxx.

37 {
38  float roi_eta = p_roi->eta();
39  float roi_phi = p_roi->phi();
40  if (roi_phi < 0) roi_phi += 2.0 * M_PI;
41 
42  //const Muon::TgcPrepDataContainer* tgcPrepContainer = 0;
43  const Muon::TgcPrepDataContainer* tgcPrepContainer;
44  int gasGap;
45  int channel;
46 
47  const bool isLowPt = m_recMuonRoIUtils.isLowPt(p_roi);
48 
49  // Select the eta cut based on ROI Pt.
50  const double mid_eta_test = (isLowPt) ? m_options.roadParameters().deltaEtaAtMiddleForLowPt()
52  const double inn_eta_test = (isLowPt) ? m_options.roadParameters().deltaEtaAtInnerForLowPt()
54  const double mid_phi_test = m_options.roadParameters().deltaPhiAtMiddle();
55  const double inn_phi_test = m_options.roadParameters().deltaPhiAtInner();
56 
57  auto tgcContainerHandle = SG::makeHandle(m_tgcContainerKey);
58  tgcPrepContainer = tgcContainerHandle.cptr();
59  if (!tgcContainerHandle.isValid()) {
60  ATH_MSG_ERROR("Could not retrieve PrepDataContainer key:" << m_tgcContainerKey.key());
61  return StatusCode::FAILURE;
62  } else {
63  ATH_MSG_DEBUG("Retrieved PrepDataContainer: " << tgcPrepContainer->numberOfCollections());
64  }
65 
66  //Find closest wires in Middle
67  float min_dphi_wire=1000.;
68  float second_dphi_wire=1000.;
69  std::vector<float> ov_dphi;
70  ov_dphi.clear();
71  for( const Muon::TgcPrepDataCollection* wi : *tgcPrepContainer ) { // loop over collections
72  if( !wi ) continue;
73  for( const Muon::TgcPrepData* cwi : *wi ){ // loop over data in the collection
74  if( !cwi ) continue;
75  const Muon::TgcPrepData& prepDataWi = *cwi;
76  if (!m_idHelperSvc->tgcIdHelper().isStrip(prepDataWi.identify())) {//wire
77  int stationNumWi = m_idHelperSvc->tgcIdHelper().stationRegion(prepDataWi.identify())-1;
78  if (stationNumWi==-1) stationNumWi=3;
79  if (stationNumWi<3 && std::abs(prepDataWi.globalPosition().eta() - roi_eta) < mid_eta_test ) {
80  const float dphi = std::acos(std::cos(prepDataWi.globalPosition().phi()-roi_phi));
81  bool overlap=false;
82  for (unsigned int ov=0;ov<ov_dphi.size();ov++)
83  if (std::abs(dphi-ov_dphi[ov])<1e-5) overlap=true;
84  if (overlap) continue;
85  ov_dphi.push_back(dphi);
86  if (dphi<second_dphi_wire){
87  second_dphi_wire=dphi;
88  }
89  if (dphi<min_dphi_wire) {
90  second_dphi_wire=min_dphi_wire;
91  min_dphi_wire=dphi;
92  }
93  }
94  }
95  }
96  }
97 
98  //Check if there are enough number of hits
99  int num_min_hits=0;
100  int num_second_hits=0;
101  for( const Muon::TgcPrepDataCollection* hit : *tgcPrepContainer ) { // loop over collections
102  if( !hit ) continue;
103  for( const Muon::TgcPrepData* chit : *hit ){ // loop over data in the collection
104  if( !chit ) continue;
105  const Muon::TgcPrepData& prepDataHit = *chit;
106  if (!m_idHelperSvc->tgcIdHelper().isStrip(prepDataHit.identify())) {//strip
107  int stationNumHit = m_idHelperSvc->tgcIdHelper().stationRegion(prepDataHit.identify())-1;
108  if (stationNumHit==-1) stationNumHit=3;
109  if (stationNumHit<3 && std::abs(prepDataHit.globalPosition().eta() - roi_eta) < mid_eta_test ) {
110  const float dphi = std::acos(std::cos(prepDataHit.globalPosition().phi()-roi_phi));
111  if (std::abs(dphi-min_dphi_wire)<1e-5) num_min_hits++;
112  if (std::abs(dphi-second_dphi_wire)<1e-5) num_second_hits++;
113  }
114  }
115  }
116  }
117 
118  float dphi_wire=min_dphi_wire;
119  bool useDefault=false;
120  if (num_min_hits<5) {
121  if (num_second_hits>5) dphi_wire=second_dphi_wire;
122  else useDefault=true;
123  }
124 
125  for( const Muon::TgcPrepDataCollection* col : *tgcPrepContainer ) { // loop over collections
126  if( !col ) continue;
127  for( const Muon::TgcPrepData* cit : *col ){ // loop over data in the collection
128  if( !cit ) continue;
129  const Muon::TgcPrepData& prepData = *cit;
130 
131  bool isInRoad = false;
132  int stationNum = m_idHelperSvc->tgcIdHelper().stationRegion(prepData.identify())-1;
133  if (stationNum==-1) stationNum=3;
134  if (m_idHelperSvc->tgcIdHelper().isStrip(prepData.identify())) {
135  double dphi = std::abs(prepData.globalPosition().phi() - roi_phi);
136  if( dphi > M_PI*2 ) dphi = dphi - M_PI*2;
137  if( dphi > M_PI ) dphi = M_PI*2 - dphi;
138  // For strips, apply phi cut
139  if ( stationNum < 3 && dphi < mid_phi_test ) { isInRoad = true; }
140  else if( stationNum == 3 && dphi < inn_phi_test ) { isInRoad = true; }
141  }
142  else {
143  // For wires, apply eta cut.
144  const float dphi = std::acos(std::cos(prepData.globalPosition().phi()-roi_phi));
145  if ( stationNum < 3 && std::abs(prepData.globalPosition().eta() - roi_eta) < mid_eta_test ) {
146  if (useDefault) isInRoad = true;//default
147  else if (std::abs(dphi-dphi_wire)<1e-5) isInRoad = true;//for close-by muon
148  }
149  else if( stationNum == 3 && std::abs(prepData.globalPosition().eta() - roi_eta) < inn_eta_test ) { isInRoad = true; }
150  }
151  if( ! isInRoad ) continue;
152 
153  const MuonGM::TgcReadoutElement* tgcReadout = prepData.detectorElement();
154  gasGap = m_idHelperSvc->tgcIdHelper().gasGap(prepData.identify());
155  channel = m_idHelperSvc->tgcIdHelper().channel(prepData.identify());
156 
157  TrigL2MuonSA::TgcHitData lutDigit;
158 
159  lutDigit.eta = prepData.globalPosition().eta();
160  lutDigit.phi = prepData.globalPosition().phi();
161  lutDigit.r = prepData.globalPosition().perp();
162  lutDigit.z = prepData.globalPosition().z();
163  lutDigit.sta = stationNum;
164  lutDigit.isStrip = m_idHelperSvc->tgcIdHelper().isStrip(prepData.identify());
165  if(m_idHelperSvc->tgcIdHelper().isStrip(prepData.identify())){
166  lutDigit.width = tgcReadout->stripWidth(gasGap, channel);
167  }
168  else{
169  lutDigit.width = tgcReadout->gangRadialLength(gasGap, channel);
170  }
171  lutDigit.bcTag = 2;
172  lutDigit.inRoad = false;
173 
174 
175  tgcHits.push_back(lutDigit);
176 
177  }
178  }
179 
180  return StatusCode::SUCCESS;
181 }

◆ prepareData() [2/2]

StatusCode TrigL2MuonSA::TgcDataPreparator::prepareData ( const xAOD::MuonRoI p_roi,
TrigL2MuonSA::TgcHits tgcHits 
) const

Definition at line 186 of file TgcDataPreparator.cxx.

188 {
189  float roi_eta = p_roi->eta();
190  float roi_phi = p_roi->phi();
191  if (roi_phi < 0) roi_phi += 2.0 * M_PI;
192 
193  //const Muon::TgcPrepDataContainer* tgcPrepContainer = 0;
194  const Muon::TgcPrepDataContainer* tgcPrepContainer;
195  int gasGap;
196  int channel;
197 
198  const bool isLowPt = m_recMuonRoIUtils.isLowPt(p_roi);
199 
200  // Select the eta cut based on ROI Pt.
201  const double mid_eta_test = (isLowPt) ? m_options.roadParameters().deltaEtaAtMiddleForLowPt()
203  const double inn_eta_test = (isLowPt) ? m_options.roadParameters().deltaEtaAtInnerForLowPt()
205  const double mid_phi_test = m_options.roadParameters().deltaPhiAtMiddle();
206  const double inn_phi_test = m_options.roadParameters().deltaPhiAtInner();
207 
208  auto tgcContainerHandle = SG::makeHandle(m_tgcContainerKey);
209  tgcPrepContainer = tgcContainerHandle.cptr();
210  if (!tgcContainerHandle.isValid()) {
211  ATH_MSG_ERROR("Could not retrieve PrepDataContainer key:" << m_tgcContainerKey.key());
212  return StatusCode::FAILURE;
213  } else {
214  ATH_MSG_DEBUG("Retrieved PrepDataContainer: " << tgcPrepContainer->numberOfCollections());
215  }
216 
217  //Find closest wires in Middle
218  float min_dphi_wire=1000.;
219  float second_dphi_wire=1000.;
220  std::vector<float> ov_dphi;
221  ov_dphi.clear();
222  for( const Muon::TgcPrepDataCollection* wi : *tgcPrepContainer ) { // loop over collections
223  if( !wi ) continue;
224  for( const Muon::TgcPrepData* cwi : *wi ){ // loop over data in the collection
225  if( !cwi ) continue;
226  const Muon::TgcPrepData& prepDataWi = *cwi;
227  if (!m_idHelperSvc->tgcIdHelper().isStrip(prepDataWi.identify())) {//wire
228  int stationNumWi = m_idHelperSvc->tgcIdHelper().stationRegion(prepDataWi.identify())-1;
229  if (stationNumWi==-1) stationNumWi=3;
230  if (stationNumWi<3 && std::abs(prepDataWi.globalPosition().eta() - roi_eta) < mid_eta_test ) {
231  const float dphi = std::acos(std::cos(prepDataWi.globalPosition().phi()-roi_phi));
232  bool overlap=false;
233  for (unsigned int ov=0;ov<ov_dphi.size();ov++)
234  if (std::abs(dphi-ov_dphi[ov])<1e-5) overlap=true;
235  if (overlap) continue;
236  ov_dphi.push_back(dphi);
237  if (dphi<second_dphi_wire){
238  second_dphi_wire=dphi;
239  }
240  if (dphi<min_dphi_wire) {
241  second_dphi_wire=min_dphi_wire;
242  min_dphi_wire=dphi;
243  }
244  }
245  }
246  }
247  }
248 
249  //Check if there are enough number of hits
250  int num_min_hits=0;
251  int num_second_hits=0;
252  for( const Muon::TgcPrepDataCollection* hit : *tgcPrepContainer ) { // loop over collections
253  if( !hit ) continue;
254  for( const Muon::TgcPrepData* chit : *hit ){ // loop over data in the collection
255  if( !chit ) continue;
256  const Muon::TgcPrepData& prepDataHit = *chit;
257  if (!m_idHelperSvc->tgcIdHelper().isStrip(prepDataHit.identify())) {//strip
258  int stationNumHit = m_idHelperSvc->tgcIdHelper().stationRegion(prepDataHit.identify())-1;
259  if (stationNumHit==-1) stationNumHit=3;
260  if (stationNumHit<3 && std::abs(prepDataHit.globalPosition().eta() - roi_eta) < mid_eta_test ) {
261  const float dphi = std::acos(std::cos(prepDataHit.globalPosition().phi()-roi_phi));
262  if (std::abs(dphi-min_dphi_wire)<1e-5) num_min_hits++;
263  if (std::abs(dphi-second_dphi_wire)<1e-5) num_second_hits++;
264  }
265  }
266  }
267  }
268 
269  float dphi_wire=min_dphi_wire;
270  bool useDefault=false;
271  if (num_min_hits<5) {
272  if (num_second_hits>5) dphi_wire=second_dphi_wire;
273  else useDefault=true;
274  }
275 
276  for( const Muon::TgcPrepDataCollection* col : *tgcPrepContainer ) { // loop over collections
277  if( !col ) continue;
278  for( const Muon::TgcPrepData* cit : *col ){ // loop over data in the collection
279  if( !cit ) continue;
280  const Muon::TgcPrepData& prepData = *cit;
281 
282  bool isInRoad = false;
283  int stationNum = m_idHelperSvc->tgcIdHelper().stationRegion(prepData.identify())-1;
284  if (stationNum==-1) stationNum=3;
285  if (m_idHelperSvc->tgcIdHelper().isStrip(prepData.identify())) {
286  double dphi = std::abs(prepData.globalPosition().phi() - roi_phi);
287  if( dphi > M_PI*2 ) dphi = dphi - M_PI*2;
288  if( dphi > M_PI ) dphi = M_PI*2 - dphi;
289  // For strips, apply phi cut
290  if ( stationNum < 3 && dphi < mid_phi_test ) { isInRoad = true; }
291  else if( stationNum == 3 && dphi < inn_phi_test ) { isInRoad = true; }
292  }
293  else {
294  // For wires, apply eta cut.
295  const float dphi = std::acos(std::cos(prepData.globalPosition().phi()-roi_phi));
296  if ( stationNum < 3 && std::abs(prepData.globalPosition().eta() - roi_eta) < mid_eta_test ) {
297  if (useDefault) isInRoad = true;//default
298  else if (std::abs(dphi-dphi_wire)<1e-5) isInRoad = true;//for close-by muon
299  }
300  else if( stationNum == 3 && std::abs(prepData.globalPosition().eta() - roi_eta) < inn_eta_test ) { isInRoad = true; }
301  }
302  if( ! isInRoad ) continue;
303 
304  const MuonGM::TgcReadoutElement* tgcReadout = prepData.detectorElement();
305  gasGap = m_idHelperSvc->tgcIdHelper().gasGap(prepData.identify());
306  channel = m_idHelperSvc->tgcIdHelper().channel(prepData.identify());
307 
308  TrigL2MuonSA::TgcHitData lutDigit;
309 
310  lutDigit.eta = prepData.globalPosition().eta();
311  lutDigit.phi = prepData.globalPosition().phi();
312  lutDigit.r = prepData.globalPosition().perp();
313  lutDigit.z = prepData.globalPosition().z();
314  lutDigit.sta = stationNum;
315  lutDigit.isStrip = m_idHelperSvc->tgcIdHelper().isStrip(prepData.identify());
316  if(m_idHelperSvc->tgcIdHelper().isStrip(prepData.identify())){
317  lutDigit.width = tgcReadout->stripWidth(gasGap, channel);
318  }
319  else{
320  lutDigit.width = tgcReadout->gangRadialLength(gasGap, channel);
321  }
322  lutDigit.bcTag = 2;
323  lutDigit.inRoad = false;
324 
325 
326  tgcHits.push_back(lutDigit);
327 
328  }
329  }
330 
331  return StatusCode::SUCCESS;
332 }

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

◆ setOptions()

void TrigL2MuonSA::TgcDataPreparator::setOptions ( const TrigL2MuonSA::TgcDataPreparatorOptions options)
inline

Definition at line 54 of file TgcDataPreparator.h.

54 { m_options = options; };

◆ setRoIBasedDataAccess()

void TrigL2MuonSA::TgcDataPreparator::setRoIBasedDataAccess ( bool  use_RoIBasedDataAccess)
inline

Definition at line 56 of file TgcDataPreparator.h.

56 { m_use_RoIBasedDataAccess = use_RoIBasedDataAccess; };

◆ 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::TgcDataPreparator::m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
private

Definition at line 60 of file TgcDataPreparator.h.

◆ m_options

TrigL2MuonSA::TgcDataPreparatorOptions TrigL2MuonSA::TgcDataPreparator::m_options {}
private

Definition at line 63 of file TgcDataPreparator.h.

◆ m_recMuonRoIUtils

TrigL2MuonSA::RecMuonRoIUtils TrigL2MuonSA::TgcDataPreparator::m_recMuonRoIUtils {}
private

Definition at line 66 of file TgcDataPreparator.h.

◆ m_tgcContainerKey

SG::ReadHandleKey<Muon::TgcPrepDataContainer> TrigL2MuonSA::TgcDataPreparator::m_tgcContainerKey
private
Initial value:
{
this, "TGCPrepDataContainer", "TGC_Measurements", "Name of the TGCContainer to read in"}

Definition at line 68 of file TgcDataPreparator.h.

◆ m_use_RoIBasedDataAccess

bool TrigL2MuonSA::TgcDataPreparator::m_use_RoIBasedDataAccess = false
private

Definition at line 71 of file TgcDataPreparator.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:
ReadFromCoolCompare.ov
ov
Definition: ReadFromCoolCompare.py:230
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
Muon::MuonPrepDataContainer
Template for Muon PRD containers (which are basically collections of MuonPrepDataCollections).
Definition: MuonPrepDataContainer.h:42
TrigL2MuonSA::TgcDataPreparator::m_use_RoIBasedDataAccess
bool m_use_RoIBasedDataAccess
Definition: TgcDataPreparator.h:71
dumpTgcDigiDeadChambers.gasGap
list gasGap
Definition: dumpTgcDigiDeadChambers.py:33
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
TrigL2MuonSA::TgcHitData::sta
int sta
Definition: TgcData.h:34
TrigL2MuonSA::TgcHitData::phi
double phi
Definition: TgcData.h:30
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
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
xAOD::MuonRoI_v1::eta
float eta() const
The pseudorapidity ( ) of the muon candidate.
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
Muon::TgcPrepData::detectorElement
virtual const MuonGM::TgcReadoutElement * detectorElement() const override final
Returns the detector element corresponding to this PRD The pointer will be zero if the det el is not ...
Definition: TgcPrepData.h:120
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
LVL1::RecMuonRoI::eta
virtual double eta() const
returns eta coord of ROI
Definition: RecMuonRoI.h:117
TrigL2MuonSA::TgcDataPreparatorRoadParameters::deltaPhiAtInner
double deltaPhiAtInner() const
Definition: TgcDataPreparatorOptions.h:32
TrigL2MuonSA::TgcHitData::isStrip
bool isStrip
Definition: TgcData.h:35
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:27
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
TrigL2MuonSA::TgcDataPreparatorOptions::roadParameters
const TgcDataPreparatorRoadParameters & roadParameters() const
Definition: TgcDataPreparatorOptions.h:52
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
IdentifiableContainerMT::numberOfCollections
virtual size_t numberOfCollections() const override final
return number of collections
Definition: IdentifiableContainerMT.h:216
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
MuonGM::TgcReadoutElement::stripWidth
double stripWidth(int gasGap, int strip) const
Returns the width of a given strip in the gasGap i.
Definition: MuonDetDescr/MuonReadoutGeometry/src/TgcReadoutElement.cxx:146
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TrigL2MuonSA::TgcDataPreparatorRoadParameters::deltaEtaAtMiddleForLowPt
double deltaEtaAtMiddleForLowPt() const
Definition: TgcDataPreparatorOptions.h:26
MuonGM::TgcReadoutElement
A TgcReadoutElement corresponds to a single TGC chamber; therefore typically a TGC station contains s...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/TgcReadoutElement.h:42
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TrigL2MuonSA::TgcDataPreparator::m_tgcContainerKey
SG::ReadHandleKey< Muon::TgcPrepDataContainer > m_tgcContainerKey
Definition: TgcDataPreparator.h:68
MuonGM::TgcReadoutElement::gangRadialLength
double gangRadialLength(int gasGap, int gang) const
Returns the length of the wire gang along the radial direction [pitch x N_{wire}^{gang}].
Definition: MuonDetDescr/MuonReadoutGeometry/src/TgcReadoutElement.cxx:72
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TrigL2MuonSA::TgcDataPreparatorRoadParameters::deltaEtaAtMiddleForHighPt
double deltaEtaAtMiddleForHighPt() const
Definition: TgcDataPreparatorOptions.h:27
TrigL2MuonSA::TgcHitData
Definition: TgcData.h:14
python.AtlRunQueryLib.options
options
Definition: AtlRunQueryLib.py:379
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
TrigL2MuonSA::TgcHitData::width
double width
Definition: TgcData.h:33
TrigL2MuonSA::TgcDataPreparatorRoadParameters::deltaEtaAtInnerForLowPt
double deltaEtaAtInnerForLowPt() const
Definition: TgcDataPreparatorOptions.h:30
TrigL2MuonSA::TgcHitData::r
double r
Definition: TgcData.h:31
Muon::MuonPrepDataCollection
Template to hold collections of MuonPrepRawData objects.
Definition: MuonPrepDataCollection.h:46
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
TrigL2MuonSA::TgcDataPreparatorRoadParameters::deltaPhiAtMiddle
double deltaPhiAtMiddle() const
Definition: TgcDataPreparatorOptions.h:28
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
LVL1::RecMuonRoI::phi
virtual double phi() const
returns phi coord of ROI
Definition: RecMuonRoI.h:114
Trk::PrepRawData::identify
Identifier identify() const
return the identifier
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
TrigL2MuonSA::TgcDataPreparator::m_options
TrigL2MuonSA::TgcDataPreparatorOptions m_options
Definition: TgcDataPreparator.h:63
TrigL2MuonSA::TgcDataPreparatorRoadParameters::deltaEtaAtInnerForHighPt
double deltaEtaAtInnerForHighPt() const
Definition: TgcDataPreparatorOptions.h:31
TrigL2MuonSA::TgcDataPreparator::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: TgcDataPreparator.h:60
query_example.col
col
Definition: query_example.py:7
a
TList * a
Definition: liststreamerinfos.cxx:10
h
TrigL2MuonSA::TgcHitData::z
double z
Definition: TgcData.h:32
TrigL2MuonSA::TgcHitData::bcTag
int bcTag
Definition: TgcData.h:36
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TrigL2MuonSA::TgcDataPreparator::m_recMuonRoIUtils
TrigL2MuonSA::RecMuonRoIUtils m_recMuonRoIUtils
Definition: TgcDataPreparator.h:66
Muon::TgcPrepData
Class to represent TGC measurements.
Definition: TgcPrepData.h:32
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
Muon::TgcPrepData::globalPosition
virtual const Amg::Vector3D & globalPosition() const override final
Returns the global position.
Definition: TgcPrepData.h:125
TrigL2MuonSA::RecMuonRoIUtils::isLowPt
bool isLowPt(const LVL1::RecMuonRoI *p_roi) const
Definition: RecMuonRoIUtils.h:25
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
TrigL2MuonSA::TgcHitData::eta
double eta
Definition: TgcData.h:26
TrigL2MuonSA::TgcHitData::inRoad
bool inRoad
Definition: TgcData.h:37
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
fitman.k
k
Definition: fitman.py:528
xAOD::MuonRoI_v1::phi
float phi() const
The azimuthal angle ( ) of the muon candidate.