17 #include "TRestDetectorDaqChannelSwitchingProcess.h"
20 #include <TPaveText.h>
26 TRestDetectorDaqChannelSwitchingProcess::TRestDetectorDaqChannelSwitchingProcess() { Initialize(); }
28 TRestDetectorDaqChannelSwitchingProcess::~TRestDetectorDaqChannelSwitchingProcess() {}
31 SetLibraryVersion(LIBRARY_VERSION);
32 SetSectionName(this->ClassName());
34 fFirstDaqChannelDef.clear();
35 fIgnoreUndefinedModules =
false;
41 fReadout = GetMetadata<TRestDetectorReadout>();
42 if (fReadout !=
nullptr) {
43 auto iter = fFirstDaqChannelDef.begin();
44 while (iter != fFirstDaqChannelDef.end()) {
45 auto mod = fReadout->GetReadoutModuleWithID(iter->first);
46 if (mod ==
nullptr)
continue;
49 for (
size_t i = 0; i < mod->GetNumberOfChannels(); i++) {
50 if (mod->GetChannel(i)->GetDaqID() < mindaq) {
51 mindaq = mod->GetChannel(i)->GetDaqID();
56 for (
size_t i = 0; i < mod->GetNumberOfChannels(); i++) {
57 mod->GetChannel(i)->SetDaqID(mod->GetChannel(i)->GetDaqID() - mindaq + iter->second);
63 if (fIgnoreUndefinedModules) {
64 for (
int i = 0; i < fReadout->GetNumberOfReadoutPlanes(); i++) {
69 if (fFirstDaqChannelDef.count(mod.
GetModuleID()) == 0) {
92 TiXmlElement* ele = fElement->FirstChildElement(
"module");
93 while (ele !=
nullptr) {
96 if (
id == -1 || channel == -1)
continue;
97 fFirstDaqChannelDef[id] = channel;
98 ele = ele->NextSiblingElement(
"module");
100 fIgnoreUndefinedModules = StringToBool(GetParameter(
"ignoreUndefinedModules",
"false"));
void Initialize() override
Making default settings.
void EndProcess() override
To be executed at the end of the run (outside event loop)
void InitFromConfigFile() override
To make settings from rml file. This method must be implemented in the derived class.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
Process one event.
void InitProcess() override
To be executed at the beginning of the run (outside event loop)
void SetDaqID(Int_t id)
Sets the daq channel number id.
Int_t GetModuleID() const
Returns the module id.
TRestDetectorReadoutChannel * GetChannel(size_t n)
Returns a pointer to a readout channel by index.
size_t GetNumberOfChannels() const
Returns the total number of channels defined inside the module.
size_t GetNumberOfModules() const
Returns the total number of modules in the readout plane.
A base class for any REST event.
Int_t StringToInteger(std::string in)
Gets an integer from a string.