Skip to content
Snippets Groups Projects
Commit d7a73a64 authored by Eric Torrence's avatar Eric Torrence
Browse files

Fix up with upstream master

parents 6da05b79 e6e69e7e
No related branches found
No related tags found
No related merge requests found
...@@ -20,16 +20,31 @@ RawWaveformDecoderTool::RawWaveformDecoderTool(const std::string& type, ...@@ -20,16 +20,31 @@ RawWaveformDecoderTool::RawWaveformDecoderTool(const std::string& type,
{ {
declareInterface<RawWaveformDecoderTool>(this); declareInterface<RawWaveformDecoderTool>(this);
// These must be configured by job options
declareProperty("CaloChannels", m_caloChannels); declareProperty("CaloChannels", m_caloChannels);
m_caloChannels.push_back(0);
m_caloChannels.push_back(1);
m_caloChannels.push_back(2);
m_caloChannels.push_back(3);
declareProperty("VetoChannels", m_vetoChannels); declareProperty("VetoChannels", m_vetoChannels);
m_vetoChannels.push_back(4);
m_vetoChannels.push_back(5);
m_vetoChannels.push_back(6);
m_vetoChannels.push_back(7);
declareProperty("TriggerChannels", m_triggerChannels); declareProperty("TriggerChannels", m_triggerChannels);
m_triggerChannels.push_back(8);
m_triggerChannels.push_back(9);
m_triggerChannels.push_back(10);
m_triggerChannels.push_back(11);
declareProperty("PreshowerChannels", m_preshowerChannels); declareProperty("PreshowerChannels", m_preshowerChannels);
m_preshowerChannels.push_back(12);
m_preshowerChannels.push_back(13);
// Test channels is provided for conveniene, not normally used
declareProperty("TestChannels", m_testChannels); declareProperty("TestChannels", m_testChannels);
m_testChannels.push_back(14);
// Clock should always be in channel 15
declareProperty("ClockChannels", m_clockChannels); declareProperty("ClockChannels", m_clockChannels);
m_clockChannels.push_back(15); m_clockChannels.push_back(15);
...@@ -43,82 +58,6 @@ StatusCode ...@@ -43,82 +58,6 @@ StatusCode
RawWaveformDecoderTool::initialize() RawWaveformDecoderTool::initialize()
{ {
ATH_MSG_DEBUG("RawWaveformDecoderTool::initialize()"); ATH_MSG_DEBUG("RawWaveformDecoderTool::initialize()");
// Set up helpers
ATH_CHECK(detStore()->retrieve(m_ecalID, "EcalID"));
ATH_CHECK(detStore()->retrieve(m_vetoID, "VetoID"));
ATH_CHECK(detStore()->retrieve(m_triggerID, "TriggerID"));
ATH_CHECK(detStore()->retrieve(m_preshowerID, "PreshowerID"));
// Take each channel list and create identifiers
// Loop through digitizer channel lists creating Identifiers
m_identifierMap.clear();
// First, calorimeter. Can either be 4 or 6 channels
// Bottom row first from left to right, then top row
int index=0;
int module=0;
int row=0;
int pmt=0;
int max_modules = m_caloChannels.size() / 2;
for (auto const& chan : m_caloChannels) {
row = index / max_modules;
module = index % max_modules;
index++;
// Only store in map if digitizer channel is valid
if (chan < 0) continue;
m_identifierMap[chan] = m_ecalID->pmt_id(row, module, pmt);
ATH_MSG_DEBUG("Mapped digitizer channel " << chan << " to calo ID: " << m_identifierMap[chan]);
}
// Next, veto detector. Have station and plate here.
int station=0;
int plate=0;
pmt=0;
index=0;
int max_stations=m_vetoChannels.size() / 2;
for (auto const& chan : m_vetoChannels) {
station = index / max_stations;
plate = index % max_stations;
index++;
// Only store in map if digitizer channel is valid
if (chan < 0) continue;
m_identifierMap[chan] = m_vetoID->pmt_id(station, plate, pmt);
ATH_MSG_DEBUG("Mapped digitizer channel " << chan << " to veto ID: " << m_identifierMap[chan]);
}
// Next, trigger detector. Have pmt and plate.
pmt=0;
station=0;
index=0;
int max_plates=m_triggerChannels.size() / 2;
for (auto const& chan : m_triggerChannels) {
plate = index / max_plates;
pmt = index % max_plates;
index++;
// Only store in map if digitizer channel is valid
if (chan < 0) continue;
m_identifierMap[chan] = m_triggerID->pmt_id(station, plate, pmt);
ATH_MSG_DEBUG("Mapped dititizer channel " << chan << " to trigger ID: " << m_identifierMap[chan]);
}
// Finally, preshower detector.
pmt=0;
station=0;
plate=0;
index=0;
for (auto const& chan : m_preshowerChannels) {
plate = index;
index++;
// Only store in map if digitizer channel is valid
if (chan < 0) continue;
m_identifierMap[chan] = m_preshowerID->pmt_id(station, plate, pmt);
ATH_MSG_DEBUG("Mapped digitizer channel " << chan << " to preshower ID: " << m_identifierMap[chan]);
}
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
...@@ -172,7 +111,7 @@ RawWaveformDecoderTool::convert(const DAQFormats::EventFull* re, ...@@ -172,7 +111,7 @@ RawWaveformDecoderTool::convert(const DAQFormats::EventFull* re,
ATH_MSG_DEBUG("Found valid digitizer fragment"); ATH_MSG_DEBUG("Found valid digitizer fragment");
} }
std::vector<int>* channelList; std::vector<unsigned int>* channelList;
if (key == std::string("CaloWaveforms")) { if (key == std::string("CaloWaveforms")) {
channelList = &m_caloChannels; channelList = &m_caloChannels;
...@@ -191,7 +130,7 @@ RawWaveformDecoderTool::convert(const DAQFormats::EventFull* re, ...@@ -191,7 +130,7 @@ RawWaveformDecoderTool::convert(const DAQFormats::EventFull* re,
return StatusCode::FAILURE; return StatusCode::FAILURE;
} }
for (int channel: *channelList) { for (unsigned int channel: *channelList) {
ATH_MSG_DEBUG("Converting channel "+std::to_string(channel)+" for "+key); ATH_MSG_DEBUG("Converting channel "+std::to_string(channel)+" for "+key);
// Check if this has data // Check if this has data
...@@ -222,11 +161,6 @@ RawWaveformDecoderTool::convert(const DAQFormats::EventFull* re, ...@@ -222,11 +161,6 @@ RawWaveformDecoderTool::convert(const DAQFormats::EventFull* re,
<< *frag); << *frag);
} }
// Set ID if one exists (clock, for instance, doesn't have an identifier)
if (m_identifierMap.count(channel) == 1) {
wfm->setIdentifier(m_identifierMap[channel]);
}
container->push_back(wfm); container->push_back(wfm);
// Sanity check // Sanity check
......
...@@ -13,12 +13,6 @@ ...@@ -13,12 +13,6 @@
#include "EventFormats/DAQFormats.hpp" #include "EventFormats/DAQFormats.hpp"
#include "WaveRawEvent/RawWaveformContainer.h" #include "WaveRawEvent/RawWaveformContainer.h"
#include "Identifier/Identifier.h"
#include "FaserCaloIdentifier/EcalID.h"
#include "ScintIdentifier/VetoID.h"
#include "ScintIdentifier/TriggerID.h"
#include "ScintIdentifier/PreshowerID.h"
// This class provides conversion between bytestream and Waveform objects // This class provides conversion between bytestream and Waveform objects
class RawWaveformDecoderTool : public AthAlgTool { class RawWaveformDecoderTool : public AthAlgTool {
...@@ -38,48 +32,13 @@ class RawWaveformDecoderTool : public AthAlgTool { ...@@ -38,48 +32,13 @@ class RawWaveformDecoderTool : public AthAlgTool {
private: private:
// List of channels to include in each container // List of channels to include in each container
// List order must correspond to offline channel order std::vector<unsigned int> m_caloChannels;
// All L/R designations refer to looking at the detector from std::vector<unsigned int> m_vetoChannels;
// the beam direction. std::vector<unsigned int> m_triggerChannels;
// std::vector<unsigned int> m_preshowerChannels;
// In general, the ordering is layer (longitudinal), row (vertical), module (horizontal) std::vector<unsigned int> m_testChannels;
// Layers increase with longitudianl position downstream std::vector<unsigned int> m_clockChannels;
// Rows increase from bottom to top
// Modules increase from right to left
//
// For all lists, use invalid channel (-1) to indicate detectors
// missing in sequence (i.e. 3 of 4 veto counters)
//
// TI12 detector:
// Calorimeter order:
// bottom right, bottom left, top right, top left
// Veto
// front to back.
// Trigger
// bottom right PMT, bottom left PMT, top right PMT, top left PMT
// Preshower
// front to back
//
// 2021 Testbeam detector:
// Calo order:
// bottom right, bottom center, bottom left, top R, top C, top L
// All others are just in order front to back
std::vector<int> m_caloChannels;
std::vector<int> m_vetoChannels;
std::vector<int> m_triggerChannels;
std::vector<int> m_preshowerChannels;
std::vector<int> m_testChannels;
std::vector<int> m_clockChannels;
// Identifiers keyed by digitizer channel
std::map<unsigned int, Identifier> m_identifierMap;
// ID helpers
const EcalID* m_ecalID{nullptr};
const VetoID* m_vetoID{nullptr};
const TriggerID* m_triggerID{nullptr};
const PreshowerID* m_preshowerID{nullptr};
}; };
......
...@@ -9,8 +9,7 @@ RawWaveformCnv_p0::persToTrans(const RawWaveform_p0* persObj, RawWaveform* trans ...@@ -9,8 +9,7 @@ RawWaveformCnv_p0::persToTrans(const RawWaveform_p0* persObj, RawWaveform* trans
// Just fill available data here // Just fill available data here
// Rest of it patched up in RawWaveformContainerCnv_p0 // Rest of it patched up in RawWaveformContainerCnv_p0
// Persistent object stores ID value, so instantiate Identifier here transObj->setIdentifier(persObj->m_ID);
transObj->setIdentifier(Identifier32(persObj->m_ID));
transObj->setChannel(persObj->m_channel); transObj->setChannel(persObj->m_channel);
transObj->setCounts(persObj->m_adc_counts); transObj->setCounts(persObj->m_adc_counts);
...@@ -24,9 +23,7 @@ RawWaveformCnv_p0::transToPers(const RawWaveform* transObj, RawWaveform_p0* pers ...@@ -24,9 +23,7 @@ RawWaveformCnv_p0::transToPers(const RawWaveform* transObj, RawWaveform_p0* pers
// log << MSG::DEBUG << (*transObj) << endmsg; // log << MSG::DEBUG << (*transObj) << endmsg;
// log << MSG::DEBUG << "Persistent waveform (before):" << endmsg; // log << MSG::DEBUG << "Persistent waveform (before):" << endmsg;
// persObj->print(); // persObj->print();
persObj->m_ID = transObj->identify();
// Save actual ID number
persObj->m_ID = transObj->identify32().get_compact();
persObj->m_channel = transObj->channel(); persObj->m_channel = transObj->channel();
// Use copy here // Use copy here
......
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