ATLAS Offline Software
Loading...
Searching...
No Matches
JetBadChanCorrTool Class Reference

JetBadChanCorrTool. More...

#include <JetBadChanCorrTool.h>

Inheritance diagram for JetBadChanCorrTool:
Collaboration diagram for JetBadChanCorrTool:

Classes

class  ProfileData

Public Member Functions

 JetBadChanCorrTool (const std::string &name)
virtual ~JetBadChanCorrTool ()
virtual StatusCode initialize () override
 Dummy implementation of the initialisation function.
virtual StatusCode decorate (const xAOD::JetContainer &jets) const override
 Decorate a jet collection without otherwise modifying it.
virtual StatusCode setupEvent ()
virtual void print () const
 Print the state of the tool.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
virtual StatusCode modify (xAOD::JetContainer &jets) const override final
 Concrete implementation of the function inherited from IJetModifier.
Additional helper functions, not directly mimicking Athena
template<class T>
const T * getProperty (const std::string &name) const
 Get one of the tool's properties.
const std::string & msg_level_name () const __attribute__((deprecated))
 A deprecated function for getting the message level's name.
const std::string & getName (const void *ptr) const
 Get the name of an object that is / should be in the event store.
SG::sgkey_t getKey (const void *ptr) const
 Get the (hashed) key of an object that is in the event store.

Protected Member Functions

StatusCode correctionFromClustersBadCells (const xAOD::JetContainer &jets) const
StatusCode correctionFromCellsInJet (const xAOD::JetContainer &jets, const jet::CaloCellFastMap *badCellMap) const
float correctionFromCellsInCone (const xAOD::Jet *jet, const jet::CaloCellFastMap *badCellMap) const
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

double getProfile (double pt, double dr, int sample, double eta, double phi) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ServiceHandle< ITHistSvc > m_thistSvc
Gaudi::Property< std::string > m_jetContainerName {this, "JetContainer", "", "SG key for the input jet container"}
Gaudi::Property< int > m_nBadCellLimit {this, "NBadCellLimit", 10000, "Limit to calculate moments"}
Gaudi::Property< std::string > m_streamName {this, "StreamName", "/JetBadChanCorrTool/", "Stream name"}
Gaudi::Property< std::string > m_profileName {this, "ProfileName", "JetBadChanCorrTool.root", "Profile name"}
Gaudi::Property< std::string > m_profileTag {this, "ProfileTag", "", "Profile tag"}
Gaudi::Property< bool > m_useCone {this, "UseCone", true, "Use cone?"}
Gaudi::Property< bool > m_useClusters {this, "UseClusters", false, "Use clusters?"}
SG::ReadHandleKey< jet::CaloCellFastMapm_badCellMap_key {this, "MissingCellMap", "MissingCaloCellsMap", "SG key for missing cell map"}
SG::WriteDecorHandleKey< xAOD::JetContainerm_corrCellKey {this, "CorrCellDecorKey", "BchCorrCell", "SG key for cell level decoration"}
SG::WriteDecorHandleKey< xAOD::JetContainerm_corrDotxKey {this, "CorrDotxDecorKey", "BchCorrDotx", "SG key for DOTX decoration"}
SG::WriteDecorHandleKey< xAOD::JetContainerm_corrJetKey {this, "CorrJetDecorKey", "BchCorrJet", "SG key for jet level decoration"}
SG::WriteDecorHandleKey< xAOD::JetContainerm_corrJetForCellKey {this, "CorrJetForCellDecorKey", "BchCorrJetForCell", "SG key for JetForCell decoration"}
std::vector< ProfileDatam_profileDatas [CaloCell_ID::Unknown]
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

JetBadChanCorrTool.

The energy fraction of dead cells are estimated by jet-level estimator using jet profile. Some cells are already corrected in cell-level using neighboring cells, so this fraction is calculated. The estimation by jet-level for those cells corrected in cell-level is also stored to see the difference or combined the corrections.

BCH_CORR_JET= jet level estimation of the energy fraction of dead cells BCH_CORR_CELL= cell level correction, which is already corrected BCH_CORR_JET_FORCELL= jet level estimation for the corrected cells in cell level

The relation and usage of the moment is jet = jet already corrected in cell level jet x ( 1 - BCH_CORR_CELL ) = jet without cell level correction jet x ( 1 - BCH_CORR_CELL + BCH_CORR_JET ) = jet corrected by jet level estimation jet x ( 1 + BCH_CORR_JET - BCH_CORR_JET_FORCELL ) = jet with cell level correction and corrected in jet level for not covered cells

Properties:

Name Type Default Description
ProcessNJetMax 999999
NBadCellLimit 10000 limit to calculate the moments, if exceed, giving up the calculation ie) when Calorimeter off
AttachCorrCell True switch to attach BCH_CORR_CELL
AttachCorrDOTX True switch to attach BCH_CORR_DOTX
AttachCorrJet True switch to attach BCH_CORR_JET
AttachCorrJetForCell True switch to attach BCH_CORR_JET_FORCELL
StreamName "/JetBadChanCorrTool/" name of stream name
ProfileName "JetBadChanCorrTool.root" name of profile data
ProfileTag "" tag to select profile,"" for all in file
UseCone True boundary of correction, cone or only associated cells
ConeDr 0.4 boundary of correction in case UseCone=True
UseCalibScale False scale for calculation of the contribution of bad cells
CellCalibrator calibration tool for cell-level correction

Definition at line 51 of file JetBadChanCorrTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ JetBadChanCorrTool()

JetBadChanCorrTool::JetBadChanCorrTool ( const std::string & name)

Definition at line 29 of file JetBadChanCorrTool.cxx.

29 :
30 asg::AsgTool(name),
31 m_thistSvc( "THistSvc", name )
32{
33 declareInterface<IJetDecorator>(this);
34}
ServiceHandle< ITHistSvc > m_thistSvc

◆ ~JetBadChanCorrTool()

JetBadChanCorrTool::~JetBadChanCorrTool ( )
virtualdefault

Member Function Documentation

◆ correctionFromCellsInCone()

float JetBadChanCorrTool::correctionFromCellsInCone ( const xAOD::Jet * jet,
const jet::CaloCellFastMap * badCellMap ) const
protected

Definition at line 247 of file JetBadChanCorrTool.cxx.

247 {
248
249 ATH_MSG_DEBUG( " Missing cells for cone search "<< badCellMap->size() << " jet="<< jet->index() << " R="
250 << jet->getSizeParameter() << " input="<< jet->getInputType() << " jet_eta="<<jet->eta() ) ;
251
252 double corr_jet_cone=0;
253
254 double rawPt = jet->jetP4(xAOD::JetEMScaleMomentum).Pt();
255
256 double jeteta = jet->eta();
257 double jetphi = jet->phi();
258 std::vector<jet::CellPosition> closeCells = badCellMap->cellsInDeltaR(jeteta,jetphi, jet->getSizeParameter() );
259 std::vector<jet::CellPosition>::iterator itr = closeCells.begin();
260 std::vector<jet::CellPosition>::iterator itrE = closeCells.end();
261
262 for(; itr!=itrE; ++itr){
263
264 double cell_eta = itr->x();
265 double cell_phi = itr->phi();
266
267 CaloCell_ID::CaloSample sampling = itr->sampling();
268
269 double dr = xAOD::P4Helpers::deltaR(jeteta, jetphi, cell_eta, cell_phi);
270 double frac_cell = getProfile(rawPt, dr, sampling, cell_eta, cell_phi);
271
272 corr_jet_cone += frac_cell;
273 }
274
275 return corr_jet_cone;
276}
#define ATH_MSG_DEBUG(x)
CaloSampling::CaloSample CaloSample
Definition CaloCell_ID.h:53
double getProfile(double pt, double dr, int sample, double eta, double phi) const
unsigned int size() const
size_t index() const
Return the index of this element within its container.
std::vector< CellPosition > cellsInDeltaR(double eta, double phi, double r) const
virtual double phi() const
The azimuthal angle ( ) of the particle.
Definition Jet_v1.cxx:54
float getSizeParameter() const
Definition Jet_v1.cxx:245
JetInput::Type getInputType() const
Definition Jet_v1.cxx:253
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition Jet_v1.cxx:49
JetFourMom_t jetP4() const
The full 4-momentum of the particle : internal jet type.
Definition Jet_v1.cxx:76
double deltaR(double rapidity1, double phi1, double rapidity2, double phi2)
from bare bare rapidity,phi
@ JetEMScaleMomentum
Definition JetTypes.h:28

◆ correctionFromCellsInJet()

StatusCode JetBadChanCorrTool::correctionFromCellsInJet ( const xAOD::JetContainer & jets,
const jet::CaloCellFastMap * badCellMap ) const
protected

Definition at line 165 of file JetBadChanCorrTool.cxx.

165 {
166
167 SG::WriteDecorHandle<xAOD::JetContainer, float> corrCellHandle(m_corrCellKey);
168 SG::WriteDecorHandle<xAOD::JetContainer, float> corrDotxHandle(m_corrDotxKey);
169 SG::WriteDecorHandle<xAOD::JetContainer, float> corrJetHandle(m_corrJetKey);
170 SG::WriteDecorHandle<xAOD::JetContainer, float> corrJetForCellHandle(m_corrJetForCellKey);
171
172 for(const xAOD::Jet* jet : jets){
173
175 double rawPt = p4.Pt();
176 double rawE = p4.E();
177
178 // jet moments, fraction
179 double corr_jet_associate=0;
180 double corr_jet_forcell=0;
181 double corr_cell=0;
182 double corr_dotx=0;
183
184 jet::JetCellAccessor::const_iterator cellIt = jet::JetCellAccessor::begin(jet);
185 jet::JetCellAccessor::const_iterator cellItE = jet::JetCellAccessor::end(jet);
186
187 for( ;cellIt!=cellItE; ++cellIt) {
188
189 const CaloDetDescrElement * dde = (*cellIt)->caloDDE();
190 const CaloCell *cell = *cellIt;
191 double cellWeight = cellIt.weight();
192
193 double cell_energy = cell->e() * cellWeight;
194
195 CaloCell_ID::CaloSample sampling = dde->getSampling();
196
197 bool considerBad = cell->badcell();
198 // for bad channels in jet
199 if(considerBad){
200
201 // determine if this comes from a deadOTX
202 bool isOTX = false;
203 if(!(dde->is_tile()))
204 if(cell->provenance() & 0x0200)
205 isOTX = true;
206
207 double dr = xAOD::P4Helpers::deltaR(jet->eta(),jet->phi(),dde->eta(), dde->phi());
208 double frac_cell = getProfile(rawPt, dr, sampling, dde->eta(), dde->phi());
209
210 double frac = frac_cell * cellWeight;
211
212 corr_jet_associate += frac;
213
214 // corrected in cell-level
215 if(cell_energy!=0){
216 // for cryo.
217 if(isOTX)
218 corr_dotx += cell_energy;
219 else
220 corr_cell += cell_energy;
221
222 corr_jet_forcell += frac;
223 }
224 }
225 } // loop over cells
226
227 const double inv_rawE = 1. / rawE;
228 corr_cell *= inv_rawE;
229 corr_dotx *= inv_rawE;
230 ATH_MSG( DEBUG ) << "pt=" << jet->pt()/GeV << " eta=" << jet->eta() << " phi=" << jet->phi()
231 << " BCH_CORR_CELL=" << corr_cell
232 << " BCH_CORR_DOTX=" << corr_dotx
233 << " BCH_CORR_JET=" << corr_jet_associate
234 << " BCH_CORR_JET_FORCELL=" << corr_jet_forcell << endmsg;
235
236 corrCellHandle(*jet) = corr_cell;
237 corrDotxHandle(*jet) = corr_dotx;
238 corrJetForCellHandle(*jet) = corr_jet_forcell;
239 if(m_useCone)
240 corrJetHandle(*jet) = correctionFromCellsInCone(jet, badCellMap);
241 else
242 corrJetHandle(*jet) = corr_jet_associate;
243 }
244 return StatusCode::SUCCESS;
245}
#define endmsg
#define ATH_MSG(lvl)
CaloCell_ID::CaloSample getSampling() const
cell sampling
SG::WriteDecorHandleKey< xAOD::JetContainer > m_corrJetKey
Gaudi::Property< bool > m_useCone
float correctionFromCellsInCone(const xAOD::Jet *jet, const jet::CaloCellFastMap *badCellMap) const
SG::WriteDecorHandleKey< xAOD::JetContainer > m_corrCellKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_corrDotxKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_corrJetForCellKey
weight_t weight() const
Accessor for weight associated to this cell.
static const_iterator begin(const xAOD::Jet *jet)
static const_iterator end(const xAOD::Jet *jet)
Jet_v1 Jet
Definition of the current "jet version".
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.
Definition JetTypes.h:17
#define DEBUG
Definition page_access.h:11

◆ correctionFromClustersBadCells()

StatusCode JetBadChanCorrTool::correctionFromClustersBadCells ( const xAOD::JetContainer & jets) const
protected

Definition at line 278 of file JetBadChanCorrTool.cxx.

278 {
279
280 SG::WriteDecorHandle<xAOD::JetContainer, float> corrCellHandle(m_corrCellKey);
281
282 for(const xAOD::Jet* jet : jets){
283
284 double corrCell=0;
285
286 size_t nconstit=jet->numConstituents();
287 for(size_t i=0; i<nconstit; i++) {
288 // use the raw constituents since we're interested only in one moment :
289 const xAOD::IParticle* constit = jet->rawConstituent(i);
290 if( constit->type() != xAOD::Type::CaloCluster ) continue;
291 double badE;
292 bool v = static_cast<const xAOD::CaloCluster*>(constit)->retrieveMoment( xAOD::CaloCluster::ENG_BAD_CELLS, badE);
293 if(v) corrCell += badE;
294 }
295
296 double rawE = jet->jetP4(xAOD::JetEMScaleMomentum).E();
297 if(rawE==0) corrCellHandle(*jet) = 0;
298 else corrCellHandle(*jet) = corrCell / rawE;
299 }
300 return StatusCode::SUCCESS;
301}
@ ENG_BAD_CELLS
Total em-scale energy of bad cells in this cluster.
virtual Type::ObjectType type() const =0
The type of the object as a simple enumeration.
@ CaloCluster
The object is a calorimeter cluster.
Definition ObjectType.h:39
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ decorate()

StatusCode JetBadChanCorrTool::decorate ( const xAOD::JetContainer & jets) const
overridevirtual

Decorate a jet collection without otherwise modifying it.

Implements IJetDecorator.

Definition at line 134 of file JetBadChanCorrTool.cxx.

135{
136
138
139 auto handle = SG::makeHandle (m_badCellMap_key);
140 if (!handle.isValid()){
141 ATH_MSG_ERROR("Could not retieve bad cell map " << m_badCellMap_key.key());
142 return StatusCode::FAILURE;
143 }
144
145 const auto *badCellMap = handle.cptr();
146
147 // number of bad cells exceed the limit, set moments -1 and skip
148 if((int) badCellMap->cells().size() >m_nBadCellLimit){
149 SG::WriteDecorHandle<xAOD::JetContainer, float> corrCellHandle(m_corrCellKey);
150 SG::WriteDecorHandle<xAOD::JetContainer, float> corrDotxHandle(m_corrDotxKey);
151 SG::WriteDecorHandle<xAOD::JetContainer, float> corrJetHandle(m_corrJetKey);
152 SG::WriteDecorHandle<xAOD::JetContainer, float> corrJetForCellHandle(m_corrJetForCellKey);
153 for(const xAOD::Jet* jet : jets){
154 corrCellHandle(*jet) = -1.;
155 corrDotxHandle(*jet) = -1.;
156 corrJetHandle(*jet) = -1.;
157 corrJetForCellHandle(*jet) = -1.;
158 }
159 return StatusCode::SUCCESS;
160 }
161
162 return correctionFromCellsInJet(jets, badCellMap);
163}
#define ATH_MSG_ERROR(x)
Gaudi::Property< int > m_nBadCellLimit
StatusCode correctionFromClustersBadCells(const xAOD::JetContainer &jets) const
SG::ReadHandleKey< jet::CaloCellFastMap > m_badCellMap_key
StatusCode correctionFromCellsInJet(const xAOD::JetContainer &jets, const jet::CaloCellFastMap *badCellMap) const
Gaudi::Property< bool > m_useClusters
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void * ptr) const
inherited

Get the (hashed) key of an object that is in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119 {
120
121#ifdef XAOD_STANDALONE
122 // In case we use @c xAOD::TEvent, we have a direct function call
123 // for this.
124 return evtStore()->event()->getKey( ptr );
125#else
126 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127 return ( proxy == nullptr ? 0 : proxy->sgkey() );
128#endif // XAOD_STANDALONE
129 }
ServiceHandle< StoreGateSvc > & evtStore()

◆ getName()

const std::string & asg::AsgTool::getName ( const void * ptr) const
inherited

Get the name of an object that is / should be in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106 {
107
108#ifdef XAOD_STANDALONE
109 // In case we use @c xAOD::TEvent, we have a direct function call
110 // for this.
111 return evtStore()->event()->getName( ptr );
112#else
113 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114 static const std::string dummy = "";
115 return ( proxy == nullptr ? dummy : proxy->name() );
116#endif // XAOD_STANDALONE
117 }

◆ getProfile()

double JetBadChanCorrTool::getProfile ( double pt,
double dr,
int sample,
double eta,
double phi ) const
private

Definition at line 303 of file JetBadChanCorrTool.cxx.

303 {
304 std::vector<ProfileData>::const_iterator itr =m_profileDatas[sample].begin();
305 std::vector<ProfileData>::const_iterator itrE =m_profileDatas[sample].end();
306 for(; itr!=itrE; ++itr){
307 if((*itr).match(pt/GeV,sample,eta,phi)){
308 return (*itr).frac(dr);
309 }
310 }
311 return 0;
312}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
std::vector< ProfileData > m_profileDatas[CaloCell_ID::Unknown]

◆ getProperty()

template<class T>
const T * asg::AsgTool::getProperty ( const std::string & name) const
inherited

Get one of the tool's properties.

◆ initialize()

StatusCode JetBadChanCorrTool::initialize ( void )
overridevirtual

Dummy implementation of the initialisation function.

It's here to allow the dual-use tools to skip defining an initialisation function. Since many are doing so...

Reimplemented from asg::AsgTool.

Definition at line 39 of file JetBadChanCorrTool.cxx.

40{
41 ATH_MSG_DEBUG("initializing version with data handles");
42
43 if(!m_useClusters){
44 std::string fname = PathResolver::find_file(m_profileName, "DATAPATH");
45
46 if(fname.empty()){
47 ATH_MSG(ERROR) << "Could not get file " << m_profileName << endmsg;
48 return StatusCode::FAILURE;
49 }
50 TFile tf(fname.c_str());
51 if(!tf.IsOpen()){
52 ATH_MSG( ERROR ) << "Could not open file " << fname << endmsg;
53 return StatusCode::FAILURE;
54 }
55 // already registered hists
56 std::vector<std::string> histsInSvc = m_thistSvc->getHists();
57
58 TListIter next(tf.GetListOfKeys());
59 TObject *obj;
60 while((obj = next())) {
61 std::string hname=obj->GetName();
62 if(hname.find('_')==std::string::npos) continue;
63 std::string tag = hname.substr(0,hname.find('_'));
64 std::string para = hname.substr(hname.find('_')+1);
65 std::string location = m_streamName+hname;
66
67 if(m_profileTag=="" || m_profileTag==tag){
68 // read in histo not registered yet
69 if(find(histsInSvc.begin(),histsInSvc.end(),location)==histsInSvc.end()){
70 StatusCode sc = m_thistSvc->regHist(location);
71 if(sc.isFailure()){
72 ATH_MSG( ERROR ) << "failed to read histo " << location << endmsg;
73 return StatusCode::FAILURE;
74 }
75 }
76 int sample=0;
77 double ptMin=0;
78 double ptMax=9999;
79 double etaMin=0;
80 double etaMax=5.0;
81 double phiMin=-M_PI;
82 double phiMax=M_PI;
83 int ret = sscanf(para.c_str(),"sample%d_pt%lf_%lf_eta%lf_%lf_phi%lf_%lf",
84 &sample,&ptMin,&ptMax,&etaMin,&etaMax,&phiMin,&phiMax);
85
86 if(ret<1 || sample<0 || sample>=CaloCell_ID::Unknown) {
87 ATH_MSG( DEBUG ) << "Could not understand the name of hist " << obj->GetName() << endmsg;
88 continue;
89 }
90
91 TH1* th=nullptr;
92 StatusCode sc = m_thistSvc->getHist(location,th);
93 if(sc.isFailure()){
94 ATH_MSG( ERROR ) << "failed to get histo " << location << endmsg;
95 return StatusCode::FAILURE;
96 }
97 m_profileDatas[sample].emplace_back(th,sample,ptMin,ptMax,etaMin,etaMax,phiMin,phiMax);
98 ATH_MSG( DEBUG ) << "read hist=" << th->GetName()
99 << " tag=" << tag << " sample=" << sample
100 << " ptMin=" << ptMin << " ptMax=" << ptMax
101 << " etaMin=" << etaMin << " etaMax=" << etaMax
102 << " phiMin=" << phiMin << " phiMax=" << phiMax << endmsg;
103 }
104 }
105 }
106
107 if(m_jetContainerName.empty()){
108 ATH_MSG_ERROR("JetBadChanCorrTool needs to have its input jet container name configured!");
109 return StatusCode::FAILURE;
110 }
111
112 ATH_CHECK(m_badCellMap_key.initialize());
113
118
119 ATH_CHECK(m_corrCellKey.initialize());
120 // These 3 aren't used if we're configured to use clusters
124
125 return StatusCode::SUCCESS;
126}
#define M_PI
#define ATH_CHECK
Evaluate an expression and check for errors.
static Double_t sc
Gaudi::Property< std::string > m_jetContainerName
Gaudi::Property< std::string > m_streamName
Gaudi::Property< std::string > m_profileTag
Gaudi::Property< std::string > m_profileName
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
std::string find(const std::string &s)
return a remapped string
Definition hcg.cxx:138
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ modify()

virtual StatusCode IJetDecorator::modify ( xAOD::JetContainer & jets) const
inlinefinaloverridevirtualinherited

Concrete implementation of the function inherited from IJetModifier.

Implements IJetModifier.

Definition at line 32 of file IJetDecorator.h.

32{return decorate(jets);};
virtual StatusCode decorate(const xAOD::JetContainer &jets) const =0
Decorate a jet collection without otherwise modifying it.

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
inherited

A deprecated function for getting the message level's name.

Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101 {
102
103 return MSG::name( msg().level() );
104 }
MsgStream & msg() const
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition MsgLevel.cxx:19

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ print()

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setupEvent()

StatusCode JetBadChanCorrTool::setupEvent ( )
virtual

Definition at line 128 of file JetBadChanCorrTool.cxx.

129{
130 return StatusCode::SUCCESS;
131}

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_badCellMap_key

SG::ReadHandleKey<jet::CaloCellFastMap> JetBadChanCorrTool::m_badCellMap_key {this, "MissingCellMap", "MissingCaloCellsMap", "SG key for missing cell map"}
private

Definition at line 89 of file JetBadChanCorrTool.h.

89{this, "MissingCellMap", "MissingCaloCellsMap", "SG key for missing cell map"};

◆ m_corrCellKey

SG::WriteDecorHandleKey<xAOD::JetContainer> JetBadChanCorrTool::m_corrCellKey {this, "CorrCellDecorKey", "BchCorrCell", "SG key for cell level decoration"}
private

Definition at line 90 of file JetBadChanCorrTool.h.

90{this, "CorrCellDecorKey", "BchCorrCell", "SG key for cell level decoration"};

◆ m_corrDotxKey

SG::WriteDecorHandleKey<xAOD::JetContainer> JetBadChanCorrTool::m_corrDotxKey {this, "CorrDotxDecorKey", "BchCorrDotx", "SG key for DOTX decoration"}
private

Definition at line 91 of file JetBadChanCorrTool.h.

91{this, "CorrDotxDecorKey", "BchCorrDotx", "SG key for DOTX decoration"};

◆ m_corrJetForCellKey

SG::WriteDecorHandleKey<xAOD::JetContainer> JetBadChanCorrTool::m_corrJetForCellKey {this, "CorrJetForCellDecorKey", "BchCorrJetForCell", "SG key for JetForCell decoration"}
private

Definition at line 93 of file JetBadChanCorrTool.h.

93{this, "CorrJetForCellDecorKey", "BchCorrJetForCell", "SG key for JetForCell decoration"};

◆ m_corrJetKey

SG::WriteDecorHandleKey<xAOD::JetContainer> JetBadChanCorrTool::m_corrJetKey {this, "CorrJetDecorKey", "BchCorrJet", "SG key for jet level decoration"}
private

Definition at line 92 of file JetBadChanCorrTool.h.

92{this, "CorrJetDecorKey", "BchCorrJet", "SG key for jet level decoration"};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_jetContainerName

Gaudi::Property<std::string> JetBadChanCorrTool::m_jetContainerName {this, "JetContainer", "", "SG key for the input jet container"}
private

Definition at line 78 of file JetBadChanCorrTool.h.

78{this, "JetContainer", "", "SG key for the input jet container"};

◆ m_nBadCellLimit

Gaudi::Property<int> JetBadChanCorrTool::m_nBadCellLimit {this, "NBadCellLimit", 10000, "Limit to calculate moments"}
private

Definition at line 79 of file JetBadChanCorrTool.h.

79{this, "NBadCellLimit", 10000, "Limit to calculate moments"};

◆ m_profileDatas

std::vector<ProfileData> JetBadChanCorrTool::m_profileDatas[CaloCell_ID::Unknown]
private

Definition at line 131 of file JetBadChanCorrTool.h.

◆ m_profileName

Gaudi::Property<std::string> JetBadChanCorrTool::m_profileName {this, "ProfileName", "JetBadChanCorrTool.root", "Profile name"}
private

Definition at line 83 of file JetBadChanCorrTool.h.

83{this, "ProfileName", "JetBadChanCorrTool.root", "Profile name"};

◆ m_profileTag

Gaudi::Property<std::string> JetBadChanCorrTool::m_profileTag {this, "ProfileTag", "", "Profile tag"}
private

Definition at line 84 of file JetBadChanCorrTool.h.

84{this, "ProfileTag", "", "Profile tag"};

◆ m_streamName

Gaudi::Property<std::string> JetBadChanCorrTool::m_streamName {this, "StreamName", "/JetBadChanCorrTool/", "Stream name"}
private

Definition at line 82 of file JetBadChanCorrTool.h.

82{this, "StreamName", "/JetBadChanCorrTool/", "Stream name"};

◆ m_thistSvc

ServiceHandle<ITHistSvc> JetBadChanCorrTool::m_thistSvc
private

Definition at line 76 of file JetBadChanCorrTool.h.

◆ m_useClusters

Gaudi::Property<bool> JetBadChanCorrTool::m_useClusters {this, "UseClusters", false, "Use clusters?"}
private

Definition at line 87 of file JetBadChanCorrTool.h.

87{this, "UseClusters", false, "Use clusters?"};

◆ m_useCone

Gaudi::Property<bool> JetBadChanCorrTool::m_useCone {this, "UseCone", true, "Use cone?"}
private

Definition at line 86 of file JetBadChanCorrTool.h.

86{this, "UseCone", true, "Use cone?"};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: