ATLAS Offline Software
JetBadChanCorrTool.h
Go to the documentation of this file.
1 // this file is -*- C++ -*-
2 
3 /*
4  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 #ifndef XAOD_ANALYSIS
8 
9 #ifndef JETMOMENTTOOLS_JETBADCHANCORRTOOL_H
10 #define JETMOMENTTOOLS_JETBADCHANCORRTOOL_H
11 
34 #include "AsgTools/AsgTool.h"
37 
39 
41 
42 #include "TH1D.h"
43 #include <utility>
44 
45 
46 class Identifier;
47 
48 class ITileBadChanTool;
49 class ITHistSvc;
50 
52  virtual public IJetDecorator
53 {
55 public:
56  JetBadChanCorrTool(const std::string& name);
57 
59 
60  virtual StatusCode initialize() override;
61 
62  virtual StatusCode decorate(const xAOD::JetContainer& jets) const override;
63 
64  virtual StatusCode setupEvent();
65 
66 
67 protected:
68  // These two apply the moments they compute as decorations to the jet collection
71  // This one computes the moment without applying it
72  float correctionFromCellsInCone(const xAOD::Jet* jet, const jet::CaloCellFastMap * badCellMap) const;
73 
74  private:
75 
77 
78  Gaudi::Property<std::string> m_jetContainerName{this, "JetContainer", "", "SG key for the input jet container"};
79  Gaudi::Property<int> m_nBadCellLimit{this, "NBadCellLimit", 10000, "Limit to calculate moments"};
80 
81  // for jet-level correction
82  Gaudi::Property<std::string> m_streamName{this, "StreamName", "/JetBadChanCorrTool/", "Stream name"};
83  Gaudi::Property<std::string> m_profileName{this, "ProfileName", "JetBadChanCorrTool.root", "Profile name"};
84  Gaudi::Property<std::string> m_profileTag{this, "ProfileTag", "", "Profile tag"};
85 
86  Gaudi::Property<bool> m_useCone{this, "UseCone", true, "Use cone?"};
87  Gaudi::Property<bool> m_useClusters{this, "UseClusters", false, "Use clusters?"};
88 
89  SG::ReadHandleKey<jet::CaloCellFastMap> m_badCellMap_key{this, "MissingCellMap", "MissingCaloCellsMap", "SG key for missing cell map"};
90  SG::WriteDecorHandleKey<xAOD::JetContainer> m_corrCellKey{this, "CorrCellDecorKey", "BchCorrCell", "SG key for cell level decoration"};
91  SG::WriteDecorHandleKey<xAOD::JetContainer> m_corrDotxKey{this, "CorrDotxDecorKey", "BchCorrDotx", "SG key for DOTX decoration"};
92  SG::WriteDecorHandleKey<xAOD::JetContainer> m_corrJetKey{this, "CorrJetDecorKey", "BchCorrJet", "SG key for jet level decoration"};
93  SG::WriteDecorHandleKey<xAOD::JetContainer> m_corrJetForCellKey{this, "CorrJetForCellDecorKey", "BchCorrJetForCell", "SG key for JetForCell decoration"};
94 
95  // jet profiles
96  class ProfileData {
97  public:
98  ProfileData(TH1D* th, int sample,
99  double ptMin=0, double ptMax=9999,
100  double etaMin=0, double etaMax=5.0,
101  double phiMin=-M_PI, double phiMax=M_PI):
102  m_th(th), m_sample(sample),
103  m_ptMin(ptMin), m_ptMax(ptMax),
105  m_phiMin(phiMin), m_phiMax(phiMax) {}
106 
107  virtual ~ProfileData(){}
108 
109  bool match(double pt, int sample, double eta, double phi) const {
110  return ( pt>=m_ptMin && pt<m_ptMax
111  && sample==m_sample
112  && fabs(eta)>=m_etaMin && fabs(eta)<m_etaMax
113  && phi>=m_phiMin && phi<m_phiMax);
114  }
115 
116  double frac(double dr) const {
117  int idr = std::as_const(m_th)->FindBin(dr);
118  return m_th->GetBinContent(idr);
119  }
120  private:
121  TH1D* m_th;
122  int m_sample;
123  double m_ptMin;
124  double m_ptMax;
125  double m_etaMin;
126  double m_etaMax;
127  double m_phiMin;
128  double m_phiMax;
129 
130  };
131  std::vector<ProfileData> m_profileDatas[CaloCell_ID::Unknown];//24
132 
133  double getProfile(double pt, double dr, int sample, double eta, double phi) const;
134 };
135 #endif
136 
137 #endif
138 
139 // DoxygenDocumentation
SG::WriteDecorHandleKey
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Definition: StoreGate/StoreGate/WriteDecorHandleKey.h:89
GetLCDefs::Unknown
@ Unknown
Definition: GetLCDefs.h:21
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
JetBadChanCorrTool
JetBadChanCorrTool.
Definition: JetBadChanCorrTool.h:53
JetBadChanCorrTool::ProfileData::m_th
TH1D * m_th
Definition: JetBadChanCorrTool.h:121
JetBadChanCorrTool::m_useClusters
Gaudi::Property< bool > m_useClusters
Definition: JetBadChanCorrTool.h:87
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
MissingCellListTool.h
JetBadChanCorrTool::ProfileData::~ProfileData
virtual ~ProfileData()
Definition: JetBadChanCorrTool.h:107
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
JetBadChanCorrTool::m_profileTag
Gaudi::Property< std::string > m_profileTag
Definition: JetBadChanCorrTool.h:84
JetBadChanCorrTool::m_corrCellKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_corrCellKey
Definition: JetBadChanCorrTool.h:90
test_pyathena.pt
pt
Definition: test_pyathena.py:11
M_PI
#define M_PI
Definition: ActiveFraction.h:11
IJetDecorator
Interface for adding a decoration to a jet container.
Definition: IJetDecorator.h:21
JetBadChanCorrTool::m_badCellMap_key
SG::ReadHandleKey< jet::CaloCellFastMap > m_badCellMap_key
Definition: JetBadChanCorrTool.h:89
xAOD::etaMax
etaMax
Definition: HIEventShape_v2.cxx:46
JetBadChanCorrTool::ProfileData::m_ptMin
double m_ptMin
Definition: JetBadChanCorrTool.h:123
JetBadChanCorrTool::ProfileData::m_sample
int m_sample
Definition: JetBadChanCorrTool.h:122
python.TurnDataReader.dr
dr
Definition: TurnDataReader.py:112
JetBadChanCorrTool::m_corrDotxKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_corrDotxKey
Definition: JetBadChanCorrTool.h:91
SG::ReadHandleKey< jet::CaloCellFastMap >
JetBadChanCorrTool::ProfileData
Definition: JetBadChanCorrTool.h:96
JetBadChanCorrTool::m_corrJetKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_corrJetKey
Definition: JetBadChanCorrTool.h:92
IJetDecorator.h
JetBadChanCorrTool::ProfileData::ProfileData
ProfileData(TH1D *th, int sample, double ptMin=0, double ptMax=9999, double etaMin=0, double etaMax=5.0, double phiMin=-M_PI, double phiMax=M_PI)
Definition: JetBadChanCorrTool.h:98
CaloCell_ID.h
JetBadChanCorrTool::setupEvent
virtual StatusCode setupEvent()
Definition: JetBadChanCorrTool.cxx:128
JetBadChanCorrTool::m_streamName
Gaudi::Property< std::string > m_streamName
Definition: JetBadChanCorrTool.h:82
JetBadChanCorrTool::m_jetContainerName
Gaudi::Property< std::string > m_jetContainerName
Definition: JetBadChanCorrTool.h:78
JetBadChanCorrTool::m_profileDatas
std::vector< ProfileData > m_profileDatas[CaloCell_ID::Unknown]
Definition: JetBadChanCorrTool.h:131
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
python.TriggerHandler.th
th
Definition: TriggerHandler.py:296
WriteDecorHandleKey.h
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
FullCPAlgorithmsTest_eljob.sample
sample
Definition: FullCPAlgorithmsTest_eljob.py:116
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
JetBadChanCorrTool::ProfileData::m_ptMax
double m_ptMax
Definition: JetBadChanCorrTool.h:124
ASG_TOOL_CLASS0
#define ASG_TOOL_CLASS0(CLASSNAME)
Definition: AsgToolMacros.h:62
JetBadChanCorrTool::ProfileData::m_etaMin
double m_etaMin
Definition: JetBadChanCorrTool.h:125
JetBadChanCorrTool::m_nBadCellLimit
Gaudi::Property< int > m_nBadCellLimit
Definition: JetBadChanCorrTool.h:79
JetBadChanCorrTool::ProfileData::match
bool match(double pt, int sample, double eta, double phi) const
Definition: JetBadChanCorrTool.h:109
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
JetBadChanCorrTool::decorate
virtual StatusCode decorate(const xAOD::JetContainer &jets) const override
Decorate a jet collection without otherwise modifying it.
Definition: JetBadChanCorrTool.cxx:134
JetBadChanCorrTool::ProfileData::m_phiMax
double m_phiMax
Definition: JetBadChanCorrTool.h:128
JetBadChanCorrTool::getProfile
double getProfile(double pt, double dr, int sample, double eta, double phi) const
Definition: JetBadChanCorrTool.cxx:303
JetBadChanCorrTool::~JetBadChanCorrTool
virtual ~JetBadChanCorrTool()
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
JetBadChanCorrTool::m_profileName
Gaudi::Property< std::string > m_profileName
Definition: JetBadChanCorrTool.h:83
JetBadChanCorrTool::correctionFromClustersBadCells
StatusCode correctionFromClustersBadCells(const xAOD::JetContainer &jets) const
Definition: JetBadChanCorrTool.cxx:278
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
JetBadChanCorrTool::ProfileData::m_etaMax
double m_etaMax
Definition: JetBadChanCorrTool.h:126
JetBadChanCorrTool::correctionFromCellsInCone
float correctionFromCellsInCone(const xAOD::Jet *jet, const jet::CaloCellFastMap *badCellMap) const
Definition: JetBadChanCorrTool.cxx:247
LArCellBinning.etaMin
etaMin
Definition: LArCellBinning.py:84
JetBadChanCorrTool::ProfileData::m_phiMin
double m_phiMin
Definition: JetBadChanCorrTool.h:127
JetBadChanCorrTool::correctionFromCellsInJet
StatusCode correctionFromCellsInJet(const xAOD::JetContainer &jets, const jet::CaloCellFastMap *badCellMap) const
Definition: JetBadChanCorrTool.cxx:165
ITileBadChanTool
An abstract inteface to get Tile channel and ADC status.
Definition: ITileBadChanTool.h:21
JetBadChanCorrTool::m_useCone
Gaudi::Property< bool > m_useCone
Definition: JetBadChanCorrTool.h:86
JetBadChanCorrTool::m_thistSvc
ServiceHandle< ITHistSvc > m_thistSvc
Definition: JetBadChanCorrTool.h:76
JetBadChanCorrTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: JetBadChanCorrTool.cxx:39
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
JetBadChanCorrTool::ProfileData::frac
double frac(double dr) const
Definition: JetBadChanCorrTool.h:116
JetBadChanCorrTool::JetBadChanCorrTool
JetBadChanCorrTool(const std::string &name)
Definition: JetBadChanCorrTool.cxx:29
AsgTool.h
JetBadChanCorrTool::m_corrJetForCellKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_corrJetForCellKey
Definition: JetBadChanCorrTool.h:93
jet::CaloCellFastMap
Definition: MissingCellListTool.h:89
ServiceHandle< ITHistSvc >
Identifier
Definition: IdentifierFieldParser.cxx:14