79 #include "TRestDetectorSignalChannelActivityProcess.h"
103 const char* configFilename) {
106 if (LoadConfigFromFile(configFilename)) LoadDefaultConfig();
126 SetSectionName(this->ClassName());
127 SetLibraryVersion(LIBRARY_VERSION);
145 if (LoadConfigFromFile(configFilename, name)) LoadDefaultConfig();
156 fReadout = GetMetadata<TRestDetectorReadout>();
158 RESTDebug <<
"TRestDetectorSignalChannelActivityProcess::InitProcess. Readout pointer : " << fReadout
161 fReadout->PrintMetadata();
164 fDaqChannelsHisto =
new TH1D(
"daqChannelActivity",
"daqChannelActivity", fDaqHistogramChannels,
165 fDaqStartChannel, fDaqEndChannel);
167 fReadoutChannelsHisto =
168 new TH1D(
"rChannelActivity",
"readoutChannelActivity", fReadoutHistogramChannels,
169 fReadoutStartChannel, fReadoutEndChannel);
170 fReadoutChannelsHisto_OneSignal =
171 new TH1D(
"rChannelActivity_1",
"readoutChannelActivity", fReadoutHistogramChannels,
172 fReadoutStartChannel, fReadoutEndChannel);
173 fReadoutChannelsHisto_OneSignal_High =
174 new TH1D(
"rChannelActivity_1H",
"readoutChannelActivity", fReadoutHistogramChannels,
175 fReadoutStartChannel, fReadoutEndChannel);
176 fReadoutChannelsHisto_TwoSignals =
177 new TH1D(
"rChannelActivity_2",
"readoutChannelActivity", fReadoutHistogramChannels,
178 fReadoutStartChannel, fReadoutEndChannel);
179 fReadoutChannelsHisto_TwoSignals_High =
180 new TH1D(
"rChannelActivity_2H",
"readoutChannelActivity", fReadoutHistogramChannels,
181 fReadoutStartChannel, fReadoutEndChannel);
182 fReadoutChannelsHisto_ThreeSignals =
183 new TH1D(
"rChannelActivity_3",
"readoutChannelActivity", fReadoutHistogramChannels,
184 fReadoutStartChannel, fReadoutEndChannel);
185 fReadoutChannelsHisto_ThreeSignals_High =
186 new TH1D(
"rChannelActivity_3H",
"readoutChannelActivity", fReadoutHistogramChannels,
187 fReadoutStartChannel, fReadoutEndChannel);
188 fReadoutChannelsHisto_MultiSignals =
189 new TH1D(
"rChannelActivity_M",
"readoutChannelActivity", fReadoutHistogramChannels,
190 fReadoutStartChannel, fReadoutEndChannel);
191 fReadoutChannelsHisto_MultiSignals_High =
192 new TH1D(
"rChannelActivity_MH",
"readoutChannelActivity", fReadoutHistogramChannels,
193 fReadoutStartChannel, fReadoutEndChannel);
208 fSignalEvent->SetID(fInputSignalEvent->GetID());
209 fSignalEvent->SetSubID(fInputSignalEvent->GetSubID());
210 fSignalEvent->SetTimeStamp(fInputSignalEvent->GetTimeStamp());
211 fSignalEvent->SetSubEventTag(fInputSignalEvent->GetSubEventTag());
213 Int_t N = fInputSignalEvent->GetNumberOfSignals();
214 for (
int sgnl = 0; sgnl < N; sgnl++) fSignalEvent->AddSignal(*fInputSignalEvent->GetSignal(sgnl));
219 for (
int s = 0; s < fSignalEvent->GetNumberOfSignals(); s++) {
221 if (sgnl->GetMaxValue() > fHighThreshold) Nhigh++;
222 if (sgnl->GetMaxValue() > fLowThreshold) Nlow++;
225 for (
int s = 0; s < fSignalEvent->GetNumberOfSignals(); s++) {
228 if (!fReadOnly && fReadout) {
229 Int_t signalID = fSignalEvent->GetSignal(s)->GetID();
231 Int_t p, m, readoutChannel;
232 fReadout->GetPlaneModuleChannel(signalID, p, m, readoutChannel);
234 fReadoutChannelsHisto->Fill(readoutChannel);
236 if (sgnl->GetMaxValue() > fLowThreshold) {
237 if (Nlow == 1) fReadoutChannelsHisto_OneSignal->Fill(readoutChannel);
238 if (Nlow == 2) fReadoutChannelsHisto_TwoSignals->Fill(readoutChannel);
239 if (Nlow == 3) fReadoutChannelsHisto_ThreeSignals->Fill(readoutChannel);
240 if (Nlow > 3 && Nlow < 10) fReadoutChannelsHisto_MultiSignals->Fill(readoutChannel);
243 if (sgnl->GetMaxValue() > fHighThreshold) {
244 if (Nhigh == 1) fReadoutChannelsHisto_OneSignal_High->Fill(readoutChannel);
245 if (Nhigh == 2) fReadoutChannelsHisto_TwoSignals_High->Fill(readoutChannel);
246 if (Nhigh == 3) fReadoutChannelsHisto_ThreeSignals_High->Fill(readoutChannel);
247 if (Nhigh > 3 && Nhigh < 10) fReadoutChannelsHisto_MultiSignals_High->Fill(readoutChannel);
252 Int_t daqChannel = fSignalEvent->GetSignal(s)->GetID();
253 fDaqChannelsHisto->Fill(daqChannel);
258 fAnalysisTree->PrintObservables();
270 fDaqChannelsHisto->Write();
272 fReadoutChannelsHisto->Write();
274 fReadoutChannelsHisto_OneSignal->Write();
275 fReadoutChannelsHisto_TwoSignals->Write();
276 fReadoutChannelsHisto_ThreeSignals->Write();
277 fReadoutChannelsHisto_MultiSignals->Write();
279 fReadoutChannelsHisto_OneSignal_High->Write();
280 fReadoutChannelsHisto_TwoSignals_High->Write();
281 fReadoutChannelsHisto_ThreeSignals_High->Write();
282 fReadoutChannelsHisto_MultiSignals_High->Write();
292 fLowThreshold =
StringToDouble(GetParameter(
"lowThreshold",
"25"));
293 fHighThreshold =
StringToDouble(GetParameter(
"highThreshold",
"50"));
295 fDaqHistogramChannels =
StringToInteger(GetParameter(
"daqChannels",
"300"));
296 fDaqStartChannel =
StringToInteger(GetParameter(
"daqStartCh",
"4320"));
298 fReadoutHistogramChannels =
StringToInteger(GetParameter(
"readoutChannels",
"128"));
299 fReadoutStartChannel =
StringToInteger(GetParameter(
"readoutStartCh",
"0"));
300 fReadoutEndChannel =
StringToInteger(GetParameter(
"readoutEndCh",
"128"));
A pure analysis process to generate histograms with detector channels activity.
void LoadDefaultConfig()
Function to load the default config in absence of RML input.
~TRestDetectorSignalChannelActivityProcess()
Default destructor.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
void LoadConfig(const std::string &configFilename, const std::string &name="")
Function to load the configuration from an external configuration file.
void Initialize() override
Function to initialize input/output event members and define the section name.
void InitFromConfigFile() override
Function to read input parameters from the RML TRestDetectorSignalChannelActivityProcess metadata sec...
void EndProcess() override
Function to include required actions after all events have been processed. In this process it will ta...
TRestDetectorSignalChannelActivityProcess()
Default constructor.
void InitProcess() override
Process initialization. The ROOT TH1 histograms are created here using the limits defined in the proc...
A base class for any REST event.
@ REST_Info
+show most of the information for each steps
@ REST_Debug
+show the defined debug messages
Double_t StringToDouble(std::string in)
Gets a double from a string.
Int_t StringToInteger(std::string in)
Gets an integer from a string.