BOSS 7.1.0
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_tofData(0),m_emcData(0),m_mucData(0),m_conData(0){
9}
10
12 DstHltInf(),
13 m_mdcData(0),m_tofData(0),m_emcData(0),m_mucData(0),m_conData(0){
14}
15
17}
18
20 DstHltInf(aHlt),
21 m_mdcData(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_tof_inf(id)) {
39 iter = m_tofData.begin();
40 size = m_tofData.size();
41 }
42 else if(HltID::is_emc_inf(id)) {
43 iter = m_emcData.begin();
44 size = m_emcData.size();
45 }
46 else if(HltID::is_muc_inf(id)) {
47 iter = m_mucData.begin();
48 size = m_mucData.size();
49 }
50 else if(HltID::is_con_inf(id)) {
51 iter = m_conData.begin();
52 size = m_conData.size();
53 }
54 else return false;
55
56 uint32_t sub=HltID::id_sub(id);
57
58 if(sub<size) {
59 (*(iter+sub))=data;
60 return true;
61 }
62 else {
63 return false;
64 }
65}
66
67vector<uint32_t>& HltInf::getDataVec(const Identifier& id) {
68 if(HltID::is_mdc_inf(id)) return m_mdcData;
69 else if(HltID::is_tof_inf(id)) return m_tofData;
70 else if(HltID::is_emc_inf(id)) return m_emcData;
71 else if(HltID::is_muc_inf(id)) return m_mucData;
72 else if(HltID::is_con_inf(id)) return m_conData;
73 else return m_conData; //default: return condition number
74}
75
76vector<uint32_t>& HltInf::getDataVec(const uint32_t part) {
77 return getDataVec(HltID::data_type_id(part));
78}
79
80bool HltInf::getData(const Identifier& id, uint32_t* address) {
81
82 vector<uint32_t>::iterator iter;
83 uint32_t size=0;
84
85 if(HltID::is_mdc_inf(id)) {
86 iter = m_mdcData.begin();
87 size = m_mdcData.size();
88 }
89 else if(HltID::is_tof_inf(id)) {
90 iter = m_tofData.begin();
91 size = m_tofData.size();
92 }
93 else if(HltID::is_emc_inf(id)) {
94 iter = m_emcData.begin();
95 size = m_emcData.size();
96 }
97 else if(HltID::is_muc_inf(id)) {
98 iter = m_mucData.begin();
99 size = m_mucData.size();
100 }
101 else if(HltID::is_con_inf(id)) {
102 iter = m_conData.begin();
103 size = m_conData.size();
104 }
105 else return false;
106
107 uint32_t sub=HltID::id_sub(id);
108
109 if(sub<size) {
110 *address = *(iter+sub);
111 return true;
112 }
113 else {
114 return false;
115 }
116}
117
118void HltInf::print() const{
119 std::cout << *this;
120 std::cout << "MDC data:" << dec << m_mdcData.size() << std::endl;
121 for(uint32_t i=0;i<m_mdcData.size();i++){
122 std::cout << " #"<<i<<"# ";
123 std::cout << *((int*)&m_mdcData[i]) << "(" << *((float*)&m_mdcData[i]) << ")";
124 if(i==m_mdcData.size()-1) std::cout << std::endl;
125 }
126 std::cout << "TOF data:" << m_tofData.size() << std::endl;
127 for(uint32_t i=0;i<m_tofData.size();i++){
128 std::cout << " #"<<i<<"# ";
129 std::cout << *((int*)&m_tofData[i]) << "(" << *((float*)&m_tofData[i]) << ")";
130 if(i==m_tofData.size()-1) std::cout << std::endl;
131 }
132 std::cout << "EMC data:" << m_emcData.size() << std::endl;
133 for(uint32_t i=0;i<m_emcData.size();i++){
134 std::cout << " #"<<i<<"# ";
135 std::cout << *((int*)&m_emcData[i]) << "(" << *((float*)&m_emcData[i]) << ")";
136 if(i==m_emcData.size()-1) std::cout << std::endl;
137 }
138 std::cout << "MUC data:" << m_mucData.size() << std::endl;
139 for(uint32_t i=0;i<m_mucData.size();i++){
140 std::cout << " #"<<i<<"# ";
141 std::cout << *((int*)&m_mucData[i]) << "(" << *((float*)&m_mucData[i]) << ")";
142 if(i==m_mucData.size()-1) std::cout << std::endl;
143 }
144 std::cout << "CON data:" << m_conData.size() << std::endl;
145 for(uint32_t i=0;i<m_conData.size();i++){
146 std::cout << " #"<<i<<"# ";
147 std::cout << *((int*)&m_conData[i]);
148 if(i==m_conData.size()-1) std::cout << std::endl;
149 }
150 return;
151}
152
153ostream& operator<<(ostream & os, const HltInf& aHlt){
154 os<<"-----HltInf-----:"<<endl;
155 os<<"EventType: "<<hex<<aHlt.getEventType()<<endl
156 <<"AlgProcess: "<<aHlt.getAlgProcess()<<endl
157 <<"CriteriaTab:"<<aHlt.getCriteriaTable()<<endl
158 <<"EFVersion: "<<aHlt.getVersion()<<endl
159 <<"TotalEnergy:"<<aHlt.getTotalEnergy()<<endl;
160 return os;
161}
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:153
float getTotalEnergy() const
Definition: DstHltInf.h:46
uint32_t getCriteriaTable() const
Definition: DstHltInf.h:44
uint32_t getVersion() const
Definition: DstHltInf.h:45
uint32_t getEventType() const
Definition: DstHltInf.h:42
uint32_t getAlgProcess() const
Definition: DstHltInf.h:43
DstHltInf & operator=(const DstHltInf &)
Definition: DstHltInf.cxx:48
static bool is_tof_inf(const Identifier &id)
Definition: HltID.cxx:119
static bool is_con_inf(const Identifier &id)
Definition: HltID.cxx:134
static Identifier data_type_id(const unsigned int detector, const unsigned int id_in_sub=0)
For a single data.
Definition: HltID.cxx:172
static bool is_muc_inf(const Identifier &id)
Definition: HltID.cxx:129
static bool is_emc_inf(const Identifier &id)
Definition: HltID.cxx:124
static bool is_mdc_inf(const Identifier &id)
Definition: HltID.cxx:114
static unsigned int id_sub(const Identifier &id)
Definition: HltID.cxx:145
Definition: HltInf.h:16
virtual bool setData(const Identifier &id, float data)
Definition: HltInf.h:41
virtual void print() const
Definition: HltInf.cxx:118
~HltInf()
Definition: HltInf.cxx:16
virtual bool getData(const Identifier &, uint32_t *)
Definition: HltInf.cxx:80
HltInf & operator=(const DstHltInf &aHlt)
Definition: HltInf.cxx:24
std::vector< uint32_t > & getDataVec(const Identifier &)
Definition: HltInf.cxx:67
HltInf()
Definition: HltInf.cxx:11