19 m_transportBeamA(
"AFPProtonTransportTool/TransportBeamA", this),
20 m_transportBeamC(
"AFPProtonTransportTool/TransportBeamC", this)
22 declareProperty(
"TransportBeamA",
m_transportBeamA,
"Proton transport tool side A");
23 declareProperty(
"TransportBeamC",
m_transportBeamC,
"Proton transport tool side C");
31 ATH_MSG_INFO(
"Initialization. The correct configuration of this algorithm "
32 <<
"requires jets ordered in increasing energy");
70 return StatusCode::SUCCESS;
75 return l->p4().Et() >
r->p4().Et();
81 ATH_MSG_DEBUG(
"TrigAFPDijetComboHypoTool::executeAlg Executing algorithm");
83 std::vector<ElementLink<xAOD::JetContainer>> selected_jets;
86 if(combination.size() != 3)
ATH_MSG_ERROR(
"Number of leg decisions is not 3!");
90 for(
const auto& comb: combination){
91 const auto dec = comb.second;
93 if (jet_link.isValid()) {
94 selected_jets.push_back(jet_link);
98 if(selected_jets.size() != 2){
99 ATH_MSG_ERROR(
"Expecting to combine exactly two jets, but instead found "
100 << selected_jets.size() <<
". Will throw a runtime error");
101 throw std::runtime_error(
102 "Expecting to combine exactly two jets, but instead found " +
107 auto jetLink1 = selected_jets[0];
108 auto jetLink2 = selected_jets[1];
110 TLorentzVector jet1_vec = (*jetLink1)->p4();
111 TLorentzVector jet2_vec = (*jetLink2)->p4();
112 TLorentzVector dijet = jet1_vec + jet2_vec;
117 dijetMass = dijet.M() *
m_GeV;
119 dijetRapidity = dijet.Rapidity();
132 auto predictProtonAEnergy =
Monitored::Scalar(
"PredictProtonAEnergy" , -999.0 );
133 auto predictProtonCEnergy =
Monitored::Scalar(
"PredictProtonCEnergy" , -999.0 );
158 double sideA_minDist = 9e9;
159 double sideC_minDist = 9e9;
161 int nearestTrackSideAId = 999;
162 int nearestTrackSideCId = 999;
169 for(
auto track: (*tracksAFP)){
176 if(
track->stationID() == 1){
179 yDiff = sideA_predictY -
track->yLocal();
180 distance = sqrt(xDiff * xDiff + yDiff * yDiff);
184 nearestTrackSideAId =
track->index();
187 }
else if(
track->stationID() == 2){
190 yDiff = sideC_predictY -
track->yLocal();
191 distance = sqrt(xDiff * xDiff + yDiff * yDiff);
195 nearestTrackSideCId =
track->index();
205 bool passRCutA =
false;
206 bool passRCutC =
false;
208 bool passXYCutA =
false;
209 bool passXYCutC =
false;
222 if(nearestTrackSideAId != 999){
225 sideA_trackY = tracksAFP.
get()->
at(nearestTrackSideAId)->yLocal();
226 sideA_diffX = sideA_predictX - sideA_trackX;
227 sideA_diffY = sideA_predictY - sideA_trackY;
229 ATH_MSG_DEBUG(
"TrigAFPDijetComboHypoTool::execute sideA_diffX: " << sideA_diffX);
241 if(nearestTrackSideCId != 999){
244 sideC_trackY = tracksAFP.
get()->
at(nearestTrackSideCId)->yLocal();
245 sideC_diffX = sideC_predictX - sideC_trackX;
246 sideC_diffY = sideC_predictY - sideC_trackY;
269 if(passRCutA && passRCutC && passXYCutA && passXYCutC) pass =
true;