18#include <FairRootManager.h>
22#include <TClonesArray.h>
34using std::setprecision;
36using std::stringstream;
40 : FairTask(
"MVDClusterfinder")
42 , fShowDebugHistos(kFALSE)
55 : FairTask(name, iVerbose)
57 , fShowDebugHistos(kFALSE)
62 , fBranchName(
"MvdDigi")
85 LOG(debug) <<
"CbmMvdClusterfinder::Exec : Starting Exec ";
93 Int_t nEvents =
fEvents->GetEntriesFast();
94 LOG(debug) << setw(20) << left << GetName() <<
": Processing time slice " <<
fNofTs <<
" with " << nEvents
95 << (nEvents == 1 ?
" event" :
" events");
96 for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
99 Int_t clustersBeforeEvent =
fCluster->GetEntriesFast();
100 LOG(debug) <<
"Number of clusters before executing the event: " << clustersBeforeEvent;
104 for (Int_t iCluster = clustersBeforeEvent; iCluster <
fCluster->GetEntriesFast(); ++iCluster) {
115 logOut << setw(20) << left << GetName() <<
" [";
116 logOut << fixed << setw(8) << setprecision(1) << right <<
fTimer.RealTime() * 1000. <<
" ms] ";
117 logOut <<
"TS " <<
fNofTs;
120 logOut <<
", clusters " <<
fCluster->GetEntriesFast();
121 LOG(info) << logOut.str();
132 if (fVerbose) LOG(debug) <<
"//----------------------------------------//";
133 if (fVerbose) LOG(debug) <<
"Send Input";
137 LOG(debug) <<
"CbmMvdClusterfinder::Exec - nDigis= " << nDigis;
144 for (Int_t iDigi = 0; iDigi < nDigis; iDigi++) {
152 LOG(debug) <<
"CbmMvdClusterfinder::Exec : Communicating with Plugin: " << nTargetPlugin;
155 if (fVerbose) LOG(debug) <<
"Execute ClusterPlugin Nr. " <<
fClusterPluginNr;
157 if (fVerbose) LOG(debug) <<
"End Chain";
158 if (fVerbose) LOG(debug) <<
"Start writing Cluster";
172 LOG(info) << GetName() <<
": Initialisation...";
175 FairRootManager* ioman = FairRootManager::Instance();
177 LOG(error) << GetName() <<
"::Init: No FairRootManager!";
185 LOG(error) <<
"No MvdDigi branch found. There was no MVD in the "
186 "simulation. Switch this task off";
192 LOG(info) << GetName() <<
": Using event-by-event mode";
193 fEvents =
dynamic_cast<TClonesArray*
>(ioman->GetObject(
"CbmEvent"));
195 LOG(warn) << GetName() <<
": Event mode selected but no event array found!";
200 LOG(info) << GetName() <<
": Using time-based mode";
204 fCluster =
new TClonesArray(
"CbmMvdCluster", 10000);
205 ioman->Register(
"MvdCluster",
"Mvd Clusters",
fCluster, IsOutputBranchPersistent(
"MvdCluster"));
210 if (fVerbose) LOG(info) <<
"succesfully loaded Geometry from file";
213 LOG(fatal) <<
"Geometry couldn't be loaded from file. No MVD digitizer available.";
220 for (
auto itr = sensorMap.begin(); itr != sensorMap.end(); itr++) {
223 itr->second->AddPlugin(clusterTask);
224 itr->second->SetClusterPlugin(plugincount);
235 LOG(info) << GetName() <<
" initialised with parameters: ";
269 std::stringstream ss;
270 ss <<
"============================================================" << endl;
271 ss <<
"============== Parameters Clusterfinder ====================" << endl;
272 ss <<
"============================================================" << endl;
273 ss <<
"=============== End Task ===================================" << endl;
@ kMvd
Micro-Vertex Detector.
ClassImp(CbmMvdClusterfinder)
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.
Class characterising one event by a collection of links (indices) to data objects,...
void PrintParameters() const
Int_t fNofTs
Number of time slices processed.
TStopwatch fTimer
ROOT timer.
CbmMvdDetector * fDetector
virtual InitStatus Init()
virtual InitStatus ReInit()
std::string ParametersToString() const
ECbmRecoMode fEventMode
Time-slice or event-by-event.
UInt_t fClusterPluginNr
Input array of events.
CbmDigiManager * fDigiMan
void ProcessData(CbmEvent *event)
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)
Int_t GetSensorArraySize()
void SetRefId(int32_t refId)