CbmRoot
Loading...
Searching...
No Matches
CbmMvdSensorReadoutTask.cxx
Go to the documentation of this file.
1/* Copyright (C) 2017-2019 Institut fuer Kernphysik, Goethe-Universitaet Frankfurt, Frankfurt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Philipp Sitzmann [committer] */
4
5// -------------------------------------------------------------------------
6// ----- CbmMvdSensorReadoutTask source file -----
7// ----- Created 15.05.2017 by P. Sitzmann -----
8// -------------------------------------------------------------------------
10
11#include "CbmMvdDigi.h" // for CbmMvdDigi
12
13#include <Logger.h>
14
15#include <TClonesArray.h> // for TClonesArray
16#include <TH1.h> // for TH1I
17
18// ----- Default constructor -------------------------------------------
21 , fInputBuffer(nullptr)
22 , fOutputBuffer(nullptr)
23 , fSensor(nullptr)
24 , fSensorBanks()
25{
26 // fSensorBanks[maxBanks] = {0};
27 fPluginIDNumber = 600;
28}
29// -------------------------------------------------------------------------
30// ----- constructor -------------------------------------------
32 : CbmMvdSensorTask(name)
33 , fInputBuffer(nullptr)
34 , fOutputBuffer(nullptr)
35 , fSensor(nullptr)
36 , fSensorBanks()
37{
38 // fSensorBanks[maxBanks] = {0};
39 fPluginIDNumber = 600;
40}
41// -------------------------------------------------------------------------
42
43// ----- Destructor ----------------------------------------------------
49// -------------------------------------------------------------------------
50
51// ----- Virtual private method Init ----------------------------------
53{
54
55 fSensor = mysensor;
56 fInputBuffer = new TClonesArray("CbmMvdDigi", 10000);
57 fOutputBuffer = new TClonesArray("TH1", 1);
58
59
60 initialized = kTRUE;
61}
62// -------------------------------------------------------------------------
63
64// -----------------------------------------------------------------------------
65void CbmMvdSensorReadoutTask::SetInputArray(TClonesArray* inputStream)
66{
67
68 Int_t i = 0;
69 Int_t nInputs = inputStream->GetEntriesFast();
70 while (nInputs > i) {
71 new ((*fInputBuffer)[fInputBuffer->GetEntriesFast()]) CbmMvdDigi(*((CbmMvdDigi*) inputStream->At(i)));
72 ++i;
73 }
74}
75// -----------------------------------------------------------------------------
76
77// -----------------------------------------------------------------------------
79{
80
81 new ((*fInputBuffer)[fInputBuffer->GetEntriesFast()]) CbmMvdDigi(*((CbmMvdDigi*) digi));
82}
83// -----------------------------------------------------------------------------
84
85// ----- Virtual public method ExecChain --------------
87// -------------------------------------------------------------------------
88
89// ----- Virtual public method Exec --------------
91{
92
93 for (Int_t i = 0; i < fInputBuffer->GetEntriesFast(); i++) {
94 CbmMvdDigi* digi = (CbmMvdDigi*) fInputBuffer->At(i);
95 Int_t iBank = GetBankNumber(digi->GetPixelX());
96 fSensorBanks[iBank]++;
97 }
98}
99// -------------------------------------------------------------------------
100
101// -------------------------------------------------------------------------
102Int_t CbmMvdSensorReadoutTask::GetBankNumber(const Int_t& xPixelNr) const
103{
104 Int_t iBank = 0;
105 for (; iBank < maxBanks; ++iBank) {
106 if (xPixelNr - (iBank * fPixelsPerBank) <= fPixelsPerBank) return iBank;
107 }
108
109 return iBank;
110}
111// -------------------------------------------------------------------------
112
113
114// ----- Private method Reset ------------------------------------------
116// -------------------------------------------------------------------------
117
118// -------------------------------------------------------------------------
120{
121 for (Int_t iBank = 0; iBank < maxBanks; ++iBank) {
122 LOG(info) << "Number of fired pixels in bank : " << iBank << " is " << fSensorBanks[iBank];
123 TH1I* hist = (TH1I*) fOutputBuffer->ConstructedAt(0);
124 hist->Fill(iBank, fSensorBanks[iBank]);
125 }
126}
127// -------------------------------------------------------------------------
128
ClassImp(CbmConverterManager)
int32_t GetPixelX()
Int_t GetBankNumber(const Int_t &yPixelNr) const
void SetInputArray(TClonesArray *inputStream)
void InitTask(CbmMvdSensor *mySensor)
void SetInputDigi(CbmMvdDigi *digi)