CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
HltCriteria.cxx
Go to the documentation of this file.
1#include <cmath>
2#include "GaudiKernel/Bootstrap.h"
3#include "GaudiKernel/ISvcLocator.h"
6
8
9//HltStoreSvc* HltCriteria::m_HltStoreSvc = NULL;
10
12 :m_idCriteria(id)
13{
14 ISvcLocator* svcLocator = Gaudi::svcLocator(); // from Bootstrap
15 StatusCode sc = svcLocator->service("HltStoreSvc", m_HltStoreSvc);
16 if (sc.isFailure()) {
17 std::cout<<"Event Filter: In HltCriteria ==> Could not access HltStoreSvc!"<<std::endl;
18 exit(1);
19 }
20}
21
23
24 CriteriaItemValue* p_itemValue;
25 float itemValue;
26 std::vector<CriteriaItem>::const_iterator it = m_items.begin();
27
28 bool judge=true;
29 while (it != m_items.end()) {
30 //std::cout << "HltCriteria::satisfyCriteria()"<<(int)m_HltStoreSvc<<std::endl;
31 //std::cout << it->name << "," << it->value <<std::endl;
32 bool status = m_HltStoreSvc->get(it->name, p_itemValue);
33 if (!status) return false;
34 //std::cout << "HltCriteria::satisfyCriteria()"<<2<<std::endl;
35 status = p_itemValue->getValue(itemValue);
36 if (!status) return false;
37 //std::cout << "HltCriteria::satisfyCriteria()"<<3<<std::endl;
38 //std::cout << "HltCriteria::satisfyCriteria() item[" << it->name
39 // << "] type=>" << it->type << " get value=" << itemValue << std::endl;
40
41 if (it->type == "MIN") {
42 if (itemValue <= it->value) judge= false;
43 } else if (it->type == "MAX") {
44 if (itemValue >= it->value) judge= false;
45 } else if (it->type == "TRUE") {
46 if (fabs(itemValue - it->value) > 0.000001) judge= false;
47 } else if (it->type == "FALSE") {
48 if (fabs(itemValue - it->value) < 0.000001) judge= false;
49 } else {
50 std::cout << "In HltCriteria::satisfyCriteria() ==> Unvalid CriteriaItemType!" << std::endl;
51 exit(1);
52 }
53
54 if(it->name =="nmuc"){
55
56 }
57 else if(it->name =="nmdc"){
58
59 }
60 else if(it->name=="etot"&&it->type=="MIN"){
61
62 }
63 else if(it->name=="etot"&&it->type=="MAX"){
64
65 }
66 else if(it->name=="acop"&&it->type=="MAX"){
67
68 }
69 else{
70 //std::cout << "In HltCriteria::satisfyCriteria() ==>Criteria bits not enough! " << std::endl;
71 }
72 it++;
73 }
74
75 //std::cout << "HltCriteria::satisfyCriteria() return true" << std::endl;
76 return judge;
77}
78
79void HltCriteria::addItem(const std::string& name, float value, const std::string& type,int id) {
80 CriteriaItem it = {name, value, type,id};
81 m_items.push_back(it);
82}
83
bool getValue(float &value) const
void addItem(const std::string &name, float value, const std::string &type, int id)
bool get(const std::string &name, T &value)
Definition HltStoreSvc.h:76