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

The L1CaloRampMaker creates a set of L1CaloRampData objects. More...

#include <L1CaloRampMaker.h>

Inheritance diagram for L1CaloRampMaker:

Public Member Functions

 L1CaloRampMaker (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~L1CaloRampMaker ()
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

void setupRampDataContainer (const xAOD::TriggerTowerContainer *triggerTowerContainer)
double getTriggerTowerEnergy (const xAOD::TriggerTower *tt, SG::ReadCondHandle< L1CaloPprChanCalibContainer > pprCond)
double getCaloEnergy (const xAOD::TriggerTower *tt)
void checkProvenance (const xAOD::TriggerTower *tt)
bool validTower (const bool &isTile)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

std::string m_triggerTowerContainerName
std::string m_outputFolderName
std::string m_gainStrategyFolder
std::map< int, int > m_specialChannelRange
bool m_doLAr
bool m_doTile
bool m_isGain1
bool m_isOvEmb
bool m_isOvEmec
bool m_isFcalLowEta
bool m_isFcalHighEta
bool m_checkProvenance
unsigned int m_nEventsPerStep
unsigned int m_nSteps
int m_fadcSaturationCut
double m_tileSaturationCut
ToolHandle< LVL1::IL1TriggerTowerToolRun3m_ttTool
ToolHandle< LVL1::IL1CaloxAODOfflineTriggerTowerToolsm_xAODTTTools
ToolHandle< LVL1::IL1CaloOfflineTriggerTowerToolsm_jmTools
unsigned int m_nEvent
bool m_firstEvent
unsigned int m_nTTs
const CaloLVL1_IDm_lvl1Helper
std::unique_ptr< L1CaloRampDataContainerm_rampDataContainer
std::map< unsigned int, std::pair< unsigned int, double > > m_mapBadOFCIteration
SG::ReadCondHandleKey< CondAttrListCollectionm_strategy { this, "TRIGGER", "/TRIGGER/Receivers/Conditions/Strategy", "Strategy" }
SG::ReadCondHandleKey< L1CaloPprChanCalibContainerm_pprChanCalibContainer { this, "InputKeyCond", "L1CaloPprChanCalibContainer"}
SG::ReadCondHandleKey< L1CaloPprDisabledChannelContainerRun2m_pprDisabledChannelContainer { this, "InputKeyDisabledChannel", "L1CaloPprDisabledChannelContainerRun2"}
SG::ReadCondHandleKey< LArOnOffIdMappingm_cablingKey {this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"}
SG::ReadHandleKey< CaloCellContainerm_caloCellsKey { this, "CaloCellsKey", "AllCalo", "CaloCellContainer key" }
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

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

◆ L1CaloRampMaker()

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

Definition at line 42 of file L1CaloRampMaker.cxx.

43 : AthAlgorithm(name, pSvcLocator),
44 m_triggerTowerContainerName(LVL1::TrigT1CaloDefs::xAODTriggerTowerLocation),
45 m_outputFolderName("/L1CaloRampMaker/L1CaloRampDataContainer"),
46 m_gainStrategyFolder("/TRIGGER/Receivers/Conditions/Strategy"),
47 m_doLAr(false),
48 m_doTile(false),
49 m_isGain1(true),
50 m_isOvEmb(false),
51 m_isOvEmec(false),
52 m_isFcalLowEta(false),
53 m_isFcalHighEta(false),
54 m_checkProvenance(false),
55 m_nEventsPerStep(200),
56 m_nSteps(9),
57 m_fadcSaturationCut(963),
58 m_tileSaturationCut(150.),
59 m_ttTool("LVL1::L1TriggerTowerToolRun3/L1TriggerTowerToolRun3"),
60 m_xAODTTTools("LVL1::L1CaloxAODOfflineTriggerTowerTools/L1CaloxAODOfflineTriggerTowerTools", this),
61 m_jmTools("LVL1::L1CaloOfflineTriggerTowerTools/L1CaloOfflineTriggerTowerTools", this),
62 m_nEvent(1),
63 m_firstEvent(true),
64 m_nTTs(0),
65 m_lvl1Helper(nullptr),
66 m_rampDataContainer(nullptr)
67
68{
69 declareProperty("TriggerTowerCollectionName", m_triggerTowerContainerName);
70 declareProperty("OutputFolderName", m_outputFolderName);
71 declareProperty("GainStrategyFolder", m_gainStrategyFolder);
72 declareProperty("DoLAr", m_doLAr);
73 declareProperty("DoTile", m_doTile);
74 declareProperty("IsGain1", m_isGain1);
75 declareProperty("IsOvEmb", m_isOvEmb);
76 declareProperty("IsOvEmec", m_isOvEmec);
77 declareProperty("IsFcalLowEta", m_isFcalLowEta);
78 declareProperty("IsFcalHighEta", m_isFcalHighEta);
79 declareProperty("CheckProvenance", m_checkProvenance);
80 declareProperty("EventsPerEnergyStep", m_nEventsPerStep);
81 declareProperty("NumberOfEnergySteps", m_nSteps);
82 declareProperty("FADCSaturationCut", m_fadcSaturationCut);
83 declareProperty("TileSaturationCut", m_tileSaturationCut);
84 declareProperty("L1TriggerTowerToolRun3", m_ttTool);
85 declareProperty("SpecialChannelRange", m_specialChannelRange);
86}
Base class from which all concrete Athena algorithm classes should be derived.
static const std::string xAODTriggerTowerLocation

◆ ~L1CaloRampMaker()

L1CaloRampMaker::~L1CaloRampMaker ( )
virtual

Definition at line 88 of file L1CaloRampMaker.cxx.

89{
90}

Member Function Documentation

◆ checkProvenance()

void L1CaloRampMaker::checkProvenance ( const xAOD::TriggerTower * tt)
private

Definition at line 384 of file L1CaloRampMaker.cxx.

384 {
385 const std::vector<const CaloCell*>& cells(m_xAODTTTools->getCaloCells(*tt));
386 double oneOverNCells = 1./double(cells.size());
387 for(const auto *cell : cells) {
388 auto it = m_mapBadOFCIteration.find(tt->coolId());
389 if(it == m_mapBadOFCIteration.end()) {
390 m_mapBadOFCIteration.insert(std::make_pair(tt->coolId(), std::make_pair(!(cell->provenance() & 0x100),
391 (cell->time()*oneOverNCells))));
392 continue;
393 }
394 if(!(cell->provenance() & 0x100)) {
395 it->second.first += 1;
396 }
397 it->second.second += (cell->time()*oneOverNCells);
398 }
399}

◆ 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 L1CaloRampMaker::execute ( )

Definition at line 117 of file L1CaloRampMaker.cxx.

118{
119 // Skip spurious events
120 unsigned int wantedEvents = m_nEventsPerStep*m_nSteps;
121 if (m_nEvent > wantedEvents) {
122 if (m_nEvent == wantedEvents+1) {
123 ATH_MSG_INFO( "Processed " << wantedEvents
124 << " events, skipping the rest" );
125 }
126 ++m_nEvent;
127 return StatusCode::SUCCESS;
128 }
129
130 const xAOD::EventInfo* eventInfo = nullptr;
131 CHECK(evtStore()->retrieve(eventInfo));
132 if (eventInfo->eventNumber() == 0 && m_nEvent > 1) {
133 // Only allow event 0 as first event
134 ATH_MSG_WARNING( "Skipping spurious event number 0" );
135 return StatusCode::SUCCESS;
136 }
137
138 const xAOD::TriggerTowerContainer *tts = nullptr;
139 auto sc = evtStore()->retrieve(tts, m_triggerTowerContainerName);
140 if(!sc.isSuccess()) {
141 ATH_MSG_ERROR( "Cannot retrieve TriggerTowerCollection '"
142 << m_triggerTowerContainerName << "' from StoreGate." );
143 return StatusCode::RECOVERABLE;
144 }
145
146
147 const EventContext& ctx = getContext();
148
149 SG::ReadHandle<CaloCellContainer> cells{ m_caloCellsKey,ctx};
150
151 const unsigned evt=ctx.eventID().event_number();
152 ATH_MSG_DEBUG("Event " << evt << " contains " << cells->size() << " CaloCells" );
153 const CaloCellContainer* cellCont = cells.get();
154
155
156
157 m_jmTools->caloCells(cellCont);
158
159 // init trigger tower to cell mapping
160 CHECK(m_xAODTTTools->initCaloCells());
161 ATH_MSG_DEBUG("GAIN STRATEGY " << m_strategy);
162
163
164
165 if(m_firstEvent) {
166 m_nTTs = tts->size();
167 unsigned int runNumber = eventInfo->runNumber();
168 std::string gainStrategy("");
169 const CondAttrListCollection* gainStrategyColl = 0;
170 sc = detStore()->retrieve(gainStrategyColl, m_gainStrategyFolder);
171 if(sc.isSuccess()) {
172 CondAttrListCollection::const_iterator itr = gainStrategyColl->begin();
173 CondAttrListCollection::const_iterator itrE = gainStrategyColl->end();
174 bool consistent(true);
175 for (; itr != itrE; ++itr) {
176 const unsigned int channel = itr->first;
177 if (channel != 1 && channel != 2) continue;
178 const coral::AttributeList& attrList = itr->second;
179 const std::string strategy(attrList["name"].data<std::string>());
180 const std::string status(attrList["status"].data<std::string>());
181 ATH_MSG_INFO( "Gain Strategy: channel = " << channel
182 << ", name = " << strategy
183 << ", status = " << status );
184 if (gainStrategy.empty()) gainStrategy = std::move(strategy);
185 else if (gainStrategy != strategy) consistent = false;
186 }
187 std::string newStrategy("");
188 if (runNumber == 219978) newStrategy = "GainOneOvEmecFcalLowEta";
189 if (runNumber == 219979) newStrategy = "GainOneOvEmbFcalHighEta";
190 if (runNumber == 219980) newStrategy = "CalibGainsEt";
191 if (runNumber == 220013) newStrategy = "GainOneOvEmecFcalLowEta";
192 if (runNumber == 220014) newStrategy = "GainOneOvEmbFcalHighEta";
193 if (runNumber == 220015) newStrategy = "CalibGainsEt";
194 if (runNumber == 222871) newStrategy = "GainOne";
195 if (runNumber == 222872) newStrategy = "GainOne";
196 if (runNumber == 222873) newStrategy = "GainOne";
197 if (runNumber == 223073) newStrategy = "GainOne";
198 if (runNumber == 223074) newStrategy = "GainOne";
199 if (runNumber == 223075) newStrategy = "GainOne";
200 if (not newStrategy.empty()) {
201 ATH_MSG_INFO( "Changing Gain Strategy to " << newStrategy);
202 gainStrategy = std::move(newStrategy);
203 }
204 if (!gainStrategy.empty() && consistent) {
205 m_isGain1 = (gainStrategy.find("GainOne") != std::string::npos);
206 m_isOvEmb = (gainStrategy.find("OvEmb") != std::string::npos);
207 m_isOvEmec = (gainStrategy.find("OvEmec") != std::string::npos);
208 m_isFcalLowEta = (gainStrategy.find("FcalLowEta") != std::string::npos);
209 m_isFcalHighEta = (gainStrategy.find("FcalHighEta") != std::string::npos);
210 } else if (gainStrategy == "") {
211 ATH_MSG_WARNING( "Gain Strategy collection empty" );
212 } else {
213 ATH_MSG_WARNING( "Inconsistent Gain Strategies" );
214 }
215 } else {
216 ATH_MSG_WARNING( "No Gain Strategy collection found" );
217 }
218 ATH_MSG_INFO( "isGain1 = " << m_isGain1
219 << ", isOvEmb = " << m_isOvEmb
220 << ", isOvEmec = " << m_isOvEmec
221 << ", isFcalLowEta = " << m_isFcalLowEta
222 << ", isFcalHighEta = " << m_isFcalHighEta );
223
227 m_firstEvent = false;
228 }
229 else {
230 if (tts->size() != m_nTTs) {
231 // Adding missing towers, if any
232 ATH_MSG_WARNING("Number of trigger towers changed in event " << eventInfo->eventNumber()
233 << ": old=" << m_nTTs << ", new=" << tts->size());
234
235 unsigned int nmiss = 0;
236 for(auto* tt: *tts) {
237 bool isTile = m_xAODTTTools->isTile(*tt);
238 if (this->validTower(isTile)) {
239 if (m_rampDataContainer->rampData(tt->coolId()) == nullptr) {
240 m_rampDataContainer->addRampData(tt->coolId(),L1CaloRampData());
241 nmiss++;
242 }
243 }
244 }
245 ATH_MSG_WARNING("Added " << nmiss << " missing towers");
246 m_nTTs = tts->size();
247 }
248 }
249
250 // Reading L1Calo conditions
251 SG::ReadCondHandle<L1CaloPprDisabledChannelContainerRun2> pprDisabledChannel(m_pprDisabledChannelContainer);
252 SG::ReadCondHandle<L1CaloPprChanCalibContainer> pprChanCalib( m_pprChanCalibContainer);
253
254 auto specialChannelRangeEnd = m_specialChannelRange.end();
255 bool nextStep = (m_nEvent % m_nEventsPerStep == 0);
256 for(auto *tt : *tts) {
257 // skip saturated towers
258 if(tt->isJepSaturated()) continue;
259
260 // isSaturated flag is not enough to check - test FADC for saturation, too
261 auto max = std::max_element(tt->adc().begin(), tt->adc().end());
262 if(*max >= m_fadcSaturationCut) continue;
263
264 // skip disabled channels
265 if(m_ttTool->disabledChannel(tt->coolId())) continue;
266
267 bool isTile = m_xAODTTTools->isTile(*tt);
268 if (this->validTower(isTile)) {
269 if(m_checkProvenance) checkProvenance(tt);
270 double level1Energy = getTriggerTowerEnergy(tt,pprChanCalib);
271 double caloEnergy = getCaloEnergy(tt);
272
273 // cut on 150 GeV ADC for Tile, lots of saturating calibration signals
274 if(isTile && level1Energy > m_tileSaturationCut) continue;
275
276 // see if we have a special channel and cut on level1 energy
277 auto specialChannelIt = m_specialChannelRange.find(tt->coolId());
278 if(specialChannelIt == specialChannelRangeEnd || level1Energy < specialChannelIt->second) {
279 ATH_MSG_DEBUG("Adding Energy for " << tt->coolId() << ":" << caloEnergy << " vs. " << level1Energy);
280 m_rampDataContainer->rampData(tt->coolId())->addData(caloEnergy, level1Energy);
281 } else {
282 // make sure we don't accidently miss the threshold again
283 specialChannelIt->second = -1000;
284 }
285 if(nextStep) m_rampDataContainer->rampData(tt->coolId())->nextStep();
286 }
287 }
288
289 ++m_nEvent;
290
291 return StatusCode::SUCCESS;
292}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
#define CHECK(...)
Evaluate an expression and check for errors.
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
static Double_t sc
#define max(a, b)
Definition cfImp.cxx:41
const ServiceHandle< StoreGateSvc > & detStore() const
const_iterator end() const
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
ChanAttrListMap::const_iterator const_iterator
size_type size() const noexcept
Returns the number of elements in the collection.
void setGainStrategy(const std::string &strategy)
void addRampData(unsigned int channelId, const L1CaloRampData &rampData)
const L1CaloRampData * rampData(unsigned int channelId) const
void setRunNumber(unsigned int run)
void addData(unsigned int step, const std::pair< double, double > &energy)
ToolHandle< LVL1::IL1CaloxAODOfflineTriggerTowerTools > m_xAODTTTools
double getCaloEnergy(const xAOD::TriggerTower *tt)
ToolHandle< LVL1::IL1CaloOfflineTriggerTowerTools > m_jmTools
std::unique_ptr< L1CaloRampDataContainer > m_rampDataContainer
unsigned int m_nTTs
bool validTower(const bool &isTile)
SG::ReadHandleKey< CaloCellContainer > m_caloCellsKey
unsigned int m_nEventsPerStep
void setupRampDataContainer(const xAOD::TriggerTowerContainer *triggerTowerContainer)
double getTriggerTowerEnergy(const xAOD::TriggerTower *tt, SG::ReadCondHandle< L1CaloPprChanCalibContainer > pprCond)
void checkProvenance(const xAOD::TriggerTower *tt)
ToolHandle< LVL1::IL1TriggerTowerToolRun3 > m_ttTool
unsigned int m_nEvent
std::map< int, int > m_specialChannelRange
uint32_t runNumber() const
The current event's run number.
uint64_t eventNumber() const
The current event's event number.
status
Definition merge.py:16
retrieve(aClass, aKey=None)
Definition PyKernel.py:110
EventInfo_v1 EventInfo
Definition of the latest event info version.
TriggerTowerContainer_v2 TriggerTowerContainer
Define the latest version of the TriggerTower container.

◆ 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 L1CaloRampMaker::finalize ( )

Definition at line 405 of file L1CaloRampMaker.cxx.

406{
407 CHECK(detStore()->record(std::move(m_rampDataContainer), m_outputFolderName));
408
409 if(m_checkProvenance) {
410 std::ofstream bad_ofciter("bad-ofciter.txt");
411 std::map<unsigned int, std::pair<unsigned int, double> >::const_iterator it(m_mapBadOFCIteration.begin()), itE(m_mapBadOFCIteration.end());
412 for(;it != itE; ++it) {
413 bad_ofciter << "0x" << std::hex << it->first << " "
414 << std::dec << double(it->second.first) / double(m_nEvent)
415 << " " << it->second.second / double(m_nEvent) << std::endl;
416 }
417 bad_ofciter.close();
418 }
419
420 return StatusCode::SUCCESS;
421}

◆ getCaloEnergy()

double L1CaloRampMaker::getCaloEnergy ( const xAOD::TriggerTower * tt)
private

Definition at line 307 of file L1CaloRampMaker.cxx.

308{
309 double et(0.);
310 auto id = m_ttTool->identifier(tt->eta(), tt->phi(), tt->sampling());
311
312 if(m_lvl1Helper->is_fcal(id)) {
313 if(tt->sampling() == 0) { // fcal em - use decorated value
314 et = ttCellsET(*tt);
315 } else { // had
316 LVL1::TriggerTowerKey K(tt->phi(), tt->eta());
317 LVL1::TriggerTower T(tt->phi(), tt->eta(), K.ttKey(tt->phi(), tt->eta()));
318 std::vector<float> etRec = m_jmTools->hadTTCellsEtByReceiver(&T);
319 if (etRec.size() == 2) {
320 if (m_isFcalLowEta) et = etRec[1];//FCAL high and low eta receivers swapped here due to LAr baseplane misrouting
321 else if (m_isFcalHighEta) et = etRec[0];
322 else et = etRec[0] + etRec[1];
323 } else if (etRec.size() == 1) et = etRec[0];
324 }
325 } else {
326 if(m_lvl1Helper->is_barrel_end(id) && (m_isOvEmb || m_isOvEmec)) {
327 LVL1::TriggerTowerKey K(tt->phi(), tt->eta());
328 LVL1::TriggerTower T(tt->phi(), tt->eta(), K.ttKey(tt->phi(), tt->eta()));
329 std::vector<float> energyRec = m_jmTools->emTTCellsEnergyByReceiver(&T);
330 if (energyRec.size() == 2) {
331 double energy(0.);
332 if (m_isOvEmec) energy = energyRec[0];
333 else energy = energyRec[1];
334 et = energy / std::cosh(tt->eta());
335 } else et = energyRec[0] / std::cosh(tt->eta());
336 } else {
337 et = ttCellsEnergy(*tt) / std::cosh(tt->eta());
338 }
339 }
340 return et;
341}
float et(const xAOD::jFexSRJetRoI *j)
bool is_barrel_end(const Identifier id) const
Test wether given tower or layer is part of the EM barrel END.
bool is_fcal(const Identifier id) const
Test wether given tower or layer is part of the FCAL.
const CaloLVL1_ID * m_lvl1Helper
The TriggerTowerKey object provides the key for each trigger tower depending on its eta-phi coords.
Trigger towers are the inputs to all other parts of the calorimeter trigger.
unsigned long long T
Extra patterns decribing particle interation process.

◆ getTriggerTowerEnergy()

double L1CaloRampMaker::getTriggerTowerEnergy ( const xAOD::TriggerTower * tt,
SG::ReadCondHandle< L1CaloPprChanCalibContainer > pprCond )
private

Definition at line 345 of file L1CaloRampMaker.cxx.

345 {
346 // calibration is against ADC energy "(adc peak value - pedestal) / 4"
347 auto max = std::max_element(tt->adc().begin(), tt->adc().end());
348
349 if(!pprChanCalib->pprChanCalib(tt->coolId())) {
350 ATH_MSG_WARNING("Empty PPrChanCalib for 0x "
351 << std::hex << tt->coolId() << std::dec << "!");
352 return 0.;
353 }
354
355 double energy = (*max - int( pprChanCalib->pprChanCalib(tt->coolId())->pedValue())) * 0.25;
356 ATH_MSG_DEBUG("PedValue " << tt->coolId() << ":" << int( pprChanCalib->pprChanCalib(tt->coolId())->pedValue()) );
357
358
359 if (energy < 0.) energy = 0.;
360
361 // no corrections if gain is set correctly
362 if(!m_isGain1) return energy;
363
364 // correct hec and tile if gain 1
365 auto id = m_ttTool->identifier(tt->eta(), tt->phi(), tt->sampling());
366 if(m_lvl1Helper->is_hec(id)) {
367 energy /= std::cosh(tt->eta());
368 if(fabs(tt->eta()) > 2.5) {
369 energy *= 10.;
370 } else if(fabs(tt->eta()) > 1.9) {
371 energy *= 5.;
372 } else {
373 energy *= 3.125;
374 }
375 } else if(m_lvl1Helper->is_tile(id)) {
376 energy /= std::cosh(tt->eta());
377 }
378
379 return energy;
380}
bool is_tile(const Identifier id) const
Test wether given tower or layer is part of the Tile Calorimeter.
bool is_hec(const Identifier id) const
Test wether given tower or layer is part of the HEC.

◆ initialize()

StatusCode L1CaloRampMaker::initialize ( )

Definition at line 92 of file L1CaloRampMaker.cxx.

93{
94
95 CHECK(m_caloCellsKey.initialize());
96
97 const CaloIdManager *caloMgr = nullptr;
98 CHECK(detStore()->retrieve(caloMgr));
99 m_lvl1Helper = caloMgr->getLVL1_ID();
100 if(!m_lvl1Helper) {
101 ATH_MSG_FATAL( "Cannot access CaloLVL1_ID helper." );
102 return StatusCode::FAILURE;
103 }
104
105 ATH_CHECK( m_cablingKey.initialize() );
106 ATH_CHECK(m_ttTool.retrieve());
107 ATH_CHECK(m_xAODTTTools.retrieve());
108 ATH_CHECK(m_jmTools.retrieve());
109
110 ATH_CHECK( m_strategy.initialize() );
111 ATH_CHECK( m_pprDisabledChannelContainer.initialize() );
112 ATH_CHECK( m_pprChanCalibContainer.initialize() );
113
114 return StatusCode::SUCCESS;
115}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
This class initializes the Calo (LAr and Tile) offline identifiers.
const CaloLVL1_ID * getLVL1_ID(void) const
StatusCode initialize(bool used=true)
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.

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

◆ setupRampDataContainer()

void L1CaloRampMaker::setupRampDataContainer ( const xAOD::TriggerTowerContainer * triggerTowerContainer)
private

Definition at line 294 of file L1CaloRampMaker.cxx.

295{
296 m_rampDataContainer.reset(new L1CaloRampDataContainer());
298 for(auto* tt: *tts) {
299 bool isTile = m_xAODTTTools->isTile(*tt);
300 if (this->validTower(isTile)) {
301 m_rampDataContainer->addRampData(tt->coolId(), rd);
302 }
303 }
304}
Container of L1CaloRampData objects.
Transient class to store the RampData calculated from calibration runs.

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

◆ validTower()

bool L1CaloRampMaker::validTower ( const bool & isTile)
private

Definition at line 401 of file L1CaloRampMaker.cxx.

401 {
402 return ((m_doLAr && !isTile) || (m_doTile && isTile));
403}

Member Data Documentation

◆ m_cablingKey

SG::ReadCondHandleKey<LArOnOffIdMapping> L1CaloRampMaker::m_cablingKey {this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"}
private

Definition at line 106 of file L1CaloRampMaker.h.

106{this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"};

◆ m_caloCellsKey

SG::ReadHandleKey<CaloCellContainer> L1CaloRampMaker::m_caloCellsKey { this, "CaloCellsKey", "AllCalo", "CaloCellContainer key" }
private

Definition at line 107 of file L1CaloRampMaker.h.

107{ this, "CaloCellsKey", "AllCalo", "CaloCellContainer key" };

◆ m_checkProvenance

bool L1CaloRampMaker::m_checkProvenance
private

Definition at line 70 of file L1CaloRampMaker.h.

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

bool L1CaloRampMaker::m_doLAr
private

Definition at line 63 of file L1CaloRampMaker.h.

◆ m_doTile

bool L1CaloRampMaker::m_doTile
private

Definition at line 64 of file L1CaloRampMaker.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_fadcSaturationCut

int L1CaloRampMaker::m_fadcSaturationCut
private

Definition at line 73 of file L1CaloRampMaker.h.

◆ m_firstEvent

bool L1CaloRampMaker::m_firstEvent
private

Definition at line 83 of file L1CaloRampMaker.h.

◆ m_gainStrategyFolder

std::string L1CaloRampMaker::m_gainStrategyFolder
private

Definition at line 61 of file L1CaloRampMaker.h.

◆ m_isFcalHighEta

bool L1CaloRampMaker::m_isFcalHighEta
private

Definition at line 69 of file L1CaloRampMaker.h.

◆ m_isFcalLowEta

bool L1CaloRampMaker::m_isFcalLowEta
private

Definition at line 68 of file L1CaloRampMaker.h.

◆ m_isGain1

bool L1CaloRampMaker::m_isGain1
private

Definition at line 65 of file L1CaloRampMaker.h.

◆ m_isOvEmb

bool L1CaloRampMaker::m_isOvEmb
private

Definition at line 66 of file L1CaloRampMaker.h.

◆ m_isOvEmec

bool L1CaloRampMaker::m_isOvEmec
private

Definition at line 67 of file L1CaloRampMaker.h.

◆ m_jmTools

ToolHandle<LVL1::IL1CaloOfflineTriggerTowerTools> L1CaloRampMaker::m_jmTools
private

Definition at line 79 of file L1CaloRampMaker.h.

◆ m_lvl1Helper

const CaloLVL1_ID* L1CaloRampMaker::m_lvl1Helper
private

Definition at line 86 of file L1CaloRampMaker.h.

◆ m_mapBadOFCIteration

std::map<unsigned int, std::pair<unsigned int, double> > L1CaloRampMaker::m_mapBadOFCIteration
private

Definition at line 98 of file L1CaloRampMaker.h.

◆ m_nEvent

unsigned int L1CaloRampMaker::m_nEvent
private

Definition at line 82 of file L1CaloRampMaker.h.

◆ m_nEventsPerStep

unsigned int L1CaloRampMaker::m_nEventsPerStep
private

Definition at line 71 of file L1CaloRampMaker.h.

◆ m_nSteps

unsigned int L1CaloRampMaker::m_nSteps
private

Definition at line 72 of file L1CaloRampMaker.h.

◆ m_nTTs

unsigned int L1CaloRampMaker::m_nTTs
private

Definition at line 84 of file L1CaloRampMaker.h.

◆ m_outputFolderName

std::string L1CaloRampMaker::m_outputFolderName
private

Definition at line 60 of file L1CaloRampMaker.h.

◆ m_pprChanCalibContainer

SG::ReadCondHandleKey<L1CaloPprChanCalibContainer> L1CaloRampMaker::m_pprChanCalibContainer { this, "InputKeyCond", "L1CaloPprChanCalibContainer"}
private

Definition at line 102 of file L1CaloRampMaker.h.

102{ this, "InputKeyCond", "L1CaloPprChanCalibContainer"};

◆ m_pprDisabledChannelContainer

SG::ReadCondHandleKey<L1CaloPprDisabledChannelContainerRun2> L1CaloRampMaker::m_pprDisabledChannelContainer { this, "InputKeyDisabledChannel", "L1CaloPprDisabledChannelContainerRun2"}
private

Definition at line 103 of file L1CaloRampMaker.h.

103{ this, "InputKeyDisabledChannel", "L1CaloPprDisabledChannelContainerRun2"};

◆ m_rampDataContainer

std::unique_ptr<L1CaloRampDataContainer> L1CaloRampMaker::m_rampDataContainer
private

Definition at line 88 of file L1CaloRampMaker.h.

◆ m_specialChannelRange

std::map<int, int> L1CaloRampMaker::m_specialChannelRange
private

Definition at line 62 of file L1CaloRampMaker.h.

◆ m_strategy

SG::ReadCondHandleKey<CondAttrListCollection> L1CaloRampMaker::m_strategy { this, "TRIGGER", "/TRIGGER/Receivers/Conditions/Strategy", "Strategy" }
private

Definition at line 100 of file L1CaloRampMaker.h.

100{ this, "TRIGGER", "/TRIGGER/Receivers/Conditions/Strategy", "Strategy" };

◆ m_tileSaturationCut

double L1CaloRampMaker::m_tileSaturationCut
private

Definition at line 74 of file L1CaloRampMaker.h.

◆ m_triggerTowerContainerName

std::string L1CaloRampMaker::m_triggerTowerContainerName
private

Definition at line 59 of file L1CaloRampMaker.h.

◆ m_ttTool

ToolHandle<LVL1::IL1TriggerTowerToolRun3> L1CaloRampMaker::m_ttTool
private

Definition at line 75 of file L1CaloRampMaker.h.

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

◆ m_xAODTTTools

ToolHandle<LVL1::IL1CaloxAODOfflineTriggerTowerTools> L1CaloRampMaker::m_xAODTTTools
private

Definition at line 78 of file L1CaloRampMaker.h.


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