CbmRoot
Loading...
Searching...
No Matches
CbmTaskInspectDigiEvents.cxx
Go to the documentation of this file.
1/* Copyright (C) 2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Volker Friese [committer] */
4
6
7#include <FairRootManager.h>
8#include <Logger.h>
9
10
11// ----- Constructor -----------------------------------------------------
12CbmTaskInspectDigiEvents::CbmTaskInspectDigiEvents() : FairTask("InspectDigiEvents") {}
13// ---------------------------------------------------------------------------
14
15
16// ----- Destructor ------------------------------------------------------
18// ---------------------------------------------------------------------------
19
20
21// ----- Execution -------------------------------------------------------
23{
24
25 // --- Inspect event vector
26 LOG(info) << GetName() << ": timeslice " << fNumTs << " with " << fEvents->size() << " events"
27 << (fEvents->size() > 10 ? " (showing the first 10 only)" : "");
28 size_t numEventsInTs = 0;
29 for (auto& event : *fEvents) {
30 size_t numBmon = event.fData.fBmon.Size();
31 size_t numSts = event.fData.fSts.Size();
32 size_t numMuch = event.fData.fMuch.Size();
33 size_t numRich = event.fData.fRich.Size();
34 size_t numTrd1d = event.fData.fTrd.Size();
35 size_t numTrd2d = event.fData.fTrd2d.Size();
36 size_t numTof = event.fData.fTof.Size();
37 size_t numFsd = event.fData.fFsd.Size();
38 LOG(info) << " Event " << event.fNumber << ", time " << event.fTime << ", digis: bmon " << numBmon << " sts "
39 << numSts << " much " << numMuch << " rich " << numRich << " trd1d " << numTrd1d << " trd2d "
40 << numTrd2d << " tof " << numTof << " fsd " << numFsd;
41 numEventsInTs++;
42 if (numEventsInTs > 9) break;
43 }
44
45 // --- Run statistics
46 fNumTs++;
47 fNumEvents += fEvents->size();
48}
49// ----------------------------------------------------------------------------
50
51
52// ----- End-of-run action ------------------------------------------------
54{
55 LOG(info) << "=====================================";
56 LOG(info) << GetName() << ": Run summary";
57 LOG(info) << "Timeslices : " << fNumTs;
58 LOG(info) << "Events : " << fNumEvents;
59 LOG(info) << "=====================================";
60}
61// ----------------------------------------------------------------------------
62
63
64// ----- Initialisation ---------------------------------------------------
66{
67 // --- Get FairRootManager instance
68 FairRootManager* ioman = FairRootManager::Instance();
69 assert(ioman);
70
71 LOG(info) << "==================================================";
72 LOG(info) << GetName() << ": Initialising...";
73
74 // --- Input data
75 fEvents = ioman->InitObjectAs<const std::vector<CbmDigiEvent>*>("DigiEvent");
76 if (!fEvents) {
77 LOG(error) << GetName() << ": No input branch DigiEvent!";
78 return kFATAL;
79 }
80 LOG(info) << "--- Found branch DigiEvent at " << fEvents;
81
82 LOG(info) << "==================================================";
83 return kSUCCESS;
84}
85// ----------------------------------------------------------------------------
86
87
ClassImp(CbmConverterManager)
Demonstrator class to look at digi events in the ROOT tree.
const std::vector< CbmDigiEvent > * fEvents
size_t fNumTs
Input data (events)
size_t fNumEvents
Number of analysed events.
virtual void Finish()
Finish timeslice.
virtual void Exec(Option_t *opt)
Task execution.
virtual InitStatus Init()
Task initialisation.
virtual ~CbmTaskInspectDigiEvents()
Destructor.