19using Athena::Units::GeV;
34 std::vector<std::string> modules;
36 int ros = fragID >> 8;
37 int drawer = fragID & 0x3F;
42 std::ostringstream os;
46 unsigned int ros = fragID >> 8;
47 unsigned int drawer = fragID & 0xFF;
49 os <<
" " << module <<
"/0x" << std::hex << fragID << std::dec;
58 std::map<std::string, unsigned int> roses = { {
"AUX", 0}, {
"LBA", 1}, {
"LBC", 2}, {
"EBA", 3}, {
"EBC", 4} };
59 for (
const std::string& maskedModuleChannels :
m_masked) {
61 std::string module = maskedModuleChannels.substr(0, 5);
62 std::string partition =
module.substr(0, 3);
63 if (roses.count(partition) != 1) {
64 ATH_MSG_WARNING(
"There no such partition: " << partition <<
" in module: " << module
65 <<
" => skip because of bad format: " << maskedModuleChannels);
69 unsigned int drawer = std::stoi(module.substr(3, 2)) - 1;
71 ATH_MSG_WARNING(
"There no such drawer: " << drawer + 1 <<
" in module: " << module
72 <<
" => skip because of bad format: " << maskedModuleChannels);
76 unsigned int ros = roses.at(partition);
79 std::string gain = maskedModuleChannels.substr(5,7);
80 unsigned int adc = std::stoi(gain);
83 ATH_MSG_WARNING(
"There no such gain: " << gain <<
" => skip because of bad format: " << maskedModuleChannels);
87 std::stringstream channels(maskedModuleChannels.substr(7));
89 while (std::getline(channels, channel,
',')) {
90 if (!channel.empty()) {
91 unsigned int chan = std::stoi(channel);
93 ATH_MSG_WARNING(
"There no such channel: " << chan <<
" in channels: " << channels.str()
94 <<
" => skip because of bad format: " << maskedModuleChannels);
129 return StatusCode::SUCCESS;
139 constexpr int nSamples = allSamples + 1;
146 if (!caloCellContainer->empty()) {
147 for (
const CaloCell* cell : *caloCellContainer) {
151 if (!tile_cell)
continue;
163 int gain1 = tile_cell->
gain1();
164 int gain2 = tile_cell->
gain2();
192 bool isMaskedChannel1 = isOkChannel1 && ((
m_maskedChannels[drawerIdx1][channel1] >> gain1) & 1U);
193 bool isMaskedChannel2 = isOkChannel2 && ((
m_maskedChannels[drawerIdx2][channel2] >> gain2) & 1U);
200 std::string sampleTowerSuffix =
"_" + std::to_string(sample) +
"_" + std::to_string(tower);
206 double energyDiff = (single_PMT_scin) ? 0.0 : tile_cell->
eneDiff() * (1.0 /
GeV);
207 double time = cell->time();
208 double time1 = tile_cell->
time1();
209 double time2 = tile_cell->
time2();
210 double timeDiff = (single_PMT_scin) ? 0.0 : 2. * tile_cell->
timeDiff();
257 if (isMaskedChannel1 && !isMaskedChannel2) {
258 energy = energy2 * 2.0;
259 }
else if (isMaskedChannel2 && !isMaskedChannel1) {
260 energy = energy1 * 2.0;
261 }
else if (isMaskedChannel1 && isMaskedChannel2) {
264 sampleEnergy[drawerIdx1][sample] += energy;
265 sampleEnergy[drawerIdx1][allSamples] += energy;
289 fill(
"TileTBCellMonExecuteTime", timer);
291 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
Handle class for reading from StoreGate.
Wrapper to avoid constant divisions when using units.
const ServiceHandle< StoreGateSvc > & detStore() const
virtual StatusCode initialize() override
initialize
ToolHandleArray< GenericMonitoringTool > m_tools
Array of Generic Monitoring Tools.
Data object for each calorimeter readout cell.
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
This class groups all DetDescr information related to a CaloCell.
IdentifierHash onl2() const
cell online identifier 2
IdentifierHash onl1() const
cell online identifier 1
This is a "hash" representation of an Identifier.
Declare a monitored scalar variable.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
static const unsigned int MAX_DRAWERIDX
Maximal drawer index.
static const unsigned int MAX_ROS
Number of ROSs.
static std::string getDrawerString(unsigned int ros, unsigned int drawer)
Return the drawer name, e.g.
static const unsigned int MAX_GAIN
Number of gains per channel.
static const unsigned int MAX_DRAWER
Number of drawers in ROS 1-4.
static unsigned int getDrawerIdx(unsigned int ros, unsigned int drawer)
Returns a drawer hash.
static unsigned int getMaxDrawer(unsigned int ros)
Returns the maximal channel number for a given drawer.
static const unsigned int MAX_CHAN
Number of channels in drawer.
float time1(void) const
get time of first PMT
float eneDiff(void) const
all get methods
int gain2(void) const
get gain of second PMT
int gain1(void) const
get gain of first PMT
float ene1(void) const
get energy of first PMT
float timeDiff(void) const
get time diff for two PMTs (data member)
float time2(void) const
get time of second PMT
float ene2(void) const
get energy of second PMT
std::map< std::string, int > m_energyDiffGroups
const TileCablingService * m_cabling
std::map< std::string, int > m_channelTimeGroups
virtual StatusCode initialize() override
initialize
std::array< unsigned int, TileCalibUtils::MAX_DRAWERIDX > m_drawerIdxToDrawer
double m_energyThresholdForTimeInGeV
std::map< std::string, int > m_timeDiffGroups
Gaudi::Property< std::vector< std::string > > m_masked
std::map< std::string, int > m_channelEnergyGroups
Gaudi::Property< float > m_scaleFactor
std::map< std::string, int > m_energyGroups
std::map< std::string, int > m_sampleEnergyGroups
std::map< std::string, int > m_timeGroups
Gaudi::Property< bool > m_fillHistogramsPerChannel
std::array< unsigned int, TileCalibUtils::MAX_DRAWERIDX > m_drawerIdxToROS
Gaudi::Property< float > m_energyThresholdForTime
const TileHWID * m_tileHWID
std::map< std::string, int > m_time2VsTime1Groups
std::array< std::array< unsigned char, TileCalibUtils::MAX_CHAN >, TileCalibUtils::MAX_DRAWERIDX > m_maskedChannels
ServiceHandle< TileCablingSvc > m_cablingSvc
Name of Tile cabling service.
SG::ReadHandleKey< CaloCellContainer > m_caloCellContainerKey
Gaudi::Property< std::vector< int > > m_fragIDs
virtual StatusCode fillHistograms(const EventContext &ctx) const override
adds event to the monitoring histograms
std::map< std::string, int > m_energy2VsEnergy1Groups
std::array< bool, TileCalibUtils::MAX_DRAWERIDX > m_monitoredDrawerIdx
Generic monitoring tool for athena components.
std::vector< V > buildToolMap(const ToolHandleArray< GenericMonitoringTool > &tools, const std::string &baseName, int nHist)
Builds an array of indices (base case)
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
void fill(H5::Group &out_file, size_t iterations)