9#include "CaloDetDescr/CaloDetDescrElement.h"
11#include "GaudiKernel/ThreadLocalContext.h"
16#include "CoralBase/Blob.h"
17#include "CoralBase/Attribute.h"
18#include "CoralBase/AttributeList.h"
19#include "CoralBase/AttributeListSpecification.h"
22#include "CoolKernel/StorageType.h"
34 "Select how to set thresholds. Allowed values are 'fixed','group' and 'noise'");
73 if (
m_mode.compare(
"fixed")==0) {
76 << name() <<
".tQThreshold and "
77 << name() <<
".samplesThreshold for DSP thresholds" );
79 else if (
m_mode.compare(
"group")==0) {
81 ATH_MSG_INFO (
"Will used cell groups defined in jobO " << name() <<
".CellGroup for DSP thresholds" );
86 return StatusCode::FAILURE;
91 return StatusCode::FAILURE;
94 else if (
m_mode.compare(
"noise")==0) {
98 ATH_MSG_INFO (
"Will used ICaloCellTool::totalNoiseRMS times " << name() <<
".sigmaNoiseSamples and" );
100 ATH_MSG_INFO (
"Will used ICaloCellTool::elecNoiseRMS times " << name() <<
".sigmaNoiseSamples and" );
103 ATH_MSG_INFO (
"ICaloCellTool::totalNoiseRMS times " << name() <<
".sigmaNoiseQt for DSP thresholds" );
105 ATH_MSG_INFO (
"ICaloCellTool::elecNoiseRMS times " << name() <<
".sigmaNoiseQt for DSP thresholds" );
112 return StatusCode::SUCCESS;
120 const EventContext& ctx = Gaudi::Hive::currentContext();
126 unsigned hashMax=
m_onlineID->channelHashMax();
128 coral::AttributeListSpecification* spec =
new coral::AttributeListSpecification();
129 spec->extend(
"tQThr",
"blob");
130 spec->extend(
"samplesThr",
"blob");
131 spec->extend(
"trigSumThr",
"blob");
132 spec->extend(
"Name",
"string");
138 coral::Blob& tQThrBlob = (*attr)[
"tQThr"].data<coral::Blob>();
139 coral::Blob& samplesThrBlob = (*attr)[
"samplesThr"].data<coral::Blob>();
140 coral::Blob& trigSumThrBlob = (*attr)[
"trigSumThr"].data<coral::Blob>();
142 tQThrBlob.resize(hashMax*
sizeof(
float));
143 samplesThrBlob.resize(hashMax*
sizeof(
float));
144 trigSumThrBlob.resize(hashMax*
sizeof(
float));
146 float* ptQThrBlob=
static_cast<float*
>(tQThrBlob.startingAddress());
147 float* psamplesBlob=
static_cast<float*
>(samplesThrBlob.startingAddress());
148 float* ptrigSumBlob=
static_cast<float*
>(trigSumThrBlob.startingAddress());
161 return StatusCode::FAILURE;
168 totalNoise = totalNoiseH.
cptr();
170 elecNoise = elecNoiseH.
cptr();
181 for (
unsigned hs=0;hs<hashMax;++hs) {
183 const Identifier id=cabling->cnvToIdentifier(chid);
184 ATH_MSG_DEBUG (
"cell id: " <<
id <<
" " << cabling->isOnlineConnected(chid) );
186 if(!cabling->isOnlineConnected(chid)){
187 ATH_MSG_DEBUG (
"cell id: " <<
id <<
" not connected channel, skip " );
209 const std::vector<float>& thrs=
m_thrPerCell.valuesForCell(
id);
210 if(thrs.size()!=2) std::cout <<
"len=" << thrs.size() << std::endl;
211 ptQThrBlob[hs]=thrs[0];
212 psamplesBlob[hs]=thrs[1];
213 ptrigSumBlob[hs]=thrs[0];
219 return StatusCode::FAILURE;
230 float samplesThr = 0.;
234 samplesThr = totalNoise->
getNoise(
id,igain);
236 samplesThr = elecNoise->
getNoise(
id,igain);
239 QtThr = totalNoise->
getNoise(
id,igain);
241 QtThr = elecNoise->
getNoise(
id,igain);
255 }
else if ( (
m_onlineID->isHECchannel(chid) && (slot==7 || slot==8) ) ||
256 (
m_onlineID->isEMECchannel(chid) && (slot==12||slot==13)) ) {
275 return StatusCode::FAILURE;
277 std::ofstream outfile;
280 return StatusCode::FAILURE;
283 if (outfile.is_open()) {
288 return StatusCode::FAILURE;
291 std::vector<HWIdentifier>::const_iterator chanIt=
m_onlineID->channel_begin();
292 std::vector<HWIdentifier>::const_iterator chanIt_e=
m_onlineID->channel_end ();
293 for (;chanIt!=chanIt_e;++chanIt) {
303 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
LArBadXCont< LArBadChannel > LArBadChannelCont
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() const
An AttributeList represents a logical row of attributes in a metadata table.
Helper base class for offline cell identifiers.
Helper class for offline cell identifiers.
This class groups all DetDescr information related to a CaloCell.
IdentifierHash calo_hash() const
cell calo hash
float eta() const
cell eta
float phi() const
cell phi
bool is_lar_fcal() const
cell belongs to FCAL
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
This class provides the client interface for accessing the detector description information common to...
float getNoise(const IdentifierHash h, const int gain) const
Accessor by IdentifierHash and gain.
value_type get_compact() const
Get the compact id.
Gaudi::Property< float > m_scaleIW
virtual ~LArDSPThresholdFillInline()
SG::ReadCondHandleKey< CaloNoise > m_totalNoiseKey
SG::ReadCondHandleKey< CaloNoise > m_elecNoiseKey
LArBadChannelMask m_bcMask
Handle to bad-channel mask.
float m_sigmaNoiseSamples
std::string m_outFileName
std::vector< std::string > m_cellGroupStr
bool m_usePileupNoiseSamples
const LArOnlineID * m_onlineID
Gaudi::Property< std::vector< std::string > > m_problemsToMask
SG::ReadCondHandleKey< LArBadChannelCont > m_bcContKey
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
virtual StatusCode stop() override
LArDSPThresholdFillInline(const std::string &name, ISvcLocator *pSvcLocator)
float m_maskedsamplesThrsh
virtual StatusCode initialize() override
CaloCellGroupList m_thrPerCell
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
float trigSumThr(const HWIdentifier &CellID) const
float samplesThr(const HWIdentifier &CellID) const
float tQThr(const HWIdentifier &CellID) const
const_pointer_type cptr()