16#include "GaudiKernel/TypeNameString.h"
17#include "GaudiKernel/ITHistSvc.h"
86 declareInterface<ITrackDiff>(
this);
113 SmartIF<ITHistSvc> tHistSvc{service(
"THistSvc")};
132 m_nt->Branch(
"nFakeStates", &
m_fakes,
"nFakeStates[8]/I");
133 m_nt->Branch(
"nMissedStates", &
m_missed,
"nMissedStates[8]/I");
154 m_surfX =
new std::vector<float>();
155 m_surfY =
new std::vector<float>();
156 m_surfZ =
new std::vector<float>();
183 return StatusCode::FAILURE;
201 return StatusCode::SUCCESS;
217 return StatusCode::SUCCESS;
233 if (!evt.isValid()) {
235 return StatusCode::FAILURE;
256 ATH_MSG_VERBOSE (
"number of track states: ref=" << refTrackStateData->
size() <<
", compare=" << compareTrackStateData->
size() );
265 for (; refIter != refTrackStateData->
end(); ++refIter) {
270 bool foundMatchingState =
false;
274 if ((*refIter)->rot()) {
275 refPRD = (*refIter)->rot()->prepRawData();
277 compIter = compareTrackStateData->
begin();
278 for ( ; compIter != compareTrackStateData->
end(); ++compIter ) {
280 if ( (*compIter)->surface() == (*refIter)->surface() ) {
282 foundMatchingState =
true;
290 }
else if ( refPRD && (*compIter)->rot() ) {
294 if ( refPRD == ((*compIter)->rot()->prepRawData()) ) {
296 foundMatchingState =
true;
304 if (!foundMatchingState) {
311 compareTrackStateData->
erase(compIter);
317 compIter = compareTrackStateData->
begin();
318 for (; compIter != compareTrackStateData->
end(); ++compIter) {
339 delete refTrackStateData;
340 delete compareTrackStateData;
341 return StatusCode::SUCCESS;
350 ATH_MSG_ERROR (
"track containes no track states, diff impossible" );
361 for (; iter != trackStates->
end(); ++iter) {
383 ATH_MSG_ERROR (
"measurementOnTrack == Null for a TrackStateOnSurface "
384 <<
"of type Measurement or Outlier" );
389 (*iter)->trackParameters()->associatedSurface();
411 std::string detTypeName =
"unidentified";
426 return trackStateData;
489 std::string &detTypeName )
const {
494 if (
id.is_valid()) {
496 detTypeName =
"Pixel";
518 detTypeName =
"unidentified";
526 bool foundDiff =
false;
529 bool isMissing =
false;
530 bool isPRD_Mismatch =
false;
531 bool isFlippedSign =
false;
532 bool isNoDriftTime =
false;
533 bool refIsMeasurement =
false;
534 bool refIsOutlier =
false;
535 bool compIsMeasurement =
false;
536 bool compIsOutlier =
false;
537 bool wrongType =
false;
538 std::string detTypeName =
"unidentified";
548 if (!compareTrackState) {
556 detType = refTrackState->
detType();
560 else if (compareTrackState) {
565 detType = compareTrackState->
detType();
568 if (compareTrackState){
576 if (refTrackState && compareTrackState) {
591 if (refIsMeasurement != compIsMeasurement ) {
594 if (refIsMeasurement) {
605 if (refROT && compareROT) {
607 isPRD_Mismatch =
true;
616 foundDiff = (foundDiff || isPRD_Mismatch || isFlippedSign || isNoDriftTime );
624 msg(MSG::DEBUG) <<
"Diff:";
625 if (isFake){
msg(MSG::DEBUG) <<
" -- ";}
626 else {
msg(MSG::DEBUG) << (refIsOutlier ?
" O" :
" ") << (refIsMeasurement ?
"M " :
" ");}
627 if (isMissing){
msg(MSG::DEBUG) <<
" -- ";}
628 else {
msg(MSG::DEBUG) << (compIsOutlier ?
" O" :
" ") << (compIsMeasurement ?
"M " :
" ");}
629 msg(MSG::DEBUG) << (isFake ?
" FakeState " :
"")
630 << (isMissing ?
" MissingState " :
"")
631 << (wrongType ?
" Wrong TSoS type" :
"")
632 << (isPRD_Mismatch ?
" PRD mismatch " :
"")
633 << (isFlippedSign ?
" Flipped Sign " :
"")
634 << (isNoDriftTime ?
" NoDriftTime " :
"")
635 <<
" in " << detTypeName
636 <<
" detector at surface with center " <<
endmsg;
646 ATH_MSG_DEBUG (
"(" << surfX <<
", " << surfY <<
"," << surfZ <<
")");
650 float maxAssgnProb = -1.;
651 float sumAssgnProb = -1.;
652 if (compareTrackState) {
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() const
DataModel_detail::const_iterator< DataVector > const_iterator
value_type push_back(value_type pElem)
Add an element to the end of the collection.
DataModel_detail::iterator< DataVector > iterator
Standard iterator.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
iterator erase(iterator position)
Remove element at a given position.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
Base class for all CompetingRIOsOnTack implementations, extends the common MeasurementBase.
AssignmentProb assignmentProbability(unsigned int indx) const
returns the AssignmentProbability depending on the integer.
virtual unsigned int numberOfContainedROTs() const =0
Number of RIO_OnTracks to be contained by this CompetingRIOsOnTrack.
unsigned int indexOfMaxAssignProb() const
Index of the ROT with the highest assignment probability.
virtual const RIO_OnTrack & rioOnTrack(unsigned int) const =0
returns the RIO_OnTrack (also known as ROT) objects depending on the integer.
This class is the pure abstract base class for all fittable tracking measurements.
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
virtual const Surface & associatedSurface() const =0
Interface method to get the associated Surface.
double eta() const
Access method for pseudorapidity - from momentum.
Class to handle RIO On Tracks ROT) for InDet and Muons, it inherits from the common MeasurementBase.
virtual const Trk::PrepRawData * prepRawData() const =0
returns the PrepRawData (also known as RIO) object to which this RIO_OnTrack is associated.
Identifier identify() const
return the identifier -extends MeasurementBase
Abstract Base Class for tracking surfaces.
const Amg::Vector3D & center() const
Returns the center position of the Surface.
int m_PRD_Mismatches[Trk::TrackState::NumberOfMeasurementTypes]
std::vector< int > * m_isNoDriftTime
int m_driftCircleSignFlips
TrackDiff(const std::string &, const std::string &, const IInterface *)
SG::ReadHandleKey< xAOD::EventInfo > m_evt
StatusCode finalize()
finalize
std::vector< int > * m_compIsOutlier
int m_nRefStates[Trk::TrackState::NumberOfMeasurementTypes]
int m_missed[Trk::TrackState::NumberOfMeasurementTypes]
std::vector< int > * m_isFake
vector<bool> would be more efficient, but vector<bool> is not a normal vector<> and seems to make tro...
int m_wrongTypeSum[Trk::TrackState::NumberOfMeasurementTypes]
std::vector< float > * m_sumAssignProb
int m_refType[Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes]
std::string m_ntupleTreeName
jobOption: Ntuple tree name
int m_fakeType[Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes]
Trk::TrackState::MeasurementType detectorType(const Trk::RIO_OnTrack &ROT, std::string &detTypeName) const
get detector type and name by identifier of Trk::RIO_OnTrack
bool m_compareOutliers
jobOption: compare track states of type "outlier"
int m_missedSum[Trk::TrackState::NumberOfMeasurementTypes]
std::vector< int > * m_isPRD_Mismatch
int m_PRD_MismatchesSum[Trk::TrackState::NumberOfMeasurementTypes]
std::vector< int > * m_detectorType
int m_wrongType[Trk::TrackState::NumberOfMeasurementTypes]
int m_fakesSum[Trk::TrackState::NumberOfMeasurementTypes]
bool m_compareAll
jobOption: compare track states of all types
std::string m_ntupleDirName
jobOption: Ntuple directory name
int m_nCompStatesSum[Trk::TrackState::NumberOfMeasurementTypes]
int m_compareType[Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes]
std::string m_ntupleFileName
jobOption: Ntuple file name
std::vector< float > * m_surfZ
int m_missingType[Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes]
TTree * m_nt
Pointer to the NTuple tree.
std::vector< float > * m_maxAssignProb
std::vector< int > * m_compIsMeasurement
bool m_writeCompetingROT
jobOption: write data about TrkCompetingRIOsOnTrack?
DataVector< const Trk::TrackStateData > * extractDataFromTrack(const Trk::Track &) const
extract data from a Trk::Track into a list of Trk::TrackStateData
std::vector< int > * m_isMissing
int m_fakes[Trk::TrackState::NumberOfMeasurementTypes]
AtlasDetectorID * m_idHelper
Used to find out the sub-det from PRD->identify().
std::vector< int > * m_isFlippedSign
std::vector< float > * m_surfX
virtual StatusCode diff(const Trk::Track &referenceTrack, const Trk::Track &comparedTrack)
diff of two given tracks
std::vector< float > * m_surfY
std::vector< int > * m_refIsMeasurement
bool diffStateInfo(const Trk::TrackStateData *refTrackStateData, const Trk::TrackStateData *compareTrackStateData)
diff of two given track state data
int m_nRefStatesSum[Trk::TrackState::NumberOfMeasurementTypes]
std::vector< int > * m_refIsOutlier
bool m_writeNtuple
jobOption: write data to ntuple?
int m_nCompStates[Trk::TrackState::NumberOfMeasurementTypes]
void resetVariables()
reset the ntuple variables
Helper class for Trk::TrackDiff.
const std::string & detTypeName() const
return detector type name
const Trk::TrackStateOnSurface * trackStateOnSurface() const
assignment operator
const TrackState::MeasurementType & detType() const
return dectector type
const Trk::RIO_OnTrack * rot() const
return Trk::RIO_OnTrack pointer
const Trk::Surface * surface() const
return Trk::Surface pointer
bool type(const TrackStateOnSurfaceType type) const
Use this method to find out if the TSoS is of a certain type: i.e.
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
@ NumberOfTrackStateOnSurfaceTypes
@ Outlier
This TSoS contains an outlier, that is, it contains a MeasurementBase/RIO_OnTrack which was not used ...
const Perigee * perigeeParameters() const
return Perigee.
MeasurementType
enum describing the flavour of MeasurementBase
@ NumberOfMeasurementTypes
DataVector< const Trk::TrackStateOnSurface > TrackStates