PandaRoot
SortTool.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 // ******************************************************
14 // DecayTreeFitter Package
15 // We thank the original author Wouter Hulsbergen
16 // (BaBar, LHCb) for providing the sources.
17 // http://arxiv.org/abs/physics/0503191v1 (2005)
18 // Adaptation & Development for PANDA: Ralf Kliemt (2015)
19 // ******************************************************
20 //
21 // SortTool.h
22 // TreeFitter
23 //
24 // Created by Ralf Kliemt on 26/01/15.
25 // Copyright (c) 2015 Ralf Kliemt. All rights reserved.
26 //
27 
28 #ifndef TREEFITTER_SORTTOOL_H
29 #define TREEFITTER_SORTTOOL_H 1
30 
31 #include "ParticleBase.h"
32 #include "RecoTrack.h"
33 
34 namespace DecayTreeFitter {
35 inline bool sortByType(const ParticleBase *lhs, const ParticleBase *rhs)
36 {
37  int lhstype = lhs->type();
38  int rhstype = rhs->type();
39  bool rc = false;
40  if (lhstype == rhstype && lhstype == ParticleBase::kRecoTrack)
41  rc = lhs->particle()->Pt() > rhs->particle()->Pt();
42  else if (lhs->particle()->NDaughters() > 0 && rhs->particle()->NDaughters() > 0)
44  else
45  rc = lhstype < rhstype;
46  return rc;
47 }
48 inline bool compTrkTransverseMomentum(const RecoTrack *lhs, const RecoTrack *rhs)
49 {
50  return lhs->particle()->Pt() > rhs->particle()->Pt();
51 }
52 } // namespace DecayTreeFitter
53 #endif
RhoCandidate * particle() const
Definition: ParticleBase.h:61
virtual int nFinalChargedCandidates() const
Double_t Pt() const
Definition: RhoCandidate.h:213
virtual int type() const =0
bool compTrkTransverseMomentum(const RecoTrack *lhs, const RecoTrack *rhs)
Definition: SortTool.h:48
Int_t NDaughters() const
bool sortByType(const ParticleBase *lhs, const ParticleBase *rhs)
Definition: SortTool.h:35