XMLThresholdConfigLoader.cxx 1.53 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/

#include "./XMLThresholdConfigLoader.h"
#include "./XMLTriggerThresholdLoader.h"
#include "./XMLBoostHelper.h"

#include "TrigConfStorage/XMLStorageMgr.h"
#include "TrigConfL1Data/ThresholdConfig.h"
#include "TrigConfL1Data/TriggerThreshold.h"
#include "TrigConfL1Data/CaloInfo.h"

using namespace std;
using namespace TrigConf;


XMLThresholdConfigLoader::XMLThresholdConfigLoader( XMLStorageMgr& sm, const ptree::value_type* pt ) : 
   XMLLoader("XMLThresholdConfigLoader", sm, pt)
Oleg Kuprash's avatar
Oleg Kuprash committed
20
{}
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56


bool
XMLThresholdConfigLoader::load( ThresholdConfig& thrcfg ) {

   if ( ! is_a("TriggerThresholdList") ) return false;

   TRG_MSG_DEBUG("Loading ThresholdConfig object")

   // Get the thresholds
   XMLTriggerThresholdLoader* thr_ldr = new XMLTriggerThresholdLoader(m_storageMgr);
   thr_ldr->setLevel(outputLevel());
   for(value_type v: pt() ) {
      thr_ldr->setPtree(&v);
      TriggerThreshold* thr = new TriggerThreshold();
      if (thr_ldr->load(*thr)) {
         TRG_MSG_DEBUG("Adding trigger threshold " << *thr << "(type " << thr->ttype() << ", mapping " << thr->mapping() << ")")
         thrcfg.addTriggerThreshold(thr);
      }
   }
   delete thr_ldr;

   // Read CaloInfo
   ICaloInfoLoader& ci_loader = m_storageMgr.caloInfoLoader();
   ci_loader.setLevel(outputLevel());
   CaloInfo ci;
   if ( ci_loader.load(ci) ) {
      thrcfg.setCaloInfo(ci);
      TriggerThresholdValue::setCaloInfo(ci);
   } else {
      TRG_MSG_ERROR("reading CaloInfo");
   }

   return true;
}