ATLAS Offline Software
PixelIDLayerComp.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "Identifier/Identifier.h"
7 
8 namespace InDet {
9 
10 
12  public:
14  PixelIDLayerComp(const PixelID* pixelId) : m_pixelId(pixelId) {}
15  bool operator() (Identifier id1, Identifier id2) const {
16 
17  bool id1_is_pixel = m_pixelId->is_pixel(id1);
18  bool id2_is_pixel = m_pixelId->is_pixel(id2);
19  if(!id1_is_pixel && id2_is_pixel) return false;
20  if(id1_is_pixel && !id2_is_pixel) return true;
21 
22  // FIX ME:
23  // this situation isn't well defined, unfortunately.
24  // But in principle we should never be in this situation, right?
25  if(!id1_is_pixel && !id2_is_pixel){
26  // ATH_MSG_WARNING("Passed a non-pixel ID into the pixel ID map!");
27  return false;
28  }
29 
30  if(!m_pixelId->is_pixel(id1) || !m_pixelId->is_pixel(id2))
31  return (&id1 < &id2);
32 
33  bool id1_is_barrel = m_pixelId->is_barrel(id1);
34  bool id2_is_barrel = m_pixelId->is_barrel(id2);
35  if((id1_is_barrel && id2_is_barrel) ||
36  (!id1_is_barrel && !id2_is_barrel)){
37  // they're both in the barrel or both in the endcap,
38  // so check the layer
39  return (m_pixelId->layer_disk(id1) < m_pixelId->layer_disk(id2));
40  }
41 
42  // one is in the barrel and one is in the endcap
43  if(!id1_is_barrel && id2_is_barrel){
44  return false;
45  }
46 
47  //remaining possibility is if(id1_is_barrel && !id2_is_barrel), remove 'if' statement to make coverity happy, otherwise complains about logically dead code
48  return true;
49 
50 
51  }
52 
53  void SetPixelIDSvc(PixelID* pixelId) { m_pixelId = pixelId; }
54  private:
55  const PixelID * m_pixelId;
56  };
57 
58 }
PixelID.h
This is an Identifier helper class for the Pixel subdetector. This class is a factory for creating co...
AtlasDetectorID::is_pixel
bool is_pixel(Identifier id) const
Definition: AtlasDetectorID.h:760
InDet
DUMMY Primary Vertex Finder.
Definition: VP1ErrorUtils.h:36
PixelID::is_barrel
bool is_barrel(const Identifier &id) const
Test for barrel - WARNING: id MUST be pixel id, otherwise answer is not accurate. Use SiliconID for g...
Definition: PixelID.h:605
InDet::PixelIDLayerComp::PixelIDLayerComp
PixelIDLayerComp()
Definition: PixelIDLayerComp.h:13
id2
HWIdentifier id2
Definition: LArRodBlockPhysicsV0.cxx:564
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
InDet::PixelIDLayerComp::m_pixelId
const PixelID * m_pixelId
Definition: PixelIDLayerComp.h:55
InDet::PixelIDLayerComp::SetPixelIDSvc
void SetPixelIDSvc(PixelID *pixelId)
Definition: PixelIDLayerComp.h:53
PixelID::layer_disk
int layer_disk(const Identifier &id) const
Definition: PixelID.h:626
InDet::PixelIDLayerComp::PixelIDLayerComp
PixelIDLayerComp(const PixelID *pixelId)
Definition: PixelIDLayerComp.h:14
InDet::PixelIDLayerComp::operator()
bool operator()(Identifier id1, Identifier id2) const
Definition: PixelIDLayerComp.h:15
InDet::PixelIDLayerComp
Definition: PixelIDLayerComp.h:11
PixelID
Definition: PixelID.h:67