CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
HltInf.cxx
Go to the documentation of this file.
1#include "Identifier/HltID.h"
2#include "HltEvent/HltInf.h"
3#include <iostream>
4
5HltInf::HltInf(const unsigned int type, const unsigned int alg,
6 const unsigned int cri, const unsigned int ver, const float etot):
7 DstHltInf(type,alg,cri,ver,etot),
8 m_mdcData(0),m_cgemData(0),m_tofData(0),m_emcData(0),m_mucData(0),m_conData(0){
9}
10
12 DstHltInf(),
13 m_mdcData(0),m_cgemData(0),m_tofData(0),m_emcData(0),m_mucData(0),m_conData(0){
14}
15
18
20 DstHltInf(aHlt),
21 m_mdcData(0),m_cgemData(0),m_tofData(0),m_emcData(0),m_mucData(0),m_conData(0){
22}
23
26 return *this;
27}
28
29bool HltInf::setData(const Identifier& id, uint32_t data){
30
31 vector<uint32_t>::iterator iter;
32 uint32_t size=0;
33
34 if(HltID::is_mdc_inf(id)) {
35 iter = m_mdcData.begin();
36 size = m_mdcData.size();
37 }
38 else if(HltID::is_cgem_inf(id)) {
39 iter = m_cgemData.begin();
40 size = m_cgemData.size();
41 }
42 else if(HltID::is_tof_inf(id)) {
43 iter = m_tofData.begin();
44 size = m_tofData.size();
45 }
46 else if(HltID::is_emc_inf(id)) {
47 iter = m_emcData.begin();
48 size = m_emcData.size();
49 }
50 else if(HltID::is_muc_inf(id)) {
51 iter = m_mucData.begin();
52 size = m_mucData.size();
53 }
54 else if(HltID::is_con_inf(id)) {
55 iter = m_conData.begin();
56 size = m_conData.size();
57 }
58 else return false;
59
60 uint32_t sub=HltID::id_sub(id);
61
62 if(sub<size) {
63 (*(iter+sub))=data;
64 return true;
65 }
66 else {
67 return false;
68 }
69}
70
71vector<uint32_t>& HltInf::getDataVec(const Identifier& id) {
72 if(HltID::is_mdc_inf(id)) return m_mdcData;
73 else if(HltID::is_cgem_inf(id)) return m_cgemData;
74 else if(HltID::is_tof_inf(id)) return m_tofData;
75 else if(HltID::is_emc_inf(id)) return m_emcData;
76 else if(HltID::is_muc_inf(id)) return m_mucData;
77 else if(HltID::is_con_inf(id)) return m_conData;
78 else return m_conData; //default: return condition number
79}
80
81vector<uint32_t>& HltInf::getDataVec(const uint32_t part) {
82 return getDataVec(HltID::data_type_id(part));
83}
84
85bool HltInf::getData(const Identifier& id, uint32_t* address) {
86
87 vector<uint32_t>::iterator iter;
88 uint32_t size=0;
89
90 if(HltID::is_mdc_inf(id)) {
91 iter = m_mdcData.begin();
92 size = m_mdcData.size();
93 }
94 else if(HltID::is_cgem_inf(id)) {
95 iter = m_cgemData.begin();
96 size = m_cgemData.size();
97 }
98 else if(HltID::is_tof_inf(id)) {
99 iter = m_tofData.begin();
100 size = m_tofData.size();
101 }
102 else if(HltID::is_emc_inf(id)) {
103 iter = m_emcData.begin();
104 size = m_emcData.size();
105 }
106 else if(HltID::is_muc_inf(id)) {
107 iter = m_mucData.begin();
108 size = m_mucData.size();
109 }
110 else if(HltID::is_con_inf(id)) {
111 iter = m_conData.begin();
112 size = m_conData.size();
113 }
114 else return false;
115
116 uint32_t sub=HltID::id_sub(id);
117
118 if(sub<size) {
119 *address = *(iter+sub);
120 return true;
121 }
122 else {
123 return false;
124 }
125}
126
127void HltInf::print() const{
128 std::cout << *this;
129 std::cout << "MDC data:" << dec << m_mdcData.size() << std::endl;
130 for(uint32_t i=0;i<m_mdcData.size();i++){
131 std::cout << " #"<<i<<"# ";
132 std::cout << *((int*)&m_mdcData[i]) << "(" << *((float*)&m_mdcData[i]) << ")";
133 if(i==m_mdcData.size()-1) std::cout << std::endl;
134 }
135 std::cout << "CGEM data:" << dec << m_cgemData.size() << std::endl;
136 for(uint32_t i=0;i<m_cgemData.size();i++){
137 std::cout << " #"<<i<<"# ";
138 std::cout << *((int*)&m_cgemData[i]) << "(" << *((float*)&m_cgemData[i]) << ")";
139 if(i==m_cgemData.size()-1) std::cout << std::endl;
140 }
141 std::cout << "TOF data:" << m_tofData.size() << std::endl;
142 for(uint32_t i=0;i<m_tofData.size();i++){
143 std::cout << " #"<<i<<"# ";
144 std::cout << *((int*)&m_tofData[i]) << "(" << *((float*)&m_tofData[i]) << ")";
145 if(i==m_tofData.size()-1) std::cout << std::endl;
146 }
147 std::cout << "EMC data:" << m_emcData.size() << std::endl;
148 for(uint32_t i=0;i<m_emcData.size();i++){
149 std::cout << " #"<<i<<"# ";
150 std::cout << *((int*)&m_emcData[i]) << "(" << *((float*)&m_emcData[i]) << ")";
151 if(i==m_emcData.size()-1) std::cout << std::endl;
152 }
153 std::cout << "MUC data:" << m_mucData.size() << std::endl;
154 for(uint32_t i=0;i<m_mucData.size();i++){
155 std::cout << " #"<<i<<"# ";
156 std::cout << *((int*)&m_mucData[i]) << "(" << *((float*)&m_mucData[i]) << ")";
157 if(i==m_mucData.size()-1) std::cout << std::endl;
158 }
159 std::cout << "CON data:" << m_conData.size() << std::endl;
160 for(uint32_t i=0;i<m_conData.size();i++){
161 std::cout << " #"<<i<<"# ";
162 std::cout << *((int*)&m_conData[i]);
163 if(i==m_conData.size()-1) std::cout << std::endl;
164 }
165 return;
166}
167
168ostream& operator<<(ostream & os, const HltInf& aHlt){
169 os<<"-----HltInf-----:"<<endl;
170 os<<"EventType: "<<hex<<aHlt.getEventType()<<endl
171 <<"AlgProcess: "<<aHlt.getAlgProcess()<<endl
172 <<"CriteriaTab:"<<aHlt.getCriteriaTable()<<endl
173 <<"EFVersion: "<<aHlt.getVersion()<<endl
174 <<"TotalEnergy:"<<aHlt.getTotalEnergy()<<endl;
175 return os;
176}
TTree * data
Double_t etot
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
ostream & operator<<(ostream &os, const HltInf &aHlt)
Definition HltInf.cxx:168
float getTotalEnergy() const
Definition DstHltInf.h:47
uint32_t getCriteriaTable() const
Definition DstHltInf.h:45
uint32_t getVersion() const
Definition DstHltInf.h:46
uint32_t getEventType() const
Definition DstHltInf.h:43
uint32_t getAlgProcess() const
Definition DstHltInf.h:44
DstHltInf & operator=(const DstHltInf &)
Definition DstHltInf.cxx:48
static bool is_tof_inf(const Identifier &id)
Definition HltID.cxx:130
static bool is_con_inf(const Identifier &id)
Definition HltID.cxx:145
static bool is_cgem_inf(const Identifier &id)
Definition HltID.cxx:125
static Identifier data_type_id(const unsigned int detector, const unsigned int id_in_sub=0)
For a single data.
Definition HltID.cxx:186
static bool is_muc_inf(const Identifier &id)
Definition HltID.cxx:140
static bool is_emc_inf(const Identifier &id)
Definition HltID.cxx:135
static bool is_mdc_inf(const Identifier &id)
Definition HltID.cxx:120
static unsigned int id_sub(const Identifier &id)
Definition HltID.cxx:156
virtual bool setData(const Identifier &id, float data)
Definition HltInf.h:43
virtual void print() const
Definition HltInf.cxx:127
~HltInf()
Definition HltInf.cxx:16
virtual bool getData(const Identifier &, uint32_t *)
Definition HltInf.cxx:85
HltInf & operator=(const DstHltInf &aHlt)
Definition HltInf.cxx:24
std::vector< uint32_t > & getDataVec(const Identifier &)
Definition HltInf.cxx:71
HltInf()
Definition HltInf.cxx:11