BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
FTFinder.cxx
Go to the documentation of this file.
1#include <cmath>
2#include <iostream>
3
4#include "GaudiKernel/Bootstrap.h"
5#include "GaudiKernel/IDataManagerSvc.h"
6#include "GaudiKernel/IDataProviderSvc.h"
7#include "GaudiKernel/IMessageSvc.h"
8#include "GaudiKernel/IPartPropSvc.h"
9#include "GaudiKernel/ISvcLocator.h"
10#include "GaudiKernel/MsgStream.h"
11#include "GaudiKernel/PropertyMgr.h"
12#include "GaudiKernel/SmartDataPtr.h"
13#include "GaudiKernel/SmartRef.h"
14#include "GaudiKernel/SmartRefVector.h"
15#include "GaudiKernel/StatusCode.h"
16
17#include "EvTimeEvent/RecEsTime.h"
18#include "EventModel/EventHeader.h"
19#include "Identifier/Identifier.h"
20#include "Identifier/MdcID.h"
21#include "MdcGeomSvc/IMdcGeomSvc.h"
22#include "MdcGeomSvc/MdcGeoLayer.h"
23#include "MdcGeomSvc/MdcGeoSuper.h"
24#include "MdcGeomSvc/MdcGeoWire.h"
25#include "MdcRawEvent/MdcDigi.h"
26#include "MdcRecEvent/RecMdcHit.h"
27#include "MdcRecEvent/RecMdcTrack.h"
28#include "RawDataProviderSvc/IRawDataProviderSvc.h"
29#include "RawEvent/RawDataUtil.h"
30#include "ReconEvent/ReconEvent.h"
31#include "TrigEvent/TrigData.h"
32#include "TrigEvent/TrigGTD.h"
33#include "TrigEvent/TrigGTDProvider.h"
34#include "TrigEvent/TrigMdc.h"
35
36#include "FTFinder.h"
37#include "FTGeom.h"
38#include "FTLayer.h"
39#include "FTList.h"
40#include "FTSegment.h"
41#include "FTSuperLayer.h"
42#include "FTTrack.h"
43#include "FTWire.h"
44#include "MdcParameter.h"
45#include "ntupleItem.h"
46
47#ifndef OnlineMode
48# include "McTruth/McParticle.h"
49
50# include "AIDA/IAxis.h"
51# include "AIDA/IHistogram1D.h"
52# include "AIDA/IHistogram2D.h"
53# include "AIDA/IHistogram3D.h"
54# include "AIDA/IHistogramFactory.h"
55#endif
56
57using namespace Event;
58
59#ifndef OnlineMode
60
61extern NTuple::Item<long> g_ntrkMC, g_eventNo;
62extern NTuple::Array<float> g_theta0MC, g_phi0MC;
63extern NTuple::Array<float> g_pxMC, g_pyMC, g_pzMC, g_ptMC;
64
65// recon
66
67extern NTuple::Item<long> g_ntrk;
68extern NTuple::Array<float> g_px, g_py, g_pz, g_pt, g_p;
69extern NTuple::Array<float> g_phi, g_theta;
70extern NTuple::Array<float> g_vx, g_vy, g_vz;
71extern NTuple::Array<float> g_dr, g_phi0, g_kappa, g_dz, g_tanl;
72extern NTuple::Item<float> g_estime;
73
74extern IHistogram1D* g_ncellMC;
75extern IHistogram1D* g_ncell;
76extern IHistogram1D* g_naxialhit;
77extern IHistogram1D* g_nstereohit;
78extern IHistogram1D* g_nhit;
79extern IHistogram2D* g_hitmap[20];
80
82
83#endif
84
85FTSuperLayer* FTFinder::superLayer( int id ) const { return m_geom->getSuperLayer( id ); }
86FTList<FTTrack*>& FTFinder::tracks() { return _tracks; }
87void FTFinder::setAlgorithmPointer( Algorithm* alg ) { m_algorithm = alg; }
88
89int FTFinder::getWireId( FTWire* w ) const { return w->getWireId(); }
90
91float FTFinder::x2t( const FTLayer* l, const float x ) const {
92 return ( x * x ) / ( param->_xtCoEff * param->_xtCoEff * l->csize() );
93}
94
95float FTFinder::t2x( const FTLayer* l, const float t ) const {
96 float x = ( t > 0.0f ) ? (( param->_xtCoEff ))*sqrt( t * l->csize() ) : 0.0f;
97 if ( x > 0.47f * l->csize() )
98 {
99 x = 0.0004f * t +
100 0.47f * l->csize() *
101 ( 1.0f - 0.0004f * 0.47f / ( ( param->_xtCoEff ) * ( param->_xtCoEff ) ) );
102 }
103
104 return x;
105}
106
107Hep3Vector FTFinder::vertex() const { return Hep3Vector( _vx, _vy, _vz ); }
108
109MdcParameter* FTFinder::param = MdcParameter::instance();
110
112 : tOffSet( 0 )
113 , t0Estime( -999 )
114 , tEstFlag( 0 )
115 , tEstime( 10 )
116 , _tracks( 0 )
117 , _linkedSegments( 0 )
118 , _axialSegCollect( 0 )
119 , _vx( 0 )
120 , _vy( 0 )
121 , _vz( 0 )
122 , _ExpNo( 0 )
123 , _RunNo( 0 )
124 , m_total_trk( 0 )
125 , pivot( 0, 0, 0 ) {
126 StatusCode scmgn = Gaudi::svcLocator()->service( "MagneticFieldSvc", m_pmgnIMF );
127 if ( scmgn != StatusCode::SUCCESS )
128 { std::cout << "Unable to open Magnetic field service" << std::endl; }
129}
130
132 if ( !param->_doIt ) return;
133
134 // Get the Particle Properties Service
135 IPartPropSvc* p_PartPropSvc;
136 StatusCode PartPropStatus = Gaudi::svcLocator()->service( "PartPropSvc", p_PartPropSvc );
137
138 if ( !PartPropStatus.isSuccess() )
139 {
140 std::cerr << "Could not initialize Particle Properties Service" << std::endl;
141 return;
142 }
143 m_particleTable = p_PartPropSvc->PDT();
144
145 StatusCode RawData =
146 Gaudi::svcLocator()->service( "RawDataProviderSvc", m_rawDataProviderSvc );
147 if ( !RawData.isSuccess() )
148 {
149 std::cerr << "Could not load RawDataProviderSvc!" << m_rawDataProviderSvc << endmsg;
150 return;
151 }
152}
153
155 eventNo = 0;
156 runNo = 0;
157 expflag = 0;
158 if ( !param->_doIt ) return;
159 _ExpNo = 0;
160 _RunNo = 0;
161
162 IMdcGeomSvc* mdcGeomSvc;
163 StatusCode sc = Gaudi::svcLocator()->service( "MdcGeomSvc", mdcGeomSvc );
164
165 if ( !sc.isSuccess() ) return;
166
167 m_geom = FTGeom::instance();
168}
169
171 if ( !param->_doIt ) return;
172
173 IMessageSvc* msgSvc;
174 Gaudi::svcLocator()->service( "MessageSvc", msgSvc ).ignore();
175
176 MsgStream log( msgSvc, "FTFinder" );
177
178 IDataProviderSvc* eventSvc;
179 Gaudi::svcLocator()->service( "EventDataSvc", eventSvc ).ignore();
180
181 //--
182 // clear old information
183 //--
184 clear();
185
186 // check whether Recon already registered
187 DataObject* aReconEvent;
188 eventSvc->findObject( "/Event/Recon", aReconEvent ).ignore();
189 if ( !aReconEvent )
190 {
191 // register ReconEvent Data Object to TDS;
192 ReconEvent* recevt = new ReconEvent;
193 StatusCode sc = eventSvc->registerObject( "/Event/Recon", recevt );
194 if ( sc != StatusCode::SUCCESS )
195 {
196 log << MSG::FATAL << "Could not register ReconEvent" << endmsg;
197 return;
198 }
199 }
200
201 // register Event start time
202 IDataManagerSvc* dataManSvc;
203 Gaudi::svcLocator()->service( "EventDataSvc", dataManSvc ).ignore();
204
205 DataObject* aEsTimeEvent;
206 eventSvc->findObject( "/Event/Recon/RecEsTimeCol", aEsTimeEvent ).ignore();
207 if ( aEsTimeEvent )
208 {
209 dataManSvc->clearSubTree( "/Event/Recon/RecEsTimeCol" ).ignore();
210 eventSvc->unregisterObject( "/Event/Recon/RecEsTimeCol" ).ignore();
211 }
212
213 RecEsTimeCol* aRecEsTimeCol = new RecEsTimeCol;
214 StatusCode est;
215 est = eventSvc->registerObject( "/Event/Recon/RecEsTimeCol", aRecEsTimeCol );
216 if ( est.isFailure() )
217 {
218 log << MSG::FATAL << "Could not register RecEsTimeCol" << endmsg;
219 return;
220 }
221 log << MSG::DEBUG << "RecEsTimeCol registered successfully!" << endmsg;
222
223 //--
224 // update wirehit information
225 //--
226 updateMdc();
227
228 //--
229 // segment finding
230 //--
231 for ( int i = 0; i < 11; i++ ) { m_geom->getSuperLayer( i )->mkSegmentList(); }
232
233 //--
234 // reduce noise and get start time from segment fit
235 //--
236 for ( int i = 0; i < 10; i++ ) { m_geom->getSuperLayer( i )->reduce_noise( tEstime ); }
237
238 getTestime();
239
240 //--
241 // axial segment linking
242 //--
243 mkTrackList();
244
245 //--
246 // 2D track fitting
247 //--
248 //(*_superLayer).reAppendSalvage();
249 log << MSG::DEBUG << "number of 2D tracks: " << _tracks.size() << endmsg;
250
251#ifndef OnlineMode
252 num_2Dtrk += _tracks.size();
253#endif
254
255 for ( auto it = _tracks.begin(); it != _tracks.end(); )
256 {
257 if ( !( *it )->r_phiFit() )
258 {
259 delete *it;
260 it = _tracks.erase( it );
261 int tmp_index = std::distance( _tracks.begin(), it );
262 log << MSG::DEBUG << "===========> deleted 2D track : " << tmp_index << endmsg;
263 }
264 else it++;
265 }
266
267 if ( t0Estime != -999 )
268 {
269 // begin to make Event start time
270 RecEsTime* arecestime = new RecEsTime;
271 arecestime->setTest( t0Estime );
272 arecestime->setStat( tEstFlag );
273 aRecEsTimeCol->push_back( arecestime );
274 }
275
276 if ( !_tracks.size() )
277 {
278 makeTds().ignore();
279 return;
280 }
281
282 ///--
283 /// vertex(r-phi) fit and event timing correction
284 //--
285 int vtx_flag = VertexFit( 0 );
286 evtTiming = ( param->_evtTimeCorr ) ? CorrectEvtTiming() : 0;
287
288 ///--
289 /// 2D track re-fitting
290 //--
291 if ( param->_hitscut == 1 )
292 {
293 for ( auto trk_i : _tracks ) { trk_i->r_phiReFit( _vx, _vy, vtx_flag ); }
294 }
295
296 //--
297 // cut bad hits from 2D track re-fitting
298 if ( param->_hitscut == 2 )
299 {
300 for ( auto trk_i : _tracks )
301 {
302 for ( int j = 0; j < 2; j++ )
303 {
304 i_rPhiFit = trk_i->r_phi2Fit( _vx, _vy, vtx_flag );
305 if ( i_rPhiFit != -99 ) trk_i->r_phi3Fit( i_rPhiFit, _vx, _vy, vtx_flag );
306 }
307 trk_i->r_phi4Fit( _vx, _vy, vtx_flag );
308 }
309 }
310
311 //--
312 // stereo segment linking
313 //--
314 mkTrack3D();
315
316 //--
317 // final track fittng
318 //--
319 log << MSG::DEBUG << "number of 3D tracks: " << _tracks.size() << endmsg;
320
321#ifndef OnlineMode
322 num_3Dtrk += _tracks.size();
323#endif
324
325 for ( auto it = _tracks.begin(); it != _tracks.end(); )
326 {
327
328 int trk_index = std::distance( _tracks.begin(), it ) + 1;
329
330#ifndef OnlineMode
331 log << MSG::DEBUG << "=======> 3D track: " << trk_index << endmsg;
332 ( *it )->printout();
333#endif
334
335 if ( ( *it )->get_nhits() < 18 )
336 {
337 delete ( *it );
338 log << MSG::DEBUG << "================> deleted 3D track : " << trk_index << endmsg;
339 it = _tracks.erase( it );
340 }
341 else it++;
342 }
343
344 if ( !_tracks.size() )
345 {
346 makeTds().ignore();
347 return;
348 }
349
350 for ( auto trk_i : _tracks ) trk_i->s_zFit();
351
352 //--
353 // find primary event vertex
354 //--
355 if ( param->_findEventVertex ) { VertexFit( 1 ); }
356
357 log << MSG::DEBUG << "final number of tracks: " << _tracks.size() << endmsg;
358
359#ifndef OnlineMode
360 num_finaltrk += _tracks.size();
361 if ( param->_mkMdst ) makeMdst();
362#endif
363
364 //--
365 // output tracking result into TDS
366 // by wangdy
367 //--
368 if ( param->_mkTds ) makeTds().ignore();
369}
370
371int FTFinder::updateMdc() {
372 IMessageSvc* msgSvc;
373 Gaudi::svcLocator()->service( "MessageSvc", msgSvc ).ignore();
374
375 MsgStream log( msgSvc, "FTFinder" );
376
377 IDataProviderSvc* eventSvc;
378 Gaudi::svcLocator()->service( "EventDataSvc", eventSvc ).ignore();
379
380 if ( !eventSvc )
381 {
382 log << MSG::FATAL << "Could not find EventDataSvc" << endmsg;
383 return 0;
384 }
385
386 // Part 1: Get the event header, print out event and run number
387
388 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc, "/Event/EventHeader" );
389 if ( !eventHeader )
390 {
391 log << MSG::FATAL << "Could not find Event Header" << endmsg;
392 return 0;
393 }
394
395 log << MSG::DEBUG << "MdcFastTrkAlg: retrieved event: " << eventHeader->eventNumber()
396 << " run: " << eventHeader->runNumber() << endmsg;
397
398 eventNo = eventHeader->eventNumber();
399 runNo = eventHeader->runNumber();
400 if ( runNo > 0 ) expflag = 1;
401 else expflag = 0;
402 int digiId;
403
404#ifndef OnlineMode
405 g_eventNo = eventHeader->eventNumber();
406
407 // Part 2: Retrieve MC truth
408 SmartDataPtr<McParticleCol> mcParticleCol( eventSvc, "/Event/MC/McParticleCol" );
409 if ( !mcParticleCol ) { log << MSG::WARNING << "Could not find McParticle" << endmsg; }
410 else
411 {
412 McParticleCol::iterator iter_mc = mcParticleCol->begin();
413
414 digiId = 0;
415 int ntrkMC = 0;
416 int charge = 0;
417
418 for ( ; iter_mc != mcParticleCol->end(); iter_mc++, digiId++ )
419 {
420 log << MSG::DEBUG << "MDC digit No: " << digiId << endmsg;
421 log << MSG::DEBUG << " particleId = " << ( *iter_mc )->particleProperty() << endmsg;
422 int statusFlags = ( *iter_mc )->statusFlags();
423 int pid = ( *iter_mc )->particleProperty();
424 if ( pid > 0 )
425 {
426 if ( m_particleTable->particle( pid ) )
427 { charge = (int)m_particleTable->particle( pid )->charge(); }
428 }
429 else if ( pid < 0 )
430 {
431 if ( m_particleTable->particle( -pid ) )
432 {
433 charge = (int)m_particleTable->particle( -pid )->charge();
434 charge *= -1;
435 }
436 }
437 else { log << MSG::WARNING << "wrong particle id, please check data" << endmsg; }
438
439 if ( charge == 0 || abs( cos( ( *iter_mc )->initialFourMomentum().theta() ) ) > 0.93 )
440 continue;
441
442 g_theta0MC[ntrkMC] = ( *iter_mc )->initialFourMomentum().theta();
443 g_phi0MC[ntrkMC] = ( *iter_mc )->initialFourMomentum().phi();
444 g_pxMC[ntrkMC] = ( *iter_mc )->initialFourMomentum().px();
445 g_pyMC[ntrkMC] = ( *iter_mc )->initialFourMomentum().py();
446 g_pzMC[ntrkMC] = ( *iter_mc )->initialFourMomentum().pz();
447 g_ptMC[ntrkMC] =
448 0.001 * sqrt( g_pxMC[ntrkMC] * g_pxMC[ntrkMC] + g_pyMC[ntrkMC] * g_pyMC[ntrkMC] );
449 ntrkMC++;
450 }
451 g_ntrkMC = ntrkMC;
452 }
453#endif
454
455#ifdef MultiThread
456 // Part 3: Retrieve MDC digi
457 SmartDataPtr<MdcDigiCol> mdcDigiVec( eventSvc, "/Event/Digi/MdcDigiCol" );
458 if ( !mdcDigiVec )
459 {
460 log << MSG::FATAL << "Could not find MDC digi" << endmsg;
461 return ( StatusCode::FAILURE );
462 }
463 MdcDigiCol::iterator iter1 = mdcDigiVec->begin();
464 digiId = 0;
465 Identifier mdcId;
466 int layerId;
467 int wireId;
468 for ( ; iter1 != mdcDigiVec->end(); iter1++, digiId++ )
469 {
470#else
471 //--use RawDataProvider to get MdcDigi
472 // bool m_dropRecHits=true;//or false
473 MdcDigiVec mdcDigiVec = m_rawDataProviderSvc->getMdcDigiVec(); // call MdcRawDataProvider
474 MdcDigiVec::iterator iter1 = mdcDigiVec.begin();
475 digiId = 0;
476 Identifier mdcId;
477 int layerId;
478 int wireId;
479 for ( ; iter1 != mdcDigiVec.end(); iter1++, digiId++ )
480 {
481#endif
482
483 mdcId = ( *iter1 )->identify();
484 layerId = MdcID::layer( mdcId );
485 wireId = MdcID::wire( mdcId );
486
487#ifndef OnlineMode
488 log << MSG::DEBUG << "MDC digit No: " << digiId << endmsg;
489 log << MSG::DEBUG
490 << " time_channel = " << RawDataUtil::MdcTime( ( *iter1 )->getTimeChannel() )
491 << " charge_channel = " << RawDataUtil::MdcCharge( ( *iter1 )->getChargeChannel() )
492 << " layerId = " << layerId << " wireId = " << wireId << endmsg;
493#endif
494
495 const int localwid = wireId;
496 const int wid = m_geom->layer2wireStart( layerId ) + localwid;
497
498#ifndef OnlineMode
499 g_ncellMC->fill( wid, 1.0 );
500#endif
501
502 //... skip invalid wireID's
503 if ( wid < 0 || wid > 6795 )
504 {
505 std::cout << "FTFinder::updateMdc(): wid out of range: " << wid << std::endl;
506 continue;
507 }
508
509 FTWire* w = m_geom->getWire( wid );
510 float tdc = RawDataUtil::MdcTime( ( *iter1 )->getTimeChannel() );
511 float adc = RawDataUtil::MdcCharge( ( *iter1 )->getChargeChannel() );
512
513#ifndef OnlineMode
514 if ( eventNo == 466 ) { g_hitmap[0]->fill( w->x(), w->y() ); }
515 if ( eventNo == 538 ) { g_hitmap[1]->fill( w->x(), w->y() ); }
516 if ( eventNo == 408 ) { g_hitmap[2]->fill( w->x(), w->y() ); }
517 if ( eventNo == 499 ) { g_hitmap[3]->fill( w->x(), w->y() ); }
518 if ( eventNo == 603 ) { g_hitmap[4]->fill( w->x(), w->y() ); }
519 if ( eventNo == 938 ) { g_hitmap[5]->fill( w->x(), w->y() ); }
520#endif
521
522 // tdc/adc calibration
523 // new tdc include drift time and flight time
524 float time = tdc - sqrt( w->x() * w->x() + w->y() * w->y() ) / 30;
525 w->time( time );
526 w->wireId( wid );
527 w->setAdc( adc );
528
529 //... check adc validation
530 FTLayer* lyr = w->layer();
531
532 //... save to the array
533 // w->distance(time*40*0.0001); //original
534 w->distance( 0.0 ); // by X.-R. Lu
535 w->setChi2( 999 );
536 w->state( FTWireHit );
537 FTSuperLayer* sup = m_geom->getSuperLayer( m_geom->layer2superLayer( lyr->layerId() ) );
538 sup->appendHit( w );
539 }
540
541 return 1;
542}
543
544void FTFinder::clear() {
545 evtTiming = 0;
546
547 for ( int i = 0; i < 11; i++ ) { m_geom->getSuperLayer( i )->clear(); }
548
549 // for ( auto trk_i : _tracks ) delete trk_i;
550 _tracks.clear();
551
552 // for ( auto seg_i : _axialSegCollect ) delete seg_i;
553 _axialSegCollect.clear();
554
555 _vx = -99999.;
556 _vy = -99999.;
557 _vz = -99999.;
558
559 for ( auto& v : tEstime ) { v.clear(); }
560}
561
562void FTFinder::getTestime() {
563 IMessageSvc* msgSvc;
564 Gaudi::svcLocator()->service( "MessageSvc", msgSvc ).ignore();
565
566 MsgStream log( msgSvc, "FTFinder" );
567
568 IDataProviderSvc* eventSvc;
569 Gaudi::svcLocator()->service( "EventDataSvc", eventSvc ).ignore();
570
571 float sumT = 0, estime = 0;
572 int n = 0;
573 t0Estime = -999;
574
575 for ( auto& tEstimeVec : tEstime )
576 {
577 for ( auto tEstime_i : tEstimeVec )
578 {
579 if ( tEstime_i != 0 )
580 {
581 sumT += tEstime_i;
582 n++;
583 }
584 }
585 }
586
587 if ( n != 0 )
588 {
589 estime = sumT / n;
590 estime += _t0cal;
591
592 if ( estime > -1 )
593 {
594 if ( expflag == 0 )
595 {
596 int nbunch = ( (int)( estime - tOffSet ) ) / _bunchtime;
597 if ( ( (int)( estime - tOffSet ) ) % (int)_bunchtime > _bunchtime / 2 )
598 nbunch = nbunch + 1;
599 t0Estime = nbunch * _bunchtime + tOffSet;
600 }
601 else { t0Estime = estime; }
602
603 int trigtimming = 0;
604
605 // Retrieve trigger timming information
606 // timing system: TOF:1, MDC:2, EMC:3, NONE:0
607 SmartDataPtr<TrigData> trigData( eventSvc, "/Event/Trig/TrigData" );
608 if ( trigData )
609 {
610 trigtimming = trigData->getTimingType();
611 log << MSG::INFO << "Timing type: " << trigData->getTimingType() << endmsg;
612 }
613
614 if ( trigtimming == 1 ) tEstFlag = 117;
615 if ( trigtimming == 2 ) tEstFlag = 127;
616 if ( trigtimming == 3 ) tEstFlag = 137;
617 if ( trigtimming == 0 ) tEstFlag = 107;
618
619#ifndef OnlineMode
620 g_estime = estime;
621#endif
622 }
623 }
624}
625
626void FTFinder::mkTrackList() {
627 IMessageSvc* msgSvc;
628 Gaudi::svcLocator()->service( "MessageSvc", msgSvc ).ignore();
629
630 MsgStream log( msgSvc, "FTFinder" );
631
632 FTList<FTSegment*> inner_segments;
633 FTList<FTSegment*> outer_segments;
634
635 linkAxialSuperLayer234( inner_segments );
636 linkAxialSuperLayer910( outer_segments );
637
638 _axialSegCollect.insert( _axialSegCollect.end(), inner_segments.begin(),
639 inner_segments.end() );
640 _axialSegCollect.insert( _axialSegCollect.end(), outer_segments.begin(),
641 outer_segments.end() );
642
643 int innerN = inner_segments.size();
644 int outerN = outer_segments.size();
645
646 log << MSG::DEBUG << innerN << " segments in inner axial layers!" << endmsg;
647 log << MSG::DEBUG << outerN << " segments in outer axial layers!" << endmsg;
648
649 for ( auto inner : inner_segments )
650 {
651 if ( inner->track() ) continue;
652 FTTrack* track_cand = nullptr;
653
654#ifndef OnlineMode
655 inner->printout();
656#endif
657
658 if ( outerN == 0 )
659 {
660 track_cand = linkAxialSegments( inner, nullptr );
661 if ( !track_cand ) continue;
662 _linkedSegments = FTList<FTSegment*>( 5 );
663
664 // append this to _tracks
665 const FTList<FTSegment*>& segments = track_cand->axial_segments();
666
667 for ( auto seg_i : segments ) { seg_i->track( track_cand ); }
668
669 _tracks.push_back( track_cand );
670 track_cand->setFTFinder( this );
671 continue;
672 }
673
674 for ( auto outer : outer_segments )
675 {
676 if ( outer->track() )
677 { // already used
678 if ( outer == outer_segments.back() )
679 { // if the last outer segment
680 if ( inner->track() ) continue; // inner segment never used
681 track_cand = linkAxialSegments( inner, nullptr );
682 if ( !track_cand ) continue;
683 _linkedSegments = FTList<FTSegment*>( 5 );
684 // append this to _tracks
685 const FTList<FTSegment*>& segments = track_cand->axial_segments();
686
687 for ( auto seg_i : segments ) { seg_i->track( track_cand ); }
688 _tracks.push_back( track_cand );
689 track_cand->setFTFinder( this );
690 }
691 continue;
692 }
693
694 track_cand = linkAxialSegments( inner, outer );
695
696 if ( !track_cand )
697 { // link failed
698 if ( outer == outer_segments.back() )
699 { // if the last outer segment
700 if ( inner->track() ) continue; // inner segment never used
701 track_cand = linkAxialSegments( inner, nullptr );
702 }
703 if ( !track_cand ) continue;
704 }
705
706 _linkedSegments = FTList<FTSegment*>( 5 );
707
708 // compair this to appended track candidate
709
710 const FTList<FTSegment*>& segments = track_cand->axial_segments();
711
712 // compare this to the appended track candidate
713 if ( inner->track() )
714 { // already used
715 FTTrack* trk_tmp = inner->track();
716
717 int nTrks = _tracks.size();
718 auto cache_it = _tracks.end();
719
720 for ( auto it = _tracks.begin(); it != _tracks.end(); it++ )
721 {
722 if ( *it == trk_tmp )
723 {
724 cache_it = it;
725 break;
726 }
727 }
728
729 const FTList<FTSegment*>& segments2 = trk_tmp->axial_segments();
730
731 int n2 = segments2.size();
732 if ( segments.size() >= segments2.size() &&
733 track_cand->chi2_kappa_tmp() < trk_tmp->chi2_kappa_tmp() )
734 {
735 // swap this and appended one
736 for ( auto seg2_i : segments2 ) { seg2_i->track( nullptr ); }
737 for ( auto seg_i : segments ) { seg_i->track( track_cand ); }
738
739 *cache_it = track_cand;
740 track_cand->setFTFinder( this );
741 delete trk_tmp;
742 }
743 else { delete track_cand; }
744 }
745 else
746 {
747 // append this
748 for ( auto seg_i : segments ) { seg_i->track( track_cand ); }
749 _tracks.push_back( track_cand );
750 track_cand->setFTFinder( this );
751 }
752 } // end of loop of outerN
753 } // end of loop innerN
754
755#ifndef OnlineMode
756 int i = 0;
757 for ( auto trk_i : _tracks )
758 {
759 const FTList<FTSegment*>& segments = trk_i->axial_segments();
760 log << MSG::DEBUG << " loop connected axial track: " << i << endmsg;
761 int l = segments.size();
762 for ( int j = 0; j < l; j++ ) { segments[j]->printout(); }
763 i++;
764 }
765#endif
766}
767
768FTTrack* FTFinder::linkAxialSegments( FTSegment* inner, FTSegment* outer ) {
769 float chi2_kappa = param->_chi2_kappa;
770 _linkedSegments.clear();
771
772 if ( !outer )
773 {
774 // allow only 2, 3, 4, axial segments in one track
775 int n = inner->wireHits().size();
776 _linkedSegments.push_back( inner );
777
778 if ( n >= 7 ) return ( new FTTrack( _linkedSegments, inner->kappa(), chi2_kappa ) );
779 else return nullptr;
780 }
781
782 _linkedSegments.push_back( outer );
783
784 int n = _linkedSegments.size();
785 float SigmaK = outer->kappa();
786 float SigmaRR = outer->r();
787 SigmaRR *= SigmaRR;
788 float SigmaKRR = SigmaK * SigmaRR;
789 float SigmaKKRR = SigmaK * SigmaKRR;
790
791 FTSegment* s = _linkedSegments[n - 1];
792 FTSegment* innerSegment = nullptr;
793
794 float SigmaK_cache, SigmaRR_cache, SigmaKRR_cache, SigmaKKRR_cache;
795
796 float Min_chi2 = param->_Min_chi2;
797 float inX = s->incomingX();
798 float inY = s->incomingY();
799 float in_r = s->innerBoundHits().front()->layer()->r();
800 float incomingPhi = s->incomingPhi();
801
802 FTSegment* next = inner;
803 const FTWire* NextOuterBoundHit = next->outerBoundHits().front();
804
805 float outX = next->outgoingX();
806 float outY = next->outgoingY();
807
808 //////////////////////////////////////////////////////
809 float _trk_d = -2 * ( -1. / 2.99792458 / m_pmgnIMF->getReferField() ) / s->kappa();
810 float _angle1 = asin( NextOuterBoundHit->layer()->r() / _trk_d );
811 float _angle2 = asin( s->outerBoundHits().front()->layer()->r() / _trk_d );
812 float _ang_diff = _angle2 - _angle1;
813 float _diff = s->outgoingPhi() - next->outgoingPhi();
814 _diff = _diff - ( int( _diff / M_PI ) ) * 2 * M_PI;
815 float _require = _ang_diff - _diff;
816
817 // cut of connecting inner and outer segments
818 if ( _require < -0.10 || _require > 0.11 ) return nullptr;
819
820 float SegK = next->kappa();
821 float SegRR = next->r();
822 SegRR *= SegRR;
823 const float out_r = NextOuterBoundHit->layer()->r();
824 // kappa = -2. * alpha * ((Vout X Vin)_z / |Vin|*|Vout|) / |Vin-Vout|
825 float GapK = 2. * ( -1. / 2.99792458 / m_pmgnIMF->getReferField() ) *
826 ( inX * outY - inY * outX ) /
827 ( in_r * out_r *
828 sqrt( ( inX - outX ) * ( inX - outX ) + ( inY - outY ) * ( inY - outY ) ) );
829 // float GapRR = (currentLayer==j+1||currentLayer==j+2) ? 0.5*(in_r+out_r) : in_r+out_r;
830 float GapRR = 0.5 * ( in_r + out_r );
831 GapRR *= GapRR;
832 float SigmaK_tmp = ( SigmaK + SegK + GapK );
833 float SigmaRR_tmp = SigmaRR + SegRR + GapRR;
834 float SigmaKRR_tmp = SigmaKRR + SegK * SegRR + GapK * GapRR;
835 float SigmaKKRR_tmp = SigmaKKRR + SegK * SegK * SegRR + GapK * GapK * GapRR;
836 float MuK_tmp = SigmaK_tmp / ( 2 * n + 1 );
837 float chi2 =
838 ( MuK_tmp * MuK_tmp * SigmaRR_tmp - 2. * MuK_tmp * SigmaKRR_tmp + SigmaKKRR_tmp ) /
839 ( 2 * n + 1 );
840 if ( ( chi2 - chi2_kappa ) < Min_chi2 )
841 {
842 Min_chi2 = chi2;
843 innerSegment = next;
844 SigmaK_cache = SigmaK_tmp;
845 SigmaRR_cache = SigmaRR_tmp;
846 SigmaKRR_cache = SigmaKRR_tmp;
847 SigmaKKRR_cache = SigmaKKRR_tmp;
848 }
849 if ( innerSegment )
850 {
851 _linkedSegments.push_back( inner );
852 n = _linkedSegments.size();
853 SigmaK = SigmaK_cache;
854 SigmaRR = SigmaRR_cache;
855 SigmaKRR = SigmaKRR_cache;
856 SigmaKKRR = SigmaKKRR_cache;
857 chi2_kappa = Min_chi2;
858
859 if ( n > 1 ) return ( new FTTrack( _linkedSegments, SigmaK / ( 2 * n - 1 ), chi2_kappa ) );
860 }
861 else return nullptr;
862 return nullptr;
863}
864
865void FTFinder::linkAxialSuperLayer234( FTList<FTSegment*>& inner_segments ) {
866 FTList<FTSegment*> _segments34;
867 FTList<FTSegment*>& SuperLayer3Segments = m_geom->getSuperLayer( 3 )->segments();
868 FTList<FTSegment*>& SuperLayer4Segments = m_geom->getSuperLayer( 4 )->segments();
869
870 linkAxialSegments_step( SuperLayer3Segments, SuperLayer4Segments, _segments34,
871 param->_D_phi2, param->_chi2_2 );
872 _segments34.insert( _segments34.end(), SuperLayer3Segments.begin(),
873 SuperLayer3Segments.end() );
874 SuperLayer3Segments.clear();
875
876 FTList<FTSegment*>& SuperLayer2Segments = m_geom->getSuperLayer( 2 )->segments();
877 linkAxialSegments_step( SuperLayer2Segments, _segments34, inner_segments, param->_D_phi1,
878 param->_chi2_1 );
879 inner_segments.insert( inner_segments.end(), _segments34.begin(), _segments34.end() );
880
881 // zoujh: connect the 2&4 superlayers leap over 3
882
883 for ( auto inner_it = SuperLayer2Segments.begin(); inner_it != SuperLayer2Segments.end(); )
884 {
885 FTSegment* inner = *inner_it;
886
887 bool erased_inner = false; // a flag to indicate whether the inner segment is erased
888
889 float in_outerPhi = inner->outgoingPhi();
890 for ( auto outer_it = SuperLayer4Segments.begin(); outer_it != SuperLayer4Segments.end(); )
891 {
892 FTSegment* outer = *outer_it;
893
894 float out_innerPhi = outer->incomingPhi();
895 float D_phi = fabs( in_outerPhi - out_innerPhi );
896 if ( D_phi > M_PI ) D_phi = 2 * M_PI - D_phi;
897
898 /////////////////////////////////////////////////////
899
900 if ( D_phi > M_PI / 12.5 )
901 {
902 outer_it++;
903 continue;
904 }
905
906 float inX = inner->outgoingX();
907 float inY = inner->outgoingY();
908 float outX = outer->incomingX();
909 float outY = outer->incomingY();
910 float in_r = inner->outerBoundHits().front()->layer()->r();
911 float out_r = outer->innerBoundHits().front()->layer()->r();
912 float GapK =
913 2. * ( -1. / 2.99792458 / m_pmgnIMF->getReferField() ) *
914 ( inY * outX - inX * outY ) /
915 ( in_r * out_r *
916 sqrt( ( inX - outX ) * ( inX - outX ) + ( inY - outY ) * ( inY - outY ) ) );
917 // float cache_in = ((inner->kappa()+outer->kappa()+GapK)/3.0 - inner->kappa())/in_r;
918 float cache_in = ( ( outer->kappa() + GapK ) / 3.0 - inner->kappa() * 2.0 / 3.0 ) / in_r;
919 float cache_out =
920 ( ( inner->kappa() + GapK ) / 3.0 - outer->kappa() * 2.0 / 3.0 ) / out_r;
921 float cache_gap = ( ( inner->kappa() + outer->kappa() ) / 3.0 - GapK * 2.0 / 3.0 ) *
922 2.0 / ( in_r + out_r );
923 float chi2_z = cache_in * cache_in + cache_out * cache_out + cache_gap * cache_gap;
924
925 if ( chi2_z > param->_D_phi1 )
926 {
927 outer_it++;
928 continue;
929 }
930
931 /////////////////////////////////////////////////////
932 inner->connect_outer( outer->wireHits(), outer->outerBoundHits() );
933 inner->update();
934 inner_segments.push_back( inner );
935
936 inner_it = SuperLayer2Segments.erase( inner_it );
937 erased_inner = true;
938
939 delete *outer_it;
940 outer_it = SuperLayer4Segments.erase( outer_it );
941
942 break;
943 }
944 if ( !erased_inner ) inner_it++;
945 }
946
947 inner_segments.insert( inner_segments.end(), SuperLayer2Segments.begin(),
948 SuperLayer2Segments.end() );
949 inner_segments.insert( inner_segments.end(), SuperLayer4Segments.begin(),
950 SuperLayer4Segments.end() );
951}
952
953void FTFinder::linkAxialSuperLayer910( FTList<FTSegment*>& outer_segments ) {
954 FTList<FTSegment*>& SuperLayer9Segments = m_geom->getSuperLayer( 9 )->segments();
955 FTList<FTSegment*>& SuperLayer10Segments = m_geom->getSuperLayer( 10 )->segments();
956 linkAxialSegments_step( SuperLayer9Segments, SuperLayer10Segments, outer_segments,
957 param->_D_phi3, param->_chi2_3 );
958
959 outer_segments.insert( outer_segments.end(), SuperLayer9Segments.begin(),
960 SuperLayer9Segments.end() );
961
962 outer_segments.insert( outer_segments.end(), SuperLayer10Segments.begin(),
963 SuperLayer10Segments.end() );
964}
965
966void FTFinder::linkAxialSegments_step( FTList<FTSegment*>& InnerSegments,
967 FTList<FTSegment*>& OuterSegments,
968 FTList<FTSegment*>& Connected, float maxDphi,
969 float maxChi2 ) {
970 IMessageSvc* msgSvc;
971 Gaudi::svcLocator()->service( "MessageSvc", msgSvc ).ignore();
972 MsgStream log( msgSvc, "FTFinder" );
973
974 for ( auto inner_it = InnerSegments.begin();
975 inner_it != InnerSegments.end(); ) // will erase element in loop, so no "inner_it++"
976 // here
977 {
978 FTSegment* inner = *inner_it;
979
980 const FTLayer* in_outerBound = inner->outerBoundHits().front()->layer();
981 float in_outerPhi = inner->outgoingPhi();
982 float min_Dphi = M_PI / 2;
983 auto min_Dphi_outer_it = OuterSegments.end();
984
985 for ( auto outer_it = OuterSegments.begin(); outer_it != OuterSegments.end(); outer_it++ )
986 {
987 FTSegment* outer = *outer_it;
988 float D_phi = fabs( in_outerPhi - outer->incomingPhi() );
989 if ( D_phi > M_PI ) D_phi = 2 * M_PI - D_phi;
990
991 if ( D_phi > min_Dphi ) continue;
992
993 float inX = inner->incomingX();
994 float inY = inner->incomingY();
995 float outX = outer->outgoingX();
996 float outY = outer->outgoingY();
997 float in_r = inner->innerBoundHits().front()->layer()->r();
998 float out_r = outer->outerBoundHits().front()->layer()->r();
999 float allK =
1000 2. * ( -1. / 2.99792458 / m_pmgnIMF->getReferField() ) *
1001 ( inY * outX - inX * outY ) /
1002 ( in_r * out_r *
1003 sqrt( ( inX - outX ) * ( inX - outX ) + ( inY - outY ) * ( inY - outY ) ) );
1004 float cache_in = ( ( outer->kappa() + allK ) / 3.0 - inner->kappa() * 2 / 3.0 ) / in_r;
1005 float cache_out = ( ( inner->kappa() + allK ) / 3.0 - outer->kappa() * 2 / 3.0 ) / out_r;
1006 float cache_all = ( ( inner->kappa() + outer->kappa() ) / 3.0 - allK * 2 / 3.0 ) * 2.0 /
1007 ( in_r + out_r );
1008 float chi2_z = cache_in * cache_in + cache_out * cache_out + cache_all * cache_all;
1009
1010 log << MSG::DEBUG << "D_phi: " << D_phi << " chi2_z: " << chi2_z
1011 << " maxChi2: " << maxChi2 << endmsg;
1012
1013 if ( chi2_z > maxChi2 ) continue;
1014 min_Dphi = D_phi;
1015 min_Dphi_outer_it = outer_it;
1016 }
1017
1018 if ( min_Dphi_outer_it == OuterSegments.end() )
1019 {
1020 inner_it++;
1021 continue;
1022 };
1023
1024 log << MSG::DEBUG << "min_Dphi: " << min_Dphi << endmsg;
1025
1026 FTSegment* outer = *min_Dphi_outer_it;
1027
1028 const FTLayer* out_innerBound = outer->innerBoundHits().front()->layer();
1029
1030 int dLayerId = out_innerBound->layerId() - in_outerBound->layerId();
1031
1032 if ( dLayerId == 1 && min_Dphi > maxDphi )
1033 {
1034 inner_it++;
1035 continue;
1036 };
1037 if ( dLayerId == 2 && min_Dphi > maxDphi * 1.5 )
1038 {
1039 inner_it++;
1040 continue;
1041 };
1042 if ( dLayerId == 3 && min_Dphi > maxDphi * 2.25 )
1043 {
1044 inner_it++;
1045 continue;
1046 };
1047 if ( dLayerId != 1 && dLayerId != 2 && dLayerId != 3 )
1048 {
1049 inner_it++;
1050 continue;
1051 };
1052
1053 inner->connect_outer( outer->wireHits(), outer->outerBoundHits() );
1054 inner->update();
1055 Connected.push_back( inner );
1056 inner_it = InnerSegments.erase( inner_it );
1057
1058 delete outer;
1059 OuterSegments.erase( min_Dphi_outer_it );
1060
1061 log << MSG::DEBUG << "DONE!!" << endmsg;
1062 }
1063}
1064
1065void FTFinder::mkTrack3D() {
1066 IMessageSvc* msgSvc;
1067 Gaudi::svcLocator()->service( "MessageSvc", msgSvc ).ignore();
1068 MsgStream log( msgSvc, "FTFinder" );
1069
1070 FTList<FTSegment*> multi_trk_cand;
1071
1072 for ( int i = 8; i >= 0; i-- )
1073 {
1074 if ( i == 4 ) i -= 3;
1075 FTList<FTSegment*>& segments = m_geom->getSuperLayer( i )->segments();
1076
1077 for ( auto s : segments )
1078 {
1079
1080#ifndef OnlineMode
1081 s->printout();
1082#endif
1083
1084 int nTrack = 0;
1085 FTTrack* t;
1086
1087 int k = 0;
1088 for ( auto tmp_trk : _tracks )
1089 {
1090#ifndef OnlineMode
1091 log << MSG::DEBUG << "coupling to track: " << k << endmsg;
1092#endif
1093 if ( s->update3D( tmp_trk ) )
1094 {
1095 // calculate s and z
1096 t = tmp_trk;
1097 nTrack++;
1098 }
1099 k++;
1100 }
1101
1102 switch ( nTrack )
1103 {
1104 case 0: continue;
1105 case 1: t->append_stereo_cache( s ); break;
1106 default: multi_trk_cand.push_back( s ); break;
1107 }
1108 }
1109 // whose relation between this is unique
1110 for ( auto t : _tracks ) t->updateSZ();
1111 }
1112
1113 // link segments by tanLambda & dz
1114 for ( auto t : _tracks ) t->linkStereoSegments();
1115 for ( auto t : multi_trk_cand ) t->linkStereoSegments();
1116}
1117
1118int FTFinder::VertexFit2D() {
1119 int nTrks = _tracks.size();
1120 if ( nTrks < 2 )
1121 {
1122 _vx = -99999.;
1123 _vy = -99999.;
1124 _vz = -99999.;
1125 return 0;
1126 }
1127
1128 FTList<float> px;
1129 FTList<float> py;
1130 FTList<float> dx;
1131 FTList<float> dy;
1132 FTList<double> weight;
1133
1134 for ( auto t : _tracks )
1135 {
1136 const Lpav& la = t->lpav();
1137 HepVector a = la.Hpar( pivot );
1138
1139 const float dr_i = a( 1 );
1140 if ( fabs( a( 1 ) ) > 1.5 ) continue;
1141 const float px_i = -sin( a( 2 ) );
1142 const float py_i = cos( a( 2 ) );
1143
1144 float weight_i = la.chisq() / ( la.nc() * 0.02 );
1145
1146 px.push_back( px_i );
1147 py.push_back( py_i );
1148 dx.push_back( dr_i * py_i );
1149 dy.push_back( -dr_i * px_i );
1150 weight.push_back( exp( -weight_i * weight_i ) );
1151 }
1152
1153 if ( dx.size() < 2 )
1154 {
1155 _vx = -99999.;
1156 _vy = -99999.;
1157 _vz = -99999.;
1158 return 0;
1159 }
1160
1161 double S_weight = 0.;
1162 for ( int i = dx.size() - 1; i; i-- )
1163 {
1164 const float px_i = px[i];
1165 const float py_i = py[i];
1166 const float dx_i = dx[i];
1167 const float dy_i = dy[i];
1168 const float weight_i = weight[i];
1169 for ( int j = 0; j < i; j++ )
1170 {
1171 const float px_j = px[j];
1172 const float py_j = py[j];
1173
1174 const float ddx = dx[j] - dx_i;
1175 const float ddy = dx[j] - dy_i;
1176
1177 const float tmp_par = px_i * py_j - px_j * py_i;
1178 const float par = ( py_j * ddx - px_j * ddy ) / tmp_par;
1179
1180 double weight_ij = weight_i * weight[j];
1181 S_weight += weight_i * weight[j];
1182 if ( tmp_par == 0 || par < -0.5 || ( py_i * ddx - px_i * ddy ) / tmp_par < -0.5 ||
1183 fabs( ( px_i * px_j + py_i * py_j ) /
1184 sqrt( ( px_i * px_i + py_i * py_i ) * ( px_j * px_j + py_j * py_j ) ) ) >
1185 0.86 )
1186 {
1187 _vx += ( dx_i + 0.5 * ddx ) * weight_ij;
1188 _vy += ( dy_i + 0.5 * ddy ) * weight_ij;
1189 }
1190 else
1191 {
1192 _vx += ( dx_i + par * px_i ) * weight_ij;
1193 _vy += ( dy_i + par * py_i ) * weight_ij;
1194 }
1195 }
1196 }
1197
1198 int rtn_flag = 0;
1199 if ( S_weight == 0. )
1200 {
1201 _vx = -99999.;
1202 _vy = -99999.;
1203 _vz = -99999.;
1204 }
1205 else
1206 {
1207 _vx /= S_weight;
1208 _vy /= S_weight;
1209 _vz = -99999.;
1210 rtn_flag = 1;
1211 }
1212 return rtn_flag;
1213}
1214
1215int FTFinder::VertexFit( int z_flag ) {
1216 _vx = 0.;
1217 _vy = 0.;
1218 _vz = 0.;
1219
1220 if ( !z_flag ) { return VertexFit2D(); }
1221
1222 if ( _tracks.size() < 2 )
1223 {
1224 _vx = -99999.;
1225 _vy = -99999.;
1226 _vz = -99999.;
1227 return 0;
1228 }
1229
1230 FTList<float> px;
1231 FTList<float> py;
1232 FTList<float> pz;
1233 FTList<float> dx;
1234 FTList<float> dy;
1235 FTList<float> dz;
1236 FTList<float> pmag2;
1237 FTList<float> weight;
1238 FTList<float> weight_z;
1239 FTList<float> sigma2_r;
1240 FTList<float> sigma2_z;
1241
1242 for ( auto t : _tracks )
1243 {
1244 const Lpav& la = t->lpav();
1245 if ( la.nc() <= 3 ) continue;
1246 const zav& za = t->Zav();
1247 if ( za.nc() > 2 && za.b() > -900 )
1248 {
1249 pmag2.push_back( 1 + za.b() * za.b() );
1250 pz.push_back( za.a() );
1251 dz.push_back( za.b() );
1252 sigma2_z.push_back( za.chisq() / ( za.nc() - 2 ) );
1253 weight_z.push_back( exp( -( za.chisq() / ( za.nc() - 2 ) ) ) );
1254 }
1255 else continue;
1256
1257 HepVector a = la.Hpar( pivot );
1258
1259 const float dr_i = a( 1 );
1260 const float px_i = -std::sin( a( 2 ) );
1261 const float py_i = std::cos( a( 2 ) );
1262
1263 px.push_back( px_i );
1264 py.push_back( py_i );
1265 dx.push_back( dr_i * py_i );
1266 dy.push_back( -dr_i * px_i );
1267 sigma2_r.push_back( std::sqrt( la.chisq() ) / ( la.nc() - 3 ) );
1268 weight.push_back( exp( -( std::sqrt( la.chisq() ) / ( la.nc() - 3 ) ) ) );
1269 }
1270
1271 if ( dx.size() < 2 )
1272 {
1273 _vx = -9999.;
1274 _vy = -9999.;
1275 _vz = -9999.;
1276 return 0;
1277 }
1278
1279 FTList<float> vtx_x;
1280 FTList<float> vtx_y;
1281 FTList<float> vtx_z;
1282 FTList<float> weight2;
1283 FTList<float> weight2_z;
1284 FTList<float> vtx_chi2;
1285 unsigned n_vtx( 0 );
1286
1287 for ( int i = dx.size() - 1; i; i-- )
1288 {
1289 for ( int j = 0; j < i; j++ )
1290 {
1291 // min. chi2 fit w/ line approximation
1292 const float pij_x = py[i] * pz[j] - pz[i] * py[j];
1293 const float pij_y = pz[i] * px[j] - px[i] * pz[j];
1294 const float pij_z = px[i] * py[j] - py[i] * px[j];
1295
1296 if ( pij_x == 0.0f && pij_y == 0.0f && pij_z == 0.0f ) continue;
1297
1298 const float sr = sigma2_r[i] + sigma2_r[j];
1299 const float sz = sigma2_z[i] + sigma2_z[j];
1300
1301 const float ddx = dx[i] - dx[j];
1302 const float ddy = dy[i] - dy[j];
1303 const float ddz = dz[i] - dz[j];
1304
1305 const float pij_mag2 = pij_x * pij_x / ( sr * sz ) + pij_y * pij_y / ( sr * sz ) +
1306 pij_z * pij_z / ( sr * sr );
1307
1308 const float d_i = ( pij_x * ( py[j] * ddz - pz[j] * ddy ) / ( sr * sz ) +
1309 pij_y * ( pz[j] * ddx - px[j] * ddz ) / ( sr * sz ) +
1310 pij_z * ( px[j] * ddy - py[j] * ddx ) / ( sr * sr ) ) /
1311 pij_mag2;
1312
1313 const float d_j = ( pij_x * ( py[i] * ddz - pz[i] * ddy ) / ( sr * sz ) +
1314 pij_y * ( pz[i] * ddx - px[i] * ddz ) / ( sr * sz ) +
1315 pij_z * ( px[i] * ddy - py[i] * ddx ) / ( sr * sr ) ) /
1316 pij_mag2;
1317
1318 const float vtx_x_i = dx[i] + px[i] * d_i;
1319 const float vtx_y_i = dy[i] + py[i] * d_i;
1320 const float vtx_z_i = dz[i] + pz[i] * d_i;
1321
1322 const float vtx_x_j = dx[j] + px[j] * d_j;
1323 const float vtx_y_j = dy[j] + py[j] * d_j;
1324 const float vtx_z_j = dz[j] + pz[j] * d_j;
1325
1326 const float weight_ij = weight[i] + weight[j];
1327 vtx_x.push_back( ( weight[j] * vtx_x_i + weight[i] * vtx_x_j ) / weight_ij );
1328 vtx_y.push_back( ( weight[j] * vtx_y_i + weight[i] * vtx_y_j ) / weight_ij );
1329 vtx_z.push_back( ( weight_z[j] * vtx_z_i + weight_z[i] * vtx_z_j ) /
1330 ( weight_z[i] + weight_z[j] ) );
1331
1332 weight2.push_back( exp( -sr ) );
1333 weight2_z.push_back( exp( -sz ) );
1334 vtx_chi2.push_back( ( ( vtx_x_i - vtx_x_j ) * ( vtx_x_i - vtx_x_j ) +
1335 ( vtx_y_i - vtx_y_j ) * ( vtx_y_i - vtx_y_j ) ) /
1336 sr +
1337 ( vtx_z_i - vtx_z_j ) * ( vtx_z_i - vtx_z_j ) / sz );
1338 n_vtx++;
1339 }
1340 }
1341
1342 float S_weight( 0.0f );
1343 float S_weight_z( 0.0f );
1344 for ( int i = 0; i < vtx_chi2.size(); i++ )
1345 {
1346 if ( vtx_chi2[i] > 10. ) continue;
1347 float w( std::exp( -vtx_chi2[i] ) );
1348 _vx += vtx_x[i] * weight2[i] * w;
1349 _vy += vtx_y[i] * weight2[i] * w;
1350 _vz += vtx_z[i] * weight2_z[i] * w;
1351 S_weight += weight2[i] * w;
1352 S_weight_z += weight2_z[i] * w;
1353 }
1354
1355 int rtn_flag = 0;
1356 if ( S_weight <= 0. )
1357 {
1358 _vx = -9999.;
1359 _vy = -9999.;
1360 }
1361 else
1362 {
1363 _vx /= S_weight;
1364 _vy /= S_weight;
1365 rtn_flag = 1;
1366 }
1367
1368 if ( !z_flag ) return rtn_flag;
1369
1370 if ( S_weight_z <= 0. ) { _vz = -9999.; }
1371 else
1372 {
1373 _vz /= S_weight_z;
1374 rtn_flag++;
1375 }
1376 return rtn_flag;
1377}
1378
1379int FTFinder::findBestVertex() {
1380 if ( _tracks.size() < 2 )
1381 {
1382 _vx = -9999.;
1383 _vy = -9999.;
1384 _vz = -9999.;
1385 return 0;
1386 }
1387
1388 float min_dr = 9999.;
1389 float phi0 = 9999.;
1390 for ( auto t : _tracks )
1391 {
1392 HepVector a = t->lpav().Hpar( pivot );
1393 if ( fabs( a( 1 ) ) < fabs( min_dr ) )
1394 {
1395 min_dr = a( 1 );
1396 phi0 = a( 2 );
1397 }
1398 }
1399 _vx = min_dr * cos( phi0 );
1400 _vy = min_dr * sin( phi0 );
1401 return 1;
1402}
1403
1404int FTFinder::CorrectEvtTiming() {
1405 float weight_sum = 0.;
1406 float dt_sum2 = 0.;
1407 for ( auto t : _tracks )
1408 {
1409 float dt_sum = 0.;
1410 float dtt_sum = 0.;
1411 int nHits = 0;
1412
1413 const Lpav& la = t->lpav();
1414
1415 const FTList<FTSegment*>& axial_sgmnts = t->axial_segments();
1416
1417 for ( auto axial_seg : axial_sgmnts )
1418 {
1419 FTList<FTWire*>& hits = axial_seg->wireHits();
1420
1421 for ( auto h : hits )
1422 {
1423 const float x = h->x();
1424 const float y = h->y();
1425 double d0 = fabs( la.d( (double)x, (double)y ) );
1426 if ( d0 >= 0.47f * h->layer()->csize() ) continue;
1427 nHits++;
1428
1429 float dt = x2t( h->layer(), d0 ) - h->time();
1430 dt_sum += dt;
1431 dtt_sum += ( dt * dt );
1432 }
1433 }
1434
1435 if ( !nHits ) continue;
1436
1437 float weight_t = exp( -( dtt_sum - ( dt_sum * dt_sum / nHits ) ) / ( nHits * 1600 ) );
1438 weight_sum += ( nHits * weight_t );
1439 dt_sum2 += ( dt_sum * weight_t );
1440 }
1441 return int( dt_sum2 / weight_sum );
1442}
1443
1444#ifndef OnlineMode
1445void FTFinder::makeMdst( void ) {
1446 int Ntable( 0 );
1447
1448 for ( auto t : _tracks )
1449 {
1450
1451 FTTrack& trk = *t;
1452
1453 const FTList<FTSegment*>& axialSegments = trk.axial_segments();
1454 const FTList<FTSegment*>& stereoSegments = trk.stereo_segments();
1455
1456 for ( auto seg : axialSegments )
1457 {
1458 FTList<FTWire*>& wires = seg->wireHits();
1459 for ( auto w : wires ) { g_ncell->fill( w->getWireId() ); }
1460 }
1461
1462 for ( auto seg : stereoSegments )
1463 {
1464 FTList<FTWire*>& wires = seg->wireHits();
1465 for ( auto w : wires ) { g_ncell->fill( w->getWireId() ); }
1466 }
1467
1468 const Helix& h = *trk.helix();
1469 if ( h.tanl() < -9000. ) continue;
1470
1471 Ntable++;
1472 Hep3Vector p( h.momentum() );
1473 HepPoint3D v( h.x() );
1474 // float m_charge = (h.kappa() > 0) ? 1. : -1.;
1475 float m_px = p.x();
1476 g_px[Ntable - 1] = p.x();
1477 float m_py = p.y();
1478 g_py[Ntable - 1] = p.y();
1479 float m_pz = p.z();
1480 g_pz[Ntable - 1] = p.z();
1481 g_p[Ntable - 1] = p.mag();
1482 g_phi[Ntable - 1] = atan2( m_py, m_px );
1483
1484 g_dr[Ntable - 1] = h.dr();
1485 g_phi0[Ntable - 1] = h.phi0();
1486 g_kappa[Ntable - 1] = h.kappa();
1487 g_pt[Ntable - 1] = 1 / fabs( h.kappa() );
1488 g_dz[Ntable - 1] = h.dz();
1489 g_tanl[Ntable - 1] = h.tanl();
1490 g_theta[Ntable - 1] = atan2( 1 / fabs( h.kappa() ), (double)( m_pz ) );
1491 g_vx[Ntable - 1] = v( 0 );
1492 g_vy[Ntable - 1] = v( 1 );
1493 g_vz[Ntable - 1] = v( 2 );
1494 }
1495 g_ntrk = Ntable;
1496}
1497#endif
1498
1499//-------------------------------
1500// output tracking results to TDS by wangdy
1501//-------------------------------
1502StatusCode FTFinder::makeTds() {
1503 IMessageSvc* msgSvc;
1504 Gaudi::svcLocator()->service( "MessageSvc", msgSvc ).ignore();
1505 MsgStream log( msgSvc, "FTFinder" );
1506
1507 IDataProviderSvc* eventSvc;
1508 Gaudi::svcLocator()->service( "EventDataSvc", eventSvc ).ignore();
1509
1510 if ( !eventSvc )
1511 {
1512 log << MSG::FATAL << "makeTds:Could not find eventSvc" << endmsg;
1513 return StatusCode::FAILURE;
1514 }
1515
1516 RecMdcTrackCol* trkcol = new RecMdcTrackCol;
1517 RecMdcHitCol* hitcol = new RecMdcHitCol;
1518
1519 // make RecMdcTrackCol
1520#ifndef OnlineMode
1521 log << MSG::DEBUG << "beginning to make RecMdcTrackCol" << endmsg;
1522#endif
1523
1524 int trkid = 0, i = -1;
1525 for ( auto fttrk : tracks() )
1526 {
1527 i++;
1528
1529 RecMdcTrack* trk = new RecMdcTrack;
1530
1531 if ( fttrk->helix()->tanl() < -9000. )
1532 {
1533 log << MSG::DEBUG << "deleted trackId = " << i + 1
1534 << " due to tanl = " << fttrk->helix()->tanl() << endmsg;
1535 delete trk;
1536 continue;
1537 }
1538
1539 HepPoint3D pos = fttrk->helix()->pivot();
1540 int charge = -1;
1541 HepVector m_a( 5, 0 );
1542 m_a = fttrk->helix()->a();
1543 m_a[2] = -m_a[2];
1544 HepSymMatrix m_ea = fttrk->helix()->Ea();
1545 float fiterm = fttrk->lpav().phi( 77.0 );
1546 float chi2lpav = fttrk->lpav().chisq();
1547 float chi2zav = fttrk->Zav().chisq();
1548
1549 m_ea[0][0] = 0.0085;
1550 m_ea[1][1] = 0.000011;
1551 m_ea[2][2] = 0.0018;
1552 m_ea[3][3] = 1.2;
1553 m_ea[4][4] = 0.00026;
1554 m_ea[1][0] = m_ea[0][1] = -0.00029;
1555 m_ea[2][0] = m_ea[0][2] = charge * 0.004;
1556 m_ea[2][1] = m_ea[1][2] = charge * 0.00012;
1557 m_ea[3][0] = m_ea[0][3] = -0.017;
1558 m_ea[3][1] = m_ea[1][3] = 0.0;
1559 m_ea[3][2] = m_ea[2][3] = 0.0;
1560 m_ea[4][0] = m_ea[0][4] = 0.0;
1561 m_ea[4][1] = m_ea[1][4] = 0.0;
1562 m_ea[4][2] = m_ea[2][4] = 0.0;
1563 m_ea[4][3] = m_ea[3][4] = -0.018;
1564
1565 trk->setTrackId( trkid );
1566 trk->setHelix( m_a );
1567 trk->setPivot( pos );
1568 trk->setError( m_ea );
1569 trk->setFiTerm( fiterm );
1570 trk->setChi2( chi2lpav + chi2zav );
1571
1572#ifndef OnlineMode
1573 log << MSG::DEBUG << " trackId = " << i << endmsg;
1574 log << MSG::DEBUG << "fast-tracking kappa " << m_a[2] << " fast-tracking tanl "
1575 << m_a[4] << endmsg;
1576 log << MSG::DEBUG << "push_backed kappa " << trk->helix( 2 ) << " push_backed tanl "
1577 << trk->helix( 4 ) << endmsg;
1578
1579 log << MSG::DEBUG << "beginning to make hitlist and RecMdcHitCol " << endmsg;
1580#endif
1581
1582 HitRefVec hitrefvec;
1583
1584 int hitindex = 0;
1585
1586 // axial segments part
1587 const FTList<FTSegment*>& seglist_ax = fttrk->axial_segments();
1588
1589 int ntrackhits = 0;
1590 for ( auto seg_ax_i : seglist_ax )
1591 {
1592 FTList<FTWire*>& hitlist_ax = seg_ax_i->wireHits();
1593 ntrackhits += hitlist_ax.size();
1594
1595 for ( auto wire_ax : hitlist_ax )
1596 {
1597 double dd = wire_ax->distance();
1598 double adc = RawDataUtil::MdcChargeChannel( wire_ax->getAdc() );
1599 double tdc = wire_ax->time();
1600 double chi2 = wire_ax->getChi2();
1601 const Identifier mdcid =
1602 MdcID::wire_id( wire_ax->layer()->layerId(), wire_ax->localId() );
1603
1604 RecMdcHit* hit = new RecMdcHit;
1605 hit->setId( hitindex );
1606 hit->setDriftDistLeft( dd );
1607 hit->setDriftDistRight( dd );
1608 hit->setAdc( adc );
1609 hit->setTdc( tdc );
1610 hit->setMdcId( mdcid );
1611 hit->setChisqAdd( chi2 );
1612
1613#ifndef OnlineMode
1614 log << MSG::DEBUG << "Hit DriftDistLeft " << hit->getDriftDistLeft() << endmsg;
1615 log << MSG::DEBUG << "MDC Hit ADC " << hit->getAdc() << endmsg;
1616 log << MSG::DEBUG << "Hit MDC Identifier " << hit->getMdcId() << endmsg;
1617 log << MSG::DEBUG << "Hit Chisq " << hit->getChisqAdd() << endmsg;
1618#endif
1619
1620 hitcol->push_back( hit );
1621 SmartRef<RecMdcHit> refhit( hit );
1622 hitrefvec.push_back( refhit );
1623 }
1624 }
1625
1626 // stereo segments part
1627 const FTList<FTSegment*>& seglist_st = fttrk->stereo_segments();
1628
1629 int ntrackster = 0;
1630
1631 for ( auto seg_st_i : seglist_st )
1632 {
1633 FTList<FTWire*>& hitlist_st = seg_st_i->wireHits();
1634
1635 ntrackhits += hitlist_st.size();
1636 ntrackster += hitlist_st.size();
1637
1638 for ( auto wire_st : hitlist_st )
1639 {
1640 double dd = wire_st->distance();
1641 double adc = RawDataUtil::MdcChargeChannel( wire_st->getAdc() );
1642 double tdc = wire_st->time();
1643 double chi2 = wire_st->getChi2();
1644 const Identifier mdcid =
1645 MdcID::wire_id( wire_st->layer()->layerId(), wire_st->localId() );
1646
1647 RecMdcHit* hit = new RecMdcHit;
1648 hit->setId( hitindex );
1649 hit->setDriftDistLeft( dd );
1650 hit->setDriftDistRight( dd );
1651 hit->setAdc( adc );
1652 hit->setTdc( tdc );
1653 hit->setMdcId( mdcid );
1654 hit->setChisqAdd( chi2 );
1655
1656#ifndef OnlineMode
1657 log << MSG::DEBUG << "Z Hit DriftDistLeft " << hit->getDriftDistLeft() << endmsg;
1658 log << MSG::DEBUG << "Z MDC Hit ADC " << hit->getAdc() << endmsg;
1659 log << MSG::DEBUG << "Z Hit MDC Identifier " << hit->getMdcId() << endmsg;
1660 log << MSG::DEBUG << "Z Hit Chisq " << hit->getChisqAdd() << endmsg;
1661#endif
1662
1663 hitcol->push_back( hit );
1664 SmartRef<RecMdcHit> refhit( hit );
1665 hitrefvec.push_back( refhit );
1666 }
1667 }
1668
1669 trk->setNhits( ntrackhits );
1670 trk->setNster( ntrackster );
1671 trk->setVecHits( hitrefvec );
1672 trkcol->push_back( trk );
1673 trkid++;
1674
1675#ifndef OnlineMode
1676 g_naxialhit->fill( ( ntrackhits - ntrackster ), 1.0 );
1677 g_nstereohit->fill( ntrackster, 1.0 );
1678 g_nhit->fill( ntrackhits, 1.0 );
1679#endif
1680 }
1681
1682 IDataManagerSvc* dataManSvc = dynamic_cast<IDataManagerSvc*>( eventSvc );
1683
1684 DataObject* aTrackCol;
1685 eventSvc->findObject( "/Event/Recon/RecMdcTrackCol", aTrackCol ).ignore();
1686 if ( aTrackCol )
1687 {
1688 dataManSvc->clearSubTree( "/Event/Recon/RecMdcTrackCol" ).ignore();
1689 eventSvc->unregisterObject( "/Event/Recon/RecMdcTrackCol" ).ignore();
1690 }
1691
1692 DataObject* aRecHitCol;
1693 eventSvc->findObject( "/Event/Recon/RecMdcHitCol", aRecHitCol ).ignore();
1694 if ( aRecHitCol )
1695 {
1696 dataManSvc->clearSubTree( "/Event/Recon/RecMdcHitCol" ).ignore();
1697 eventSvc->unregisterObject( "/Event/Recon/RecMdcHitCol" ).ignore();
1698 }
1699
1700 // register RecMdcHitCol
1701 StatusCode hitsc;
1702 hitsc = eventSvc->registerObject( "/Event/Recon/RecMdcHitCol", hitcol );
1703 if ( !hitsc.isSuccess() )
1704 {
1705 log << MSG::FATAL << "Could not register RecMdcHitCol" << endmsg;
1706 return hitsc;
1707 }
1708
1709#ifndef OnlineMode
1710 log << MSG::DEBUG << "RecMdcHitCol registered successfully!" << endmsg;
1711
1712 RecMdcTrackCol::iterator bef = trkcol->begin();
1713 for ( ; bef != trkcol->end(); bef++ )
1714 {
1715 log << MSG::DEBUG << " registered kappa" << ( *bef )->helix( 2 ) << " registered tanl"
1716 << ( *bef )->helix( 4 ) << endmsg;
1717 }
1718#endif
1719
1720 // register RecMdcTrackCol
1721 StatusCode trksc;
1722 trksc = eventSvc->registerObject( "/Event/Recon/RecMdcTrackCol", trkcol );
1723 if ( !trksc.isSuccess() )
1724 {
1725 log << MSG::FATAL << "Could not register RecMdcTrackCol" << endmsg;
1726 return trksc;
1727 }
1728
1729#ifndef OnlineMode
1730 log << MSG::DEBUG << "RecMdcTrackCol registered successfully!" << endmsg;
1731
1732 // check the result:RecMdcHitCol
1733 SmartDataPtr<RecMdcHitCol> newhitCol( eventSvc, "/Event/Recon/RecMdcHitCol" );
1734 if ( !newhitCol )
1735 {
1736 log << MSG::FATAL << "Could not find RecMdcHit" << endmsg;
1737 return ( StatusCode::FAILURE );
1738 }
1739
1740 log << MSG::DEBUG << "Begin to check RecMdcHitCol" << endmsg;
1741
1742 RecMdcHitCol::iterator iter_hit = newhitCol->begin();
1743 for ( ; iter_hit != newhitCol->end(); iter_hit++ )
1744 {
1745 log << MSG::DEBUG << "retrieved MDC Hit:"
1746 << " DDL " << ( *iter_hit )->getDriftDistLeft() << " DDR "
1747 << ( *iter_hit )->getDriftDistRight() << " ADC " << ( *iter_hit )->getAdc()
1748 << endmsg;
1749 }
1750
1751 // check the result:RecMdcTrackCol
1752 SmartDataPtr<RecMdcTrackCol> newtrkCol( eventSvc, "/Event/Recon/RecMdcTrackCol" );
1753 if ( !newtrkCol )
1754 {
1755 log << MSG::FATAL << "Could not find RecMdcTrackCol" << endmsg;
1756 return ( StatusCode::FAILURE );
1757 }
1758
1759 log << MSG::DEBUG << "Begin to check RecMdcTrackCol" << endmsg;
1760 RecMdcTrackCol::iterator iter_trk = newtrkCol->begin();
1761 for ( ; iter_trk != newtrkCol->end(); iter_trk++ )
1762 {
1763 log << MSG::DEBUG << "retrieved MDC track:"
1764 << "Track Id: " << ( *iter_trk )->trackId() << " Pivot: " << ( *iter_trk )->poca()[0]
1765 << " " << ( *iter_trk )->poca()[1] << " " << ( *iter_trk )->poca()[2] << endmsg;
1766
1767 log << MSG::DEBUG << "hitList of this track:" << endmsg;
1768 HitRefVec gothits = ( *iter_trk )->getVecHits();
1769 HitRefVec::iterator it_gothit = gothits.begin();
1770 for ( ; it_gothit != gothits.end(); it_gothit++ )
1771 {
1772 log << MSG::DEBUG << "hits Id: " << ( *it_gothit )->getId() << " hits DDL&DDR "
1773 << ( *it_gothit )->getDriftDistLeft() << " hits MDC IDentifier "
1774 << ( *it_gothit )->getMdcId() << endmsg << " hits TDC " << ( *it_gothit )->getTdc()
1775 << " hits ADC " << ( *it_gothit )->getAdc() << endmsg;
1776 }
1777 }
1778#endif
1779
1780 return StatusCode::SUCCESS;
1781}
1782
1784 for ( auto t : _tracks ) delete t;
1785 for ( auto s : _linkedSegments ) delete s;
1786
1787 if ( param->_doIt ) clear();
1788}
const Int_t n
Double_t x[10]
Double_t time
ObjectVector< RecEsTime > RecEsTimeCol
EvtComplex exp(const EvtComplex &c)
double w
IHistogram1D * g_nstereohit
Definition ntupleItem.h:42
NTuple::Array< float > g_pz
Definition FTFinder.cxx:68
NTuple::Array< float > g_theta
Definition FTFinder.cxx:69
int num_3Dtrk
Definition FTFinder.cxx:81
NTuple::Array< float > g_pxMC
Definition ntupleItem.h:23
NTuple::Array< float > g_pzMC
Definition FTFinder.cxx:63
IHistogram1D * g_ncellMC
Definition ntupleItem.h:39
int num_2Dtrk
NTuple::Array< float > g_pyMC
Definition FTFinder.cxx:63
NTuple::Array< float > g_dr
Definition ntupleItem.h:32
IHistogram2D * g_hitmap[20]
Definition ntupleItem.h:44
NTuple::Array< float > g_kappa
Definition FTFinder.cxx:71
NTuple::Array< float > g_ptMC
Definition FTFinder.cxx:63
NTuple::Item< float > g_estime
Definition ntupleItem.h:33
NTuple::Array< float > g_dz
Definition FTFinder.cxx:71
NTuple::Array< float > g_tanl
Definition FTFinder.cxx:71
NTuple::Item< long > g_ntrk
Definition ntupleItem.h:27
NTuple::Item< long > g_ntrkMC
Definition ntupleItem.h:21
NTuple::Array< float > g_phi0MC
Definition FTFinder.cxx:62
int num_finaltrk
Definition FTFinder.cxx:81
NTuple::Array< float > g_py
Definition FTFinder.cxx:68
NTuple::Array< float > g_px
Definition ntupleItem.h:29
IHistogram1D * g_ncell
Definition ntupleItem.h:40
NTuple::Array< float > g_pt
Definition FTFinder.cxx:68
IHistogram1D * g_nhit
Definition ntupleItem.h:43
NTuple::Array< float > g_p
Definition FTFinder.cxx:68
NTuple::Array< float > g_phi0
Definition FTFinder.cxx:71
NTuple::Array< float > g_vx
Definition ntupleItem.h:31
IHistogram1D * g_naxialhit
Definition ntupleItem.h:41
NTuple::Array< float > g_vy
Definition FTFinder.cxx:70
NTuple::Array< float > g_theta0MC
Definition ntupleItem.h:22
NTuple::Array< float > g_vz
Definition FTFinder.cxx:70
NTuple::Array< float > g_phi
Definition ntupleItem.h:30
HepGeom::Point3D< double > HepPoint3D
Definition FTFinder.h:20
#define FTWireHit
Definition FTWire.h:3
XmlRpcServer s
NTuple::Item< double > m_pz
int g_eventNo
Definition FTFinder.cxx:61
*********Class see also m_nmax DOUBLE PRECISION m_MasPhot DOUBLE PRECISION m_phsu DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_r2 DOUBLE PRECISION m_WtMass INTEGER m_nmax INTEGER m_Nevgen INTEGER m_IsFSR INTEGER m_MarTot *COMMON c_KarFin $ !Output file $ !Event serial number $ !alpha QED at Thomson limit $ !minimum energy at CMS for remooval $ !infrared dimensionless $ !dummy photon IR regulator $ !crude photon multiplicity enhancement factor *EVENT $ !MC crude volume of PhhSpace *Sfactors $ !YFS formfactor IR part only $ !YFS formfactor non IR finite part $ !mass weight
Definition KarFin.h:34
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition KarLud.h:35
TGraph2DErrors * dt
Definition McCor.cxx:41
int n2
Definition SD0Tag.cxx:59
IMessageSvc * msgSvc()
#define M_PI
Definition TConstant.h:4
void setError(double err[15])
void setHelix(double helix[5])
const HepVector helix() const
......
float t0Estime
Definition FTFinder.h:131
FTList< FTTrack * > & tracks()
returns track list
Definition FTFinder.cxx:86
FTSuperLayer * superLayer(int id) const
returns superlayer
Definition FTFinder.cxx:85
int i_rPhiFit
Definition FTFinder.h:136
float t2x(const FTLayer *l, const float t) const
convert t to x
Definition FTFinder.cxx:95
void event()
track finder core
Definition FTFinder.cxx:170
int tEstFlag
Definition FTFinder.h:137
void init()
initializer(creates geometry)
Definition FTFinder.cxx:131
float tOffSet
Definition FTFinder.h:132
float evtTiming
Definition FTFinder.h:133
int eventNo
Definition FTFinder.h:128
CLHEP::Hep3Vector vertex() const
returns event primary vertex
Definition FTFinder.cxx:107
void begin_run()
begin run function(reads constants)
Definition FTFinder.cxx:154
void term()
terminator
int runNo
Definition FTFinder.h:129
int expflag
Definition FTFinder.h:130
void setAlgorithmPointer(Algorithm *)
returns FTFinder pointer
Definition FTFinder.cxx:87
int getWireId(FTWire *) const
returns wire ID for given FTWire object
Definition FTFinder.cxx:89
float x2t(const FTLayer *l, const float x) const
convert x to t
Definition FTFinder.cxx:91
FTFinder()
Constructors and destructor.
Definition FTFinder.cxx:111
const HepPoint3D pivot
Definition FTFinder.h:134
FTList< FTList< float > > tEstime
Definition FTFinder.h:138
static FTGeom * instance()
Definition FTGeom.cxx:162
const float r() const
returns r form origin
Definition FTLayer.h:35
double csize() const
returns cell size
Definition FTLayer.h:53
const int layerId() const
returns layer ID
Definition FTLayer.h:26
Definition FTList.h:6
std::vector< T >::iterator erase(typename std::vector< T >::iterator it)
Definition FTList.h:10
float incomingPhi() const
returns phi of incoming position
Definition FTSegment.cxx:92
FTList< FTWire * > & wireHits()
returns wire-hit FTList
Definition FTSegment.cxx:52
float r() const
returns r from origin
Definition FTSegment.cxx:59
float outgoingY() const
returns y of outgoing position
Definition FTSegment.cxx:56
float kappa() const
returns kappa(axial)
Definition FTSegment.cxx:79
float outgoingX() const
returns x of outgoing position
Definition FTSegment.cxx:55
float incomingX() const
returns x of incoming position
Definition FTSegment.cxx:57
const FTList< FTWire * > & innerBoundHits()
returns innerBoundHits
Definition FTSegment.cxx:53
void update()
update information for axial segment
const FTList< FTWire * > & outerBoundHits()
returns outerBoundHits
Definition FTSegment.cxx:54
float outgoingPhi() const
returns phi of outgoing position
float incomingY() const
returns y of incoming position
Definition FTSegment.cxx:58
void connect_outer(const FTList< FTWire * > &, const FTList< FTWire * > &)
connect short segments
Definition FTSegment.cxx:25
void appendHit(FTWire *)
append wireHit to the list of hits
float _chi2_kappa
Definition FTTrack.h:131
const FTList< FTSegment * > & stereo_segments()
returns stereo_segments
Definition FTTrack.cxx:55
void setFTFinder(FTFinder *)
Definition FTTrack.cxx:65
float chi2_kappa_tmp() const
returns sigmaKappa at linking
Definition FTTrack.cxx:57
const FTList< FTSegment * > & axial_segments()
returns axial segments
Definition FTTrack.cxx:54
Helix * helix() const
returns helix parameters
Definition FTTrack.cxx:60
FTLayer * layer() const
returns layer
Definition FTWire.h:60
Hep3Vector momentum(double dPhi=0.) const
returns momentum vector after rotating angle dPhi in phi direction.
HepPoint3D x(double dPhi=0.) const
returns position after rotating angle dPhi in phi direction.
double dr(void) const
returns an element of parameters.
const HepPoint3D & pivot(void) const
returns pivot position.
HepVector Hpar(const HepPoint3D &pivot) const
static Identifier wire_id(int wireType, int layer, int wire)
For a single wire.
Definition MdcID.cxx:69
static int layer(const Identifier &id)
Values of different levels (failure returns 0).
Definition MdcID.cxx:47
static int wire(const Identifier &id)
Definition MdcID.cxx:52
static MdcParameter * instance()
static int MdcChargeChannel(double charge)
static double MdcTime(int timeChannel)
static double MdcCharge(int chargeChannel)
Index next(Index i)
int t()
Definition t.c:1