ATLAS Offline Software
Loading...
Searching...
No Matches
TrigInDetTrackMonitoringTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "TMath.h"
7#include<iostream>
8
9//#include "TrigInterfaces/Algo.h"
10//
11//Constructor--------------------------------------------------------------
13 const std::string& name,
14 const IInterface* parent):
15 AthAlgTool(type,name,parent)
16{
18 //declareProperty( "MonitoringTool", m_monTool );
19}
20
21//Destructor---------------------------------------------------------------
23 ATH_MSG_DEBUG( "TrigInDetTrackMonitoringTool destructor called");
24}
25
26//Initialize---------------------------------------------------------------
28 ATH_MSG_DEBUG( "TrigInDetTrackMonitoringTool initialize() called");
29
30 //Retrieve monitoring tool
31 if (!m_monTool.empty()) ATH_CHECK(m_monTool.retrieve());
32
33 return StatusCode::SUCCESS;
34
35}
36
38 ATH_MSG_DEBUG("TrigInDetTrackMonitoringTool finalize()");
39 return StatusCode::SUCCESS;
40}
41
42
43//Monitoring track variables
44//void TrigInDetTrackMonitoringTool::monitor_tracks(std::string prefix, std::string suffix, DataVector<xAOD::TrackParticle> tracks ){
45//void TrigInDetTrackMonitoringTool::monitor_tracks( const std::string &prefix, const std::string &suffix, const xAOD::TrackParticleContainer &tracks ){
46void TrigInDetTrackMonitoringTool::monitor_tracks( const std::string &prefix, const std::string &suffix, const xAOD::TrackParticleContainer &tracks ) const {
47 auto trackPt = Monitored::Collection( prefix + "Pt" + suffix, tracks, [](const xAOD::TrackParticle *t){ return t->pt() * 0.001;});
48 auto trackQOverP = Monitored::Collection( prefix + "QOverP" + suffix, tracks, [](const xAOD::TrackParticle *t){ return t->qOverP() * 1000;});
49 auto trackQPt = Monitored::Collection( prefix + "QPt" + suffix, tracks, [](const xAOD::TrackParticle *t){ return t->pt() * 0.001 * (t->qOverP() > 0 ? 1.0 : -1.0);});
50 auto trackEta = Monitored::Collection( prefix + "Eta" + suffix, tracks, [](const xAOD::TrackParticle *t){ return t->eta();});
51 auto trackPhi = Monitored::Collection( prefix + "Phi" + suffix, tracks, [](const xAOD::TrackParticle *t){ return t->phi();});
52 auto trackTheta = Monitored::Collection( prefix + "Theta" + suffix, tracks, [](const xAOD::TrackParticle *t){ return t->theta();});
53 auto trackZ0 = Monitored::Collection( prefix + "Z0" + suffix, tracks, [](const xAOD::TrackParticle *t){ return t->z0();});
54 auto trackD0 = Monitored::Collection( prefix + "D0" + suffix, tracks, [](const xAOD::TrackParticle *t){ return t->d0();});
55//TODO: append later if needed
56// auto trackZ0err = Monitored::Collection( prefix + "Z0err" + suffix, tracks, [](const xAOD::TrackParticle *t){ return t->Z0err() ;});
57// auto trackD0err = Monitored::Collection( prefix + "D0err" + suffix, tracks, [](const xAOD::TrackParticle *t){ return t->D0err() ;});
58// auto trackQual = Monitored::Collection( prefix + "Qual" + suffix, tracks, [](const xAOD::TrackParticle *t){ return t->Qual() ;});
59//
60 auto trackNDF = Monitored::Collection( prefix + "NDF" + suffix, tracks, [](const xAOD::TrackParticle *t){ return t->numberDoF();});
61 auto trackChi2Prob= Monitored::Collection( prefix + "Chi2Prob" + suffix, tracks, [](const xAOD::TrackParticle *t){ return t->chiSquared();});
62
63 //Hits in the layiers
64 auto trackPiHits = Monitored::Collection( prefix + "PIXHits" + suffix, tracks, [](const xAOD::TrackParticle *t){ uint8_t nPixHits = 0; t->summaryValue( nPixHits, xAOD::numberOfPixelHits); return nPixHits ;});
65 auto trackSCTHits = Monitored::Collection( prefix + "SCTHits" + suffix, tracks, [](const xAOD::TrackParticle *t){ uint8_t nSCTHits = 0; t->summaryValue( nSCTHits, xAOD::numberOfSCTHits); return nSCTHits ;});
66
67 auto trackTRTHits = Monitored::Collection( prefix + "TRTHits" + suffix, tracks, [](const xAOD::TrackParticle *t){ uint8_t nTRTHits = 0; t->summaryValue( nTRTHits, xAOD::numberOfTRTHits); return nTRTHits ;});
68
69 // This track counting still doesn't fill histogram
70 auto trkCount = Monitored::Scalar( prefix + "Counting" + suffix, tracks.size());
71
72 //If needed add more monitored values from:
73 //https://gitlab.cern.ch/atlas/athena/-/blob/master/Tracking/TrkTools/TrkParticleCreator/src/TrackParticleCreatorTool.cxx
74
75 auto mon = Monitored::Group(m_monTool,
76 trackPt, trackEta, trackQOverP, trackQPt, trackPhi, trackTheta, trackD0 ,trackZ0, trackNDF, trackChi2Prob,
77 trackPiHits, trackSCTHits, trackTRTHits, //Hits in the det layers
78 trkCount
79 );
80}
81
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
size_type size() const noexcept
Returns the number of elements in the collection.
Group of local monitoring quantities and retain correlation when filling histograms
Declare a monitored scalar variable.
TrigInDetTrackMonitoringTool(const std::string &type, const std::string &name, const IInterface *parent)
This class implements the monitoring for the online track (xAODTrackParticles to be precise) paramete...
ToolHandle< GenericMonitoringTool > m_monTool
void monitor_tracks(const std::string &prefix, const std::string &suffix, const xAOD::TrackParticleContainer &tracks) const
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
@ numberOfTRTHits
number of TRT hits [unit8_t].
@ numberOfSCTHits
number of hits in SCT [unit8_t].
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].