BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
MucRecRoadFinder.cxx
Go to the documentation of this file.
1//$id$
2//
3//$log$
4
5/*
6 * 2003/12/26 Zhengyun You Peking University
7 *
8 */
9
10#include "MucRecRoadFinder.h"
11#include "EmcRawEvent/EmcDigi.h"
12#include "EmcRecEventModel/RecEmcEventModel.h"
13#include "EventModel/EventHeader.h"
14#include "ExtEvent/RecExtTrack.h"
15#include "GaudiKernel/IDataManagerSvc.h"
16#include "GaudiKernel/IDataProviderSvc.h"
17#include "GaudiKernel/IPartPropSvc.h"
18#include "GaudiKernel/ISvcLocator.h"
19#include "GaudiKernel/MsgStream.h"
20#include "GaudiKernel/PropertyMgr.h"
21#include "GaudiKernel/SmartDataPtr.h"
22#include "Identifier/Identifier.h"
23#include "Identifier/MucID.h"
24#include "McTruth/McKine.h"
25#include "McTruth/McParticle.h"
26#include "MdcRawEvent/MdcDigi.h"
27#include "MdcRecEvent/RecMdcTrack.h"
28#include "MucGeomSvc/IMucGeomSvc.h"
29#include "MucGeomSvc/MucConstant.h"
30#include "MucRawEvent/MucDigi.h"
31#include "MucRecEvent/MucRec2DRoad.h"
32#include "MucRecEvent/MucRec3DRoad.h"
33#include "MucRecEvent/MucRecHit.h"
34#include "MucRecEvent/MucRecHitContainer.h"
35#include "MucRecEvent/RecMucTrack.h"
37#include "ReconEvent/ReconEvent.h"
38#include "TofRawEvent/TofDigi.h"
39#include "geomdefs.hh"
40#include <fstream>
41#include <iomanip>
42#include <iostream>
43#include <vector>
44
45using namespace std;
46using namespace Event;
47
49
50MucRecRoadFinder::MucRecRoadFinder( const std::string& name, ISvcLocator* pSvcLocator )
51 : Algorithm( name, pSvcLocator ) {
52 // Declare the properties
53 declareProperty( "FittingMethod", m_fittingMethod = 2 );
54 declareProperty( "ConfigFile", m_configFile = "MucConfig.xml" );
55 declareProperty( "McCosmic", m_mccosmic = 0 );
56 declareProperty( "OnlySeedFit", m_onlyseedfit = 0 );
57 declareProperty( "NtOutput", m_NtOutput = 0 );
58 declareProperty( "MaxHitsRec", m_maxHitsRec = 200 );
59 declareProperty( "United", m_united = 0 );
60 declareProperty( "SeedType", m_seedtype = 0 );
61 declareProperty( "MsOutput", m_MsOutput = false );
62 declareProperty( "FilterFile", m_filter_filename );
63}
64
65// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
67 MsgStream log( msgSvc(), name() );
68 log << MSG::INFO << "in initialize()" << endmsg;
69
70 m_NHitsTotal = 0;
71 m_NHitsLostTotal = 0;
72 for ( int i = 0; i < 20; i++ ) m_NHitsLost.push_back( 0 );
73 for ( int i = 0; i < 10; i++ ) m_NHitsLostInGap.push_back( 0 );
74
75 m_NEvent = 0;
76 m_NEventWithHit = 0;
77 m_NEventReco = 0;
78
79 IMucGeomSvc* mucGeomSvc;
80 StatusCode sc = service( "MucGeomSvc", mucGeomSvc );
81 if ( sc == StatusCode::SUCCESS )
82 {
83 mucGeomSvc->Dump();
84 // cout<<"1st wire id:"<<mucGeomSvc->Wire(0)->Id()<<endl;
85 // cout<<"2nd wire lyr id:"<<mucGeomSvc->Wire(1)->Lyr()->Id()<<endl;
86 // cout<<"6860th wire lyr id:"<<mucGeomSvc->Wire(6859)->Lyr()->Id()<<endl;
87 }
88 else { return StatusCode::FAILURE; }
89
90 aMucRecHitContainer = 0;
91
92 if ( m_NtOutput >= 1 )
93 {
94 NTuplePtr nt1( ntupleSvc(), "FILE401/T" );
95
96 if ( nt1 ) { m_tuple = nt1; }
97 else
98 {
99 // m_tuple = ntupleSvc()->book ("MyTuples/1", CLID_RowWiseTuple, "MdcTrkRecon
100 // N-Tuple");
101 m_tuple = ntupleSvc()->book( "FILE401/T", CLID_RowWiseTuple, "MucTrkRecon N-Tuple" );
102 if ( m_tuple )
103 {
104 sc = m_tuple->addItem( "part", m_part );
105 sc = m_tuple->addItem( "seg", m_seg );
106 sc = m_tuple->addItem( "gap", m_gap );
107 sc = m_tuple->addItem( "strip", m_strip );
108 sc = m_tuple->addItem( "diff", m_diff );
109 sc = m_tuple->addItem( "dist", m_dist );
110 sc = m_tuple->addItem( "run", m_run );
111 sc = m_tuple->addItem( "event", m_event );
112 sc = m_tuple->addItem( "ngap", m_ngapwithhits );
113 sc = m_tuple->addItem( "nhit", m_nhit );
114 sc = m_tuple->addItem( "maxhit", m_maxhit );
115 sc = m_tuple->addItem( "multihit", m_multihit );
116 sc = m_tuple->addItem( "angleCosmic", m_angle_cosmic );
117 sc = m_tuple->addItem( "angleUpdown", m_angle_updown );
118 sc = m_tuple->addItem( "px", m_px );
119 sc = m_tuple->addItem( "py", m_py );
120 sc = m_tuple->addItem( "pz", m_pz );
121 sc = m_tuple->addItem( "theta", m_theta );
122 sc = m_tuple->addItem( "phi", m_phi );
123 sc = m_tuple->addItem( "theta_pipe", m_theta_pipe );
124 sc = m_tuple->addItem( "phi_pipe", m_phi_pipe );
125 sc = m_tuple->addItem( "pxmc", m_px_mc );
126 sc = m_tuple->addItem( "pymc", m_py_mc );
127 sc = m_tuple->addItem( "pzmc", m_pz_mc );
128 sc = m_tuple->addItem( "thetamc", m_theta_mc );
129 sc = m_tuple->addItem( "phimc", m_phi_mc );
130 sc = m_tuple->addItem( "thetamc_pipe", m_theta_mc_pipe );
131 sc = m_tuple->addItem( "phimc_pipe", m_phi_mc_pipe );
132 sc = m_tuple->addItem( "emcUp", m_emcUp );
133 sc = m_tuple->addItem( "emcDown", m_emcDown );
134 sc = m_tuple->addItem( "mucUp", m_mucUp );
135 sc = m_tuple->addItem( "mucDown", m_mucDown );
136 sc = m_tuple->addItem( "projx", m_projx );
137 sc = m_tuple->addItem( "projz", m_projz );
138 }
139 else
140 { // did not manage to book the N tuple....
141 log << MSG::ERROR << " Cannot book N-tuple:" << long( m_tuple ) << endmsg;
142 // return StatusCode::FAILURE;
143 }
144 }
145 }
146
147 // load the filter event
148 if ( m_filter_filename == "" )
149 {
150 m_filter_filename = getenv( "MUCRECALGROOT" );
151 m_filter_filename += "/share/filter.txt";
152 }
153
154 if ( m_filter_filename.size() )
155 {
156 std::ifstream infile( m_filter_filename.c_str() );
157
158 while ( !infile.eof() )
159 {
160 FilterEvent filterevt;
161 infile >> filterevt.bossver >> filterevt.runid >> filterevt.eventid;
162 if ( ( !infile.good() ) || ( infile.eof() ) ) { break; }
163
164 m_filter_event.push_back( filterevt );
165 // cout << filterevt.bossver << " "
166 // << filterevt.runid << " "
167 // << filterevt.eventid << std::endl;
168 }
169 }
170
171 return StatusCode::SUCCESS;
172}
173
174// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
176
177 MsgStream log( msgSvc(), name() );
178 log << MSG::INFO << "in execute()" << endmsg;
179
180 // Part 1: Get the event header, print out event and run number
181 int event, run;
182
183 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc(), "/Event/EventHeader" );
184 if ( !eventHeader )
185 {
186 log << MSG::FATAL << "Could not find Event Header" << endmsg;
187 return ( StatusCode::FAILURE );
188 }
189 log << MSG::INFO << "Run: " << eventHeader->runNumber()
190 << " Event: " << eventHeader->eventNumber() << endmsg;
191
192 event = eventHeader->eventNumber();
193 run = eventHeader->runNumber();
194
195 // cout<<"events run "<<event <<" "<<run<<endl;
196 string release = getenv( "BES_RELEASE" );
197 // if(release=="6.6.5"&&run==35896&&event==7448){return ( StatusCode::SUCCESS);}
198 // if(release=="6.6.5"&&run==37241&&event==1690731){return ( StatusCode::SUCCESS);}
199 // filter the event
200 for ( std::vector<FilterEvent>::iterator it = m_filter_event.begin();
201 it != m_filter_event.end(); ++it )
202 {
203 const FilterEvent& fe = ( *it );
204 if ( release == fe.bossver && run == fe.runid && event == fe.eventid )
205 {
206 cout << "SKIP: " << fe.bossver << " " << fe.runid << " " << fe.eventid << std::endl;
207 return StatusCode::SUCCESS;
208 }
209 }
210
211 int digiId;
212
213 // Part 2: Retrieve MC truth
214
215 Hep3Vector cosmicMom;
216 if ( m_mccosmic == 1 )
217 {
218 SmartDataPtr<McParticleCol> mcParticleCol( eventSvc(), "/Event/MC/McParticleCol" );
219 if ( !mcParticleCol )
220 {
221 log << MSG::FATAL << "Could not find McParticle" << endmsg;
222 return ( StatusCode::FAILURE );
223 }
224
225 McParticleCol::iterator iter_mc = mcParticleCol->begin();
226 for ( ; iter_mc != mcParticleCol->end(); iter_mc++, digiId++ )
227 {
228 log << MSG::DEBUG << " particleId = " << ( *iter_mc )->particleProperty() << endmsg;
229 int pid = ( *iter_mc )->particleProperty();
230 // cout<<"in mucroadfinder pid = "<<pid<<endl;
231 if ( fabs( pid ) != 13 ) continue;
232
233 HepLorentzVector initialMomentum = ( *iter_mc )->initialFourMomentum();
234 Hep3Vector startP( initialMomentum.px(), initialMomentum.py(), initialMomentum.pz() );
235 Hep3Vector rotate( -initialMomentum.px(), initialMomentum.pz(), initialMomentum.py() );
236
237 if ( m_NtOutput >= 1 )
238 {
239 m_px_mc = initialMomentum.px();
240 m_py_mc = initialMomentum.py();
241 m_pz_mc = initialMomentum.pz();
242
243 m_theta_mc = rotate.theta();
244 m_phi_mc = rotate.phi();
245
246 m_theta_mc_pipe = startP.theta();
247 m_phi_mc_pipe = startP.phi();
248
249 // m_tuple->write();
250 }
251
252 // if(initialMomentum.py()>0)cout<<"py>0????? "<<pid<<endl;
253 cosmicMom = startP;
254 }
255 }
256 /*
257 //Part 3: Retrieve MDC digi
258 SmartDataPtr<MdcDigiCol> mdcDigiCol(eventSvc(),"/Event/Digi/MdcDigiCol");
259 if (!mdcDigiCol) {
260 log << MSG::FATAL << "Could not find MDC digi" << endmsg;
261 return( StatusCode::FAILURE);
262 }
263
264 MdcDigiCol::iterator iter1 = mdcDigiCol->begin();
265 digiId = 0;
266
267 for (;iter1 != mdcDigiCol->end(); iter1++, digiId++) {
268 log << MSG::INFO << "MDC digit No: " << digiId << endmsg;
269
270 log << MSG::INFO
271 << " time_channel = " << (*iter1)->getTimeChannel()
272 << " charge_channel = " << (*iter1)->getChargeChannel()
273 << endmsg;
274 }
275
276 //Part 4: Retrieve TOF digi
277 SmartDataPtr<TofDigiCol> tofDigiCol(eventSvc(),"/Event/Digi/TofDigiCol");
278 if (!tofDigiCol) {
279 log << MSG::FATAL << "Could not find TOF digi" << endmsg;
280 return( StatusCode::FAILURE);
281 }
282
283 TofDigiCol::iterator iter2 = tofDigiCol->begin();
284 digiId = 0;
285
286 for (;iter2 != tofDigiCol->end(); iter2++, digiId++) {
287 log << MSG::INFO << "TOF digit No: " << digiId << endmsg;
288
289 }
290
291 //Part 5: Retrieve EMC digi
292 SmartDataPtr<EmcDigiCol> emcDigiCol(eventSvc(),"/Event/Digi/EmcDigiCol");
293 if (!emcDigiCol) {
294 log << MSG::FATAL << "Could not find EMC digi" << endmsg;
295 return( StatusCode::FAILURE);
296 }
297
298 EmcDigiCol::iterator iter3 = emcDigiCol->begin();
299 digiId = 0;
300
301 for (;iter3 != emcDigiCol->end(); iter3++, digiId++) {
302 log << MSG::INFO << "Emc digit No: " << digiId << endmsg;
303
304 log << MSG::INFO
305 << " time_channel = " << (*iter3)->getTimeChannel()
306 << " charge_channel = " << (*iter3)->getChargeChannel()
307 << endmsg;
308 }
309 */
310
311 // Part 6: Retrieve MUC digi
312 SmartDataPtr<MucDigiCol> mucDigiCol( eventSvc(), "/Event/Digi/MucDigiCol" );
313 if ( !mucDigiCol )
314 {
315 log << MSG::FATAL << "Could not find MUC digi" << endmsg;
316 return ( StatusCode::FAILURE );
317 }
318
319 MucDigiCol::iterator iter4 = mucDigiCol->begin();
320 digiId = 0;
321 for ( ; iter4 != mucDigiCol->end(); iter4++, digiId++ ) {}
322 log << MSG::INFO << "MUC digis:: " << digiId << endmsg;
323 if ( digiId == 0 ) return ( StatusCode::SUCCESS );
324
325 //********************************//
326 RecMucTrackCol* aMucTrackCol;
327 int trackId = -1;
328 int muctrackId = -1;
329
330 if ( m_united != 1 ) // if this algorithm run individualy, we need create hitcollection and
331 // trackcollection...
332 {
333 Identifier mucID;
334 if ( !aMucRecHitContainer ) { aMucRecHitContainer = new MucRecHitContainer(); }
335 aMucRecHitContainer->Clear();
336
337 MucRecHitCol* aMucRecHitCol = new MucRecHitCol();
338 aMucRecHitContainer->SetMucRecHitCol( aMucRecHitCol );
339
340 SmartIF<IDataManagerSvc> dataManSvc( eventSvc() );
341 DataObject* mucRecHitCol;
342 eventSvc()->findObject( "/Event/Recon/MucRecHitCol", mucRecHitCol );
343 if ( mucRecHitCol != NULL )
344 {
345 dataManSvc->clearSubTree( "/Event/Recon/MucRecHitCol" );
346 eventSvc()->unregisterObject( "/Event/Recon/MucRecHitCol" );
347 }
348
349 StatusCode sc = eventSvc()->registerObject( "/Event/Recon/MucRecHitCol",
350 aMucRecHitContainer->GetMucRecHitCol() );
351
352 MucDigiCol::iterator iterMuc = mucDigiCol->begin();
353 int mucDigiId = 0;
354 for ( ; iterMuc != mucDigiCol->end(); iterMuc++, mucDigiId++ )
355 {
356 mucID = ( *iterMuc )->identify();
357 int part = MucID::barrel_ec( mucID );
358 int seg = MucID::segment( mucID );
359 int gap = MucID::layer( mucID );
360 int strip = MucID::channel( mucID );
361 // aMucRecHitContainer->AddHit(mucID);
362 // if(part==1 && seg==2 && gap==8 && (strip==19||strip==16));//cout<<"noise
363 // hit!!!=========="<<endl; else /////this problem has been solved!
364 aMucRecHitContainer->AddHit( part, seg, gap, strip );
365 log << MSG::INFO << " digit" << mucDigiId << " : "
366 << " part " << part << " seg " << seg << " gap " << gap << " strip " << strip
367 << endmsg;
368 }
369
370 DataObject* aReconEvent;
371 eventSvc()->findObject( "/Event/Recon", aReconEvent );
372 if ( aReconEvent == NULL )
373 {
374 // then register Recon
375 aReconEvent = new ReconEvent();
376 StatusCode sc = eventSvc()->registerObject( "/Event/Recon", aReconEvent );
377 if ( sc != StatusCode::SUCCESS )
378 {
379 log << MSG::FATAL << "Could not register ReconEvent" << endmsg;
380 return ( StatusCode::FAILURE );
381 }
382 }
383 StatusCode fr = eventSvc()->findObject( "/Event/Recon", aReconEvent );
384 if ( fr != StatusCode::SUCCESS )
385 {
386 log << MSG::WARNING << "Could not find register ReconEvent, will create it" << endmsg;
387 StatusCode sc = eventSvc()->registerObject( "/Event/Recon", aReconEvent );
388 if ( sc != StatusCode::SUCCESS )
389 {
390 log << MSG::FATAL << "Could not register ReconEvent" << endmsg;
391 return ( StatusCode::FAILURE );
392 }
393 }
394
395 //********************************//
396 // Create track Container;
397 DataObject* mucTrackCol;
398 eventSvc()->findObject( "/Event/Recon/RecMucTrackCol", mucTrackCol );
399 if ( mucTrackCol != NULL )
400 {
401 dataManSvc->clearSubTree( "/Event/Recon/RecMucTrackCol" );
402 eventSvc()->unregisterObject( "/Event/Recon/RecMucTrackCol" );
403 }
404
405 aMucTrackCol = new RecMucTrackCol();
406 sc = eventSvc()->registerObject( "/Event/Recon/RecMucTrackCol", aMucTrackCol );
407 aMucTrackCol->clear();
408
409 // check MucTrackCol registered
410 SmartDataPtr<RecMucTrackCol> findMucTrackCol( eventSvc(), "/Event/Recon/RecMucTrackCol" );
411 if ( !findMucTrackCol )
412 {
413 log << MSG::FATAL << "Could not find RecMucTrackCol" << endmsg;
414 return ( StatusCode::FAILURE );
415 }
416 aMucTrackCol->clear();
417
418 log << MSG::INFO << "MaxHitsRec : " << m_maxHitsRec << endmsg;
419 if ( digiId > m_maxHitsRec )
420 return StatusCode::SUCCESS; // too many digit! abnormal------2008-04-17
421 //********************************//
422 // Create track Container;
423
424 trackId = 0;
425 muctrackId = 0;
426 } //// conrespond to if(m_united != 1) !!!!!!!
427 else if ( m_united == 1 )
428 {
429
430 Identifier mucID;
431 if ( !aMucRecHitContainer ) { aMucRecHitContainer = new MucRecHitContainer(); }
432 aMucRecHitContainer->Clear();
433
434 SmartDataPtr<MucRecHitCol> aMucRecHitCol( eventSvc(), "/Event/Recon/MucRecHitCol" );
435 if ( aMucRecHitCol == NULL ) { log << MSG::WARNING << "MucRecHitCol is NULL" << endmsg; }
436
437 aMucRecHitContainer->SetMucRecHitCol( aMucRecHitCol );
438
439 SmartDataPtr<RecMucTrackCol> mucTrackCol( eventSvc(), "/Event/Recon/RecMucTrackCol" );
440 if ( mucTrackCol == NULL ) { log << MSG::WARNING << "aMucTrackCol is NULL" << endmsg; }
441
442 log << MSG::INFO << "mucTrackCol size: " << mucTrackCol->size()
443 << " hitCol size: " << aMucRecHitCol->size() << endmsg;
444 aMucTrackCol = mucTrackCol;
445
446 // Retrieve Ext track Col from TDS for setting trackId
447 SmartDataPtr<RecExtTrackCol> aExtTrackCol( eventSvc(), "/Event/Recon/RecExtTrackCol" );
448 if ( !aExtTrackCol ) { log << MSG::WARNING << "Can't find ExtTrackCol in TDS!" << endmsg; }
449
450 SmartDataPtr<RecMdcTrackCol> aMdcTrackCol( eventSvc(), "/Event/Recon/RecMdcTrackCol" );
451 if ( !aMdcTrackCol ) { log << MSG::WARNING << "Can't find MdcTrackCol in TDS!" << endmsg; }
452
453 if ( aExtTrackCol && aMdcTrackCol ) trackId = aMdcTrackCol->size();
454 muctrackId = aMucTrackCol->size();
455 }
456
457 int hasEmcUp = 0;
458 int hasEmcDown = 0;
459 SmartDataPtr<RecEmcShowerCol> aShowerCol( eventSvc(), "/Event/Recon/RecEmcShowerCol" );
460 if ( !aShowerCol )
461 {
462 log << MSG::WARNING << "Could not find RecEmcShowerCol" << endmsg;
463 // return( StatusCode::FAILURE);
464 }
465 else
466 {
467 RecEmcShowerCol::iterator iShowerCol;
468 for ( iShowerCol = aShowerCol->begin(); iShowerCol != aShowerCol->end(); iShowerCol++ )
469 {
470 /*
471 cout<<"check EmcRecShowerCol registered:"<<endl;
472 cout<<"shower id: "<<(*iShowerCol)->ShowerId()<<"\t"
473 <<"shower energy: "<<(*iShowerCol)->Energy()<<"\n"
474 <<"shower position: "<<(*iShowerCol)->Position()<<endl;
475 */
476 if ( ( ( *iShowerCol )->position() ).phi() > 0 &&
477 ( ( *iShowerCol )->position() ).phi() < 3.1415926 )
478 hasEmcUp++;
479 else hasEmcDown++;
480 }
481 }
482 if ( m_NtOutput >= 1 )
483 {
484 m_emcUp = hasEmcUp;
485 m_emcDown = hasEmcDown;
486 }
487
488 //********************************//
489 m_NEvent++;
491 // Find or create the 3D road container ...
492 if ( !p3DRoadC ) { p3DRoadC = new MucRec3DRoadContainer(); }
493 p3DRoadC->clear(); // make sure that the container is empty
494
496 // Find or create the 2D road0 container ...
497 if ( !p2DRoad0C ) { p2DRoad0C = new MucRec2DRoadContainer(); }
498 p2DRoad0C->clear(); // make sure that the container is empty
499
501 // Find or create the 2D road1 container ...
502 if ( !p2DRoad1C ) { p2DRoad1C = new MucRec2DRoadContainer(); }
503 p2DRoad1C->clear(); // make sure that the container is empty
504 log << MSG::INFO << "Muc 2D 3D Road Container created" << endmsg;
505
506 // We have all of the input and output parameters now, so do
507 // something useful with them!
508 // static bool first_call = true;
509 //
510 // Now find some roads!
511 //
512
513 MucRecHit *pHit0 = 0, *pHit1 = 0;
514 int count0, count1, count, iGap0, iGap1;
515 int orient;
516
517 for ( int iPart = 0; iPart < (int)MucID::getPartNum(); iPart++ )
518 {
519 for ( int iSeg = 0; iSeg < (int)MucID::getSegNum( iPart ); iSeg++ )
520 {
521 for ( int iOrient = 0; iOrient < 2; iOrient++ )
522 {
523 int nLoops = 1;
524 if ( m_seedtype == 1 ) nLoops = kNSeedLoops;
525 for ( int iLoop = 0; iLoop < nLoops; iLoop++ )
526 { // now only 1 loop
527 // checkout the seed gap(s) from search order
528 int length = kSearchLength[iLoop][iPart][iOrient];
529 if ( m_seedtype == 1 )
530 {
531 iGap0 = kSearchOrder[iLoop][iPart][iOrient][0];
532 iGap1 = kSearchOrder[iLoop][iPart][iOrient][1];
533 }
534 else
535 { // new method to calc seed gaps------//
536 int setgap0 = 0;
537 MucDigiCol::iterator iterMuc = mucDigiCol->begin();
538 int mucDigiId = 0;
539 Identifier mucID;
540 iGap0 = 0;
541 iGap1 = 0;
542 for ( ; iterMuc != mucDigiCol->end(); iterMuc++, mucDigiId++ )
543 {
544 mucID = ( *iterMuc )->identify();
545 int part = MucID::barrel_ec( mucID );
546 int seg = MucID::segment( mucID );
547 int gap = MucID::layer( mucID );
548 int strip = MucID::channel( mucID );
549 int orient = 0;
550 if ( ( part == 1 && gap % 2 == 0 ) || ( part != 1 && gap % 2 == 1 ) ) orient = 1;
551
552 if ( part == iPart && seg == iSeg && orient == iOrient && setgap0 == 0 )
553 {
554 iGap0 = gap;
555 setgap0 = 1;
556 } // make sure that iGap0 record the 1st gap in this orient
557 if ( part == iPart && seg == iSeg && orient == iOrient && setgap0 == 1 &&
558 gap != iGap0 )
559 { iGap1 = gap; } // make sure that iGap1 record the last gap in this orient
560 }
561 }
562 //
563 if ( m_MsOutput )
564 cout << "Find seed gap in ( " << iPart << " " << iSeg << " ) gap0: " << iGap0
565 << " gap1: " << iGap1 << endl;
566
567 // new method to calc seed gaps------//
568 if ( iGap0 > iGap1 )
569 {
570 int tempGap = iGap0;
571 iGap0 = iGap1;
572 iGap1 = tempGap;
573 }
574 if ( iGap1 == iGap0 ) continue;
575
576 count0 = aMucRecHitContainer->GetGapHitCount( iPart, iSeg, iGap0 );
577 for ( int iHit0 = 0; iHit0 < count0; iHit0++ )
578 {
579 // cout << "iHit0 = " << iHit0 << endl;
580 pHit0 = aMucRecHitContainer->GetHit( iPart, iSeg, iGap0, iHit0 );
581 if ( !pHit0 )
582 {
583 log << MSG::FATAL << "MucRecRoadFinder-E10 "
584 << " part " << iPart << " seg " << iSeg << " gap " << iGap0
585 << " null pointer" << endl;
586 }
587 else
588 {
589
590 // this algo use with ext and this hit has been used before;
591 if ( m_united == 1 && pHit0->GetHitMode() != -1 ) continue;
592
593 count1 = aMucRecHitContainer->GetGapHitCount( iPart, iSeg, iGap1 );
594 if ( m_MsOutput )
595 cout << "part " << iPart << " seg " << iSeg << " orient " << iOrient
596 << " gap0 " << iGap0 << " count0 " << count0 << " gap1 " << iGap1
597 << " count1 " << count1 << endl;
598 for ( int iHit1 = 0; iHit1 < count1; iHit1++ )
599 {
600 // cout << "iHit1 = " << iHit1 << endl;
601 pHit1 = aMucRecHitContainer->GetHit( iPart, iSeg, iGap1, iHit1 );
602 if ( !pHit1 )
603 {
604 log << MSG::ERROR << "MucRecRoadFinder-E10 "
605 << " part " << iPart << " seg " << iSeg << " gap " << iGap1
606 << " null pointer" << endl;
607 }
608 else
609 {
610
611 // this algo use with ext and this hit has been used before;
612 if ( m_united == 1 && pHit1->GetHitMode() != -1 ) continue;
613
614 // Found seed hit(s), create a new 2D road object,
615 // and attach hit pHit1 and pHit0
616 MucRec2DRoad* road2D =
617 new MucRec2DRoad( iPart, iSeg, iOrient, 0.0, 0.0, 3000.0 );
618 if ( !road2D )
619 {
620 log << MSG::FATAL << "MucRecRoadFinder-E20 "
621 << "failed to create 2D road!" << endmsg;
622 continue;
623 }
625
626 if ( !pHit0->GetGap() )
627 log << MSG::ERROR << "pHit0->GetGap(), null pointer" << endmsg;
628 if ( pHit0->GetGap()->Orient() == iOrient )
629 {
630 // float xStrip, yStrip, zStrip;
631 // MucRecGeometry::GetPointer()->GetStripPointer(pHit0->GetSoftID())->GetCenterPos(xStrip,
632 // yStrip, zStrip); cout << " x = " << xStrip << " y = " << yStrip << " z =
633 // " << zStrip << endl;
634
635 // set hit as seed then
636 bool isseed = true;
637 pHit0->SetHitSeed( true );
638 pHit1->SetHitSeed( true );
639
640 road2D->AttachHit( pHit0 );
641 if ( m_MsOutput )
642 cout << "pHit0 attached, " << road2D->GetTotalHits()
643 << ", hitId= " << pHit0->Part() << " " << pHit0->Seg() << " "
644 << pHit0->Gap() << " " << pHit0->Strip() << endl;
645 }
646
647 if ( pHit1->GetGap()->Orient() == iOrient )
648 {
649 // cout << pHit1->GetSoftID() << endl;
650 // float xStrip, yStrip, zStrip;
651 // MucRecGeometry::GetPointer()->GetStripPointer(pHit1->GetSoftID())->GetCenterPos(xStrip,
652 // yStrip, zStrip); cout << " x = " << xStrip << " y = " << yStrip << " z =
653 // " << zStrip << endl;
654 road2D->AttachHit( pHit1 );
655 if ( m_MsOutput )
656 cout << "pHit1 attached, " << road2D->GetTotalHits()
657 << ", hitId= " << pHit1->Part() << " " << pHit1->Seg() << " "
658 << pHit1->Gap() << " " << pHit1->Strip() << endl;
659 }
660 if ( m_MsOutput )
661 cout << "Hit cout " << road2D->GetTotalHits() << ", slope "
662 << road2D->GetSlope() << endl;
663
664 // After first (two) hit(s) is(are) attached,
665 // calculate reference pos, direction.
666 // Project to the other planes;
667 // attach clusters within search window.
668
669 for ( int i = 0; i < length; i++ )
670 {
671 int iGap = kSearchOrder[iLoop][iPart][iOrient][i];
672
673 float dXmin = kInfinity;
674 MucRecHit* pHit = 0;
675
676 float Win = kWindowSize[iPart][iGap];
677 // Win = road2D->GetSearchWindowSize(iGap);
678
679 // following line should be removed after
680 // we have a good function classes for search window
681 // Win = WindowParGamma[iGap];
682
683 // search hit in iGap
684 count = aMucRecHitContainer->GetGapHitCount( iPart, iSeg, iGap );
685 for ( int iHit = 0; iHit < count; iHit++ )
686 {
687 pHit = aMucRecHitContainer->GetHit( iPart, iSeg, iGap, iHit );
688 if ( !pHit )
689 {
690 log << MSG::FATAL << "MucRecRoadFinder-E20 null cluster pointer pHit"
691 << endmsg;
692 continue;
693 }
694 else
695 {
696
697 // this algo use with ext and this hit has been used before;
698 if ( m_united == 1 && pHit->GetHitMode() != -1 ) continue;
699
700 // Get the displacement of hit pHit to road2D
701 float dX = road2D->GetHitDistance( pHit );
702 if ( m_MsOutput )
703 cout << "dX = " << dX << " Win = " << Win
704 << ", hit: " << pHit->Part() << " " << pHit->Seg() << " "
705 << pHit->Gap() << " " << pHit->Strip() << endl;
706
707 if ( dX < Win )
708 {
709 // Attach the hit if it exists
710 // cout << "meet window " << pHit->GetSoftID() << endl;
711 if ( iGap == iGap0 || iGap == iGap1 )
712 { // hits in these gap is used to be seed, so unvailable for
713 // calibrate effi;
714 if ( pHit->GetHitMode() == -1 )
715 {
716 pHit->SetHitMode( 3 ); // self road finder mode
717 }
718 else if ( pHit->GetHitMode() == 3 )
719 {
720 pHit->SetHitMode( 4 ); // self road finder mode used!!!
721 }
722 }
723 // attach hits if we need fit or hit. OR, only attach hits not in
724 // seed layers
725 if ( m_onlyseedfit == 0 ) road2D->AttachHit( pHit );
726 else
727 {
728 if ( iGap == iGap0 || iGap == iGap1 ) road2D->AttachHit( pHit );
729 else road2D->AttachHitNoFit( pHit );
730 }
731 }
732 }
733 }
734
735 } // for (int i = 0; i < length; ...), Search all gaps
736
737 // Ok we found a road already, we need to know
738 // whether we should save it or not
739 // check road quality...
740 //
741
742 // 1. last gap of the road
743 bool lastGapOK = false;
744 if ( road2D->GetLastGap() >= kMinLastGap2D ) { lastGapOK = true; }
745 else
746 {
747 log << MSG::INFO << " 2D lastGap " << road2D->GetLastGap() << " < "
748 << kMinLastGap2D << endmsg;
749 }
750
751 // 2. positon at reference plane
752
753 // 3. number of gaps contain hits
754 bool firedGapsOK = false;
755 if ( road2D->GetNGapsWithHits() >= kMinFiredGaps ) { firedGapsOK = true; }
756 else
757 {
758 log << MSG::INFO << " 2D firedGaps " << road2D->GetNGapsWithHits() << " < "
759 << kMinFiredGaps << endmsg;
760 }
761
762 // 4. duplicated road check
763 bool duplicateRoad = false;
764 int maxSharedHits = 0, sharedHits = 0;
765 if ( iOrient == 0 )
766 {
767 for ( int index = 0; index < (int)p2DRoad0C->size(); index++ )
768 { sharedHits = ( *p2DRoad0C )[index]->GetNSharedHits( road2D ); }
769 if ( maxSharedHits < sharedHits ) maxSharedHits = sharedHits;
770 }
771 else
772 {
773 for ( int index = 0; index < (int)p2DRoad1C->size(); index++ )
774 { sharedHits = ( *p2DRoad1C )[index]->GetNSharedHits( road2D ); }
775 if ( maxSharedHits < sharedHits ) maxSharedHits = sharedHits;
776 }
777
778 if ( road2D->GetTotalHits() == maxSharedHits ||
779 maxSharedHits >= kMinSharedHits2D )
780 {
781 duplicateRoad = true;
782 log << MSG::INFO << " maxSharedHits " << maxSharedHits << " > "
783 << kMinSharedHits2D << endmsg;
784 }
785
786 // Here is our criteria for a candidate road
787 // i.e. 1) There are at least two gaps containing hits
788 // 2) LastGap of the road passes last plane cut
789 // 3) Reference position passes vertex cut
790 // 4) No existing road share same hits with the road
791
792 if ( lastGapOK && firedGapsOK && !duplicateRoad )
793 {
794 if ( iOrient == 0 )
795 {
796 log << MSG::INFO << "Add a road0" << endmsg;
797 p2DRoad0C->add( road2D );
798 }
799 else
800 {
801 log << MSG::INFO << "Add a road1" << endmsg;
802 p2DRoad1C->add( road2D );
803 }
804 }
805 else
806 {
807
808 // reset hit mode to be -1 if this road useless!
809 vector<MucRecHit*> road2DHits = road2D->GetHits();
810 for ( int i = 0; i < road2DHits.size(); i++ )
811 {
812 MucRecHit* ihit = road2DHits[i];
813 if ( ihit->Gap() == iGap0 || ihit->Gap() == iGap1 )
814 {
815 if ( ihit->GetHitMode() == 3 ) ihit->SetHitMode( -1 );
816 if ( ihit->GetHitMode() == 4 ) ihit->SetHitMode( 3 );
817 }
818 }
819 delete road2D;
820 }
821 } // else {
822 } // for ( int iHit = 0 ...)
823 } // else {
824 } // for ( int iHit0 ...)
825 } // for (int iLoop ...)
826 } // for (int iOrient ...)
827 } // for (int iSeg ...)
828 } // for(iPartArm ...)
829
830 int print2DRoadInfo = 0;
831 if ( print2DRoadInfo == 1 )
832 {
833 // print 2DRoad container info.
834 cout << "In 2DRoad container : " << endl
835 << " Num of 2DRoad0 = " << p2DRoad0C->size() << endl
836 << endl;
837
838 for ( int iRoad = 0; iRoad < (int)p2DRoad0C->size(); iRoad++ )
839 {
840
841 MucRec2DRoad* road = ( *p2DRoad0C )[iRoad];
842 cout << " " << iRoad << "th 2DRoad0 :" << endl
843 << " Part = " << road->GetPart() << endl
844 << " Seg = " << road->GetSeg() << endl
845 << " Orient = " << road->GetOrient() << endl
846 << " LastGap = " << road->GetLastGap() << endl
847 << " TotalHits = " << road->GetTotalHits() << endl
848 << " DOF = " << road->GetDegreesOfFreedom() << endl
849 << " Slope = " << road->GetSlope() << endl
850 << " Intercept = " << road->GetIntercept() << endl
851 << endl;
852 // road->PrintHitsInfo();
853 }
854
855 cout << " Num of 2DRoad1 = " << p2DRoad1C->size() << endl << endl;
856
857 for ( int iRoad = 0; iRoad < (int)p2DRoad1C->size(); iRoad++ )
858 {
859
860 MucRec2DRoad* road = ( *p2DRoad1C )[iRoad];
861 cout << " " << iRoad << "th 2DRoad1 :" << endl
862 << " Part = " << road->GetPart() << endl
863 << " Seg = " << road->GetSeg() << endl
864 << " Orient = " << road->GetOrient() << endl
865 << " LastGap = " << road->GetLastGap() << endl
866 << " TotalHits = " << road->GetTotalHits() << endl
867 << " DOF = " << road->GetDegreesOfFreedom() << endl
868 << " Slope = " << road->GetSlope() << endl
869 << " Intercept = " << road->GetIntercept() << endl
870 << endl;
871 // road->PrintHitsInfo();
872 }
873 }
874
875 // We found all possible 2D roads in one part and seg
876 // and now it is time to construct 3D roads base on those 2D roads
877 for ( int iRoad0 = 0; iRoad0 < (int)p2DRoad0C->size(); iRoad0++ )
878 {
879 MucRec2DRoad* road0 = ( *p2DRoad0C )[iRoad0];
880 for ( int iRoad1 = 0; iRoad1 < (int)p2DRoad1C->size(); iRoad1++ )
881 {
882 MucRec2DRoad* road1 = ( *p2DRoad1C )[iRoad1];
883
884 // Create a new road object with road0 and road1
885 if ( !( road0 && road1 ) )
886 {
887 cout << "Null pointer to road0 or road1: "
888 << "road0 = " << road0 << "road1 = " << road1 << endl;
889 continue;
890 }
891
892 // Check that both 1D roads are in the same part and segment.
893 if ( ( road0->GetPart() != road1->GetPart() ) || ( road0->GetSeg() != road1->GetSeg() ) )
894 { continue; }
895
896 MucRec3DRoad* road3D = new MucRec3DRoad( road0, road1 );
897
898 // What are our criteria for accepting a road as valid?
899 // Check them here.
900 // 1. difference of total number clusters in road0 and in road1
901 // 2. difference of last gaps in road0 and road1
902 // 3. InterSection OK or not (if X Y clusters in each gap are
903 // in same panel or overlap region)
904 // 4. Reference position check
905 // 5. Chisquare check
906 // 6. Last Gap check
907 // 7. Duplicate road check
908
909 bool lastGapDeltaOK = false;
910 if ( road3D->GetLastGapDelta() <= kMaxDeltaLastGap ) { lastGapDeltaOK = true; }
911 else { cout << "LastGapDelta = " << road3D->GetLastGapDelta() << endl; }
912
913 bool totalHitsDeltaOK = false;
914 if ( road3D->GetTotalHitsDelta() <= kMaxDeltaTotalHits ) { totalHitsDeltaOK = true; }
915 else
916 {
917 // cout << "TotalHitsDelta = " << road3D->GetTotalHitsDelta() << endl;
918 }
919
920 bool chiSquareCutOK = false;
921 float xChiSquare = road0->GetReducedChiSquare();
922 float yChiSquare = road1->GetReducedChiSquare();
923 if ( xChiSquare <= kMaxXChisq && yChiSquare <= kMaxYChisq ) { chiSquareCutOK = true; }
924 else { cout << "xChiSquare = " << xChiSquare << "yChiSquare = " << yChiSquare << endl; }
925
926 bool minLastGapOK = false;
927 if ( road3D->GetLastGap() >= kMinLastGap3D ) { minLastGapOK = true; }
928 else { log << MSG::INFO << " minLastGap = " << road3D->GetLastGap() << endmsg; }
929
930 bool duplicateRoad = false;
931 int maxSharedHits = 0, sharedHits = 0;
932 for ( int i = 0; i < (int)p3DRoadC->size(); i++ )
933 {
934 sharedHits = ( *p3DRoadC )[i]->GetNSharedHits( road3D );
935 if ( maxSharedHits < sharedHits ) maxSharedHits = sharedHits;
936
937 // cout<<"judge shared hits: road["<<i<<"] max = "<<maxSharedHits<<endl;
938 }
939 if ( road3D->GetTotalHits() == maxSharedHits || maxSharedHits >= kMinSharedHits2D )
940 {
941 duplicateRoad = true;
942 log << MSG::INFO << " MaxShareHits = " << maxSharedHits << endmsg;
943 }
944
945 if ( lastGapDeltaOK && totalHitsDeltaOK && chiSquareCutOK && minLastGapOK &&
946 !duplicateRoad )
947 {
948 float vx, vy, x0, y0;
949 float slope1 = 100, slope0 = 100;
950 if ( fabs( road1->GetSlope() ) < 100 ) slope1 = road1->GetSlope();
951 if ( fabs( road0->GetSlope() ) < 100 ) slope0 = road0->GetSlope();
952
953 if ( road3D->GetPart() == 1 )
954 {
955 road3D->TransformPhiRToXY( slope1, slope0, road1->GetIntercept(),
956 road0->GetIntercept(), vx, vy, x0, y0 );
957 }
958 else
959 {
960 vx = slope1;
961 x0 = road1->GetIntercept();
962 vy = slope0;
963 y0 = road0->GetIntercept();
964 }
965 road3D->SetSimpleFitParams( vx, x0, vy, y0 );
966
967 log << MSG::INFO << "Add a 3D Road ... " << endmsg;
968
969 float startx = 0.0, starty = 0.0, startz = 0.0;
970 float sigmax = 0.0, sigmay = 0.0, sigmaz = 0.0;
971 road3D->ProjectWithSigma( 0, startx, starty, startz, sigmax, sigmay, sigmaz ); // gap0
972
973 // cout<<"slope1,0 = "<<slope1<<" "<<slope0<<" vx,y = "<<vx<<" "<<vy<<endl;
974 // cout<<"startxyz= "<<startx<<" "<<starty<<" "<<startz<<endl;
975 // mom(vx,vy,1)
976 float vz = 1;
977 float sign = vy / fabs( vy );
978 float signx = vx / fabs( vx );
979 // cout<<"vxyz = "<<vx<<" "<<vy<<" "<<vz<<endl;
980 if ( road3D->GetPart() == 1 )
981 {
982 if ( road3D->GetSeg() > 4 )
983 { // down segment
984
985 vx *= -sign;
986 vy *= -sign;
987 vz *= -sign;
988 }
989 else if ( road3D->GetSeg() < 2 )
990 {
991 vx *= signx;
992 vy *= signx;
993 vz *= signx;
994 }
995 else if ( road3D->GetSeg() >= 3 && road3D->GetSeg() <= 4 )
996 {
997 vx *= -signx;
998 vy *= -signx;
999 vz *= -signx;
1000 }
1001 else
1002 {
1003 vx *= sign;
1004 vy *= sign;
1005 vz *= sign;
1006 }
1007 }
1008 else if ( road3D->GetPart() == 0 )
1009 {
1010 // fix me
1011
1012 // cout<<"startxyz= "<<startx<<" "<<starty<<" "<<startz<<endl;
1013 // cout<<"vx,y,z = "<<vx<<" "<<vy<<" "<<vz<<endl;
1014 // cout<<"in road finder a endcap finded!!! -------------"<<endl;
1015 }
1016 else if ( road3D->GetPart() == 2 )
1017 {
1018 // fix me
1019
1020 vx *= -1;
1021 vy *= -1;
1022 vz *= -1;
1023 // cout<<"startxyz= "<<startx<<" "<<starty<<" "<<startz<<endl;
1024 // cout<<"vx,y,z = "<<vx<<" "<<vy<<" "<<vz<<endl;
1025 // cout<<"in road finder a endcap finded!!! ------------2-"<<endl;
1026 }
1027
1028 Hep3Vector mom( vx, vy, vz );
1029
1030 ////////////construct track
1031 // MucTrack *aTrack = new MucTrack(road3D);
1032 // cout<<"startxyz = "<<startx<<" "<<starty<<" "<<startz<<endl;
1033 // cout<<"vxyz = "<<vx<<" "<<vy<<" "<<vz<<endl;
1034
1035 startx /= 10;
1036 starty /= 10;
1037 startz /= 10; // mm->cm
1038 startx -= vx / mom.mag();
1039 starty -= vy / mom.mag();
1040 startz -= vz / mom.mag(); // decrease a little
1041
1042 // cout<<"startxyz = "<<startx<<" "<<starty<<" "<<startz<<endl;
1043 RecMucTrack* aTrack = new RecMucTrack();
1044 aTrack->SetExtMucPos( startx, starty, startz ); // mm->cm
1045 aTrack->SetExtMucMomentum( vx, vy, vz );
1046 aTrack->SetMucPos( startx, starty, startz );
1047 aTrack->SetMucMomentum( vx, vy, vz );
1048 aTrack->SetCurrentPos( startx, starty, startz );
1049 aTrack->SetCurrentDir( vx, vy, vz );
1050 aTrack->SetRecMode( 3 );
1051 // aTrack->LineFit(1);
1052 // aTrack->ComputeTrackInfo(1);
1053
1054 aTrack->setTrackId( trackId );
1055 aTrack->setId( muctrackId );
1056 trackId++;
1057 muctrackId++;
1058
1059 // cout<<"find a track!!!"<<endl;
1060 aMucTrackCol->add( aTrack );
1061 TrackFinding( aTrack );
1062 p3DRoadC->add( road3D );
1063
1064 ////////////record strip info in this track//////////////
1065
1066 vector<MucRecHit*> attachedHits = aTrack->GetHits();
1067 vector<MucRecHit*> expectedHits = aTrack->GetExpectedHits();
1068 vector<float> distanceHits = aTrack->getDistHits();
1069
1070 for ( int i = 0; i < expectedHits.size(); i++ )
1071 {
1072 MucRecHit* ihit = expectedHits[i];
1073 // cout<<"expected Hits: "<<ihit->Part()<<" "<<ihit->Seg()<<" "<<ihit->Gap()<<"
1074 // "<<ihit->Strip()<<endl;
1075 }
1076
1077 vector<int> multiHit;
1078 for ( int i = 0; i < attachedHits.size(); i++ )
1079 {
1080 MucRecHit* ihit = attachedHits[i];
1081 // cout<<"attached Hits: "<<ihit->Part()<<" "<<ihit->Seg()<<" "<<ihit->Gap()<<"
1082 // "<<ihit->Strip()<<" hitmode: "<<ihit->GetHitMode()<<endl; calc multiplicity hits;
1083 int hitnum = 0;
1084 for ( int k = 0; k < attachedHits.size(); k++ )
1085 {
1086 MucRecHit* khit = attachedHits[k];
1087 if ( ( ihit->Part() == khit->Part() ) && ( ihit->Seg() == khit->Seg() ) &&
1088 ( ihit->Gap() == khit->Gap() ) )
1089 hitnum++;
1090 }
1091 multiHit.push_back( hitnum );
1092 // cout<<"multi hit: "<<hitnum<<" "<<multiHit[i]<<endl;
1093 }
1094
1095 for ( int i = 0; i < expectedHits.size(); i++ )
1096 { // calc distance between attached hits and expected hits
1097
1098 MucRecHit* ihit = expectedHits[i];
1099 // cout<<"attached Hits: "<<ihit->Part()<<" "<<ihit->Seg()<<" "<<ihit->Gap()<<"
1100 // "<<ihit->Strip()<<endl;
1101
1102 int diff = -999;
1103
1104 for ( int j = 0; j < attachedHits.size(); j++ )
1105 {
1106 MucRecHit* jhit = attachedHits[j];
1107
1108 // if(attachedHits.size()!=distanceHits.size())cout<<"attached hits
1109 // size no same as disthits!!!"<<endl;
1110
1111 if ( ( jhit->Part() == ihit->Part() ) && ( jhit->Seg() == ihit->Seg() ) &&
1112 ( jhit->Gap() == ihit->Gap() ) && attachedHits.size() == distanceHits.size() )
1113 { // same gap, cale distance
1114 diff = ihit->Strip() - jhit->Strip();
1115 // cout<<"diff = "<<diff<<endl;
1116
1117 if ( m_NtOutput >= 2 )
1118 {
1119
1120 m_part = ihit->Part();
1121 m_seg = ihit->Seg();
1122 m_gap = ihit->Gap();
1123 m_strip = jhit->Strip();
1124 m_diff = diff;
1125 m_dist = distanceHits[j];
1126 // cout<<"distance = "<<m_dist<<endl;
1127
1128 m_angle_cosmic = -999;
1129 m_angle_updown = -999;
1130 // m_px = -999; m_py = -999; m_pz = -999; m_theta = -999; m_phi = -999;
1131 // m_theta_pipe = -999; m_phi_pipe = -999; m_px_mc = -999; m_py_mc = -999;
1132 // m_pz_mc = -999; m_theta_mc = -999; m_phi_mc = -999; m_theta_mc_pipe = -999;
1133 // m_phi_mc_pipe = -999;
1134 m_ngapwithhits = aTrack->numLayers();
1135 m_nhit = aTrack->numHits();
1136 m_maxhit = aTrack->maxHitsInLayer();
1137 m_multihit = multiHit[j];
1138 m_run = eventHeader->runNumber();
1139 m_event = eventHeader->eventNumber();
1140
1141 m_tuple->write();
1142 }
1143 }
1144 }
1145
1146 if ( diff == -999 )
1147 { // to calc effi of this strip
1148 if ( m_NtOutput >= 2 )
1149 {
1150 m_part = ihit->Part();
1151 m_seg = ihit->Seg();
1152 m_gap = ihit->Gap();
1153 m_strip = ihit->Strip();
1154 m_diff = diff;
1155 m_dist = -999;
1156 m_angle_updown = -999;
1157 m_angle_cosmic = -999;
1158 // m_px = -999; m_py = -999; m_pz = -999; m_theta = -999; m_phi = -999;
1159 // m_theta_pipe = -999; m_phi_pipe = -999; m_px_mc = -999; m_py_mc = -999;
1160 // m_pz_mc = -999; m_theta_mc = -999; m_phi_mc = -999; m_theta_mc_pipe = -999;
1161 // m_phi_mc_pipe = -999;
1162 m_ngapwithhits = aTrack->numLayers();
1163 m_run = eventHeader->runNumber();
1164 m_event = eventHeader->eventNumber();
1165 // m_tuple->write();
1166 }
1167 }
1168 // if(diff != -999) cout<< "has hit in this layer"<<endl;
1169 }
1170 ////////////record strip info in this track//////////////
1171 /*
1172 m_part = -999;
1173 m_seg = -999;
1174 m_gap = -999;
1175 m_strip= -999;
1176 m_diff = -999;
1177
1178 m_angle_updown = -999;
1179 m_angle_cosmic = cosmicMom.angle(aTrack->getMucMomentum());
1180 if(m_angle_cosmic>1.57) m_angle_cosmic = 3.14159265 - m_angle_cosmic;
1181 m_run = eventHeader->runNumber();
1182 m_event = eventHeader->eventNumber();
1183
1184 double px,py,pz,p,theta,phi;
1185 px = (aTrack->getMucMomentum()).x();
1186 py = (aTrack->getMucMomentum()).y();
1187 pz = (aTrack->getMucMomentum()).z();
1188
1189 Hep3Vector rotate(-px,pz,py);
1190 theta = rotate.theta();
1191 phi = rotate.phi();
1192
1193
1194 m_px = px; m_py = py; m_pz = pz;
1195 m_theta = theta; m_phi = phi;
1196 m_theta_pipe = (aTrack->getMucMomentum()).theta();
1197 m_phi_pipe = (aTrack->getMucMomentum()).phi();
1198 //m_px_mc = -999; m_py_mc = -999; m_pz_mc = -999; m_theta_mc = -999; m_phi_mc = -999;
1199 //m_theta_mc_pipe = -999; m_phi_mc_pipe = -999;
1200 //////////if(m_py>0)m_tuple->write();
1201
1202 */
1203 }
1204 else
1205 {
1206 // cout << "Delete a 3D Road ... " << endl;
1207 delete road3D;
1208 // don't keep it if it's not a good condidate
1209 }
1210 } // for ( int iRoad1 ...
1211 } // for ( int iRoad0 ..
1212
1213 // for cosmic ray, to combine 2 track to 1
1214 RecMucTrack* aaTrack = 0;
1215 RecMucTrack* bbTrack = 0;
1216
1217 int hasMucUp = 0;
1218 int hasMucDown = 0;
1219 for ( int iTrack = 0; iTrack < (int)aMucTrackCol->size(); iTrack++ )
1220 {
1221 aaTrack = ( *aMucTrackCol )[iTrack];
1222 if ( ( aaTrack->getMucMomentum() ).phi() < 3.1415926 &&
1223 ( aaTrack->getMucMomentum() ).phi() > 0 )
1224 hasMucUp++;
1225 else hasMucDown++;
1226
1227 double px, py, pz, p, theta, phi;
1228 px = ( aaTrack->getMucMomentum() ).x();
1229 py = ( aaTrack->getMucMomentum() ).y();
1230 pz = ( aaTrack->getMucMomentum() ).z();
1231
1232 if ( py < 0 ) continue;
1233
1234 if ( m_NtOutput >= 1 )
1235 {
1236
1237 m_angle_updown = -999;
1238 m_angle_cosmic = cosmicMom.angle( aaTrack->getMucMomentum() );
1239 if ( m_angle_cosmic > 1.57 ) m_angle_cosmic = 3.14159265 - m_angle_cosmic;
1240 m_run = eventHeader->runNumber();
1241 m_event = eventHeader->eventNumber();
1242
1243 Hep3Vector rotate( -px, pz, py );
1244 theta = rotate.theta();
1245 phi = rotate.phi();
1246
1247 m_px = px;
1248 m_py = py;
1249 m_pz = pz;
1250 m_theta = theta;
1251 m_phi = phi;
1252 m_theta_pipe = ( aaTrack->getMucMomentum() ).theta();
1253 m_phi_pipe = ( aaTrack->getMucMomentum() ).phi();
1254
1255 // if(fabs(m_phi_pipe*57.2958-90)>3)cout<<"px,y,z = "<<m_px<<" "<<m_py<<" "<<m_pz<<endl;
1256
1257 // calc proj point in y=0 plane
1258 Hep3Vector mucPos = aaTrack->getMucPos();
1259 double posx, posy, posz;
1260 posx = mucPos.x();
1261 posy = mucPos.y();
1262 posz = mucPos.z();
1263 // double projx, projz;
1264 m_projx = -999;
1265 m_projz = -999;
1266 if ( py != 0 )
1267 {
1268 m_projx = posx - px / py * posy;
1269 m_projz = posz - pz / py * posy;
1270 }
1271 // cout<<"projection: "<<projx<<" "<<projz<<endl;
1272 }
1273 }
1274 if ( m_NtOutput >= 1 )
1275 {
1276 m_mucUp = hasMucUp;
1277 m_mucDown = hasMucDown;
1278 m_tuple->write();
1279 }
1280
1281 int forCosmic = 0;
1282 if ( aMucTrackCol->size() >= 2 && forCosmic == 1 )
1283 {
1284 for ( int iTrack = 0; iTrack < (int)aMucTrackCol->size(); iTrack++ )
1285 {
1286 log << MSG::DEBUG << "iTrack " << iTrack << " / " << (int)aMucTrackCol->size() << endmsg;
1287 aaTrack = ( *aMucTrackCol )[iTrack];
1288 if ( aaTrack->trackId() >= 0 ) continue; // this track has been used
1289 aaTrack->setTrackId( iTrack );
1290 // cout<<"atrack set index "<<iTrack<<endl;
1291 for ( int jTrack = iTrack + 1; jTrack < (int)aMucTrackCol->size(); jTrack++ )
1292 {
1293 bbTrack = ( *aMucTrackCol )[jTrack];
1294
1295 Hep3Vector mom_a = aaTrack->getMucMomentum();
1296 Hep3Vector mom_b = bbTrack->getMucMomentum();
1297
1298 // cout<<"angle is : "<<mom_a.angle(mom_b)<<endl;
1299 if ( fabs( mom_a.angle( mom_b ) - 3.1415926 ) < 0.2 )
1300 {
1301 bbTrack->setTrackId( iTrack );
1302 // cout<<"btrack set index "<<iTrack<<endl;
1303 // cout<<"find one cosmic ray"<<endl;
1304
1305 // cout<<"angle = "<<cosmicMom.angle(mom_a)<<" "<<cosmicMom.angle(mom_b)<<endl;
1306 }
1307
1308 if ( m_NtOutput >= 1 )
1309 {
1310 m_angle_cosmic = cosmicMom.angle( mom_a );
1311 if ( cosmicMom.angle( mom_a ) > 1.57 )
1312 m_angle_cosmic = 3.14159265 - cosmicMom.angle( mom_a );
1313
1314 m_angle_updown = fabs( mom_a.angle( mom_b ) - 3.1415926 );
1315 m_px = -999;
1316 m_py = -999;
1317 m_pz = -999;
1318 m_theta = -999;
1319 m_phi = -999;
1320 m_theta_pipe = -999;
1321 m_phi_pipe = -999;
1322 m_px_mc = -999;
1323 m_py_mc = -999;
1324 m_pz_mc = -999;
1325 m_theta_mc = -999;
1326 m_phi_mc = -999;
1327 m_theta_mc_pipe = -999;
1328 m_phi_mc_pipe = -999;
1329
1330 // m_tuple->write();
1331 }
1332 }
1333 }
1334 }
1335
1336 if ( p3DRoadC->size() != 0 )
1337 {
1338 log << MSG::INFO << "In 3DRoad container : "
1339 << " Num of 3DRoad = " << p3DRoadC->size() << endmsg;
1340
1341 int print2DRoadInfo = 0;
1342 if ( print2DRoadInfo == 1 )
1343 {
1344 for ( int iRoad = 0; iRoad < (int)p3DRoadC->size(); iRoad++ )
1345 {
1346 MucRec3DRoad* road = ( *p3DRoadC )[iRoad];
1347 cout << endl
1348 << " " << iRoad << "th 3DRoad :" << endl
1349 << " Part = " << road->GetPart() << endl
1350 << " Seg = " << road->GetSeg() << endl
1351 << " NumGapsWithHits = " << road->GetNGapsWithHits() << endl
1352 << " TotalHits = " << road->GetTotalHits() << endl
1353 << " MaxHitsPerGap = " << road->GetMaxHitsPerGap() << endl
1354 << " LastGapDelta = " << road->GetLastGapDelta() << endl
1355 << " TotalHitsDelta = " << road->GetTotalHitsDelta() << endl
1356 << " DegreesOfFreedom = " << road->GetDegreesOfFreedom() << endl
1357 << " ReducedChiSquare = " << road->GetReducedChiSquare() << endl
1358 << " SlopeZX = " << road->GetSlopeZX() << endl
1359 << " InterceptZX = " << road->GetInterceptZX() << endl
1360 << " SlopeZY = " << road->GetSlopeZY() << endl
1361 << " InterceptZY = " << road->GetInterceptZY() << endl
1362 << " Hits Info : " << endl;
1363 // road->PrintHitsInfo();
1364 }
1365 }
1366
1367 m_NEventReco++;
1368 }
1369
1370 // delete p3DRoadC
1371 for ( int i = 0; i < p3DRoadC->size(); i++ ) delete ( *p3DRoadC )[i];
1372 for ( int i = 0; i < p2DRoad0C->size(); i++ ) delete ( *p2DRoad0C )[i];
1373 for ( int i = 0; i < p2DRoad1C->size(); i++ ) delete ( *p2DRoad1C )[i];
1374
1375 p3DRoadC->clear();
1376 p2DRoad0C->clear();
1377 p2DRoad1C->clear();
1378 delete p3DRoadC;
1379 delete p2DRoad0C;
1380 delete p2DRoad1C;
1381
1382 return StatusCode::SUCCESS;
1383}
1384
1385// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1387 MsgStream log( msgSvc(), name() );
1388 log << MSG::INFO << "in finalize()" << endmsg;
1389
1390 // cout << m_NHitsLostTotal << " of " << m_NHitsTotal << " total hits" << endl;
1391 // for(int i = 0; i < 20; i++) cout << "lost " << i << " hits event " << m_NHitsLost[i] <<
1392 // endl; for(int i = 0; i < 9; i++) cout << "lost on gap " << i << " is " <<
1393 // m_NHitsLostInGap[i] << endl;
1394
1395 return StatusCode::SUCCESS;
1396}
1397
1399 MsgStream log( msgSvc(), name() );
1400
1401 Hep3Vector currentPos = aTrack->GetCurrentPos();
1402 Hep3Vector currentDir = aTrack->GetCurrentDir();
1403 // if(currentPos.mag() < kMinor) {
1404 // log << MSG::WARNING << "No MUC intersection in track " << endmsg;
1405 // continue;
1406 // }
1407
1408 int firstHitFound[2] = { 0, 0 }; // Has the fist position in this orient determined? if so,
1409 // could CorrectDirection()
1410 int firstHitGap[2] = { -1, -1 }; // When the fist position in this orient determined, the gap
1411 // it is on
1412 for ( int partSeq = 0; partSeq < (int)MucID::getPartNum(); partSeq++ )
1413 {
1414 int iPart = kPartSeq[partSeq];
1415 for ( int iGap = 0; iGap < (int)MucID::getGapNum( iPart ); iGap++ )
1416 {
1417 int seg = -1;
1418 int orient = MucGeoGeneral::Instance()->GetGap( iPart, 0, iGap )->Orient();
1419 ;
1420
1421 float xInsct, yInsct, zInsct;
1422 aTrack->Project( iPart, iGap, xInsct, yInsct, zInsct, seg );
1423 if ( m_MsOutput )
1424 cout << "part " << iPart << " gap " << iGap << " x " << xInsct << " y " << yInsct
1425 << " z " << zInsct << " seg " << seg << endl;
1426
1427 if ( seg == -1 )
1428 {
1429 // log << MSG::DEBUG << "no intersection with part " << iPart
1430 // << " gap " << iGap << " in this track !" << endl;
1431 continue;
1432 }
1433
1434 aTrack->SetCurrentInsct( xInsct, yInsct, zInsct );
1435
1436 for ( int iDeltaSeg = 0; iDeltaSeg < kNSegSearch; iDeltaSeg++ )
1437 {
1438 int iSeg = seg + kDeltaSeg[iDeltaSeg]; // also find on neighbor seg;
1439 if ( iSeg < 0 ) iSeg += MucID::getSegNum( iPart );
1440 if ( iSeg > (int)MucID::getSegNum( iPart ) - 1 ) iSeg -= MucID::getSegNum( iPart );
1441
1442 float window = kWindowSize[iPart][iGap];
1443
1444 for ( int iHit = 0; iHit < aMucRecHitContainer->GetGapHitCount( iPart, iSeg, iGap );
1445 iHit++ )
1446 {
1447 log << MSG::DEBUG << "iSeg " << iSeg << " iHit " << iHit << endmsg;
1448 MucRecHit* pHit = aMucRecHitContainer->GetHit( iPart, iSeg, iGap, iHit );
1449 // cout<< "strip " << pHit->Strip() << " center " << pHit->GetCenterPos() << endl;
1450
1451 if ( !pHit )
1452 {
1453 log << MSG::WARNING << "MucRecTrkExt: null pointer to pHit" << endmsg;
1454 continue;
1455 }
1456 else
1457 {
1458
1459 // this algo use with ext and this hit has been used before;
1460 if ( pHit->GetHitMode() != -1 && pHit->GetHitMode() != 3 ) continue;
1461
1462 // Get the displacement of hit pHit to intersection
1463 float dX = aTrack->GetHitDistance( pHit );
1464 log << MSG::DEBUG << "distance = " << setw( 8 ) << dX << " size " << setw( 4 )
1465 << window << endmsg;
1466
1467 // cout<<"dX= "<<dX<<" window="<<window<<endl;
1468
1469 if ( dX < window )
1470 {
1471 // Attach the hit if it exists
1472 // cout << "meet window " << pHit->GetSoftID() << endl;
1473 //****************if this if emc track, we abondon used hit in
1474 // mdc*******************
1475 // if(m_emcrec == 1 )
1476 if ( aTrack->GetRecMode() == 0 )
1477 {
1478 pHit->SetHitMode( 1 ); // mdc ext
1479 aTrack->AttachHit( pHit );
1480 // cout<<"in MucRecTrkExt: trackmode==0 so mdc ext "<<iPart<<" "<<iSeg<<"
1481 // "<<iGap<<" "<<iHit<<endl;
1482 }
1483 if ( aTrack->GetRecMode() == 1 )
1484 {
1485 // cout<<"in MucRecTrkExt: HitMode = "<<pHit->GetHitMode()<<" part: "<<iPart<<"
1486 // "<<iSeg<<" "<<iGap<<"
1487 // "<<iHit<<endl;
1488 if ( pHit->GetHitMode() != 1 )
1489 {
1490 aTrack->AttachHit( pHit ); // this hit has not been used by mdc ext
1491 pHit->SetHitMode( 2 ); // emc ext
1492 }
1493 }
1494 if ( aTrack->GetRecMode() == 2 )
1495 {
1496 aTrack->AttachHit( pHit ); // this hit has not been used by mdc ext
1497 // pHit->SetHitMode(2); //emc ext
1498 }
1499 if ( aTrack->GetRecMode() == 3 )
1500 {
1501 if ( pHit->GetHitMode() != 1 )
1502 {
1503 aTrack->AttachHit( pHit ); // this hit has not been used by mdc ext
1504 pHit->SetHitMode( 3 ); // emc ext
1505 }
1506 }
1507
1508 if ( firstHitGap[orient] == -1 ) firstHitGap[orient] = iGap;
1509 firstHitFound[orient] = 1;
1510 // cout << "You could correct directon in orient " << orient << endl;
1511
1512 // cout<< " part " << iPart << " seg " << iSeg << " gap " << iGap
1513 // << " strip " << setw(2) << pHit->Strip() << " attatched" << endl;
1514
1515 log << MSG::DEBUG << " part " << iPart << " seg " << iSeg << " gap " << iGap
1516 << " strip " << setw( 2 ) << pHit->Strip() << " attatched" << endmsg;
1517 log << MSG::DEBUG << "current total hits " << aTrack->GetTotalHits() << endmsg;
1518 }
1519 else
1520 {
1521 m_NHitsLostInGap[iGap]++;
1522 // log << MSG::DEBUG cout << " part " << iPart << " seg " << iSeg << " gap " <<
1523 // iGap
1524 // << " strip " << setw(2) << pHit->GetSoftID().GetStrip()
1525 // << " not attached !" << endmsg;
1526 }
1527 }
1528 }
1529 aTrack->CalculateInsct( iPart, iSeg, iGap );
1530 }
1531
1532 if ( m_onlyseedfit == 0 )
1533 { //
1534 // When correct dir in the orient is permitted and this gap is not the gap first hit
1535 // locates.
1536 if ( firstHitFound[orient] && firstHitGap[orient] != iGap ) aTrack->CorrectDir();
1537 aTrack->CorrectPos();
1538 // cout << "Current Intersection " << aTrack->GetCurrentInsct() << endl;
1539 // cout << "Current Direction " << aTrack->GetCurrentDir() << endl;
1540 aTrack->AttachInsct( aTrack->GetCurrentInsct() );
1541 } // else; not correct pos & dir.
1542 }
1543 }
1544 aTrack->LineFit( 1 );
1545 aTrack->ComputeTrackInfo( 1 );
1546 log << MSG::INFO << "Fit track done! trackIndex: " << aTrack->trackId()
1547 << ", mucId: " << aTrack->id() << ", RecMode: " << aTrack->GetRecMode() << endmsg;
1548 // cout<<" in TrackFinding: depth= "<<aTrack->GetDepth()<<endl;
1549}
1550
1551// END
DECLARE_COMPONENT(BesBdkRc)
struct sembuf release
DOUBLE_PRECISION count[3]
const int kMaxDeltaLastGap
const int kMinLastGap3D
const int kMinLastGap2D
const int kNSegSearch
const int kMinSharedHits2D
const int kPartSeq[3]
const int kDeltaSeg[kNSegSearch]
const int kMaxDeltaTotalHits
const int kNSeedLoops
const float kMaxYChisq
const float kWindowSize[3][9]
const int kSearchOrder[kNSeedLoops][3][2][5]
const float kMaxXChisq
const int kMaxSkippedGaps
const int kSearchLength[kNSeedLoops][3][2]
const int kMinFiredGaps
INTupleSvc * ntupleSvc()
IMessageSvc * msgSvc()
virtual void Dump()=0
MucGeoGap * GetGap(const int part, const int seg, const int gap) const
Get a pointer to the gap identified by (part,seg,gap).
static MucGeoGeneral * Instance()
Get a pointer to the single instance of MucGeoGeneral.
static int barrel_ec(const Identifier &id)
Values of different levels.
Definition MucID.cxx:38
static int layer(const Identifier &id)
Definition MucID.cxx:58
static int channel(const Identifier &id)
Definition MucID.cxx:68
static int segment(const Identifier &id)
Definition MucID.cxx:48
static value_type getPartNum()
Definition MucID.cxx:131
static value_type getSegNum(int part)
Definition MucID.cxx:134
static value_type getGapNum(int part)
Definition MucID.cxx:141
int GetNGapsWithHits() const
How many gaps provide hits attached to this road?
int GetTotalHits() const
How many hits in all does this road contain?
float GetReducedChiSquare() const
Chi-square parameter (per degree of freedom) of the trajectory fit.
float GetIntercept() const
Intercept of trajectory.
void AttachHit(MucRecHit *hit)
Attach the given hit to this road.
int GetLastGap() const
Which gap is the last one with hits attached to this road?
void AttachHitNoFit(MucRecHit *hit)
Attach the given hit to this road, but not fit this road.
float GetSlope() const
Slope of trajectory.
void SetMaxNSkippedGaps(const int &nGaps)
int GetPart() const
In which part was this road found?
float GetHitDistance(const MucRecHit *hit)
Distance to a hit.
int GetDegreesOfFreedom() const
How many degrees of freedom in the trajectory fit?
vector< MucRecHit * > GetHits() const
int GetSeg() const
In which segment was this road found?
int GetOrient() const
In which orientation was this road found?
float GetSlopeZX() const
Get Z-X dimension slope.
float GetSlopeZY() const
Get Z-Y dimension slope.
void TransformPhiRToXY(const float &vk, const float &vr, const float &k0, const float &r0, float &vx, float &vy, float &x0, float &y0) const
Where does the trajectory of this road intersect the reference plane?
int GetLastGapDelta() const
Difference between the last gap in the two 1-D roads.
int GetPart() const
In which part was this road found?
int GetLastGap() const
Which gap is the last one with hits attached to this road?
int GetTotalHitsDelta() const
Difference between the number of hits in the two 1-D roads.
int GetTotalHits() const
How many hits in all does this road contain?
float GetInterceptZY() const
Get Z-Y dimension intercept.
void SetSimpleFitParams(const float &m_SlopeZX, const float &m_InterceptZX, const float &m_SlopeZY, const float &m_InterceptZY)
set the fit parameters : slope and intercept for XZ and YZ.
int GetSeg() const
In which segment was this road found?
int GetDegreesOfFreedom() const
How many degrees of freedom in the trajectory fit?
void ProjectWithSigma(const int &gap, float &x, float &y, float &z, float &sigmaX, float &sigmaY, float &sigmaZ)
Where does the trajectory of this road intersect a specific gap?
float GetInterceptZX() const
Get Z-X dimension intercept.
int GetNGapsWithHits() const
How many gaps provide hits attached to this road?
float GetReducedChiSquare() const
Chi-square parameter (per degree of freedom) of the trajectory fit.
int GetMaxHitsPerGap() const
How many hits were attached in the gap with the most attached hits?
MucGeoGap * GetGap() const
Get geometry data for the gap containing this hit.
MucRecRoadFinder(const std::string &name, ISvcLocator *pSvcLocator)
StatusCode initialize()
void TrackFinding(RecMucTrack *aTrack)
int GetTotalHits() const
How many hits in all does this track contain?
void LineFit(int fittingMethod)
Line fit with hits on a seg with max hits.
void CorrectPos()
Correct current position of this trajectory.
void CorrectDir()
Correct direction of this trajectory.
void ComputeTrackInfo(int fittingmethod)
Get corresponding monte carlo track pointer.
Hep3Vector getMucPos() const
start position of this track in Muc.
void AttachInsct(Hep3Vector insct)
Attach the intersection to this trajectory.
void SetExtMucPos(const float x, const float y, const float z)
void SetCurrentDir(const float x, const float y, const float z)
set current direction of the trajectory.
float GetHitDistance(const MucRecHit *hit)
Calculate the distance of the hit to the intersection in read direction.
void setTrackId(const int trackId)
set the index for this track.
Hep3Vector CalculateInsct(const int part, const int seg, const int gap)
Calculate intersection from all hits attached on this gap.
void Project(const int &part, const int &gap, float &x, float &y, float &z, int &seg)
Where does the trajectory of this track intersect a specific gap?
void SetMucMomentum(const float px, const float py, const float pz)
set start moment of the track in Muc.
Hep3Vector GetCurrentInsct() const
Current intersection.
void SetExtMucMomentum(const float px, const float py, const float pz)
set start moment of ext track in Muc.
vector< MucRecHit * > GetHits() const
Get all hits on this track.
void AttachHit(MucRecHit *hit)
set corresponding monte carlo track pointer.
void SetCurrentInsct(const float x, const float y, const float z)
set current intersection of the trajectory with strip plane.
Hep3Vector getMucMomentum() const
Start momentum of this track in Muc.
void SetCurrentPos(const float x, const float y, const float z)
set current position of the trajectory.
vector< MucRecHit * > GetExpectedHits() const
void SetMucPos(const float x, const float y, const float z)
set start position of the track in Muc. (after line fit and correction)