21#include <FairRootManager.h>
25#include <TClonesArray.h>
37using std::setprecision;
39using std::stringstream;
43 : FairTask(
"MVDHitfinder")
46 , fInputCluster(nullptr)
48 , fHitfinderPluginNr(0)
49 , fUseClusterfinder(kFALSE)
50 , fShowDebugHistos(kFALSE)
59 : FairTask(name, iVerbose)
62 , fInputCluster(nullptr)
64 , fHitfinderPluginNr(0)
65 , fUseClusterfinder(kFALSE)
66 , fShowDebugHistos(kFALSE)
75 : FairTask(name, iVerbose)
78 , fInputCluster(nullptr)
80 , fHitfinderPluginNr(0)
81 , fUseClusterfinder(kFALSE)
82 , fShowDebugHistos(kFALSE)
111 if (fVerbose) LOG(debug) <<
"//----------------------------------------//";
113 LOG(fatal) << GetName() <<
"- Mode without cluster finder is currently not supported ";
118 LOG(debug) <<
"CbmMvdClusterfinder::Exec : Starting Exec ";
125 Int_t nEvents =
fEvents->GetEntriesFast();
126 LOG(debug) << setw(20) << left << GetName() <<
": Processing time slice " <<
fNofTs <<
" with " << nEvents
127 << (nEvents == 1 ?
" event" :
" events");
128 for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
131 Int_t hitsBeforeEvent =
fHits->GetEntriesFast();
132 LOG(debug) <<
"Number of hits before executing the event: " << hitsBeforeEvent;
136 for (Int_t iHit = hitsBeforeEvent; iHit <
fHits->GetEntriesFast(); ++iHit) {
139 LOG(debug) <<
"The current event contains " <<
event->GetNofData(
ECbmDataType::kMvdHit) <<
" MVD hits";
146 logOut << setw(20) << left << GetName() <<
" [";
147 logOut << fixed << setw(8) << setprecision(1) << right <<
fTimer.RealTime() * 1000. <<
" ms] ";
148 logOut <<
"TS " <<
fNofTs;
151 logOut <<
", hits " <<
fHits->GetEntriesFast();
152 LOG(info) << logOut.str();
164 if (fVerbose) LOG(debug) <<
"//----------------------------------------//";
165 if (fVerbose) LOG(debug) <<
"Send Input";
169 LOG(debug) <<
"CbmMvdHitfinder::Exec - nDigis= " << nCluster;
176 for (Int_t iCluster = 0; iCluster < nCluster; ++iCluster) {
183 static_cast<TObject*
>(cluster));
189 if (fVerbose) LOG(debug) <<
"End Chain";
190 if (fVerbose) LOG(debug) <<
"Start writing Hits";
205 LOG(info) << GetName() <<
": Initialisation...";
208 FairRootManager* ioman = FairRootManager::Instance();
210 LOG(error) << GetName() <<
"::Init: No FairRootManager!";
216 LOG(fatal) << GetName() <<
" - Mode without cluster finder is currently not supported ";
220 LOG(error) <<
"No MvdDigi branch found. There was no MVD in the "
221 "simulation. Switch this task off";
226 fInputCluster = (TClonesArray*) ioman->GetObject(
"MvdCluster");
228 LOG(error) <<
"No MvdCluster branch found. There was no MVD in the "
229 "simulation. Switch this task off";
236 LOG(info) << GetName() <<
": Using event-by-event mode";
237 fEvents =
dynamic_cast<TClonesArray*
>(ioman->GetObject(
"CbmEvent"));
239 LOG(warn) << GetName() <<
": Event mode selected but no event array found!";
244 LOG(info) << GetName() <<
": Using time-based mode";
248 fHits =
new TClonesArray(
"CbmMvdHit", 1000);
249 ioman->Register(
"MvdHit",
"Mvd Hits",
fHits, IsOutputBranchPersistent(
"MvdHit"));
271 for (
auto itr = sensorMap.begin(); itr != sensorMap.end(); itr++) {
274 itr->second->AddPlugin(hitfinderTask);
275 itr->second->SetHitPlugin(plugincount);
289 LOG(info) << GetName() <<
" initialised with parameters: ";
319 std::stringstream ss;
320 ss.setf(std::ios_base::fixed, std::ios_base::floatfield);
321 ss <<
"============================================================" << endl;
322 ss <<
"============== Parameters MvdHitfinder =====================" << endl;
323 ss <<
"============================================================" << endl;
324 ss <<
"=============== End Task ===================================" << endl;
@ kMvd
Micro-Vertex Detector.
ClassImp(CbmMvdHitfinder)
CbmDigiManager * fDigiMan
static Bool_t IsPresent(ECbmModuleId systemId)
Presence of a digi branch.
InitStatus Init()
Initialisation.
static CbmDigiManager * Instance()
Static instance.
Class characterising one event by a collection of links (indices) to data objects,...
void SetRefId(int32_t RefId)
int32_t DetectorId(int32_t iStation) const
std::map< int, CbmMvdSensor * > & GetSensorMap()
Int_t GetPluginArraySize()
static CbmMvdDetector * Instance()
Int_t DetectPlugin(Int_t pluginID)
void SetSensorArrayFilled(Bool_t value=kTRUE)
void SendInputToSensorPlugin(Int_t detectorid, Int_t nPlugin, TObject *input)
void GetOutputArray(Int_t nPlugin, TClonesArray *outputArray)
void SetPluginCount(UInt_t count)
virtual InitStatus ReInit()
virtual ~CbmMvdHitfinder()
void PrintParameters() const
CbmDigiManager * fDigiMan
std::string ParametersToString() const
CbmMvdDetector * fDetector
TClonesArray * fInputCluster
TStopwatch fTimer
ROOT timer.
Int_t fNofTs
Number of time slices processed.
UInt_t fHitfinderPluginNr
Input array of events.
virtual InitStatus Init()
void ProcessData(CbmEvent *)
ECbmRecoMode fEventMode
Time-slice or event-by-event.