7 #include "GaudiKernel/SystemOfUnits.h"
46 return StatusCode::FAILURE;
77 return StatusCode::SUCCESS;
122 std::vector<float> cluster_et_log, cluster_dEta, cluster_dPhi;
123 std::vector<float> cluster_log_SECOND_R, cluster_SECOND_LAMBDA, cluster_CENTER_LAMBDA;
128 auto mon_cluster_SECOND_LAMBDA =
Monitored::Collection(
"cluster_SECOND_LAMBDA", cluster_SECOND_LAMBDA);
129 auto mon_cluster_CENTER_LAMBDA =
Monitored::Collection(
"cluster_CENTER_LAMBDA", cluster_CENTER_LAMBDA);
130 std::vector<unsigned char> calo_errors;
152 std::vector<float> track_pt_log, track_dEta, track_dPhi;
153 std::vector<float> track_d0_abs_log, track_z0sinthetaTJVA_abs_log;
154 std::vector<float> track_nPixelHitsPlusDeadSensors, track_nSCTHitsPlusDeadSensors;
159 auto mon_track_z0sinthetaTJVA_abs_log =
Monitored::Collection(
"track_z0sinthetaTJVA_abs_log", track_z0sinthetaTJVA_abs_log);
160 auto mon_track_nPixelHitsPlusDeadSensors =
Monitored::Collection(
"track_nPixelHitsPlusDeadSensors", track_nPixelHitsPlusDeadSensors);
161 auto mon_track_nSCTHitsPlusDeadSensors =
Monitored::Collection(
"track_nSCTHitsPlusDeadSensors", track_nSCTHitsPlusDeadSensors);
162 std::vector<unsigned char> track_errors;
165 std::map<std::string, Monitored::Scalar<float>> monitoredIdVariables;
175 std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> monVars = {
194 std::ref(mon_track_nPixelHitsPlusDeadSensors),
std::ref(mon_track_nSCTHitsPlusDeadSensors),
215 return StatusCode::FAILURE;
218 if(roisHandle->
empty()) {
220 return StatusCode::FAILURE;
229 return StatusCode::FAILURE;
238 std::unique_ptr<xAOD::TauJetContainer> outputContainer = std::make_unique<xAOD::TauJetContainer>();
239 std::unique_ptr<xAOD::TauJetAuxContainer> outputAuxContainer = std::make_unique<xAOD::TauJetAuxContainer>();
240 outputContainer->setStore(outputAuxContainer.get());
243 ATH_CHECK(outputTauHandle.
record(std::move(outputContainer), std::move(outputAuxContainer)));
246 std::unique_ptr<xAOD::TauTrackContainer> outputTrackContainer = std::make_unique<xAOD::TauTrackContainer>();
247 std::unique_ptr<xAOD::TauTrackAuxContainer> outputTrackAuxContainer = std::make_unique<xAOD::TauTrackAuxContainer>();
248 outputTrackContainer->setStore(outputTrackAuxContainer.get());
251 ATH_CHECK(tauTrackHandle.
record(std::move(outputTrackContainer), std::move(outputTrackAuxContainer)));
270 if(RoICaloClusterContainer) {
271 ATH_MSG_DEBUG(
"CaloCluster container found of size: " << RoICaloClusterContainer->
size());
278 return StatusCode::FAILURE;
282 std::unique_ptr<xAOD::JetContainer> jetContainer{std::make_unique<xAOD::JetContainer>()};
283 std::unique_ptr<xAOD::JetAuxContainer> jetAuxContainer{std::make_unique<xAOD::JetAuxContainer>()};
284 jetContainer->setStore(jetAuxContainer.get());
287 ATH_CHECK(outputTauSeedJetHandle.
record(std::move(jetContainer), std::move(jetAuxContainer)));
290 outputTauSeedJetHandle->
push_back(std::make_unique<xAOD::Jet>());
298 TLorentzVector cluster_p4, barycenter;
300 ATH_MSG_DEBUG(
"Cluster (e, eta, phi): (" << cluster->e() <<
", " << cluster->eta() <<
", " << cluster->phi() <<
")");
302 if(cluster->e() < 0) {
307 cluster_p4.SetPtEtaPhiE(cluster->pt(), cluster->eta(), cluster->phi(), cluster->e());
308 jet->addConstituent(cluster);
310 barycenter += cluster_p4;
313 jet->setJetP4(
xAOD::JetFourMom_t(barycenter.Pt(), barycenter.Eta(), barycenter.Phi(), barycenter.M()));
314 ATH_MSG_DEBUG(
"Built jet with eta: " <<
jet->eta() <<
", phi: " <<
jet->phi() <<
", pT: " <<
jet->pt() <<
", E: "<<
jet->e() );
319 outputTauHandle->
push_back(std::make_unique<xAOD::TauJet>());
320 tau = outputTauHandle->
back();
328 ATH_MSG_DEBUG(
"Changing (eta, phi) back to the RoI center due to negative energy: " <<
jet->e());
329 tau->
setP4(tau->
pt(), roiDescriptor->
eta(), roiDescriptor->
phi(), tau->
m());
361 if(!outputTauHandle->
empty()) {
362 tau = outputTauHandle->
back();
382 if(!VertexContainerHandle.
isValid()) {
383 ATH_MSG_DEBUG(
"No VertexContainer retrieved for the trigger element");
386 RoIVxContainer = VertexContainerHandle.
get();
398 StatusCode processStatus = StatusCode::SUCCESS;
405 processStatus =
tool->executeVertexFinder(*tau, RoIVxContainer);
407 if(!processStatus.isFailure()) {
419 processStatus =
tool->execute(*tau);
421 if(!processStatus.isFailure()) {
433 processStatus =
tool->executeTrackFinder(*tau, *tauTrackHandle);
435 if(!processStatus.isFailure()) {
447 processStatus =
tool->execute(*tau);
449 if(!processStatus.isFailure()) {
463 processStatus =
tool->executeVertexVariables(*tau, dummyVxCont);
465 if(!processStatus.isFailure()) {
477 processStatus =
tool->execute(*tau);
479 if(!processStatus.isFailure()) {
491 if(!processStatus.isSuccess()) {
492 ATH_MSG_DEBUG(
"The tau object has NOT been registered in the tau container");
505 float fJetEnergy = (*tau->
jetLink())->
e();
508 if(fJetEnergy < 0.00001) {
509 ATH_MSG_DEBUG(
"Changing tau's (eta,phi) to RoI ones due to negative energy (PxPyPzE flips eta and phi)");
510 ATH_MSG_DEBUG(
"This is probably not needed anymore, method PxPyPzE has been corrected");
513 tau->
setP4(tau->
pt(), roiDescriptor->
eta(), roiDescriptor->
phi(), tau->
m());
515 ATH_MSG_DEBUG(
"Roi: " << roiDescriptor->
roiId() <<
", Tau eta: " << tau->
eta() <<
", phi: " << tau->
phi() <<
", pT: " << tau->
pt());
528 etaRoI = roiDescriptor->
eta();
529 phiRoI = roiDescriptor->
phi();
530 dEta_RoI =
eta - roiDescriptor->
eta();
531 dPhi_RoI =
phi - roiDescriptor->
phi();
532 if(dPhi_RoI < -
M_PI) dPhi_RoI += 2.0*
M_PI;
533 if(dPhi_RoI >
M_PI) dPhi_RoI -= 2.0*
M_PI;
536 float pre_mEflowApprox;
540 float pre_ptRatioEflowApprox;
558 float Et_raw = EtEm + EtHad;
559 if(Et_raw != 0) EMFrac = EtEm / Et_raw;
568 if(
test) clustersMeanCenterLambda =
tmp;
570 if(
test) clustersMeanFirstEngDens =
tmp;
572 if(
test) clustersMeanEMProbability =
tmp;
574 if(
test) clustersMeanSecondLambda =
tmp;
576 if(
test) clustersMeanPresamplerFrac =
tmp;
580 n_clusters = tau->
clusters().size();
581 for(
const auto& cluster : tau->
clusters()) {
584 cluster_et_log.push_back(std::log10(
cls->et()));
585 cluster_dEta.push_back(
cls->eta() - tau->
eta());
586 cluster_dPhi.push_back(
cls->p4().DeltaPhi(tau->
p4()));
588 double log_second_R = -999;
590 if(success_SECOND_R) log_second_R = std::log10(log_second_R + 0.1);
591 cluster_log_SECOND_R.push_back(log_second_R);
593 double second_lambda = -999;
595 if(success_SECOND_LAMBDA) second_lambda = std::log10(second_lambda + 0.1);
596 cluster_SECOND_LAMBDA.push_back(second_lambda);
598 double center_lambda = -999;
600 if(success_CENTER_LAMBDA) center_lambda = std::log10(center_lambda + 1
e-6);
601 cluster_CENTER_LAMBDA.push_back(center_lambda);
631 track_pt_log.push_back(std::log10(
track->pt()));
632 track_dEta.push_back(
track->eta() - tau->
eta());
633 track_dPhi.push_back(
track->p4().DeltaPhi(tau->
p4()));
634 track_d0_abs_log.push_back(std::log10(std::abs(
track->track()->d0()) + 1
e-6));
635 track_z0sinthetaTJVA_abs_log.push_back(
track->z0sinthetaTJVA());
637 uint8_t pixel_hits, pixel_dead;
640 float nPixelHitsPlusDeadSensor = -999;
641 if(success1_pixel_hits && success2_pixel_dead) nPixelHitsPlusDeadSensor = pixel_hits + pixel_dead;
642 track_nPixelHitsPlusDeadSensors.push_back(nPixelHitsPlusDeadSensor);
655 if(
p.first.isAvailable(*tau)) {
657 monitoredIdVariables.at(
key +
"_TauJetScore_0p") =
p.first(*tau);
658 }
else if(tau->
nTracks() == 1) {
659 monitoredIdVariables.at(
key +
"_TauJetScore_1p") =
p.first(*tau);
661 monitoredIdVariables.at(
key +
"_TauJetScore_mp") =
p.first(*tau);
665 if(
p.second.isAvailable(*tau)) {
667 monitoredIdVariables.at(
key +
"_TauJetScoreTrans_0p") =
p.second(*tau);
668 }
else if(tau->
nTracks() == 1) {
669 monitoredIdVariables.at(
key +
"_TauJetScoreTrans_1p") =
p.second(*tau);
671 monitoredIdVariables.at(
key +
"_TauJetScoreTrans_mp") =
p.second(*tau);
681 <<
", Tau pT (GeV): " <<
pT <<
", Tau eta: " <<
eta <<
", Tau phi: " <<
phi
682 <<
", wrt RoI dEta: " << dEta_RoI <<
", dPhi: " << dPhi_RoI);
692 return StatusCode::SUCCESS;