CbmRoot
CbmMvdSensorReadoutTask.cxx
Go to the documentation of this file.
1
// -------------------------------------------------------------------------
2
// ----- CbmMvdSensorReadoutTask source file -----
3
// ----- Created 15.05.2017 by P. Sitzmann -----
4
// -------------------------------------------------------------------------
5
6
#include "
CbmMvdSensorReadoutTask.h
"
7
#include "TClonesArray.h"
8
#include "TH1I.h"
9
#include "TObjArray.h"
10
11
#include <iostream>
12
13
using
std::cout;
14
using
std::endl;
15
16
// ----- Default constructor -------------------------------------------
17
CbmMvdSensorReadoutTask::CbmMvdSensorReadoutTask
()
18
:
CbmMvdSensorTask
()
19
, fInputBuffer(nullptr)
20
, fOutputBuffer(nullptr)
21
, fSensor(nullptr)
22
, fSensorBanks() {
23
// fSensorBanks[maxBanks] = {0};
24
}
25
// -------------------------------------------------------------------------
26
// ----- constructor -------------------------------------------
27
CbmMvdSensorReadoutTask::CbmMvdSensorReadoutTask
(
const
char
* name)
28
:
CbmMvdSensorTask
(name)
29
, fInputBuffer(nullptr)
30
, fOutputBuffer(nullptr)
31
, fSensor(nullptr)
32
, fSensorBanks() {
33
// fSensorBanks[maxBanks] = {0};
34
}
35
// -------------------------------------------------------------------------
36
37
// ----- Destructor ----------------------------------------------------
38
CbmMvdSensorReadoutTask::~CbmMvdSensorReadoutTask
() {
39
fInputBuffer
->Delete();
40
fOutputBuffer
->Delete();
41
}
42
// -------------------------------------------------------------------------
43
44
// ----- Virtual private method Init ----------------------------------
45
void
CbmMvdSensorReadoutTask::InitTask
(
CbmMvdSensor
* mysensor) {
46
47
fSensor
= mysensor;
48
fInputBuffer
=
new
TClonesArray(
"CbmMvdDigi"
, 10000);
49
fOutputBuffer
=
new
TClonesArray(
"TH1"
, 1);
50
51
52
initialized
= kTRUE;
53
}
54
// -------------------------------------------------------------------------
55
56
// -----------------------------------------------------------------------------
57
void
CbmMvdSensorReadoutTask::SetInputArray
(TClonesArray* inputStream) {
58
59
Int_t
i
= 0;
60
Int_t nInputs = inputStream->GetEntriesFast();
61
while
(nInputs >
i
) {
62
new
((*fInputBuffer)[
fInputBuffer
->GetEntriesFast()])
63
CbmMvdDigi
(*((
CbmMvdDigi
*) inputStream->At(
i
)));
64
++
i
;
65
}
66
}
67
// -----------------------------------------------------------------------------
68
69
// -----------------------------------------------------------------------------
70
void
CbmMvdSensorReadoutTask::SetInputDigi
(
CbmMvdDigi
* digi) {
71
72
new
((*fInputBuffer)[
fInputBuffer
->GetEntriesFast()])
73
CbmMvdDigi
(*((
CbmMvdDigi
*) digi));
74
}
75
// -----------------------------------------------------------------------------
76
77
// ----- Virtual public method ExecChain --------------
78
void
CbmMvdSensorReadoutTask::ExecChain
() {
Exec
(); }
79
// -------------------------------------------------------------------------
80
81
// ----- Virtual public method Exec --------------
82
void
CbmMvdSensorReadoutTask::Exec
() {
83
84
for
(Int_t
i
= 0;
i
<
fInputBuffer
->GetEntriesFast();
i
++) {
85
CbmMvdDigi
* digi = (
CbmMvdDigi
*)
fInputBuffer
->At(
i
);
86
Int_t iBank =
GetBankNumber
(digi->
GetPixelX
());
87
fSensorBanks
[iBank]++;
88
}
89
}
90
// -------------------------------------------------------------------------
91
92
// -------------------------------------------------------------------------
93
Int_t
CbmMvdSensorReadoutTask::GetBankNumber
(
const
Int_t& xPixelNr)
const
{
94
Int_t iBank = 0;
95
for
(; iBank <
maxBanks
; ++iBank) {
96
if
(xPixelNr - (iBank *
fPixelsPerBank
) <=
fPixelsPerBank
)
return
iBank;
97
}
98
99
return
iBank;
100
}
101
// -------------------------------------------------------------------------
102
103
104
// ----- Private method Reset ------------------------------------------
105
void
CbmMvdSensorReadoutTask::Reset
() {}
106
// -------------------------------------------------------------------------
107
108
// -------------------------------------------------------------------------
109
void
CbmMvdSensorReadoutTask::Finish
() {
110
for
(Int_t iBank = 0; iBank <
maxBanks
; ++iBank) {
111
cout <<
"Number of fired pixels in bank : "
<< iBank <<
" is "
112
<<
fSensorBanks
[iBank] << endl;
113
TH1I* hist = (TH1I*)
fOutputBuffer
->ConstructedAt(0);
114
hist->Fill(iBank,
fSensorBanks
[iBank]);
115
}
116
}
117
// -------------------------------------------------------------------------
118
119
ClassImp
(
CbmMvdSensorReadoutTask
)
CbmMvdSensorReadoutTask.h
CbmMvdSensorReadoutTask::GetBankNumber
Int_t GetBankNumber(const Int_t &yPixelNr) const
Definition:
CbmMvdSensorReadoutTask.cxx:93
CbmMvdSensorReadoutTask::Exec
void Exec()
Definition:
CbmMvdSensorReadoutTask.cxx:82
i
int i
Definition:
L1/vectors/P4_F32vec4.h:25
CbmMvdSensorReadoutTask::fOutputBuffer
TClonesArray * fOutputBuffer
Definition:
CbmMvdSensorReadoutTask.h:53
CbmMvdSensorReadoutTask::Finish
void Finish()
Definition:
CbmMvdSensorReadoutTask.cxx:109
CbmMvdSensorReadoutTask
Definition:
CbmMvdSensorReadoutTask.h:25
CbmMvdSensorReadoutTask::ExecChain
void ExecChain()
Definition:
CbmMvdSensorReadoutTask.cxx:78
CbmMvdSensorTask
Definition:
CbmMvdSensorTask.h:26
CbmMvdSensorPlugin::initialized
Bool_t initialized
Definition:
CbmMvdSensorPlugin.h:71
CbmMvdSensor
Definition:
CbmMvdSensor.h:40
CbmMvdSensorReadoutTask::fInputBuffer
TClonesArray * fInputBuffer
Definition:
CbmMvdSensorReadoutTask.h:52
CbmMvdSensorReadoutTask::Reset
void Reset()
Definition:
CbmMvdSensorReadoutTask.cxx:105
CbmMvdSensorReadoutTask::SetInputDigi
void SetInputDigi(CbmMvdDigi *digi)
Definition:
CbmMvdSensorReadoutTask.cxx:70
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition:
CbmConverterManager.cxx:12
CbmMvdSensorReadoutTask::SetInputArray
void SetInputArray(TClonesArray *inputStream)
Definition:
CbmMvdSensorReadoutTask.cxx:57
CbmMvdSensorReadoutTask::fSensor
CbmMvdSensor * fSensor
Definition:
CbmMvdSensorReadoutTask.h:54
CbmMvdDigi
Definition:
CbmMvdDigi.h:21
CbmMvdDigi::GetPixelX
Int_t GetPixelX()
Definition:
CbmMvdDigi.cxx:141
CbmMvdSensorReadoutTask::fSensorBanks
Int_t fSensorBanks[maxBanks]
Definition:
CbmMvdSensorReadoutTask.h:56
CbmMvdSensorReadoutTask::CbmMvdSensorReadoutTask
CbmMvdSensorReadoutTask()
Definition:
CbmMvdSensorReadoutTask.cxx:17
CbmMvdSensorReadoutTask::~CbmMvdSensorReadoutTask
virtual ~CbmMvdSensorReadoutTask()
Definition:
CbmMvdSensorReadoutTask.cxx:38
CbmMvdSensorReadoutTask::maxBanks
static const Int_t maxBanks
Definition:
CbmMvdSensorReadoutTask.h:50
CbmMvdSensorReadoutTask::InitTask
void InitTask(CbmMvdSensor *mySensor)
Definition:
CbmMvdSensorReadoutTask.cxx:45
CbmMvdSensorReadoutTask::fPixelsPerBank
const Int_t fPixelsPerBank
Definition:
CbmMvdSensorReadoutTask.h:57
mvd
plugins
tasks
CbmMvdSensorReadoutTask.cxx
Generated on Wed Oct 28 2020 15:11:43 for CbmRoot by
1.8.18