39 const float dPhiCut_Loose =
M_PI/8;
41 const float dPhiCutGlobal[2] = {
static_cast<float>(
M_PI/24),
static_cast<float>(
M_PI/12)};
42 const float dRhoCutGlobal[2] = { 0.08, 0.5};
44 const float dPhiCutSector[2] = { 0.2, 0.1};
45 const float dRhoCutSector[2] = { 200, 2000};
50 unsigned int nTrack=matchedSegments[i].size();
59 if(nTrack!=1)
continue;
66 float innerSegmRho=0;
float innerSegmPhi=0;
float innerSegmZ=0;
75 float midSegmPhi =0;
float midSegmZ =0;
80 bool canCheckGlobal[4] = {0, 0, 0, 0};
81 if(matchedSegments[i].at(0).at(2)!=
nullptr){
83 canCheckGlobal[0]=
true; canCheckGlobal[1]=
true; canCheckGlobal[2]=
true;
85 midSegmPos =
Amg::Vector3D(matchedSegments[i].at(0).at(2)->globalPosition());
86 midSegmPhi = midSegmPos.phi();
87 midSegmZ = midSegmPos.z();
88 if(midSegmPhi<0)midSegmPhi+=2*
M_PI;
89 midSegmDirzunit =
Amg::Vector3D(midSegmPos/std::abs(midSegmZ));
91 if((matchedSegments[i].at(0).at(0)!=
nullptr)&&(matchedSegments[i].at(0).at(2)!=
nullptr)){
93 canCheckGlobal[3]=
true;
95 innerSegmPos =
Amg::Vector3D(matchedSegments[i].at(0).at(0)->globalPosition());
96 innerSegmRho = std::abs(innerSegmPos.perp());
97 innerSegmZ = std::abs(innerSegmPos.z());
99 innerSegmPhi = midSegmPhi;
101 innerSegmPos =
Amg::Vector3D(innerSegmRho*std::cos(innerSegmPhi), innerSegmRho*std::sin(innerSegmPhi), innerSegmZ);
102 innerSegmDirzunit =
Amg::Vector3D(innerSegmPos/std::abs(innerSegmZ));
106 bool skipSide =
true;
107 for(
int jTGC=0;jTGC<4;jTGC++)
if(canCheckGlobal[jTGC]==
true)skipSide=
false;
108 if(skipSide==
true)
continue;
111 int TGCStationNames[8] ={41, 42, 43, 44, 45, 46, 47, 48};
112 int TGCstation_StationFE[4] ={-1,-1,-1,-1};
113 int TGCstation_StationEta[4]={ 0, 0, 0, 0};
114 int TGCstation_StationPhi[4]={ 0, 0, 0, 0};
115 int nStationMatch[4] ={ 0, 0, 0, 0};
116 bool canCheckSector[4] ={
true,
true,
true,
true};
119 for(
int stationnameindex=0; stationnameindex<8; stationnameindex++){
121 int stationName = TGCStationNames[stationnameindex];
123 if(stationIndex<0)
continue;
124 if(!canCheckGlobal[stationIndex])
continue;
127 for(
int stationeta=1; stationeta<=8; stationeta++){
128 for(
int stationphi=1; stationphi<=48; stationphi++){
130 if(
m_TREarray[stationnameindex][i][stationeta][stationphi]==
nullptr)
continue;
139 float dZ_sector=std::abs(sectorZ)-std::abs(innerSegmZ);
141 sectorExtrapolatedPos =
Amg::Vector3D(innerSegmPos+(innerSegmDirzunit*dZ_sector));
144 float dZ_sector=std::abs(sectorZ)-std::abs(midSegmZ);
145 sectorExtrapolatedPos =
Amg::Vector3D(midSegmPos+(midSegmDirzunit*dZ_sector));
151 Amg::Vector2D sectorLocalPos2D(sectorLocalPos3D.y(),sectorLocalPos3D.z());
158 double tol1=-0.1*(avWidth/2);
159 double tol2=-0.1*(
length/2);
161 bool insideSectorBounds=tre->
bounds().
inside(sectorLocalPos2D,tol1,tol2);
162 if(!insideSectorBounds)
continue;
165 TGCstation_StationFE[stationIndex]= (tre->
isForward()==
false);
166 TGCstation_StationEta[stationIndex]=stationeta;
167 TGCstation_StationPhi[stationIndex]=stationphi;
168 nStationMatch[stationIndex]++;
174 for(
int jTGC=0;jTGC<4;jTGC++){
175 if(nStationMatch[jTGC]==0){
176 canCheckSector[jTGC]=
false;
178 else if(nStationMatch[jTGC]>1){
179 canCheckSector[jTGC]=
false;
187 int nTGCStrips[4] = {0, 0, 0, 0};
188 for(
int jMDT=0;jMDT<4;jMDT++){
189 if(matchedSegments[i].at(0).at(jMDT)==
nullptr)
continue;
193 ATH_MSG_DEBUG(
"number of MeasurementBase: "<<mMeasTrk.size() );
194 for (
unsigned int i=0; i<mMeasTrk.size(); i++) {
202 int stationName = int(
m_idHelperSvc->mdtIdHelper().stationName(
id));
205 if((jMDT==2)&&((stationName==41)||(stationName==42)))nTGCStrips[0]++;
206 if((jMDT==2)&&((stationName==43)||(stationName==44)))nTGCStrips[1]++;
207 if((jMDT==2)&&((stationName==45)||(stationName==46)))nTGCStrips[2]++;
208 if((jMDT==0)&&((stationName==47)||(stationName==48)))nTGCStrips[3]++;
219 if((nTGCStrips[1]==0)&&(nTGCStrips[2]==0)){canCheckSector[0]=
false;canCheckGlobal[0]=
false;}
220 if((nTGCStrips[0]==0)&&(nTGCStrips[2]==0)){canCheckSector[1]=
false;canCheckGlobal[1]=
false;}
221 if((nTGCStrips[0]==0)&&(nTGCStrips[1]==0)){canCheckSector[2]=
false;canCheckGlobal[2]=
false;}
225 bool sectorhitregistered[9][2];
226 for(
int l=0;l<9;l++){
227 for(
int k=0;k<2;k++){
229 sectorhitregistered[l][k]=
false;
234 bool HasPRD[9] ={
false,
false,
false,
false,
false,
false,
false,
false,
false};
235 bool PRDMatch[9]={
false,
false,
false,
false,
false,
false,
false,
false,
false};
246 prepitc!= prepitc_end;
255 int tgcAC=(tre->
sideA()==
false);
258 int stationName =
m_idHelperSvc->tgcIdHelper().stationName(tgcid);
264 if(tgcAC!=i)
continue;
265 if(stationName>48 || stationName<41)
continue;
272 if(stationIndex<0)
continue;
273 if(!(canCheckGlobal[stationIndex]||canCheckSector[stationIndex]))
continue;
274 if(layer<0)
continue;
280 float tgcRho = std::abs(prdPos.perp());
281 float tgcPhi = prdPos.phi();
282 float tgcZ = prdPos.z();
283 if(tgcPhi<0)tgcPhi+=2*
M_PI;
290 float dZ = std::abs(tgcZ) - std::abs(innerSegmZ);
292 tgcExtrapolatedPos =
Amg::Vector3D(innerSegmPos+(innerSegmDirzunit*dZ));
295 float dZ = std::abs(tgcZ) - std::abs(midSegmZ);
297 tgcExtrapolatedPos =
Amg::Vector3D(midSegmPos+(midSegmDirzunit*dZ));
299 float tgcExtrRho = std::abs(tgcExtrapolatedPos.perp());
300 float tgcExtrPhi = tgcExtrapolatedPos.phi();
301 if(tgcExtrPhi<0)tgcExtrPhi+=2*
M_PI;
304 float dRho = tgcRho-tgcExtrRho;
305 float dPhi = tgcPhi-tgcExtrPhi;
310 if(std::abs(dPhi)<dPhiCut_Loose){
316 if(canCheckGlobal[stationIndex]){
318 float dRhoCut = dRhoCutGlobal[tgcWS]*tgcExtrRho;
319 if(std::abs(dPhi)<dPhiCutGlobal[tgcWS] && std::abs(dRho)<dRhoCut){
324 if(canCheckSector[stationIndex]){
325 if((stationEta==TGCstation_StationEta[stationIndex])&&
326 (stationPhi==TGCstation_StationPhi[stationIndex])&&
327 (tgcFE==TGCstation_StationFE[stationIndex])){
328 if(std::abs(dPhi)<dPhiCutSector[tgcWS] && std::abs(dRho)<dRhoCutSector[tgcWS]){
329 sectorhitregistered[layer][tgcWS]=
true;
339 for(
int l=0;l<9;l++){
342 if(stationIndex<0)
continue;
343 for(
int k=0;k<2;k++){
345 if(canCheckSector[stationIndex]){
346 if((TGCstation_StationFE[stationIndex]<0)||(TGCstation_StationEta[stationIndex]==0)||(TGCstation_StationPhi[stationIndex]==0)){
347 ATH_MSG_WARNING(
"SegmTrack: canCheckSector passed for jTGC=" << stationIndex
348 <<
" but, FE=" << TGCstation_StationFE[stationIndex]
349 <<
" Eta=" << TGCstation_StationEta[stationIndex]
350 <<
" Phi=" << TGCstation_StationPhi[stationIndex] );
354 int stationMap_EtaIndex=
getStationMapIndex(1, l, TGCstation_StationFE[stationIndex], TGCstation_StationEta[stationIndex], TGCstation_StationPhi[stationIndex]);
355 int stationMap_PhiIndex=
getStationMapIndex(2, l, TGCstation_StationFE[stationIndex], TGCstation_StationEta[stationIndex], TGCstation_StationPhi[stationIndex]);
357 if(sectorhitregistered[l][k]){
376 if((PRDMatch[0]||PRDMatch[1]||PRDMatch[2])&&
377 (PRDMatch[3]||PRDMatch[4])&&
378 (PRDMatch[5]||PRDMatch[6])&&
380 if((PRDMatch[0]&&PRDMatch[1]&&PRDMatch[2])&&
381 (PRDMatch[3]&&PRDMatch[4])&&
382 (PRDMatch[5]&&PRDMatch[6])&&