89 Int_t nofPoints =
fPoints->GetEntriesFast();
90 Int_t nofHits =
fHits->GetEntriesFast();
93 cout <<
"PndGemMatchHits::Exec() with " << nofPoints <<
" points and " << nofHits <<
" hits." << endl;
96 Int_t nMatchedHits = 0;
100 vector<Double_t> pointZ;
101 vector<Double_t> pointR;
102 vector<Double_t> pointP;
103 for ( Int_t iPoint = 0 ; iPoint < nofPoints ; iPoint++ ) {
106 Double_t pointX = currentPndGemMCPoint->GetX();
107 Double_t pointY = currentPndGemMCPoint->GetY();
110 cout <<
" .... " << pointX <<
" " << pointY <<
" " << currentPndGemMCPoint->GetZ() << endl;
112 Double_t phiAValue = TMath::ATan(pointX/pointY);
113 if ( pointY < 0 ) phiAValue +=
TMath::Pi();
114 else if ( pointX < 0 ) phiAValue += 2.*
TMath::Pi();
116 pointZ.push_back(currentPndGemMCPoint->GetZ());
117 pointR.push_back(
TMath::Sqrt(pointX*pointX+pointY*pointY));
118 pointP.push_back(phiAValue);
121 cout <<
"point " << iPoint <<
", sensor Id = " << currentPndGemMCPoint->
GetSensorId() <<
" (" << pointZ[pointZ.size()-1] <<
"," << pointR[pointR.size()-1] <<
"," << pointP[pointP.size()-1] <<
")" << endl;
124 for ( Int_t iHit = 0 ; iHit < nofHits ; iHit++ ) {
127 Double_t hitX = currentPndGemHit->GetX();
128 Double_t hitY = currentPndGemHit->GetY();
129 Double_t hitZ = currentPndGemHit->GetZ();
132 cout <<
" .... " << hitX <<
" " << hitY <<
" " << currentPndGemHit->GetZ() << endl;
134 Double_t hitP = TMath::ATan(hitX/hitY);
136 else if ( hitX < 0 ) hitP += 2.*
TMath::Pi();
140 cout <<
"-------------------------------------------" << endl;
141 cout <<
"hit " << iHit <<
" (" << hitZ <<
"," << hitR <<
"," << hitP <<
")" << endl;
144 Int_t matchPoint = -1;
147 for (
size_t iPoint = 0 ; iPoint < pointZ.size() ; iPoint++ ) {
149 if (
TMath::Abs(pointZ[iPoint]-hitZ) > currentPndGemHit->GetDz() ) {
continue; }
152 if ( hitP < 1.0 && pointP[iPoint] > 5.5 ) hitP += 2.*
TMath::Pi();
153 if ( hitP > 5.5 && pointP[iPoint] < 1.0 ) hitP -= 2.*
TMath::Pi();
157 cout <<
"matched with " <<
" (" << pointZ[iPoint] <<
"," << pointR[iPoint] <<
"," << pointP[iPoint] <<
") " << endl;
158 cout <<
"DP = " << currentPndGemHit->
GetDp() <<
" after transf. = " << currentPndGemHit->
GetDp()*
TMath::Sqrt(3.)/hitR <<
" while p_p = " << pointP[iPoint] <<
" " <<
" h_p = " << hitP << endl;
159 cout <<
"PASSED WITH POINT " << iPoint << endl;
162 (pointP[iPoint]-hitP)*(pointP[iPoint]-hitP)/currentPndGemHit->
GetDp()/currentPndGemHit->
GetDp());
163 if ( matchPoint != -1 ) multiHit = kTRUE;
164 if ( distance > closestDistance )
continue;
165 closestDistance = distance;
168 currentPndGemHit->SetRefIndex(matchPoint);
169 if ( matchPoint != -1 ) {
171 currentPndGemHit->
SetBotIndex(matchp->GetTrackID());
178 if ( matchPoint != -1 ) nMatchedHits++;
180 if ( multiHit ) nMultiHits++;
189 cout <<
"************PndGemMatchHits**************" << endl;
190 cout <<
" Number of all hits " << nHits << endl;
191 cout <<
" Number of matched hits " << nMatchedHits <<
" -> " << 100.*(
Double_t)nMatchedHits/(
Double_t)nHits << endl;
192 cout <<
" Number of fake hits " << nFakeHits <<
" -> " << 100.*(
Double_t)nFakeHits/(
Double_t)nHits << endl;
193 cout <<
" Number of multi hits " << nMultiHits <<
" -> " << 100.*(
Double_t)nMultiHits/(
Double_t)nHits << endl;
194 cout <<
"*****************************************" << endl;
static T Sqrt(const T &x)
void SetBotIndex(Int_t id)
Int_t GetSensorId() const