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

parameterization of correction for ADC non linearity More...

#include <LinearityADC.h>

Inheritance diagram for LinearityADC:
Collaboration diagram for LinearityADC:

Public Member Functions

 LinearityADC (const std::string &filename, const std::string &name="ADCNonLinearityCorrection")
 constructor (initialization done there reading a root file for the HV maps per period
 ~LinearityADC ()
float getCorr (float etaCalo, float et, PATCore::ParticleType::Type ptype=PATCore::ParticleType::Electron) const
 get relative correction factor to apply to energy: corrected energy should be original energy * correction factor
void setLevel (MSG::Level lvl)
 Change the current logging level.
Functions providing the same interface as AthMessaging
bool msgLvl (const MSG::Level lvl) const
 Test the output level of the object.
MsgStream & msg () const
 The standard message stream.
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream.

Private Member Functions

void initMessaging () const
 Initialize our message level and MessageSvc.

Private Attributes

std::map< PATCore::ParticleType::Type, std::unique_ptr< TProfile2D > > m_hcorr
std::string m_nm
 Message source name.
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels)
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer.
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level.
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging)

Detailed Description

parameterization of correction for ADC non linearity

deltaADC vs ADC parameterized from calibration runs in different eta bins for HG/MG/HG by Luca applied to single particle samples to parameterize vs eta and Et and particle type

Definition at line 25 of file LinearityADC.h.

Constructor & Destructor Documentation

◆ LinearityADC()

LinearityADC::LinearityADC ( const std::string & filename,
const std::string & name = "ADCNonLinearityCorrection" )

constructor (initialization done there reading a root file for the HV maps per period

Definition at line 9 of file LinearityADC.cxx.

10 : asg::AsgMessaging(name) {
11 ATH_MSG_INFO("Initialize LinearityADC with file " << filename);
12 std::unique_ptr<TFile> adcFile(TFile::Open(filename.c_str(), "READ"));
13 static const std::map<TString, PATCore::ParticleType::Type> pN = {
17 for (const auto & [ptclName, ptclType] : pN) {
18 m_hcorr[ptclType].reset(dynamic_cast<TProfile2D*>(
19 adcFile->Get(Form("linearity_%s", ptclName.Data()))));
20 m_hcorr[ptclType]->SetDirectory(nullptr);
21 }
22 adcFile->Close();
23}
#define ATH_MSG_INFO(x)
std::map< PATCore::ParticleType::Type, std::unique_ptr< TProfile2D > > m_hcorr

◆ ~LinearityADC()

LinearityADC::~LinearityADC ( )
inline

Definition at line 32 of file LinearityADC.h.

32{};

Member Function Documentation

◆ getCorr()

float LinearityADC::getCorr ( float etaCalo,
float et,
PATCore::ParticleType::Type ptype = PATCore::ParticleType::Electron ) const

get relative correction factor to apply to energy: corrected energy should be original energy * correction factor

inputs: etaCalo and Et in MeV, pType (enum)

Definition at line 26 of file LinearityADC.cxx.

27 {
28 float corr = 0.;
29 float etGeV = et / 1000.;
30 if (etGeV < 6.)
31 etGeV = 6.;
32 if (etGeV > 2999.)
33 etGeV = 2999.;
34
35 auto it = m_hcorr.find(pType);
36 if (it == m_hcorr.end()) {
37 ATH_MSG_ERROR("unknown particle type " << pType);
38 return 1.;
39 }
40 TProfile2D* hh = it->second.get();
41
42 float aeta = std::abs(etaCalo);
43 if (aeta > 2.49)
44 aeta = 2.49;
45
46 int ix = hh->GetXaxis()->FindBin(aeta);
47 int iy = hh->GetYaxis()->FindBin(etGeV);
48 float y = hh->GetYaxis()->GetBinCenter(iy);
49 int iy0, iy1;
50 if (y > etGeV) {
51 iy0 = iy - 1;
52 iy1 = iy;
53 } else {
54 iy0 = iy;
55 iy1 = iy + 1;
56 }
57
58 int iyc = hh->GetYaxis()->FindBin(40.);
59
60 if (iy0 < 1)
61 corr = hh->GetBinContent(ix, iy1);
62 if (iy1 > hh->GetYaxis()->GetNbins())
63 corr = hh->GetBinContent(ix, iy0);
64
65 float y0 = hh->GetYaxis()->GetBinCenter(iy0);
66 float y1 = hh->GetYaxis()->GetBinCenter(iy1);
67 // subtract effect for 40 GeV Et electrons
69 if (it == m_hcorr.end()){
70 ATH_MSG_ERROR("Unknown particle type " << pType<<" in LinearityADC::getCorr");
71 return 1.;
72 }
73 float c0 = hh->GetBinContent(ix, iy0) - it->second->GetBinContent(ix, iyc);
74 float c1 = hh->GetBinContent(ix, iy1) - it->second->GetBinContent(ix, iyc);
75
76 corr = (c1 * (etGeV - y0) + c0 * (y1 - etGeV)) / (y1 - y0);
77 ATH_MSG_VERBOSE("correction from ADC non linearity = " << corr);
78
79 return (1. + corr);
80}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
float et(const xAOD::jFexSRJetRoI *j)
#define y

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40{
42 // If user did not set an explicit level, set a default
43 if (m_lvl == MSG::NIL) {
44 m_lvl = m_imsg ?
45 static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
46 MSG::INFO;
47 }
48}
std::string m_nm
Message source name.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::atomic< MSG::Level > m_lvl
Current logging level.
IMessageSvc * getMessageSvc(bool quiet=false)

◆ msg() [1/2]

MsgStream & asg::AsgMessaging::msg ( ) const
inherited

The standard message stream.

Returns
A reference to the default message stream of this object.

Definition at line 49 of file AsgMessaging.cxx.

49 {
50#ifndef XAOD_STANDALONE
51 return ::AthMessaging::msg();
52#else // not XAOD_STANDALONE
53 return m_msg;
54#endif // not XAOD_STANDALONE
55 }

◆ msg() [2/2]

MsgStream & asg::AsgMessaging::msg ( const MSG::Level lvl) const
inherited

The standard message stream.

Parameters
lvlThe message level to set the stream to
Returns
A reference to the default message stream, set to level "lvl"

Definition at line 57 of file AsgMessaging.cxx.

57 {
58#ifndef XAOD_STANDALONE
59 return ::AthMessaging::msg( lvl );
60#else // not XAOD_STANDALONE
61 m_msg << lvl;
62 return m_msg;
63#endif // not XAOD_STANDALONE
64 }

◆ msgLvl()

bool asg::AsgMessaging::msgLvl ( const MSG::Level lvl) const
inherited

Test the output level of the object.

Parameters
lvlThe message level to test against
Returns
boolean Indicting if messages at given level will be printed
true If messages at level "lvl" will be printed

Definition at line 41 of file AsgMessaging.cxx.

41 {
42#ifndef XAOD_STANDALONE
43 return ::AthMessaging::msgLvl( lvl );
44#else // not XAOD_STANDALONE
45 return m_msg.msgLevel( lvl );
46#endif // not XAOD_STANDALONE
47 }

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29{
30 m_lvl = lvl;
31}

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ m_hcorr

std::map<PATCore::ParticleType::Type, std::unique_ptr<TProfile2D> > LinearityADC::m_hcorr
private

Definition at line 42 of file LinearityADC.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

135{ nullptr };

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

138{ MSG::NIL };

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.


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