BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
LocalProtonSelector.cxx
Go to the documentation of this file.
1#include "GaudiKernel/Bootstrap.h"
2#include "GaudiKernel/ISvcLocator.h"
3
4#include "EvtRecEvent/EvtRecTrack.h"
6#include "ParticleID/ParticleID.h"
7
8#include "VertexDbSvc/IVertexDbSvc.h"
9#include "VertexFit/Helix.h"
10
12
13LocalProtonSelector::LocalProtonSelector( const std::string& type, const std::string& name,
14 const IInterface* parent )
15 : base_class( type, name, parent ) {
16 m_pidtype = 0;
17
18 // Declare the properties
19 declareProperty( "RxyCut", m_VrCut = 1.0 );
20 declareProperty( "Vz0Cut", m_VzCut = 10.0 );
21 declareProperty( "CosThetaCut", m_CosThetaCut = 0.93 );
22
23 declareProperty( "PID", m_PID = true );
24 declareProperty( "ChiCut", m_ChiCut = 8 );
25
26 declareProperty( "PidUseDedx", m_useDedx = true );
27 declareProperty( "PidUseTof1", m_useTof1 = true );
28 declareProperty( "PidUseTof2", m_useTof2 = true );
29 declareProperty( "PidUseTofE", m_useTofE = false );
30 declareProperty( "PidUseTofQ", m_useTofQ = false );
31 declareProperty( "PidUseEmc", m_useEmc = false );
32 declareProperty( "PidUseMuc", m_useMuc = false );
33
34 declareProperty( "PidwithProbability", m_probability = true );
35 declareProperty( "PidProbCut", m_PidProbCut = 0.001 );
36 declareProperty( "RejectKaon", m_rejectKaon = true );
37 declareProperty( "RejectPion", m_rejectPion = true );
38
39 declareProperty( "PidwithLikelihood", m_likelihood = false );
40 declareProperty( "PidwithNeuronNetwork", m_neuronNetwork = false );
41 declareProperty( "NeuronValue", m_neuronValCut = { 1.5, 2.5 } );
42}
43
45
46 aProton.setUserTag( 1 );
47 EvtRecTrack* recTrk = const_cast<EvtRecTrack*>( aProton.track() );
48
49 // MDC track selection
50
52 if ( !recTrk->isMdcKalTrackValid() ) return false;
53 RecMdcKalTrack* mdcKalTrk = recTrk->mdcKalTrack();
54 if ( mdcKalTrk->charge() == 0 ) return false;
55
56 Hep3Vector xorigin( 0, 0, 0 );
57 IVertexDbSvc* vtxsvc;
58 StatusCode sc = serviceLocator()->service( "VertexDbSvc", vtxsvc );
59 if ( vtxsvc->isVertexValid() )
60 {
61 double* dbv = vtxsvc->PrimaryVertex();
62 double* vv = vtxsvc->SigmaPrimaryVertex();
63 xorigin.setX( dbv[0] );
64 xorigin.setY( dbv[1] );
65 xorigin.setZ( dbv[2] );
66 }
67 HepVector a = mdcKalTrk->getZHelixP();
68 HepSymMatrix Ea = mdcKalTrk->getZErrorP();
69 HepPoint3D point0( 0., 0., 0. );
70 HepPoint3D IP( xorigin[0], xorigin[1], xorigin[2] );
71 VFHelix helixip3( point0, a, Ea );
72 helixip3.pivot( IP );
73 HepVector vecipa = helixip3.a();
74
75 double dr = fabs( vecipa[0] );
76 double dz = fabs( vecipa[3] );
77 double costheta = cos( mdcKalTrk->theta() );
78 if ( dr >= m_VrCut ) return false;
79 if ( dz >= m_VzCut ) return false;
80 if ( fabs( costheta ) >= m_CosThetaCut ) return false;
81
82 if ( !m_PID ) return true;
83
84 // ParticleID for Proton
86 pid->init();
87 pid->setMethod( pid->methodProbability() );
88 pid->setChiMinCut( m_ChiCut );
89 pid->setRecTrack( recTrk );
90 // pid->usePidSys(pid->useDedx() | pid->useTof1() | pid->useTof2() | pid->useTof());
91 pid->usePidSys( pid->useDedx() | pid->useTofCorr() );
92 pid->identify( pid->onlyPion() | pid->onlyKaon() | pid->onlyProton() );
93 pid->calculate();
94
95 if ( !( pid->probProton() > 0. && pid->probProton() > pid->probPion() &&
96 pid->probProton() > pid->probKaon() ) )
97 aProton.setUserTag( 2 );
98
99 if ( m_pidtype == 0 ) return true;
100
101 if ( aProton.userTag() == 1 ) return true;
102 else return false;
103}
104
105// LocalProtonSelector protonSelector;
DECLARE_COMPONENT(BesBdkRc)
HepGeom::Point3D< double > HepPoint3D
CDChargedVisible< DBCandidate::kProton > CDProton
void setUserTag(int tag)
int userTag() const
virtual bool isVertexValid()=0
virtual double * SigmaPrimaryVertex()=0
virtual double * PrimaryVertex()=0
bool operator()(CDProton &aProton) override
LocalProtonSelector(const std::string &type, const std::string &name, const IInterface *parent)
static ParticleID * instance()
void calculate()
void init()
const HepPoint3D & pivot(void) const
returns pivot position.
const HepVector & a(void) const
returns helix parameters.