7#include "CaloDetDescr/CaloDetDescrElement.h"
13#include "CLHEP/Random/RandFlat.h"
23 const std::string& name,
24 const IInterface* parent)
31 declareInterface<CaloCellCorrection>(
this);
57 xfile.open(fname.c_str());
60 return StatusCode::FAILURE;
65 while (getline(xfile, line,
'\n')) {
66 std::istringstream buf(line);
73 return StatusCode::FAILURE;
77 unsigned pos =
m_noise_file[0].find_last_of(
"0123456789");
78 std::ostringstream buf;
98 m_tree =
new TChain(
"NoiseTree");
104 ATH_MSG_FATAL(
"Noise chain has less then 100 events !!!!" );
105 return StatusCode::FAILURE;
116 const int PRIORITY = 100;
117 pIncSvc->addListener(
this,
"BeginEvent", PRIORITY);
119 ATH_MSG_DEBUG(
" TBCellNoiseCorrection initialization finished" );
121 return StatusCode::SUCCESS;
132 return StatusCode::SUCCESS;
137 const EventContext& )
const
144 double e = theCell->
energy();
149 for(i = 0; i < size; ++i) {
150 if(std::as_const(
m_cell_id)->at(i) == cid) {
156 ATH_MSG_ERROR(
"Could not find a noise value for cell: "<<std::hex<<cid<<std::dec );
167 if ( inc.type() ==
"BeginEvent") {
168 m_engine->setSeed (
"TBCellNoseCorrection", inc.context());
169 unsigned int random = int(RandFlat::shoot(
m_engine->getEngine (inc.context()), 0.,
m_entries-1.));
175 ATH_MSG_ERROR(
"Not equal size of noise vectors !!!! Something wrong !!!" );
#define ATH_CHECK
Evaluate an expression and check for errors.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Data object for each calorimeter readout cell.
double energy() const
get energy (data member)
virtual void setEnergy(float energy)
set energy
Identifier ID() const
get ID (from cached data member) non-virtual and inline for fast access
value_type get_compact() const
Get the compact id.
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
virtual ~TBCellNoiseCorrection()
std::vector< std::string > m_noise_file
ATHRNG::RNGWrapper * m_engine
void MakeCorrection(CaloCell *theCell, const EventContext &ctx) const override
TBCellNoiseCorrection(const std::string &type, const std::string &name, const IInterface *parent)
ServiceHandle< IAthRNGSvc > m_rndmSvc
std::vector< float > * m_cell_energy
virtual StatusCode finalize() override
std::vector< unsigned int > * m_cell_id
virtual void handle(const Incident &) override
virtual StatusCode initialize() override
static std::vector< uint32_t > runnumber