R3BROOT
R3B analysis software
Toggle main menu visibility
Loading...
Searching...
No Matches
R3BNeulandProvideTStart.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 "
R3BNeulandProvideTStart.h
"
15
#include "FairRootManager.h"
16
#include "
R3BEventHeader.h
"
17
18
R3BNeulandProvideTStart::R3BNeulandProvideTStart
()
19
: FairTask(
"R3BNeulandProvideTStart"
, 0)
20
,
fNeulandCalData
(
"NeulandCalData"
)
21
,
fEventHeader
(nullptr)
22
{
23
}
24
25
InitStatus
R3BNeulandProvideTStart::Init
()
26
{
27
fNeulandCalData
.
Init
();
28
29
auto
ioman = FairRootManager::Instance();
30
if
(ioman ==
nullptr
)
31
{
32
throw
std::runtime_error(
"R3BNeulandProvideTStart: No FairRootManager"
);
33
}
34
35
fEventHeader
=
dynamic_cast<
R3BEventHeader
*
>
(ioman->GetObject(
"EventHeader."
));
36
if
(
fEventHeader
==
nullptr
)
37
{
38
throw
std::runtime_error(
"R3BNeulandProvideTStart: No R3BEventHeader"
);
39
}
40
41
return
kSUCCESS;
42
}
43
44
void
R3BNeulandProvideTStart::Exec
(Option_t*) {
fEventHeader
->
SetTStart
(
GetTStart
()); }
45
46
Double_t
R3BNeulandProvideTStart::GetTStart
()
const
47
{
48
const
auto
calData =
fNeulandCalData
.
Retrieve
();
49
50
double
tref[2] = { NAN, NAN };
51
double
eref[2] = { NAN, NAN };
52
int
fref = 0;
53
54
for
(
const
auto
& data : calData)
55
{
56
const
auto
side = data->GetSide() - 1;
// [1,2] -> [0,1]
57
const
auto
bar = data->GetBarId();
58
59
// proton beam 2020, neuland bar 701 used as a start detector
60
if
(bar == 701)
61
{
62
tref[side] = data->GetTime();
63
eref[side] = data->GetQdc();
64
fref++;
65
}
66
}
67
68
double
pstart = NAN;
69
if
(fref == 2)
70
{
71
if
(tref[0] - tref[1] < -0.5 * 5. * 2048)
72
tref[1] = tref[1] - 5. * 2048;
73
if
(tref[0] - tref[1] > 0.5 * 5. * 2048)
74
tref[0] = tref[0] - 5. * 2048;
75
76
pstart = 0.5 * (tref[0] + tref[1]);
77
}
78
79
return
pstart;
80
}
81
82
bool
R3BNeulandProvideTStart::IsBeam
()
const
{
return
!std::isnan(
GetTStart
()); }
83
84
ClassImp
(
R3BNeulandProvideTStart
)
R3BEventHeader.h
ClassImp
ClassImp(R3B::Neuland::Cal2HitPar)
R3BNeulandProvideTStart.h
R3BEventHeader
Definition
R3BEventHeader.h:23
R3BEventHeader::SetTStart
void SetTStart(const double tStart)
Definition
R3BEventHeader.h:34
R3BNeulandProvideTStart
Definition
R3BNeulandProvideTStart.h:24
R3BNeulandProvideTStart::Init
InitStatus Init() override
Definition
R3BNeulandProvideTStart.cxx:25
R3BNeulandProvideTStart::Exec
void Exec(Option_t *) override
Definition
R3BNeulandProvideTStart.cxx:44
R3BNeulandProvideTStart::fNeulandCalData
TCAOptionalInputConnector< R3BNeulandCalData > fNeulandCalData
Definition
R3BNeulandProvideTStart.h:32
R3BNeulandProvideTStart::fEventHeader
R3BEventHeader * fEventHeader
Definition
R3BNeulandProvideTStart.h:33
R3BNeulandProvideTStart::GetTStart
Double_t GetTStart() const
Definition
R3BNeulandProvideTStart.cxx:46
R3BNeulandProvideTStart::IsBeam
bool IsBeam() const
Definition
R3BNeulandProvideTStart.cxx:82
R3BNeulandProvideTStart::R3BNeulandProvideTStart
R3BNeulandProvideTStart()
Definition
R3BNeulandProvideTStart.cxx:18
TCAOptionalInputConnector::Retrieve
std::vector< T * > Retrieve() const
Definition
TCAConnector.h:131
TCAOptionalInputConnector::Init
void Init()
Definition
TCAConnector.h:115
neuland
calibration
legacy
R3BNeulandProvideTStart.cxx
Generated by
1.18.0