ATLAS Offline Software
JetTileCorrectionTool.h
Go to the documentation of this file.
1 // Dear emacs, this is -*- c++ -*-
2 
3 /*
4  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // $Id: JetTileCorrectionTool.h 2015-03-10 tripiana $
8 #ifndef JETTILECORRECTION_JETTILECORRECTIONTOOL_H
9 #define JETTILECORRECTION_JETTILECORRECTIONTOOL_H
10 
11 // Framework include(s):
13 
14 // Tool dependencies
15 
16 // Local include(s):
18 #include "xAODJet/JetContainer.h"
20 
21 #include "TFile.h"
22 #include "TSystem.h"
23 #include "TProfile.h"
24 #include <iostream>
25 #include <stdlib.h>
26 #include <set>
27 #include <vector>
28 #include <unordered_map>
29 
30 //--- config ---
31 #define PIXWIDTH 0.1
32 #define RINGWIDTH 0.1
33 #define RJET 0.4
34 #define NPIX 16
35 #define OUT 99
36 #define Pix_eta 17
37 #define Pix_phi 6
38 //--------------
39 
40 
41 
42 namespace CP {
43 
46  {
49 
50  public:
52  JetTileCorrectionTool( const std::string& name );
53 
55  virtual ~JetTileCorrectionTool();
56 
58  virtual StatusCode initialize();
59 
61  virtual CorrectionCode applyCorrection( xAOD::Jet& object );
62 
65 
66 
68  virtual bool
69  isAffectedBySystematic( const SystematicVariation& systematic ) const;
70 
72  virtual SystematicSet
73  affectingSystematics() const;
74 
76  virtual SystematicSet
77  recommendedSystematics() const;
78 
81  return *m_appliedSystematics;
82  }
83 
85  ( const SystematicSet& systConfig );
86 
88 
89 
90  //status helpers
93 
94  //DR helper
95  void setRJET(float r); //Set Jet Radius. NOTE: Only for checking overlap! The correction is only derived for EMTopo R=0.4 jets at the moment.
96 
97  protected:
98  // Arguments and tool dependencies
99  bool m_isData;
100 
101  private:
102 
103  // Load dead regions DB
104  void loadDeadUser(); //user-defined
105  void loadDeadDB(); //DB-defined
106 
107  std::vector<float> getCorrections(const xAOD::Jet& j); //, bool constScale);
108 
109  JTC::TS overlap(const xAOD::Jet& j, JTC::Hole region);
110 
111  int getPtBin(float pt); //in MeV
112 
113  bool inIOV(JTC::Hole region, int run);
114 
115  bool inHole(const xAOD::Jet& j, JTC::Hole rdead);
116  bool inHole(float eta, float phi, JTC::Hole rdead);
117 
119 
120  void loadModulesFromMap(const xAOD::Jet& jet, JTC::TS& status, const std::map<std::string,JTC::Hole>& hmap, JTC::PART part=JTC::PART::LB, JTC::TYPE type=JTC::TYPE::DB);
122 
123  JTC::Hole partModToHole(int part, int mod); //translate to eta-phi coordinates (+dummy IOV)
124 
125  bool m_constScale = false; //Get correction using constituent pt (for testing purposes)
126  bool m_isMC = false; //check if it is simulation
127 
128  int m_current_run = -1; //keep current run number
129  //int m_current_lb; //keep current lumiblock
130 
131  int m_NbinsPt = -1; //number of pt-bins in parametrization histograms
132 
133  std::vector<std::string> m_v_user_dead; //book dead regions (apart from those coming from detector db)
134 
135  TFile* m_rootFile = 0; //correction file
136  std::string m_rootFileName; //correction filename
137 
138  std::string m_bd_dead_mapFile; //masked region DB filename
139 
140  std::vector<JTC::Region> m_position_masked;
141 
142  //***
145  //***
146 
147  std::map<int,TH1F*> m_pars_LB;
148  std::map<int,TH1F*> m_pars_EB;
149  std::map<std::string,JTC::Hole> m_db_dead_LB;
150  std::map<std::string,JTC::Hole> m_db_dead_EB;
151  std::map<std::string,JTC::Hole> m_user_dead_LB;
152  std::map<std::string,JTC::Hole> m_user_dead_EB;
153 
154  float m_RJET;
155 
157  std::unordered_map<CP::SystematicSet, CP::SystematicSet> m_systFilter;
158 
161 
162  }; // class JetTileCorrectionTool
163 
164 } // namespace CP
165 
166 #endif // JETTILECORRECTION_JETTILECORRECTIONTOOL_H
CP::JetTileCorrectionTool::getPtBin
int getPtBin(float pt)
Definition: JetTileCorrectionTool.cxx:587
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
JTC::TS
TS
Definition: IJetTileCorrectionTool.h:27
CP::JetTileCorrectionTool::m_pars_LB
std::map< int, TH1F * > m_pars_LB
Definition: JetTileCorrectionTool.h:147
beamspotman.r
def r
Definition: beamspotman.py:676
CP::JetTileCorrectionTool::inIOV
bool inIOV(JTC::Hole region, int run)
Definition: JetTileCorrectionTool.cxx:600
CP::JetTileCorrectionTool::m_RJET
float m_RJET
Definition: JetTileCorrectionTool.h:154
CP::JetTileCorrectionTool::isAffectedBySystematic
virtual bool isAffectedBySystematic(const SystematicVariation &systematic) const
returns: whether this tool is affected by the given systematic
Definition: JetTileCorrectionTool.cxx:219
CP::JetTileCorrectionTool::m_user_dead_EB
std::map< std::string, JTC::Hole > m_user_dead_EB
Definition: JetTileCorrectionTool.h:152
CP::JetTileCorrectionTool::JetTileCorrectionTool
JetTileCorrectionTool(const std::string &name)
Create a proper constructor for Athena.
Definition: JetTileCorrectionTool.cxx:44
JTC::TYPE
TYPE
Definition: IJetTileCorrectionTool.h:29
test_pyathena.pt
pt
Definition: test_pyathena.py:11
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
CP::JetTileCorrectionTool::correctedCopy
virtual CorrectionCode correctedCopy(const xAOD::Jet &input, xAOD::Jet *&output)
Create a corrected copy from a constant jet.
Definition: JetTileCorrectionTool.cxx:194
CP::JetTileCorrectionTool::m_v_user_dead
std::vector< std::string > m_v_user_dead
Definition: JetTileCorrectionTool.h:133
CP::JetTileCorrectionTool::m_db_dead_EB
std::map< std::string, JTC::Hole > m_db_dead_EB
Definition: JetTileCorrectionTool.h:150
IJetTileCorrectionTool.h
CP::JetTileCorrectionTool::loadAllModules
StatusCode loadAllModules(const xAOD::Jet &jet, JTC::TS &status)
Definition: JetTileCorrectionTool.cxx:498
CP::SystematicVariation
Definition: SystematicVariation.h:47
IPair
std::pair< int, int > IPair
Definition: IJetTileCorrectionTool.h:21
JetConstituentVector.h
This file defines helper classes to deal with jet constituents.
CP::JetTileCorrectionTool::m_appliedSystematics
CP::SystematicSet * m_appliedSystematics
Currently applied systematics.
Definition: JetTileCorrectionTool.h:160
CP::JetTileCorrectionTool::partModToHole
JTC::Hole partModToHole(int part, int mod)
Definition: JetTileCorrectionTool.cxx:619
CP::JetTileCorrectionTool::getCorrections
std::vector< float > getCorrections(const xAOD::Jet &j)
Definition: JetTileCorrectionTool.cxx:535
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
CP::JetTileCorrectionTool::m_pars_EB
std::map< int, TH1F * > m_pars_EB
Definition: JetTileCorrectionTool.h:148
CP::JetTileCorrectionTool::~JetTileCorrectionTool
virtual ~JetTileCorrectionTool()
Destructor:
Definition: JetTileCorrectionTool.cxx:53
python.PyAthena.module
module
Definition: PyAthena.py:131
CP::JetTileCorrectionTool::m_bd_dead_mapFile
std::string m_bd_dead_mapFile
Definition: JetTileCorrectionTool.h:138
CP::JetTileCorrectionTool::m_db_dead_LB
std::map< std::string, JTC::Hole > m_db_dead_LB
Definition: JetTileCorrectionTool.h:149
CP::JetTileCorrectionTool::recommendedSystematics
virtual SystematicSet recommendedSystematics() const
returns: the list of all systematics this tool recommends to use
Definition: JetTileCorrectionTool.cxx:236
CP::JetTileCorrectionTool::getModulePosition
IPair getModulePosition(const xAOD::Jet &jet, JTC::Hole module)
Definition: JetTileCorrectionTool.cxx:412
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
maskDeadModules.mod
mod
Definition: maskDeadModules.py:36
CP::IJetTileCorrectionTool
Interface for the tool correcting for dead Tile modules.
Definition: IJetTileCorrectionTool.h:78
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CP::JetTileCorrectionTool::registerSystematics
StatusCode registerSystematics()
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
CP::JetTileCorrectionTool::m_rootFileName
std::string m_rootFileName
Definition: JetTileCorrectionTool.h:136
run
Definition: run.py:1
CP::JetTileCorrectionTool::inHole
bool inHole(const xAOD::Jet &j, JTC::Hole rdead)
Definition: JetTileCorrectionTool.cxx:606
JTC::TYPE::DB
@ DB
CP::JetTileCorrectionTool
Definition: JetTileCorrectionTool.h:46
CP::JetTileCorrectionTool::getTileStatus
JTC::TS getTileStatus(const xAOD::Jet &jet)
Definition: JetTileCorrectionTool.cxx:477
CP::JetTileCorrectionTool::m_current_run
int m_current_run
Definition: JetTileCorrectionTool.h:128
merge.output
output
Definition: merge.py:17
CP::JetTileCorrectionTool::applyCorrection
virtual CorrectionCode applyCorrection(xAOD::Jet &object)
Apply the correction on a modifyable object.
Definition: JetTileCorrectionTool.cxx:147
CP::JetTileCorrectionTool::m_systFilter
std::unordered_map< CP::SystematicSet, CP::SystematicSet > m_systFilter
Systematics filter map.
Definition: JetTileCorrectionTool.h:157
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
CP::JetTileCorrectionTool::initialize
virtual StatusCode initialize()
Function initialising the tool.
Definition: JetTileCorrectionTool.cxx:61
CP::JetTileCorrectionTool::m_NbinsPt
int m_NbinsPt
Definition: JetTileCorrectionTool.h:131
CP::JetTileCorrectionTool::m_isData
bool m_isData
Definition: JetTileCorrectionTool.h:99
CP::JetTileCorrectionTool::m_rootFile
TFile * m_rootFile
Definition: JetTileCorrectionTool.h:135
JTC::Hole
Definition: IJetTileCorrectionTool.h:31
CP::ISystematicsTool
Interface for all CP tools supporting systematic variations.
Definition: ISystematicsTool.h:32
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
CP::JetTileCorrectionTool::loadDeadDB
void loadDeadDB()
Definition: JetTileCorrectionTool.cxx:338
CP::JetTileCorrectionTool::appliedSystematics
const CP::SystematicSet & appliedSystematics() const
returns: the currently applied systematics
Definition: JetTileCorrectionTool.h:80
JetContainer.h
CP::JetTileCorrectionTool::m_user_dead_LB
std::map< std::string, JTC::Hole > m_user_dead_LB
Definition: JetTileCorrectionTool.h:151
asg::AsgMetadataTool
Base class for dual-use tools that provide file metadata access.
Definition: AsgMetadataTool.h:48
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
AsgMetadataTool.h
ASG_TOOL_CLASS3
#define ASG_TOOL_CLASS3(CLASSNAME, INT1, INT2, INT3)
Definition: AsgToolMacros.h:85
CP::CorrectionCode
Return value from object correction CP tools.
Definition: CorrectionCode.h:31
CP::IReentrantSystematicsTool
interface for all CP tools supporting systematic variations within a reentrant algorithm
Definition: IReentrantSystematicsTool.h:58
JTC::PART
PART
Definition: IJetTileCorrectionTool.h:25
CP::JetTileCorrectionTool::m_position_masked
std::vector< JTC::Region > m_position_masked
Definition: JetTileCorrectionTool.h:140
CP::JetTileCorrectionTool::m_constScale
bool m_constScale
Definition: JetTileCorrectionTool.h:125
CP::JetTileCorrectionTool::m_core_sys_LB
TH1F * m_core_sys_LB
//needs to be transient!
Definition: JetTileCorrectionTool.h:143
CP::JetTileCorrectionTool::loadDeadUser
void loadDeadUser()
Definition: JetTileCorrectionTool.cxx:287
merge.status
status
Definition: merge.py:17
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
CP::JetTileCorrectionTool::addTileStatus
StatusCode addTileStatus(const xAOD::Jet &jet)
Definition: JetTileCorrectionTool.cxx:487
CP::JetTileCorrectionTool::overlap
JTC::TS overlap(const xAOD::Jet &j, JTC::Hole region)
Definition: JetTileCorrectionTool.cxx:268
CP::JetTileCorrectionTool::m_core_sys_EB
TH1F * m_core_sys_EB
Definition: JetTileCorrectionTool.h:144
CP::JetTileCorrectionTool::applySystematicVariation
virtual StatusCode applySystematicVariation(const SystematicSet &systConfig)
effects: configure this tool for the given list of systematic variations.
Definition: JetTileCorrectionTool.cxx:242
CP::JetTileCorrectionTool::affectingSystematics
virtual SystematicSet affectingSystematics() const
returns: the list of all systematics this tool can be affected by
Definition: JetTileCorrectionTool.cxx:226
JTC::PART::LB
@ LB
CP::JetTileCorrectionTool::m_isMC
bool m_isMC
Definition: JetTileCorrectionTool.h:126
CP::JetTileCorrectionTool::setRJET
void setRJET(float r)
Definition: JetTileCorrectionTool.cxx:493
CP::JetTileCorrectionTool::loadModulesFromMap
void loadModulesFromMap(const xAOD::Jet &jet, JTC::TS &status, const std::map< std::string, JTC::Hole > &hmap, JTC::PART part=JTC::PART::LB, JTC::TYPE type=JTC::TYPE::DB)
Definition: JetTileCorrectionTool.cxx:442