CbmRoot
Loading...
Searching...
No Matches
CbmL1MCPoint.h
Go to the documentation of this file.
1/* Copyright (C) 2010-2017 Frankfurt Institute for Advanced Studies, Goethe-Universitaet Frankfurt, Frankfurt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Ivan Kisel, Sergey Gorbunov, Igor Kulakov [committer], Maksym Zyzak */
4
5/*
6 *====================================================================
7 *
8 * CBM Level 1 Reconstruction
9 *
10 * Authors: I.Kisel, S.Gorbunov
11 *
12 * e-mail : ikisel@kip.uni-heidelberg.de
13 *
14 *====================================================================
15 *
16 * L1 Monte Carlo information
17 *
18 *====================================================================
19 */
20
21#ifndef CbmL1MCPoint_H
22#define CbmL1MCPoint_H
23
24#include "CaVector.h"
25
26#include <iomanip>
27#include <sstream>
28#include <string>
29
30namespace
31{
33}
34
36
37 CbmL1MCPoint() = default;
38
39 static bool compareIDz(const CbmL1MCPoint& a, const CbmL1MCPoint& b)
40 {
41 return (a.ID < b.ID) || ((a.ID == b.ID) && (a.z < b.z));
42 }
43
44 static bool pcompareIDz(const CbmL1MCPoint* a, const CbmL1MCPoint* b)
45 {
46 return (a->ID < b->ID) || ((a->ID == b->ID) && (a->z < b->z));
47 }
48
49 double x = 0.;
50 double y = 0.;
51 double z = 0.;
52 double px = 0.;
53 double py = 0.;
54 double pz = 0.;
55 double xIn = 0.;
56 double yIn = 0.;
57 double zIn = 0.;
58 double pxIn = 0.;
59 double pyIn = 0.;
60 double pzIn = 0.;
61 double xOut = 0.;
62 double yOut = 0.;
63 double zOut = 0.;
64 double pxOut = 0.;
65 double pyOut = 0.;
66 double pzOut = 0.;
67 double p = 0.;
68 double q = 0.;
69 double mass = 0.;
70 double time = 0.;
71 int pdg = 0;
72 int ID = 0;
73 int mother_ID = 0;
74 int iStation = 0;
75 int pointId = -1;
76 int file = -1;
77 int event = -1;
78 Vector<int> hitIds{"CbmL1MCPoint::hitIds"}; // indices of CbmL1Hits in L1->vStsHits array
79
81 std::string ToString(int verbose = 3, bool printHeader = false) const
82 {
83 if (verbose < 1) {
84 return std::string();
85 }
86
87 std::stringstream msg;
88 msg.precision(4);
89 if (printHeader) {
90 if (verbose > 0) {
91 msg << std::setw(10) << "track ID" << ' ';
92 msg << std::setw(10) << "mother ID" << '|';
93 msg << std::setw(10) << "station ID" << '|';
94 msg << std::setw(10) << "PDG" << ' ';
95 if (verbose > 3) {
96 msg << std::setw(10) << "m [GeV/c2]" << ' ';
97 msg << std::setw(10) << "q [e]" << '|';
98 }
99 msg << std::setw(14) << "t [ns]" << ' ';
100 msg << std::setw(14) << "x [cm]" << ' ';
101 msg << std::setw(14) << "y [cm]" << ' ';
102 msg << std::setw(14) << "z [cm]" << '|';
103 if (verbose > 1) {
104 msg << std::setw(14) << "zIn [cm]" << ' ';
105 msg << std::setw(14) << "zOut [cm]" << '|';
106 msg << std::setw(14) << "p [GeV/c]" << '|';
107 msg << std::setw(10) << "point ID" << ' ';
108 if (verbose > 3) {
109 msg << std::setw(10) << "event ID" << ' ';
110 msg << std::setw(10) << "file ID" << ' ';
111 }
112 msg << std::setw(16) << "hit indices" << ' ';
113 }
114 }
115 }
116 else {
117 if (verbose > 0) {
118 msg << std::setw(10) << ID << ' ';
119 msg << std::setw(10) << mother_ID << '|';
120 msg << std::setw(10) << iStation << '|';
121 msg << std::setw(10) << pdg << ' ';
122 if (verbose > 3) {
123 msg << std::setw(10) << mass << ' ';
124 msg << std::setw(10) << q << '|';
125 }
126 msg << std::setw(14) << time << ' ';
127 msg << std::setw(14) << x << ' ';
128 msg << std::setw(14) << y << ' ';
129 msg << std::setw(14) << z << '|';
130 if (verbose > 1) {
131 msg << std::setw(14) << zIn << ' ';
132 msg << std::setw(14) << zOut << '|';
133 msg << std::setw(14) << p << '|';
134 msg << std::setw(10) << pointId << ' ';
135 if (verbose > 3) {
136 msg << std::setw(10) << event << ' ';
137 msg << std::setw(10) << file << ' ';
138 }
139 std::stringstream msgHits;
140 for (int iH : hitIds) {
141 msgHits << iH << ' ';
142 }
143 msg << std::setw(16) << msgHits.str() << ' ';
144 }
145 }
146 }
147 return msg.str();
148 }
149};
150
151#endif
CbmL1MCPoint()=default
static bool compareIDz(const CbmL1MCPoint &a, const CbmL1MCPoint &b)
std::string ToString(int verbose=3, bool printHeader=false) const
Temporary log function for debugging.
Vector< int > hitIds
static bool pcompareIDz(const CbmL1MCPoint *a, const CbmL1MCPoint *b)