CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Attributes

HLTLevel1Activity Class Reference

Inheritance diagram for HLTLevel1Activity:
edm::EDFilter edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

virtual bool filter (edm::Event &, const edm::EventSetup &)
 HLTLevel1Activity (const edm::ParameterSet &)
 ~HLTLevel1Activity ()

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)

Private Attributes

std::vector< int > m_bunchCrossings
unsigned int m_daqPartitions
edm::InputTag m_gtReadoutRecord
bool m_ignoreL1Mask
bool m_invert
std::vector< bool > m_maskedPhysics
std::vector< bool > m_maskedTechnical
std::vector< bool > m_selectPhysics
std::vector< bool > m_selectTechnical
edm::ESWatcher
< L1GtTriggerMaskAlgoTrigRcd
m_watchPhysicsMask
edm::ESWatcher
< L1GtTriggerMaskTechTrigRcd
m_watchTechnicalMask

Detailed Description

This class is an EDFilter that checks if there was any L1 activity It can be configured to

Date:
2012/01/23 00:13:18
Revision:
1.15
Author:
Andrea Bocci

Definition at line 39 of file HLTLevel1Activity.cc.


Constructor & Destructor Documentation

HLTLevel1Activity::HLTLevel1Activity ( const edm::ParameterSet config) [explicit]

Definition at line 72 of file HLTLevel1Activity.cc.

References edm::ParameterSet::getParameter(), i, m_maskedPhysics, m_maskedTechnical, m_selectPhysics, and m_selectTechnical.

                                                                   :
  m_gtReadoutRecord( config.getParameter<edm::InputTag>     ("L1GtReadoutRecordTag") ),
  m_bunchCrossings(  config.getParameter<std::vector<int> > ("bunchCrossings") ),
  m_selectPhysics(   PHYSICS_BITS_SIZE ),
  m_selectTechnical( TECHNICAL_BITS_SIZE ),
  m_maskedPhysics(   PHYSICS_BITS_SIZE ),
  m_maskedTechnical( TECHNICAL_BITS_SIZE ),
  m_daqPartitions(   config.getParameter<unsigned int>      ("daqPartitions") ),
  m_ignoreL1Mask(    config.getParameter<bool>              ("ignoreL1Mask") ),
  m_invert(          config.getParameter<bool>              ("invert") )
{
  unsigned long long low  = config.getParameter<unsigned long long>("physicsLoBits");
  unsigned long long high = config.getParameter<unsigned long long>("physicsHiBits");
  unsigned long long tech = config.getParameter<unsigned long long>("technicalBits");
  for (unsigned int i = 0; i < 64; i++) {
    m_selectPhysics[i]    = low  & (0x01ULL << (unsigned long long) i);
    m_maskedPhysics[i]    = low  & (0x01ULL << (unsigned long long) i);
  }
  for (unsigned int i = 0; i < 64; i++) {
    m_selectPhysics[i+64] = high & (0x01ULL << (unsigned long long) i);
    m_maskedPhysics[i+64] = high & (0x01ULL << (unsigned long long) i);
  }
  for (unsigned int i = 0; i < 64; i++) {
    m_selectTechnical[i]  = tech & (0x01ULL << (unsigned long long) i);
    m_maskedTechnical[i]  = tech & (0x01ULL << (unsigned long long) i);
  }
}
HLTLevel1Activity::~HLTLevel1Activity ( )

Definition at line 100 of file HLTLevel1Activity.cc.

{
}

Member Function Documentation

void HLTLevel1Activity::fillDescriptions ( edm::ConfigurationDescriptions descriptions) [static]

Reimplemented from edm::EDFilter.

Definition at line 105 of file HLTLevel1Activity.cc.

References edm::ParameterSetDescription::add(), and edm::ConfigurationDescriptions::add().

                                                                              {
  edm::ParameterSetDescription desc;
  desc.add<edm::InputTag>("L1GtReadoutRecordTag",edm::InputTag("hltGtDigis"));
  {
    std::vector<int> temp1;
    temp1.reserve(3);
    temp1.push_back(0);
    temp1.push_back(-1);
    temp1.push_back(1);
    desc.add<std::vector<int> >("bunchCrossings",temp1);
  }
  desc.add<unsigned int>("daqPartitions",1);
  desc.add<bool>("ignoreL1Mask",false);
  desc.add<bool>("invert",false);
  desc.add<unsigned long long int>("physicsLoBits",1);
  desc.add<unsigned long long int>("physicsHiBits",262144);
  desc.add<unsigned long long int>("technicalBits",1);
  descriptions.add("hltLevel1Activity",desc);
}
bool HLTLevel1Activity::filter ( edm::Event event,
const edm::EventSetup setup 
) [virtual]

Implements edm::EDFilter.

Definition at line 131 of file HLTLevel1Activity.cc.

References edm::ESWatcher< T >::check(), edm::EventSetup::get(), i, m_bunchCrossings, m_daqPartitions, m_gtReadoutRecord, m_ignoreL1Mask, m_invert, m_maskedPhysics, m_maskedTechnical, m_selectPhysics, m_selectTechnical, m_watchPhysicsMask, m_watchTechnicalMask, PHYSICS_BITS_SIZE, and TECHNICAL_BITS_SIZE.

{
  // apply L1 mask to the physics bits
  //  - mask & partition == part. --> fully masked
  //  - mask & partition == 0x00  --> fully unmasked
  //  - mask & partition != part. --> unmasked in some partitions, consider as unmasked
  if (not m_ignoreL1Mask and m_watchPhysicsMask.check(setup)) {
    edm::ESHandle<L1GtTriggerMask> h_mask;
    setup.get<L1GtTriggerMaskAlgoTrigRcd>().get(h_mask);
    const std::vector<unsigned int> & mask = h_mask->gtTriggerMask();
    for (unsigned int i = 0; i < PHYSICS_BITS_SIZE; ++i)
      m_maskedPhysics[i] = m_selectPhysics[i] and ((mask[i] & m_daqPartitions) != m_daqPartitions);
  }
  
  // apply L1 mask to the technical bits
  //  - mask & partition == part. --> fully masked
  //  - mask & partition == 0x00  --> fully unmasked
  //  - mask & partition != part. --> unmasked in some partitions, consider as unmasked
  if (not m_ignoreL1Mask and m_watchTechnicalMask.check(setup)) {
    edm::ESHandle<L1GtTriggerMask> h_mask;
    setup.get<L1GtTriggerMaskTechTrigRcd>().get(h_mask);
    const std::vector<unsigned int> & mask = h_mask->gtTriggerMask();
    for (unsigned int i = 0; i < TECHNICAL_BITS_SIZE; ++i)
      m_maskedTechnical[i] = m_selectTechnical[i] and ((mask[i] & m_daqPartitions) != m_daqPartitions);
  }

  // access the L1 decisions
  edm::Handle<L1GlobalTriggerReadoutRecord> h_gtReadoutRecord;
  event.getByLabel(m_gtReadoutRecord, h_gtReadoutRecord);

  // compare the results with the requested bits, and return true as soon as the first match is found
  BOOST_FOREACH(int bx, m_bunchCrossings) {
    const std::vector<bool> & physics = h_gtReadoutRecord->decisionWord(bx);
    if (physics.size() != PHYSICS_BITS_SIZE)
      // error in L1 results
      return m_invert;
    for (unsigned int i = 0; i < PHYSICS_BITS_SIZE; ++i)
      if (m_maskedPhysics[i] and physics[i])
        return not m_invert;
    const std::vector<bool> & technical = h_gtReadoutRecord->technicalTriggerWord(bx);
    if (technical.size() != TECHNICAL_BITS_SIZE)
      // error in L1 results
      return m_invert;
    for (unsigned int i = 0; i < TECHNICAL_BITS_SIZE; ++i)
      if (m_maskedTechnical[i] and technical[i])
        return not m_invert;
  }
 
  return m_invert; 
}

Member Data Documentation

std::vector<int> HLTLevel1Activity::m_bunchCrossings [private]

Definition at line 48 of file HLTLevel1Activity.cc.

Referenced by filter().

unsigned int HLTLevel1Activity::m_daqPartitions [private]

Definition at line 53 of file HLTLevel1Activity.cc.

Referenced by filter().

Definition at line 47 of file HLTLevel1Activity.cc.

Referenced by filter().

Definition at line 54 of file HLTLevel1Activity.cc.

Referenced by filter().

Definition at line 55 of file HLTLevel1Activity.cc.

Referenced by filter().

std::vector<bool> HLTLevel1Activity::m_maskedPhysics [private]

Definition at line 51 of file HLTLevel1Activity.cc.

Referenced by filter(), and HLTLevel1Activity().

std::vector<bool> HLTLevel1Activity::m_maskedTechnical [private]

Definition at line 52 of file HLTLevel1Activity.cc.

Referenced by filter(), and HLTLevel1Activity().

std::vector<bool> HLTLevel1Activity::m_selectPhysics [private]

Definition at line 49 of file HLTLevel1Activity.cc.

Referenced by filter(), and HLTLevel1Activity().

std::vector<bool> HLTLevel1Activity::m_selectTechnical [private]

Definition at line 50 of file HLTLevel1Activity.cc.

Referenced by filter(), and HLTLevel1Activity().

Definition at line 57 of file HLTLevel1Activity.cc.

Referenced by filter().

Definition at line 58 of file HLTLevel1Activity.cc.

Referenced by filter().