R3BROOT
R3B analysis software
Toggle main menu visibility
Loading...
Searching...
No Matches
R3BNeulandTacquilaMapped2QCalPar.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 "
R3BNeulandTacquilaMapped2QCalPar.h
"
15
#include "FairLogger.h"
16
#include "FairRuntimeDb.h"
17
#include "
R3BEventHeader.h
"
18
#include "
R3BNeulandQCalPar.h
"
19
#include "
R3BNeulandTacquilaMappedData.h
"
20
#include "R3BTCalEngine.h"
21
#include "TClonesArray.h"
22
#include "TH1F.h"
23
#include <FairRootManager.h>
24
25
#define nPMTs 2 * fPaddles* fPlanes
26
27
R3BNeulandTacquilaMapped2QCalPar::R3BNeulandTacquilaMapped2QCalPar
(
const
char
* name, Int_t iVerbose)
28
: FairTask(name, iVerbose)
29
,
fPar
(NULL)
30
,
fHits
(NULL)
31
{
32
}
33
34
R3BNeulandTacquilaMapped2QCalPar::R3BNeulandTacquilaMapped2QCalPar
()
35
: FairTask(
"R3BNeulandTacquilaMapped2QCalPar"
)
36
,
fPar
(NULL)
37
,
fHits
(NULL)
38
{
39
}
40
41
R3BNeulandTacquilaMapped2QCalPar::~R3BNeulandTacquilaMapped2QCalPar
()
42
{
43
if
(
fData
.size() > 0)
44
for
(Int_t plane =
fPlanes
- 1; plane >= 0; plane--)
45
for
(Int_t bar =
fPaddles
- 1; bar >= 0; bar--)
46
for
(Int_t side = 1; side <= 2; side++)
47
fData
.at(plane).at(bar).at(side)->Delete();
48
49
if
(
fPar
)
50
delete
fPar
;
51
}
52
53
InitStatus
R3BNeulandTacquilaMapped2QCalPar::Init
()
54
{
55
FairRootManager* fMan = FairRootManager::Instance();
56
if
(!fMan)
57
{
58
LOG(fatal) <<
" FairRootManager not found."
;
59
return
kFATAL;
60
}
61
fHits
=
dynamic_cast<
TClonesArray*
>
(fMan->GetObject(
"NeulandTacquilaMappedData"
));
62
if
(!
fHits
)
63
{
64
LOG(fatal) <<
" Branch: NeulandTacquilaMappedData not found in Tree."
;
65
return
kFATAL;
66
}
67
header
=
dynamic_cast<
R3BEventHeader
*
>
(fMan->GetObject(
"R3BEventHeader"
));
68
if
(!
header
)
69
{
70
LOG(fatal) <<
" Branch: R3BEventHeader not found in Tree."
;
71
return
kFATAL;
72
}
73
74
TH1F* histo;
75
76
for
(Int_t plane = 1; plane <=
fPlanes
; plane++)
77
{
78
std::vector<std::vector<TH1F*>> v_plane;
79
for
(Int_t bar = 1; bar <=
fPaddles
; bar++)
80
{
81
std::vector<TH1F*> v_bar;
82
for
(Int_t side = 1; side <= 2; side++)
83
{
84
std::string s =
85
"h_pedpar_"
+ std::to_string(plane) +
"_"
+ std::to_string(bar) +
"_"
+ std::to_string(side);
86
histo =
new
TH1F(s.c_str(),
"PedPar"
, 2001, -0.5, 2000.5);
87
v_bar.push_back(histo);
88
}
89
v_plane.push_back(v_bar);
90
}
91
fData
.push_back(v_plane);
92
}
93
fPar
=
dynamic_cast<
R3BNeulandQCalPar
*
>
(FairRuntimeDb::instance()->getContainer(
"NeulandQCalPar"
));
94
95
return
kSUCCESS;
96
}
97
98
void
R3BNeulandTacquilaMapped2QCalPar::Exec
(Option_t* option)
99
{
100
R3BNeulandTacquilaMappedData
* hit;
101
Int_t nHits =
fHits
->GetEntries();
102
103
if
(
header
->
GetTrigger
() != 2)
104
return
;
105
106
if
(nHits <
nPMTs
)
107
return
;
108
109
for
(Int_t i = 0; i < nHits; i++)
110
{
111
hit =
dynamic_cast<
R3BNeulandTacquilaMappedData
*
>
(
fHits
->At(i));
112
if
(!hit)
113
continue
;
114
115
fData
.at(hit->
GetPlane
() - 1).at(hit->
GetPaddle
() - 1).at(hit->
GetSide
() - 1)->Fill(hit->
GetQdcData
());
116
}
117
}
118
119
void
R3BNeulandTacquilaMapped2QCalPar::FinishTask
()
120
{
121
Int_t i = 0;
122
TH1F* pars =
new
TH1F(
"QCalPar"
,
"Pedestal Offset"
,
nPMTs
, 0.5,
nPMTs
+ 0.5);
123
TH1F* histo;
124
fPar
->
SetSize
(
nPMTs
);
125
for
(Int_t plane = 1; plane <=
fPlanes
; plane++)
126
for
(Int_t bar = 1; bar <=
fPaddles
; bar++)
127
for
(Int_t side = 1; side <= 2; side++)
128
{
129
histo =
fData
.at(plane - 1).at(bar - 1).at(side - 1);
130
Int_t maxBinPos = histo->GetBinCenter(histo->GetMaximumBin());
131
pars->SetBinContent(i++ + 1, maxBinPos);
132
fPar
->
SetParAt
(plane, bar, side, maxBinPos);
133
}
134
pars->Write();
135
fPar
->setChanged();
136
}
137
138
ClassImp
(
R3BNeulandTacquilaMapped2QCalPar
)
R3BEventHeader.h
ClassImp
ClassImp(R3B::Neuland::Cal2HitPar)
R3BNeulandQCalPar.h
nPMTs
#define nPMTs
Definition
R3BNeulandTacquilaMapped2QCalPar.cxx:25
R3BNeulandTacquilaMapped2QCalPar.h
R3BNeulandTacquilaMappedData.h
R3BEventHeader
Definition
R3BEventHeader.h:23
R3BEventHeader::GetTrigger
int GetTrigger() const
Definition
R3BEventHeader.h:42
R3BNeulandQCalPar
Definition
R3BNeulandQCalPar.h:26
R3BNeulandQCalPar::SetParAt
void SetParAt(Int_t plane, Int_t bar, Int_t side, Int_t offset)
Method to set the pedestal offset of a PMT.
Definition
R3BNeulandQCalPar.h:77
R3BNeulandQCalPar::SetSize
void SetSize(Int_t size)
Method to set the size of the array of parameters.
Definition
R3BNeulandQCalPar.cxx:49
R3BNeulandTacquilaMapped2QCalPar
Definition
R3BNeulandTacquilaMapped2QCalPar.h:25
R3BNeulandTacquilaMapped2QCalPar::fHits
TClonesArray * fHits
Definition
R3BNeulandTacquilaMapped2QCalPar.h:44
R3BNeulandTacquilaMapped2QCalPar::fPaddles
Int_t fPaddles
Definition
R3BNeulandTacquilaMapped2QCalPar.h:42
R3BNeulandTacquilaMapped2QCalPar::fData
std::vector< std::vector< std::vector< TH1F * > > > fData
Definition
R3BNeulandTacquilaMapped2QCalPar.h:51
R3BNeulandTacquilaMapped2QCalPar::Init
virtual InitStatus Init()
Definition
R3BNeulandTacquilaMapped2QCalPar.cxx:53
R3BNeulandTacquilaMapped2QCalPar::Exec
virtual void Exec(Option_t *option)
Definition
R3BNeulandTacquilaMapped2QCalPar.cxx:98
R3BNeulandTacquilaMapped2QCalPar::fPlanes
Int_t fPlanes
Definition
R3BNeulandTacquilaMapped2QCalPar.h:41
R3BNeulandTacquilaMapped2QCalPar::R3BNeulandTacquilaMapped2QCalPar
R3BNeulandTacquilaMapped2QCalPar()
Definition
R3BNeulandTacquilaMapped2QCalPar.cxx:34
R3BNeulandTacquilaMapped2QCalPar::~R3BNeulandTacquilaMapped2QCalPar
virtual ~R3BNeulandTacquilaMapped2QCalPar()
Definition
R3BNeulandTacquilaMapped2QCalPar.cxx:41
R3BNeulandTacquilaMapped2QCalPar::fPar
R3BNeulandQCalPar * fPar
Definition
R3BNeulandTacquilaMapped2QCalPar.h:45
R3BNeulandTacquilaMapped2QCalPar::FinishTask
virtual void FinishTask()
Definition
R3BNeulandTacquilaMapped2QCalPar.cxx:119
R3BNeulandTacquilaMapped2QCalPar::header
R3BEventHeader * header
Definition
R3BNeulandTacquilaMapped2QCalPar.h:49
R3BNeulandTacquilaMappedData
Definition
R3BNeulandTacquilaMappedData.h:21
R3BNeulandTacquilaMappedData::GetQdcData
UShort_t GetQdcData() const
Definition
R3BNeulandTacquilaMappedData.h:35
R3BNeulandTacquilaMappedData::GetSide
Int_t GetSide() const
Definition
R3BNeulandTacquilaMappedData.h:38
R3BNeulandTacquilaMappedData::GetPlane
Int_t GetPlane() const
Definition
R3BNeulandTacquilaMappedData.h:36
R3BNeulandTacquilaMappedData::GetPaddle
Int_t GetPaddle() const
Definition
R3BNeulandTacquilaMappedData.h:37
neuland
calibration
legacy
R3BNeulandTacquilaMapped2QCalPar.cxx
Generated by
1.18.0