42 if(!tofTrackContainer.isValid())
45 return StatusCode::SUCCESS;
50 if(!protonContainer.isValid())
53 return StatusCode::SUCCESS;
58 std::vector<const xAOD::AFPToFTrack*> tofTrackSideAContainer;
59 std::copy_if(tofTrackContainer->begin(), tofTrackContainer->end(), std::back_inserter(tofTrackSideAContainer),
60 [](
auto track) { return track->stationID() == 0; });
61 if(tofTrackSideAContainer.empty())
return StatusCode::SUCCESS;
64 std::vector<const xAOD::AFPToFTrack*> tofTrackSideCContainer;
65 std::copy_if(tofTrackContainer->begin(), tofTrackContainer->end(), std::back_inserter(tofTrackSideCContainer),
66 [](
auto track) { return track->stationID() == 3; });
67 if(tofTrackSideCContainer.empty())
return StatusCode::SUCCESS;
70 std::vector<const xAOD::AFPProton*> protonSideAContainer;
71 std::copy_if(protonContainer->begin(), protonContainer->end(), std::back_inserter(protonSideAContainer),
72 [](
auto proton) { return proton->side() == 0; });
73 if(protonSideAContainer.empty())
return StatusCode::SUCCESS;
76 std::vector<const xAOD::AFPProton*> protonSideCContainer;
77 std::copy_if(protonContainer->begin(), protonContainer->end(), std::back_inserter(protonSideCContainer),
78 [](
auto proton) { return proton->side() == 1; });
79 if(protonSideCContainer.empty())
return StatusCode::SUCCESS;
81 ATH_MSG_DEBUG(
"tofTrackSideAContainer size: " << tofTrackSideAContainer.size());
82 ATH_MSG_DEBUG(
"tofTrackSideCContainer size: " << tofTrackSideCContainer.size());
83 ATH_MSG_DEBUG(
"protonSideAContainer size: " << protonSideAContainer.size());
84 ATH_MSG_DEBUG(
"protonSideCContainer size: " << protonSideCContainer.size());
97 double protonXPositionFar = protonSideA->track(0)->xLocal();
98 if(protonSideA->nTracks()==2 && protonSideA->track(1)->stationID()==0)
99 protonXPositionFar = protonSideA->track(1)->xLocal();
101 double dx =
std::min(std::abs(protonXPositionFar-TVP_A.
trainEdge(tofTrackSideA->trainID())),std::abs(protonXPositionFar-TVP_A.
trainEdge(tofTrackSideA->trainID()+1)));
103 if( protonXPositionFar > TVP_A.
trainEdge(tofTrackSideA->trainID()) && protonXPositionFar < TVP_A.
trainEdge(tofTrackSideA->trainID()+1) ) distA = -
dx;
107 "Tracks too far away from each other (xProton, xLeftPositionSideA; xRightPositionSideA; distance) [mm]: "
108 << protonXPositionFar <<
", " << TVP_A.
trainEdge(tofTrackSideA->trainID()) <<
"; "
109 << TVP_A.
trainEdge(tofTrackSideA->trainID()+1) <<
", " << distA <<
"; " << distA);
121 double protonXPositionFar = protonSideC->track(0)->xLocal();
122 if(protonSideC->nTracks()==2 && protonSideC->track(1)->stationID()==3)
123 protonXPositionFar = protonSideC->track(1)->xLocal();
124 double dx =
std::min(std::abs(protonXPositionFar-TVP_C.
trainEdge(tofTrackSideC->trainID())),std::abs(protonXPositionFar-TVP_C.
trainEdge(tofTrackSideC->trainID()+1)));
126 if( protonXPositionFar > TVP_C.
trainEdge(tofTrackSideC->trainID()) && protonXPositionFar < TVP_C.
trainEdge(tofTrackSideC->trainID()+1) ) distC = -
dx;
130 "Tracks too far away from each other (xProton, xLeftPositionSideC; xRightPositionSideC; distance) [mm]: "
131 << protonXPositionFar <<
", " << TVP_C.
trainEdge(tofTrackSideC->trainID()) <<
"; "
132 << TVP_C.
trainEdge(tofTrackSideC->trainID()+1) <<
", " << distC <<
"; " << distC);
138 xAOD::AFPVertex *
vertex =
reco(distA, distC, tofTrackSideA, tofTrackSideC, protonSideA, protonSideC, TVP_A, TVP_C, outputContainer);
154 return StatusCode::SUCCESS;