50 const std::string& Bname,
51 const std::string& Prefix,
54 BaseItem(
Name, Bname, Prefix), isoValue(IsoValue), nTracks(NTracks) {
61 const std::string& Bname,
62 const std::string& Prefix) {
69 const std::string& Bname,
70 const std::string& Prefix,
88 isoValue =
item.isoValue;
89 nTracks =
item.nTracks;
97 return buildName(
"Ntracks");
102 const std::string&
n,
106 declareInterface<DerivationFramework::IAugmentationTool>(
this);
116 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::initializeHook() -- begin");
123 <<
"), IsoTrkImpChi2Max ("
125 <<
") and IsoDoTrkImpChi2Cut ("
135 "optimized (faster)" :
"regular (slower)")
136 <<
"track isolation calculation methd.");
138 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::initializeHook() -- end");
140 return StatusCode::SUCCESS;
148 return StatusCode::SUCCESS;
154 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::addBranchesVCLoopHook() -- begin");
156 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::addBranchesVCSetupHook: "
157 <<
"Vertex container index " << ivc
163 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::addBranchesVCSetupHook() -- end");
166 return StatusCode::SUCCESS;
172 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::addBranchesSVLoopHook() -- begin");
174 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::addBranchesSVLoopHook(): "
175 "calculate isolation ...");
181 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::addBranchesSVLoopHook(): "
182 "save isolation ...");
186 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::addBranchesSVLoopHook() -- end");
189 return StatusCode::SUCCESS;
196 const unsigned int ipv,
197 const unsigned int its,
198 const unsigned int itt)
const {
201 <<
", its: " << its <<
", itt: " << itt);
205 TVector3 candP = cand.
totalP();
212 for (
unsigned int ic = 0;
ic < nCones; ++
ic) {
222 double nTracksInCone = 0;
223 double ptSumInCone = 0.;
226 if ( candRefPV != NULL ) {
228 for (TrackBag::const_iterator trkItr = tracks.begin();
229 trkItr != tracks.end(); ++trkItr) {
230 double deltaR = candP.DeltaR((*trkItr)->p4().Vect());
232 double logChi2 = (doLogChi2 > 0) ?
235 if ( doLogChi2 == 2 ) logChi2 = abs(logChi2);
236 if ( doLogChi2 == 0 || logChi2 < logChi2Max ) {
238 ptSumInCone += (*trkItr)->pt();
243 if ( ptSumInCone + candP.Pt() > 0. ) {
244 iso.
isoValue = candP.Pt() / ( ptSumInCone + candP.Pt() );
256 return StatusCode::SUCCESS;
262 const int ipv)
const {
275 for (
unsigned int its = 0; its < nTrackSels; ++its) {
276 for (
unsigned int ic = 0;
ic < nCones; ++
ic) {
277 for (
unsigned int itt = 0; itt < nTrackTypes; ++itt) {
287 <<
", found ? " <<
found
289 << (
found ? itpv->second : -1));
299 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::calculateIsolation -- begin");
306 for (
unsigned int its = 0; its < nTrackSels; ++its) {
307 for (
unsigned int ipv = 0; ipv < nPvAssocs; ++ipv) {
308 for (
unsigned int ic = 0;
ic < nCones; ++
ic) {
309 for (
unsigned int itt = 0; itt < nTrackTypes; ++itt) {
320 return StatusCode::SUCCESS;
329 const double logChi2Max,
331 const ToolHandle<TrkSelTool>& tSelTool,
333 const int trackTypes )
const {
342 TVector3 candP = cand.
totalP();
352 if ( ! tSelTool->accept(*
track, candRefPV) )
continue;
354 if ( ! ((
unsigned int)trackTypes ==
ttall() ||
355 (
unsigned int)trackTypes ==
ttallMin() ||
357 & trackTypes) > 0x0) )
continue;
360 != candTracks.end() )
continue;
362 tracks.push_back(
track);
365 double nTracksInCone = 0;
366 double ptSumInCone = 0.;
367 for (TrackBag::const_iterator trkItr = tracks.begin();
368 trkItr != tracks.end(); ++trkItr) {
369 double deltaR = candP.DeltaR((*trkItr)->p4().Vect());
371 double logChi2 = (doLogChi2 > 0) ?
374 if ( doLogChi2 == 2 ) logChi2 = abs(logChi2);
375 if ( doLogChi2 == 0 || logChi2 < logChi2Max ) {
377 ptSumInCone += (*trkItr)->pt();
382 if ( ptSumInCone + candP.Pt() > 0. ) {
383 iso.
isoValue = candP.Pt() / ( ptSumInCone + candP.Pt() );
389 return StatusCode::SUCCESS;
400 for (
unsigned int its = 0; its < nTrackSels; ++its) {
401 for (
unsigned int ipv = 0; ipv < nPvAssocs; ++ipv) {
402 for (
unsigned int ic = 0;
ic < nCones; ++
ic) {
403 for (
unsigned int itt = 0; itt < nTrackTypes; ++itt) {
406 d_iso_value(
result.isoName());
408 d_iso_ntracks(
result.nTracksName());
409 d_iso_value(*vtx) =
result.isoValue;
410 d_iso_ntracks(*vtx) =
result.nTracks;
411 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::saveIsolation() -- isobn: "
412 <<
result.isoName() <<
", ntbn: "
414 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::saveIsolation() -- vertex: ("
417 << vtx->
z() <<
"), iso: "
418 <<
result.isoValue <<
", nTracks: "
425 return StatusCode::SUCCESS;
430 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::setResultsPrefix -- begin");
437 for (
unsigned int its = 0; its < nTrackSels; ++its) {
438 for (
unsigned int ipv = 0; ipv < nPvAssocs; ++ipv) {
439 for (
unsigned int ic = 0;
ic < nCones; ++
ic) {
440 for (
unsigned int itt = 0; itt < nTrackTypes; ++itt) {
447 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::setResultsPrefix -- end");
458 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::initResults : nCones = " << nCones);
459 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::initResults : nTrackSels = "
461 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::initResults : nPvAssocs = "
463 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::initResults : nTrackTypes = "
465 m_results.resize(boost::extents[nCones][nTrackSels][nPvAssocs][nTrackTypes]);
466 for (
unsigned int its = 0; its < nTrackSels; ++its) {
467 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::initResults -- its = " << its);
468 for (
unsigned int ipv = 0; ipv < nPvAssocs; ++ipv) {
469 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::initResults -- ipv = " << ipv);
470 for (
unsigned int ic = 0;
ic < nCones; ++
ic) {
472 for (
unsigned int itt = 0; itt < nTrackTypes; ++itt) {
473 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::initResults -- itt = " << itt);
493 unsigned int itt)
const {
494 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::buildBranchName -- begin");
502 static_cast<int>(
coneSize * 10.),
static_cast<int>(logChi2Max * 10.),doLogChi2,