Skip to content

Commit c9827fd

Browse files
authored
Merge pull request #123 from rest-for-physics/aquintana-BiPo
TRestRawBiPoAnalysisProcess first implementation
2 parents 320dffd + 32c49e1 commit c9827fd

File tree

5 files changed

+175
-1
lines changed

5 files changed

+175
-1
lines changed

inc/TRestRawBiPoAnalysisProcess.h

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*************************************************************************
2+
* This file is part of the REST software framework. *
3+
* *
4+
* Copyright (C) 2016 GIFNA/TREX (University of Zaragoza) *
5+
* For more information see http://gifna.unizar.es/trex *
6+
* *
7+
* REST is free software: you can redistribute it and/or modify *
8+
* it under the terms of the GNU General Public License as published by *
9+
* the Free Software Foundation, either version 3 of the License, or *
10+
* (at your option) any later version. *
11+
* *
12+
* REST is distributed in the hope that it will be useful, *
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15+
* GNU General Public License for more details. *
16+
* *
17+
* You should have a copy of the GNU General Public License along with *
18+
* REST in $REST_PATH/LICENSE. *
19+
* If not, see http://www.gnu.org/licenses/. *
20+
* For the list of contributors see $REST_PATH/CREDITS. *
21+
*************************************************************************/
22+
23+
#ifndef RESTProc_TRestRawBiPoAnalysisProcess
24+
#define RESTProc_TRestRawBiPoAnalysisProcess
25+
26+
#include "TRestEventProcess.h"
27+
#include "TRestRawSignalEvent.h"
28+
29+
class TRestRawBiPoAnalysisProcess : public TRestEventProcess {
30+
private:
31+
/// A pointer to the specific TRestRawSignalEvent input event
32+
TRestRawSignalEvent* fAnaEvent; //!
33+
34+
void Initialize() override;
35+
36+
public:
37+
RESTValue GetInputEvent() const override { return fAnaEvent; }
38+
RESTValue GetOutputEvent() const override { return fAnaEvent; }
39+
40+
void InitProcess() override;
41+
42+
const char* GetProcessName() const override { return "BiPoAnalysis"; }
43+
44+
TRestEvent* ProcessEvent(TRestEvent* eventInput) override;
45+
46+
void EndProcess() override;
47+
48+
void PrintMetadata() override {
49+
BeginPrintProcess();
50+
51+
EndPrintProcess();
52+
}
53+
54+
TRestRawBiPoAnalysisProcess();
55+
~TRestRawBiPoAnalysisProcess();
56+
57+
ClassDefOverride(TRestRawBiPoAnalysisProcess, 1);
58+
};
59+
#endif

inc/TRestRawSignalEvent.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class TRestRawSignalEvent : public TRestEvent {
4444
Double_t fMaxTime; //!
4545
Double_t fMinValue; //!
4646
Double_t fMaxValue; //!
47+
Double_t fAuxiliar = 0;
4748

4849
TVector2 fBaseLineRange = TVector2(-1, -1); //!
4950
TVector2 fRange = TVector2(-1, -1); //!
@@ -72,6 +73,10 @@ class TRestRawSignalEvent : public TRestEvent {
7273
for (int n = 0; n < GetNumberOfSignals(); n++) fSignal[n].SetTailPoints(p);
7374
}
7475

76+
// Set and Get a tmp variable (for BiPo)
77+
void SetAuxiliar(Double_t aux);
78+
auto GetAuxiliar() { return fAuxiliar; }
79+
7580
/// It sets the range to be used for the baseline calculation and calls
7681
/// TRestRawSignal::CalculateBaseLine()
7782
void SetBaseLineRange(TVector2 blRange, std::string option = "") {
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/*************************************************************************
2+
* This file is part of the REST software framework. *
3+
* *
4+
* Copyright (C) 2016 GIFNA/TREX (University of Zaragoza) *
5+
* For more information see http://gifna.unizar.es/trex *
6+
* *
7+
* REST is free software: you can redistribute it and/or modify *
8+
* it under the terms of the GNU General Public License as published by *
9+
* the Free Software Foundation, either version 3 of the License, or *
10+
* (at your option) any later version. *
11+
* *
12+
* REST is distributed in the hope that it will be useful, *
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15+
* GNU General Public License for more details. *
16+
* *
17+
* You should have a copy of the GNU General Public License along with *
18+
* REST in $REST_PATH/LICENSE. *
19+
* If not, see http://www.gnu.org/licenses/. *
20+
* For the list of contributors see $REST_PATH/CREDITS. *
21+
*************************************************************************/
22+
23+
////////////////////////////////////////////////////////////////////////
24+
/// The TRestRawBiPoSignalAnalysisProcess is meant to add specific BiPo
25+
/// observables when doing the analysis.
26+
/// For the moment it gives the observable "t1t2" which is the time distance
27+
/// between the frist and second window in the BiPo analysis
28+
///
29+
///--------------------------------------------------------------------------
30+
///
31+
/// RESTsoft - Software for Rare Event Searches with TPCs
32+
///
33+
/// History of developments:
34+
///
35+
/// 2023-Oct: First implementation
36+
/// Ana Quintana
37+
///
38+
/// \class TRestRawBiPoSignalAnalysisProcess
39+
/// \author Ana Quintana
40+
///
41+
/// <hr>
42+
///
43+
44+
#include "TRestRawBiPoAnalysisProcess.h"
45+
46+
using namespace std;
47+
48+
ClassImp(TRestRawBiPoAnalysisProcess);
49+
50+
///////////////////////////////////////////////
51+
/// \brief Default constructor
52+
///
53+
TRestRawBiPoAnalysisProcess::TRestRawBiPoAnalysisProcess() { Initialize(); }
54+
55+
///////////////////////////////////////////////
56+
/// \brief Default destructor
57+
///
58+
TRestRawBiPoAnalysisProcess::~TRestRawBiPoAnalysisProcess() {}
59+
60+
///////////////////////////////////////////////
61+
/// \brief Function to initialize input/output event members and define
62+
/// the section name
63+
///
64+
void TRestRawBiPoAnalysisProcess::Initialize() {
65+
SetSectionName(this->ClassName());
66+
SetLibraryVersion(LIBRARY_VERSION);
67+
fAnaEvent = NULL;
68+
69+
// Initialize here the values of class data members if needed
70+
}
71+
72+
///////////////////////////////////////////////
73+
/// \brief Process initialization. Observable names can be re-interpreted
74+
/// here. Any action in the process required before starting event process
75+
/// might be added here.
76+
///
77+
void TRestRawBiPoAnalysisProcess::InitProcess() {
78+
// TRestRawToSignalProcess::InitProcess();
79+
80+
// fEventCounter = 0;
81+
}
82+
83+
///////////////////////////////////////////////
84+
/// \brief The main processing event function
85+
///
86+
TRestEvent* TRestRawBiPoAnalysisProcess::ProcessEvent(TRestEvent* evInput) {
87+
fAnaEvent = (TRestRawSignalEvent*)evInput;
88+
89+
// Write here the main logic of process: TRestRawBiPoAnalysisProcess
90+
// Read data from input event, write data to output event, and save observables to tree
91+
92+
Int_t t1t2_BiPo = fAnaEvent->GetAuxiliar();
93+
SetObservableValue("t1t2", t1t2_BiPo);
94+
95+
return fAnaEvent;
96+
}
97+
98+
///////////////////////////////////////////////
99+
/// \brief Function to include required actions after all events have been
100+
/// processed.
101+
///
102+
void TRestRawBiPoAnalysisProcess::EndProcess() {
103+
// Write here the jobs to do when all the events are processed
104+
}

src/TRestRawBiPoToSignalProcess.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
using namespace std;
8484

8585
#include "TTimeStamp.h"
86-
#include "zlib.h"
86+
// #include "zlib.h"
8787

8888
ClassImp(TRestRawBiPoToSignalProcess);
8989

@@ -529,6 +529,7 @@ Int_t TRestRawBiPoToSignalProcess::ReadBiPoEventData(std::vector<uint16_t>& mdat
529529
}
530530
totalBytesReaded += sizeof(int32_t);
531531
RESTDebug << " T1-T2 distance --> " << tmp << RESTendl;
532+
fSignalEvent->SetAuxiliar(tmp);
532533

533534
mdata.resize(data_size);
534535
if (fread(&mdata[0], sizeof(uint16_t), data_size, fInputBinFile) != (size_t)data_size) {

src/TRestRawSignalEvent.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,11 @@ Double_t TRestRawSignalEvent::GetMaxTime() {
354354
return maxTime;
355355
}
356356

357+
// An auxiliar variable that can be used to store temporal values.
358+
Double_t fAuxiliar = 0;
359+
void TRestRawSignalEvent::SetAuxiliar(Double_t aux) { fAuxiliar = aux; }
360+
auto GetAuxiliar() { return fAuxiliar; }
361+
357362
///////////////////////////////////////////////
358363
/// \brief This method draws current raw signal event in a TPad.
359364
///

0 commit comments

Comments
 (0)