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,
115 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::initializeHook() -- begin");
122 <<
"), IsoTrkImpChi2Max ("
124 <<
") and IsoDoTrkImpChi2Cut ("
134 "optimized (faster)" :
"regular (slower)")
135 <<
"track isolation calculation methd.");
137 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::initializeHook() -- end");
139 return StatusCode::SUCCESS;
147 return StatusCode::SUCCESS;
153 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::addBranchesVCLoopHook() -- begin");
155 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::addBranchesVCSetupHook: "
156 <<
"Vertex container index " << ivc
162 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::addBranchesVCSetupHook() -- end");
165 return StatusCode::SUCCESS;
171 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::addBranchesSVLoopHook() -- begin");
173 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::addBranchesSVLoopHook(): "
174 "calculate isolation ...");
180 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::addBranchesSVLoopHook(): "
181 "save isolation ...");
185 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::addBranchesSVLoopHook() -- end");
188 return StatusCode::SUCCESS;
195 const unsigned int ipv,
196 const unsigned int its,
197 const unsigned int itt)
const {
200 <<
", its: " << its <<
", itt: " << itt);
204 TVector3 candP = cand.
totalP();
211 for (
unsigned int ic = 0;
ic < nCones; ++
ic) {
221 double nTracksInCone = 0;
222 double ptSumInCone = 0.;
225 if ( candRefPV != NULL ) {
227 for (TrackBag::const_iterator trkItr = tracks.begin();
228 trkItr != tracks.end(); ++trkItr) {
229 double deltaR = candP.DeltaR((*trkItr)->p4().Vect());
231 double logChi2 = (doLogChi2 > 0) ?
234 if ( doLogChi2 == 2 ) logChi2 = abs(logChi2);
235 if ( doLogChi2 == 0 || logChi2 < logChi2Max ) {
237 ptSumInCone += (*trkItr)->pt();
242 if ( ptSumInCone + candP.Pt() > 0. ) {
243 iso.
isoValue = candP.Pt() / ( ptSumInCone + candP.Pt() );
255 return StatusCode::SUCCESS;
261 const int ipv)
const {
274 for (
unsigned int its = 0; its < nTrackSels; ++its) {
275 for (
unsigned int ic = 0;
ic < nCones; ++
ic) {
276 for (
unsigned int itt = 0; itt < nTrackTypes; ++itt) {
286 <<
", found ? " <<
found
288 << (
found ? itpv->second : -1));
298 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::calculateIsolation -- begin");
305 for (
unsigned int its = 0; its < nTrackSels; ++its) {
306 for (
unsigned int ipv = 0; ipv < nPvAssocs; ++ipv) {
307 for (
unsigned int ic = 0;
ic < nCones; ++
ic) {
308 for (
unsigned int itt = 0; itt < nTrackTypes; ++itt) {
319 return StatusCode::SUCCESS;
328 const double logChi2Max,
330 const ToolHandle<TrkSelTool>& tSelTool,
332 const int trackTypes )
const {
341 TVector3 candP = cand.
totalP();
351 if ( ! tSelTool->accept(*track, candRefPV) )
continue;
353 if ( ! ((
unsigned int)trackTypes ==
ttall() ||
354 (
unsigned int)trackTypes ==
ttallMin() ||
356 & trackTypes) > 0x0) )
continue;
358 if (
std::find(candTracks.begin(), candTracks.end(), track)
359 != candTracks.end() )
continue;
361 tracks.push_back(track);
364 double nTracksInCone = 0;
365 double ptSumInCone = 0.;
366 for (TrackBag::const_iterator trkItr = tracks.begin();
367 trkItr != tracks.end(); ++trkItr) {
368 double deltaR = candP.DeltaR((*trkItr)->p4().Vect());
370 double logChi2 = (doLogChi2 > 0) ?
373 if ( doLogChi2 == 2 ) logChi2 = abs(logChi2);
374 if ( doLogChi2 == 0 || logChi2 < logChi2Max ) {
376 ptSumInCone += (*trkItr)->pt();
381 if ( ptSumInCone + candP.Pt() > 0. ) {
382 iso.
isoValue = candP.Pt() / ( ptSumInCone + candP.Pt() );
388 return StatusCode::SUCCESS;
399 for (
unsigned int its = 0; its < nTrackSels; ++its) {
400 for (
unsigned int ipv = 0; ipv < nPvAssocs; ++ipv) {
401 for (
unsigned int ic = 0;
ic < nCones; ++
ic) {
402 for (
unsigned int itt = 0; itt < nTrackTypes; ++itt) {
405 d_iso_value(
result.isoName());
407 d_iso_ntracks(
result.nTracksName());
408 d_iso_value(*vtx) =
result.isoValue;
409 d_iso_ntracks(*vtx) =
result.nTracks;
410 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::saveIsolation() -- isobn: "
411 <<
result.isoName() <<
", ntbn: "
413 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::saveIsolation() -- vertex: ("
416 << vtx->
z() <<
"), iso: "
417 <<
result.isoValue <<
", nTracks: "
424 return StatusCode::SUCCESS;
429 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::setResultsPrefix -- begin");
436 for (
unsigned int its = 0; its < nTrackSels; ++its) {
437 for (
unsigned int ipv = 0; ipv < nPvAssocs; ++ipv) {
438 for (
unsigned int ic = 0;
ic < nCones; ++
ic) {
439 for (
unsigned int itt = 0; itt < nTrackTypes; ++itt) {
446 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::setResultsPrefix -- end");
457 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::initResults : nCones = " << nCones);
458 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::initResults : nTrackSels = "
460 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::initResults : nPvAssocs = "
462 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::initResults : nTrackTypes = "
464 m_results.resize(boost::extents[nCones][nTrackSels][nPvAssocs][nTrackTypes]);
465 for (
unsigned int its = 0; its < nTrackSels; ++its) {
466 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::initResults -- its = " << its);
467 for (
unsigned int ipv = 0; ipv < nPvAssocs; ++ipv) {
468 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::initResults -- ipv = " << ipv);
469 for (
unsigned int ic = 0;
ic < nCones; ++
ic) {
471 for (
unsigned int itt = 0; itt < nTrackTypes; ++itt) {
472 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::initResults -- itt = " << itt);
492 unsigned int itt)
const {
493 ATH_MSG_DEBUG(
"BVertexTrackIsoTool::buildBranchName -- begin");
501 static_cast<int>(
coneSize * 10.),
static_cast<int>(logChi2Max * 10.),doLogChi2,