ATLAS Offline Software
LeadingJetsRelations.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
8 #include "TH1.h"
9 #include "TH2.h"
10 #include "TProfile.h"
11 
12 
13 
15  , m_histoDef(this)
16 {
17  declareProperty("HistoDef", m_histoDef, "The list of HistoDefinitionTool defining the histos to be used in this tool");
18 }
19 
20 
21 
23  CHECK( m_histoDef.retrieve() );
24  return StatusCode::SUCCESS;
25 }
26 
28  ATH_MSG_INFO(" buildHistos num of histos : "<< m_histoDef.size() );
29 
31 
32  // Histos are defined in jobOptions !
33  // For each histo, ask hbuilder if a corresponding definition exists in the jobOption list.
34  // -> if so a valid histo is returned (and booked)
35  // -> else NULL is returned
36  m_histDeltaR = bookHisto( hbuilder.build<TH1F>("ljrDeltaR") );
37  m_histDeltaEta = bookHisto( hbuilder.build<TH1F>("ljrDeltaEta") );
38  m_histDeltaPhi = bookHisto( hbuilder.build<TH1F>("ljrDeltaPhi") );
39  m_histFrac = bookHisto( hbuilder.build<TH1F>("ljrFrac") );
40  m_histEta1Eta2 = bookHisto( hbuilder.build<TH2F>("ljrEta1Eta2") );
41 
42 
43  return 0;
44 }
45 
46 
48  if( cont.size()<2) return 0;
49 
50  const xAOD::Jet * j1 = cont[0];
51  const xAOD::Jet * j2 = cont[1];
52 
53  double dEta = j1->eta() - j2->eta();
54  double dPhi = fabs(j1->phi() - j2->phi() );
55  if(dPhi > 2*3.14159) dPhi -= 2*3.14159;
56  double dR = sqrt( dPhi*dPhi + dEta*dEta);
57  double histFrac = 0.;
58  if (j1->pt() > 0.) histFrac = j2->pt()/j1->pt();
59 
62  if(m_histDeltaR) m_histDeltaR->Fill( dR, weight);
63 
64  if(m_histFrac) m_histFrac->Fill( histFrac, weight);
65 
66  if(m_histEta1Eta2) m_histEta1Eta2->Fill( j1->eta(), j2->eta(), weight );
67 
68  return 0;
69 }
70 
71 
72 
73 
LeadingJetsRelations::m_histEta1Eta2
TH2F * m_histEta1Eta2
Definition: LeadingJetsRelations.h:35
LeadingJetsRelations::initialize
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
Definition: LeadingJetsRelations.cxx:22
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
LeadingJetsRelations::buildHistos
virtual int buildHistos()
Definition: LeadingJetsRelations.cxx:27
TH2F
Definition: rootspy.cxx:420
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
LeadingJetsRelations::m_histoDef
ToolHandleArray< HistoDefinitionTool > m_histoDef
Definition: LeadingJetsRelations.h:29
LeadingJetsRelations::m_histDeltaPhi
TH1F * m_histDeltaPhi
Definition: LeadingJetsRelations.h:32
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
LeadingJetsRelations.h
LeadingJetsRelations::m_histFrac
TH1F * m_histFrac
Definition: LeadingJetsRelations.h:33
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:200
JetHistoBase
Definition: JetHistoBase.h:27
doubleTestComp.j1
j1
Definition: doubleTestComp.py:21
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TauGNNUtils::Variables::Track::dPhi
bool dPhi(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:530
LeadingJetsRelations::fillHistosFromContainer
virtual int fillHistosFromContainer(const xAOD::JetContainer &cont, float weight)
Definition: LeadingJetsRelations.cxx:47
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
ToolHandleHistoHelper::HistoRetriever
Definition: ToolHandleHistoHelper.h:26
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
LeadingJetsRelations::LeadingJetsRelations
LeadingJetsRelations(const std::string &t)
Definition: LeadingJetsRelations.cxx:14
ToolHandleHistoHelper::HistoRetriever::build
T * build(const std::string &n)
Definition: ToolHandleHistoHelper.h:44
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
TH1F
Definition: rootspy.cxx:320
LeadingJetsRelations::m_histDeltaR
TH1F * m_histDeltaR
Definition: LeadingJetsRelations.h:30
HistoGroupBase::bookHisto
T * bookHisto(T *h, Interval_t ityp=useToolInterval)
register the histo h in this group (if h!=NULL). The histo name is changed if m_prefixedHistoName==tr...
Definition: HistoGroupBase.h:69
LeadingJetsRelations::m_histDeltaEta
TH1F * m_histDeltaEta
Definition: LeadingJetsRelations.h:31
TauGNNUtils::Variables::Track::dEta
bool dEta(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:525
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
ToolHandleHistoHelper.h
doubleTestComp.j2
j2
Definition: doubleTestComp.py:22