ATLAS Offline Software
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):
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 ){
46 void 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 
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 
TrigDefs::Group
Group
Properties of a chain group.
Definition: GroupProperties.h:13
hotSpotInTAG.suffix
string suffix
Definition: hotSpotInTAG.py:186
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
TrigInDetTrackMonitoringTool::~TrigInDetTrackMonitoringTool
virtual ~TrigInDetTrackMonitoringTool()
Definition: TrigInDetTrackMonitoringTool.cxx:22
TrigInDetTrackMonitoringTool.h
xAOD::numberOfPixelHits
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].
Definition: TrackingPrimitives.h:259
xAOD::numberOfTRTHits
@ numberOfTRTHits
number of TRT hits [unit8_t].
Definition: TrackingPrimitives.h:275
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Monitored::Collection
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
Definition: MonitoredCollection.h:38
IDTPM::nSCTHits
float nSCTHits(const U &p)
Definition: TrackParametersHelper.h:393
IDTPM::nTRTHits
float nTRTHits(const U &p)
Definition: TrackParametersHelper.h:446
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
TrigInDetTrackMonitoringTool::TrigInDetTrackMonitoringTool
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...
Definition: TrigInDetTrackMonitoringTool.cxx:12
TauGNNUtils::Variables::Track::trackPt
bool trackPt(const xAOD::TauJet &, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:472
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TrigInDetTrackMonitoringTool::monitor_tracks
void monitor_tracks(const std::string &prefix, const std::string &suffix, const xAOD::TrackParticleContainer &tracks) const
Definition: TrigInDetTrackMonitoringTool.cxx:46
TrigInDetTrackMonitoringTool::initialize
virtual StatusCode initialize() final
Definition: TrigInDetTrackMonitoringTool.cxx:27
TrigInDetTrackMonitoringTool::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: TrigInDetTrackMonitoringTool.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
plotBeamSpotMon.mon
mon
Definition: plotBeamSpotMon.py:67
xAOD::numberOfSCTHits
@ numberOfSCTHits
number of hits in SCT [unit8_t].
Definition: TrackingPrimitives.h:268
TauGNNUtils::Variables::Track::trackPhi
bool trackPhi(const xAOD::TauJet &, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:482
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
AthAlgTool
Definition: AthAlgTool.h:26
TrigInDetTrackMonitoringTool::finalize
virtual StatusCode finalize() final
Definition: TrigInDetTrackMonitoringTool.cxx:37
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
TauGNNUtils::Variables::Track::trackEta
bool trackEta(const xAOD::TauJet &, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:477