|
ATLAS Offline Software
|
Go to the documentation of this file.
26 #include "GaudiKernel/ConcurrencyFlags.h"
64 ATH_MSG_ERROR(
"Property 'DoDspTestDump' must not be true if nThreads>1");
65 return StatusCode::FAILURE;
68 ATH_MSG_ERROR(
"Property 'DoCellsDump' must not be true if nThreads>1");
69 return StatusCode::FAILURE;
74 auto pairCmp = [](
const std::pair<int,int>&
p1,
const std::pair<int,int>&
p2) {
return (
p1.first<
p2.first);};
76 ATH_MSG_ERROR(
"Configuration problem: Energy ranges not in ascending order!");
77 return StatusCode::FAILURE;
81 ATH_MSG_ERROR(
"Configuration problem: Time ranges not in ascending order!");
82 return StatusCode::FAILURE;
86 ATH_MSG_ERROR(
"Configuration problem: Quality ranges not in ascending order!");
87 return StatusCode::FAILURE;
101 m_fdump<<
"febid channel CellID slot FT barrel_ec posneg partition E_off E_on T_off T_on Q_off Q_on event "<<std::endl;
137 bool isEventFlaggedByLArNoisyROAlg =
false;
138 bool isEventFlaggedByLArNoisyROAlgInTimeW =
false;
141 isEventFlaggedByLArNoisyROAlg =
true;
146 isEventFlaggedByLArNoisyROAlgInTimeW =
true;
147 ATH_MSG_DEBUG(
" !!! Noisy event found by LArNoisyROAlg in Time window of 500ms!!!" );
151 if (
m_removeNoiseBursts && (isEventFlaggedByLArNoisyROAlg || isEventFlaggedByLArNoisyROAlgInTimeW))
return StatusCode::SUCCESS;
157 lb = thisEventInfo->lumiBlock();
160 const int streamsize = nStreams + 1;
161 std::vector<int> hasStream(streamsize,0);
164 bool hasstrlist =
false;
165 const std::vector< xAOD::EventInfo::StreamTag >& evtStreamTags=thisEventInfo->streamTags();
166 for (
const auto& evtStreamTag : evtStreamTags) {
170 ATH_MSG_VERBOSE(
"Keeping Stream Tag: " << evtStreamTag.type() <<
"_" << evtStreamTag.name());
175 if (! hasstrlist) hasStream[nStreams] = 1;
184 std::set<HWIdentifier> ignoreFEBs;
191 for (
const auto* febH : *febCont) {
192 if (((
m_doCheckSum && febH->ChecksumVerification()==
false)) ||
194 ignoreFEBs.insert(febH->FEBId());
197 ATH_MSG_DEBUG(
"Found " << ignoreFEBs.size() <<
" FEBs with checksum errors or statatus errors. Will ignore these FEBs.");
203 std::vector<unsigned> errsPerFEB;
206 const bool ignoreFebs=(ignoreFEBs.size()>0);
207 std::set<HWIdentifier>::const_iterator ignoreFebsEnd=ignoreFEBs.end();
216 LArRawChannelContainer::const_iterator rcDigIt=rawColl_fromDigits->begin();
217 LArRawChannelContainer::const_iterator rcDigIt_e=rawColl_fromDigits->end();
218 LArRawChannelContainer::const_iterator rcBSIt=rawColl_fromBytestream->begin();
219 LArRawChannelContainer::const_iterator rcBSIt_e=rawColl_fromBytestream->end();
228 for (;rcDigIt!=rcDigIt_e;++rcDigIt) {
233 if (ignoreFEBs.find(febId)!=ignoreFebsEnd)
continue;
246 LArRawChannelContainer::const_iterator currIt=rcBSIt;
247 for (;rcBSIt!=rcBSIt_e && rcBSIt->hardwareID() != idDig; ++rcBSIt);
248 if (rcBSIt==rcBSIt_e) {
249 ATH_MSG_WARNING(
"LArDigitContainer not in the expected order. Change of LArByteStream format?" );
251 for (rcBSIt=rawColl_fromBytestream->begin();rcBSIt!=currIt && rcBSIt->hardwareID() != idDig; ++rcBSIt);
252 if (rcBSIt==currIt) {
254 return StatusCode::FAILURE;
262 for (;digIt!=digIt_e && (*digIt)->hardwareID() != idDig; ++digIt);
263 if (digIt==digIt_e) {
264 ATH_MSG_WARNING(
"LArRawChannelContainer not in the expected order. Change of LArRawChannelBuilder behavior?" );
266 for (digIt=pLArDigitContainer->
begin();digIt!=currDigIt && (*digIt)->hardwareID() != idDig; ++digIt);
267 if (digIt==currDigIt) {
269 return StatusCode::FAILURE;
273 const std::vector<short>& samples=dig->
samples();
274 const auto [minSamplesIt, maxSamplesIt] = std::minmax_element(samples.begin(),samples.end());
289 ++(errcounters[
p].errors_E[
gain]);
293 ++(errsPerFEB[febHash]);
296 ++(errcounters[
p].errors_T[
gain]);
301 ++(errcounters[
p].errors_Q[
gain]);
307 ATH_MSG_DEBUG(
"Samples : "<< *maxSamplesIt <<
" " << *minSamplesIt );
316 sweetc = errsPerFEB[
i];
335 unsigned allErrsPartE=0;
336 unsigned allErrsPartT=0;
337 unsigned allErrsPartQ=0;
339 for (
unsigned g=0;
g<3;++
g) {
341 weight_e = (
float)errcounters[
p].errors_E[
g];
342 weight_q = (
float)errcounters[
p].errors_Q[
g];
346 allErrsPartE+=errcounters[
p].errors_E[
g];
347 allErrsPartT+=errcounters[
p].errors_T[
g];
348 allErrsPartQ+=errcounters[
p].errors_Q[
g];
351 numE = (
float)allErrsPartE;
352 numT = (
float)allErrsPartT;
353 numQ = (
float)allErrsPartQ;
369 return StatusCode::SUCCESS;
382 const float& en_fB=rcBS.
energy();
383 const float& en_fD=rcDig.
energy();
396 auto pairValueCmp = [](
const int&
a,
const std::pair<int,int>&
b){
return a<
b.first;};
409 if (std::abs(en_fD-en_fB) > e_Precision->second) {
417 const float q_fB=rcBS.
quality();
418 const float q_fD=rcDig.
quality();
419 const float t_fB=rcBS.
time();
421 if ((rcDig.
provenance() & 0x2000) == 0 || q_fD==0 || t_fB==0 || q_fB==0 || timeOffline==0) {
427 ATH_MSG_VERBOSE(
"Skip time/Quality comparison, not computed either online or offline");
439 if (fabs(DiffT) > t_Precision->second) {
448 float qdiff = 65535.0;
449 if (q_fD > 0.) qdiff = (q_fD - q_fB)/std::sqrt(q_fD);
460 if (fabs(DiffQ) > q_Precision->second) {
471 const EventContext& ctx)
const{
498 const auto& polynom_adc2mev=adc2mev->
ADC2MEV(chid,
gain);
499 const float escale = (polynom_adc2mev)[1];
500 float ramp0 = (polynom_adc2mev)[0];
504 const float hvscale = hvScaleCorrs->
HVScaleCorr(chid);
507 const std::vector<short>& samples=dig.
samples();
508 if (
gain == 0) ramp0 = 0.;
515 <<
", run " << ctx.eventID().run_number() <<
", evt " << ctx.eventID().event_number());
516 if (
cmp.e_on!=
cmp.e_off) {
519 <<
" , Eoff - Eonl = " <<
cmp.e_off-
cmp.e_on);
524 if(
cmp.t_off!=
cmp.t_on ) {
527 <<
" , Toff - Tonl = " <<
cmp.t_off -
cmp.t_on);
529 if (
cmp.q_off!=
cmp.q_on) {
532 <<
" (Qoff - Qnl)/sqrt(Qoff) = " << (
cmp.q_off -
cmp.q_on)/std::sqrt(
cmp.q_off));
557 ATH_MSG_INFO(
"Escale: "<<escale<<
" intercept: "<<ramp0<<
" pedestal: "<<
ped<<
" gain: "<<dig.
gain() );
563 const unsigned nOFCSamp=
std::min(samples.size(),OFCa.size());
564 for (
unsigned k=0;
k<nOFCSamp; ++
k) emon += (samples.at(
k)-
ped)*OFCa.at(
k);
567 ATH_MSG_INFO(
"intercept + Escale*Sum[(sample-ped)*OFCa] "<<emon);
572 for (
const float a : OFCa) {sumai +=
a;}
573 float pedplusoffset=0;
574 if (escale*sumai != 0) pedplusoffset =
ped - ramp0/(escale*sumai);
575 else pedplusoffset = 0;
576 const float inv_Escale = 1. / escale;
578 m_fai <<
channel<<
"\t"<<
ped<<
"\t"<< pedplusoffset<<
"\t"
579 << OFCa[0]*escale<<
"\t"<< OFCa[1]*escale<<
"\t"<< OFCa[2]*escale<<
"\t"<< OFCa[3]*escale<<
"\t"<< OFCa[4]*escale<<
"\t"
580 << OFCb[0]*escale<<
"\t"<< OFCb[1]*escale<<
"\t"<< OFCb[2]*escale<<
"\t"<< OFCb[3]*escale<<
"\t"<< OFCb[4]*escale<<
"\t"
581 << shape[0]*inv_Escale<<
"\t"<< shape[1]*inv_Escale<<
"\t"<< shape[2]*inv_Escale<<
"\t"<< shape[3]*inv_Escale<<
"\t"<< shape[4]*inv_Escale<<
"\t"
582 << shapeDer[0]*inv_Escale<<
"\t"<< shapeDer[1]*inv_Escale<<
"\t"<< shapeDer[2]*inv_Escale<<
"\t"<< shape[3]*inv_Escale<<
"\t"<< shapeDer[4]*inv_Escale << std::endl;
590 for (
const short d : samples) {
600 const EventContext& ctx,
612 <<std::dec << std::setw(3) << std::right << slot << std::setw(3) << std::right <<
FT << std::setw(3) << std::right << barrel_ec << std::setw(3) << std::right<< posneg << std::setw(6) << std::right <<
getPartitionName(chid)
613 <<
" " <<
gain <<
" " <<
" " <<
cmp.e_off <<
" "<<
cmp.e_on <<
" "<<
cmp.t_off <<
" "<<
cmp.t_on <<
" "<<
cmp.q_off <<
" "<<
cmp.q_on <<ctx.eventID().event_number()<<std::endl;
629 return StatusCode::SUCCESS;
def retrieve(aClass, aKey=None)
virtual float pedestal(const HWIdentifier &id, int gain) const =0
SG::ReadCondHandleKey< LArADC2MeV > m_adc2mevKey
const LArVectorProxy ADC2MEV(const HWIdentifier &id, int gain) const
Const iterator class for DataVector/DataList.
Gaudi::Property< std::vector< std::pair< int, int > > > m_E_precision
Gaudi::Property< std::vector< std::pair< int, int > > > m_Q_precision
virtual StatusCode finalize() override final
size_type febHashMax(void) const
define feb hash tables max size
LArBadChannelMask m_bcMask
HWIdentifier channelID() const
Gaudi::Property< bool > m_doCellsDump
std::string find(const std::string &s)
return a remapped string
SG::ReadCondHandleKey< ILArPedestal > m_keyPedestal
Conditions-Data class holding LAr Bad Channel or Bad Feb information.
Gaudi::Property< std::string > m_EnergyFileName
Gaudi::Property< std::string > m_AiFileName
virtual OFCRef_t OFC_b(const HWIdentifier &id, int gain, int tbin=0) const =0
virtual ShapeRef_t ShapeDer(const HWIdentifier &id, int gain, int tbin=0, int mode=0) const =0
const std::vector< short > & samples() const
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
int slot(const HWIdentifier id) const
Return the slot number of a hardware cell identifier: slot = [1,15] Slot-ID in top part of the crat...
SG::ReadCondHandleKey< LArBadChannelCont > m_bcContKey
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
StatusCode buildBitMask(const std::vector< std::string > &problemsToMask, MsgStream &msg)
Gaudi::Property< bool > m_printEnergyErrors
Gaudi::Property< bool > m_removeNoiseBursts
#define ATH_MSG_VERBOSE(x)
float getNoise(const IdentifierHash h, const int gain) const
Accessor by IdentifierHash and gain.
bool cellShouldBeMasked(const LArBadChannelCont *bcCont, const HWIdentifier &hardwareId) const
int barrel_ec(const HWIdentifier id) const
Return the position barrel or endcap of a hardware cell identifier: barrel_ec = [0,...
@ LAr
The LAr calorimeter.
Gaudi::Property< bool > m_skipNullPed
value_type get_compact() const
Get the compact id.
virtual ~LArRODMonAlg()
Default destructor.
Gaudi::Property< bool > m_doCheckSum
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
xAOD::MissingETComponent_v1::Weight weight_t
Type for kinematic weight.
Gaudi::Property< std::string > m_DumpCellsFileName
Gaudi::Property< bool > m_doDspTestDump
std::array< unsigned, 3 > errors_E
SG::ReadHandleKey< LArFebHeaderContainer > m_headerContainerKey
int channel(const HWIdentifier id) const
Return the channel number of a hardware cell identifier channel = [0,127] in all FEB.
Gaudi::Property< bool > m_skipKnownProblematicChannels
Gaudi::Property< std::vector< std::pair< int, int > > > m_T_precision
Liquid Argon digit base class.
std::atomic< unsigned > m_ndump
Liquid Argon ROD output object base class.
::StatusCode StatusCode
StatusCode definition for legacy code.
PARTITION getPartition(const HWIdentifier chid) const
Gaudi::Property< std::string > m_MonGroupName
int pos_neg(const HWIdentifier id) const
Return the side of a hardware cell identifier pos_neg = [0,1] positive-side or negative-side Barrel...
void fill(const ToolHandle< GenericMonitoringTool > &groupHandle, std::vector< std::reference_wrapper< Monitored::IMonitoredVariable >> &&variables) const
Fills a vector of variables to a group by reference.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Gaudi::Property< float > m_timeOffset
Gaudi::Property< std::vector< std::string > > m_partitions
SG::ReadHandle< xAOD::EventInfo > GetEventInfo(const EventContext &) const
Return a ReadHandle for an EventInfo object (get run/event numbers, etc.)
virtual StatusCode fillHistograms(const EventContext &ctx) const override final
adds event to the monitoring histograms
HWIdentifier feb_Id(int barrel_ec, int pos_neg, int feedthrough, int slot) const
Create feb_Id from fields.
const char * getPartitionName(const HWIdentifier chid) const
void dumpCellInfo(const HWIdentifier chid, const int gain, const EventContext &ctx, const diff_t &comp) const
Dump a cell's information and calculated energies into a txt file.
ToolHandleArray< GenericMonitoringTool > m_tools
Array of Generic Monitoring Tools.
std::string to_string(const DetectorType &type)
StatusCode initialize(bool used=true)
Gaudi::Property< short > m_adc_th
Gaudi::Property< unsigned > m_max_dump
Gaudi::Property< bool > m_doRodStatus
void detailedOutput(const LArRODMonAlg::diff_t &, const LArDigit &dig, const EventContext &ctx) const
virtual StatusCode initialize() override
initialize
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
std::string getString() const
Provide a string form of the identifier - hexadecimal.
int feedthrough(const HWIdentifier id) const
Return the feedthrough of a hardware cell identifier : feedthrough = [0,31] Barrel - A/C side or H/...
CaloGain::CaloGain gain() const
SG::ReadCondHandleKey< ILArOFC > m_keyOFC
diff_t compareChannel(const LArRawChannel &rcDig, const LArRawChannel &rcBS) const
#define ATH_MSG_WARNING(x)
Gaudi::Property< float > m_peakTime_cut
SG::ReadHandleKey< LArRawChannelContainer > m_channelKey_fromBytestream
virtual OFCRef_t OFC_a(const HWIdentifier &id, int gain, int tbin=0) const =0
access to OFCs by online ID, gain, and tbin (!=0 for testbeam)
const LArOnlineID * m_LArOnlineIDHelper
const HWIdentifier & channelID() const
Gaudi::Property< std::vector< std::string > > m_problemsToMask
SG::ReadCondHandleKey< CaloNoise > m_noiseCDOKey
virtual const float & HVScaleCorr(const HWIdentifier &id) const =0
std::array< unsigned, 3 > errors_Q
Gaudi::Property< std::string > m_DigitsFileName
Declare a monitored scalar variable.
SG::ReadCondHandleKey< ILArShape > m_keyShape
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
std::map< std::string, int > m_histoGroups
std::string channel_name(const HWIdentifier id) const
Return a string corresponding to a feedthrough name given an identifier.
const T * get(const ReadHandleKey< T > &key)
Convenience function to retrieve an object given a ReadHandleKey.
SG::ReadDecorHandleKey< xAOD::EventInfo > m_eventInfoKey
Gaudi::Property< std::vector< std::string > > m_streams
virtual StatusCode initialize() override final
initialize
IdentifierHash feb_Hash(HWIdentifier febId) const
Create feb hash identifiers from feb identifiers.
SG::ReadCondHandleKey< ILArHVScaleCorr > m_keyHVScaleCorr
uint16_t provenance() const
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
SG::ReadHandleKey< LArDigitContainer > m_digitContainerKey
Proxy for accessing a range of float values like a vector.
SG::ReadHandleKey< LArRawChannelContainer > m_channelKey_fromDigits
virtual ShapeRef_t Shape(const HWIdentifier &id, int gain, int tbin=0, int mode=0) const =0
std::array< unsigned, 3 > errors_T