BOSS 7.0.8
BESIII Offline Software System
Loading...
Searching...
No Matches
LocalLambdaSelector.cxx
Go to the documentation of this file.
1#include "GaudiKernel/Bootstrap.h"
2#include "GaudiKernel/IJobOptionsSvc.h"
3#include "GaudiKernel/ISvcLocator.h"
4#include "GaudiKernel/PropertyMgr.h"
5
12
13
15{
16 IJobOptionsSvc* jobSvc;
17 Gaudi::svcLocator()->service("JobOptionsSvc", jobSvc);
18
19 PropertyMgr m_propMgr;
20
21 m_propMgr.declareProperty("LambdaMinMassCut", m_minMass = 1.10 );
22 m_propMgr.declareProperty("LambdaMaxMassCut", m_maxMass = 1.13 );
23 m_propMgr.declareProperty("LambdaMaxChisq", m_maxChisq = 100 );
24 m_propMgr.declareProperty("UseProtonPID", m_UseProtonPID = true );
25 m_propMgr.declareProperty("ProtonPIDChiCut", m_ChiCut = 8);
26
27 m_propMgr.declareProperty("DoSecondaryVFit", m_doSecondaryVFit = false );
28 m_propMgr.declareProperty("LambdaMaxVFitChisq", m_maxVFitChisq = 100 );
29 m_propMgr.declareProperty("LambdaMinFlightSig", m_minFlightSig = 2.0 );
30
31 jobSvc->setMyProperties("LocalLambdaSelector", &m_propMgr);
32}
33
35
36 aLambda.setUserTag(1);
37 EvtRecVeeVertex* lambda = const_cast<EvtRecVeeVertex*>( aLambda.navLambda() );
38
39 if ( fabs(lambda->vertexId()) != 3122 ) return false;
40
41 double mass = lambda->mass();
42 if ((mass <= m_minMass)||(mass >= m_maxMass)) return false;
43 if ( lambda->chi2() >= m_maxChisq ) return false;
44
45
46 // PID
47 int index[2] = {0, 1};
48 if (lambda->vertexId() < 0){
49 index[0] = 1;
50 index[1] = 0;
51 }
52
53 EvtRecTrack* recTrk_proton = lambda->daughter(index[0]);
54 EvtRecTrack* recTrk_pion = lambda->daughter(index[1]);
55
56 if(m_UseProtonPID){
58 pid->init();
59 pid->setMethod(pid->methodProbability());
60 pid->setChiMinCut(m_ChiCut);
61 pid->setRecTrack(recTrk_proton);
62 //pid->usePidSys(pid->useDedx() | pid->useTof1() | pid->useTof2() | pid->useTof());
63 pid->usePidSys(pid->useDedx() | pid->useTofCorr() );
64 pid->identify(pid->onlyPion() | pid->onlyKaon() | pid->onlyProton());
65 pid->calculate();
66 if(!(pid->probProton() > 0. && pid->probProton() > pid->probPion() && pid->probProton() > pid->probKaon())) return false;
67 }
68
69 if( !m_doSecondaryVFit ) return true;
70 // --------------------------------------------------
71 // Do a secondary vertex fit and check the flight significance
72 // --------------------------------------------------
73
74 RecMdcKalTrack* mdcKalTrk_proton = recTrk_proton->mdcKalTrack();
75 mdcKalTrk_proton->setPidType(RecMdcKalTrack::proton);
76 WTrackParameter WTrk_proton;
77 WTrk_proton = WTrackParameter(0.9314940054, mdcKalTrk_proton->getZHelixP(), mdcKalTrk_proton->getZErrorP());
78
79 RecMdcKalTrack* mdcKalTrk_pion = recTrk_pion->mdcKalTrack();
80 mdcKalTrk_pion->setPidType(RecMdcKalTrack::pion);
81 WTrackParameter WTrk_pion = WTrackParameter(0.13957018, mdcKalTrk_pion->getZHelix(), mdcKalTrk_pion->getZError());
82
83 VertexParameter wideVertex;
84 HepPoint3D vWideVertex(0., 0., 0.);
85 HepSymMatrix evWideVertex(3, 0);
86
87 evWideVertex[0][0] = 1.0e12;
88 evWideVertex[1][1] = 1.0e12;
89 evWideVertex[2][2] = 1.0e12;
90
91 wideVertex.setVx(vWideVertex);
92 wideVertex.setEvx(evWideVertex);
93
94 // First, perform a vertex fit
96 vtxfit->init();
97
98 // add the daughters
99 vtxfit->AddTrack(0,WTrk_proton);
100 vtxfit->AddTrack(1,WTrk_pion);
101 vtxfit->AddVertex(0,wideVertex,0,1);
102
103 // do the fit
104 vtxfit->Fit(0);
105 vtxfit->Swim(0);
106 vtxfit->BuildVirtualParticle(0);
107
108 // Now perform the secondary vertex fit
110 svtxfit->init();
111
112 // add the primary vertex
113 VertexParameter beamSpot;
114 HepPoint3D vBeamSpot(0., 0., 0.);
115 HepSymMatrix evBeamSpot(3, 0);
116
117 IVertexDbSvc* vtxsvc;
118 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
119 if(vtxsvc->isVertexValid()){
120 double* dbv = vtxsvc->PrimaryVertex();
121 double* vv = vtxsvc->SigmaPrimaryVertex();
122 for (unsigned int ivx = 0; ivx < 3; ivx++){
123 vBeamSpot[ivx] = dbv[ivx];
124 evBeamSpot[ivx][ivx] = vv[ivx] * vv[ivx];
125 }
126 }
127 else{
128 cout << "LambdaSELECTOR ERROR: Could not find a vertex from VertexDbSvc" << endl;
129 return false;
130 }
131
132 beamSpot.setVx(vBeamSpot);
133 beamSpot.setEvx(evBeamSpot);
134
135 VertexParameter primaryVertex(beamSpot);
136 svtxfit->setPrimaryVertex(primaryVertex);
137
138 // add the secondary vertex
139 svtxfit->setVpar(vtxfit->vpar(0));
140
141 // add the Ks or lambda
142 svtxfit->AddTrack(0,vtxfit->wVirtualTrack(0));
143
144 // do the second vertex fit
145 // if the fit fails, the default values will not be changed
146 if( !svtxfit->Fit() ) return false;
147
148 // save the new ks parameters
149 double vfitlength = svtxfit->decayLength();
150 double vfiterror = svtxfit->decayLengthError();
151 double vfitchi2 = svtxfit->chisq();
152 double flightsig = 0;
153 if( vfiterror != 0 )
154 flightsig = vfitlength/vfiterror;
155
156 // if the ks does not meet the criteria, the information from
157 // the secondary vertex fit will not be filled (default = -999)
158 if( vfitchi2 > m_maxVFitChisq ) return false;
159 if( flightsig < m_minFlightSig ) return false;
160
161 return true;
162
163}
164
double mass
LocalLambdaSelector lambdaSelector
void setUserTag(int tag)
Definition: CDCandidate.cxx:81
virtual const EvtRecVeeVertex * navLambda() const
Definition: CDLambda.cxx:116
static void setPidType(PidType pidType)
RecMdcKalTrack * mdcKalTrack()
Definition: EvtRecTrack.h:54
SmartRef< EvtRecTrack > & daughter(int i)
int vertexId() const
double mass() const
double chi2() const
virtual bool isVertexValid()=0
virtual double * SigmaPrimaryVertex()=0
virtual double * PrimaryVertex()=0
bool operator()(CDLambda &aLambda)
int useTofCorr() const
int onlyProton() const
int methodProbability() const
int useDedx() const
int onlyKaon() const
int onlyPion() const
void setChiMinCut(const double chi=4)
void setRecTrack(EvtRecTrack *trk)
double probKaon() const
Definition: ParticleID.h:124
void setMethod(const int method)
Definition: ParticleID.h:94
void identify(const int pidcase)
Definition: ParticleID.h:103
void usePidSys(const int pidsys)
Definition: ParticleID.h:97
static ParticleID * instance()
Definition: ParticleID.cxx:22
double probPion() const
Definition: ParticleID.h:123
void calculate()
Definition: ParticleID.cxx:97
void init()
Definition: ParticleID.cxx:27
double probProton() const
Definition: ParticleID.h:125
const HepVector & getZHelix() const
HepVector & getZHelixP()
const HepSymMatrix & getZError() const
HepSymMatrix & getZErrorP()
void setPrimaryVertex(const VertexParameter vpar)
double decayLength() const
double decayLengthError() const
static SecondVertexFit * instance()
void setVpar(const VertexParameter vpar)
double chisq() const
void AddTrack(const int number, const double mass, const RecMdcTrack *trk)
Definition: TrackPool.cxx:22
WTrackParameter wVirtualTrack(int n) const
Definition: VertexFit.h:92
void init()
Definition: VertexFit.cxx:29
void AddVertex(int number, VertexParameter vpar, std::vector< int > lis)
Definition: VertexFit.cxx:89
static VertexFit * instance()
Definition: VertexFit.cxx:15
VertexParameter vpar(int n) const
Definition: VertexFit.h:89
void BuildVirtualParticle(int number)
Definition: VertexFit.cxx:619
void Swim(int n)
Definition: VertexFit.h:59
bool Fit()
Definition: VertexFit.cxx:301
void setEvx(const HepSymMatrix &eVx)
void setVx(const HepPoint3D &vx)