9 #include "FairRootManager.h" 
   10 #include "FairRunAna.h" 
   11 #include "FairRuntimeDb.h" 
   12 #include "FairBaseParSet.h" 
   13 #include "FairTrackParam.h" 
   14 #include "FairTrackParP.h" 
   18 #include "FairRootManager.h" 
   24 #include "TClonesArray.h" 
   25 #include "TGeoManager.h" 
   26 #include "TMatrixFSym.h" 
   83   FairRootManager* ioman = FairRootManager::Instance();
 
   85     cout << 
"-E- "<< GetName() <<
"::Init: " 
   86          << 
"RootManager not instantised!" << endl;
 
   91   FairRunAna* ana = FairRunAna::Instance();
 
   93     cout << 
"-E- "<< GetName() <<
"::Init :" 
   94          <<
" no FairRunAna object!" << endl;
 
   98   FairRuntimeDb* 
rtdb = ana->GetRuntimeDb();
 
  100     cout << 
"-E- "<< GetName() <<
"::Init :" 
  101          <<
" no runtime database!" << endl;
 
  108     cout << 
"-I- "<< GetName() <<
"::Init: No MCTrack array!" << endl;
 
  113     cout << 
"-I- "<< GetName() <<
"::Init: No MCGemPoint array!" << endl;
 
  118     cout << 
"-I- "<< GetName() <<
"::Init: No MCMvdPoint array!" << endl;
 
  123     cout << 
"-W- "<< GetName() <<
"::Init: No PndMvdPixelHit array!" << endl;
 
  129     cout << 
"-W- "<< GetName() <<
"::Init: No PndMvdStripHit array!" << endl;
 
  133   fGemHitArray  = (TClonesArray*) ioman->GetObject(
"GEMHit");
 
  135     cout << 
"-W- "<< GetName() <<
"::Init: No PndGemHit array!" << endl;
 
  149   cout << 
"-I- " << 
"PndMvdGemTrackFinderOnHits" << 
"::Init(). There are " << 
fDigiPar->
GetNStations() << 
" GEM stations." << endl;
 
  150   cout << 
"-I- " << 
"PndMvdGemTrackFinderOnHits" << 
"::Init(). Initialization succesfull." << endl;
 
  161   for ( Int_t in = 0 ; in < 3 ; in++ ) {
 
  166   std::cout << 
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" << std::endl;
 
  167   std::cout << 
"-I- "<< GetName() <<
": Intialization successfull" << std::endl;
 
  168   std::cout << 
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" << std::endl;
 
  177   FairRunAna* 
run = FairRunAna::Instance();
 
  178   if ( ! run ) Fatal(
"SetParContainers", 
"No analysis run");
 
  180   FairRuntimeDb* db = run->GetRuntimeDb();
 
  181   if ( ! db ) Fatal(
"SetParContainers", 
"No runtime database");
 
  199     cout << 
"===========================================" << endl;
 
  200     cout << 
"=============== EVENT " << 
fNofEvents << 
" =================" << endl;
 
  214   for ( Int_t itr = 0 ; itr < 
fMCTrackArray->GetEntriesFast() ; itr++ ) { 
 
  265     cout << 
"************************************************" << endl;
 
  270     cout << 
"************************************************" << endl;
 
  271     cout << 
"finished printing tracks" << endl;
 
  277     cout << 
"------------------------------------------------" << endl;
 
  278     cout << 
"!!!!!!!!!!!!!!!!!! " << nr << 
" tracks have been found" << endl;
 
  279     cout << 
"------------------------------------------------" << endl;
 
  286   Bool_t printInfo = kFALSE;
 
  288   Int_t nofCreatedTracks = 0;
 
  290   const Int_t kNofRecoTracks = nofRecoTracks;
 
  292   const Int_t maxNofHits = 100;
 
  293   Int_t hitIndices[kNofRecoTracks][maxNofHits][2]; 
 
  294   Int_t nofHits   [kNofRecoTracks];
 
  298   Int_t    nofTS  [kNofRecoTracks];
 
  306   for ( itr = 0 ; itr < nofRecoTracks ; itr++ ) {
 
  319     Bool_t hitInTrack[2] = {kFALSE,kFALSE};
 
  320     for ( Int_t ih1 = 0 ; ih1 < 2 ; ih1++ ) {
 
  321       for ( Int_t ihit = 0 ; ihit < nofHits[itr] ; ihit++ ) 
 
  322         if ( hitIndices[itr][ihit][0] == iterTS.
detId   [ih1] &&
 
  323              hitIndices[itr][ihit][1] == iterTS.
hitIndex[ih1] ) { 
 
  324           hitInTrack[ih1] = kTRUE; 
 
  327       if ( hitInTrack[ih1] == kFALSE ) {
 
  328         hitIndices[itr][nofHits[itr]][0] = iterTS.
detId   [ih1];
 
  329         hitIndices[itr][nofHits[itr]][1] = iterTS.
hitIndex[ih1];
 
  334     if ( nofTS[itr] > 0 ) {
 
  335       if ( meanPhi[itr]/nofTS[itr] <   5. && iterTS.
trackPhi > 355. ) { iterTS.
trackPhi -= 360.; }
 
  336       if ( meanPhi[itr]/nofTS[itr] > 355. && iterTS.
trackPhi <   5. ) { iterTS.
trackPhi += 360.; }
 
  343   for ( itr = 0 ; itr < nofRecoTracks ; itr++ ) {
 
  344     if ( nofTS[itr] == 0 ) 
continue;
 
  346     meanMom[itr] = meanMom[itr]/nofTS[itr];
 
  347     meanPhi[itr] = meanPhi[itr]/nofTS[itr];
 
  348     meanThe[itr] = meanThe[itr]/nofTS[itr];
 
  350     trackCand = 
new((*fTrackCandArray)[nofCreatedTracks]) 
PndTrackCand();
 
  353       cout << 
"---------------------------------------------------------" << endl;
 
  354       cout << 
"  Track " << itr << 
" segments:" << endl;
 
  362       cout << 
" track has " << nofHits[itr] << 
" hits:" << endl;
 
  367     for ( Int_t ihit = 0 ; ihit < nofHits[itr] ; ihit++ ) {
 
  369       if ( hitIndices[itr][ihit][0] < 0 ) 
 
  370         detId = (-hitIndices[itr][ihit][0])>>27;
 
  373         cout << 
"    #" << ihit << 
". "  
  374              << hitIndices[itr][ihit][0] << 
"."  
  375              << hitIndices[itr][ihit][1] << 
" -> " 
  381         trackCand->
AddHit(FairRootManager::Instance()->GetBranchId(
"GEMHit"),
 
  382                           hitIndices[itr][ihit][1],gemHit->
GetPosition().Mag());
 
  385           cout << 
"  ( " << gemHit->GetX()
 
  386                << 
"    " << gemHit->GetY()
 
  387                << 
"    " << gemHit->GetZ()
 
  393         trackCand->
AddHit(FairRootManager::Instance()->GetBranchId(
"MVDHitsStrip"),hitIndices[itr][ihit][1],mvdHit->
GetPosition().Mag());
 
  396           cout << 
"  ( " << mvdHit->GetX()
 
  397                << 
"    " << mvdHit->GetY()
 
  398                << 
"    " << mvdHit->GetZ()
 
  404         trackCand->
AddHit(FairRootManager::Instance()->GetBranchId(
"MVDHitsPixel"),hitIndices[itr][ihit][1],mvdHit->
GetPosition().Mag());
 
  407           cout << 
"  ( " << mvdHit->GetX()
 
  408                << 
"    " << mvdHit->GetY()
 
  409                << 
"    " << mvdHit->GetZ()
 
  420     TVector3 
pos(0.,0.,0.);
 
  422     mom.SetMagThetaPhi(
TMath::Abs(meanMom[itr]),meanThe[itr]*TMath::DegToRad(),meanPhi[itr]*TMath::DegToRad());
 
  425     if ( mom.Mag() < 0. ) charge = 1;
 
  427     FairTrackParP*          firstPar = 
new FairTrackParP(pos,mom,
 
  428                                                          TVector3(0.5, 0.5, 0.5),
 
  434     FairTrackParP*          lastPar = 
new FairTrackParP(TVector3(nGemHits,nMvdStrH,nMvdPixH), 
 
  436                                                         TVector3(0.5, 0.5, 0.5),
 
  443     new((*fTrackArray)[nofCreatedTracks]) 
PndTrack(*firstPar, *lastPar, *trackCand);
 
  446       cout << 
"TRACK " << nofCreatedTracks << 
" HAS momentum: (" << meanMom[itr] << 
" GeV/c, " << meanThe[itr] << 
" deg theta, " << meanPhi[itr] << 
" deg phi)" << endl; 
 
  449       mom.SetMagThetaPhi(
TMath::Abs(meanMom[itr]),meanThe[itr]*TMath::DegToRad(),meanPhi[itr]*TMath::DegToRad());
 
  452       cout << 
" momentum: (" << meanMom[itr] << 
" GeV/c, " << meanThe[itr] << 
" deg theta, " << meanPhi[itr] << 
" deg phi)" << endl; 
 
  453       cout << 
"---------------------------------------------------------" << endl;
 
  458   return nofCreatedTracks;
 
  464   Bool_t printInfo = kFALSE;
 
  467     cout << 
"Trying to remove clone tracks" << endl;
 
  469   const Int_t kNofRecoTracks = nofRecoTracks;
 
  471   const Int_t maxNofHits = 100;
 
  475   Int_t    hitIndices[kNofRecoTracks][maxNofHits][2]; 
 
  476   Int_t    nofHits   [kNofRecoTracks]; 
 
  477   Int_t    nofTS     [kNofRecoTracks]; 
 
  478   Double_t trackCons [kNofRecoTracks]; 
 
  479   Int_t    whatToDo  [kNofRecoTracks]; 
 
  481   for ( Int_t itr = 0 ; itr < kNofRecoTracks ; itr++ ) {
 
  496     if ( nofTS[itr] != 0 ) {
 
  497       if ( meanPhi[itr]/nofTS[itr] <   5. && iterTS.
trackPhi > 355. ) { iterTS.
trackPhi -= 360.; }
 
  498       if ( meanPhi[itr]/nofTS[itr] > 355. && iterTS.
trackPhi <   5. ) { iterTS.
trackPhi += 360.; }
 
  506   for ( itr = 0 ; itr < kNofRecoTracks ; itr++ ) {
 
  507     meanMom[itr] = meanMom[itr]/nofTS[itr];
 
  508     meanPhi[itr] = meanPhi[itr]/nofTS[itr];
 
  509     meanThe[itr] = meanThe[itr]/nofTS[itr];
 
  522   for ( itr = 0 ; itr < kNofRecoTracks ; itr++ ) {
 
  523     trackCons[itr] = trackCons[itr]/(3.*nofTS[itr]);
 
  525     if ( trackCons[itr] > 1. && nofTS[itr] < 6 ) {
 
  528         cout << 
"TRACK " << itr << 
" with " << nofTS[itr] << 
" segments will be deleted" << endl;
 
  533     for ( Int_t itr2 = 0 ; itr2 < itr ; itr2++ ) {
 
  544       if ( similarity < 2.35 ) 
 
  546           if ( whatToDo[itr2] == -1   ) whatToDo[itr2] = itr2;
 
  547           whatToDo[itr] = whatToDo[itr2];
 
  553       cout << 
" TRACK " << itr << 
" with " << nofTS[itr] << 
" segments:" << endl;
 
  554       cout << 
" MEAN = " << meanMom[itr] << 
" " << meanPhi[itr] << 
" " << meanThe[itr] << endl;
 
  555       cout << 
" CONS = " << trackCons[itr] << 
" ========> " << whatToDo[itr] << endl;
 
  567     Bool_t hitInTrack[2] = {kFALSE,kFALSE};
 
  569     for ( Int_t ih1 = 0 ; ih1 < 2 ; ih1++ ) {
 
  570       for ( Int_t ihit = 0 ; ihit < nofHits[itr] ; ihit++ ) 
 
  571         if ( hitIndices[itr][ihit][0] == iterTS.
detId   [ih1] )
 
  572           if ( hitIndices[itr][ihit][1] == iterTS.
hitIndex[ih1] ) {
 
  573             hitInTrack[ih1] = kTRUE; 
 
  575       if ( hitInTrack[ih1] == kFALSE ) {
 
  576         hitIndices[itr][nofHits[itr]][0] = iterTS.
detId   [ih1];
 
  577         hitIndices[itr][nofHits[itr]][1] = iterTS.
hitIndex[ih1];
 
  582   for ( itr = 0 ; itr < kNofRecoTracks ; itr++ ) {
 
  585         cout << 
"---Track " << itr << 
" has " << nofTS[itr] << 
" segments and " << nofHits[itr] << 
" hits:" << endl;
 
  586         for ( Int_t ihit = 0 ; ihit < nofHits[itr] ; ihit++ ) 
 
  587           cout << 
"    #" << ihit << 
". "  
  588                << hitIndices[itr][ihit][0] << 
"."  
  589                << hitIndices[itr][ihit][1] << 
" " 
  601   Bool_t printInfo = kFALSE;
 
  603   Int_t nofRecoTracks = 0;
 
  609       cout << 
"MATCH TRACK SEGMENTS TO SEGM " << itrc << 
" with params: " << origTS.
trackMom << 
" " << origTS.
trackPhi << 
" " << origTS.
trackTheta << endl;
 
  612     vector<Int_t> trackSegs;
 
  613     trackSegs.push_back(itrc);
 
  615     for ( 
size_t itrc2 = 0 ; itrc2 < 
fTrackSegments.size() ; itrc2++ ) {
 
  616       if ( itrc2 == itrc ) 
continue; 
 
  627       for ( 
size_t its = 0 ; its < trackSegs.size() ; its++ ) {
 
  641       if ( !matching ) 
continue; 
 
  645       Bool_t sameStationSegment = kFALSE;
 
  646       for ( 
size_t its = 0 ; its < trackSegs.size() ; its++ ) {
 
  651         sameStationSegment = kTRUE;
 
  655           cout << 
"there are already " << trackSegs.size() << 
" segments in this track: " << endl;
 
  659         for ( 
size_t its2 = 0 ; its2 < trackSegs.size() ; its2++ ) {    
 
  660           if ( its == its2 ) 
continue; 
 
  663             cout << its2 << 
" (" << trackSegs[its2] << 
") > "  
  665                  << 
" ---- size = " << trackSegs.size()-1 << endl;      
 
  666           meanMom += aveTS.
trackMom/(trackSegs.size()-1);
 
  667           meanPhi += aveTS.
trackPhi/(trackSegs.size()-1);
 
  668           meanThe += aveTS.
trackTheta/(trackSegs.size()-1);
 
  671           cout << its << 
" (" << trackSegs[its] << 
") > " << iterTS.
trackMom << 
" " << iterTS.
trackPhi << 
" " << iterTS.
trackTheta << endl;     
 
  672           cout << 
" this track conflicts with track " << its << 
" and is: " << endl;
 
  674           cout << 
" should decide on mean of other track segments, which is: " << endl;
 
  675           cout << 
"MEAN   > " << meanMom << 
" " << meanPhi << 
" " << meanThe << endl;
 
  677         if ( meanPhi < 5. ) { 
 
  681         if ( meanPhi > 355 ) {
 
  689           trackSegs[its] = itrc2;
 
  694       if ( sameStationSegment ) 
continue;
 
  697       trackSegs.push_back(itrc2);
 
  699     if ( trackSegs.size() < 5 ) 
continue;
 
  702       cout << 
"track " << nofRecoTracks << 
" segments: " << endl;
 
  703     for ( 
size_t its = 0 ; its < trackSegs.size() ; its++ ) {
 
  707           cout << iterTS.
detId[0] << 
" " << iterTS.
detId[1] << 
" > " << flush;
 
  708           for ( Int_t ihit = 0 ; ihit < 2 ; ihit++ ) 
 
  709             cout << setw(4) << iterTS.
hitIndex[ihit] << 
" " << flush;
 
  716       cout << 
" seems to belong to one track" << endl;
 
  721     cout << 
"********* " << nofRecoTracks << 
" track candidates have been found" << endl;
 
  723   return nofRecoTracks;
 
  730   Bool_t printInfo = kFALSE;
 
  737   Double_t zDistRatio = zStation2/zStation1;
 
  738   Double_t zDiffRatio = zStation1/(zStation2-zStation1);
 
  739   Double_t zCuDiff = zStation2*zStation2*zStation2-zStation1*zStation1*zStation1;
 
  740   Double_t zSqDiff = zStation2*zStation2-zStation1*zStation1;
 
  741   Double_t zDiff   = zStation2-zStation1;
 
  751   for(Int_t iHit = 0; iHit < nGemHits; iHit++){
 
  755     zStation1 = gemHit->GetZ();
 
  758       cout << 
"LOOKING FOR TRACK SEGMENTS STARTING AT " << gemHit->GetX() << 
" " << gemHit->GetY() << 
" " << gemHit->GetZ() << 
"( " << zStation1 << 
") ndigihits = " << gemHit->
GetNDigiHits() << endl;
 
  761       cout << 
"possible segment " << 
fTrackSegments.size() << 
" starts here " << gemHit->GetX() << 
" " << gemHit->GetY() << 
" " << gemHit->GetZ() << endl;
 
  762     Double_t radius = 
TMath::Sqrt(gemHit->GetX()*gemHit->GetX()+gemHit->GetY()*gemHit->GetY());
 
  763     Double_t pangle = TMath::ACos(gemHit->GetX()/radius);
 
  764     if ( gemHit->GetY() < 0 )
 
  769       cout << 
"     -> with theta of " << theta << 
" (radius = " << radius << 
" and phi angle = " << pangle*TMath::RadToDeg() << 
")" << endl;
 
  770     for(Int_t iHit2 = 0; iHit2 < nGemHits; iHit2++){
 
  777       zStation2 = gemHit2->GetZ();
 
  779       zDistRatio = zStation2/zStation1;
 
  780       zDiffRatio = zStation1/(zStation2-zStation1);
 
  781       zCuDiff = zStation2*zStation2*zStation2-zStation1*zStation1*zStation1;
 
  782       zSqDiff = zStation2*zStation2-zStation1*zStation1;
 
  783       zDiff   = zStation2-zStation1;
 
  789         cout << 
"trying to match it with " << gemHit2->GetX() << 
" " << gemHit2->GetY() << 
" " << gemHit2->GetZ() << endl;
 
  790       Double_t radius2 = 
TMath::Sqrt(gemHit2->GetX()*gemHit2->GetX()+gemHit2->GetY()*gemHit2->GetY());
 
  791       Double_t pangle2 = TMath::ACos(gemHit2->GetX()/radius2);
 
  792       if ( gemHit2->GetY() < 0 )
 
  798       if ( 
TMath::Abs(pangle-pangle2)*TMath::RadToDeg() > 40 ) 
continue;
 
  801         cout << 
"       (radius = " << radius2 << 
" and phi angle = " << pangle2*TMath::RadToDeg() << 
")" << endl;
 
  804       Double_t expRadUncert = 0.05*radius*zDistRatio;
 
  809              << 
" * " << radius << 
" * " << zDistRatio << endl;
 
  810         cout << 
" -> while expected radius was " << expectedRad2 << endl;
 
  813       if ( radius2>expectedRad2+expRadUncert || radius2<expectedRad2-expRadUncert ) 
continue;
 
  816         cout << 
"STRONG CORRELATION FOR THIS HIT!!!" << endl;
 
  819       if ( (pangle-pangle2) != 0 ) 
 
  820         trackMomentum = (par0_mom+par1_mom*radius)/((pangle-pangle2)*TMath::RadToDeg());;
 
  822         cout << 
"calculated track momentum is " << trackMomentum << endl;
 
  823       Double_t trackPhiAngle = pangle+(pangle-pangle2)*zDiffRatio; 
 
  824       if ( trackPhiAngle < 0. ) trackPhiAngle += 
TMath::Pi()*2.;
 
  827         cout << 
"calculated phi is " << trackPhiAngle*TMath::RadToDeg() << endl;
 
  832       tempTS.
detId[0] = gemHit ->GetDetectorID();
 
  833       tempTS.
detId[1] = gemHit2->GetDetectorID();
 
  837       tempTS.
trackPhi = trackPhiAngle*TMath::RadToDeg();
 
  843         cout << 
" found segment (stat. " << stat1Id << 
" & " << stat2Id << 
"), hits " 
  845              << iHit << 
"(" << tempTS.
detId[0] << 
"), " << iHit2 << 
"(" << tempTS.
detId[1] << 
"), " 
  846              << 
" >>> " << trackMomentum << 
" GeV, " << trackPhiAngle*TMath::RadToDeg() << 
" deg, " << theta << 
" deg." << endl;
 
  855     cout << 
"===>>> " << 
fTrackSegments.size() << 
" track segments" << endl;
 
  862   Bool_t printInfo = kFALSE;
 
  883   for ( Int_t iMvdHit1 = 0 ; iMvdHit1 < nMvdPixelHits+nMvdStripHits ; iMvdHit1++ ) {
 
  884     Int_t mvdHit1Nr = iMvdHit1;
 
  885     if ( iMvdHit1 < nMvdPixelHits )
 
  888       mvdHit1Nr = iMvdHit1-nMvdPixelHits;
 
  891     zStation1 = mvdHit1->GetZ();
 
  892     if ( zStation1 < 4. ) 
continue; 
 
  895       cout << 
"LOOKING FOR TRACK SEGMENTS STARTING AT " << mvdHit1->GetX() << 
" " << mvdHit1->GetY() << 
" " << mvdHit1->GetZ() << 
"( " << zStation1 << 
")" << endl;
 
  896     Double_t radius = 
TMath::Sqrt(mvdHit1->GetX()*mvdHit1->GetX()+mvdHit1->GetY()*mvdHit1->GetY());
 
  897     Double_t pangle = TMath::ACos(mvdHit1->GetX()/radius);
 
  898     if ( mvdHit1->GetY() < 0 )
 
  903       cout << 
"     -> with theta of " << theta << 
" (radius = " << radius << 
" and phi angle = " << pangle*TMath::RadToDeg() << 
")" << endl;
 
  905     for(Int_t iHit2 = 0; iHit2 < nGemHits; iHit2++){
 
  909       zStation2 = gemHit2->GetZ();
 
  911       zDistRatio = zStation2/zStation1;
 
  912       zDiffRatio = zStation1/(zStation2-zStation1);
 
  913       zCuDiff = zStation2*zStation2*zStation2-zStation1*zStation1*zStation1;
 
  914       zSqDiff = zStation2*zStation2-zStation1*zStation1;
 
  915       zDiff   = zStation2-zStation1;
 
  921         cout << 
"trying to match it with " << gemHit2->GetX() << 
" " << gemHit2->GetY() << 
" " << gemHit2->GetZ() << endl;
 
  922       Double_t radius2 = 
TMath::Sqrt(gemHit2->GetX()*gemHit2->GetX()+gemHit2->GetY()*gemHit2->GetY());
 
  923       Double_t pangle2 = TMath::ACos(gemHit2->GetX()/radius2);
 
  924       if ( gemHit2->GetY() < 0 )
 
  930       if ( 
TMath::Abs(pangle-pangle2)*TMath::RadToDeg() > 40 ) 
continue;
 
  933         cout << 
"       (radius = " << radius2 << 
" and phi angle = " << pangle2*TMath::RadToDeg() << 
")" << endl;
 
  936       Double_t expectedRad2  = radius*zDistRatio;
 
  937       Double_t expRadUncert = 0.05*radius*zDistRatio;
 
  942              << 
" * " << radius << 
" * " << zDistRatio << endl;
 
  943         cout << 
" -> while expected radius was " << expectedRad2 << endl;
 
  946       if ( radius2>expectedRad2+expRadUncert || radius2<expectedRad2-expRadUncert ) 
continue;
 
  949         cout << 
"STRONG CORRELATION FOR THIS HIT!!!" << endl;
 
  952       if ( (pangle-pangle2) != 0 ) 
 
  953         trackMomentum = (par0_mom+par1_mom*radius)/((pangle-pangle2)*TMath::RadToDeg());;
 
  955         cout << 
"calculated track momentum is " << trackMomentum << endl;
 
  956       Double_t trackPhiAngle = pangle+(pangle-pangle2)*zDiffRatio; 
 
  957       if ( trackPhiAngle < 0. ) trackPhiAngle += 
TMath::Pi()*2.;
 
  960         cout << 
"calculated phi is " << trackPhiAngle*TMath::RadToDeg() << endl;
 
  966       tempTS.
detId[1] = gemHit2->GetDetectorID();
 
  970       tempTS.
trackPhi = trackPhiAngle*TMath::RadToDeg();
 
  976         cout << 
" found segment " 
  978              << mvdHit1Nr << 
"(" << tempTS.
detId[0] 
 
  980              << 
"), " << iHit2 << 
"(" << tempTS.
detId[1] << 
"), " 
  981              << 
" >>> " << trackMomentum << 
" GeV, " << trackPhiAngle*TMath::RadToDeg() << 
" deg, " << theta << 
" deg." << endl;
 
  990     cout << 
"===>>> " << 
fTrackSegments.size() << 
" track segments" << endl;
 
  997   Bool_t printInfo = kFALSE;
 
 1018   for ( Int_t iMvdHit1 = 0 ; iMvdHit1 < nMvdPixelHits+nMvdStripHits ; iMvdHit1++ ) {
 
 1019     Int_t mvdHit1Nr = iMvdHit1;
 
 1020     if ( iMvdHit1 < nMvdPixelHits )
 
 1023       mvdHit1Nr = iMvdHit1-nMvdPixelHits;
 
 1026     zStation1 = mvdHit1->GetZ();
 
 1027     if ( zStation1 < 4. ) 
continue; 
 
 1030       cout << 
"LOOKING FOR TRACK SEGMENTS STARTING AT " << mvdHit1->GetX() << 
" " << mvdHit1->GetY() << 
" " << mvdHit1->GetZ() << 
"( " << zStation1 << 
")" << endl;
 
 1031     Double_t radius = 
TMath::Sqrt(mvdHit1->GetX()*mvdHit1->GetX()+mvdHit1->GetY()*mvdHit1->GetY());
 
 1032     Double_t pangle = TMath::ACos(mvdHit1->GetX()/radius);
 
 1033     if ( mvdHit1->GetY() < 0 )
 
 1038       cout << 
"     -> with theta of " << theta << 
" (radius = " << radius << 
" and phi angle = " << pangle*TMath::RadToDeg() << 
")" << endl;
 
 1040     for ( Int_t iMvdHit2 = iMvdHit1+1 ; iMvdHit2 < nMvdPixelHits+nMvdStripHits ; iMvdHit2++ ) {
 
 1041       Int_t mvdHit2Nr = iMvdHit2;
 
 1042       if ( iMvdHit2 < nMvdPixelHits )
 
 1045         mvdHit2Nr = iMvdHit2-nMvdPixelHits;
 
 1049       zStation2 = mvdHit2->GetZ();
 
 1050       if ( zStation2 < 4. ) 
continue; 
 
 1052       if ( 
TMath::Abs(zStation1-zStation2) < 2. ) 
continue;
 
 1054       zStation2 = mvdHit2->GetZ();
 
 1056       zDistRatio = zStation2/zStation1;
 
 1057       zDiffRatio = zStation1/(zStation2-zStation1);
 
 1058       zCuDiff = zStation2*zStation2*zStation2-zStation1*zStation1*zStation1;
 
 1059       zSqDiff = zStation2*zStation2-zStation1*zStation1;
 
 1060       zDiff   = zStation2-zStation1;
 
 1066         cout << 
"trying to match it with " << mvdHit2->GetX() << 
" " << mvdHit2->GetY() << 
" " << mvdHit2->GetZ() << endl;
 
 1067       Double_t radius2 = 
TMath::Sqrt(mvdHit2->GetX()*mvdHit2->GetX()+mvdHit2->GetY()*mvdHit2->GetY());
 
 1068       Double_t pangle2 = TMath::ACos(mvdHit2->GetX()/radius2);
 
 1069       if ( mvdHit2->GetY() < 0 )
 
 1075       if ( 
TMath::Abs(pangle-pangle2)*TMath::RadToDeg() > 40 ) 
continue;
 
 1078         cout << 
"       (radius = " << radius2 << 
" and phi angle = " << pangle2*TMath::RadToDeg() << 
")" << endl;
 
 1081       Double_t expRadUncert = 0.05*radius*zDistRatio;
 
 1084         cout << 
" expRad = "  
 1086              << 
" * " << radius << 
" * " << zDistRatio << endl;
 
 1087         cout << 
" -> while expected radius was " << expectedRad2 << endl;
 
 1090       if ( radius2>expectedRad2+expRadUncert || radius2<expectedRad2-expRadUncert ) 
continue;
 
 1093         cout << 
"STRONG CORRELATION FOR THIS HIT!!!" << endl;
 
 1096       if ( (pangle-pangle2) != 0 ) 
 
 1097         trackMomentum = 1.6*(par0_mom+par1_mom*radius)/((pangle-pangle2)*TMath::RadToDeg());
 
 1102         cout << 
"calculated track momentum is " << trackMomentum << endl;
 
 1103       Double_t trackPhiAngle = pangle+(pangle-pangle2)*zDiffRatio; 
 
 1104       if ( trackPhiAngle < 0. ) trackPhiAngle += 
TMath::Pi()*2.;
 
 1107         cout << 
"calculated phi is " << trackPhiAngle*TMath::RadToDeg() << endl;
 
 1112       tempTS.
detId[0] = -(mvdHit1->
GetSensorID()+(mvdHit1->GetDetectorID()<<27));
 
 1113       tempTS.
detId[1] = -(mvdHit2->
GetSensorID()+(mvdHit2->GetDetectorID()<<27));
 
 1117       tempTS.
trackPhi = trackPhiAngle*TMath::RadToDeg();
 
 1123         cout << 
" found segment " 
 1125              << mvdHit1Nr << 
"(" << tempTS.
detId[0] 
 
 1127              << 
"), " << mvdHit2Nr << 
"(" << tempTS.
detId[1] << 
"), " 
 1128              << 
" >>> " << trackMomentum << 
" GeV, " << trackPhiAngle*TMath::RadToDeg() << 
" deg, " << theta << 
" deg." << endl;
 
 1137     cout << 
"===>>> " << 
fTrackSegments.size() << 
" track segments" << endl;
 
 1405   cout << 
"-------------------- " << fName.Data() << 
" : Summary -----------------------" << endl;
 
 1406   cout << 
" Events:        " << setw(10) << 
fNofEvents << endl;
 
 1407   cout << 
"--------------------------------------------------------------------------------" << endl; 
 
Double_t GetTrackFinderOnHits_ParTheta1()
void PrintTracks(Int_t nofRecoTracks)
std::vector< TrackSegment > fTrackSegments
virtual void SetParContainers()
Double_t GetTrackFinderOnHits_ParThetaB()
Double_t GetTrackFinderOnHits_ParTheta3()
TVector3 GetPosition() const 
static T Sqrt(const T &x)
TClonesArray * fTrackCandArray
TClonesArray * fTrackArray
Int_t MatchTrackSegments()
Double_t GetZ(Int_t it=0)
virtual ~PndMvdGemTrackFinderOnHits()
TVector3 GetMomentum() const 
Int_t CreateTracks(Int_t nofRecoTracks)
void SetPersistency(Bool_t val=kTRUE)
void PrintMCTrackSegments()
Double_t GetTrackFinderOnHits_ParMat1(Int_t in)
Digitization Parameter Class for GEM part. 
TClonesArray * fMvdStripHitArray
Double_t GetTrackFinderOnHits_ParTheta0()
Double_t GetTrackFinderOnHits_ParMat0(Int_t in)
void RemoveCloneTracks(Int_t nofRecoTracks)
PndMvdGemTrackFinderOnHits()
void AddHit(UInt_t detId, UInt_t hitId, Double_t rho)
Int_t FindTrackSegments()
Int_t GetNDigiHits() const 
virtual InitStatus ReInit()
virtual void Exec(Option_t *opt)
Int_t GetStationNr() const 
void PrintTrackSegments()
Int_t fNofFoundTrackSegments
TVector3 GetPosition() const 
virtual InitStatus Init()
Double_t GetTrackFinderOnHits_ParRadPhi2()
TClonesArray * fMCMvdPointArray
TClonesArray * fMvdPixelHitArray
TClonesArray * fMCGemPointArray
TClonesArray * fMCTrackArray
Int_t GetSensorID() const 
OnHits track finding algorithm. 
TClonesArray * fGemHitArray
Double_t GetTrackFinderOnHits_ParThetaA()
void PrintMCTracks(Int_t nofRecoTracks)
Double_t GetTrackFinderOnHits_ParTheta2()
Double_t GetTrackFinderOnHits_ParRadPhi0()
Int_t fNofExpectedTrackSegments
PndGemStation * GetStation(Int_t iStation)