59 VertexCaloIsolation::VertexCaloIsolation(
const std::string&
t,
61 const IInterface*
p) :
63 m_caloIsoTool(
"xAOD::CaloIsolationTool/CaloIsolationTool"),
64 m_trackContainerName(
"InDetTrackParticles"),
65 m_vertexContainerName(
"NONE"),
66 m_caloClusterContainerName(
"CaloCalTopoClusters"),
67 m_muonContainerName(
"Muons"),
68 m_caloExtTool(
"Trk::ParticleCaloExtensionTool/ParticleCaloExtensionTool"),
70 m_sigmaCaloNoiseCut(3.4),
74 declareInterface<DerivationFramework::IAugmentationTool>(
this);
106 ATH_MSG_WARNING(
"As no pass-flags are given, no vertices will be decorated");
116 return StatusCode::SUCCESS;
125 return StatusCode::SUCCESS;
148 else{
ATH_MSG_ERROR(
"Failed loading IdTrackparticleContainer container");
149 return StatusCode::FAILURE;
157 return StatusCode::FAILURE;
167 return StatusCode::FAILURE;
176 return StatusCode::FAILURE;
182 std::vector<xAOD::Iso::IsolationType> cones; cones.resize(
m_cones.size());
187 for (
unsigned int i =0;
i<
m_cones.size();
i++)
193 for(
auto vertex : *vertexContainer){
196 for(std::vector<std::string>::const_iterator flagItr =
m_passFlags.begin(); flagItr!=
m_passFlags.end(); ++flagItr) {
205 if(
vertex->trackParticleLinks().size() != 3)
ATH_MSG_WARNING(
"Vertex without 3 tracks, it has "<<
vertex->trackParticleLinks().size() <<
" instead");
207 TLorentzVector candidate;
209 std::set<const xAOD::TrackParticle*> exclusionset;
211 for(
auto part :
vertex->trackParticleLinks()){
212 candidate += (*part)->p4();
213 exclusionset.insert( *
part );
222 std::vector<const xAOD::Muon*> vtxMuons;
223 std::vector<TLorentzVector> extrVtxMuons ;
224 std::vector<const xAOD::CaloCluster*> vtxMuonCluster;
226 std::vector<const xAOD::TrackParticle*> usedVtxTracks;
228 map<xAOD::Iso::IsolationType, bool> is_reliable;
231 TLorentzVector muonref;
235 for (
auto muon : *muons ) {
237 if(
muon->inDetTrackParticleLink().isValid() && exclusionset.find(*
muon->inDetTrackParticleLink() ) != exclusionset.end() ){
241 vtxMuonCluster.push_back(clus);
242 vtxMuons.push_back(
muon);
243 usedVtxTracks.push_back( *
muon->inDetTrackParticleLink() );
244 extrVtxMuons.push_back(muonref);
246 ATH_MSG_DEBUG(
"Cannot find clusters. Would need a consistent set of Trk::Tracks to run extrapolation.");
263 if(vtxMuonCluster.size() !=3){
268 if(
std::find(usedVtxTracks.begin(), usedVtxTracks.end(), missingTrk) == usedVtxTracks.end()){
270 vtxMuonCluster.push_back(NULL);
271 usedVtxTracks.push_back( missingTrk );
272 extrVtxMuons.push_back(muonref);
278 if(vtxMuonCluster.size() !=3){
279 ATH_MSG_DEBUG(
"For this vertex there were less than 3 muons found (or extrapolated)" );
285 is_reliable[isoCone] =
true;
305 ATH_MSG_DEBUG(
"Check if the caloclus container has to be given or not... see line from 755 on of CaloIsolationTool");
309 ATH_MSG_DEBUG(
"Calculation of caloTopoClusterIsolation failed");
310 return StatusCode::FAILURE;
314 TLorentzVector extr_candidate;
316 ATH_MSG_WARNING(
"Failure extrapolating the slyTrack "<<
"pt="<<candidate_slyTrack.
pt()<<
" eta="<<candidate_slyTrack.
eta()<<
" phi="<<candidate_slyTrack.
phi());
321 std::map<xAOD::Iso::IsolationType,float> coreCorrections;
328 std::vector<xAOD::CaloCluster> clustersInCone;
330 for(
unsigned int j=0; j < vtxMuonCluster.size(); j++){
331 auto mucluster = vtxMuonCluster[j];
333 float dr=extrVtxMuons[j].DeltaR(extr_candidate);
338 ATH_MSG_DEBUG(extrVtxMuons[j].
Eta() <<
" - "<<extr_candidate.Eta()<<
" and "<<extrVtxMuons[j].Phi() <<
" - "<<extr_candidate.Phi());
345 else is_reliable[isoType] =
false;
358 if(clustersInCone.size() == 2){
359 for(
auto cell : clustersInCone[0]){
360 clustersInCone[1].removeCell(
cell);
363 if(clustersInCone.size() == 3){
364 for(
auto cell : clustersInCone[0]){
365 clustersInCone[1].removeCell(
cell);
366 clustersInCone[2].removeCell(
cell);
368 for(
auto cell : clustersInCone[1]){
369 clustersInCone[2].removeCell(
cell);
374 std::vector<float> etcore(4, 0.);
376 for(
auto cl : clustersInCone){
388 coreCorrections[isoType] = coreCorr;
398 string ED(
"_EDcorr");
399 string core(
"_COREcorr");
400 string reliable(
"_isReliable");
403 string vtx_type[3] = {
"SumPt",
"A0",
"Z0"};
405 string vtx = vtx_type[ vertex_type ];
408 for(
unsigned int i=0;
i< cones.size();
i++){
410 result.etcones[
i] -= coreCorrections[isoType];
430 isolation(*
vertex) = coreCorrections[isoType];
436 reliability(*
vertex) = is_reliable[isoType];
452 return StatusCode::SUCCESS;
460 ATH_MSG_ERROR(
"VertexCaloIsolation::extrapolateTrack needs to be rewritten because of changes to the caloExtension");
461 throw std::runtime_error(
"VertexCaloIsolation::extrapolateTrack needs to be rewritten because of changes to the caloExtension");
503 float etaT = 0, phiT = 0;
516 extr_tp.SetPtEtaPhiE(1., etaT/nSample, phiT/nSample, 10.);
524 ATH_MSG_WARNING(
"Muon calo cluster not found. Calo extension can not be obtained!!!");
542 covmat(candidate_slyTrack) = std::vector<float>(25, 0.);
557 return candidate_slyTrack;