R3BROOT
R3B analysis software
Toggle main menu visibility
Loading...
Searching...
No Matches
R3BNeulandCalTest.cxx
Go to the documentation of this file.
1
/******************************************************************************
2
* Copyright (C) 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
3
* Copyright (C) 2019-2025 Members of R3B Collaboration *
4
* *
5
* This software is distributed under the terms of the *
6
* GNU General Public Licence (GPL) version 3, *
7
* copied verbatim in the file "LICENSE". *
8
* *
9
* In applying this license GSI does not waive the privileges and immunities *
10
* granted to it by virtue of its status as an Intergovernmental Organization *
11
* or submit itself to any jurisdiction. *
12
******************************************************************************/
13
14
#include "
R3BNeulandCalTest.h
"
15
#include "FairLogger.h"
16
#include "FairRootManager.h"
17
#include "R3BLosHit.h"
18
#include "
R3BNeulandCalData.h
"
19
#include "
R3BNeulandPmt.h
"
20
#include "TClonesArray.h"
21
#include "TH1F.h"
22
#include "TH2F.h"
23
#include "TMath.h"
24
25
Double_t
walk
(Double_t x)
26
{
27
Double_t y = 0;
28
29
Double_t par1 = 1500.;
// +-0.2238
30
Double_t par2 = 0.00075;
//+-2.355e-05
31
y = par1 * TMath::Power(x, par2) - (par1 * TMath::Power(400., par2));
// Michael's
32
33
// y=2.29083*log(x)-0.0870157*log(x)*log(x)-4.57824; // mine
34
35
return
y;
36
// return 0.;
37
}
38
39
R3BNeulandCalTest::R3BNeulandCalTest
()
40
:
fnEvents
(0)
41
,
fLandPmt
(NULL)
42
,
fNeulandPmt
(NULL)
43
,
fLosHit
(NULL)
44
{
45
}
46
47
R3BNeulandCalTest::R3BNeulandCalTest
(
const
char
* name, Int_t iVerbose)
48
: FairTask(name, iVerbose)
49
,
fnEvents
(0)
50
,
fLandPmt
(NULL)
51
,
fNeulandPmt
(NULL)
52
,
fLosHit
(NULL)
53
{
54
}
55
56
R3BNeulandCalTest::~R3BNeulandCalTest
() {}
57
58
InitStatus
R3BNeulandCalTest::Init
()
59
{
60
FairRootManager* fMan = FairRootManager::Instance();
61
if
(!fMan)
62
{
63
LOG(fatal) <<
"FairRootManager not found"
;
64
}
65
fLandPmt
= (TClonesArray*)fMan->GetObject(
"NeulandCalData"
);
66
fNeulandPmt
= (TClonesArray*)fMan->GetObject(
"NeulandPmt"
);
67
fLosHit
= (TClonesArray*)fMan->GetObject(
"LosHit"
);
68
CreateHistos
();
69
70
return
kSUCCESS;
71
}
72
73
void
R3BNeulandCalTest::Exec
(Option_t* option)
74
{
75
Bool_t startSeen = kTRUE;
76
Double_t startTime = 0.;
77
if
(
fLosHit
)
78
{
79
Int_t nLosHit =
fLosHit
->GetEntriesFast();
80
Double_t stime[4];
81
R3BLosHit* losHit;
82
Int_t ch;
83
Bool_t seen[] = { kFALSE, kFALSE, kFALSE, kFALSE };
84
for
(Int_t i = 0; i < nLosHit; i++)
85
{
86
losHit = (R3BLosHit*)
fLosHit
->At(i);
87
ch = losHit->GetChannel();
88
if
(ch > 3)
89
{
90
continue
;
91
}
92
else
93
{
94
seen[ch] = kTRUE;
95
stime[ch] = losHit->GetTime();
96
}
97
}
98
99
for
(Int_t i = 0; i < 4; i++)
100
{
101
if
(1 == i)
102
{
103
continue
;
104
}
105
if
(!seen[i])
106
{
107
startSeen = kFALSE;
108
break
;
109
}
110
}
111
if
(startSeen)
112
{
113
startTime = (stime[0] + stime[2] + stime[3]) / 3.;
114
}
115
}
116
117
if
(
fLandPmt
)
118
{
119
Int_t nLandPmt =
fLandPmt
->GetEntriesFast();
120
R3BNeulandCalData
* pmt1;
121
R3BNeulandCalData
* pmt2;
122
Int_t barId;
123
Double_t time1, time2;
124
for
(Int_t i1 = 0; i1 < nLandPmt; i1++)
125
{
126
pmt1 = (
R3BNeulandCalData
*)
fLandPmt
->At(i1);
127
barId = pmt1->
GetBarId
();
128
time1 = pmt1->
GetTime
();
129
time1 +=
walk
(pmt1->
GetQdc
());
130
131
for
(Int_t i2 = 0; i2 < nLandPmt; i2++)
132
{
133
if
(i2 == i1)
134
{
135
continue
;
136
}
137
pmt2 = (
R3BNeulandCalData
*)
fLandPmt
->At(i2);
138
if
(barId != pmt2->
GetBarId
())
139
{
140
continue
;
141
}
142
time2 = pmt2->
GetTime
();
143
time2 +=
walk
(pmt2->
GetQdc
());
144
145
if
(startSeen && barId == 125)
146
{
147
fh_los_corr
->Fill((time1 + time2) / 2., startTime);
148
fh_tof
->Fill((time1 + time2) / 2. - startTime);
149
fh_qdctof
->Fill((time1 + time2) / 2. - startTime - 1563. + 30.,
150
TMath::Sqrt(pmt1->
GetQdc
() * pmt2->
GetQdc
()));
151
}
152
if
(startSeen && barId == 225)
153
{
154
fh_qdctof
->Fill((time1 + time2) / 2. - startTime - 1571. + 30.,
155
TMath::Sqrt(pmt1->
GetQdc
() * pmt2->
GetQdc
()));
156
}
157
}
158
}
159
}
160
if
(
fNeulandPmt
)
161
{
162
Int_t nNeulandPmt =
fNeulandPmt
->GetEntriesFast();
163
R3BNeulandPmt
* pmt1;
164
R3BNeulandPmt
* pmt2;
165
Int_t planeId;
166
Int_t barId;
167
Double_t time1, time2;
168
for
(Int_t i1 = 0; i1 < nNeulandPmt; i1++)
169
{
170
pmt1 = (
R3BNeulandPmt
*)
fNeulandPmt
->At(i1);
171
planeId = pmt1->
GetPlaneId
();
172
barId = pmt1->
GetBarId
();
173
time1 = pmt1->
GetTime
();
174
time1 +=
walk
(pmt1->
GetCharge
());
175
176
for
(Int_t i2 = i1 + 1; i2 < nNeulandPmt; i2++)
177
{
178
if
(i2 == i1)
179
{
180
continue
;
181
}
182
pmt2 = (
R3BNeulandPmt
*)
fNeulandPmt
->At(i2);
183
if
(barId != pmt2->
GetBarId
())
184
{
185
continue
;
186
}
187
time2 = pmt2->
GetTime
();
188
time2 +=
walk
(pmt2->
GetCharge
());
189
190
fh_tdiff
->Fill(time1 - time2);
191
/*
192
if (startSeen && barId == 125)
193
{
194
fh_los_corr->Fill((time1 + time2) / 2., startTime);
195
fh_tof->Fill((time1 + time2) / 2. - startTime);
196
fh_qdctof->Fill((time1 + time2) / 2. - startTime - 1563. + 30.,
197
TMath::Sqrt(pmt1->GetQdc()*pmt2->GetQdc()));
198
}
199
if (startSeen && barId == 225)
200
{
201
fh_qdctof->Fill((time1 + time2) / 2. - startTime - 1571. + 30.,
202
TMath::Sqrt(pmt1->GetQdc()*pmt2->GetQdc()));
203
}
204
*/
205
}
206
}
207
}
208
209
fnEvents
+= 1;
210
}
211
212
void
R3BNeulandCalTest::FinishTask
() {
WriteHistos
(); }
213
214
void
R3BNeulandCalTest::CreateHistos
()
215
{
216
fh_los_corr
=
new
TH2F(
"h_los_corr"
,
"LOS vs NeuLAND"
, 1000, 100, 400., 1000, -1360., -1310.);
217
fh_tof
=
new
TH1F(
"h_tof"
,
"ToF"
, 1000, 1500., 1700.);
218
fh_qdctof
=
new
TH2F(
"h_qdctof"
,
"QDC vs ToF"
, 1000, 0., 100., 200, 0., 2000.);
219
fh_qdctof_2
=
new
TH2F(
"h_qdctof_2"
,
"QDC vs ToF"
, 1000, 0., 100., 200, 0., 2000.);
220
fh_tdiff
=
new
TH1F(
"h_tdiff"
,
"Tdiff"
, 10000, -50, 50.);
221
}
222
223
void
R3BNeulandCalTest::WriteHistos
()
224
{
225
fh_los_corr
->Write();
226
fh_tof
->Write();
227
fh_qdctof
->Write();
228
fh_qdctof_2
->Write();
229
fh_tdiff
->Write();
230
}
231
232
ClassImp
(
R3BNeulandCalTest
)
R3BNeulandCalData.h
walk
Double_t walk(Double_t x)
Definition
R3BNeulandCalTest.cxx:25
R3BNeulandCalTest.h
ClassImp
ClassImp(R3B::Neuland::Cal2HitPar)
R3BNeulandPmt.h
R3BNeulandCalData
Definition
R3BNeulandCalData.h:22
R3BNeulandCalData::GetBarId
auto GetBarId() const -> int
Definition
R3BNeulandCalData.h:27
R3BNeulandCalData::GetTime
auto GetTime() const -> double
Definition
R3BNeulandCalData.h:29
R3BNeulandCalData::GetQdc
auto GetQdc() const -> double
Definition
R3BNeulandCalData.h:31
R3BNeulandCalTest
Definition
R3BNeulandCalTest.h:24
R3BNeulandCalTest::Init
virtual InitStatus Init()
Definition
R3BNeulandCalTest.cxx:58
R3BNeulandCalTest::CreateHistos
void CreateHistos()
Definition
R3BNeulandCalTest.cxx:214
R3BNeulandCalTest::fnEvents
Int_t fnEvents
Definition
R3BNeulandCalTest.h:37
R3BNeulandCalTest::fLosHit
TClonesArray * fLosHit
Definition
R3BNeulandCalTest.h:41
R3BNeulandCalTest::fNeulandPmt
TClonesArray * fNeulandPmt
Definition
R3BNeulandCalTest.h:40
R3BNeulandCalTest::fh_los_corr
TH2F * fh_los_corr
Definition
R3BNeulandCalTest.h:43
R3BNeulandCalTest::fh_tof
TH1F * fh_tof
Definition
R3BNeulandCalTest.h:44
R3BNeulandCalTest::WriteHistos
void WriteHistos()
Definition
R3BNeulandCalTest.cxx:223
R3BNeulandCalTest::fh_qdctof_2
TH2F * fh_qdctof_2
Definition
R3BNeulandCalTest.h:48
R3BNeulandCalTest::R3BNeulandCalTest
R3BNeulandCalTest()
Definition
R3BNeulandCalTest.cxx:39
R3BNeulandCalTest::FinishTask
virtual void FinishTask()
Definition
R3BNeulandCalTest.cxx:212
R3BNeulandCalTest::fh_tdiff
TH1F * fh_tdiff
Definition
R3BNeulandCalTest.h:46
R3BNeulandCalTest::Exec
virtual void Exec(Option_t *option)
Definition
R3BNeulandCalTest.cxx:73
R3BNeulandCalTest::~R3BNeulandCalTest
virtual ~R3BNeulandCalTest()
Definition
R3BNeulandCalTest.cxx:56
R3BNeulandCalTest::fLandPmt
TClonesArray * fLandPmt
Definition
R3BNeulandCalTest.h:39
R3BNeulandCalTest::fh_qdctof
TH2F * fh_qdctof
Definition
R3BNeulandCalTest.h:45
R3BNeulandPmt
Definition
R3BNeulandPmt.h:27
R3BNeulandPmt::GetTime
const Double_t & GetTime() const
Definition
R3BNeulandPmt.h:36
R3BNeulandPmt::GetBarId
const Int_t & GetBarId() const
Definition
R3BNeulandPmt.h:34
R3BNeulandPmt::GetPlaneId
const Int_t & GetPlaneId() const
Definition
R3BNeulandPmt.h:33
R3BNeulandPmt::GetCharge
const Double_t & GetCharge() const
Definition
R3BNeulandPmt.h:37
neuland
calibration
legacy
R3BNeulandCalTest.cxx
Generated by
1.18.0