FairRoot/PandaRoot
RhoGoodTrackSelector.cxx
Go to the documentation of this file.
1 // //
3 // RhoGoodTrackSelector //
4 // //
5 // Selector classes for track quality selections //
6 // //
7 // Author List: //
8 // Marcel Kunze, RUB, Feb. 99 //
9 // Copyright (C) 1999-2001, Ruhr-University Bochum. //
10 // Ralf Kliemt, HIM/GSI Feb.2013 (Cleanup & Restructuring) //
11 // //
13 
15 
16 #include "RhoBase/RhoCandidate.h"
17 #include "PndPidCandidate.h"
18 
20 
21 TBuffer& operator>> ( TBuffer& buf, RhoGoodTrackSelector *&obj )
22 {
23  obj = ( RhoGoodTrackSelector* ) buf.ReadObject ( RhoGoodTrackSelector::Class() );
24  return buf;
25 }
26 
27 #include <iostream>
28 using namespace std;
29 
31  RhoParticleSelectorBase ( name,"pi-" ),
32  fCutFit(kFALSE),
33  fCutVtx(kFALSE),
34  fCutMom(kFALSE),
35  fCutPt(kFALSE)
36 
37 {
38 }
39 
41 {
42 }
43 
45 {
46  // The GoodTrackSelector does a selection based on the
47  // quality of a reconstructed charged track
48 
49  if ( &b == 0 ) { return kFALSE; }
50  if ( !Accept ( *(b.GetRecoCandidate()) ) ) { return kFALSE; }
51  //SetTypeAndMass ( b );
52 
53  return kTRUE;
54 }
55 
57 {
58  // The GoodTrackSelector does a selection based on the
59  // quality of a reconstructed charged track
60  if ( &cand == 0 ) { return kFALSE; }
61  if ( cand.GetCharge() == 0 ) { return kFALSE; }
62 // // Cut on number of hits and distance from inner to outer layer
63 // if (fCutHits) {
64 // Int_t nhits = cand.GetNHits(); // Get the number of hits
65 // if ( nhits <= nHitsMin ) return kFALSE;
66 // if ( nhits > nHitsMax ) return kFALSE;
67 // }
68  // Cut on momenta
69  TVector3 p = cand.GetMomentum();
70  if (fCutMom){
71  if ( p.Mag() < fPMin ) { return kFALSE; }
72  if ( p.Mag() > fPMax ) { return kFALSE; }
73  }
74 
75  if (fCutPt){
76  if ( p.Perp() < fPtMin ) { return kFALSE; }
77  if ( p.Perp() > fPtMax ) { return kFALSE; }
78  }
79 
80 
81  // Cut on quality of fit
82  if (fCutFit){
83  Float_t chiq = cand.GetChiSquared();
84  if ( chiq > fChisqMax ) { return kFALSE; }
85  Float_t ndf = cand.GetDegreesOfFreedom();
86  if ( TMath::Prob(chiq,ndf) < fChisqProbMin ) { return kFALSE; }
87  }
88 
89  // Cut on primary vertex
90  if (fCutVtx) {
91  TVector3 v = cand.GetPosition(); // Get the starting point (spot corrected)
92  if ( v.Perp() > fDocaMax ) { return kFALSE; }
93  if ( v.Z() > fZMax ) { return kFALSE; }
94  if ( v.Z() < fZMin ) { return kFALSE; }
95  }
96 
97  return kTRUE;
98 }
99 
101 {
102  o << GetName() << endl;
103 // if ( fNHitsMin > 0 ) { o << "Number of Hits = " << fNHitsMin << " ... " << fNHitsMax << endl; }
104  if ( fPMin > 0 ) { o << "Momentum range = " << fPMin << " ... " << fPMax << " GeV" << endl; }
105  if ( fPtMin > 0 ) { o << "Momentum range (Pt) = " << fPtMin << " ... " << fPtMax << " GeV" << endl; }
106  if ( fChisqProbMin > 0 ) { o << "Fit probability/chi2 = " << fChisqProbMin << '/' << fChisqMax << endl; }
107  if ( fZMin>-1.E8 || fZMax < 1.E8 ) { o << "z position = " << fZMin << " ... " << fZMax << endl; }
108  if ( fDocaMax < 1.E8 ) { o << "doca = " << fDocaMax << endl; }
109  o << endl;
110 }
111 
113 {
114  a.PrintOn ( o );
115  return o;
116 }
117 
118 
Int_t GetCharge() const
return buf
Int_t GetDegreesOfFreedom() const
RhoGoodTrackSelector(const char *name="RhoGoodTrackSelector")
TTree * b
ClassImp(RhoGoodTrackSelector) TBuffer &operator>>(TBuffer &buf
PndPidCandidate * GetRecoCandidate() const
Definition: RhoCandidate.h:376
__m128 v
Definition: P4_F32vec4.h:4
Double_t p
Definition: anasim.C:58
std::ostream & operator<<(std::ostream &o, const RhoGoodTrackSelector &a)
virtual Bool_t Accept(RhoCandidate &b)
Float_t GetChiSquared() const
Int_t a
Definition: anaLmdDigi.C:126
virtual void PrintOn(std::ostream &o=std::cout) const
RhoGoodTrackSelector *& obj
TString name
TVector3 GetPosition() const
TVector3 GetMomentum() const