PandaRoot
SortTool.h
Go to the documentation of this file.
1 // ******************************************************
2 // DecayTreeFitter Package
3 // We thank the original author Wouter Hulsbergen
4 // (BaBar, LHCb) for providing the sources.
5 // http://arxiv.org/abs/physics/0503191v1 (2005)
6 // Adaptation & Development for PANDA: Ralf Kliemt (2015)
7 // ******************************************************
8 //
9 // SortTool.h
10 // TreeFitter
11 //
12 // Created by Ralf Kliemt on 26/01/15.
13 // Copyright (c) 2015 Ralf Kliemt. All rights reserved.
14 //
15 
16 #ifndef TREEFITTER_SORTTOOL_H
17 #define TREEFITTER_SORTTOOL_H 1
18 
19 #include "ParticleBase.h"
20 #include "RecoTrack.h"
21 
22 namespace DecayTreeFitter {
23 inline bool sortByType(const ParticleBase *lhs, const ParticleBase *rhs)
24 {
25  int lhstype = lhs->type();
26  int rhstype = rhs->type();
27  bool rc = false;
28  if (lhstype == rhstype && lhstype == ParticleBase::kRecoTrack)
29  rc = lhs->particle()->Pt() > rhs->particle()->Pt();
30  else if (lhs->particle()->NDaughters() > 0 && rhs->particle()->NDaughters() > 0)
32  else
33  rc = lhstype < rhstype;
34  return rc;
35 }
36 inline bool compTrkTransverseMomentum(const RecoTrack *lhs, const RecoTrack *rhs)
37 {
38  return lhs->particle()->Pt() > rhs->particle()->Pt();
39 }
40 } // namespace DecayTreeFitter
41 #endif
RhoCandidate * particle() const
Definition: ParticleBase.h:49
virtual int nFinalChargedCandidates() const
Double_t Pt() const
Definition: RhoCandidate.h:201
virtual int type() const =0
bool compTrkTransverseMomentum(const RecoTrack *lhs, const RecoTrack *rhs)
Definition: SortTool.h:36
Int_t NDaughters() const
bool sortByType(const ParticleBase *lhs, const ParticleBase *rhs)
Definition: SortTool.h:23