ATLAS Offline Software
InDetGlobalMotherTrigMonTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
18 //Local
20 //Framework
21 #include "GaudiKernel/IInterface.h"
22 #include "GaudiKernel/StatusCode.h"
23 #include "StoreGate/ReadHandle.h"
24 #include "EventInfo/TriggerInfo.h"
25 #include "LWHists/TH1I_LW.h"
26 #include "LWHists/TH2I_LW.h"
27 
29  const std::string & type,
30  const std::string & name,
31  const IInterface* parent)
33  m_doTrigger(true)
34 {
35  declareProperty("doTrigger",m_doTrigger);
36 }
37 
39  if ( ManagedMonitorToolBase::initialize().isFailure() )
40  {
41  if ( msgLvl(MSG::DEBUG) ) msg(MSG::DEBUG) << "Could not initialize Monitor tool base!" << endmsg;
42  return StatusCode::FAILURE;
43  }
44  m_triggerNames[0] = "RNDM";
45  m_triggerNames[1] = "BPTX";
46  m_triggerNames[2] = "L1CAL";
47  m_triggerNames[3] = "TGC";
48  m_triggerNames[4] = "RPC";
49  m_triggerNames[5] = "MBTS";
50  m_triggerNames[6] = "COSM";
51  m_triggerNames[7] = "Calib";
52 
54 
55  return StatusCode::SUCCESS;
56 }
57 
58 //---------------------------------------------------------
60 {
61  m_activeMenuItems.clear();
63  if ( evtInfo.isValid() ){
64  if ( evtInfo->trigger_info() == nullptr) // Trigger info not available, will not do trigger aware plots
65  return StatusCode::FAILURE;
66  std::vector<unsigned int> level1TriggerInfo = evtInfo->trigger_info()->level1TriggerInfo();
67  if ( level1TriggerInfo.size() != 24 ) // LVL1 trigger info not of correct size, will not do trigger aware plots
68  return StatusCode::FAILURE;
69 
70  for ( int i = 0; i < 8; i++){
71  m_firedTriggers[i] = evtInfo->trigger_info()->level1TriggerType() >> i & 1;
72  }
73  for (unsigned int i = 16; i <24; i++ ){
74  for (unsigned int j = 0;j< 32; j++){
75  if ( (level1TriggerInfo[i] >> j) & 0x1 )
76  m_activeMenuItems.push_back(j+(i%8)*32);
77  }
78  }
79  return StatusCode::SUCCESS;
80  }else{
81  return StatusCode::FAILURE;
82  }
83 }
84 
86 {
87  for ( int i = 0; i < 8; i++){
88  if ( msgLvl(MSG::INFO) ) msg(MSG::INFO) << std::setw(7) << m_triggerNames[i] << " : " << m_firedTriggers[i] << endmsg;
89  }
90  return StatusCode::SUCCESS;
91 }
92 
94 {
95  return m_firedTriggers[trigger] == 1;
96 }
97 
98 
99 
101 {
102  std::vector<unsigned int>::const_iterator trig_itr = m_activeMenuItems.begin();
103  std::vector<unsigned int>::const_iterator trig_itr_end = m_activeMenuItems.end();
104  for ( ; trig_itr != trig_itr_end ; ++trig_itr) {
105  hist->Fill( (*trig_itr), value );
106  }
107  return StatusCode::SUCCESS;
108 }
109 
111 {
112  std::vector<unsigned int>::const_iterator trig_itr = m_activeMenuItems.begin();
113  std::vector<unsigned int>::const_iterator trig_itr_end = m_activeMenuItems.end();
114  for ( ; trig_itr != trig_itr_end ; ++trig_itr) {
115  hist->Fill( (*trig_itr), value );
116  }
117  return StatusCode::SUCCESS;
118 }
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
plotmaker.hist
hist
Definition: plotmaker.py:148
InDetGlobalMotherTrigMonTool::fillTrigAwareHisto
StatusCode fillTrigAwareHisto(TH1I_LW *, int)
Definition: InDetGlobalMotherTrigMonTool.cxx:100
TH1I_LW
Definition: TH1I_LW.h:23
InDetGlobalMotherTrigMonTool::PrintTriggers
StatusCode PrintTriggers()
Definition: InDetGlobalMotherTrigMonTool.cxx:85
InDetGlobalMotherTrigMonTool::m_firedTriggers
int m_firedTriggers[8]
Definition: InDetGlobalMotherTrigMonTool.h:70
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
athena.value
value
Definition: athena.py:122
TriggerInfo.h
This class contains trigger related information.
InDetGlobalMotherTrigMonTool::CheckTriggers
StatusCode CheckTriggers()
Definition: InDetGlobalMotherTrigMonTool.cxx:59
TriggerInfo::level1TriggerInfo
const std::vector< number_type > & level1TriggerInfo() const
get level1 trigger info
Definition: TriggerInfo.cxx:143
InDetGlobalMotherTrigMonTool::InDetGlobalMotherTrigMonTool
InDetGlobalMotherTrigMonTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor
Definition: InDetGlobalMotherTrigMonTool.cxx:28
InDetGlobalMotherMonTool
This tool derives from InDetGlobalMonitorToolBase The Mother tool interfaces to all subtools.
Definition: InDetGlobalMotherMonTool.h:75
InDetGlobalMotherTrigMonTool::m_eventInfoKey
SG::ReadHandleKey< EventInfo > m_eventInfoKey
Definition: InDetGlobalMotherTrigMonTool.h:72
ManagedMonitorToolBase::initialize
virtual StatusCode initialize()
Definition: ManagedMonitorToolBase.cxx:669
lumiFormat.i
int i
Definition: lumiFormat.py:92
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
InDetGlobalMotherTrigMonTool::m_activeMenuItems
std::vector< unsigned int > m_activeMenuItems
Definition: InDetGlobalMotherTrigMonTool.h:71
TH1I_LW.h
TH2I_LW.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
TriggerInfo::level1TriggerType
number_type level1TriggerType() const
get level1 trigger type
Definition: TriggerInfo.cxx:138
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
InDetGlobalMotherTrigMonTool::m_doTrigger
bool m_doTrigger
Definition: InDetGlobalMotherTrigMonTool.h:67
TH2I_LW
Definition: TH2I_LW.h:23
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
InDetGlobalMotherTrigMonTool::hasTriggerFired
bool hasTriggerFired(int trigger)
Definition: InDetGlobalMotherTrigMonTool.cxx:93
InDetGlobalMotherTrigMonTool::m_triggerNames
std::string m_triggerNames[8]
Definition: InDetGlobalMotherTrigMonTool.h:65
EventInfo::trigger_info
TriggerInfo * trigger_info()
trigger information (ptr may be NULL)
Definition: EventInfo/EventInfo/EventInfo.h:230
InDetGlobalMotherTrigMonTool.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
DEBUG
#define DEBUG
Definition: page_access.h:11
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
ReadHandle.h
Handle class for reading from StoreGate.
InDetGlobalMotherTrigMonTool::initialize
virtual StatusCode initialize()
Definition: InDetGlobalMotherTrigMonTool.cxx:38
PhysDESDM_Quirks.trigger
trigger
Definition: PhysDESDM_Quirks.py:27