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

#include <TileCellToTTL1.h>

Inheritance diagram for TileCellToTTL1:
Collaboration diagram for TileCellToTTL1:

Public Member Functions

 TileCellToTTL1 (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~TileCellToTTL1 ()
StatusCode initialize ()
StatusCode execute ()
StatusCode finalize ()
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
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 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

Protected Member Functions

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

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadHandleKey< CaloCellContainerm_cellContainerKey
SG::WriteHandleKey< TileTTL1CellContainerm_ttl1CellContainerKey
const TileIDm_tileID
const CaloLVL1_IDm_TT_ID
const TileCablingServicem_tileCablingService
DataObjIDColl m_extendedExtraObjects
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

Definition at line 51 of file TileCellToTTL1.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ TileCellToTTL1()

TileCellToTTL1::TileCellToTTL1 ( const std::string & name,
ISvcLocator * pSvcLocator )

Definition at line 41 of file TileCellToTTL1.cxx.

42 : AthAlgorithm(name, pSvcLocator)
43 , m_tileID(0)
44 , m_TT_ID(0)
46{
47
48}
AthAlgorithm()
Default constructor:
const TileID * m_tileID
const CaloLVL1_ID * m_TT_ID
const TileCablingService * m_tileCablingService

◆ ~TileCellToTTL1()

TileCellToTTL1::~TileCellToTTL1 ( )
virtual

Definition at line 50 of file TileCellToTTL1.cxx.

50 {
51}

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::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< Algorithm > >::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>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::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< Algorithm > >::evtStore ( )
inlineinherited

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

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode TileCellToTTL1::execute ( )

Definition at line 75 of file TileCellToTTL1.cxx.

75 {
76
77 ATH_MSG_DEBUG( "Executing TileCellToTTL1");
78
79 // -------------------------------------------------
80 // Load the TileCell container
81 // -------------------------------------------------
82
83 SG::ReadHandle<CaloCellContainer> cellContainer(m_cellContainerKey);
84 ATH_CHECK( cellContainer.isValid() );
85
86 // -------------------------------------------------
87 // Create TTL1 container and other arrays
88 // -------------------------------------------------
89 SG::WriteHandle<TileTTL1CellContainer> ttl1CellContainer(m_ttl1CellContainerKey);
90
91 // Register the TTL1 container in the TES
92 ATH_CHECK( ttl1CellContainer.record(std::make_unique<TileTTL1CellContainer>()) );
93 ATH_MSG_DEBUG( "TileTTL1Container registered successfully (" << m_ttl1CellContainerKey.key() << ")");
94
95 struct Arrays {
96 int ttNpmt[32][64]; // array of TT occupancy
97 Identifier ttId[32][64]; // array of TT identifiers
98 float ttAmp[32][64]; // array of all TT amplitudes
99 uint16_t ttStatusCells[32][64]; // array of TT status of cells
100 uint16_t ttStatusChans[32][64]; // array of TT status of channels
101 float ttTimeAve[32][64]; // array of TT time average
102 float ttCorrFact[32][64]; // array of TT correction factor
103 };
104 auto a = std::make_unique<Arrays>();
105
106 // clear the arrays
107 for (int i = 0; i < 32; i++) {
108 for (int j = 0; j < 64; j++) {
109 a->ttNpmt[i][j] = 0;
110 a->ttId[i][j] = 0;
111 a->ttAmp[i][j] = 0.0;
112 a->ttStatusCells[i][j] = 0;
113 a->ttStatusChans[i][j] = 0;
114 a->ttTimeAve[i][j] = 0.0;
115 a->ttCorrFact[i][j] = 1.0; // this is a place holder for now, set to 1.0
116 }
117 }
118
119 // -------------------------------------------------
120 // Loop over all cells
121 // -------------------------------------------------
122
123 for (const CaloCell* cell : *cellContainer) {
124
125 // keep only cells from TileCal calorimeter barrel or extended barrel
126 Identifier cell_id = cell->ID();
127 if (!(m_tileID->is_tile(cell_id))) continue;
128
129 const TileCell* tilecell = dynamic_cast<const TileCell*>(cell);
130 if (!tilecell) continue;
131
132 float cell_ene = cell->energy();
133 float cell_time = cell->time();
134
135 int bad_cell = tilecell->badcell();
136 int bad_chan[2];
137 bad_chan[0] = tilecell->badch1();
138 bad_chan[1] = tilecell->badch2();
139
140 // In order to make sure that the D-cells are correctly added
141 // across two towers. Loop over the two PMTs in each cell
142 // for each PMT reduce the cell energy by 50%.
143
144 for (int ipmt = 0; ipmt < 2; ipmt++) {
145 Identifier pmt_id = m_tileID->pmt_id(cell_id, ipmt);
146 Identifier tt_id = m_tileCablingService->pmt2tt_id(pmt_id);
147
148 // remove the E-cells
149 int sample = m_tileID->sample(pmt_id);
150 if (sample == TileID::SAMP_E) continue;
151
152 // if in the negative eta region add 16 to the ieta offset arrays
153 int eta_offset = 0;
154 if (m_tileID->is_negative(pmt_id))
155 eta_offset = 16;
156
157 // the D0 cell is not being split correctly across cells
158 int ieta = m_TT_ID->eta(tt_id);
159 if (sample == TileID::SAMP_D && ieta == 0 && ipmt == 1)
160 eta_offset = 16;
161
162 ieta += eta_offset;
163 int iphi = m_TT_ID->phi(tt_id);
164
165 // Sum the tower energy
166 // already exists - just add charge
167 // reduce cell energy by 50% because we are loop over both pmts in cell
168 if (a->ttNpmt[ieta][iphi] > 0) {
169 a->ttAmp[ieta][iphi] += cell_ene * 0.5;
170 a->ttNpmt[ieta][iphi]++;
171 a->ttStatusCells[ieta][iphi] += (uint16_t) bad_cell;
172 a->ttStatusChans[ieta][iphi] += (uint16_t) bad_chan[ipmt];
173 a->ttTimeAve[ieta][iphi] += cell_time;
174
175 // rawChannel in new TT
176 } else {
177 a->ttId[ieta][iphi] = tt_id;
178 a->ttNpmt[ieta][iphi]++;
179 a->ttAmp[ieta][iphi] = cell_ene * 0.5;
180 a->ttStatusCells[ieta][iphi] = (uint16_t) bad_cell;
181 a->ttStatusChans[ieta][iphi] = (uint16_t) bad_chan[ipmt];
182 a->ttTimeAve[ieta][iphi] = cell_time;
183 }
184
185 } // end of loop over pmts in the cell
186 } // end loop over cells
187
188 for (int ieta = 0; ieta < 32; ieta++) {
189 for (int iphi = 0; iphi < 64; iphi++) {
190
191 // don't load towers that are empty
192 if (a->ttNpmt[ieta][iphi] == 0) continue;
193
194 float time_ave = a->ttTimeAve[ieta][iphi] / ((float) a->ttNpmt[ieta][iphi]);
195
196 uint16_t qual = 0;
197 if (a->ttStatusChans[ieta][iphi] == a->ttNpmt[ieta][iphi])
199 if (a->ttStatusCells[ieta][iphi] > 0)
201 if (a->ttStatusChans[ieta][iphi] > 0)
203
204 ttl1CellContainer->push_back(std::make_unique<TileTTL1Cell>(a->ttId[ieta][iphi],
205 a->ttAmp[ieta][iphi],
206 time_ave,
207 a->ttCorrFact[ieta][iphi],
208 qual));
209
210 }
211 }
212
213
214 // Execution completed
215 ATH_MSG_DEBUG( "TileCellToTTL1 execution completed.");
216
217 return StatusCode::SUCCESS;
218}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
static Double_t a
SG::WriteHandleKey< TileTTL1CellContainer > m_ttl1CellContainerKey
SG::ReadHandleKey< CaloCellContainer > m_cellContainerKey
virtual bool badcell(void) const override final
check if whole cell is bad (i.e.
Definition TileCell.h:214
bool badch1(void) const
check if first PMT is in bad channel list and masked
Definition TileCell.h:209
bool badch2(void) const
check if second PMT is in bad channel list and masked
Definition TileCell.h:212
setWord1 uint16_t

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::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

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51{
52 // If we didn't find any symlinks to add, just return the collection
53 // from the base class. Otherwise, return the extended collection.
54 if (!m_extendedExtraObjects.empty()) {
56 }
57 return Algorithm::extraOutputDeps();
58}
DataObjIDColl m_extendedExtraObjects

◆ finalize()

StatusCode TileCellToTTL1::finalize ( )

Definition at line 220 of file TileCellToTTL1.cxx.

220 {
221
222 ATH_MSG_INFO( "TileCellToTTL1::finalize() end");
223
224 return StatusCode::SUCCESS;
225}
#define ATH_MSG_INFO(x)

◆ initialize()

StatusCode TileCellToTTL1::initialize ( )

Definition at line 56 of file TileCellToTTL1.cxx.

56 {
57
58 // retrieve CaloLVL1_ID, TileID, from det store
61
63
64 ATH_CHECK( m_cellContainerKey.initialize() );
65 ATH_CHECK( m_ttl1CellContainerKey.initialize() );
66
67 ATH_MSG_INFO( "TileCellToTTL1 initialization completed");
68
69 return StatusCode::SUCCESS;
70}
#define CHECK(...)
Evaluate an expression and check for errors.
const ServiceHandle< StoreGateSvc > & detStore() const
static const TileCablingService * getInstance()
get pointer to service instance
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::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.

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msgLvl()

bool AthCommonMsg< Algorithm >::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< Algorithm > >::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.

◆ 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< Algorithm > >::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< Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, and PyAthena::Alg.

Definition at line 66 of file AthAlgorithm.cxx.

66 {
68
69 if (sc.isFailure()) {
70 return sc;
71 }
72 ServiceHandle<ICondSvc> cs("CondSvc",name());
73 for (auto h : outputHandles()) {
74 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75 // do this inside the loop so we don't create the CondSvc until needed
76 if ( cs.retrieve().isFailure() ) {
77 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78 return StatusCode::SUCCESS;
79 }
80 if (cs->regHandle(this,*h).isFailure()) {
81 sc = StatusCode::FAILURE;
82 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83 << " with CondSvc");
84 }
85 }
86 }
87 return sc;
88}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
static Double_t sc
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::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< Algorithm > >::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_cellContainerKey

SG::ReadHandleKey<CaloCellContainer> TileCellToTTL1::m_cellContainerKey
private
Initial value:
{this,"CaloCellContainer",
"AllCalo", "Input Calo cell container key"}

Definition at line 67 of file TileCellToTTL1.h.

67 {this,"CaloCellContainer",
68 "AllCalo", "Input Calo cell container key"};

◆ m_detStore

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

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

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

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_tileCablingService

const TileCablingService* TileCellToTTL1::m_tileCablingService
private

Definition at line 78 of file TileCellToTTL1.h.

◆ m_tileID

const TileID* TileCellToTTL1::m_tileID
private

Definition at line 76 of file TileCellToTTL1.h.

◆ m_TT_ID

const CaloLVL1_ID* TileCellToTTL1::m_TT_ID
private

Definition at line 77 of file TileCellToTTL1.h.

◆ m_ttl1CellContainerKey

SG::WriteHandleKey<TileTTL1CellContainer> TileCellToTTL1::m_ttl1CellContainerKey
private
Initial value:
{this,"TileTTL1CellContainer",
"TileTTL1CellContainer",
"Output Tile TTL1 cell container key"}

Definition at line 70 of file TileCellToTTL1.h.

70 {this,"TileTTL1CellContainer",
71 "TileTTL1CellContainer",
72 "Output Tile TTL1 cell container key"};

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


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