ATLAS Offline Software
PRD_TruthTrajectorySorterID.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
9 
10 InDet::PRD_TruthTrajectorySorterID::PRD_TruthTrajectorySorterID(const std::string& t, const std::string& n, const IInterface* p) :
11 AthAlgTool(t,n,p)
12 {
13 declareInterface<Trk::IPRD_TruthTrajectoryManipulator>(this);
14 
15 }
16 
18  ATH_MSG_VERBOSE("Initializing ...");
19  return StatusCode::SUCCESS;
20 }
21 
23  ATH_MSG_VERBOSE("Finalizing ...");
24  return StatusCode::SUCCESS;
25 }
26 
27 class mysort{
28  public:
29  bool operator()(const Trk::PrepRawData *prd1,const Trk::PrepRawData *prd2) {
30  const InDet::PixelCluster* pixclus1=dynamic_cast<const InDet::PixelCluster*>(prd1);
31  const InDet::PixelCluster* pixclus2=dynamic_cast<const InDet::PixelCluster*>(prd2);
32  const InDet::SCT_Cluster* sctclus1=dynamic_cast<const InDet::SCT_Cluster*>(prd1);
33  const InDet::SCT_Cluster* sctclus2=dynamic_cast<const InDet::SCT_Cluster*>(prd2);
34  const InDet::TRT_DriftCircle* trtclus1=dynamic_cast<const InDet::TRT_DriftCircle*>(prd1);
35  const InDet::TRT_DriftCircle* trtclus2=dynamic_cast<const InDet::TRT_DriftCircle*>(prd2);
36  if (pixclus1 && !pixclus2) return true;
37  else if (pixclus2 && !pixclus1) return false;
38  else if (sctclus1 && trtclus2) return true;
39  else if (sctclus2 && trtclus1) return false;
40  else if (pixclus1){
41  if (pixclus1->detectorElement()->isBarrel() && pixclus2->detectorElement()->isEndcap()) return true;
42  else if (pixclus1->detectorElement()->isEndcap() && pixclus2->detectorElement()->isBarrel()) return false;
43  else if (pixclus1->detectorElement()->isBarrel()) return (pixclus1->globalPosition().perp()<pixclus2->globalPosition().perp());
44  else return (std::abs(pixclus1->globalPosition().z())<std::abs(pixclus2->globalPosition().z()));
45  }
46  else if (sctclus1){
47  if (sctclus1->detectorElement()->isBarrel() && sctclus2->detectorElement()->isEndcap()) return true;
48  else if (sctclus1->detectorElement()->isEndcap() && sctclus2->detectorElement()->isBarrel()) return false;
49  else if (sctclus1->detectorElement()->isBarrel()) return (sctclus1->globalPosition().perp()<sctclus2->globalPosition().perp());
50  else return (std::abs(sctclus1->globalPosition().z())<std::abs(sctclus2->globalPosition().z()));
51 
52  }
53  else if (trtclus1){
55  else if (trtclus1->detectorElement()->type()==InDetDD::TRT_BaseElement::ENDCAP && trtclus2->detectorElement()->type()==InDetDD::TRT_BaseElement::BARREL) return false;
56  Amg::Vector3D pos1=trtclus1->detectorElement()->center(trtclus1->identify());
57  Amg::Vector3D pos2=trtclus2->detectorElement()->center(trtclus2->identify());
58  if (trtclus1->detectorElement()->type()==InDetDD::TRT_BaseElement::BARREL) return (pos1.perp()<pos2.perp());
59  else return (std::abs(pos1.z())<std::abs(pos2.z()));
60  }
61  return true;
62 }
63 
64 };
65 
67  std::stable_sort(prdvec.prds.begin(),prdvec.prds.end(),mysort());
68  return true;
69 }
InDetDD::SiDetectorElement::isEndcap
bool isEndcap() const
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
PixelCluster.h
PRD_TruthTrajectorySorterID.h
InDet::TRT_DriftCircle::detectorElement
virtual const InDetDD::TRT_BaseElement * detectorElement() const override final
return the detector element corresponding to this PRD
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SCT_Cluster.h
InDet::TRT_DriftCircle
Definition: TRT_DriftCircle.h:32
InDet::PRD_TruthTrajectorySorterID::PRD_TruthTrajectorySorterID
PRD_TruthTrajectorySorterID(const std::string &t, const std::string &n, const IInterface *p)
Definition: PRD_TruthTrajectorySorterID.cxx:10
InDetDD::TRT_BaseElement::ENDCAP
@ ENDCAP
Definition: TRT_BaseElement.h:61
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
InDetDD::TRT_BaseElement::BARREL
@ BARREL
Definition: TRT_BaseElement.h:61
InDet::PRD_TruthTrajectorySorterID::manipulateTruthTrajectory
virtual bool manipulateTruthTrajectory(Trk::PRD_TruthTrajectory &) const
manipulate method - boolean indicates if manipulation was done or not
Definition: PRD_TruthTrajectorySorterID.cxx:66
InDetDD::TRT_BaseElement::type
virtual TRT_BaseElement::Type type() const =0
Type information: returns BARREL or ENDCAP.
InDet::SCT_Cluster
Definition: InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/SCT_Cluster.h:34
InDet::SiCluster::detectorElement
virtual const InDetDD::SiDetectorElement * detectorElement() const override final
return the detector element corresponding to this PRD The pointer will be zero if the det el is not d...
TRT_DriftCircle.h
Trk::PrepRawData
Definition: PrepRawData.h:62
Trk::PRD_TruthTrajectory
Definition: PRD_TruthTrajectory.h:27
Trk::PrepRawData::identify
Identifier identify() const
return the identifier
mysort::operator()
bool operator()(const Trk::PrepRawData *prd1, const Trk::PrepRawData *prd2)
Definition: PRD_TruthTrajectorySorterID.cxx:29
InDetDD::SiDetectorElement::isBarrel
bool isBarrel() const
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
mysort
Definition: PRD_TruthTrajectorySorterID.cxx:27
InDet::PixelCluster
Definition: InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/PixelCluster.h:49
InDet::SiCluster::globalPosition
const Amg::Vector3D & globalPosition() const
return global position reference
InDet::PRD_TruthTrajectorySorterID::initialize
StatusCode initialize()
Definition: PRD_TruthTrajectorySorterID.cxx:17
InDetDD::TRT_BaseElement::center
virtual const Amg::Vector3D & center() const override final
Element Surface: center of a straw layer.
AthAlgTool
Definition: AthAlgTool.h:26
Trk::PRD_TruthTrajectory::prds
std::vector< const Trk::PrepRawData * > prds
public members
Definition: PRD_TruthTrajectory.h:30
InDet::PRD_TruthTrajectorySorterID::finalize
StatusCode finalize()
Definition: PRD_TruthTrajectorySorterID.cxx:22