40 const float dPhiCut_Loose =
M_PI/8;
42 const float dPhiCutGlobal[2] = {
static_cast<float>(
M_PI/24),
static_cast<float>(
M_PI/12)};
43 const float dRhoCutGlobal[2] = { 0.08, 0.5};
45 const float dPhiCutSector[2] = { 0.2, 0.1};
46 const float dRhoCutSector[2] = { 200, 2000};
51 unsigned int nTrack=matchedSegments[i].size();
60 if(nTrack!=1)
continue;
67 float innerSegmRho=0;
float innerSegmPhi=0;
float innerSegmZ=0;
76 float midSegmPhi =0;
float midSegmZ =0;
81 bool canCheckGlobal[4] = {0, 0, 0, 0};
82 if(matchedSegments[i].at(0).at(2)!=
nullptr){
84 canCheckGlobal[0]=
true; canCheckGlobal[1]=
true; canCheckGlobal[2]=
true;
86 midSegmPos =
Amg::Vector3D(matchedSegments[i].at(0).at(2)->globalPosition());
87 midSegmPhi = midSegmPos.phi();
88 midSegmZ = midSegmPos.z();
89 if(midSegmPhi<0)midSegmPhi+=2*
M_PI;
90 midSegmDirzunit =
Amg::Vector3D(midSegmPos/std::abs(midSegmZ));
92 if((matchedSegments[i].at(0).at(0)!=
nullptr)&&(matchedSegments[i].at(0).at(2)!=
nullptr)){
94 canCheckGlobal[3]=
true;
96 innerSegmPos =
Amg::Vector3D(matchedSegments[i].at(0).at(0)->globalPosition());
97 innerSegmRho = std::abs(innerSegmPos.perp());
98 innerSegmZ = std::abs(innerSegmPos.z());
100 innerSegmPhi = midSegmPhi;
102 innerSegmPos =
Amg::Vector3D(innerSegmRho*std::cos(innerSegmPhi), innerSegmRho*std::sin(innerSegmPhi), innerSegmZ);
103 innerSegmDirzunit =
Amg::Vector3D(innerSegmPos/std::abs(innerSegmZ));
107 bool skipSide =
true;
108 for(
int jTGC=0;jTGC<4;jTGC++)
if(canCheckGlobal[jTGC]==
true)skipSide=
false;
109 if(skipSide==
true)
continue;
112 int TGCStationNames[8] ={41, 42, 43, 44, 45, 46, 47, 48};
113 int TGCstation_StationFE[4] ={-1,-1,-1,-1};
114 int TGCstation_StationEta[4]={ 0, 0, 0, 0};
115 int TGCstation_StationPhi[4]={ 0, 0, 0, 0};
116 int nStationMatch[4] ={ 0, 0, 0, 0};
117 bool canCheckSector[4] ={
true,
true,
true,
true};
120 for(
int stationnameindex=0; stationnameindex<8; stationnameindex++){
122 int stationName = TGCStationNames[stationnameindex];
124 if(stationIndex<0)
continue;
125 if(!canCheckGlobal[stationIndex])
continue;
128 for(
int stationeta=1; stationeta<=8; stationeta++){
129 for(
int stationphi=1; stationphi<=48; stationphi++){
131 if(
m_TREarray[stationnameindex][i][stationeta][stationphi]==
nullptr)
continue;
140 float dZ_sector=std::abs(sectorZ)-std::abs(innerSegmZ);
142 sectorExtrapolatedPos =
Amg::Vector3D(innerSegmPos+(innerSegmDirzunit*dZ_sector));
145 float dZ_sector=std::abs(sectorZ)-std::abs(midSegmZ);
146 sectorExtrapolatedPos =
Amg::Vector3D(midSegmPos+(midSegmDirzunit*dZ_sector));
152 Amg::Vector2D sectorLocalPos2D(sectorLocalPos3D.y(),sectorLocalPos3D.z());
159 double tol1=-0.1*(avWidth/2);
160 double tol2=-0.1*(
length/2);
162 bool insideSectorBounds=tre->
bounds().
inside(sectorLocalPos2D,tol1,tol2);
163 if(!insideSectorBounds)
continue;
166 TGCstation_StationFE[stationIndex]= (tre->
isForward()==
false);
167 TGCstation_StationEta[stationIndex]=stationeta;
168 TGCstation_StationPhi[stationIndex]=stationphi;
169 nStationMatch[stationIndex]++;
175 for(
int jTGC=0;jTGC<4;jTGC++){
176 if(nStationMatch[jTGC]==0){
177 canCheckSector[jTGC]=
false;
179 else if(nStationMatch[jTGC]>1){
180 canCheckSector[jTGC]=
false;
188 int nTGCStrips[4] = {0, 0, 0, 0};
189 for(
int jMDT=0;jMDT<4;jMDT++){
190 if(matchedSegments[i].at(0).at(jMDT)==
nullptr)
continue;
194 ATH_MSG_DEBUG(
"number of MeasurementBase: "<<mMeasTrk.size() );
195 for (
unsigned int i=0; i<mMeasTrk.size(); i++) {
203 int stationName = int(
m_idHelperSvc->mdtIdHelper().stationName(
id));
206 if((jMDT==2)&&((stationName==41)||(stationName==42)))nTGCStrips[0]++;
207 if((jMDT==2)&&((stationName==43)||(stationName==44)))nTGCStrips[1]++;
208 if((jMDT==2)&&((stationName==45)||(stationName==46)))nTGCStrips[2]++;
209 if((jMDT==0)&&((stationName==47)||(stationName==48)))nTGCStrips[3]++;
220 if((nTGCStrips[1]==0)&&(nTGCStrips[2]==0)){canCheckSector[0]=
false;canCheckGlobal[0]=
false;}
221 if((nTGCStrips[0]==0)&&(nTGCStrips[2]==0)){canCheckSector[1]=
false;canCheckGlobal[1]=
false;}
222 if((nTGCStrips[0]==0)&&(nTGCStrips[1]==0)){canCheckSector[2]=
false;canCheckGlobal[2]=
false;}
226 bool sectorhitregistered[9][2];
227 for(
int l=0;l<9;l++){
228 for(
int k=0;k<2;k++){
230 sectorhitregistered[l][k]=
false;
235 bool HasPRD[9] ={
false,
false,
false,
false,
false,
false,
false,
false,
false};
236 bool PRDMatch[9]={
false,
false,
false,
false,
false,
false,
false,
false,
false};
247 prepitc!= prepitc_end;
256 int tgcAC=(tre->
sideA()==
false);
259 int stationName =
m_idHelperSvc->tgcIdHelper().stationName(tgcid);
265 if(tgcAC!=i)
continue;
266 if(stationName>48 || stationName<41)
continue;
273 if(stationIndex<0)
continue;
274 if(!(canCheckGlobal[stationIndex]||canCheckSector[stationIndex]))
continue;
275 if(layer<0)
continue;
281 float tgcRho = std::abs(prdPos.perp());
282 float tgcPhi = prdPos.phi();
283 float tgcZ = prdPos.z();
284 if(tgcPhi<0)tgcPhi+=2*
M_PI;
291 float dZ = std::abs(tgcZ) - std::abs(innerSegmZ);
293 tgcExtrapolatedPos =
Amg::Vector3D(innerSegmPos+(innerSegmDirzunit*dZ));
296 float dZ = std::abs(tgcZ) - std::abs(midSegmZ);
298 tgcExtrapolatedPos =
Amg::Vector3D(midSegmPos+(midSegmDirzunit*dZ));
300 float tgcExtrRho = std::abs(tgcExtrapolatedPos.perp());
301 float tgcExtrPhi = tgcExtrapolatedPos.phi();
302 if(tgcExtrPhi<0)tgcExtrPhi+=2*
M_PI;
305 float dRho = tgcRho-tgcExtrRho;
306 float dPhi = tgcPhi-tgcExtrPhi;
311 if(std::abs(dPhi)<dPhiCut_Loose){
317 if(canCheckGlobal[stationIndex]){
319 float dRhoCut = dRhoCutGlobal[tgcWS]*tgcExtrRho;
320 if(std::abs(dPhi)<dPhiCutGlobal[tgcWS] && std::abs(dRho)<dRhoCut){
325 if(canCheckSector[stationIndex]){
326 if((stationEta==TGCstation_StationEta[stationIndex])&&
327 (stationPhi==TGCstation_StationPhi[stationIndex])&&
328 (tgcFE==TGCstation_StationFE[stationIndex])){
329 if(std::abs(dPhi)<dPhiCutSector[tgcWS] && std::abs(dRho)<dRhoCutSector[tgcWS]){
330 sectorhitregistered[layer][tgcWS]=
true;
340 for(
int l=0;l<9;l++){
343 if(stationIndex<0)
continue;
344 for(
int k=0;k<2;k++){
346 if(canCheckSector[stationIndex]){
347 if((TGCstation_StationFE[stationIndex]<0)||(TGCstation_StationEta[stationIndex]==0)||(TGCstation_StationPhi[stationIndex]==0)){
348 ATH_MSG_WARNING(
"SegmTrack: canCheckSector passed for jTGC=" << stationIndex
349 <<
" but, FE=" << TGCstation_StationFE[stationIndex]
350 <<
" Eta=" << TGCstation_StationEta[stationIndex]
351 <<
" Phi=" << TGCstation_StationPhi[stationIndex] );
355 int stationMap_EtaIndex=
getStationMapIndex(1, l, TGCstation_StationFE[stationIndex], TGCstation_StationEta[stationIndex], TGCstation_StationPhi[stationIndex]);
356 int stationMap_PhiIndex=
getStationMapIndex(2, l, TGCstation_StationFE[stationIndex], TGCstation_StationEta[stationIndex], TGCstation_StationPhi[stationIndex]);
358 if(sectorhitregistered[l][k]){
377 if((PRDMatch[0]||PRDMatch[1]||PRDMatch[2])&&
378 (PRDMatch[3]||PRDMatch[4])&&
379 (PRDMatch[5]||PRDMatch[6])&&
381 if((PRDMatch[0]&&PRDMatch[1]&&PRDMatch[2])&&
382 (PRDMatch[3]&&PRDMatch[4])&&
383 (PRDMatch[5]&&PRDMatch[6])&&