BmnRoot
Loading...
Searching...
No Matches
BmnEvent.cxx
Go to the documentation of this file.
1
8#include "BmnEvent.h"
9
10#include <iostream>
11#include <sstream>
12#include "FairLogger.h"
13
14
15
16// ----- Add data to event ---------------------------------------------
17void BmnEvent::AddData(DataType type, UInt_t index) {
18
19 fIndexMap[type].push_back(index);
20 fNofData++;
21
22}
23// -------------------------------------------------------------------------
24
25
26
27// ----- Get a data index ----------------------------------------------
28UInt_t BmnEvent::GetIndex(DataType type, UInt_t iData) {
29
30 if ( fIndexMap.find(type) == fIndexMap.end() ) return -1;
31 if ( fIndexMap[type].size() <= iData ) return -2;
32 return fIndexMap.at(type)[iData];
33
34}
35// -------------------------------------------------------------------------
36
37
38
39// ----- Get number of data of a type in this event --------------------
40Int_t BmnEvent::GetNofData(DataType type) const {
41
42 if ( fIndexMap.find(type) == fIndexMap.end() ) return -1;
43 else return fIndexMap.at(type).size();
44
45}
46// -------------------------------------------------------------------------
47
48
49
50// ----- Set the vertex parameters -------------------------------------
51void BmnEvent::SetVertex(Double_t x, Double_t y, Double_t z, Double_t chi2,
52 Int_t ndf, Int_t nTracks, const TMatrixFSym& covMat) {
53 fVertex.SetVertex(x, y, z, chi2, ndf, nTracks, covMat);
54}
55// -------------------------------------------------------------------------
56
57
58
59// ----- String output -------------------------------------------------
60std::string BmnEvent::ToString() const
61{
62 std::stringstream ss;
63 ss << "Event " << fNumber << " at t = " << fTimeStart
64 << " ns. Registered data types: " << fIndexMap.size()
65 << ", data objects: " << fNofData << "\n";
66 for (auto it = fIndexMap.begin(); it != fIndexMap.end(); it++) {
67 ss << " -- Data type " << it->first
68 << ", number of data " << it->second.size() << "\n";
69 }
70 return ss.str();
71}
72// -------------------------------------------------------------------------
DataType
UInt_t GetIndex(DataType type, UInt_t iData)
Definition BmnEvent.cxx:28
void AddData(DataType type, UInt_t index)
Definition BmnEvent.cxx:17
void SetVertex(Double_t x, Double_t y, Double_t z, Double_t chi2, Int_t ndf, Int_t nTracks, const TMatrixFSym &covMat)
Definition BmnEvent.cxx:51
Int_t GetNofData() const
Definition BmnEvent.h:77
std::string ToString() const
Definition BmnEvent.cxx:60
void SetVertex(Double_t x, Double_t y, Double_t z, Double_t chi2, Int_t ndf, Int_t nTracks, const TMatrixFSym &covMat, Int_t flag, vector< Int_t > idxs)
Definition BmnVertex.cxx:92