ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
LVL1CTP::ItemMap Class Reference

Map associating item name to CTPTriggerItem objects. More...

#include <ItemMap.h>

Collaboration diagram for LVL1CTP::ItemMap:

Public Member Functions

 ItemMap (const TrigConf::L1Menu *l1menu)
 
 ItemMap (const TrigConf::ItemContainer &item_vector, const TrigConf::PrescaleSet &prescales)
 constructor setting list of trigger items and associated prescales (random prescale offset if randEngine is given) More...
 
 ~ItemMap ()
 default destructor More...
 
const CTPTriggerItemgetItem (const std::string &itemName) const
 
const std::set< std::string > & itemNames () const
 

Private Member Functions

std::string getDefinition (const TrigConf::TriggerItem *item) const
 

Private Attributes

std::map< std::string, const CTPTriggerItem * > m_map
 map from item name to CTPTriggerItem More...
 
std::set< std::string > m_itemNames {}
 

Detailed Description

Map associating item name to CTPTriggerItem objects.

Definition at line 37 of file ItemMap.h.

Constructor & Destructor Documentation

◆ ItemMap() [1/2]

LVL1CTP::ItemMap::ItemMap ( const TrigConf::L1Menu l1menu)

Definition at line 21 of file ItemMap.cxx.

22 {
23  for( const TrigConf::L1Item & item : *l1menu ) {
24  const std::string & itemName( item.name() );
25 
26  // get postion from ctp id
27  unsigned int ctpId = item.ctpId();
28 
29  CTPTriggerItem * ctpItem = new CTPTriggerItem();
30  ctpItem->setPrescale( 1 );
31  ctpItem->setCtpId( ctpId );
32  ctpItem->setName(itemName);
33  ctpItem->setLogic(item.definition());
34  ctpItem->setTriggerType(item.triggerTypeAsUChar());
35  ctpItem->setBunchGroups(item.bunchgroups());
36 
37  m_map[ itemName ] = ctpItem;
38  m_itemNames.insert( itemName );
39 
40  }
41 }

◆ ItemMap() [2/2]

LVL1CTP::ItemMap::ItemMap ( const TrigConf::ItemContainer item_vector,
const TrigConf::PrescaleSet prescales 
)

constructor setting list of trigger items and associated prescales (random prescale offset if randEngine is given)

Definition at line 51 of file ItemMap.cxx.

53 {
54  for( const TrigConf::TriggerItem * item : item_vector ) {
55 
56  std::string definition = getDefinition(item);
57 
58  const std::string & itemName( item->name() );
59 
60  // get postion from ctp id
61  unsigned int ctpId = item->ctpId();
62 
63  CTPTriggerItem * ctpItem = new CTPTriggerItem();
64  ctpItem->setPrescale( prescales.prescales_float()[ ctpId ] );
65  ctpItem->setCtpId( ctpId );
66  ctpItem->setName(itemName);
67  ctpItem->setLogic(definition);
68  ctpItem->setTriggerType(item->triggerType());
69 
70  m_map[ itemName ] = ctpItem;
71  m_itemNames.insert( itemName );
72  }
73 }

◆ ~ItemMap()

LVL1CTP::ItemMap::~ItemMap ( )

default destructor

Definition at line 44 of file ItemMap.cxx.

44  {
45  for( auto entry : m_map ) {
46  delete entry.second;
47  }
48 }

Member Function Documentation

◆ getDefinition()

std::string LVL1CTP::ItemMap::getDefinition ( const TrigConf::TriggerItem item) const
private

Definition at line 85 of file ItemMap.cxx.

85  {
86 
87 
88  std::vector<std::string> thresholdlist;
89  std::string logic, conditions;
90  item->buildLogic(logic, thresholdlist); // get's the list of thresholds, e.g. 1,EM15VHI_x1,EM15VHI 2,HA12IM_x2,HA12IM 1,J25_x1,J25 3,J12_x3,J12 BGRP0 BGRP1
91 
92  std::map<unsigned int, std::string> thrNames;
93  size_t idx = 1;
94  for(const std::string & thrmult : thresholdlist) {
95  std::vector<std::string> res;
96  boost::split(res, thrmult, boost::is_any_of(",")); // split 1,EM15VHI_x1,EM15VHI into multiplicity,name_mult, and name
97 
98  std::string name_mult("");
99  if(res.size() == 1) {
100  name_mult=res[0]; // for thresholds without multiplicity requirement like RNDM0 or BGRP0,...
101  } else {
102  name_mult = res[2]+"[x"+res[0]+"]"; // build "EM15VHI[x1]"
103  }
104  thrNames[idx++] = name_mult;
105  }
106 
107  // now take the logic (1&2&3&4&5&6) apart and replace the numbers with names "thr[xmult]"
108  std::string def = item->definition();
109  std::vector<std::string> tokens;
110  // build tokens with separators ()&|! and <space>. Keeps all separators except <space> in the list of tokens
111  for ( auto & tok : boost::tokenizer<boost::char_separator<char> > (item->definition(), boost::char_separator<char>(" ", "()&|!")) ) {
112  try {
113  int n = boost::lexical_cast<int,std::string>(tok);
114  tokens.emplace_back(thrNames[n]);
115  }
116  catch(const boost::bad_lexical_cast &) {
117  tokens.emplace_back(tok);
118  }
119  }
120 
121  // and reassemble the logic definition string
122  std::string definition("");
123  for( auto & tok : tokens ) {
124  definition += tok;
125  }
126 
127  return definition;
128 }

◆ getItem()

const CTPTriggerItem* LVL1CTP::ItemMap::getItem ( const std::string &  itemName) const
inline

Definition at line 50 of file ItemMap.h.

51  { return m_map.find( itemName )->second; }

◆ itemNames()

const std::set<std::string>& LVL1CTP::ItemMap::itemNames ( ) const
inline

Definition at line 53 of file ItemMap.h.

54  { return m_itemNames; }

Member Data Documentation

◆ m_itemNames

std::set<std::string> LVL1CTP::ItemMap::m_itemNames {}
private

Definition at line 65 of file ItemMap.h.

◆ m_map

std::map< std::string, const CTPTriggerItem* > LVL1CTP::ItemMap::m_map
private

map from item name to CTPTriggerItem

Definition at line 63 of file ItemMap.h.


The documentation for this class was generated from the following files:
LVL1CTP::ItemMap::m_itemNames
std::set< std::string > m_itemNames
Definition: ItemMap.h:65
beamspotman.tokens
tokens
Definition: beamspotman.py:1284
RatesAnalysisFullMenu.prescales
prescales
Definition: RatesAnalysisFullMenu.py:119
beamspotman.n
n
Definition: beamspotman.py:731
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
TrigConf::L1Item
L1 threshold configuration.
Definition: L1Item.h:18
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
LVL1CTP::ItemMap::m_map
std::map< std::string, const CTPTriggerItem * > m_map
map from item name to CTPTriggerItem
Definition: ItemMap.h:63
item
Definition: ItemListSvc.h:43
python.XMLReader.l1menu
l1menu
Definition: XMLReader.py:73
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
LVL1CTP::ItemMap::getDefinition
std::string getDefinition(const TrigConf::TriggerItem *item) const
Definition: ItemMap.cxx:85
Trk::split
@ split
Definition: LayerMaterialProperties.h:38
TrigConf::TriggerItem
Definition: TriggerItem.h:25