25 return StatusCode::SUCCESS;
35 return StatusCode::SUCCESS;
42 if(!tofTrackContainer.
isValid())
45 return StatusCode::SUCCESS;
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;
161 auto *
vertex = outputContainer->
push_back(std::make_unique<xAOD::AFPVertex>());
165 vertex->setPosition(position);
182 vertex->addToFTrack(tofTrackLink);
191 vertex->addProton(protonLink);
201 std::unique_ptr<xAOD::AFPVertexContainer>& outputContainer)
const
203 int trainID = tofTrackSideA->
trainID();
204 double protonYPositionFar = protonSideA->
track(0)->
yLocal();
206 protonYPositionFar = protonSideA->
track(1)->
yLocal();
209 trainID = tofTrackSideC->
trainID();
210 protonYPositionFar = protonSideC->
track(0)->
yLocal();
212 protonYPositionFar = protonSideC->
track(1)->
yLocal();
218 return createVertex(position, distA, distC, outputContainer);