14 #include "../MdtVsTgcRawDataValAlg.h"
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;
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++) {
200 const std::vector<const Muon::MuonClusterOnTrack*> mc_list = crot->
containedROTs();
201 for(
unsigned int iROT=0; iROT< mc_list.size(); iROT++){
222 if((nTGCStrips[1]==0)&&(nTGCStrips[2]==0)){canCheckSector[0]=
false;canCheckGlobal[0]=
false;}
223 if((nTGCStrips[0]==0)&&(nTGCStrips[2]==0)){canCheckSector[1]=
false;canCheckGlobal[1]=
false;}
224 if((nTGCStrips[0]==0)&&(nTGCStrips[1]==0)){canCheckSector[2]=
false;canCheckGlobal[2]=
false;}
228 bool sectorhitregistered[9][2];
229 for(
int l=0;
l<9;
l++){
230 for(
int k=0;
k<2;
k++){
232 sectorhitregistered[
l][
k]=
false;
237 bool HasPRD[9] ={
false,
false,
false,
false,
false,
false,
false,
false,
false};
238 bool PRDMatch[9]={
false,
false,
false,
false,
false,
false,
false,
false,
false};
249 prepitc!= prepitc_end;
258 int tgcAC=(tre->
sideA()==
false);
267 if(tgcAC!=
i)
continue;
275 if(stationIndex<0)
continue;
276 if(!(canCheckGlobal[stationIndex]||canCheckSector[stationIndex]))
continue;
277 if(
layer<0)
continue;
283 float tgcRho = std::abs(prdPos.perp());
284 float tgcPhi = prdPos.phi();
285 float tgcZ = prdPos.z();
286 if(tgcPhi<0)tgcPhi+=2*
M_PI;
293 float dZ = std::abs(tgcZ) - std::abs(innerSegmZ);
295 tgcExtrapolatedPos =
Amg::Vector3D(innerSegmPos+(innerSegmDirzunit*dZ));
298 float dZ = std::abs(tgcZ) - std::abs(midSegmZ);
300 tgcExtrapolatedPos =
Amg::Vector3D(midSegmPos+(midSegmDirzunit*dZ));
302 float tgcExtrRho = std::abs(tgcExtrapolatedPos.perp());
303 float tgcExtrPhi = tgcExtrapolatedPos.phi();
304 if(tgcExtrPhi<0)tgcExtrPhi+=2*
M_PI;
307 float dRho = tgcRho-tgcExtrRho;
308 float dPhi = tgcPhi-tgcExtrPhi;
313 if(std::abs(
dPhi)<dPhiCut_Loose){
319 if(canCheckGlobal[stationIndex]){
321 float dRhoCut = dRhoCutGlobal[tgcWS]*tgcExtrRho;
322 if(std::abs(
dPhi)<dPhiCutGlobal[tgcWS] && std::abs(dRho)<dRhoCut){
327 if(canCheckSector[stationIndex]){
328 if((
stationEta==TGCstation_StationEta[stationIndex])&&
329 (
stationPhi==TGCstation_StationPhi[stationIndex])&&
330 (tgcFE==TGCstation_StationFE[stationIndex])){
331 if(std::abs(
dPhi)<dPhiCutSector[tgcWS] && std::abs(dRho)<dRhoCutSector[tgcWS]){
332 sectorhitregistered[
layer][tgcWS]=
true;
342 for(
int l=0;
l<9;
l++){
345 if(stationIndex<0)
continue;
346 for(
int k=0;
k<2;
k++){
348 if(canCheckSector[stationIndex]){
349 if((TGCstation_StationFE[stationIndex]<0)||(TGCstation_StationEta[stationIndex]==0)||(TGCstation_StationPhi[stationIndex]==0)){
350 ATH_MSG_WARNING(
"SegmTrack: canCheckSector passed for jTGC=" << stationIndex
351 <<
" but, FE=" << TGCstation_StationFE[stationIndex]
352 <<
" Eta=" << TGCstation_StationEta[stationIndex]
353 <<
" Phi=" << TGCstation_StationPhi[stationIndex] );
357 int stationMap_EtaIndex=
getStationMapIndex(1,
l, TGCstation_StationFE[stationIndex], TGCstation_StationEta[stationIndex], TGCstation_StationPhi[stationIndex]);
358 int stationMap_PhiIndex=
getStationMapIndex(2,
l, TGCstation_StationFE[stationIndex], TGCstation_StationEta[stationIndex], TGCstation_StationPhi[stationIndex]);
360 if(sectorhitregistered[
l][
k]){
379 if((PRDMatch[0]||PRDMatch[1]||PRDMatch[2])&&
380 (PRDMatch[3]||PRDMatch[4])&&
381 (PRDMatch[5]||PRDMatch[6])&&
383 if((PRDMatch[0]&&PRDMatch[1]&&PRDMatch[2])&&
384 (PRDMatch[3]&&PRDMatch[4])&&
385 (PRDMatch[5]&&PRDMatch[6])&&