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),
83 declareProperty(
"IsolationTypes" ,
m_cones);
105 ATH_MSG_WARNING(
"As no pass-flags are given, no vertices will be decorated");
115 return StatusCode::SUCCESS;
124 return StatusCode::SUCCESS;
147 else{
ATH_MSG_ERROR(
"Failed loading IdTrackparticleContainer container");
148 return StatusCode::FAILURE;
156 return StatusCode::FAILURE;
166 return StatusCode::FAILURE;
175 return StatusCode::FAILURE;
181 std::vector<xAOD::Iso::IsolationType> cones; cones.resize(
m_cones.size());
186 for (
unsigned int i =0;
i<
m_cones.size();
i++)
192 for(
auto vertex : *vertexContainer){
195 for(std::vector<std::string>::const_iterator flagItr =
m_passFlags.begin(); flagItr!=
m_passFlags.end(); ++flagItr) {
204 if(
vertex->trackParticleLinks().size() != 3)
ATH_MSG_WARNING(
"Vertex without 3 tracks, it has "<<
vertex->trackParticleLinks().size() <<
" instead");
206 TLorentzVector candidate;
208 std::set<const xAOD::TrackParticle*> exclusionset;
210 for(
auto part :
vertex->trackParticleLinks()){
211 candidate += (*part)->p4();
212 exclusionset.insert( *
part );
221 std::vector<const xAOD::Muon*> vtxMuons;
222 std::vector<TLorentzVector> extrVtxMuons ;
223 std::vector<const xAOD::CaloCluster*> vtxMuonCluster;
225 std::vector<const xAOD::TrackParticle*> usedVtxTracks;
227 map<xAOD::Iso::IsolationType, bool> is_reliable;
230 TLorentzVector muonref;
234 for (
auto muon : *muons ) {
236 if(
muon->inDetTrackParticleLink().isValid() && exclusionset.find(*
muon->inDetTrackParticleLink() ) != exclusionset.end() ){
240 vtxMuonCluster.push_back(clus);
241 vtxMuons.push_back(
muon);
242 usedVtxTracks.push_back( *
muon->inDetTrackParticleLink() );
243 extrVtxMuons.push_back(muonref);
245 ATH_MSG_DEBUG(
"Cannot find clusters. Would need a consistent set of Trk::Tracks to run extrapolation.");
262 if(vtxMuonCluster.size() !=3){
267 if(
std::find(usedVtxTracks.begin(), usedVtxTracks.end(), missingTrk) == usedVtxTracks.end()){
269 vtxMuonCluster.push_back(NULL);
270 usedVtxTracks.push_back( missingTrk );
271 extrVtxMuons.push_back(muonref);
277 if(vtxMuonCluster.size() !=3){
278 ATH_MSG_DEBUG(
"For this vertex there were less than 3 muons found (or extrapolated)" );
284 is_reliable[isoCone] =
true;
304 ATH_MSG_DEBUG(
"Check if the caloclus container has to be given or not... see line from 755 on of CaloIsolationTool");
308 ATH_MSG_DEBUG(
"Calculation of caloTopoClusterIsolation failed");
309 return StatusCode::FAILURE;
313 TLorentzVector extr_candidate;
315 ATH_MSG_WARNING(
"Failure extrapolating the slyTrack "<<
"pt="<<candidate_slyTrack.
pt()<<
" eta="<<candidate_slyTrack.
eta()<<
" phi="<<candidate_slyTrack.
phi());
320 std::map<xAOD::Iso::IsolationType,float> coreCorrections;
327 std::vector<xAOD::CaloCluster> clustersInCone;
329 for(
unsigned int j=0; j < vtxMuonCluster.size(); j++){
330 auto mucluster = vtxMuonCluster[j];
332 float dr=extrVtxMuons[j].DeltaR(extr_candidate);
337 ATH_MSG_DEBUG(extrVtxMuons[j].
Eta() <<
" - "<<extr_candidate.Eta()<<
" and "<<extrVtxMuons[j].Phi() <<
" - "<<extr_candidate.Phi());
344 else is_reliable[isoType] =
false;
357 if(clustersInCone.size() == 2){
358 for(
auto cell : clustersInCone[0]){
359 clustersInCone[1].removeCell(
cell);
362 if(clustersInCone.size() == 3){
363 for(
auto cell : clustersInCone[0]){
364 clustersInCone[1].removeCell(
cell);
365 clustersInCone[2].removeCell(
cell);
367 for(
auto cell : clustersInCone[1]){
368 clustersInCone[2].removeCell(
cell);
373 std::vector<float> etcore(4, 0.);
375 for(
auto cl : clustersInCone){
387 coreCorrections[isoType] = coreCorr;
397 string ED(
"_EDcorr");
398 string core(
"_COREcorr");
399 string reliable(
"_isReliable");
402 string vtx_type[3] = {
"SumPt",
"A0",
"Z0"};
404 string vtx = vtx_type[ vertex_type ];
407 for(
unsigned int i=0;
i< cones.size();
i++){
409 result.etcones[
i] -= coreCorrections[isoType];
429 isolation(*
vertex) = coreCorrections[isoType];
435 reliability(*
vertex) = is_reliable[isoType];
451 return StatusCode::SUCCESS;
459 ATH_MSG_ERROR(
"VertexCaloIsolation::extrapolateTrack needs to be rewritten because of changes to the caloExtension");
460 throw std::runtime_error(
"VertexCaloIsolation::extrapolateTrack needs to be rewritten because of changes to the caloExtension");
502 float etaT = 0, phiT = 0;
515 extr_tp.SetPtEtaPhiE(1., etaT/nSample, phiT/nSample, 10.);
523 ATH_MSG_WARNING(
"Muon calo cluster not found. Calo extension can not be obtained!!!");
541 covmat(candidate_slyTrack) = std::vector<float>(25, 0.);
556 return candidate_slyTrack;