ATLAS Offline Software
HIMonitoringMuonsTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3  */
4 
5 
6 
10 #include "xAODMuon/MuonContainer.h"
11 
13  HIMonitoringMuonsTool(const std::string& type, const std::string& name,
14  const IInterface* parent) : ManagedMonitorToolBase(type, name, parent) {
15 }
16 
18 }
19 
20 // Description: Used for rebooking unmanaged histograms
22  return StatusCode::SUCCESS;
23 }
24 
25 // Description: Used for re-booking managed histograms
28  // book histograms that are only made in the online environment...
29  }
30 
32  // book histograms that are only relevant for cosmics data...
33  }
34 
35  book_hist();
36 
37 
38  return StatusCode::SUCCESS;
39 }
40 
42  StatusCode sc;
43 
45  const xAOD::HIEventShapeContainer* evtShape;
46 
47  sc = evtStore()->retrieve(evtShape, "HIEventShape");
48  if (sc.isFailure()) {
49  ATH_MSG_ERROR("Could not find HIEventShape");
50  return StatusCode::FAILURE;
51  } else {
52  ATH_MSG_INFO("HIEventShape retrieved from StoreGate");
53  }
54 
55 
56  const xAOD::MuonContainer* muons = 0;
57  sc = evtStore()->retrieve(muons, "Muons");
58  if (sc.isFailure()) {
59  ATH_MSG_ERROR("Could not find Muons");
60  return StatusCode::FAILURE;
61  } else {
62  ATH_MSG_INFO("Muons retrieved from StoreGate");
63  }
64 
65  xAOD::MuonContainer::const_iterator muon_itr = muons->begin();
66  xAOD::MuonContainer::const_iterator muon_end = muons->end();
67 
68  for (; muon_itr != muon_end; ++muon_itr) {
69  // pt cut
70  if ((*muon_itr)->pt() * 1.e-3 < 6.) continue;
71 
72  xAOD::Muon::Author auth = (*muon_itr)->author();
73  float type = (*muon_itr)->muonType();
74 
75 
76 
77  const xAOD::TrackParticle* primTrackParticle = (*muon_itr)->primaryTrackParticle();
78  const xAOD::TrackParticle* MStrackParticle = (*muon_itr)->trackParticle(xAOD::Muon::MuonSpectrometerTrackParticle);
79  const xAOD::TrackParticle* MEtrackParticle = (*muon_itr)->trackParticle(
80  xAOD::Muon::ExtrapolatedMuonSpectrometerTrackParticle);
81  const xAOD::TrackParticle* IDtrackParticle = (*muon_itr)->trackParticle(xAOD::Muon::InnerDetectorTrackParticle);
82 
83 
84  float chi2ndof = 0;
85  float chi2ndofID = 0;
86  float chi2ndofMS = 0;
87  float chi2ndofME = 0;
88  if (primTrackParticle) {
89  chi2ndof = primTrackParticle->chiSquared() / primTrackParticle->numberDoF();
90  }
91  if (IDtrackParticle) {
92  chi2ndofID = IDtrackParticle->chiSquared() / IDtrackParticle->numberDoF();
93  }
94  if (MStrackParticle) {
95  chi2ndofMS = MStrackParticle->chiSquared() / MStrackParticle->numberDoF();
96  }
97  if (MEtrackParticle) {
98  chi2ndofME = MEtrackParticle->chiSquared() / MEtrackParticle->numberDoF();
99  }
100 
101 
102 
103 
104 
105  m_h_Auth_fcal->Fill(auth);
106  m_h_Type_fcal->Fill(type);
107  m_h_Chi2ndf_fcal->Fill(chi2ndof);
108  m_h_Chi2ndfID_fcal->Fill(chi2ndofID);
109  m_h_Chi2ndfMS_fcal->Fill(chi2ndofMS);
110  m_h_Chi2ndfME_fcal->Fill(chi2ndofME);
111  }//for
112 
113 
114 
115  return StatusCode::SUCCESS;
116 }
117 
119  //if( endOfLowStatFlag() || endOfLumiBlock() ) { }
120 
121  if (endOfRunFlag()) {
122  if (m_h_Auth_fcal->GetEntries() > 0) m_h_Auth_fcal->Scale(1. / m_h_Auth_fcal->GetEntries());
123  if (m_h_Type_fcal->GetEntries() > 0) m_h_Type_fcal->Scale(1. / m_h_Type_fcal->GetEntries());
124  if (m_h_Chi2ndf_fcal->GetEntries() > 0) m_h_Chi2ndf_fcal->Scale(1. / m_h_Chi2ndf_fcal->GetEntries());
125  if (m_h_Chi2ndfID_fcal->GetEntries() > 0) m_h_Chi2ndfID_fcal->Scale(1. / m_h_Chi2ndfID_fcal->GetEntries());
126  if (m_h_Chi2ndfMS_fcal->GetEntries() > 0) m_h_Chi2ndfMS_fcal->Scale(1. / m_h_Chi2ndfMS_fcal->GetEntries());
127  if (m_h_Chi2ndfME_fcal->GetEntries() > 0) m_h_Chi2ndfME_fcal->Scale(1. / m_h_Chi2ndfME_fcal->GetEntries());
128  }
129 
130  return StatusCode::SUCCESS;
131 }
132 
135  std::string path = "HeavyIon/Muons";
136 
137  m_h_Auth_fcal = new TH1D("h_Auth_fcal", ";author;counts", 12, 0, 12);
138  regHist(m_h_Auth_fcal, path, run).ignore();
139 
140  m_h_Type_fcal = new TH1D("h_Type_fcal", ";type;counts", 5, 0, 5);
141  regHist(m_h_Type_fcal, path, run).ignore();
142 
143  m_h_Chi2ndf_fcal = new TH1D("h_Chi2ndf_fcal", ";chi2/ndf;counts", 100, 0, 10);
144  regHist(m_h_Chi2ndf_fcal, path, run).ignore();
145 
146  m_h_Chi2ndfID_fcal = new TH1D("h_Chi2ndfID_fcal", ";ID chi2/ndf;counts", 100, 0, 10);
147  regHist(m_h_Chi2ndfID_fcal, path, run).ignore();
148 
149  m_h_Chi2ndfMS_fcal = new TH1D("h_Chi2ndfMS_fcal", ";MS chi2/ndf;counts", 100, 0, 10);
150  regHist(m_h_Chi2ndfMS_fcal, path, run).ignore();
151 
152  m_h_Chi2ndfME_fcal = new TH1D("h_Chi2ndfME_fcal", ";ME chi2/ndf;counts", 100, 0, 10);
153  regHist(m_h_Chi2ndfME_fcal, path, run).ignore();
154 }
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
HIMonitoringMuonsTool::procHistograms
virtual StatusCode procHistograms()
An inheriting class should either override this function or finalHists().
Definition: HIMonitoringMuonsTool.cxx:118
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:126
HIMonitoringMuonsTool::~HIMonitoringMuonsTool
virtual ~HIMonitoringMuonsTool()
Definition: HIMonitoringMuonsTool.cxx:17
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
ManagedMonitorToolBase
Provides functionality for users to implement and save histograms, ntuples, and summary data,...
Definition: ManagedMonitorToolBase.h:74
python.base_data.auth
auth
Definition: base_data.py:57
AthenaMonManager::cosmics
@ cosmics
Definition: AthenaMonManager.h:58
HIMonitoringMuonsTool::bookHistograms
virtual StatusCode bookHistograms()
An inheriting class should either override this function or bookHists().
Definition: HIMonitoringMuonsTool.cxx:26
HIMonitoringMuonsTool::bookHistogramsRecurrent
virtual StatusCode bookHistogramsRecurrent()
An inheriting class should either override this function, bookHists() or bookHistograms().
Definition: HIMonitoringMuonsTool.cxx:21
TH1D
Definition: rootspy.cxx:342
xAOD::TrackParticle_v1::chiSquared
float chiSquared() const
Returns the of the overall track fit.
HIMonitoringMuonsTool::book_hist
void book_hist()
*** FCal sum Et *** ///
Definition: HIMonitoringMuonsTool.cxx:134
ManagedMonitorToolBase::m_dataType
AthenaMonManager::DataType_t m_dataType
Definition: ManagedMonitorToolBase.h:901
HIMonitoringMuonsTool::m_h_Auth_fcal
TH1D * m_h_Auth_fcal
histograms
Definition: HIMonitoringMuonsTool.h:31
HIMonitoringMuonsTool::m_h_Chi2ndfMS_fcal
TH1D * m_h_Chi2ndfMS_fcal
Definition: HIMonitoringMuonsTool.h:37
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthenaMonManager::online
@ online
Definition: AthenaMonManager.h:49
HIEventShapeContainer.h
HIMonitoringMuonsTool::m_h_Type_fcal
TH1D * m_h_Type_fcal
Definition: HIMonitoringMuonsTool.h:32
HIMonitoringMuonsTool::m_h_Chi2ndf_fcal
TH1D * m_h_Chi2ndf_fcal
Definition: HIMonitoringMuonsTool.h:33
test_pyathena.parent
parent
Definition: test_pyathena.py:15
HIMonitoringMuonsTool::HIMonitoringMuonsTool
HIMonitoringMuonsTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: HIMonitoringMuonsTool.cxx:13
AthenaMonManager.h
run
Definition: run.py:1
HIMonitoringMuonsTool.h
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
ManagedMonitorToolBase::m_environment
AthenaMonManager::Environment_t m_environment
Definition: ManagedMonitorToolBase.h:902
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
MuonContainer.h
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
ManagedMonitorToolBase::endOfRunFlag
bool endOfRunFlag() const
Definition: ManagedMonitorToolBase.h:859
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
HIMonitoringMuonsTool::m_h_Chi2ndfME_fcal
TH1D * m_h_Chi2ndfME_fcal
Definition: HIMonitoringMuonsTool.h:36
HIMonitoringMuonsTool::fillHistograms
virtual StatusCode fillHistograms()
An inheriting class should either override this function or fillHists().
Definition: HIMonitoringMuonsTool.cxx:41
xAOD::TrackParticle_v1::numberDoF
float numberDoF() const
Returns the number of degrees of freedom of the overall track or vertex fit as float.
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
ParticleJetParams::Author
Author
Definition: ParticleJetParamDefs.h:33
HIMonitoringMuonsTool::m_h_Chi2ndfID_fcal
TH1D * m_h_Chi2ndfID_fcal
Definition: HIMonitoringMuonsTool.h:35
ManagedMonitorToolBase::regHist
virtual StatusCode regHist(TH1 *h, const std::string &system, Interval_t interval, MgmtAttr_t histo_mgmt=ATTRIB_MANAGED, const std::string &chain="", const std::string &merge="")
Registers a TH1 (including TH2, TH3, and TProfile) to be included in the output stream using logical ...
Definition: ManagedMonitorToolBase.cxx:1454
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.