ATLAS Offline Software
FilterUsingMBTS.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include "TrigT1Result/CTP_RDO.h"
8 
9 #include <sstream>
10 
11 /****
12  * simple filter for splash events based on MBTS multiplicites
13  * @author: Brian Thomas Martin
14  ****/
15 
16  FilterUsingMBTS::FilterUsingMBTS(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator)
17 {
18  declareProperty("NumberOfAsideHits", m_nA_required=4);
19  declareProperty("NumberOfCsideHits", m_nC_required=4);
20  declareProperty("FirstMbtsCtpId", m_ctpOffset=30);
21 }
22 
24 {
25  ATH_MSG_INFO( "Initializing " << name() );
26 
27  // Set trigger mapping and build labels
28  for(int c=0;c<32;c++)
29  {
30  m_ctpID.push_back(m_ctpOffset+c);
31  std::ostringstream ss;
32  ss << "L1_MBTS" << ((c<16) ? "A" : "C") << ((c<16) ? c : (c-16)) ;
33  m_counterLabel.push_back(ss.str());
34  }
35 
36  return StatusCode::SUCCESS;
37 }
38 
40 {
41  // Decode CTP RDO
42  const CTP_RDO* theCTP_RDO = 0;
43  ATH_CHECK( evtStore()->retrieve(theCTP_RDO, "CTP_RDO") );
45  ctp.setRDO(theCTP_RDO);
46  uint32_t numberBC = theCTP_RDO->getNumberOfBunches();
47 
48  unsigned int nA=0; // Number of A side triggers per event
49  unsigned int nC=0; // Number of C side triggers per event
50 
51  if (numberBC > 0)
52  {
53  short l1aBC = theCTP_RDO->getL1AcceptBunchPosition();
54  const std::vector < CTP_BC > &BCs = ctp.getBunchCrossings();
55  const CTP_BC & bunch = BCs[l1aBC];
56  unsigned int l1aBCID = bunch.getBCID();
57  ATH_MSG_DEBUG( "Number of Bunches in CTP window: " << numberBC );
58  ATH_MSG_DEBUG( "Level 1 Accept Bunch: " << l1aBC );
59  ATH_MSG_DEBUG( "Level 1 Accept BCID: " << l1aBCID );
60  const std::bitset < 512 > TBP(bunch.getTBP());
61  for(int c=0;c<32;c++) // Loop over MBTS counters
62  {
63  // Check the L1 result for each MBTS counter
64  if (TBP.test(m_ctpID[c]))
65  {
66  ATH_MSG_INFO( "Trigger fired for : " << m_counterLabel[c] );
67  if(c<16) nA++;
68  else nC++;
69  }
70  } // end MBTS counter loop
71  } // end if nBC>0
72 
73  // Check if filter is passed
74  if( (nA >= m_nA_required) && (nC >= m_nC_required) )
75  {
76  ATH_MSG_INFO( "MBTS filter passed" );
77  this->setFilterPassed(true);
78  }
79  else
80  {
81  ATH_MSG_INFO( "MBTS filter failed" );
82  this->setFilterPassed(false);
83  }
84 
85  return StatusCode::SUCCESS;
86 }
87 
89 {
90  return StatusCode::SUCCESS;
91 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
CTP_Decoder.h
FilterUsingMBTS::m_nA_required
unsigned int m_nA_required
Definition: FilterUsingMBTS.h:20
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
FilterUsingMBTS::initialize
StatusCode initialize()
Definition: FilterUsingMBTS.cxx:23
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
FilterUsingMBTS::m_ctpID
std::vector< unsigned int > m_ctpID
Definition: FilterUsingMBTS.h:23
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
FilterUsingMBTS::m_nC_required
unsigned int m_nC_required
Definition: FilterUsingMBTS.h:21
CTP_Decoder
Definition: CTP_Decoder.h:142
CTP_RDO::getNumberOfBunches
uint32_t getNumberOfBunches() const
Definition: CTP_RDO.cxx:89
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
FilterUsingMBTS.h
CTP_BC
Definition: CTP_Decoder.h:17
FilterUsingMBTS::m_counterLabel
std::vector< std::string > m_counterLabel
Definition: FilterUsingMBTS.h:24
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthAlgorithm
Definition: AthAlgorithm.h:47
FilterUsingMBTS::execute
StatusCode execute()
Definition: FilterUsingMBTS.cxx:39
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
CTP_BC::getTBP
const std::bitset< 512 > & getTBP() const
get bitset of TBP words
Definition: CTP_Decoder.h:93
FilterUsingMBTS::FilterUsingMBTS
FilterUsingMBTS(const std::string &name, ISvcLocator *pSvcLocator)
Definition: FilterUsingMBTS.cxx:16
CTP_BC::getBCID
uint32_t getBCID() const
Get BCID as unsigned integer.
Definition: CTP_Decoder.cxx:292
CTP_RDO::getL1AcceptBunchPosition
uint32_t getL1AcceptBunchPosition() const
Definition: CTP_RDO.cxx:94
TriggerTest.ctp
ctp
Retrieve trigger EDM objects.
Definition: TriggerTest.py:14
FilterUsingMBTS::m_ctpOffset
unsigned int m_ctpOffset
Definition: FilterUsingMBTS.h:22
FilterUsingMBTS::finalize
StatusCode finalize()
Definition: FilterUsingMBTS.cxx:88
CTP_RDO.h
CTP_RDO
Definition: CTP_RDO.h:20
python.compressB64.c
def c
Definition: compressB64.py:93