ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
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 More...
 
 ~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 More...
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Private Member Functions

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

Private Attributes

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

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.

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 }

◆ ~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 }

◆ 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  m_lvl = m_imsg ?
43  static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
44  MSG::INFO;
45 }

◆ 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
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
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.

◆ m_lvl

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

Current logging level.

Definition at line 138 of file AthMessaging.h.

◆ 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:
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
PATCore::ParticleType::UnconvertedPhoton
@ UnconvertedPhoton
Definition: PATCoreEnums.h:38
et
Extra patterns decribing particle interation process.
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
DiTauMassTools::TauTypes::hh
@ hh
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:53
extractSporadic.c1
c1
Definition: extractSporadic.py:134
skel.it
it
Definition: skel.GENtoEVGEN.py:396
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
makeTRTBarrelCans.y1
tuple y1
Definition: makeTRTBarrelCans.py:15
PATCore::ParticleType::ConvertedPhoton
@ ConvertedPhoton
Definition: PATCoreEnums.h:39
hotSpotInTAG.c0
c0
Definition: hotSpotInTAG.py:192
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
LinearityADC::m_hcorr
std::map< PATCore::ParticleType::Type, std::unique_ptr< TProfile2D > > m_hcorr
Definition: LinearityADC.h:42
MuonR4::SegmentFit::ParamDefs::y0
@ y0
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
asg::AsgMessaging
Class mimicking the AthMessaging class from the offline software.
Definition: AsgMessaging.h:40
y
#define y
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
PATCore::ParticleType::Electron
@ Electron
Definition: PATCoreEnums.h:40
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7