00001 #include <cmath>
00002 #include "GaudiKernel/Bootstrap.h"
00003 #include "GaudiKernel/ISvcLocator.h"
00004 #include "HltSteerData/HltCriteria.h"
00005 #include "HltDataTypes/CriteriaItemValue.h"
00006
00007 using HltProcessor::HltCriteria;
00008
00009
00010
00011 HltCriteria::HltCriteria(int id)
00012 :m_idCriteria(id)
00013 {
00014 ISvcLocator* svcLocator = Gaudi::svcLocator();
00015 StatusCode sc = svcLocator->service("HltStoreSvc", m_HltStoreSvc);
00016 if (sc.isFailure()) {
00017 std::cout<<"Event Filter: In HltCriteria ==> Could not access HltStoreSvc!"<<std::endl;
00018 exit(1);
00019 }
00020 }
00021
00022 bool HltCriteria::satisfyCriteria() const {
00023
00024 CriteriaItemValue* p_itemValue;
00025 float itemValue;
00026 std::vector<CriteriaItem>::const_iterator it = m_items.begin();
00027
00028 bool judge=true;
00029 while (it != m_items.end()) {
00030
00031
00032 bool status = m_HltStoreSvc->get(it->name, p_itemValue);
00033 if (!status) return false;
00034
00035 status = p_itemValue->getValue(itemValue);
00036 if (!status) return false;
00037
00038
00039
00040
00041 if (it->type == "MIN") {
00042 if (itemValue <= it->value) judge= false;
00043 } else if (it->type == "MAX") {
00044 if (itemValue >= it->value) judge= false;
00045 } else if (it->type == "TRUE") {
00046 if (fabs(itemValue - it->value) > 0.000001) judge= false;
00047 } else if (it->type == "FALSE") {
00048 if (fabs(itemValue - it->value) < 0.000001) judge= false;
00049 } else {
00050 std::cout << "In HltCriteria::satisfyCriteria() ==> Unvalid CriteriaItemType!" << std::endl;
00051 exit(1);
00052 }
00053
00054 if(it->name =="nmuc"){
00055
00056 }
00057 else if(it->name =="nmdc"){
00058
00059 }
00060 else if(it->name=="etot"&&it->type=="MIN"){
00061
00062 }
00063 else if(it->name=="etot"&&it->type=="MAX"){
00064
00065 }
00066 else if(it->name=="acop"&&it->type=="MAX"){
00067
00068 }
00069 else{
00070
00071 }
00072 it++;
00073 }
00074
00075
00076 return judge;
00077 }
00078
00079 void HltCriteria::addItem(const std::string& name, float value, const std::string& type,int id) {
00080 CriteriaItem it = {name, value, type,id};
00081 m_items.push_back(it);
00082 }
00083