Commit 40a6d123 authored by Atlas-Software Librarian's avatar Atlas-Software Librarian Committed by Graeme Stewart
Browse files

'CMakeLists.txt' (InDetDNASeparator-01-00-00)

parent 775c4d0e
################################################################################
# Package: InDetDNASeparator
################################################################################
# Declare the package name:
atlas_subdir( InDetDNASeparator )
# Declare the package's dependencies:
atlas_depends_on_subdirs( PUBLIC
Control/AthenaBaseComps
Tracking/TrkEvent/TrkMaterialOnTrack
Tracking/TrkEvent/TrkParameters
Tracking/TrkFitter/TrkFitterInterfaces
Tracking/TrkFitter/TrkFitterUtils
PRIVATE
Event/EventPrimitives
GaudiKernel
InnerDetector/InDetDetDescr/InDetIdentifier
Tracking/TrkDetDescr/TrkSurfaces
Tracking/TrkEvent/TrkMeasurementBase
Tracking/TrkEvent/TrkTrack )
# Component(s) in the package:
atlas_add_component( InDetDNASeparator
src/*.cxx
src/components/*.cxx
LINK_LIBRARIES AthenaBaseComps TrkMaterialOnTrack TrkParameters TrkFitterInterfaces TrkFitterUtils EventPrimitives GaudiKernel InDetIdentifier TrkSurfaces TrkMeasurementBase TrkTrack )
# Install files from the package:
atlas_install_headers( InDetDNASeparator )
2013-10-04 Nick Styles <nicholas.styles -at- cern.ch>
* Migrated to Eigen/new track EDM
* Tagged as InDetDNASeparator-01-00-00
2012-10-25 Wolfgang Liebig <http://phonebook.cern.ch/index.html?id=PE485812>
* compatibility with CLHEP 2.0
* tag InDetDNASeparator-00-00-12
2009-01-20 Wolfgang Liebig <http://phonebook.cern.ch/index.html?id=PE485812>
* full IDSW cleanup (detstore() and msg() use), compatible with 15.0.0
* tag InDetDNASeparator-00-00-11
2009-01-20 Wolfgang Liebig <http://phonebook.cern.ch/index.html?id=PE485812>
* first level of cleanup, compatible with 14.4.0 & 14.5.0
* tag InDetDNASeparator-00-00-10
2008-09-09 Wolfgang Liebig <http://phonebook.cern.ch/index.html?id=PE485812>
* remove editor accident
* cmt/requirements: fix checkreq warning
* tag InDetDNASeparator-00-00-09
2008-07-28 Wolfgang Liebig <http://phonebook.cern.ch/index.html?id=PE485812>
* add new interfaces+implementation to
-> give back the internal (floating-point value) significance
-> treat Trk::Track as input in addition to KF-trajectories
* tag InDetDNASeparator-00-00-07
2008-07-25 Wolfgang Liebig <http://phonebook.cern.ch/index.html?id=PE485812>
* internal restructuring (modularising) of dna-separation logic
as preparation for being called also outside KalmanFitter
* new class MeanTrackParsAtFloor for internal data flow
* results should be the same
* tag InDetDNASeparator-00-00-06
2008-06-11 Vato Kartvelishvili <vakhtang.kartvelishvili@cern.ch>
* Clean up separator code from abandoned variables etc
* tag InDetDNASeparator-00-00-05
2008-05-16 Vato Kartvelishvili <vakhtang.kartvelishvili@cern.ch>
* Adding python-selectable parameter
2007-12-18 Wolfgang Liebig <http://phonebook.cern.ch/index.html?id=PE485812>
* react to checkreq report, tag 00-00-03
2007-12-13 Wolfgang Liebig <http://phonebook.cern.ch/index.html?id=PE485812>
* another case where compile errors appear only with later releases.
-> make array dimensions constant.
* tag InDetDNASeparator-00-00-02
2007-12-12 Wolfgang Liebig <http://phonebook.cern.ch/index.html?id=PE485812>
* add full tool from Sue and Vato
* tag InDetDNASeparator-00-00-01
2007-12-12 Igor Kachaev <Igor.Katchaev@cern.ch>
* create empty package InDetDNASeparator-00-00-00
2007-08-08 Vato Kartvelishvili <vakhtang.kartvelishvili@cern.ch>
* Setup of InDetDNASeparator (empty) using SetupUtility
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
// InDetDNASeparator.h, (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
#ifndef INDETINDETDNASEPARATOR_H
#define INDETINDETDNASEPARATOR_H
#include "AthenaBaseComps/AthAlgTool.h"
#include "TrkFitterUtils/TrackBreakpointType.h"
#include "TrkFitterInterfaces/ITrackBreakpointAnalyser.h"
#include "InDetDNASeparator/MeanTrackParsAtFloor.h"
#include <vector>
class PixelID;
class SCT_ID;
namespace Trk {class Track;}
namespace InDet
{
/** @brief analyses the KalmanFitter's internal trajectory for
DNA activity and if such activity has created a brem point or not.
The confirmBreakpoint() methods work in the following way:
@returns TrackBreakpointType::NoBreakpoint if DNA never kicked in
during the fit, hence DNA = kf (previously "-1")
@returns TrackBreakpointType::DnaBremPointNotUseful if DNA kicked
in, but momentum did not change => REFIT without DNA (previously "0")
@returns TrackBreakpointType::DnaBremPointUseful if DNA kicked in
and changed momentum => DNA fit is good (previously "+1")
+1 also means that DNA fit believes the track was a bremming electron.
@author Vato Kartvelishvili <vakhtang.kartvelishvili@cern.ch>
*/
class InDetDNASeparator : virtual public Trk::ITrackBreakpointAnalyser,
public AthAlgTool
{
public:
InDetDNASeparator(const std::string&,const std::string&,const IInterface*);
/** default destructor */
virtual ~InDetDNASeparator ();
/** standard Athena-Algorithm method */
virtual StatusCode initialize();
/** standard Athena-Algorithm method */
virtual StatusCode finalize ();
//! see ITrackBreakpointAnalyser for documentation.
virtual Trk::TrackBreakpointType confirmBreakpoint(const Trk::Trajectory&) const;
virtual double breakpointSignificance(const Trk::Trajectory&) const;
virtual Trk::TrackBreakpointType confirmBreakpoint(const Trk::Track&) const;
double breakpointSignificance(const Trk::Track&) const;
private:
//! method calculating the dna-separation variables on the floor-projected track pars
std::vector<double> calculateSignificance
(const std::vector<Trk::MeanTrackParsAtFloor>) const;
//! Cutoff used in the Separator (VK)
double m_kutoff;
//!< min distance in r_xy between brem-floors
const double m_floorseparation_drr;
//! ID SCT helper
const SCT_ID* m_SCT_Tool;
//! ID Pixel helper
const PixelID* m_pixelTool;
//! bottom floor constant for max() logic and flag for no-DNA
static const double s_sigmaNoDna;
};
} // end of namespace
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
// MeanTrackParsAtFloor.h, (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
#ifndef INDET__MEANTRACKPARSATFLOOR_H
#define INDET__MEANTRACKPARSATFLOOR_H
#include "TrkParameters/TrackParameters.h"
#include "TrkMaterialOnTrack/EstimatedBremOnTrack.h"
#include "TrkFitterUtils/DNA_MaterialEffects.h"
namespace Trk {
/** @brief Helper class to manage averaging of several track and brem parameters
into floors, which are defined such that differences between consecutive
MeanTrackParametersAtFloor are sensitive to brem.
Designed for giving structure to internally used set of variables,
hence this class is part of a component lib and all members are public.
@author VK, WL
*/
class MeanTrackParsAtFloor {
public:
MeanTrackParsAtFloor();
void addTrackParsToFloor(const Trk::TrackParameters&,
const Trk::DNA_MaterialEffects*,
const Trk::EstimatedBremOnTrack*);
int nen;
// int numberMeasPerFloor() {return nen;};
double ras;
// double meanRadiusAtFloor() {return ras;};
double phs;
// double measuredPhiAtFloor() {return phs;};
double ths;
// double measuredThetaAtFloor() {return ths;};
double pts;
// double measuredPtSmoothedAtFloor() {return pts;};
double dps;
// double errorPtSmoothedAtFloor() {return dps;};
int nnf;
double dnf;
int nnb;
double dnb;
/* double ich,bin,rat,los ;*/
};
}
#endif
package InDetDNASeparator
author Vato Kartvelishvili <vakhtang.kartvelishvili@cern.ch>
public
use AtlasPolicy AtlasPolicy-*
use AthenaBaseComps AthenaBaseComps-* Control
use TrkFitterUtils TrkFitterUtils-* Tracking/TrkFitter
use TrkFitterInterfaces TrkFitterInterfaces-* Tracking/TrkFitter
use TrkParameters TrkParameters-* Tracking/TrkEvent
use TrkMaterialOnTrack TrkMaterialOnTrack-* Tracking/TrkEvent
apply_pattern component_library
library InDetDNASeparator *.cxx components/*.cxx
private
use InDetIdentifier InDetIdentifier-* InnerDetector/InDetDetDescr
use TrkTrack TrkTrack-* Tracking/TrkEvent
use TrkMeasurementBase TrkMeasurementBase-* Tracking/TrkEvent
use TrkSurfaces TrkSurfaces-* Tracking/TrkDetDescr
use EventPrimitives EventPrimitives-* Event
use GaudiInterface GaudiInterface-* External
#macro cppdebugflags '$(cppdebugflags_s)'
#macro_remove componentshr_linkopts "-Wl,-s"
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/**
@mainpage InDetDNASeparator Package
@author Vato Kartvelishvili <vakhtang.kartvelishvili@cern.ch>
@author Wolfgang Liebig <http://consult.cern.ch/xwho/people/54608>
@section InDetDNASeparatorIntro Summary
Evaluate track for energy-loss type breakpoints based on
existing material effects and momentum information on the track.
It analyses the momentum evolution along the trajectory, comparing
the momenta at different 'floors', which are detector layers
sufficently spatially separated to allow sensitivity to momentum
change. It can be used as module inside a fitter as well as re-analysis
of readily fitted Trk::Track objects.
One type of output from the brem analysis is a significance value
for potential brem, a variable which ranges from -100 (no brem or a problem)
via small negative values (energy increase due to resolution effects)
to high positive values (significant brem). The other type
of output is a decision: no breakpoint, insignificant breakpoint
or a confirmed, significant breakpoint. Breakpoint means brem
for this tool.
@section InDetDNASeparatorTechnical Implementation
The DNA separator implements the Trk::ITrackBreakpointAnalyser
interface from the common tracking realm. It has two sets of
methods: one performs the analysis on input from the internal
data members of track fitters (std::vector<Trk::ProtoTrackStateOnSurface>)
the other one on full EDM Trk::Tracks.
Each set exists in one method to calculate the significance of the brem
and another one performing a decision based on this significance.
This package also has an internal data class: <nop>MeanTrackParsAtFloor which
manages the representation of any combination of measurements on
brem-sensitive detector floors.
@section InDetDNASeparatorJO jobOptions
<table>
<tr><td><b>option</b></td><td><b>default</b></td><td><b>purpose</b></td></tr>
<tr><td>kutoff</td><td>4.50</td><td>significance value above which a brem is
declared as 'confirmed'.</td></tr>
</table>
@section InDetDNASeparatorExtras Extra Pages
- @ref InDetDNASeparatorPackages
- @ref InDetDNASeparatorRequirements
*/
/**
@page InDetDNASeparatorPackages Used Packages
@htmlinclude used_packages.html
*/
/**
@page InDetDNASeparatorRequirements
@include requirements
*/
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
// InDetDNASeparator.cxx, (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
#include "InDetDNASeparator/InDetDNASeparator.h"
#include "InDetIdentifier/SCT_ID.h"
#include "InDetIdentifier/PixelID.h"
#include "TrkTrack/TrackStateOnSurface.h"
#include "TrkTrack/Track.h"
#include "TrkMeasurementBase/MeasurementBase.h"
#include "TrkSurfaces/Surface.h"
#include "TrkFitterUtils/DNA_MaterialEffects.h"
//#include "TrkParameters/MeasuredTrackParameters.h"
// #include "TrkFitterUtils/ProtoTrajectoryUtility.h"
//================ Constructor ===============================================
const double InDet::InDetDNASeparator::s_sigmaNoDna = -100.0;
InDet::InDetDNASeparator::InDetDNASeparator(const std::string& t,
const std::string& n,
const IInterface* p )
:
AthAlgTool(t,n,p),
m_kutoff(4.50),
m_floorseparation_drr(4.00*CLHEP::mm)
{
declareInterface<ITrackBreakpointAnalyser>(this);
// template for property declaration
//declareProperty("PropertyName", m_propertyName);
declareProperty("kutoff", m_kutoff);
}
//================ Destructor =================================================
InDet::InDetDNASeparator::~InDetDNASeparator()
{}
//================ Initialisation =================================================
StatusCode InDet::InDetDNASeparator::initialize()
{
StatusCode sc = AthAlgTool::initialize();
if (sc.isFailure()) return sc;
sc = detStore()->retrieve(m_SCT_Tool, "SCT_ID");
if (sc.isFailure())
{
ATH_MSG_ERROR ("Could not get SCT_ID helper !");
return StatusCode::FAILURE;
}
sc = detStore()->retrieve(m_pixelTool, "PixelID");
if (sc.isFailure())
{
ATH_MSG_ERROR ("Could not get PixelID helper !");
return StatusCode::FAILURE;
}
// m_utility = new ProtoTrajectoryUtility(m_pixelTool);
ATH_MSG_INFO ("initialize() successful in " << name());
return StatusCode::SUCCESS;
}
//================ Finalisation =================================================
StatusCode InDet::InDetDNASeparator::finalize()
{
StatusCode sc = AthAlgTool::finalize();
// delete m_utility;
return sc;
}
//============================================================================================
Trk::TrackBreakpointType InDet::InDetDNASeparator::confirmBreakpoint(const Trk::Trajectory& trajectory) const
{
double sigmax = breakpointSignificance(trajectory);
if(sigmax == s_sigmaNoDna ) return (Trk::NoBreakpoint); // no brem objects found
if(sigmax > m_kutoff) return (Trk::DnaBremPointUseful); // significant brem
return (Trk::DnaBremPointNotUseful); // sigma calculated but not significant
}
//
// Returns 1 if DNA never kicked in during the fit, hence DNA = kf
//
// Returns 3 if DNA kicked in, but momentum did not change => REFIT without DNA
//
// Returns 2 if DNA kicked in and changed momentum => DNA fit is good
//
double InDet::InDetDNASeparator::breakpointSignificance
(const Trk::Trajectory& trajectory) const
{
/* prepare trajectory information in layers or 'floor levels', averaging
over module front and backsides and overlaps. Information per floor
level is held in the MeanTrackParsAtFloor helper class. */
std::vector<Trk::MeanTrackParsAtFloor> newPars; newPars.reserve(10);
Trk::MeanTrackParsAtFloor meanPars;
double rxy_old = 0.0;
Trk::Trajectory::const_reverse_iterator rvit = trajectory.rbegin();
Trk::Trajectory::const_reverse_iterator innermostTrtHit = trajectory.rend();
for ( ; rvit != trajectory.rend() ; ++rvit) {
if (!rvit->measurement() || !rvit->smoothedTrackParameters()
|| rvit->isOutlier() ) continue;
Identifier id=rvit->measurement()->associatedSurface().associatedDetectorElementIdentifier();
if (m_pixelTool->is_trt(id)) innermostTrtHit = rvit;
if (m_pixelTool->is_pixel(id) || m_SCT_Tool->is_sct(id)) {
// insert one (innermost) TRT hit to allow analysing brem at last SCT layer
if (rxy_old == 0.0 && (innermostTrtHit != trajectory.rend()) ) {
meanPars.addTrackParsToFloor(*(innermostTrtHit->smoothedTrackParameters()),
innermostTrtHit->dnaMaterialEffects(), 0);
rxy_old = innermostTrtHit->smoothedTrackParameters()->position().perp();
}
// define new floor if there was previous one and distance to current large enough
double current_dr = fabs(rxy_old-rvit->smoothedTrackParameters()->position().perp());
if (rxy_old > 0.0 && (current_dr > m_floorseparation_drr)) {
newPars.push_back(meanPars);
meanPars = Trk::MeanTrackParsAtFloor();
}
// create-new-floor or add-to-average of existing floor
meanPars.addTrackParsToFloor(*(rvit->smoothedTrackParameters()),
rvit->dnaMaterialEffects(), 0);
rxy_old = rvit->smoothedTrackParameters()->position().perp();
}
}
newPars.push_back(meanPars);
// calculate the significance of the brem objects found on track
return calculateSignificance(newPars).at(0);
}
Trk::TrackBreakpointType InDet::InDetDNASeparator::confirmBreakpoint(const Trk::Track& track) const
{
double sigmax = breakpointSignificance(track);
if(sigmax == s_sigmaNoDna ) return (Trk::NoBreakpoint); // no brem objects found
if(sigmax > m_kutoff) return (Trk::DnaBremPointUseful); // significant brem
return (Trk::DnaBremPointNotUseful); // sigma calculated but not significant
}
double InDet::InDetDNASeparator::breakpointSignificance(const Trk::Track& track) const
{
if (track.trackStateOnSurfaces() == NULL ||
track.trackStateOnSurfaces()->size() < 2) return s_sigmaNoDna;
/* prepare trajectory information in layers or 'floor levels', averaging
over module front and backsides and overlaps. Information per floor
level is held in the MeanTrackParsAtFloor helper class. */
std::vector<Trk::MeanTrackParsAtFloor> newPars; newPars.reserve(10);
Trk::MeanTrackParsAtFloor meanPars;
double rxy_old = 0.0;
const std::vector<const Trk::TrackStateOnSurface*>& tsos =
track.trackStateOnSurfaces()->stdcont();
std::vector<const Trk::TrackStateOnSurface*>::const_reverse_iterator rvit = tsos.rbegin();
std::vector<const Trk::TrackStateOnSurface*>::const_reverse_iterator innermostTrt = tsos.rend();
for ( ; rvit != tsos.rend() ; ++rvit) {
if (!(*rvit)->measurementOnTrack() || !(*rvit)->trackParameters()
|| !(*rvit)->type(Trk::TrackStateOnSurface::Measurement) ) continue;
Identifier
id=(*rvit)->measurementOnTrack()->associatedSurface().associatedDetectorElementIdentifier();
if (m_pixelTool->is_trt(id)) innermostTrt = rvit;
if (m_pixelTool->is_pixel(id) || m_SCT_Tool->is_sct(id)) {
// insert one (innermost) TRT hit to allow analysing brem at last SCT layer
if (rxy_old == 0.0 && (innermostTrt != tsos.rend()) ) {
const Trk::EstimatedBremOnTrack* ebr = dynamic_cast<const Trk::EstimatedBremOnTrack*>
((*innermostTrt)->materialEffectsOnTrack());
meanPars.addTrackParsToFloor(*((*innermostTrt)->trackParameters()),0,ebr);
rxy_old = (*innermostTrt)->trackParameters()->position().perp();
}
// define new floor if there was previous one and distance to current large enough
double current_dr = fabs(rxy_old-(*rvit)->trackParameters()->position().perp());
if (rxy_old > 0.0 && (current_dr > m_floorseparation_drr)) {
newPars.push_back(meanPars);
meanPars = Trk::MeanTrackParsAtFloor();
}
// create-new-floor or add-to-average of existing floor
const Trk::EstimatedBremOnTrack* ebr = dynamic_cast<const Trk::EstimatedBremOnTrack*>
((*rvit)->materialEffectsOnTrack());
meanPars.addTrackParsToFloor(*((*rvit)->trackParameters()), 0, ebr);
rxy_old = (*rvit)->trackParameters()->position().perp();
}
}
newPars.push_back(meanPars);
// calculate the significance of the brem objects found on track
return calculateSignificance(newPars).at(0);
}
// *********************************************************************************************
std::vector<double> InDet::InDetDNASeparator::calculateSignificance
(const std::vector<Trk::MeanTrackParsAtFloor> MTPF ) const
{
double sigmax=s_sigmaNoDna, dphmax=-9.0, rasmax=0.0, dnamax=0.0;
double sigf,sigb,sigm,dphb,dphf,dphm,rasf,rasb,rasm,dnam=0.0;
std::vector<double> X = std::vector<double>(4); X.at(0)=s_sigmaNoDna;
if ( MTPF.size() <= 1) {
ATH_MSG_DEBUG ("Number of floors = " << MTPF.size() << " is too small,"
<< " returning 'no breakpoint'.");
return X; // or Trk::NoBreakpoint;
}
double charge = (MTPF.back().pts > 0.0) ? 1.0 : -1.0 ;
unsigned int xfl = MTPF.size();
for(unsigned int ifl=0; ifl<MTPF.size(); ++ifl) {
ATH_MSG_DEBUG ("VATO-SEPARATOR-223-3 xfl ifl nen ras phs ths pts dps dnf dnb pec pfl sec sfl rat drt thr "
<< xfl <<" " << ifl+1 <<" "
<< MTPF[ifl].nen <<" " << MTPF[ifl].ras <<" "
<< MTPF[ifl].phs <<" "
<< MTPF[ifl].ths <<" "
<< MTPF[ifl].pts <<" "
<< MTPF[ifl].dps <<" "
<< MTPF[ifl].dnf <<" "
<< MTPF[ifl].dnb <<" ");
sigf=0.0,sigb=0.0,dphb=0.0,dphf=0.0,dphm=0.0,rasf=0.0,rasb=0.0,rasm=0.0;
sigm=s_sigmaNoDna;
if( (MTPF[ifl].dnb > 0.0) && (ifl+1 < xfl) ) {
// note that a negative sigb,sigf is possible when a mis-reconstruction
// suggests an increasing momentum