CbmRoot
Loading...
Searching...
No Matches
CbmMvdReadout.cxx
Go to the documentation of this file.
1/* Copyright (C) 2017-2020 Institut fuer Kernphysik, Goethe-Universitaet Frankfurt, Frankfurt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Philipp Sitzmann [committer] */
4
5// -------------------------------------------------------------------------
6// ----- CbmMvdClusterfinder source file -----
7// -------------------------------------------------------------------------
8#include "CbmMvdReadout.h"
9
10#include "CbmDefs.h" // for ECbmModuleId
11#include "CbmDigiManager.h" // for CbmDigiManager
12#include "CbmMvdDetector.h" // for CbmMvdDetector
13#include "CbmMvdDigi.h" // for CbmMvdDigi
14#include "CbmMvdSensor.h" // for CbmMvdSensor
15#include "CbmMvdSensorReadoutTask.h" // for CbmMvdSensorReadoudoutTask
16
17#include <FairRootManager.h> // for FairRootManager
18#include <Logger.h> // for LOG
19
20// ----- Default constructor ------------------------------------------
22// -------------------------------------------------------------------------
23
24// ----- Standard constructor ------------------------------------------
26 : FairTask(name)
27 , fMode(-1)
28 , fPluginNr(0)
29 , fShowDebugHistos(kFALSE)
30 , fDetector(nullptr)
31 , fDigiMan(nullptr)
32{
33}
34// -------------------------------------------------------------------------
35
36// ----- Destructor ----------------------------------------------------
38// -----------------------------------------------------------------------------
39
40// ----- Exec --------------------------------------------------------------
41void CbmMvdReadout::Exec(Option_t* /*opt*/)
42{
43
45 if (fVerbose) LOG(info) << "//----------------------------------------//";
46 if (fVerbose) LOG(info) << "Send Input";
47 Int_t nTargetPlugin = fDetector->DetectPlugin(200);
48 CbmMvdDigi* digi = 0;
49
51
52 for (Int_t i = 0; i < nDigis; i++) {
53 digi = new CbmMvdDigi(*(fDigiMan->Get<CbmMvdDigi>(i)));
54 digi->SetRefId(i);
55
56 fDetector->SendInputToSensorPlugin(digi->GetDetectorId(), nTargetPlugin, static_cast<TObject*>(digi));
57 }
58 if (fVerbose) LOG(info) << "Execute ReadoutPlugin Nr. " << fPluginNr;
60 if (fVerbose) LOG(info) << "End Chain";
61 }
62}
63// -----------------------------------------------------------------------------
64
65// ----- Init --------------------------------------------------------------
67{
68 LOG(info) << GetName() << ": Initialisation...";
69
70 // ********** RootManager
71 FairRootManager* ioman = FairRootManager::Instance();
72 if (!ioman) {
73 LOG(error) << GetName() << "::Init: No FairRootManager!";
74 return kFATAL;
75 }
76
77 // ********** Get input arrays
79 fDigiMan->Init();
80
82 LOG(error) << "No MvdDigi branch found. There was no MVD in the "
83 "simulation. Switch this task off";
84 return kERROR;
85 }
86
88
89 if (fDetector->GetSensorArraySize() > 1) {
90 if (fVerbose) LOG(info) << "succesfully loaded Geometry from file";
91 }
92 else {
93 LOG(fatal) << "Geometry couldn't be loaded from file. No MVD digitizer available.";
94 }
95
96 // Add the readout plugin to all sensors
97 std::map<int, CbmMvdSensor*>& sensorMap = fDetector->GetSensorMap();
98 UInt_t plugincount = fDetector->GetPluginCount();
99
100 for (auto itr = sensorMap.begin(); itr != sensorMap.end(); itr++) {
102
103 itr->second->AddPlugin(readerTask);
104 // Don't know why type of plugin it is
105 // Decide to use Cluster Plugin since it works on CbmMvdDigis as the
106 // normal cluster plugin does
107 itr->second->SetClusterPlugin(plugincount);
108 }
110 fDetector->SetPluginCount(plugincount + 1);
111
113 fDetector->Init();
114
115
116 // Screen output
117 LOG(info) << GetName() << " initialised with parameters: ";
118 //PrintParameters();
119
120 return kSUCCESS;
121}
122
123// ----- Virtual public method Reinit ----------------------------------
124InitStatus CbmMvdReadout::ReInit() { return kSUCCESS; }
125// -------------------------------------------------------------------------
126
127
128// ----- Virtual method Finish -----------------------------------------
134// -------------------------------------------------------------------------
135
136
137// ----- Private method Reset ------------------------------------------
139{
140 // fCluster->Delete();
141}
142// -------------------------------------------------------------------------
143
144// ----- Private method PrintParameters --------------------------------
146{
147
148 LOG(info) << "============================================================";
149 LOG(info) << "============== Parameters Readout ===== ====================";
150 LOG(info) << "============================================================";
151 LOG(info) << "=============== End Task ===================================";
152}
153// -------------------------------------------------------------------------
154
155
@ kMvd
Micro-Vertex Detector.
ClassImp(CbmMvdReadout)
CbmDigiManager * fDigiMan
static Int_t GetNofDigis(ECbmModuleId systemId)
static Bool_t IsPresent(ECbmModuleId systemId)
Presence of a digi branch.
InitStatus Init()
Initialisation.
const Digi * Get(Int_t index) const
Get a digi object.
static CbmDigiManager * Instance()
Static instance.
std::map< int, CbmMvdSensor * > & GetSensorMap()
Int_t GetPluginArraySize()
static CbmMvdDetector * Instance()
Int_t DetectPlugin(Int_t pluginID)
void SetSensorArrayFilled(Bool_t value=kTRUE)
UInt_t GetPluginCount()
void SendInputToSensorPlugin(Int_t detectorid, Int_t nPlugin, TObject *input)
void SetPluginCount(UInt_t count)
Int_t GetSensorArraySize()
void Exec(UInt_t nLevel)
int32_t GetDetectorId()
Definition CbmMvdDigi.h:55
void SetRefId(int32_t refId)
Definition CbmMvdDigi.h:82
CbmDigiManager * fDigiMan
virtual InitStatus ReInit()
virtual InitStatus Init()
virtual void Finish()
CbmMvdDetector * fDetector
void Exec(Option_t *opt)
void PrintParameters() const