BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
KShortReconstruction Class Reference

#include <KShortReconstruction.h>

Inheritance diagram for KShortReconstruction:

Public Member Functions

 KShortReconstruction (const std::string &name, ISvcLocator *pSvcLocator)
StatusCode initialize ()
StatusCode execute ()
StatusCode finalize ()

Detailed Description

Definition at line 9 of file KShortReconstruction.h.

Constructor & Destructor Documentation

◆ KShortReconstruction()

KShortReconstruction::KShortReconstruction ( const std::string & name,
ISvcLocator * pSvcLocator )

Definition at line 29 of file KShortReconstruction.cxx.

30 : Algorithm( name, pSvcLocator ) {
31 // Declare the properties
32
33 declareProperty( "Vz0Cut", m_vzCut = 20.0 );
34 declareProperty( "CosThetaCut", m_cosThetaCut = 0.93 );
35 declareProperty( "ChisqCut", m_chisqCut = 100.0 );
36 declareProperty( "UseVFRefine", m_useVFrefine = false ); // Use VertexfitRefine or not
37 /*
38declareProperty("PidUseDedx", m_useDedx = true);
39declareProperty("PidUseTof1", m_useTof1 = true);
40declareProperty("PidUseTof2", m_useTof2 = true);
41declareProperty("PidUseTofE", m_useTofE = false);
42declareProperty("PidUseTofQ", m_useTofQ = false);
43declareProperty("PidUseEmc", m_useEmc = false);
44declareProperty("PidProbCut", m_PidProbCut= 0.001);
45declareProperty("MassRangeLower", m_massRangeLower = 0.45);
46declareProperty("MassRangeHigher", m_massRangeHigher = 0.55);
47*/
48}

Referenced by KShortReconstruction().

Member Function Documentation

◆ execute()

StatusCode KShortReconstruction::execute ( )

Definition at line 77 of file KShortReconstruction.cxx.

77 {
78 MsgStream log( msgSvc(), name() );
79 log << MSG::INFO << "in execute()" << endmsg;
80
81 StatusCode sc;
82
83 //////////////////
84 // Read REC data
85 /////////////////
86 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc(), "/Event/EventHeader" );
87 SmartDataPtr<EvtRecEvent> recEvent( eventSvc(), EventModel::EvtRec::EvtRecEvent );
88 SmartDataPtr<EvtRecTrackCol> recTrackCol( eventSvc(), EventModel::EvtRec::EvtRecTrackCol );
89 log << MSG::DEBUG << "run and event = " << eventHeader->runNumber() << " "
90 << eventHeader->eventNumber() << endmsg;
91 log << MSG::DEBUG << "ncharg, nneu, tottks = " << recEvent->totalCharged() << " , "
92 << recEvent->totalNeutral() << " , " << recEvent->totalTracks() << endmsg;
93 int evtNo = eventHeader->eventNumber();
94 // if (eventHeader->eventNumber() % 1000 == 0) {
95 // cout << "Event number = " << evtNo << endl;
96 // }
97
98 SmartDataPtr<EvtRecVeeVertexCol> veeVertexCol( eventSvc(),
100 if ( !veeVertexCol )
101 {
102 veeVertexCol = new EvtRecVeeVertexCol;
103 sc = registerEvtRecVeeVertexCol( veeVertexCol, log );
104 if ( sc != StatusCode::SUCCESS ) { return sc; }
105 }
106
107 //////////////////////////////////////////////
108 // No PID : identify positive and negative
109 ///////////////////////////////////////////////
110 Vint ipip, ipim, iGood;
111 for ( unsigned int i = 0; i < recEvent->totalCharged(); i++ )
112 {
113 EvtRecTrackIterator itTrk = recTrackCol->begin() + i;
114 // EvtRecTrack* track = *itTrk;
115 if ( !( *itTrk )->isMdcTrackValid() ) continue;
116 if ( !( *itTrk )->isMdcKalTrackValid() ) continue;
117 RecMdcTrack* mdcTrk = ( *itTrk )->mdcTrack();
118 if ( fabs( cos( mdcTrk->theta() ) ) >= m_cosThetaCut ) continue;
119 if ( fabs( mdcTrk->z() ) >= m_vzCut ) continue;
120 iGood.push_back( i );
121 if ( mdcTrk->charge() > 0 ) ipip.push_back( i );
122 if ( mdcTrk->charge() < 0 ) ipim.push_back( i );
123 }
124 // Cut on good charged tracks
125 // if (iGood.size() < 2) return StatusCode::SUCCESS;
126 if ( ipip.size() < 1 || ipim.size() < 1 ) return StatusCode::SUCCESS;
127
128 ///////////////////////////////////
129 // Vertex Fit
130 //////////////////////////////////
131 HepPoint3D vx( 0., 0., 0. );
132 HepSymMatrix Evx( 3, 0 );
133 double bx = 1E+6;
134 double by = 1E+6;
135 double bz = 1E+6;
136 Evx[0][0] = bx * bx;
137 Evx[1][1] = by * by;
138 Evx[2][2] = bz * bz;
139
140 // VertexFit *vtxfit0 = VertexFit::instance();
141
142 for ( unsigned int i1 = 0; i1 < ipip.size(); i1++ )
143 {
144 int ip1 = ipip[i1];
145 RecMdcKalTrack* pipKalTrk = ( *( recTrackCol->begin() + ip1 ) )->mdcKalTrack();
147 WTrackParameter wpiptrk( mpi, pipKalTrk->helix(), pipKalTrk->err() );
148
149 for ( unsigned int i2 = 0; i2 < ipim.size(); i2++ )
150 {
151 int ip2 = ipim[i2];
152 RecMdcKalTrack* pimKalTrk = ( *( recTrackCol->begin() + ip2 ) )->mdcKalTrack();
154 WTrackParameter wpimtrk( mpi, pimKalTrk->helix(), pimKalTrk->err() );
155
156 if ( m_useVFrefine )
157 {
158 VertexParameter vxpar;
159 vxpar.setVx( vx );
160 vxpar.setEvx( Evx );
161
162 VertexFitRefine* vtxfit0 = VertexFitRefine::instance();
163 vtxfit0->init();
164 // vtxfit0->AddTrack(0, wpiptrk);
165 // vtxfit0->AddTrack(1, wpimtrk);
166 vtxfit0->AddTrack( 0, pipKalTrk, RecMdcKalTrack::pion );
167 vtxfit0->AddTrack( 1, pimKalTrk, RecMdcKalTrack::pion );
168 vtxfit0->AddVertex( 0, vxpar, 0, 1 );
169
170 bool fitok = vtxfit0->Fit();
171 if ( !fitok ) continue;
172
173 // if(!(vtxfit0->Fit(0))) continue;
174 // vtxfit0->BuildVirtualParticle(0);
175
176 if ( vtxfit0->chisq( 0 ) > m_chisqCut ) continue;
177 WTrackParameter wKshort = vtxfit0->wVirtualTrack( 0 ); // FIXME
178 std::pair<int, int> pair;
179 pair.first = 3;
180 pair.second = 3;
181
182 EvtRecTrack* track0 = *( recTrackCol->begin() + ip1 );
183 EvtRecTrack* track1 = *( recTrackCol->begin() + ip2 );
184
185 EvtRecVeeVertex* KsVertex = new EvtRecVeeVertex;
186 KsVertex->setVertexId( 310 );
187 KsVertex->setVertexType( 0 );
188 KsVertex->setChi2( vtxfit0->chisq( 0 ) );
189 KsVertex->setNdof( 1 );
190 KsVertex->setMass( wKshort.p().m() );
191 KsVertex->setW( wKshort.w() );
192 KsVertex->setEw( wKshort.Ew() );
193 KsVertex->setPair( pair );
194 KsVertex->setNCharge( 0 );
195 KsVertex->setNTracks( 2 );
196 KsVertex->addDaughter( track0, 0 );
197 KsVertex->addDaughter( track1, 1 );
198 veeVertexCol->push_back( KsVertex );
199 /*
200 cout << "============= After Vertex fitting ===========" << endl;
201 cout << "Event number = " << evtNo << endl;
202 cout << "chi2 = " << vtxfit0->chisq(0) << endl;
203 cout << "mass = " << wKshort.p().m() << endl;
204 cout << "w = " << wKshort.w() << endl;
205 cout << "Ew = " << wKshort.Ew() << endl;
206 cout << "track 0 : Z : " << track0->mdcTrack()->z() << endl;
207 cout << "track 1 : Z : " << track1->mdcTrack()->z() << endl; */
208 }
209 else
210 {
211 VertexParameter vxpar;
212 vxpar.setVx( vx );
213 vxpar.setEvx( Evx );
214
215 VertexFit* vtxfit0 = VertexFit::instance();
216 vtxfit0->init();
217 vtxfit0->AddTrack( 0, wpiptrk );
218 vtxfit0->AddTrack( 1, wpimtrk );
219 vtxfit0->AddVertex( 0, vxpar, 0, 1 );
220 if ( !( vtxfit0->Fit( 0 ) ) ) continue;
221 vtxfit0->BuildVirtualParticle( 0 );
222 if ( vtxfit0->chisq( 0 ) > m_chisqCut ) continue;
223 WTrackParameter wKshort = vtxfit0->wVirtualTrack( 0 ); // FIXME
224 std::pair<int, int> pair;
225 pair.first = 3;
226 pair.second = 3;
227
228 EvtRecTrack* track0 = *( recTrackCol->begin() + ip1 );
229 EvtRecTrack* track1 = *( recTrackCol->begin() + ip2 );
230
231 EvtRecVeeVertex* KsVertex = new EvtRecVeeVertex;
232 KsVertex->setVertexId( 310 );
233 KsVertex->setVertexType( 0 );
234 KsVertex->setChi2( vtxfit0->chisq( 0 ) );
235 KsVertex->setNdof( 1 );
236 KsVertex->setMass( wKshort.p().m() );
237 KsVertex->setW( wKshort.w() );
238 KsVertex->setEw( wKshort.Ew() );
239 KsVertex->setPair( pair );
240 KsVertex->setNCharge( 0 );
241 KsVertex->setNTracks( 2 );
242 KsVertex->addDaughter( track0, 0 );
243 KsVertex->addDaughter( track1, 1 );
244 veeVertexCol->push_back( KsVertex );
245
246 /*
247 cout << "============= After Vertex fitting ===========" << endl;
248 cout << "Event number = " << evtNo << endl;
249 cout << "chi2 = " << vtxfit0->chisq(0) << endl;
250 cout << "mass = " << wKshort.p().m() << endl;
251 cout << "w = " << wKshort.w() << endl;
252 cout << "Ew = " << wKshort.Ew() << endl;
253 cout << "track 0 : Z : " << track0->mdcTrack()->z() << endl;
254 cout << "track 1 : Z : " << track1->mdcTrack()->z() << endl; */
255 }
256 }
257 }
258
259 return StatusCode::SUCCESS;
260}
HepGeom::Point3D< double > HepPoint3D
EvtRecTrackCol::iterator EvtRecTrackIterator
ObjectVector< EvtRecVeeVertex > EvtRecVeeVertexCol
double mpi
std::vector< int > Vint
Definition Gam4pikp.cxx:37
IMessageSvc * msgSvc()
void addDaughter(const SmartRef< EvtRecTrack > &track, int i)
void setPair(const std::pair< int, int > &pair)
void AddTrack(const int number, const double mass, const RecMdcTrack *trk)
Definition TrackPool.cxx:21
void AddTrack(const int index, RecMdcKalTrack *p, const RecMdcKalTrack::PidType pid)
static VertexFitRefine * instance()
void AddVertex(int number, VertexParameter vpar, std::vector< int > lis)
WTrackParameter wVirtualTrack(int n) const
void init()
Definition VertexFit.cxx:27
void AddVertex(int number, VertexParameter vpar, std::vector< int > lis)
Definition VertexFit.cxx:85
static VertexFit * instance()
Definition VertexFit.cxx:15
void BuildVirtualParticle(int number)
bool Fit()

◆ finalize()

StatusCode KShortReconstruction::finalize ( )

Definition at line 59 of file KShortReconstruction.cxx.

59 {
60 MsgStream log( msgSvc(), name() );
61 log << MSG::INFO << "in finalize()" << endmsg;
62
63 return StatusCode::SUCCESS;
64}

◆ initialize()

StatusCode KShortReconstruction::initialize ( )

Definition at line 51 of file KShortReconstruction.cxx.

51 {
52 MsgStream log( msgSvc(), name() );
53 log << MSG::INFO << "in initialize()" << endmsg;
54
55 return StatusCode::SUCCESS;
56}

The documentation for this class was generated from the following files: