Commit 0a9b2ef9 authored by Nicholas Styles's avatar Nicholas Styles Committed by Graeme Stewart
Browse files

update for run 2 (TrkTrackSummary-00-23-03)

parent b33fe1cf
This package contains the Trk::Track summary object. This object is
used to store information about the Track, such as the number of pixel hits/holes etc.
Use TrkSummaryTool to get TrackSummary objects from a Track.
Edward Moyse (edward.moyse@cern.ch)
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TRK_INDETTRACKSUMMARY_H
#define TRK_INDETTRACKSUMMARY_H
#include "Identifier/Identifier.h"
class MsgStream;
namespace InDet {
class InDetTrackSummaryHelperTool;
}
namespace Trk {
/**
Detailed track summary for the indet system
*/
class InDetTrackSummary {
public:
friend class InDet::InDetTrackSummaryHelperTool;
/** default constructor */
InDetTrackSummary();
/** destructor */
~InDetTrackSummary();
/** access to the vector of likelihoods (pion/kaon/proton) */
const std::vector<float>& likelihoodsPixeldEdx() const { return m_likelihoodspixeldedx; }
/** access to mass calculated using pixel dEdx */
float massPixeldEdx() const { return m_massdedx; }
private:
std::vector<float> m_likelihoodspixeldedx; //<! vector with likelihoods
float m_massdedx; //<! mass calculated using pixel dEdx
};
/**output. This dumps the values of each of the possible summary enums*/
MsgStream& operator<<(MsgStream& out, const InDetTrackSummary& trackSum);
/**output. This dumps the values of each of the possible summary enums*/
std::ostream& operator<<(std::ostream& out, const InDetTrackSummary& trackSum);
}
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TRK_MUONTRACKSUMMARY_H
#define TRK_MUONTRACKSUMMARY_H
#include "Identifier/Identifier.h"
class MsgStream;
namespace Muon {
class MuonTrackSummaryHelperTool;
}
namespace Trk {
/**
Detailed track summary for the muon system
Give access to hit counts per chamber.
*/
class MuonTrackSummary {
public:
friend class Muon::MuonTrackSummaryHelperTool;
/** structure to hold information per chamber in the muon system */
struct ChamberHitSummary {
friend class Muon::MuonTrackSummaryHelperTool;
/** structure to hold the information for the eta/phi projection of RPC, TGC and CSC
chambers and per multilayer for MDT chambers */
struct Projection {
Projection() : nhits(0),nholes(0),noutliers(0),ndeltas(0), ncloseHits(0){}
int nhits; //<! number of hits on track in the projection
int nholes; //<! number of holes in the projection
int noutliers; //<! number of outliers in the projection
int ndeltas; //<! number of delta electrons in the projection (only filled for MDT chambers)
int ncloseHits; //<! number of hits within a road around the track in the projection
};
ChamberHitSummary( ) {}
/** constructor taking the Identifier of the chamber and a boolean whether we are dealing with a MDT chamber or not
(the boolean is passed as the ChamberHitSummary cannot unpack the identifier and it needs to know whether it is dealing
with a MDT chamber) */
ChamberHitSummary( Identifier chID, bool isMdtTube ) : m_chId(chID),m_isMdt(isMdtTube) {}
/** returns the chamber identifier */
const Identifier& chamberId() const { return m_chId; }
/** returns whether this is a MDT chamber */
bool isMdt() const { return m_isMdt; }
/** returns the total number of hits on track in the chamber */
int nhits() const { return first.nhits + second.nhits; }
/** returns the total number of holes in the chamber */
int nholes() const { return first.nholes + second.nholes; }
/** returns the total number of outliers in the chamber */
int noutliers() const { return first.noutliers + second.noutliers; }
/** returns the total number of delta electrons in the chamber */
int ndeltas() const { return first.ndeltas + second.ndeltas; }
/** returns the total number of close hits in the chamber */
int ncloseHits() const { return first.ncloseHits + second.ncloseHits; }
/** returns the total number of eta hits on track in the chamber */
int netaHits() const { return isMdt() ? nhits() : first.nhits; }
/** returns the total number of phi hits on track in the chamber */
int nphiHits() const { return isMdt() ? 0 : second.nhits; }
/** returns the total number of MDT hits on track in the first multi layer */
int nMdtHitsMl1() const { return isMdt() ? first.nhits : 0; }
/** returns the total number of MDT hits on track in the second multi layer */
int nMdtHitsMl2() const { return isMdt() ? second.nhits : 0; }
/** access to the data of the first MDT multi layer, users have to check whether this is a MDT chamber first!! */
const Projection& mdtMl1() const { return first; }
/** access to the data of the second MDT multi layer, users have to check whether this is a MDT chamber first!! */
const Projection& mdtMl2() const { return second; }
/** access to the data of the eta projection, users have to check whether this is NOT a MDT chamber first!! */
const Projection& etaProjection() const { return first; }
/** access to the data of the phi projection, users have to check whether this is NOT a MDT chamber first!! */
const Projection& phiProjection() const { return second; }
private:
Identifier m_chId; //<! chamber identifier
bool m_isMdt; //<! is this a MDT chamber
Projection first; //<! eta projections for cluster chambers, first multi layer for mdt chambers
Projection second; //<! phi projections for cluster chambers, first multi layer for mdt chambers
};
/** default constructor */
MuonTrackSummary();
/** destructor */
~MuonTrackSummary();
/** number of eta hits on the track */
unsigned int netaHits() const;
/** number of phi hits on the track */
unsigned int nphiHits() const;
/** number of eta trigger hits on the track */
unsigned int noutliers() const;
/** number of holes on the track */
unsigned int nholes() const;
/** number of holes on the track */
unsigned int ncloseHits() const;
/** number of scattering centres on the track */
unsigned int nscatterers() const { return m_nscatterers; }
/** number of pseudo measurements on the track */
unsigned int npseudoMeasurements() const { return m_npseudoMeasurements; }
/** access to the vector of chamber hit summaries on the track */
const std::vector<ChamberHitSummary>& chamberHitSummary() const { return m_chamberHitSummary; }
private:
unsigned int m_nscatterers; //<! number of scattering centres on the track
unsigned int m_npseudoMeasurements; //<! number of pseudomeasurements on the track
std::vector<ChamberHitSummary> m_chamberHitSummary; //<! vector with chamber hit summaries
};
/**output. This dumps the values of each of the possible summary enums*/
MsgStream& operator<<(MsgStream& out, const MuonTrackSummary& trackSum);
/**output. This dumps the values of each of the possible summary enums*/
std::ostream& operator<<(std::ostream& out, const MuonTrackSummary& trackSum);
}
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TRKSUMMARYDICT_H
#define TRKSUMMARYDICT_H
#include "TrkTrackSummary/TrackSummary.h"
#endif
/***************************************************************************
Summary.h - description
-------------------
begin : Tue Feb 17 2004
copyright : (C) 2004 by emoyse
email : edward.moyse@cern.ch
***************************************************************************/
#ifndef TRKTRACKSUMMARY_H
#define TRKTRACKSUMMARY_H
#include <vector>
#include <iostream>
#include <bitset>
class MsgStream;
namespace InDet {
class InDetTrackSummaryHelperTool;
}
namespace Muon {
class MuonTrackSummaryHelperTool;
}
namespace Trk {
//forward declarations
class Track;
class InDetTrackSummary;
class MuonTrackSummary;
/** enumerates the different types of information stored in Summary. Use in get(const SummaryType type), for for example, summary.get(numOfPixelHits)
When adding a new transient information type, please make sure to increase numberOfTrackSummaryTypes.*/
enum SummaryType {
// --- Inner Detector
numberOfContribPixelLayers =29, //!< number of contributing layers of the pixel detector
numberOfBLayerHits = 0, //!< these are the hits in the first pixel layer, i.e. b-layer
numberOfBLayerOutliers =31, //!< number of blayer outliers
numberOfBLayerSharedHits =16, //!< number of Pixel b-layer hits shared by several tracks.
numberOfBLayerSplitHits =43, //!< number of Pixel b-layer hits split by cluster splitting
expectBLayerHit =42, //!< Do we expect a b-layer hit for this track?
numberOfPixelHits = 2, //!< these are the pixel hits, including the b-layer
numberOfPixelOutliers =41, //!< these are the pixel outliers, including the b-layer
numberOfPixelHoles = 1, //!< number of pixel layers on track with absence of hits
numberOfPixelSharedHits =17, //!< number of Pixel all-layer hits shared by several tracks.
numberOfPixelSplitHits =44, //!< number of Pixel all-layer hits split by cluster splitting
numberOfGangedPixels =14, //!< number of pixels which have a ganged ambiguity.
numberOfGangedFlaggedFakes =32, //!< number of Ganged Pixels flagged as fakes
numberOfPixelDeadSensors =33, //!< number of dead pixel sensors crossed
numberOfPixelSpoiltHits =35, //!< number of pixel hits with broad errors (width/sqrt(12))
numberOfSCTHits = 3, //!< number of hits in SCT
numberOfSCTOutliers =39, //!< number of SCT outliers
numberOfSCTHoles = 4, //!< number of SCT holes
numberOfSCTDoubleHoles =28, //!< number of Holes in both sides of a SCT module
numberOfSCTSharedHits =18, //!< number of SCT hits shared by several tracks.
numberOfSCTDeadSensors =34, //!< number of dead SCT sensors crossed
numberOfSCTSpoiltHits =36, //!< number of SCT hits with broad errors (width/sqrt(12))
numberOfTRTHits = 5, //!< number of TRT hits
numberOfTRTOutliers =19, //!< number of TRT outliers
numberOfTRTHoles =40, //!< number of TRT holes
numberOfTRTHighThresholdHits = 6, //!< number of TRT hits which pass the high threshold (only xenon counted)
numberOfTRTHighThresholdOutliers=20, //!< number of TRT high threshold outliers (only xenon counted)
numberOfTRTDeadStraws =37, //!< number of dead TRT straws crossed
numberOfTRTTubeHits =38, //!< number of TRT tube hits
numberOfTRTXenonHits =46, //!< number of TRT hits on track in straws with xenon
// --- Muon Spectrometer
numberOfMdtHits = 7, //!< number of mdt hits
numberOfTgcPhiHits = 8, //!< tgc, rpc and csc measure both phi and eta coordinate
numberOfTgcEtaHits = 9,
numberOfCscPhiHits =10,
numberOfCscEtaHits =11,
numberOfRpcPhiHits =12,
numberOfRpcEtaHits =13,
numberOfCscEtaHoles =21, //! number of CSC Eta measurements missing from the track
numberOfCscPhiHoles =22, //! number of CSC Phi measurements missing from the track
numberOfRpcEtaHoles =23, //! number of RPC Eta measurements missing from the track
numberOfRpcPhiHoles =24, //! number of RPC Phi measurements missing from the track
numberOfMdtHoles =25, //! number of MDT measurements missing from the track
numberOfTgcEtaHoles =26, //! number of TGC Eta measurements missing from the track
numberOfTgcPhiHoles =27, //! number of TGC Phi measurements missing from the track
numberOfCscUnspoiltEtaHits =45, //! number of unspoilt CSC eta measurements (all CSC phi measurements are by definition spoilt). See Muon::CscClusterStatus for definitions of 'spoiled' hits.
// --- all
numberOfOutliersOnTrack =15, //!< number of measurements flaged as outliers in TSOS
standardDeviationOfChi2OS = 30, //!< 100 times the standard deviation of the chi2 from the surfaces
// -- numbers...
numberOfTrackSummaryTypes = 47
};
// Troels.Petersen@cern.ch:
enum eProbabilityType {
eProbabilityComb = 0, //!< Electron probability from combining the below probabilities.
eProbabilityHT = 1, //!< Electron probability from High Threshold (HT) information.
eProbabilityToT = 2, //!< Electron probability from Time-Over-Threshold (ToT) information.
eProbabilityBrem = 3, //!< Electron probability from Brem fitting (DNA).
numberOfeProbabilityTypes = 4
};
/** enumerates the various detector types currently accessible from the isHit() method.
\todo work out how to add muons to this*/
enum DetectorType {
pixelBarrel0 = 0, //!< there are three pixel barrel layers
pixelBarrel1 = 1,
pixelBarrel2 = 2,
pixelBarrel3 = 3,
pixelEndCap0 = 4, //!< three pixel discs (on each side)
pixelEndCap1 = 5,
pixelEndCap2 = 6,
sctBarrel0 = 7, //!< four sct barrel layers
sctBarrel1 = 8,
sctBarrel2 = 9,
sctBarrel3 = 10,
sctEndCap0 = 11, //!< and 9 sct discs (on each side)
sctEndCap1 = 12,
sctEndCap2 = 13,
sctEndCap3 = 14,
sctEndCap4 = 15,
sctEndCap5 = 16,
sctEndCap6 = 17,
sctEndCap7 = 18,
sctEndCap8 = 19,
trtBarrel = 20,
trtEndCap = 21,
numberOfDetectorTypes = 22
};//not complete yet
/**A summary of the information contained by a track.
If there is information missing, or if I could add useful methods then let me know. I have deliberately tried to keep this as simple as possible, whilst allowing for future expansion.
A recent addition is the isHit() method. This is analogous to the old 'hit patterns' in that you can use it to check if a specific sub-detector element has been hit by the track.
For example, you could do:
if (summary.isHit(Trk::pixelBarrel0) ) callSomething();
Please note that this class does NO error checking - i.e. it would be possible for someone to fill this object in an inconsistent manner and it would not be caught.
@author Edward.Moyse@cern.ch
*/
class TrackSummary
{
public:
friend class InDet::InDetTrackSummaryHelperTool;
friend class Muon::MuonTrackSummaryHelperTool;
/** Value set in the cxx file to -1. If any of the values returned by get(const SummaryType& type)==SummaryTypeNotSet then this means that
the information has not been filled. i.e. ID information cannot be filled if the TrackSummaryTool does not have access to the InDetTrackSummaryHelperTool*/
static const int SummaryTypeNotSet;
/**needed by POOL*/
TrackSummary();
/**ctor should probably only be called by TrkSummaryTool.
@param information The vector passed should be complete
i.e. it should be the size required by m_numSummaryTypes, and any undefined
values should be set to -1. The vector should be filled using SummaryType to select the
position of the information.
@param hitPattern this bitset should be filled using the DetectorType enum.
True indicates that a sub-detector was hit*/
TrackSummary(
const std::vector<int>& information,
const std::vector<float>& eProbability,
std::bitset<numberOfDetectorTypes>& hitPattern,
float dedx=-1,
int nhitsuseddedx=-1
);
/** copy ctor*/
TrackSummary( const TrackSummary& rhs );
virtual ~TrackSummary();
/** returns the summary information for the passed SummaryType.
@param type Use the provided enums to access it, i.e. by summary.get(numberOfPixelHits)
@return returns -1 if the enum is undefined (i.e. the information was not available in the
Track, or (more likely) Trk::TrkTrackSummaryTool is not filling it yet)*/
int get(const SummaryType& type) const;
/** returns the probability information for the passed ProbabilityType.
@param type Use the provided enums to access it, i.e. by summary.getPID(eProbabilityComb)
@return returns -1 if the enum is undefined (i.e. the information was not available in the
Track, or (more likely) Trk::TrkTrackSummaryTool is not filling it yet)*/
// Troels.Petersen@cern.ch:
float getPID(const eProbabilityType& PIDtype) const;
/** returns the dE/dx estimate, calculated using the pixel clusters */
float getPixeldEdx() const;
int numberOfUsedHitsdEdx() const;
/** returns true if the detector type 'type' is hit.
@param type Please use the DetectorType enum to access the information (the internal
positions may change!)
@return true if sub-detector 'type' is hit*/
bool isHit(const DetectorType& type) const ;
/** returns a pointer to the InDetTrackSummary if available */
const InDetTrackSummary* indetTrackSummary() const;
/** returns a pointer to the MuonTrackSummary if available */
const MuonTrackSummary* muonTrackSummary() const;
/**return number of parameters currently created*/
static unsigned int numberOfInstantiations() ;
/** adds the values of the passed TrackSummary to this TrackSummary. Mainly intended for
adding Muon and ID TrackSummaries, when making a combined Track for example
WARNING: may not make much sense for e.g. Trk::numberOfContribPixelLayers*/
TrackSummary& operator+=(const TrackSummary& ts);
/** assignment operator */
TrackSummary& operator=(const TrackSummary&);
private: // data members
/** vector containing the persistent summary information. */
std::vector<int> m_information;
/** vector containing the persistent summary information. */
// Troels.Petersen@cern.ch:
std::vector<float> m_eProbability;
/** contains the dE/dx information, calculated using the pixel clusters */
float m_dedx;
int m_nhitsdedx;
/**contains the 'hit pattern'*/
unsigned long m_idHitPattern;
/** number of objects of this type in memory */
static unsigned int s_numberOfInstantiations;
/** pointer to the InDetTrackSummary */
const InDetTrackSummary* m_indetTrackSummary;
/** pointer to the MuonTrackSummary */
const MuonTrackSummary* m_muonTrackSummary;
};
inline int Trk::TrackSummary::get(const Trk::SummaryType& type) const
{
return m_information.at(type);
}
// Troels.Petersen@cern.ch:
inline float Trk::TrackSummary::getPID(const Trk::eProbabilityType& PIDtype) const
{
return m_eProbability[PIDtype];
}
inline float Trk::TrackSummary::getPixeldEdx() const
{
return m_dedx;
}
inline int Trk::TrackSummary::numberOfUsedHitsdEdx() const
{
return m_nhitsdedx;
}
inline bool Trk::TrackSummary::isHit(const Trk::DetectorType& type) const
{
// no range checking because people should be using enums
return (m_idHitPattern&(1<<static_cast<unsigned int>(type)));
}
inline const Trk::InDetTrackSummary* Trk::TrackSummary::indetTrackSummary() const {
return m_indetTrackSummary;
}
inline const Trk::MuonTrackSummary* Trk::TrackSummary::muonTrackSummary() const {
return m_muonTrackSummary;
}
/**output. This dumps the values of each of the possible summary enums*/
MsgStream& operator<<(MsgStream& out, const TrackSummary& trackSum);
/**output. This dumps the values of each of the possible summary enums*/
std::ostream& operator<<(std::ostream& out, const TrackSummary& trackSum);
}
#endif
<lcgdict>
<enum pattern="Trk::*"/>
<class name="Trk::TrackSummary" >
<field name="s_numberOfInstantiations" transient="true" />
<field name="m_information" transient="false" />
<field name="m_idHitPattern" transient="false" />
</class>
</lcgdict>
package TrkTrackSummary
author Edward Moyse <Edward.Moyse@cern.ch>
manager Edward Moyse <Edward.Moyse@cern.ch>
private
use GaudiInterface GaudiInterface-* External
public
use AtlasPolicy AtlasPolicy-*
use Identifier Identifier-* DetectorDescription
library TrkTrackSummary *.cxx
apply_pattern installed_library
private
use AtlasReflex AtlasReflex-* External
# Pattern to build the dict lib. User should create a single header
# file: <package>Dict.h which includes all other .h files. See MissingETDict
# A selection file must be created by hand. This file lists the
# classes to be added to the dictionary, and which fields are
# transient. It should be put in ../<package> dir and is conventionally called
# selection.xml.
apply_pattern lcgdict dict=TrkTrackSummary selectionfile=selection.xml headerfiles="../TrkTrackSummary/SummaryDict.h"
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/**
@mainpage TrkTrackSummary Package
@author Edward.Moyse@cern.ch
The TrkTrackSummary package contains the Trk::TrackSummary class, designed to provide summary information about a Trk::Track. It is generated using
the Trk::TrackSummaryTool of the package TrkTrackSummaryTool.
@section used_packagesTkPara Used Packages
@htmlinclude used_packages.html
@section requirements Requirements
@include requirements
*/
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "TrkTrackSummary/InDetTrackSummary.h"
#include <iostream>
#include "GaudiKernel/MsgStream.h"
Trk::InDetTrackSummary::InDetTrackSummary() :
m_likelihoodspixeldedx(3,-1),
m_massdedx(-1){
}
Trk::InDetTrackSummary::~InDetTrackSummary() {
}
std::ostream& Trk::operator<<( std::ostream& out, const InDetTrackSummary& trackSum )
{