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 const EventContext& ctx = getContext();
148
150
151 const unsigned evt=ctx.eventID().event_number();
153 const CaloCellContainer* cellCont =
cells.get();
154
155
156
158
159
162
163
164
165 if(m_firstEvent) {
168 std::string gainStrategy("");
169 const CondAttrListCollection* gainStrategyColl = 0;
170 sc =
detStore()->retrieve(gainStrategyColl, m_gainStrategyFolder);
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;
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 == "") {
212 } else {
214 }
215 } else {
217 }
219 << ", isOvEmb = " << m_isOvEmb
220 << ", isOvEmec = " << m_isOvEmec
221 << ", isFcalLowEta = " << m_isFcalLowEta
222 << ", isFcalHighEta = " << m_isFcalHighEta );
223
228 }
229 else {
230 if (tts->
size() != m_nTTs) {
231
233 <<
": old=" << m_nTTs <<
", new=" << tts->
size());
234
235 unsigned int nmiss = 0;
236 for(auto* tt: *tts) {
241 nmiss++;
242 }
243 }
244 }
247 }
248 }
249
250
251 SG::ReadCondHandle<L1CaloPprDisabledChannelContainerRun2> pprDisabledChannel(m_pprDisabledChannelContainer);
252 SG::ReadCondHandle<L1CaloPprChanCalibContainer> pprChanCalib( m_pprChanCalibContainer);
253
256 for(auto *tt : *tts) {
257
258 if(
tt->isJepSaturated())
continue;
259
260
261 auto max = std::max_element(
tt->adc().begin(),
tt->adc().end());
262 if(*
max >= m_fadcSaturationCut)
continue;
263
264
265 if(
m_ttTool->disabledChannel(
tt->coolId()))
continue;
266
272
273
274 if(isTile && level1Energy > m_tileSaturationCut) continue;
275
276
278 if(specialChannelIt == specialChannelRangeEnd || level1Energy < specialChannelIt->second) {
279 ATH_MSG_DEBUG(
"Adding Energy for " <<
tt->coolId() <<
":" << caloEnergy <<
" vs. " << level1Energy);
281 } else {
282
283 specialChannelIt->second = -1000;
284 }
286 }
287 }
288
290
291 return StatusCode::SUCCESS;
292}
#define ATH_MSG_WARNING(x)
#define CHECK(...)
Evaluate an expression and check for errors.
char data[hepevt_bytes_allocation_ATLAS]
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.
retrieve(aClass, aKey=None)
EventInfo_v1 EventInfo
Definition of the latest event info version.
TriggerTowerContainer_v2 TriggerTowerContainer
Define the latest version of the TriggerTower container.