ATLAS Offline Software
Loading...
Searching...
No Matches
egammaCellUtils::MaxECell Struct Reference

#include <findMaxECell.h>

Inheritance diagram for egammaCellUtils::MaxECell:
Collaboration diagram for egammaCellUtils::MaxECell:

Public Member Functions

 MaxECell ()=delete
 MaxECell (const xAOD::CaloCluster *clus, const std::string &cellCKey="AllCalo", bool UseWeightForMaxCell=false)
bool msgLvl (const MSG::Level lvl) const
 Test the output level.
MsgStream & msg () const
 The standard message stream.
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream.
void setLevel (MSG::Level lvl)
 Change the current logging level.

Public Attributes

double etaCell = 999
double phiCell = 999
StatusCode sc = StatusCode::FAILURE

Private Member Functions

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

Private Attributes

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

Definition at line 14 of file findMaxECell.h.

Constructor & Destructor Documentation

◆ MaxECell() [1/2]

egammaCellUtils::MaxECell::MaxECell ( )
delete

◆ MaxECell() [2/2]

egammaCellUtils::MaxECell::MaxECell ( const xAOD::CaloCluster * clus,
const std::string & cellCKey = "AllCalo",
bool UseWeightForMaxCell = false )

Definition at line 12 of file findMaxECell.cxx.

14 :
15 AthMessaging("egammaCellUtils::MaxECell") {
16
17 const CaloClusterCellLink* cellLinks = clus->getCellLinks();
18 if (!cellLinks) {
19 ATH_MSG_WARNING("No cell link for cluster. Do nothing");
20 } else {
21
22 // First check :
23 const CaloCellContainer *caloCells = cellLinks->getCellContainer();
24 if (!caloCells) {
25 ATH_MSG_WARNING("No cells for cluster. Do nothing");
26 } else if (cellLinks->getCellContainerLink().dataID() != cellCKey) {
27 // Second check :
28 // one might have used a custom cell container for the linked cells
29 ATH_MSG_ERROR("Wrong key for the calo cells");
30 } else {
31
32 CaloClusterCellLink::const_iterator it_cell = cellLinks->begin(),
33 it_cell_e = cellLinks->end();
34
35 // find maximum cell energy in layer 2
36 double emax = 0.;
37 std::pair<const CaloCell*,double> maxcell{nullptr,0}; //just for debug
38 for(; it_cell != it_cell_e; ++it_cell) {
39 const CaloCell* cell = (*it_cell);
40 if (cell) {
41 if (!cell->caloDDE()) {
42 ATH_MSG_WARNING("Calo cell without detector element ?? eta = "
43 << cell->eta() << " phi = " << cell->phi());
44 continue;
45 }
46 int layer = cell->caloDDE()->getSampling();
47 if (layer == CaloSampling::EMB2 || layer == CaloSampling::EME2) {
48 double w = it_cell.weight();
49 double eCell = cell->energy();
50 if (UseWeightForMaxCell) eCell *= w;
51 if (eCell > emax) {
52 emax = eCell;
53 maxcell.first = cell;
54 maxcell.second = w;
55 }
56 }
57 }
58 }
59
60 if (emax > 0) {
61 etaCell = maxcell.first->caloDDE()->eta_raw();
62 phiCell = maxcell.first->caloDDE()->phi_raw();
63 if (msgLvl(MSG::DEBUG)) {
64 CaloSampling::CaloSample sam = maxcell.first->caloDDE()->getSampling();
65 double etaAmax = clus->etamax(sam);
66 double phiAmax = clus->phimax(sam);
67 double vemax = clus->energy_max(sam);
68 ATH_MSG_DEBUG("Cluster energy in sampling 2 = " << clus->energyBE(2)
69 << " maximum layer 2 energy cell, E = " << maxcell.first->energy()
70 << " check E = " << vemax
71 << " w = " << maxcell.second << "\n"
72 << " in calo frame, eta = " << etaCell << " phi = " << phiCell << "\n"
73 << " in ATLAS frame, eta = " << etaAmax << " phi = " << phiAmax);
74 }
75 } else {
76 ATH_MSG_WARNING("No layer 2 cell with positive energy ! Should never happen");
77 sc = StatusCode::FAILURE;
78 }
79 sc = StatusCode::SUCCESS;
80 } // links OK, good cell container
81 } // no links
82 } // end function
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
AthMessaging()
Default constructor:
bool msgLvl(const MSG::Level lvl) const
Test the output level.
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version)
float energy_max(const CaloSample sampling) const
Retrieve maximum cell energy in given sampling.
float energyBE(const unsigned layer) const
Get the energy in one layer of the EM Calo.
float etamax(const CaloSample sampling) const
Retrieve of cell with maximum energy in given sampling.
float phimax(const CaloSample sampling) const
Retrieve of cell with maximum energy in given sampling.
@ layer
Definition HitInfo.h:79

Member Function Documentation

◆ 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 & AthMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 167 of file AthMessaging.h.

168{
169 MsgStream* ms = m_msg_tls.get();
170 if (!ms) {
171 if (!m_initialized.test_and_set()) initMessaging();
172 ms = new MsgStream(m_imsg,m_nm);
173 m_msg_tls.reset( ms );
174 }
175
176 ms->setLevel (m_lvl);
177 return *ms;
178}
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
void initMessaging() const
Initialize our message level and MessageSvc.

◆ msg() [2/2]

MsgStream & AthMessaging::msg ( const MSG::Level lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 182 of file AthMessaging.h.

183{ return msg() << lvl; }
MsgStream & msg() const
The standard message stream.

◆ msgLvl()

bool AthMessaging::msgLvl ( const MSG::Level lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 151 of file AthMessaging.h.

152{
153 // If user did not set explicit message level we have to initialize
154 // the messaging and retrieve the default via the MessageSvc.
155 if (m_lvl==MSG::NIL && !m_initialized.test_and_set()) initMessaging();
156
157 if (m_lvl <= lvl) {
158 msg() << lvl;
159 return true;
160 } else {
161 return false;
162 }
163}

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

◆ etaCell

double egammaCellUtils::MaxECell::etaCell = 999

Definition at line 16 of file findMaxECell.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.

◆ phiCell

double egammaCellUtils::MaxECell::phiCell = 999

Definition at line 17 of file findMaxECell.h.

◆ sc

StatusCode egammaCellUtils::MaxECell::sc = StatusCode::FAILURE

Definition at line 18 of file findMaxECell.h.


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