15#include "FairRootManager.h"
16#include "FairRunOnline.h"
19#include "TClonesArray.h"
22#include "THttpServer.h"
24#include <TDirectory.h>
31using std::setprecision;
57 FairRootManager* ioman = FairRootManager::Instance();
66 fBmonDigiVec = ioman->InitObjectAs<std::vector<CbmTofDigi>
const*>(
"BmonDigi");
68 fBmonDigiArr =
dynamic_cast<TClonesArray*
>(ioman->GetObject(
"BmonDigi"));
69 if (!
fBmonDigiArr) { LOG(fatal) <<
"No TClonesArray with Bmon digis found."; }
78 fEvents =
dynamic_cast<TClonesArray*
>(ioman->GetObject(
"CbmEvent"));
81 if (
nullptr != (ioman->GetObject(
"CbmEvent"))) {
82 LOG(error) <<
"Got pointer of type" <<
typeid(ioman->GetObject(
"CbmEvent")).name();
83 auto& tmp = *(ioman->GetObject(
"CbmEvent"));
84 LOG(error) <<
"Got Object of type" <<
typeid(tmp).name();
86 LOG(fatal) <<
"No TClonesArray with events found.";
100 fEventSize =
new TH1F(
"fEventSize",
"Event Size; # Digis; Counts", 1000, -0.5, 999.5);
101 fEventLength =
new TH1F(
"fEventLength",
"Event Length; time [ns]; Counts", 1000, -0.5, 999.5);
102 fEventsPerTS =
new TH1F(
"fEventsPerTS",
"Events per time slice; # Events; Counts", 1000, -0.5, 999.5);
103 fBmonInEvent =
new TH1F(
"fBmonInEvent",
"Number of Bmon digis in Event; # digis; Counts", 1000, -0.5, 999.5);
104 fStsInEvent =
new TH1F(
"fStsInEvent",
"Number of Sts digis in Event; # digis; Counts", 1000, -0.5, 999.5);
105 fMuchInEvent =
new TH1F(
"fMuchInEvent",
"Number of Much digis in Event; # digis; Counts", 1000, -0.5, 999.5);
106 fTofInEvent =
new TH1F(
"fTofInEvent",
"Number of Tof digis in Event; # digis; Counts", 1000, -0.5, 999.5);
108 new TH1F(
"fBmonDeltaT",
"Time diff between first and last Bmon digi;dt [ns]; Counts", 1000, -0.5, 999.5);
109 fStsDeltaT =
new TH1F(
"fStsDeltaT",
"Time diff between first and last Sts digi;dt [ns]; Counts", 1000, -0.5, 999.5);
111 new TH1F(
"fMuchDeltaT",
"Time diff between first and last Much digi;dt [ns]; Counts", 1000, -0.5, 999.5);
112 fTofDeltaT =
new TH1F(
"fTofDeltaT",
"Time diff between first and last Tof digi;dt [ns]; Counts", 1000, -0.5, 999.5);
114 fEventsvsTS =
new TH2F(
"fEventsvsTS",
"Nr. of events as fct. of TS", 10000, -0.5, 9999.5, 1000, -0.5, 999.5);
115 fLengthvsTS =
new TProfile(
"fLengthvsTS",
"Length of events as fct. of TS", 10000, -0.5, 9999.5, -0.5, 999.5);
121 LOG_IF(info,
fNrTs % 1000 == 0) <<
"Analysing TS " <<
fNrTs;
123 Int_t nrEvents =
fEvents->GetEntriesFast();
128 Int_t nrBmonDigis = -1;
136 LOG(debug) <<
"Events: " << nrEvents;
137 LOG(debug) <<
"BmonDigis: " << nrBmonDigis;
138 LOG(debug) <<
"StsDigis: " << nrStsDigis;
139 LOG(debug) <<
"MuchDigis: " << nrMuchDigis;
140 LOG(debug) <<
"TofDigis: " << nrTofDigis;
143 for (Int_t iEvent = 0; iEvent < nrEvents; iEvent++) {
146 fEventLength->Fill(event->GetEndTime() - event->GetStartTime());
167 Double_t startTime {1.e18};
168 Double_t stopTime {0.};
169 Int_t nDigis =
event->GetNofData(dataType);
171 for (Int_t iDigi = 0; iDigi < nDigis; iDigi++) {
172 UInt_t index =
event->GetIndex(dataType, iDigi);
175 if (digi->GetTime() < startTime) startTime = digi->GetTime();
176 if (digi->GetTime() > stopTime) stopTime = digi->GetTime();
178 deltaT->Fill(stopTime - startTime);
184 Double_t startTime {1.e18};
185 Double_t stopTime {0.};
188 for (Int_t iDigi = 0; iDigi < nDigis; iDigi++) {
199 deltaT->Fill(stopTime - startTime);
205 TFile* oldFile = gFile;
206 TDirectory* oldDir = gDirectory;
208 TFile* outfile = TFile::Open(
"test2.root",
"RECREATE");
ClassImp(CbmConverterManager)
@ kTof
Time-of-flight Detector.
@ kSts
Silicon Tracking System.
@ kMuch
Muon detection system.
static constexpr size_t size()
CbmDigiManager * fDigiMan
const std::vector< CbmTofDigi > * fBmonDigiVec
Interface to digi data.
virtual InitStatus Init()
TClonesArray * fBmonDigiArr
virtual void Exec(Option_t *)
virtual InitStatus ReInit()
void GetTimeDiff(CbmEvent *event, TH1 *, TH1 *, ECbmDataType type)
void GetTimeDiffBmon(CbmEvent *, TH1 *, TH1 *)
virtual void SetParContainers()
void AnalyseEvent(CbmEvent *event)
static Int_t GetNofDigis(ECbmModuleId systemId)
static Bool_t IsPresent(ECbmModuleId systemId)
Presence of a digi branch.
void UseMuchBeamTimeDigi(Bool_t)
Use CbmMuchBeamTimeDigi instead of CbmMuchDigi for MUCH.
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,...
Data class for expanded digital TOF information.
double GetTime() const
Inherited from CbmDigi.