-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #106 from rest-for-physics/jgalan_bipo
Implementing BiPo event data processing in REST
- Loading branch information
Showing
14 changed files
with
1,105 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?> | ||
|
||
<TRestManager> | ||
|
||
<include file="globals.xml" /> | ||
|
||
<globals> | ||
<variable name="RUN_TYPE" value="RawData" overwrite="false" /> | ||
<variable name="FORMAT" value="[fRunTag]_run_[fRunNumber].data" overwrite="false" /> | ||
</globals> | ||
|
||
<TRestRun file="run.xml"/> | ||
|
||
<TRestProcessRunner name="RawSignals" title="Raw processing and analysis" verboseLevel="silent"> | ||
|
||
<parameter name="eventsToProcess" value="0" /> | ||
|
||
<addProcess type="TRestRawBiPoToSignalProcess" name="BiPo" value="ON" verboseLevel="silent"> | ||
<parameter name="electronicsType" value="MATACQ" /> | ||
<parameter name="minPoints" value="0" /> | ||
</addProcess> | ||
|
||
<addProcess type="TRestEventRateAnalysisProcess" name="rate" observable="all" value="ON" verboseLevel="info" > | ||
<observable name="SecondsFromStart" type="double" value="ON" /> | ||
<observable name="HoursFromStart" type="double" value="ON" /> | ||
<observable name="EventTimeDelay" type="double" value="ON" /> | ||
<observable name="MeanRate_InHz" type="double" value="ON" /> | ||
</addProcess> | ||
|
||
<addProcess type="TRestRawSignalAnalysisProcess" name="front" value="ON" | ||
baseLineRange="(800,1000)" integralRange="(0,1000)" | ||
pointThreshold="${POINT_TH}" pointsOverThreshold="${NPOINTS}" signalThreshold="${SGNL_TH}" | ||
verboseLevel="silent" > | ||
<observable name="max_amplitude_map" type="map<int,double>" value="ON" /> | ||
<observable name="thr_integral_map" type="map<int,double>" value="ON" /> | ||
<observable name="BaseLineMean" type="double" value="ON" /> | ||
<observable name="BaseLineSigmaMean" type="double" value="ON" /> | ||
<observable name="NumberOfSignals" type="int" value="ON" /> | ||
<observable name="NumberOfGoodSignals" type="int" value="ON" /> | ||
<observable name="ThresholdIntegral" type="double" value="ON" /> | ||
<observable name="TripleMaxIntegral" type="double" value="ON" /> | ||
<observable name="AmplitudeRatio" type="double" value="ON" /> | ||
<observable name="MaxPeakTime" type="double" value="ON" /> | ||
<observable name="AveragePeakTime" type="double" value="ON" /> | ||
|
||
<cut name="NumberOfGoodSignals" value="(1,1000)" /> | ||
<parameter name="cutsEnabled" value="true" /> | ||
</addProcess> | ||
|
||
<addProcess type="TRestRawSignalAnalysisProcess" name="back" value="ON" | ||
baseLineRange="(2200,2400)" integralRange="(1000,2200)" | ||
pointThreshold="${POINT_TH}" pointsOverThreshold="${NPOINTS}" signalThreshold="${SGNL_TH}" | ||
verboseLevel="silent" > | ||
<observable name="max_amplitude_map" type="map<int,double>" value="ON" /> | ||
<observable name="thr_integral_map" type="map<int,double>" value="ON" /> | ||
<observable name="BaseLineMean" type="double" value="ON" /> | ||
<observable name="BaseLineSigmaMean" type="double" value="ON" /> | ||
<observable name="NumberOfSignals" type="int" value="ON" /> | ||
<observable name="NumberOfGoodSignals" type="int" value="ON" /> | ||
<observable name="ThresholdIntegral" type="double" value="ON" /> | ||
<observable name="TripleMaxIntegral" type="double" value="ON" /> | ||
<observable name="AmplitudeRatio" type="double" value="ON" /> | ||
<observable name="MaxPeakTime" type="double" value="ON" /> | ||
<observable name="AveragePeakTime" type="double" value="ON" /> | ||
|
||
<cut name="NumberOfGoodSignals" value="(1,1000)" /> | ||
<parameter name="cutsEnabled" value="true" /> | ||
</addProcess> | ||
</TRestProcessRunner> | ||
|
||
<addTask type="processEvents" value="ON" /> | ||
|
||
</TRestManager> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
<panel font_size="0.06"> | ||
<label value="Run number : [TRestRun::fRunNumber]" x="0.25" y="0.9" /> | ||
<label value="Run tag : [TRestRun::fRunTag]" x="0.25" y="0.82" /> | ||
<label value="Run starts : [[startTime]]" x="0.25" y="0.74" /> | ||
<label value="Run ends : [[endTime]]" x="0.25" y="0.66" /> | ||
<label value="Entries : [[entries]]" x="0.25" y="0.58" /> | ||
<label value="Run duration : [[runLength]] hours" x="0.25" y="0.50" /> | ||
<label value="Mean rate : [[meanRate]] Hz" x="0.25" y="0.42" /> | ||
|
||
<!-- | ||
<label value="Detector pressure : [TRestDetector::fPressure] bar" x="0.25" y="0.30" /> | ||
<label value="Mesh voltage : [TRestDetector::fAmplificationVoltage] V" x="0.25" y="0.22" /> | ||
<label value="Drift voltage : [TRestDetector::fDriftField] V/cm/bar" x="0.25" y="0.14" /> | ||
<label value="Electronics gain : [TRestDetector::fElectronicsGain]" x="0.25" y="0.06" /> | ||
--> | ||
</panel> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<TRestManager name="SpecPlot" title="Example" verboseLevel="info"> | ||
<TRestAnalysisPlot name="restplot" title="Basic Plots" previewPlot="false" verboseLevel="silent"> | ||
<canvas size="(1800,1200)" divide="(3,3)" save="R[fRunNumber]_[fRunTag]_Raw.png"/> | ||
<include file="panel.xml"/> | ||
<plot name="MeanRateEvolution" title="Mean Rate evolution" xlabel="Threshold Integral [#]" ylabel="Counts" legend="ON" logscale="false" value="ON" xOffset="6" timeDisplay="ON"> | ||
<histo name="RateEvolution"> | ||
<variable name="timeStamp" nbins="1000" range=""/> | ||
<variable name="rate_MeanRate_InHz" nbins="100" range="(0,300)"/> | ||
<parameter name="lineColor" value="1"/> | ||
</histo> | ||
</plot> | ||
<plot name="NoiseEvolution" title="Noise evolution" xlabel="Threshold Integral [#]" ylabel="Counts" legend="ON" logscale="false" value="ON" xOffset="6" timeDisplay="ON"> | ||
<histo name="Front_BaseLineSigma"> | ||
<variable name="timeStamp" nbins="1000" range=""/> | ||
<variable name="front_BaseLineSigmaMean" range="(0,20)" nbins="100"/> | ||
<parameter name="lineColor" value="1"/> | ||
</histo> | ||
<histo name="Back_BaseLineSigma"> | ||
<variable name="timeStamp" nbins="1000"/> | ||
<variable name="back_BaseLineSigmaMean" nbins="100"/> | ||
<parameter name="lineColor" value="1"/> | ||
</histo> | ||
</plot> | ||
<plot name="ThresholdIntegral" title="ThresholdIntegrals" xlabel="Threshold Integral [#]" ylabel="Counts" legend="ON" logscale="false" value="ON" xOffset="6"> | ||
<histo name="Front_Integral"> | ||
<variable name="front_ThresholdIntegral" range="(0,30000)" nbins="1000"/> | ||
<parameter name="lineColor" value="1"/> | ||
</histo> | ||
<histo name="Back_Integral"> | ||
<variable name="back_ThresholdIntegral" range="(0,30000)" nbins="1000"/> | ||
<parameter name="lineColor" value="2"/> | ||
</histo> | ||
</plot> | ||
<plot name="TripleMaxIntegral" title="TripleMaxIntegrals" xlabel="TripleMax Integral [#]" ylabel="Counts" legend="ON" logscale="false" value="ON" xOffset="6"> | ||
<histo name="Front_TripleIntegral"> | ||
<variable name="front_TripleMaxIntegral" range="(0,5000)" nbins="1000"/> | ||
<parameter name="lineColor" value="1"/> | ||
</histo> | ||
<histo name="Back_TripleIntegral"> | ||
<variable name="back_TripleMaxIntegral" range="(0,5000)" nbins="1000"/> | ||
<parameter name="lineColor" value="2"/> | ||
</histo> | ||
</plot> | ||
<plot name="MaxPeakTime" title="MaxPeakTimes" xlabel="TripleMax Integral [#]" ylabel="Counts" legend="ON" logscale="false" value="ON" xOffset="6"> | ||
<histo name="Front_MaxPeakTime"> | ||
<variable name="front_MaxPeakTime" range="(0,2000)" nbins="200"/> | ||
<parameter name="lineColor" value="1"/> | ||
</histo> | ||
<histo name="Back_MaxPeakTime"> | ||
<variable name="back_MaxPeakTime" range="(0,2000)" nbins="200"/> | ||
<parameter name="lineColor" value="2"/> | ||
</histo> | ||
</plot> | ||
<plot name="GoodSignals" title="GoodSignals" xlabel="Good signals [#]" ylabel="Counts" legend="ON" logscale="false" value="ON" xOffset="6"> | ||
<histo name="Front_NumberOfGoodSignals"> | ||
<variable name="front_NumberOfGoodSignals" range="(0,5)" nbins="5"/> | ||
<parameter name="lineColor" value="1"/> | ||
</histo> | ||
<histo name="Back_NumberOfGoodSignals"> | ||
<variable name="back_NumberOfGoodSignals" range="(0,5)" nbins="5"/> | ||
<parameter name="lineColor" value="2"/> | ||
</histo> | ||
</plot> | ||
<plot name="FrontVersusBackIntegral" title="FrontVersusBackIntegral" xlabel="Front Integral [#]" ylabel="Back Integral" legend="ON" logscale="false" value="ON" xOffset="6"> | ||
<variable name="front_ThresholdIntegral" range="(0,30000)" nbins="100"/> | ||
<variable name="back_ThresholdIntegral" range="(0,5000)" nbins="100"/> | ||
</plot> | ||
<plot name="FrontVersusBackMaxPeakTime" title="FrontVersusBackMaxPeakTime" xlabel="Front MaxPeakTime [#]" ylabel="Back MaxPeakTime" legend="ON" logscale="false" value="ON" xOffset="6"> | ||
<variable name="front_MaxPeakTime" range="(0,200)" nbins="100"/> | ||
<variable name="back_MaxPeakTime" range="(1000,1800)" nbins="100"/> | ||
</plot> | ||
</TRestAnalysisPlot> | ||
<addTask command="restplot->PlotCombinedCanvas()" value="ON"/> | ||
</TRestManager> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
/************************************************************************* | ||
* This file is part of the REST software framework. * | ||
* * | ||
* Copyright (C) 2016 GIFNA/TREX (University of Zaragoza) * | ||
* For more information see http://gifna.unizar.es/trex * | ||
* * | ||
* REST is free software: you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation, either version 3 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
* REST is distributed in the hope that it will be useful, * | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
* GNU General Public License for more details. * | ||
* * | ||
* You should have a copy of the GNU General Public License along with * | ||
* REST in $REST_PATH/LICENSE. * | ||
* If not, see http://www.gnu.org/licenses/. * | ||
* For the list of contributors see $REST_PATH/CREDITS. * | ||
*************************************************************************/ | ||
|
||
#ifndef RestCore_TRestBiPoToSignalProcess | ||
#define RestCore_TRestBiPoToSignalProcess | ||
|
||
#include "TRestRawSignalEvent.h" | ||
#include "TRestRawToSignalProcess.h" | ||
|
||
constexpr size_t CTAG_SZ = 4; | ||
|
||
constexpr int MATACQ_N_CH = 4; // Number of channels | ||
constexpr int MATACQ_MAX_DATA_SAMP = 10240; // Max number of samples for | ||
constexpr int MATACQ_BIPO_TIMEOUT = 0; // BiPo mode timeout | ||
|
||
constexpr uint32_t MATACQ_UNDERFLOW = 0x0000; | ||
constexpr uint32_t MATACQ_ZERO = 0x8000; | ||
constexpr uint32_t MATACQ_OVERFLOW = 0xFFFF; | ||
|
||
constexpr char TAG_RUN_START[] = "STA"; | ||
constexpr char TAG_RUN_BIPO[] = "ST2"; | ||
constexpr char TAG_RUN_STOP[] = "STO"; | ||
constexpr char TAG_ACQ[] = "ACQ"; | ||
constexpr char TAG_ACQ_2[] = "AC2"; | ||
|
||
//! An process to read binary data from BiPo electronics | ||
class TRestRawBiPoToSignalProcess : public TRestRawToSignalProcess { | ||
public: | ||
/// A structure to store the configuration settings of Matacq board | ||
struct MatacqBoard { | ||
/// The base memory address of the Matacq board | ||
int32_t address; | ||
|
||
std::array<int32_t, MATACQ_N_CH> en_ch; | ||
std::array<int32_t, MATACQ_N_CH> trg_ch; | ||
|
||
int32_t Trig_Type; | ||
int32_t Threshold; | ||
int32_t Nb_Acq; | ||
int32_t Posttrig; | ||
int32_t Time_Tag_On; | ||
int32_t Sampling_GHz; | ||
|
||
std::array<int32_t, MATACQ_N_CH> ch_shifts; | ||
int32_t nChannels; | ||
}; | ||
|
||
/// A structure to store the BiPo settings | ||
struct BiPoSettings { | ||
int32_t trigger_address; | ||
|
||
int32_t Win1_Posttrig; | ||
int32_t Timeout_200KHz; | ||
|
||
std::array<int32_t, MATACQ_N_CH> Trig_Chan; | ||
std::array<int32_t, MATACQ_N_CH> Level1_mV; | ||
std::array<int32_t, MATACQ_N_CH> Level2_mV; | ||
|
||
int32_t t1_window; | ||
int32_t t2_window; | ||
int32_t t1_t2_timeout; | ||
}; | ||
|
||
protected: | ||
/// The number of Matacq boards present on the setup | ||
Int_t fNBoards = 0; ///< | ||
|
||
/// A vector of Matacq boards that contain the information of each card | ||
std::vector<MatacqBoard> fMatacqBoard; //< | ||
|
||
/// A vector of BiPo settings | ||
std::vector<BiPoSettings> fBiPoSettings; //< | ||
|
||
/// A temporary counter used to define the event id | ||
Int_t fEventCounter = 0; //! | ||
|
||
void ReadHeader(); | ||
void ReadFooter(); | ||
void ReadBoard(); | ||
void ReadBiPoSetup(); | ||
Int_t ReadBiPoEventData(std::vector<uint16_t>& mdata); | ||
|
||
UInt_t GetBoardIndex(Int_t address); | ||
Int_t GetBin(Int_t boardIndex, Int_t channel, Int_t bin); | ||
|
||
public: | ||
void InitProcess() override; | ||
void Initialize() override; | ||
TRestEvent* ProcessEvent(TRestEvent* inputEvent) override; | ||
|
||
/// Returs a given process name | ||
const char* GetProcessName() const override { return "BiPoToSignal"; } | ||
|
||
void PrintMetadata() override; | ||
|
||
/// It gives access to a Matacq board confituration | ||
MatacqBoard GetMatacqBoard(Int_t n) { return n > fNBoards ? (MatacqBoard){} : fMatacqBoard[n]; } | ||
|
||
/// It gives access to confituration of BiPo settings | ||
BiPoSettings GetBiPoSettings(Int_t n) { return n > fNBoards ? (BiPoSettings){} : fBiPoSettings[n]; } | ||
|
||
TRestRawBiPoToSignalProcess(); | ||
~TRestRawBiPoToSignalProcess(); | ||
|
||
ClassDefOverride(TRestRawBiPoToSignalProcess, 1); | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Oops, something went wrong.