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

#include <JsiLL.h>

Inheritance diagram for JsiLL:

Public Member Functions

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

Detailed Description

Definition at line 21 of file JsiLL.h.

Constructor & Destructor Documentation

◆ JsiLL()

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

Definition at line 44 of file JsiLL.cxx.

45 : Algorithm( name, pSvcLocator ) {
46
47 // Declare the properties
48 declareProperty( "Vr0cut", m_vr0cut = 5.0 );
49 declareProperty( "Vz0cut", m_vz0cut = 20.0 );
50 declareProperty( "Vr1cut", m_vr1cut = 1.0 );
51 declareProperty( "Vz1cut", m_vz1cut = 5.0 );
52 declareProperty( "Vctcut", m_cthcut = 0.93 );
53 declareProperty( "EnergyThreshold", m_energyThreshold = 0.04 );
54 declareProperty( "GammaAngCut", m_gammaAngCut = 20.0 );
55}

Referenced by JsiLL().

Member Function Documentation

◆ execute()

StatusCode JsiLL::execute ( )

Definition at line 105 of file JsiLL.cxx.

105 {
106
107 MsgStream log( msgSvc(), name() );
108 log << MSG::INFO << "in execute()" << endmsg;
109
110 // DQA
111 // Add the line below at the beginning of execute()
112 //
113 setFilterPassed( false );
114
115 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc(), "/Event/EventHeader" );
116 m_runNo = eventHeader->runNumber();
117 m_event = eventHeader->eventNumber();
118 log << MSG::DEBUG << "run, evtnum = " << m_runNo << " , " << m_event << endmsg;
119
120 SmartDataPtr<EvtRecEvent> evtRecEvent( eventSvc(), EventModel::EvtRec::EvtRecEvent );
121 log << MSG::DEBUG << "ncharg, nneu, tottks = " << evtRecEvent->totalCharged() << " , "
122 << evtRecEvent->totalNeutral() << " , " << evtRecEvent->totalTracks() << endmsg;
123
124 SmartDataPtr<EvtRecTrackCol> evtRecTrkCol( eventSvc(), EventModel::EvtRec::EvtRecTrackCol );
125
126 if ( evtRecEvent->totalNeutral() > 100 ) { return StatusCode::SUCCESS; }
127
128 Vint iGood, iplus, iminus;
129 iGood.clear();
130 iplus.clear();
131 iminus.clear();
132 Vp4 ppip, ppim;
133 ppip.clear();
134 ppim.clear();
135
136 Hep3Vector xorigin( 0, 0, 0 );
137
138 IVertexDbSvc* vtxsvc;
139 Gaudi::svcLocator()->service( "VertexDbSvc", vtxsvc ).ignore();
140 if ( vtxsvc->isVertexValid() )
141 {
142 double* dbv = vtxsvc->PrimaryVertex();
143 double* vv = vtxsvc->SigmaPrimaryVertex();
144 xorigin.setX( dbv[0] );
145 xorigin.setY( dbv[1] );
146 xorigin.setZ( dbv[2] );
147 }
148
149 int nCharge = 0;
150 for ( int i = 0; i < evtRecEvent->totalCharged(); i++ )
151 {
152 EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + i;
153 if ( !( *itTrk )->isMdcTrackValid() ) continue;
154 if ( !( *itTrk )->isMdcKalTrackValid() ) continue;
155 RecMdcTrack* mdcTrk = ( *itTrk )->mdcTrack();
156
157 double pch = mdcTrk->p();
158 double x0 = mdcTrk->x();
159 double y0 = mdcTrk->y();
160 double z0 = mdcTrk->z();
161 double phi0 = mdcTrk->helix( 1 );
162 double xv = xorigin.x();
163 double yv = xorigin.y();
164 double Rxy = fabs( ( x0 - xv ) * cos( phi0 ) + ( y0 - yv ) * sin( phi0 ) );
165
166 if ( fabs( z0 ) >= m_vz0cut ) continue;
167 if ( Rxy >= m_vr0cut ) continue;
168 // if(fabs(m_Vct)>=m_cthcut) continue;
169
170 // DQA
171 TH1* h( 0 );
172 if ( m_thsvc->getHist( "/DQAHist/JsiLL/hrxy", h ).isSuccess() ) { h->Fill( Rxy ); }
173 else { log << MSG::ERROR << "Couldn't retrieve hrxy" << endmsg; }
174 if ( m_thsvc->getHist( "/DQAHist/JsiLL/hz", h ).isSuccess() ) { h->Fill( z0 ); }
175 else { log << MSG::ERROR << "Couldn't retrieve hz" << endmsg; }
176
177 // iGood.push_back((*itTrk)->trackId());
178 iGood.push_back( i );
179 nCharge += mdcTrk->charge();
180 if ( mdcTrk->charge() > 0 ) { iplus.push_back( i ); }
181 else { iminus.push_back( i ); }
182 }
183
184 //
185 // Finish Good Charged Track Selection
186 //
187 int nGood = iGood.size();
188 log << MSG::DEBUG << "ngood, totcharge = " << nGood << " , " << nCharge << endmsg;
189 if ( ( nGood != 4 ) || ( nCharge != 0 ) ) { return StatusCode::SUCCESS; }
190
191 // for(int i = 0; i < nGood; i++) {
192 // EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + iGood[i];
193 // if(!(*itTrk)->isMdcKalTrackValid())
194 // return StatusCode::SUCCESS;
195 // }
196
197 int pidp0 = 5, pidp1 = 3, pidm0 = 5, pidm1 = 3; // PID
198
199 RecMdcKalTrack* itTrkp = ( *( evtRecTrkCol->begin() + iplus[0] ) )->mdcKalTrack();
200 RecMdcKalTrack* itTrkpip = ( *( evtRecTrkCol->begin() + iplus[1] ) )->mdcKalTrack();
201 RecMdcKalTrack* itTrkpb = ( *( evtRecTrkCol->begin() + iminus[0] ) )->mdcKalTrack();
202 RecMdcKalTrack* itTrkpim = ( *( evtRecTrkCol->begin() + iminus[1] ) )->mdcKalTrack();
203
204 // p() is not filled during reconstruction
205 double tmppp, tmpppb, tmpppip, tmpppim;
206 tmppp = sqrt( itTrkp->px() * itTrkp->px() + itTrkp->py() * itTrkp->py() +
207 itTrkp->pz() * itTrkp->pz() );
208 tmpppb = sqrt( itTrkpb->px() * itTrkpb->px() + itTrkpb->py() * itTrkpb->py() +
209 itTrkpb->pz() * itTrkpb->pz() );
210 tmpppip = sqrt( itTrkpip->px() * itTrkpip->px() + itTrkpip->py() * itTrkpip->py() +
211 itTrkpip->pz() * itTrkpip->pz() );
212 tmpppim = sqrt( itTrkpim->px() * itTrkpim->px() + itTrkpim->py() * itTrkpim->py() +
213 itTrkpim->pz() * itTrkpim->pz() );
214
215 if ( tmppp < tmpppip )
216 {
217 itTrkp = ( *( evtRecTrkCol->begin() + iplus[1] ) )->mdcKalTrack();
218 itTrkpip = ( *( evtRecTrkCol->begin() + iplus[0] ) )->mdcKalTrack();
219 pidp0 = 3;
220 pidp1 = 5;
221 double tmp;
222 tmp = tmppp;
223 tmppp = tmpppip;
224 tmpppip = tmp;
225 }
226 if ( tmpppb < tmpppim )
227 {
228 itTrkpb = ( *( evtRecTrkCol->begin() + iminus[1] ) )->mdcKalTrack();
229 itTrkpim = ( *( evtRecTrkCol->begin() + iminus[0] ) )->mdcKalTrack();
230 pidm0 = 3;
231 pidm1 = 5;
232 double tmp;
233 tmp = tmpppb;
234 tmpppb = tmpppim;
235 tmpppim = tmp;
236 }
237
238 if ( tmppp < 0.7 || tmppp > 1.1 ) return StatusCode::SUCCESS;
239 if ( tmpppb < 0.7 || tmpppb > 1.1 ) return StatusCode::SUCCESS;
240 if ( tmpppip > 0.35 ) return StatusCode::SUCCESS;
241 if ( tmpppim > 0.35 ) return StatusCode::SUCCESS;
242
245 itTrkpip->setPidType( RecMdcKalTrack::pion );
246 itTrkpim->setPidType( RecMdcKalTrack::pion );
247
248 m_chisq = 9999.0;
249 // Vertex Fit
250 HepPoint3D vx( 0., 0., 0. );
251 HepSymMatrix Evx( 3, 0 );
252 double bx = 1E+6;
253 double by = 1E+6;
254 double bz = 1E+6;
255 Evx[0][0] = bx * bx;
256 Evx[1][1] = by * by;
257 Evx[2][2] = bz * bz;
258
259 VertexParameter vxpar;
260 vxpar.setVx( vx );
261 vxpar.setEvx( Evx );
262
263 VertexFit* vtxfita0 = VertexFit::instance();
264 SecondVertexFit* vtxfita = SecondVertexFit::instance();
265 VertexFit* vtxfitb0 = VertexFit::instance();
266 SecondVertexFit* vtxfitb = SecondVertexFit::instance();
267 VertexFit* vtxfit = VertexFit::instance();
268
269 WTrackParameter wpip = WTrackParameter( mpi, itTrkpip->getZHelix(), itTrkpip->getZError() );
270 WTrackParameter wpim = WTrackParameter( mpi, itTrkpim->getZHelix(), itTrkpim->getZError() );
271 WTrackParameter wp = WTrackParameter( mproton, itTrkp->getZHelixP(), itTrkp->getZErrorP() );
272 WTrackParameter wpb =
273 WTrackParameter( mproton, itTrkpb->getZHelixP(), itTrkpb->getZErrorP() );
274
275 vtxfita0->init();
276 vtxfita0->AddTrack( 0, wp );
277 vtxfita0->AddTrack( 1, wpim );
278 vtxfita0->AddVertex( 0, vxpar, 0, 1 );
279 if ( !vtxfita0->Fit( 0 ) ) return StatusCode::SUCCESS;
280 vtxfita0->Swim( 0 );
281 vtxfita0->BuildVirtualParticle( 0 );
282 vtxfita->init();
283 vtxfita->AddTrack( 0, vtxfita0->wVirtualTrack( 0 ) );
284 vtxfita->setVpar( vtxfita0->vpar( 0 ) );
285 if ( !vtxfita->Fit() ) return StatusCode::SUCCESS;
286
287 WTrackParameter wLambda = vtxfita->wpar();
288
289 vtxfitb0->init();
290 vtxfitb0->AddTrack( 0, wpb );
291 vtxfitb0->AddTrack( 1, wpip );
292 vtxfitb0->AddVertex( 0, vxpar, 0, 1 );
293 if ( !vtxfitb0->Fit( 0 ) ) return StatusCode::SUCCESS;
294 vtxfitb0->Swim( 0 );
295 vtxfitb0->BuildVirtualParticle( 0 );
296
297 vtxfitb->init();
298 vtxfitb->AddTrack( 0, vtxfitb0->wVirtualTrack( 0 ) );
299 vtxfitb->setVpar( vtxfitb0->vpar( 0 ) );
300 if ( !vtxfitb->Fit() ) return StatusCode::SUCCESS;
301
302 WTrackParameter wLambdabar = vtxfitb->wpar();
303
304 vtxfit->init();
305 vtxfit->AddTrack( 0, wLambda );
306 vtxfit->AddTrack( 1, wLambdabar );
307 vtxfit->AddVertex( 0, vxpar, 0, 1 );
308 if ( !vtxfit->Fit( 0 ) ) return StatusCode::SUCCESS;
309 vtxfit->Swim( 0 );
310 WTrackParameter wwLambda = vtxfit->wtrk( 0 );
311 WTrackParameter wwLambdabar = vtxfit->wtrk( 1 );
312
313 // Kinamatic Fit
314
315 KinematicFit* kmfit = KinematicFit::instance();
316
317 HepLorentzVector ecms( 0.034065, 0.0, 0.0, 3.0969 );
318 const Hep3Vector u_cms = -ecms.boostVector();
319
320 kmfit->init();
321 kmfit->AddTrack( 0, wwLambda );
322 kmfit->AddTrack( 1, wwLambdabar );
323 kmfit->AddFourMomentum( 0, ecms );
324
325 if ( !kmfit->Fit() ) return StatusCode::SUCCESS;
326 m_chisq = kmfit->chisq();
327 if ( m_chisq > 50 ) return StatusCode::SUCCESS;
328 HepLorentzVector kmf_pLambda = kmfit->pfit( 0 );
329 HepLorentzVector kmf_pLambdabar = kmfit->pfit( 1 );
330
331 kmf_pLambda.boost( u_cms );
332 kmf_pLambdabar.boost( u_cms );
333 m_mLambda = kmf_pLambda.m();
334 m_mLambdabar = kmf_pLambdabar.m();
335 m_pLambda = kmf_pLambda.rho();
336 m_pLambdabar = kmf_pLambdabar.rho();
337
338 if ( fabs( m_mLambda - 1.1157 ) > 0.003 || fabs( m_mLambdabar - 1.1157 ) > 0.003 )
339 return StatusCode::SUCCESS;
340 // finale selection
341
342 m_tuple->write().ignore();
343 // return StatusCode::SUCCESS;
344
345 ////////////////////////////////////////////////////////////
346 // DQA
347 // set tag and quality
348
349 // Pid: 1 - electron, 2 - muon, 3 - pion, 4 - kaon, 5 - proton
350 ( *( evtRecTrkCol->begin() + iplus[0] ) )->setPartId( pidp0 );
351 ( *( evtRecTrkCol->begin() + iplus[1] ) )->setPartId( pidp1 );
352 ( *( evtRecTrkCol->begin() + iminus[0] ) )->setPartId( pidm0 );
353 ( *( evtRecTrkCol->begin() + iminus[1] ) )->setPartId( pidm1 );
354 // Quality: defined by whether dE/dx or TOF is used to identify particle
355 // 0 - no dE/dx, no TOF (can be used for dE/dx and TOF calibration)
356 // 1 - only dE/dx (can be used for TOF calibration)
357 // 2 - only TOF (can be used for dE/dx calibration)
358 // 3 - Both dE/dx and TOF
359 ( *( evtRecTrkCol->begin() + iplus[0] ) )->setQuality( 0 );
360 ( *( evtRecTrkCol->begin() + iplus[1] ) )->setQuality( 0 );
361 ( *( evtRecTrkCol->begin() + iminus[0] ) )->setQuality( 0 );
362 ( *( evtRecTrkCol->begin() + iminus[1] ) )->setQuality( 0 );
363
364 // DQA
365 // Add the line below at the end of execute(), (before return)
366 //
367 setFilterPassed( true );
368 ////////////////////////////////////////////////////////////
369
370 return StatusCode::SUCCESS;
371}
HepGeom::Point3D< double > HepPoint3D
const Hep3Vector u_cms
EvtRecTrackCol::iterator EvtRecTrackIterator
double mpi
std::vector< HepLorentzVector > Vp4
Definition Gam4pikp.cxx:38
std::vector< int > Vint
Definition Gam4pikp.cxx:37
const double mproton
Definition PipiJpsi.cxx:49
IMessageSvc * msgSvc()
const HepVector helix() const
......
virtual bool isVertexValid()=0
virtual double * SigmaPrimaryVertex()=0
virtual double * PrimaryVertex()=0
static KinematicFit * instance()
void AddFourMomentum(int number, HepLorentzVector p4)
static SecondVertexFit * instance()
void AddTrack(const int number, const double mass, const RecMdcTrack *trk)
Definition TrackPool.cxx:21
WTrackParameter wtrk(int n) const
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()
const double ecms
Definition inclkstar.cxx:26

◆ finalize()

StatusCode JsiLL::finalize ( )

Definition at line 374 of file JsiLL.cxx.

374 {
375
376 MsgStream log( msgSvc(), name() );
377 log << MSG::INFO << "in finalize()" << endmsg;
378 return StatusCode::SUCCESS;
379}

◆ initialize()

StatusCode JsiLL::initialize ( )

Definition at line 58 of file JsiLL.cxx.

58 {
59 MsgStream log( msgSvc(), name() );
60
61 log << MSG::INFO << "in initialize()" << endmsg;
62 StatusCode status;
63
64 // DQA
65 // The first directory specifier must be "DQAFILE"
66 // The second is the control sample name, the first letter is in upper format. eg. "Rhopi"
67 NTuplePtr nt( ntupleSvc(), "DQAFILE/JsiLL" );
68 if ( nt ) m_tuple = nt;
69 else
70 {
71 m_tuple = ntupleSvc()->book( "DQAFILE/JsiLL", CLID_ColumnWiseTuple, "JsiLL ntuple" );
72 if ( m_tuple )
73 {
74 status = m_tuple->addItem( "runNo", m_runNo );
75 status = m_tuple->addItem( "event", m_event );
76 status = m_tuple->addItem( "chisq", m_chisq );
77 status = m_tuple->addItem( "mLambda", m_mLambda );
78 status = m_tuple->addItem( "mLambdabar", m_mLambdabar );
79 status = m_tuple->addItem( "pLambda", m_pLambda );
80 status = m_tuple->addItem( "pLambdabar", m_pLambdabar );
81 }
82 else { log << MSG::ERROR << "Can not book N-tuple:" << long( m_tuple ) << endmsg; }
83 }
84
85 if ( service( "THistSvc", m_thsvc ).isFailure() )
86 {
87 log << MSG::ERROR << "Couldn't get THistSvc" << endmsg;
88 return StatusCode::FAILURE;
89 }
90
91 // "DQAHist" is fixed
92 // "Rhopi" is control sample name, just as ntuple case.
93 TH1F* hrxy = new TH1F( "Rxy", "Rxy distribution", 110, -1., 10. );
94 if ( m_thsvc->regHist( "/DQAHist/JsiLL/hrxy", hrxy ).isFailure() )
95 { log << MSG::ERROR << "Couldn't register Rxy" << endmsg; }
96 TH1F* hz = new TH1F( "z", "z distribution", 200, -100., 100. );
97 if ( m_thsvc->regHist( "/DQAHist/JsiLL/hz", hz ).isFailure() )
98 { log << MSG::ERROR << "Couldn't register z" << endmsg; }
99
100 log << MSG::INFO << "successfully return from initialize()" << endmsg;
101 return StatusCode::SUCCESS;
102}
INTupleSvc * ntupleSvc()

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