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"
23#include "CoolKernel/StorageType.h"
35 "Select how to set thresholds. Allowed values are 'fixed','group' and 'noise'");
75 if (
m_mode.compare(
"fixed")==0) {
78 << name() <<
".tQThreshold and "
79 << name() <<
".samplesThreshold for DSP thresholds" );
81 else if (
m_mode.compare(
"group")==0) {
83 ATH_MSG_INFO (
"Will used cell groups defined in jobO " << name() <<
".CellGroup for DSP thresholds" );
88 return StatusCode::FAILURE;
93 return StatusCode::FAILURE;
96 else if (
m_mode.compare(
"noise")==0) {
100 ATH_MSG_INFO (
"Will used ICaloCellTool::totalNoiseRMS times " << name() <<
".sigmaNoiseSamples and" );
102 ATH_MSG_INFO (
"Will used ICaloCellTool::elecNoiseRMS times " << name() <<
".sigmaNoiseSamples and" );
105 ATH_MSG_INFO (
"ICaloCellTool::totalNoiseRMS times " << name() <<
".sigmaNoiseQt for DSP thresholds" );
107 ATH_MSG_INFO (
"ICaloCellTool::elecNoiseRMS times " << name() <<
".sigmaNoiseQt for DSP thresholds" );
114 return StatusCode::SUCCESS;
121 const EventContext& ctx = Gaudi::Hive::currentContext();
127 unsigned hashMax=
m_onlineID->channelHashMax();
129 coral::AttributeListSpecification* spec =
new coral::AttributeListSpecification();
131 spec->extend(
"tQThr",
"blob");
132 spec->extend(
"samplesThr",
"blob");
133 spec->extend(
"trigSumThr",
"blob");
134 spec->extend(
"Name",
"string");
140 coral::Blob& tQThrBlob = (*attr)[
"tQThr"].data<coral::Blob>();
141 coral::Blob& samplesThrBlob = (*attr)[
"samplesThr"].data<coral::Blob>();
142 coral::Blob& trigSumThrBlob = (*attr)[
"trigSumThr"].data<coral::Blob>();
144 tQThrBlob.resize(hashMax*
sizeof(
float));
145 samplesThrBlob.resize(hashMax*
sizeof(
float));
146 trigSumThrBlob.resize(hashMax*
sizeof(
float));
148 float* ptQThrBlob=
static_cast<float*
>(tQThrBlob.startingAddress());
149 float* psamplesBlob=
static_cast<float*
>(samplesThrBlob.startingAddress());
150 float* ptrigSumBlob=
static_cast<float*
>(trigSumThrBlob.startingAddress());
163 return StatusCode::FAILURE;
170 totalNoise = totalNoiseH.
cptr();
172 elecNoise = elecNoiseH.
cptr();
183 for (
unsigned hs=0;hs<hashMax;++hs) {
185 const Identifier id=cabling->cnvToIdentifier(chid);
186 ATH_MSG_DEBUG (
"cell id: " <<
id <<
" " << cabling->isOnlineConnected(chid) );
188 if(!cabling->isOnlineConnected(chid)){
189 ATH_MSG_DEBUG (
"cell id: " <<
id <<
" not connected channel, skip " );
212 const std::vector<float>& thrs=
m_thrPerCell.valuesForCell(
id);
213 if(thrs.size()!=2) std::cout <<
"len=" << thrs.size() << std::endl;
214 ptQThrBlob[hs]=thrs[0];
215 psamplesBlob[hs]=thrs[1];
216 ptrigSumBlob[hs]=thrs[0];
222 return StatusCode::FAILURE;
246 float samplesThr = 0.;
250 samplesThr = totalNoise->
getNoise(
id,igain);
252 samplesThr = elecNoise->
getNoise(
id,igain);
255 QtThr = totalNoise->
getNoise(
id,igain);
257 QtThr = elecNoise->
getNoise(
id,igain);
269 (
m_onlineID->isHECchannel(chid) && (slot==9 || slot==10) ) ||
270 (
m_onlineID->isEMECchannel(chid) && (slot==6||slot==7||slot==14||slot==15))
275 }
else if ( (
m_onlineID->isHECchannel(chid) && (slot==7 || slot==8) ) ||
276 (
m_onlineID->isEMECchannel(chid) && (slot==12||slot==13)) ) {
295 std::ofstream outfile;
298 return StatusCode::FAILURE;
301 if (outfile.is_open()) {
306 return StatusCode::FAILURE;
309 std::vector<HWIdentifier>::const_iterator chanIt=
m_onlineID->channel_begin();
310 std::vector<HWIdentifier>::const_iterator chanIt_e=
m_onlineID->channel_end ();
311 for (;chanIt!=chanIt_e;++chanIt) {
321 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()