ATLAS Offline Software
Loading...
Searching...
No Matches
JetSubStructureHistos.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include "TString.h"
7#include <map>
8#include "TH1F.h"
9
10#define toGeV 1/1000.
11
13 ,m_jetScale("JetAssignedScaleMomentum")
14{
15 declareProperty("JetScale", m_jetScale);
16}
17
19
20 // -------------- Modify histo names/titles --------
21 // if we're plotting a defined scale, modify the Histo titles and names
22
23 std::map<std::string, std::string> scale2str( {
24 { "JetEMScaleMomentum" , "EMScale" } ,
25 { "JetConstitScaleMomentum" , "ConstitScale" } } );
26 TString scaleTag = scale2str[ m_jetScale ] ; // defaults to ""
27
28 TString prefixn = scaleTag;
29 if(prefixn != "") prefixn +="_";
30 // --------------
31
32 // Build and register the histos in this group :
33 TH1::AddDirectory(kFALSE); // Turn off automatic addition to gDirectory to avoid Warnings. Histos are anyway placed in their own dir later.
34 m_tau21 = bookHisto( new TH1F(prefixn+"Tau21" , "Jet Tau21 ;Entries", 100, 0, 1) );
35 m_tau32 = bookHisto( new TH1F(prefixn+"Tau32" , "Jet Tau32 ;Entries", 100, 0, 1) );
36 m_tau21_wta = bookHisto( new TH1F(prefixn+"Tau21_wta" , "Jet Tau21_wta ;Entries", 100, 0, 1) );
37 m_tau32_wta = bookHisto( new TH1F(prefixn+"Tau32_wta" , "Jet Tau32_wta ;Entries", 100, 0, 1) );
38 m_C1 = bookHisto( new TH1F(prefixn+"C1" , "Jet C1;Entries", 100, -1, 1) );
39 m_C2 = bookHisto( new TH1F(prefixn+"C2" , "Jet C2;Entries", 100, -1, 1) );
40 m_D2 = bookHisto( new TH1F(prefixn+"D2" , "Jet D2;Entries", 100, 0, 10) );
41
42
43
44 TH1::AddDirectory(kTRUE); // Turn on automatic addition to gDirectory in case others needs it.
45
46 // -------------- Modify histo titles.
47 if(prefixn != "" ){
48
49 // build a qualifier in the form "(EMScale, Leading Jet, ...)"
50 TString qualif = "(";
51 TString tags[] = { scaleTag};
52 for(const auto& t : tags ) { if(qualif != "(") qualif+=",";qualif += t; }
53 qualif += ")";
54 // reset all titles :
55 for(auto& hdata : m_vBookedHistograms ){
56 TString t = hdata.hist->GetTitle(); t+=" "+qualif;
57 hdata.hist->SetTitle(t );
58 }
59 }
60
61
62 return 0;
63}
64
65
66
68 //For definitions see JetSubStructureMomentTools
69
70 static const SG::ConstAccessor<float> Tau1Acc("Tau1");
71 static const SG::ConstAccessor<float> Tau2Acc("Tau2");
72 static const SG::ConstAccessor<float> Tau3Acc("Tau3");
73 static const SG::ConstAccessor<float> Tau1_wtaAcc("Tau1_wta");
74 static const SG::ConstAccessor<float> Tau2_wtaAcc("Tau2_wta");
75 static const SG::ConstAccessor<float> Tau3_wtaAcc("Tau3_wta");
76 static const SG::ConstAccessor<float> ECF1Acc("ECF1");
77 static const SG::ConstAccessor<float> ECF2Acc("ECF2");
78 static const SG::ConstAccessor<float> ECF3Acc("ECF3");
79 if( Tau1Acc.isAvailable(j) && Tau2Acc.isAvailable(j) && Tau3Acc.isAvailable(j)){
80 if( Tau1Acc(j) > 1e-8 ) m_tau21->Fill( Tau2Acc(j) / Tau1Acc(j), weight );
81 if( Tau2Acc(j) > 1e-8 ) m_tau32->Fill( Tau3Acc(j) / Tau2Acc(j), weight );
82 }
83 if( Tau1_wtaAcc.isAvailable(j) && Tau2_wtaAcc(j) && Tau3_wtaAcc(j)){
84 if( Tau1_wtaAcc(j) > 1e-8 ) m_tau21_wta->Fill( Tau2_wtaAcc(j) / Tau1_wtaAcc(j), weight );
85 if( Tau2_wtaAcc(j) > 1e-8 ) m_tau32_wta->Fill( Tau3_wtaAcc(j) / Tau2_wtaAcc(j), weight );
86 }
87 if( ECF1Acc.isAvailable(j) && ECF2Acc.isAvailable(j) && ECF3Acc.isAvailable(j)){
88 if( ECF1Acc(j) > 1e-8 ) m_C1->Fill( ECF2Acc(j) / pow( ECF1Acc(j), 2.0), weight );
89 if( ECF2Acc(j) > 1e-8 ) {
90 m_C2->Fill( ( ECF3Acc(j) * ECF1Acc(j) ) / pow( ECF2Acc(j), 2.0), weight );
91 m_D2->Fill( ( ECF3Acc(j) * pow( ECF1Acc(j), 3.0 ) ) / pow( ECF2Acc(j), 3.0), weight );
92 }
93 }
94
95 return 0;
96}
97
constexpr int pow(int base, int exp) noexcept
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
std::vector< HistData > m_vBookedHistograms
The list of histos in this group.
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 int fillHistosFromJet(const xAOD::Jet &j, float weight)
JetSubStructureHistos(const std::string &t)
Helper class to provide constant type-safe access to aux data.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
std::vector< std::string > tags
Definition hcg.cxx:105
Jet_v1 Jet
Definition of the current "jet version".