CMS 3D CMS Logo

L1GtUtils.cc File Reference

#include "L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h"
#include <iomanip>
#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h"
#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerRecord.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h"
#include "CondFormats/DataRecord/interface/L1GtTriggerMenuRcd.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

Go to the source code of this file.

Functions

bool l1AlgorithmResult (const edm::Event &iEvent, const edm::EventSetup &evSetup, const std::string &l1AlgorithmName)
 get the result for a given algorithm via trigger menu from the L1 GT lite record assume InputTag for L1GlobalTriggerRecord to be l1GtRecord
bool l1AlgorithmResult (const edm::Event &iEvent, const edm::EventSetup &evSetup, const edm::InputTag &l1GtRecordInputTag, const std::string &l1AlgorithmName)
 get the result for a given algorithm via trigger menu from the L1 GT lite record


Function Documentation

bool l1AlgorithmResult ( const edm::Event iEvent,
const edm::EventSetup evSetup,
const std::string &  l1AlgorithmName 
)

get the result for a given algorithm via trigger menu from the L1 GT lite record assume InputTag for L1GlobalTriggerRecord to be l1GtRecord

Definition at line 71 of file L1GtUtils.cc.

References lat::endl(), edm::friendlyname::friendlyName(), edm::Event::getAllProvenance(), and l1AlgorithmResult().

00072                                                                         {
00073 
00074     typedef std::vector< edm::Provenance const*> Provenances;
00075     Provenances provenances;
00076     std::string friendlyName;
00077     std::string modLabel;
00078     std::string instanceName;
00079     std::string processName;
00080     
00081     edm::InputTag l1GtRecordInputTag;
00082     
00083     iEvent.getAllProvenance(provenances);
00084 
00085     //edm::LogVerbatim("L1GtUtils") << "\n" << "Event contains "
00086     //        << provenances.size() << " product" << (provenances.size()==1 ? "" : "s")
00087     //        << " with friendlyClassName, moduleLabel, productInstanceName and processName:"
00088     //        << std::endl;
00089 
00090     for (Provenances::iterator itProv = provenances.begin(), itProvEnd =
00091             provenances.end(); itProv != itProvEnd; ++itProv) {
00092         
00093         friendlyName = (*itProv)->friendlyClassName();
00094         modLabel = (*itProv)->moduleLabel();
00095         instanceName = (*itProv)->productInstanceName();
00096         processName = (*itProv)->processName();
00097 
00098         //edm::LogVerbatim("L1GtUtils") << friendlyName << " \"" << modLabel
00099         //        << "\" \"" << instanceName << "\" \"" << processName << "\""
00100         //        << std::endl;
00101 
00102         if (friendlyName == "L1GlobalTriggerRecord") {
00103             l1GtRecordInputTag = edm::InputTag(modLabel, instanceName,
00104                     processName);
00105         }
00106     }
00107 
00108     edm::LogVerbatim("L1GtUtils")
00109             << "\nL1GlobalTriggerRecord found in the event with \n  "
00110             << l1GtRecordInputTag << std::endl;
00111 
00112     return l1AlgorithmResult(iEvent, evSetup, l1GtRecordInputTag,
00113             l1AlgorithmName);
00114 
00115 }

bool l1AlgorithmResult ( const edm::Event iEvent,
const edm::EventSetup evSetup,
const edm::InputTag l1GtRecordInputTag,
const std::string &  l1AlgorithmName 
)

get the result for a given algorithm via trigger menu from the L1 GT lite record

Definition at line 35 of file L1GtUtils.cc.

References lat::endl(), edm::EventSetup::get(), edm::Event::getByLabel(), L1GtTriggerMenu::gtAlgorithmResult(), edm::Handle< T >::isValid(), and edm::ESHandle< T >::product().

Referenced by l1AlgorithmResult().

00038                                           {
00039 
00040     edm::Handle<L1GlobalTriggerRecord> gtRecord;
00041     iEvent.getByLabel(l1GtRecordInputTag, gtRecord);
00042 
00043     if (!gtRecord.isValid()) {
00044 
00045         edm::LogError("L1GtUtils") << "\nL1GlobalTriggerRecord with \n  "
00046                 << l1GtRecordInputTag << "\nnot found"
00047             "\n  --> returning false by default!\n" << std::endl;
00048 
00049         return false;
00050 
00051     }
00052 
00053     const DecisionWord gtDecisionWord = gtRecord->decisionWord();
00054 
00055     edm::ESHandle<L1GtTriggerMenu> l1GtMenu;
00056     evSetup.get<L1GtTriggerMenuRcd>().get(l1GtMenu) ;
00057     const L1GtTriggerMenu* m_l1GtMenu = l1GtMenu.product();
00058 
00059     const bool algResult = m_l1GtMenu->gtAlgorithmResult(l1AlgorithmName,
00060             gtDecisionWord);
00061 
00062     edm::LogVerbatim("L1GtUtils") << "\nResult for algorithm "
00063             << l1AlgorithmName << ": " << algResult << "\n" << std::endl;
00064 
00065     return algResult;
00066 
00067 }


Generated on Tue Jun 9 17:54:37 2009 for CMSSW by  doxygen 1.5.4