Execute method.
118{
119
120 unsigned int wantedEvents = m_nEventsPerStep*m_nSteps;
121 if (m_nEvent > wantedEvents) {
122 if (m_nEvent == wantedEvents+1) {
124 << " events, skipping the rest" );
125 }
126 ++m_nEvent;
127 return StatusCode::SUCCESS;
128 }
129
132 if (eventInfo->
eventNumber() == 0 && m_nEvent > 1) {
133
135 return StatusCode::SUCCESS;
136 }
137
139 auto sc =
evtStore()->retrieve(tts, m_triggerTowerContainerName);
140 if(!
sc.isSuccess()) {
142 << m_triggerTowerContainerName << "' from StoreGate." );
143 return StatusCode::RECOVERABLE;
144 }
145
146
147
149
150 const unsigned evt=ctx.eventID().event_number();
152 const CaloCellContainer* cellCont =
cells.get();
153
154
155
157
158
161
162
163
164 if(m_firstEvent) {
167 std::string gainStrategy("");
168 const CondAttrListCollection* gainStrategyColl = 0;
169 sc =
detStore()->retrieve(gainStrategyColl, m_gainStrategyFolder);
173 bool consistent(true);
174 for (; itr != itrE; ++itr) {
175 const unsigned int channel = itr->first;
176 if (channel != 1 && channel != 2) continue;
177 const coral::AttributeList& attrList = itr->second;
178 const std::string
strategy(attrList[
"name"].data<std::string>());
179 const std::string
status(attrList[
"status"].data<std::string>());
181 << ", name = " << strategy
182 << ", status = " << status );
183 if (gainStrategy.empty()) gainStrategy = std::move(strategy);
184 else if (gainStrategy != strategy) consistent = false;
185 }
186 std::string newStrategy("");
187 if (runNumber == 219978) newStrategy = "GainOneOvEmecFcalLowEta";
188 if (runNumber == 219979) newStrategy = "GainOneOvEmbFcalHighEta";
189 if (runNumber == 219980) newStrategy = "CalibGainsEt";
190 if (runNumber == 220013) newStrategy = "GainOneOvEmecFcalLowEta";
191 if (runNumber == 220014) newStrategy = "GainOneOvEmbFcalHighEta";
192 if (runNumber == 220015) newStrategy = "CalibGainsEt";
193 if (runNumber == 222871) newStrategy = "GainOne";
194 if (runNumber == 222872) newStrategy = "GainOne";
195 if (runNumber == 222873) newStrategy = "GainOne";
196 if (runNumber == 223073) newStrategy = "GainOne";
197 if (runNumber == 223074) newStrategy = "GainOne";
198 if (runNumber == 223075) newStrategy = "GainOne";
199 if (not newStrategy.empty()) {
200 ATH_MSG_INFO(
"Changing Gain Strategy to " << newStrategy);
201 gainStrategy = std::move(newStrategy);
202 }
203 if (!gainStrategy.empty() && consistent) {
204 m_isGain1 = (gainStrategy.find(
"GainOne") != std::string::npos);
205 m_isOvEmb = (gainStrategy.find(
"OvEmb") != std::string::npos);
206 m_isOvEmec = (gainStrategy.find(
"OvEmec") != std::string::npos);
207 m_isFcalLowEta = (gainStrategy.find(
"FcalLowEta") != std::string::npos);
208 m_isFcalHighEta = (gainStrategy.find(
"FcalHighEta") != std::string::npos);
209 } else if (gainStrategy == "") {
211 } else {
213 }
214 } else {
216 }
218 << ", isOvEmb = " << m_isOvEmb
219 << ", isOvEmec = " << m_isOvEmec
220 << ", isFcalLowEta = " << m_isFcalLowEta
221 << ", isFcalHighEta = " << m_isFcalHighEta );
222
227 }
228 else {
229 if (tts->
size() != m_nTTs) {
230
232 <<
": old=" << m_nTTs <<
", new=" << tts->
size());
233
234 unsigned int nmiss = 0;
235 for(auto* tt: *tts) {
240 nmiss++;
241 }
242 }
243 }
246 }
247 }
248
249
250 SG::ReadCondHandle<L1CaloPprDisabledChannelContainerRun2> pprDisabledChannel(m_pprDisabledChannelContainer, ctx);
251 SG::ReadCondHandle<L1CaloPprChanCalibContainer> pprChanCalib( m_pprChanCalibContainer, ctx);
252
255 for(auto *tt : *tts) {
256
257 if(
tt->isJepSaturated())
continue;
258
259
260 auto max = std::max_element(
tt->adc().begin(),
tt->adc().end());
261 if(*
max >= m_fadcSaturationCut)
continue;
262
263
264 if(
m_ttTool->disabledChannel(ctx,
tt->coolId()))
continue;
265
271
272
273 if(isTile && level1Energy > m_tileSaturationCut) continue;
274
275
277 if(specialChannelIt == specialChannelRangeEnd || level1Energy < specialChannelIt->second) {
278 ATH_MSG_DEBUG(
"Adding Energy for " <<
tt->coolId() <<
":" << caloEnergy <<
" vs. " << level1Energy);
280 } else {
281
282 specialChannelIt->second = -1000;
283 }
285 }
286 }
287
289
290 return StatusCode::SUCCESS;
291}
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_INFO(x,...)
#define CHECK(...)
Evaluate an expression and check for errors.
ServiceHandle< StoreGateSvc > & evtStore()
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
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
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.
EventInfo_v1 EventInfo
Definition of the latest event info version.
TriggerTowerContainer_v2 TriggerTowerContainer
Define the latest version of the TriggerTower container.