CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

L1GlobalTriggerRecordProducer Class Reference

#include <L1GlobalTriggerRecordProducer.h>

Inheritance diagram for L1GlobalTriggerRecordProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 L1GlobalTriggerRecordProducer (const edm::ParameterSet &)
 constructor(s)
virtual ~L1GlobalTriggerRecordProducer ()
 destructor

Private Member Functions

virtual void beginJob ()
virtual void endJob ()
virtual void produce (edm::Event &, const edm::EventSetup &)

Private Attributes

edm::InputTag m_l1GtReadoutRecordTag
 InputTag for the L1 Global Trigger DAQ readout record.
const L1GtTriggerMaskm_l1GtTmAlgo
 cached stuff
unsigned long long m_l1GtTmAlgoCacheID
const L1GtTriggerMaskm_l1GtTmTech
unsigned long long m_l1GtTmTechCacheID
std::vector< unsigned int > m_triggerMaskAlgoTrig
std::vector< unsigned int > m_triggerMaskTechTrig

Detailed Description

Description: L1GlobalTriggerRecord producer.

Implementation: <TODO: enter implementation details>

Author:
: Vasile Mihai Ghete - HEPHY Vienna

$Date$ $Revision$

Definition at line 37 of file L1GlobalTriggerRecordProducer.h.


Constructor & Destructor Documentation

L1GlobalTriggerRecordProducer::L1GlobalTriggerRecordProducer ( const edm::ParameterSet parSet) [explicit]

constructor(s)

Definition at line 44 of file L1GlobaTriggerRecordProducer.cc.

References edm::ParameterSet::getParameter(), LogDebug, m_l1GtReadoutRecordTag, m_l1GtTmAlgoCacheID, and m_l1GtTmTechCacheID.

{

    produces<L1GlobalTriggerRecord>();

    // input tag for DAQ GT record
    m_l1GtReadoutRecordTag = 
        parSet.getParameter<edm::InputTag>("L1GtReadoutRecordTag");

    LogDebug("L1GlobalTriggerRecordProducer")
    << "\nInput tag for L1 GT DAQ record:             "
    << m_l1GtReadoutRecordTag
    << std::endl;

    // initialize cached IDs
    
    m_l1GtTmAlgoCacheID = 0ULL;
    m_l1GtTmTechCacheID = 0ULL;
    
}
L1GlobalTriggerRecordProducer::~L1GlobalTriggerRecordProducer ( ) [virtual]

destructor

Definition at line 66 of file L1GlobaTriggerRecordProducer.cc.

{

    // empty
    
}

Member Function Documentation

void L1GlobalTriggerRecordProducer::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 76 of file L1GlobaTriggerRecordProducer.cc.

{
    // empty
}
void L1GlobalTriggerRecordProducer::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 238 of file L1GlobaTriggerRecordProducer.cc.

{

    // empty now
}
void L1GlobalTriggerRecordProducer::produce ( edm::Event iEvent,
const edm::EventSetup evSetup 
) [private, virtual]

set global decision, decision word and technical trigger word for bunch cross with L1Accept (BxInEvent = 0) before applying the masks

Implements edm::EDProducer.

Definition at line 82 of file L1GlobaTriggerRecordProducer.cc.

References edm::EventSetup::get(), edm::Event::getByLabel(), L1GtTriggerMask::gtTriggerMask(), edm::isDebugEnabled(), edm::HandleBase::isValid(), LogDebug, LogTrace, m_l1GtReadoutRecordTag, m_l1GtTmAlgo, m_l1GtTmAlgoCacheID, m_l1GtTmTech, m_l1GtTmTechCacheID, m_triggerMaskAlgoTrig, m_triggerMaskTechTrig, edm::ESHandle< T >::product(), and edm::Event::put().

{

    // produce the L1GlobalTriggerRecord
    std::auto_ptr<L1GlobalTriggerRecord> gtRecord(new L1GlobalTriggerRecord());

    // get L1GlobalTriggerReadoutRecord
    edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecord;
    iEvent.getByLabel(m_l1GtReadoutRecordTag, gtReadoutRecord);
    
    if (!gtReadoutRecord.isValid()) {
        
        LogDebug("L1GlobalTriggerRecordProducer")
        << "\n\n Error: no L1GlobalTriggerReadoutRecord found with input tag "
        << m_l1GtReadoutRecordTag
        << "\n Returning empty L1GlobalTriggerRecord.\n\n"
        << std::endl;
        
        iEvent.put( gtRecord );
        return;
    }

    //
    boost::uint16_t gtFinalOR = gtReadoutRecord->finalOR();
    int physicsDaqPartition = 0;
    bool gtDecision = static_cast<bool> (gtFinalOR & (1 << physicsDaqPartition));
    
    DecisionWord algoDecisionWord = gtReadoutRecord->decisionWord();    
    TechnicalTriggerWord techDecisionWord = gtReadoutRecord->technicalTriggerWord();   

    // get / update the trigger mask from the EventSetup 
    // local cache & check on cacheIdentifier

    unsigned long long l1GtTmAlgoCacheID = 
        evSetup.get<L1GtTriggerMaskAlgoTrigRcd>().cacheIdentifier();

    if (m_l1GtTmAlgoCacheID != l1GtTmAlgoCacheID) {
        
        edm::ESHandle< L1GtTriggerMask > l1GtTmAlgo;
        evSetup.get< L1GtTriggerMaskAlgoTrigRcd >().get( l1GtTmAlgo );        
        m_l1GtTmAlgo = l1GtTmAlgo.product();
        
        m_triggerMaskAlgoTrig = m_l1GtTmAlgo->gtTriggerMask();
        
        m_l1GtTmAlgoCacheID = l1GtTmAlgoCacheID;

    }
    

    unsigned long long l1GtTmTechCacheID = 
        evSetup.get<L1GtTriggerMaskTechTrigRcd>().cacheIdentifier();

    if (m_l1GtTmTechCacheID != l1GtTmTechCacheID) {
        
        edm::ESHandle< L1GtTriggerMask > l1GtTmTech;
        evSetup.get< L1GtTriggerMaskTechTrigRcd >().get( l1GtTmTech );        
        m_l1GtTmTech = l1GtTmTech.product();
        
        m_triggerMaskTechTrig = m_l1GtTmTech->gtTriggerMask();
        
        m_l1GtTmTechCacheID = l1GtTmTechCacheID;

    }
    
    gtRecord->setDecisionWordBeforeMask(algoDecisionWord);
    gtRecord->setTechnicalTriggerWordBeforeMask(techDecisionWord);

    // mask the required bits for DAQ partition 0 (Physics Partition)
    
    int iDaq = 0;
    
    // algorithm trigger mask
    
    int iBit = -1; // bit counter

    for (std::vector<bool>::iterator 
            itBit = algoDecisionWord.begin(); itBit != algoDecisionWord.end(); ++itBit) {
        
        iBit++;
        
        int triggerMaskAlgoTrigBit = m_triggerMaskAlgoTrig[iBit] & (1 << iDaq);
        //LogTrace("L1GlobalTriggerFDL")
        //<< "\nAlgorithm trigger bit: " << iBit 
        //<< " mask = " << triggerMaskAlgoTrigBit
        //<< " DAQ partition " << iDaq
        //<< std::endl;

        if (triggerMaskAlgoTrigBit) {
            *itBit = false;

            //LogTrace("L1GlobalTriggerFDL")
            //<< "\nMasked algorithm trigger: " << iBit << ". Result set to false"
            //<< std::endl;
        }
    }

    // mask the technical trigger

    iBit = -1; // bit counter

    for (std::vector<bool>::iterator 
            itBit = techDecisionWord.begin(); itBit != techDecisionWord.end(); ++itBit) {
        
        iBit++;
        
        int triggerMaskTechTrigBit = m_triggerMaskTechTrig[iBit] & (1 << iDaq);
        //LogTrace("L1GlobalTriggerFDL")
        //<< "\nTechnical trigger bit: " << iBit 
        //<< " mask = " << triggerMaskTechTrigBit
        //<< " DAQ partition " << iDaq
        //<< std::endl;

        if (triggerMaskTechTrigBit) {
            *itBit = false;

            //LogTrace("L1GlobalTriggerFDL")
            //<< "\nMasked technical trigger: " << iBit << ". Result set to false"
            //<< std::endl;
        }
    }

    
    

    // set global decision, decision word and technical trigger word
    // for bunch cross with L1Accept (BxInEvent = 0) after applying the trigger masks
    gtRecord->setDecision(gtDecision);
    gtRecord->setDecisionWord(algoDecisionWord);
    gtRecord->setTechnicalTriggerWord(techDecisionWord);
    
    // get/set index of the set of prescale factors
    unsigned int pfIndexTech = 
        static_cast<unsigned int> ((gtReadoutRecord->gtFdlWord()).gtPrescaleFactorIndexTech());
    unsigned int pfIndexAlgo =
        static_cast<unsigned int> ((gtReadoutRecord->gtFdlWord()).gtPrescaleFactorIndexAlgo());
    
    gtRecord->setGtPrescaleFactorIndexTech(pfIndexTech);
    gtRecord->setGtPrescaleFactorIndexAlgo(pfIndexAlgo);
    
    if ( edm::isDebugEnabled() ) {
        std::ostringstream myCoutStream;
        gtRecord->print(myCoutStream);
        LogTrace("L1GlobalTriggerRecordProducer")
        << "\n The following L1 GT record was produced.\n"
        << myCoutStream.str() << "\n"
        << std::endl;
    }

    // put records into event
    iEvent.put( gtRecord );

}

Member Data Documentation

InputTag for the L1 Global Trigger DAQ readout record.

Definition at line 74 of file L1GlobalTriggerRecordProducer.h.

Referenced by L1GlobalTriggerRecordProducer(), and produce().

cached stuff

trigger masks

Definition at line 62 of file L1GlobalTriggerRecordProducer.h.

Referenced by produce().

Definition at line 63 of file L1GlobalTriggerRecordProducer.h.

Referenced by L1GlobalTriggerRecordProducer(), and produce().

Definition at line 65 of file L1GlobalTriggerRecordProducer.h.

Referenced by produce().

Definition at line 66 of file L1GlobalTriggerRecordProducer.h.

Referenced by L1GlobalTriggerRecordProducer(), and produce().

std::vector<unsigned int> L1GlobalTriggerRecordProducer::m_triggerMaskAlgoTrig [private]

Definition at line 68 of file L1GlobalTriggerRecordProducer.h.

Referenced by produce().

std::vector<unsigned int> L1GlobalTriggerRecordProducer::m_triggerMaskTechTrig [private]

Definition at line 69 of file L1GlobalTriggerRecordProducer.h.

Referenced by produce().