ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
InDet::PixelGangedAmbiguitiesFinder Class Reference

#include <PixelGangedAmbiguitiesFinder.h>

Inheritance diagram for InDet::PixelGangedAmbiguitiesFinder:
Collaboration diagram for InDet::PixelGangedAmbiguitiesFinder:

Public Member Functions

 PixelGangedAmbiguitiesFinder (const std::string &type, const std::string &name, const IInterface *parent)
 
 ~PixelGangedAmbiguitiesFinder ()=default
 
virtual StatusCode initialize ()
 
void execute (PixelClusterCollection *collection, PixelGangedClusterAmbiguities &map) 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
 

Static Public Member Functions

static const InterfaceID & interfaceID ()
 

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 InDetDD::SiDetectorElement SiDetectorElement
 
typedef InDetDD::SiLocalPosition SiLocalPosition
 
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...
 

Static Private Member Functions

static bool isGanged (const Identifier &rdoID, const InDetDD::SiDetectorElement *element, Identifier &gangedID)
 

Private Attributes

BooleanProperty m_internalSolving {this, "InternalSolving", false, "Standalone resolution of ganged pixel ambiguities"}
 
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollectionm_pixelDetEleCollKey {this, "PixelDetEleCollKey", "PixelDetectorElementCollection", "Key of SiDetectorElementCollection for Pixel"}
 
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 39 of file PixelGangedAmbiguitiesFinder.h.

Member Typedef Documentation

◆ SiDetectorElement

Definition at line 65 of file PixelGangedAmbiguitiesFinder.h.

◆ SiLocalPosition

Definition at line 66 of file PixelGangedAmbiguitiesFinder.h.

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ PixelGangedAmbiguitiesFinder()

InDet::PixelGangedAmbiguitiesFinder::PixelGangedAmbiguitiesFinder ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 32 of file PixelGangedAmbiguitiesFinder.cxx.

35  :
37 {
38  declareInterface<PixelGangedAmbiguitiesFinder>(this);
39 }

◆ ~PixelGangedAmbiguitiesFinder()

InDet::PixelGangedAmbiguitiesFinder::~PixelGangedAmbiguitiesFinder ( )
default

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

◆ execute()

void InDet::PixelGangedAmbiguitiesFinder::execute ( PixelClusterCollection collection,
PixelGangedClusterAmbiguities map 
) const

Definition at line 54 of file PixelGangedAmbiguitiesFinder.cxx.

56  {
57  if (collection->size()<2) return;
58 
59  ATH_MSG_DEBUG(collection->size() << " clusters");
60  ATH_MSG_DEBUG("The map has " << theMap.size() << " entries already");
61 
62  IdentifierHash elementHash = collection->identifyHash();
63 
64  // Get detector info.
65  // Find detector element for these RDOs
66 
68  const InDetDD::SiDetectorElementCollection* pixelDetEle(*pixelDetEleHandle);
69  if (not pixelDetEleHandle.isValid() or pixelDetEle==nullptr) {
70  ATH_MSG_FATAL(m_pixelDetEleCollKey.fullKey() << " is not available.");
71  return;
72  }
73  const InDetDD::SiDetectorElement* element = pixelDetEle->getDetectorElement(elementHash);
74  const InDetDD::PixelModuleDesign* design =(dynamic_cast<const InDetDD::PixelModuleDesign*>(&element->design()));
75  if (not design){
76  ATH_MSG_ERROR("Dynamic cast failed at line "<<__LINE__<<" of PixelGangedAmbiguitiesFinder.cxx.");
77  return;
78  }
79  int rowsPerFE = design->rows()/2;
80  const auto *pHelper = element->getIdHelper();
81  if (pHelper->helper() != AtlasDetectorID::HelperType::Pixel){
82  ATH_MSG_ERROR("The helper type is not Pixel at line "<<__LINE__<<" of PixelGangedAmbiguitiesFinder.cxx.");
83  return;
84  }
85  const PixelID* pixelID =static_cast<const PixelID*>(pHelper);
86  //Pointer list of clusters to be removed
87  std::vector<PixelClusterCollection::iterator> rmList;
88 
89  PixelClusterCollection::iterator cluster=collection->begin();
90  PixelClusterCollection::iterator clend=collection->end();
91 
92  for( ; cluster!=clend ; ++cluster){
93  // check if cluster has not already been flagged to be deleted
94  if ( find(rmList.begin(),rmList.end(),cluster)!=rmList.end() ) continue;
95 
96  // extract from the list of cluster rdo the ganged ones.
97  bool hasGanged = false;
98  int rmin1=999, cmin1=999; // bottom left corner of cluster
99  std::vector<Identifier> gangedPixels;
100  const std::vector<Identifier>& RDOs = (*cluster)->rdoList();
101 
102  std::vector<Identifier>::const_iterator rdo=RDOs.begin();
103  std::vector<Identifier>::const_iterator rdoend=RDOs.end();
104  for( ; rdo != rdoend; ++rdo){
105  Identifier gangedID;
106  bool ganged = isGanged(*rdo,element,gangedID);
107  if(ganged){
108  hasGanged = true;
109  gangedPixels.push_back(gangedID);
110  }
111  int thiscol=pixelID->eta_index(*rdo);
112  if (thiscol<cmin1) cmin1=thiscol;
113  int thisrow=pixelID->phi_index(*rdo);
114  if (thisrow<rmin1) rmin1=thisrow;
115 
116  }
117 
118  // set ganged pixels flag
119  (*cluster)->setGangedPixel(hasGanged);
120  // find out if any other cluster shares any of the ganged pixels
121 
122  if(hasGanged){
123 
124  ATH_MSG_DEBUG("Ganged pixel, find combi...");
125  std::vector<Identifier>::const_iterator gangedPixelsBegin = gangedPixels.begin();
126  std::vector<Identifier>::const_iterator gangedPixelsEnd = gangedPixels.end();
127  PixelClusterCollection::iterator cluster2=cluster+1;
128  for( ; cluster2!=clend; ++cluster2){
129  ATH_MSG_DEBUG("Comparing "
130  << std::hex << (*cluster)->identify()
131  << " and " << (*cluster2)->identify()
132  << std::dec);
133  bool sharedGanged = false;
134  int rmin2=999, cmin2=999; // bottom left corner of cluster2
135  const std::vector<Identifier>& rdos2 = (*cluster2)->rdoList();
136  std::vector<Identifier>::const_iterator rdo2=rdos2.begin();
137  std::vector<Identifier>::const_iterator rdo2end=rdos2.end();
138  for( ; rdo2!=rdo2end; ++rdo2) {
139  if (!sharedGanged) {
140  for( std::vector<Identifier>::const_iterator gangedRDOs=gangedPixelsBegin;
141  gangedRDOs < gangedPixelsEnd; ++gangedRDOs ){
142  if(*rdo2 == *gangedRDOs){
143  sharedGanged = true;
144  break;
145  }
146  }
147  }
148  int thiscol=pixelID->eta_index(*rdo2);
149  if (thiscol<cmin2) cmin2=thiscol;
150  int thisrow=pixelID->phi_index(*rdo2);
151  if (thisrow<rmin2) rmin2=thisrow;
152  //if ( sharedGanged ) break;
153  }
154 
155  if(sharedGanged){
156  // ganged clusters with just one row are likely to
157  // be fake if the ganged image of the same pixel is
158  // part of a cluster with more rows.
159  int drow1=lrint((**cluster).width().colRow().x() );
160  int drow2=lrint((**cluster2).width().colRow().x() );
161  int dcol1=lrint((**cluster).width().colRow().y() );
162  int dcol2=lrint((**cluster2).width().colRow().y() );
163 
164  //std::cout << "drow1: " << drow1 << " drow2: " << drow2 << " dcol1: " << dcol1 << " dcol2: " << dcol2 << " isfake1: " << (*cluster)->isFake() << " isfake2: " << (*cluster2)->isFake() << std::endl;
165  if ( (drow1==1 && drow2>1 && drow2<4) || (dcol2>dcol1 && cmin2<=cmin1 && cmin2+dcol2>=cmin1+dcol1)){
166  // cluster 1 is likely to be fake
167  if (m_internalSolving) {
168  rmList.push_back(cluster);
169  ATH_MSG_DEBUG(std::hex
170  << ": deleted " << (*cluster)->identify()
171  << std::dec);
172  break;
173  }
174  else (*cluster)->setFake(true);
175  }
176  else if ( (drow1>1 && drow1<4 && drow2==1) || (dcol1>dcol2 && cmin1<=cmin2 && cmin1+dcol1>=cmin2+dcol2)){
177  // cluster 2 is likely to be fake
178  if (m_internalSolving) {
179  rmList.push_back(cluster2);
180  ATH_MSG_DEBUG(std::hex
181  << ": deleted " << (*cluster2)->identify()
182  << std::dec);
183  continue;
184  }
185  else (*cluster2)->setFake(true);
186  }
187  else if ( drow2>1 || drow1>1 ) {
188  if (cmin1==cmin2){
189  rdo=RDOs.begin();
190  std::vector<std::vector<int> > myvec(dcol1);
191  for( ; rdo != rdoend; ++rdo){
192  int row=pixelID->phi_index(*rdo);
193  int col=pixelID->eta_index(*rdo);
194  myvec[col-cmin1].push_back(row);
195  }
196  rdo=rdos2.begin();
197  int dcol2=lrint((**cluster2).width().colRow().y() );
198  std::vector<std::vector<int> > myvec2(dcol2);
199  for( ; rdo != rdo2end; ++rdo){
200  int row=pixelID->phi_index(*rdo);
201  int col=pixelID->eta_index(*rdo);
202  myvec2[col-cmin2].push_back(row);
203  }
204  for (auto & i : myvec) if (!i.empty()) std::sort(i.begin(),i.end());
205  for (auto & i : myvec2) if (!i.empty()) std::sort(i.begin(),i.end());
206  int nvictory1=0,nvictory2=0;
207  for (int i=0;i<(int)myvec.size();i++){
208  int maxsize1=0,maxsize2=0,maxsizeleft1=0,maxsizeright1=0,maxsizeleft2=0,maxsizeright2=0,thissize=0,thissizeright=0;
209  bool hasgap1=false,hasgap2=false;
210  for (int j=0;j<(int)myvec[i].size();j++){
211  if (j!=0 && thissize==0) hasgap1=true; // there is a gap between the pixels in this column
212 
213  thissize++;
214  if (myvec[i][j]>=rowsPerFE) thissizeright++;
215 
216  if (thissize>maxsize1) maxsize1=thissize;
217  if (myvec[i][j]<rowsPerFE && thissize>maxsizeleft1) maxsizeleft1=thissize;
218  if (myvec[i][j]>=rowsPerFE && thissizeright>maxsizeright1) maxsizeright1=thissizeright;
219  if (j==(int)myvec[i].size()-1 || myvec[i][j+1]!=myvec[i][j]+1) thissize=thissizeright=0;
220  }
221  thissize=thissizeright=0;
222  for (int j=0;j<(int)myvec2[i].size();j++){
223  if (j!=0 && thissize==0) hasgap2=true;
224  thissize++;
225  if (myvec2[i][j]>=rowsPerFE) thissizeright++;
226  if (thissize>maxsize2) maxsize2=thissize;
227  if (myvec2[i][j]<rowsPerFE && thissize>maxsizeleft2) maxsizeleft2=thissize;
228  if (myvec2[i][j]>=rowsPerFE && thissizeright>maxsizeright2) maxsizeright2=thissizeright;
229  if (j==(int)myvec2[i].size()-1 || myvec2[i][j+1]!=myvec2[i][j]+1) thissize=thissizeright=0;
230 
231  }
232  //std::cout << "maxsize1: " << maxsize1 << " maxsize2: " << maxsize2 << " hasgap1: " << hasgap1 << " hasgap2: " << hasgap2 << std::endl;
233  if (maxsize1>maxsize2 && maxsizeleft1>=maxsizeleft2 && maxsizeright1>=maxsizeright2 && !hasgap1) nvictory1++;
234  else if (maxsize2>maxsize1 && maxsizeleft2>=maxsizeleft1 && maxsizeright2>=maxsizeright1 && !hasgap2) nvictory2++;
235  }
236  //std::cout << "nvictory1: " << nvictory1 << " nvictory2: " << nvictory2 << std::endl;
237 
238  // check if fake image of big clusters in ganged region
239  //if ( (rmin1<rmin2 && (rmin2+drow2-1)<rowsPerFE )
240  // || (rmin1>rmin2 && rmin2>=rowsPerFE ) ) {
241  if (nvictory1>nvictory2){
242  // cluster 2 is likely to be fake
243  if (m_internalSolving) {
244  rmList.push_back(cluster2);
245  ATH_MSG_DEBUG(std::hex
246  << ": deleted " << (*cluster2)->identify()
247  << std::dec);
248  continue;
249  }
250  else {
251  (*cluster2)->setFake(true);
252  //std::cout << "cluster2 fake!" << std::endl;
253  }
254  }
255  else if (nvictory2>nvictory1){
256  // cluster 1 is likely to be fake
257  if (m_internalSolving) {
258  rmList.push_back(cluster);
259  ATH_MSG_DEBUG(std::hex
260  << ": deleted " << (*cluster)->identify()
261  << std::dec);
262  continue;
263  }
264  else {
265  (*cluster)->setFake(true);
266  //std::cout << "cluster1 fake!" << std::endl;
267  }
268  }
269  }
270  }
271  // this point is reached:
272  // - always if m_internalSolving is false
273  // - in case no cluster could be removed
274  // in both cases the clusters are flagged as ambiguous
275  // and an entry in the ambiguity map is added.
276 
277  //GP: temporary not optimal solution not to flag two
278  //subclusters within a cluster as ganged to each other
279  //TO BE FIXED WITH A BETTER TREATMENT
280  if (!((*cluster)->isSplit() && (*cluster2)->isSplit()))
281  {
282  (*cluster)->setAmbiguous(true);
283  (*cluster2)->setAmbiguous(true);
284  // a map is a sorted container with the first element
285  // of the pair as key, for efficient lookup (~logN) need
286  // to add both permutations
287  theMap.insert(std::make_pair(*cluster,*cluster2));
288  theMap.insert(std::make_pair(*cluster2,*cluster));
289  ATH_MSG_DEBUG(std::hex
290  << ": added ambiguity entry"
291  << std::dec);
292  }
293  }
294  }
295  }
296  }
297  ATH_MSG_DEBUG("The map has " << theMap.size() << " entries ");
298 
299  // to remove clusters from the collection, the vector of iterators need to be
300  // sorted. Moreover, when preceeding iterators are removed, one must take into
301  // account the iterator position is changed.
302  int rmNumber=0;
305  std::sort(rmit,rmend);
306  for ( ; rmit!=rmend ; ++rmit){
307  ATH_MSG_DEBUG("Removed " << rmNumber+1 << " cluster: "
308  << std::hex << (*(*rmit-rmNumber))->identify() << std::dec);
309  collection->erase(*rmit-rmNumber); // The position of the iterator
310  rmNumber++;
311  }
312  ATH_MSG_DEBUG(rmNumber << " fake clusters from ganged pixel have been removed");
313 
314 }

◆ 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 InDet::PixelGangedAmbiguitiesFinder::initialize ( )
virtual

Definition at line 41 of file PixelGangedAmbiguitiesFinder.cxx.

41  {
43 
44  return StatusCode::SUCCESS;
45 }

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

◆ interfaceID()

static const InterfaceID& InDet::PixelGangedAmbiguitiesFinder::interfaceID ( )
inlinestatic

Definition at line 51 of file PixelGangedAmbiguitiesFinder.h.

51 { return IID_PixelGangedAmbiguitiesFinder; };

◆ isGanged()

bool InDet::PixelGangedAmbiguitiesFinder::isGanged ( const Identifier rdoID,
const InDetDD::SiDetectorElement element,
Identifier gangedID 
)
staticprivate

Definition at line 323 of file PixelGangedAmbiguitiesFinder.cxx.

326 {
327  InDetDD::SiCellId cellID = element->cellIdFromIdentifier (rdoID);
328  if (element->numberOfConnectedCells (cellID) > 1) {
329  InDetDD::SiCellId gangedCellID = element->connectedCell (cellID,1);
330  if ( gangedCellID==cellID ) gangedCellID = element->connectedCell (cellID,0);
331  gangedID = element->identifierFromCellId (gangedCellID);
332  return true;
333  } else {
334  gangedID = Identifier();
335  return false;
336  }
337 }

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

BooleanProperty InDet::PixelGangedAmbiguitiesFinder::m_internalSolving {this, "InternalSolving", false, "Standalone resolution of ganged pixel ambiguities"}
private

Definition at line 69 of file PixelGangedAmbiguitiesFinder.h.

◆ m_pixelDetEleCollKey

SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> InDet::PixelGangedAmbiguitiesFinder::m_pixelDetEleCollKey {this, "PixelDetEleCollKey", "PixelDetectorElementCollection", "Key of SiDetectorElementCollection for Pixel"}
private

Definition at line 71 of file PixelGangedAmbiguitiesFinder.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:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
query_example.row
row
Definition: query_example.py:24
xAOD::identify
const Identifier & identify(const UncalibratedMeasurement *meas)
Returns the associated identifier from the muon measurement.
Definition: MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/Root/UtilFunctions.cxx:61
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
PixelID::phi_index
int phi_index(const Identifier &id) const
Definition: PixelID.h:658
InDetDD::SolidStateDetectorElementBase::connectedCell
SiCellId connectedCell(const SiCellId cellId, int number) const
Get the cell ids sharing the readout for this cell.
Definition: SolidStateDetectorElementBase.cxx:250
InDetDD::SiDetectorElementCollection
Definition: SiDetectorElementCollection.h:30
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
InDetDD::PixelModuleDesign
Definition: PixelModuleDesign.h:48
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
AtlasDetectorID::HelperType::Pixel
@ Pixel
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
InDet::PixelGangedAmbiguitiesFinder::m_internalSolving
BooleanProperty m_internalSolving
Definition: PixelGangedAmbiguitiesFinder.h:69
InDet::PixelGangedAmbiguitiesFinder::m_pixelDetEleCollKey
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_pixelDetEleCollKey
Definition: PixelGangedAmbiguitiesFinder.h:71
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
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
InDetDD::SolidStateDetectorElementBase::getIdHelper
const AtlasDetectorID * getIdHelper() const
Returns the id helper (inline)
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
InDet::PixelGangedAmbiguitiesFinder::isGanged
static bool isGanged(const Identifier &rdoID, const InDetDD::SiDetectorElement *element, Identifier &gangedID)
Definition: PixelGangedAmbiguitiesFinder.cxx:323
InDetDD::SiDetectorElement::cellIdFromIdentifier
virtual SiCellId cellIdFromIdentifier(const Identifier &identifier) const override final
SiCellId from Identifier.
Definition: SiDetectorElement.cxx:120
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
InDetDD::SolidStateDetectorElementBase::numberOfConnectedCells
int numberOfConnectedCells(const SiCellId cellId) const
Test if readout cell has more than one diode associated with it.
Definition: SolidStateDetectorElementBase.cxx:243
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
InDetDD::SiDetectorElement::identifierFromCellId
virtual Identifier identifierFromCellId(const SiCellId &cellId) const override final
Identifier <-> SiCellId (ie strip number or pixel eta_index,phi_index) Identifier from SiCellId (ie s...
Definition: SiDetectorElement.cxx:89
test_pyathena.parent
parent
Definition: test_pyathena.py:15
PixelID::eta_index
int eta_index(const Identifier &id) const
Definition: PixelID.h:664
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
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
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
InDetDD::SiDetectorElement
Definition: SiDetectorElement.h:109
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
query_example.col
col
Definition: query_example.py:7
InDetDD::SiCellId
Definition: SiCellId.h:29
a
TList * a
Definition: liststreamerinfos.cxx:10
h
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
InDetDD::SiDetectorElement::design
virtual const SiDetectorDesign & design() const override final
access to the local description (inline):
PixelID
Definition: PixelID.h:67
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
Identifier
Definition: IdentifierFieldParser.cxx:14