ATLAS Offline Software
Loading...
Searching...
No Matches
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
60 if(m_histDeltaEta) m_histDeltaEta->Fill( dEta, weight);
61 if(m_histDeltaPhi) m_histDeltaPhi->Fill( dPhi, weight);
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
#define ATH_MSG_INFO(x)
#define CHECK(...)
Evaluate an expression and check for errors.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
size_type size() const noexcept
Returns the number of elements in the collection.
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...
JetHistoBase(const std::string &t)
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
ToolHandleArray< HistoDefinitionTool > m_histoDef
virtual int fillHistosFromContainer(const xAOD::JetContainer &cont, float weight)
LeadingJetsRelations(const std::string &t)
Jet_v1 Jet
Definition of the current "jet version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".