Skip to content
Snippets Groups Projects
Commit 75dc04cc authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

Merge branch 'DataHandle_LArFebErrorSummaryMaker' into 'master'

DataHandle migration of LArFebErrorSummaryMaker

See merge request atlas/athena!8363
parents 233452b1 7b4c85b2
No related branches found
No related tags found
No related merge requests found
...@@ -18,6 +18,10 @@ NAME: LArFebSummaryMaker ...@@ -18,6 +18,10 @@ NAME: LArFebSummaryMaker
#include <GaudiKernel/ToolHandle.h> #include <GaudiKernel/ToolHandle.h>
#include "LArRawEvent/LArFebHeaderContainer.h" #include "LArRawEvent/LArFebHeaderContainer.h"
#include "LArRawEvent/LArFebErrorSummary.h"
#include "StoreGate/ReadHandleKey.h"
#include "StoreGate/WriteHandleKey.h"
#include <vector> #include <vector>
#include <set> #include <set>
...@@ -34,34 +38,40 @@ class LArFebErrorSummaryMaker : public AthAlgorithm ...@@ -34,34 +38,40 @@ class LArFebErrorSummaryMaker : public AthAlgorithm
LArFebErrorSummaryMaker(const std::string& name, ISvcLocator* pSvcLocator); LArFebErrorSummaryMaker(const std::string& name, ISvcLocator* pSvcLocator);
virtual ~LArFebErrorSummaryMaker(); virtual ~LArFebErrorSummaryMaker();
StatusCode initialize(); virtual StatusCode initialize() override final;
StatusCode execute(); virtual StatusCode execute() override final;
StatusCode finalize(); virtual StatusCode finalize() override final;
private: private:
bool masked (unsigned int hid, const std::vector<unsigned int>& v_feb) const; int m_nwarns; //counter for warnings
int m_missingFebsWarns; //counter for missing FEB warnings
const LArOnlineID* m_onlineHelper ; std::vector<int> m_errors; //error types accumulator
int m_nwarns;
int m_warnLimit;
int m_missingFebsWarns;
std::vector<int> m_errors;
// ignore these FEBs for these errors
std::vector<unsigned int> m_knownEvtId;
std::vector<unsigned int> m_knownSCACStatus;
std::vector<unsigned int> m_knownZeroSample;
bool m_checkAllFeb;
std::string m_partition;
std::set<unsigned int> m_all_febs ; std::set<unsigned int> m_all_febs ;
bool m_isHec;
bool m_isFcal;
bool m_isEmb;
bool m_isEmec;
bool m_isEmPS;
bool m_isAside;
bool m_isCside;
// properties:
Gaudi::Property<int> m_warnLimit{ this, "warnLimit", 10, "Limit the number of warning messages for missing input" };
Gaudi::Property<bool> m_checkAllFeb{ this, "CheckAllFEB", true, "Check all FEBS ?" };
Gaudi::Property<std::string> m_partition{ this, "PartitionId", "", "Should contain DAQ partition (+ eventually the EventBuilder)" };
Gaudi::Property<std::vector<unsigned int> > m_knownEvtId{ this, "MaskFebEvtId", {}, "ignore these FEBs for EvtId" };
Gaudi::Property<std::vector<unsigned int> > m_knownSCACStatus{ this, "MaskFebScacStatus", {}, "ignore these FEBs for ScacStatus" };
Gaudi::Property<std::vector<unsigned int> > m_knownZeroSample{ this, "MaskFebZeroSample", {}, "ignore these FEBs for ZeroSample" };
const LArOnlineID* m_onlineHelper;
ToolHandle<ILArBadChanTool> m_badChannelTool; ToolHandle<ILArBadChanTool> m_badChannelTool;
//SG::ReadHandleKey<LArFebHeaderContainer> m_readKey; // read handle migration preparation
SG::WriteHandleKey<LArFebErrorSummary> m_writeKey;
// methods:
bool masked (unsigned int hid, const std::vector<unsigned int>& v_feb) const;
}; };
#endif #endif
......
...@@ -2,6 +2,8 @@ from LArROD.LArRODConf import LArFebErrorSummaryMaker ...@@ -2,6 +2,8 @@ from LArROD.LArRODConf import LArFebErrorSummaryMaker
febSummaryMaker =LArFebErrorSummaryMaker() febSummaryMaker =LArFebErrorSummaryMaker()
febSummaryMaker.MaskFebScacStatus = [0x38080000] febSummaryMaker.MaskFebScacStatus = [0x38080000]
febSummaryMaker.MaskFebEvtId = [0x38080000] febSummaryMaker.MaskFebEvtId = [0x38080000]
febSummaryMaker.WriteKey="StoreGateSvc+LArFebErrorSummary"
# needed only if it is not in DB. # needed only if it is not in DB.
#febSummaryMaker.MaskFebZeroSample = [0x39618000,0x39930000,0x3b1b0000,0x38db0000,0x38f60000,0x39ae8000,0x3bb90000] #febSummaryMaker.MaskFebZeroSample = [0x39618000,0x39930000,0x3b1b0000,0x38db0000,0x38f60000,0x39ae8000,0x3bb90000]
......
...@@ -21,24 +21,20 @@ ...@@ -21,24 +21,20 @@
#include <bitset> #include <bitset>
bool isHec, isFcal, isEmb, isEmec, isEmPS, isAside, isCside;
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
// CONSTRUCTOR: // CONSTRUCTOR:
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
LArFebErrorSummaryMaker::LArFebErrorSummaryMaker(const std::string& name, ISvcLocator* pSvcLocator) : LArFebErrorSummaryMaker::LArFebErrorSummaryMaker(const std::string& name, ISvcLocator* pSvcLocator) :
AthAlgorithm(name, pSvcLocator),m_onlineHelper(NULL),m_nwarns(0),m_missingFebsWarns(0), AthAlgorithm(name, pSvcLocator),m_nwarns(0),m_missingFebsWarns(0),
m_checkAllFeb(true), m_partition(""), m_badChannelTool("") m_isHec(false), m_isFcal(false), m_isEmb(false), m_isEmec(false),
m_isEmPS(false), m_isAside(false), m_isCside(false),
m_checkAllFeb(true), m_partition(""),m_onlineHelper(0),m_badChannelTool("")
{ {
declareProperty("warnLimit", m_warnLimit=10);
declareProperty("CheckAllFEB",m_checkAllFeb);
declareProperty("PartitionId", m_partition); //Should contain DAQ partition (+ eventually the EventBuilder)
declareProperty("MaskFebEvtId",m_knownEvtId);
declareProperty("MaskFebScacStatus",m_knownSCACStatus);
declareProperty("MaskFebZeroSample",m_knownZeroSample);
declareProperty("BadChannelTool",m_badChannelTool,"Bad channel tool to get info on Feb errors to ignore from database"); declareProperty("BadChannelTool",m_badChannelTool,"Bad channel tool to get info on Feb errors to ignore from database");
//declareProperty ("ReadKey", m_readKey = "LArFebHeaderContainer"); // read handle migration preparation
declareProperty ("WriteKey", m_writeKey = "StoreGateSvc+LArFebErrorSummary");
} }
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
...@@ -54,12 +50,10 @@ StatusCode LArFebErrorSummaryMaker::initialize() ...@@ -54,12 +50,10 @@ StatusCode LArFebErrorSummaryMaker::initialize()
{ {
ATH_MSG_DEBUG(" initialize " ); ATH_MSG_DEBUG(" initialize " );
ATH_CHECK(detStore()->retrieve( m_onlineHelper ) );
ATH_CHECK( detStore()->retrieve( m_onlineHelper ) );
m_errors.resize(LArFebErrorSummary::N_LArFebErrorType,0 ); m_errors.resize(LArFebErrorSummary::N_LArFebErrorType,0 );
isHec = isFcal = isEmb = isEmec = isEmPS = isAside = isCside = false;
if (m_checkAllFeb) if (m_checkAllFeb)
{ {
...@@ -74,28 +68,28 @@ StatusCode LArFebErrorSummaryMaker::initialize() ...@@ -74,28 +68,28 @@ StatusCode LArFebErrorSummaryMaker::initialize()
else { // We should chack partition id else { // We should chack partition id
if(m_partition.size() > 0) { if(m_partition.size() > 0) {
unsigned length = m_partition.size(); unsigned length = m_partition.size();
if(m_partition.find("LArgHecFcal") < length && m_partition.find("EB-HEC") < length) isHec=true; if(m_partition.value().find("LArgHecFcal") < length && m_partition.value().find("EB-HEC") < length) m_isHec=true;
if(m_partition.find("LArgHecFcal") < length && m_partition.find("EB-FCAL") < length) isFcal=true; if(m_partition.value().find("LArgHecFcal") < length && m_partition.value().find("EB-FCAL") < length) m_isFcal=true;
if(m_partition.find("LArgBarrelPS") < length) { if(m_partition.value().find("LArgBarrelPS") < length) {
isEmPS = true; m_isEmPS = true;
if(m_partition.find("EB-EMBA") < length) isAside = true; if(m_partition.value().find("EB-EMBA") < length) m_isAside = true;
if(m_partition.find("EB-EMBC") < length) isCside = true; if(m_partition.value().find("EB-EMBC") < length) m_isCside = true;
} }
if(m_partition.find("LArgEm") < length && m_partition.find("EB-EMB") < length) { if(m_partition.value().find("LArgEm") < length && m_partition.value().find("EB-EMB") < length) {
isEmb = true; m_isEmb = true;
if(m_partition.find("EB-EMBA") < length) isAside = true; if(m_partition.value().find("EB-EMBA") < length) m_isAside = true;
if(m_partition.find("EB-EMBC") < length) isCside = true; if(m_partition.value().find("EB-EMBC") < length) m_isCside = true;
} }
if(m_partition.find("LArgEm") < length && m_partition.find("EB-EMEC") < length) { if(m_partition.value().find("LArgEm") < length && m_partition.value().find("EB-EMEC") < length) {
isEmec = true; m_isEmec = true;
if(m_partition.find("EB-EMECA") < length) isAside = true; if(m_partition.value().find("EB-EMECA") < length) m_isAside = true;
if(m_partition.find("EB-EMECC") < length) isCside = true; if(m_partition.value().find("EB-EMECC") < length) m_isCside = true;
} }
} }
if(isHec || isFcal || isEmb || isEmec || isEmPS) { if(m_isHec || m_isFcal || m_isEmb || m_isEmec || m_isEmPS) {
ATH_MSG_DEBUG("isHec: "<<isHec<<" isFcal: "<< isFcal <<" isEmb: "<< isEmb <<" isEmec: "<< isEmec <<" isEmbPS: "<< isEmPS ); ATH_MSG_DEBUG("m_isHec: "<<m_isHec<<" m_isFcal: "<< m_isFcal <<" m_isEmb: "<< m_isEmb <<" m_isEmec: "<< m_isEmec <<" m_isEmbPS: "<< m_isEmPS );
} else { } else {
ATH_MSG_WARNING("Wrong PartitionId property: "<<m_partition ); ATH_MSG_WARNING("Wrong PartitionId property: "<<m_partition.value() );
ATH_MSG_WARNING("Missing FEB's will be not checked " ); ATH_MSG_WARNING("Missing FEB's will be not checked " );
} }
// Now let's build the list of FEB's according partition // Now let's build the list of FEB's according partition
...@@ -103,13 +97,13 @@ StatusCode LArFebErrorSummaryMaker::initialize() ...@@ -103,13 +97,13 @@ StatusCode LArFebErrorSummaryMaker::initialize()
std::vector<HWIdentifier>::const_iterator it_e = m_onlineHelper->feb_end(); std::vector<HWIdentifier>::const_iterator it_e = m_onlineHelper->feb_end();
for (;it!=it_e;++it){ for (;it!=it_e;++it){
if(isHec && m_onlineHelper->isHECchannel(*it)) { m_all_febs.insert((*it).get_identifier32().get_compact()); continue; } if(m_isHec && m_onlineHelper->isHECchannel(*it)) { m_all_febs.insert((*it).get_identifier32().get_compact()); continue; }
if(isFcal && m_onlineHelper->isFCALchannel(*it)) { m_all_febs.insert((*it).get_identifier32().get_compact()); continue; } if(m_isFcal && m_onlineHelper->isFCALchannel(*it)) { m_all_febs.insert((*it).get_identifier32().get_compact()); continue; }
if((isEmb && m_onlineHelper->isEMBchannel(*it) && (!m_onlineHelper->isPS(*it))) if((m_isEmb && m_onlineHelper->isEMBchannel(*it) && (!m_onlineHelper->isPS(*it)))
|| (isEmec && m_onlineHelper->isEMECchannel(*it)) || (m_isEmec && m_onlineHelper->isEMECchannel(*it))
|| (isEmPS && m_onlineHelper->isPS(*it) && (!m_onlineHelper->isEMBchannel(*it))) ) { || (m_isEmPS && m_onlineHelper->isPS(*it) && (!m_onlineHelper->isEMBchannel(*it))) ) {
if(isAside && m_onlineHelper->pos_neg(*it) == 1) {m_all_febs.insert((*it).get_identifier32().get_compact()); continue; } if(m_isAside && m_onlineHelper->pos_neg(*it) == 1) {m_all_febs.insert((*it).get_identifier32().get_compact()); continue; }
if(isCside && m_onlineHelper->pos_neg(*it) == 0) {m_all_febs.insert((*it).get_identifier32().get_compact()); continue; } if(m_isCside && m_onlineHelper->pos_neg(*it) == 0) {m_all_febs.insert((*it).get_identifier32().get_compact()); continue; }
} }
} }
} }
...@@ -121,6 +115,9 @@ StatusCode LArFebErrorSummaryMaker::initialize() ...@@ -121,6 +115,9 @@ StatusCode LArFebErrorSummaryMaker::initialize()
ATH_CHECK( m_badChannelTool.retrieve() ); ATH_CHECK( m_badChannelTool.retrieve() );
} }
//ATH_CHECK( m_readKey.initialize() ); // read handle migration preparation
ATH_CHECK( m_writeKey.initialize() );
return StatusCode::SUCCESS ; return StatusCode::SUCCESS ;
} }
...@@ -132,16 +129,20 @@ StatusCode LArFebErrorSummaryMaker::execute() ...@@ -132,16 +129,20 @@ StatusCode LArFebErrorSummaryMaker::execute()
const LArFebHeaderContainer* hdrCont; const LArFebHeaderContainer* hdrCont;
StatusCode sc = evtStore()->retrieve(hdrCont); StatusCode sc = evtStore()->retrieve(hdrCont);
// read handle migration preparation:
//SG::ReadHandle<LArFebHeaderContainer> h_read (m_readKey);
//if(!h_read.isValid()) {
if (sc.isFailure() || !hdrCont) { if (sc.isFailure() || !hdrCont) {
if (m_nwarns < m_warnLimit) if (m_nwarns < m_warnLimit)
{ {
m_nwarns++; m_nwarns++;
ATH_MSG_WARNING( "No LArFebHeaderContainer found in TDS, LArFebErrorSummary not created " ); ATH_MSG_WARNING( "No LArFebHeaderContainer found in TDS, LArFebErrorSummary not created " );
} }
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
// const LArFebHeaderContainer* hdrCont = h_read.cptr(); //preparation for read handle migration
/*
auto febErrorSummary_ptr = CxxUtils::make_unique<LArFebErrorSummary>(); auto febErrorSummary_ptr = CxxUtils::make_unique<LArFebErrorSummary>();
LArFebErrorSummary* febErrorSummary = febErrorSummary_ptr.get(); LArFebErrorSummary* febErrorSummary = febErrorSummary_ptr.get();
ATH_CHECK( evtStore()->record(std::move(febErrorSummary_ptr),"LArFebErrorSummary") ); ATH_CHECK( evtStore()->record(std::move(febErrorSummary_ptr),"LArFebErrorSummary") );
...@@ -151,6 +152,10 @@ StatusCode LArFebErrorSummaryMaker::execute() ...@@ -151,6 +152,10 @@ StatusCode LArFebErrorSummaryMaker::execute()
ATH_MSG_ERROR( "Can not set const for LArFebErrorSummary" ); ATH_MSG_ERROR( "Can not set const for LArFebErrorSummary" );
// return sc; // return sc;
} }
*/
SG::WriteHandle<LArFebErrorSummary> febErrorSummary = SG::makeHandle(m_writeKey);
ATH_CHECK( febErrorSummary.record (std::make_unique<LArFebErrorSummary>()) );
unsigned int nbSamplesFirst=0; unsigned int nbSamplesFirst=0;
uint32_t eventTypeFirst = 999; uint32_t eventTypeFirst = 999;
...@@ -160,7 +165,7 @@ StatusCode LArFebErrorSummaryMaker::execute() ...@@ -160,7 +165,7 @@ StatusCode LArFebErrorSummaryMaker::execute()
LArFebHeaderContainer::const_iterator it_e = hdrCont->end(); LArFebHeaderContainer::const_iterator it_e = hdrCont->end();
std::set<unsigned int> all_febs; std::set<unsigned int> all_febs;
if(m_checkAllFeb || isHec || isFcal || isEmb || isEmec || isEmPS){ if(m_checkAllFeb || m_isHec || m_isFcal || m_isEmb || m_isEmec || m_isEmPS){
all_febs= m_all_febs; all_febs= m_all_febs;
...@@ -172,7 +177,7 @@ StatusCode LArFebErrorSummaryMaker::execute() ...@@ -172,7 +177,7 @@ StatusCode LArFebErrorSummaryMaker::execute()
HWIdentifier febid=(*it)->FEBId(); HWIdentifier febid=(*it)->FEBId();
unsigned int int_id = febid.get_identifier32().get_compact(); unsigned int int_id = febid.get_identifier32().get_compact();
if (m_checkAllFeb || isHec || isFcal || isEmb || isEmec || isEmPS){ if (m_checkAllFeb || m_isHec || m_isFcal || m_isEmb || m_isEmec || m_isEmPS){
all_febs.erase(int_id); all_febs.erase(int_id);
} }
// ctrl3 // ctrl3
...@@ -318,7 +323,7 @@ StatusCode LArFebErrorSummaryMaker::execute() ...@@ -318,7 +323,7 @@ StatusCode LArFebErrorSummaryMaker::execute()
} }
if (m_checkAllFeb || isHec || isFcal || isEmb || isEmec || isEmPS){ if (m_checkAllFeb || m_isHec || m_isFcal || m_isEmb || m_isEmec || m_isEmPS){
const uint16_t errw = 1<< LArFebErrorSummary::MissingHeader; const uint16_t errw = 1<< LArFebErrorSummary::MissingHeader;
bool warn=false; bool warn=false;
std::set<unsigned int>::const_iterator it = all_febs.begin(); std::set<unsigned int>::const_iterator it = all_febs.begin();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment