Skip to content

Commit

Permalink
Merge pull request #11354 from fwyzard/multithreading_74x_L1GtTrigger…
Browse files Browse the repository at this point in the history
…Menu

multithreading fix for 74x:  L1GtTriggerMenu-related modules
  • Loading branch information
cmsbuild committed Oct 9, 2015
2 parents 5d85e73 + f1173fc commit 9a9ba47
Show file tree
Hide file tree
Showing 14 changed files with 49 additions and 69 deletions.
5 changes: 4 additions & 1 deletion CondCore/L1TPlugins/src/plugin.cc
Expand Up @@ -182,7 +182,10 @@ REGISTER_PLUGIN(L1GtTriggerMaskVetoTechTrigRcd, L1GtTriggerMask);
#include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h"
#include "CondFormats/DataRecord/interface/L1GtTriggerMenuRcd.h"

REGISTER_PLUGIN(L1GtTriggerMenuRcd, L1GtTriggerMenu);
namespace {
struct L1GtTriggerMenuInitializer { void operator()(L1GtTriggerMenu & _) { _.buildGtConditionMap(); } };
}
REGISTER_PLUGIN_INIT(L1GtTriggerMenuRcd, L1GtTriggerMenu, L1GtTriggerMenuInitializer);

#include "CondFormats/L1TObjects/interface/L1GtPsbSetup.h"
#include "CondFormats/DataRecord/interface/L1GtPsbSetupRcd.h"
Expand Down
2 changes: 0 additions & 2 deletions DQM/HLTEvF/plugins/TriggerRatesMonitor.cc
Expand Up @@ -186,8 +186,6 @@ void TriggerRatesMonitor::dqmBeginRun(edm::Run const & run, edm::EventSetup cons

// cache the L1 trigger menu
m_l1tMenu = get<L1GtTriggerMenuRcd, L1GtTriggerMenu>(setup);
// FIXME - do we really need this ?
//(const_cast<L1GtTriggerMenu *>(m_l1tMenu))->buildGtConditionMap();
m_l1tAlgoMask = get<L1GtTriggerMaskAlgoTrigRcd, L1GtTriggerMask>(setup);
m_l1tTechMask = get<L1GtTriggerMaskTechTrigRcd, L1GtTriggerMask>(setup);
if (m_l1tMenu and m_l1tAlgoMask and m_l1tTechMask) {
Expand Down
1 change: 0 additions & 1 deletion DQM/L1TMonitor/src/L1GtHwValidation.cc
Expand Up @@ -2330,7 +2330,6 @@ void L1GtHwValidation::excludedAlgoList() {


const AlgorithmMap& algorithmMap = m_l1GtMenu->gtAlgorithmMap();
(const_cast<L1GtTriggerMenu*> (m_l1GtMenu))->buildGtConditionMap(); //...ugly

for (CItAlgo itAlgo = algorithmMap.begin(); itAlgo != algorithmMap.end(); itAlgo++) {

Expand Down
1 change: 0 additions & 1 deletion HLTrigger/HLTcore/src/TriggerExpressionData.cc
Expand Up @@ -62,7 +62,6 @@ bool Data::setEvent(const edm::Event & event, const edm::EventSetup & setup) {
m_l1tUpdated = false;
} else {
m_l1tMenu = get<L1GtTriggerMenuRcd, L1GtTriggerMenu>(setup);
(const_cast<L1GtTriggerMenu *>(m_l1tMenu))->buildGtConditionMap();
m_l1tCacheID = l1tCacheID;
m_l1tUpdated = true;
}
Expand Down
2 changes: 1 addition & 1 deletion HLTrigger/HLTfilters/interface/HLTLevel1GTSeed.h
Expand Up @@ -112,7 +112,7 @@ class HLTLevel1GTSeed : public HLTStreamFilter
// cached stuff

/// trigger menu
L1GtTriggerMenu * m_l1GtMenu;
const L1GtTriggerMenu * m_l1GtMenu;
unsigned long long m_l1GtMenuCacheID;

/// logic parser for m_l1SeedsLogicalExpression
Expand Down
5 changes: 3 additions & 2 deletions HLTrigger/HLTfilters/interface/TriggerResultsFilter.h
Expand Up @@ -19,7 +19,7 @@

#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EDFilter.h"
#include "FWCore/Framework/interface/stream/EDFilter.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "HLTrigger/HLTcore/interface/TriggerExpressionData.h"
Expand All @@ -36,7 +36,8 @@ namespace triggerExpression {
// class declaration
//

class TriggerResultsFilter : public edm::EDFilter {
class TriggerResultsFilter : public edm::stream::EDFilter<>
{
public:
explicit TriggerResultsFilter(const edm::ParameterSet &);
~TriggerResultsFilter();
Expand Down
5 changes: 3 additions & 2 deletions HLTrigger/HLTfilters/interface/TriggerResultsFilterFromDB.h
Expand Up @@ -19,7 +19,7 @@
#include <string>

#include "FWCore/Framework/interface/ESWatcher.h"
#include "FWCore/Framework/interface/EDFilter.h"
#include "FWCore/Framework/interface/stream/EDFilter.h"
#include "CondFormats/DataRecord/interface/AlCaRecoTriggerBitsRcd.h"
#include "HLTrigger/HLTcore/interface/TriggerExpressionData.h"

Expand All @@ -35,7 +35,8 @@ namespace triggerExpression {
// class declaration
//

class TriggerResultsFilterFromDB : public edm::EDFilter {
class TriggerResultsFilterFromDB : public edm::stream::EDFilter<>
{
public:
explicit TriggerResultsFilterFromDB(const edm::ParameterSet &);
~TriggerResultsFilterFromDB();
Expand Down
15 changes: 6 additions & 9 deletions HLTrigger/HLTfilters/src/HLTLevel1GTSeed.cc
Expand Up @@ -74,7 +74,11 @@

// constructors
HLTLevel1GTSeed::HLTLevel1GTSeed(const edm::ParameterSet& parSet) : HLTStreamFilter(parSet),
// seeding done via L1 trigger object maps, with objects that fired
// initialize the cache
m_l1GtMenu( nullptr ),
m_l1GtMenuCacheID( 0ULL ),

// seeding done via L1 trigger object maps, with objects that fired
m_l1UseL1TriggerObjectMaps(parSet.getParameter<bool> (
"L1UseL1TriggerObjectMaps")),

Expand Down Expand Up @@ -180,10 +184,6 @@ HLTLevel1GTSeed::HLTLevel1GTSeed(const edm::ParameterSet& parSet) : HLTStreamFil
<< m_l1CollectionsTag << " \n"
<< "Input tag for L1 muon collections: "
<< m_l1MuonCollectionTag << " \n" << std::endl;

// initialize cache
m_l1GtMenu = nullptr;
m_l1GtMenuCacheID = 0ULL;
}

// destructor
Expand Down Expand Up @@ -348,10 +348,7 @@ bool HLTLevel1GTSeed::hltFilter(edm::Event& iEvent, const edm::EventSetup& evSet

edm::ESHandle<L1GtTriggerMenu> l1GtMenu;
evSetup.get<L1GtTriggerMenuRcd>().get(l1GtMenu);
// make a copy of the L1GtTriggerMenu in order to call buildGtConditionMap() (FIXME - is this really needed ?)
delete m_l1GtMenu;
m_l1GtMenu = new L1GtTriggerMenu(* l1GtMenu.product());
m_l1GtMenu->buildGtConditionMap();
m_l1GtMenu = l1GtMenu.product();
m_l1GtMenuCacheID = l1GtMenuCacheID;

const AlgorithmMap& algorithmMap = l1GtMenu->gtAlgorithmMap();
Expand Down
50 changes: 22 additions & 28 deletions L1Trigger/GlobalTrigger/plugins/L1GlobalTrigger.h
Expand Up @@ -31,7 +31,7 @@
#include "CondFormats/L1TObjects/interface/L1GtBoard.h"

#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/stream/EDProducer.h"

#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
Expand All @@ -52,7 +52,7 @@ class L1GtPrescaleFactors;
class L1GtTriggerMask;

// class declaration
class L1GlobalTrigger : public edm::EDProducer
class L1GlobalTrigger : public edm::stream::EDProducer<>
{

public:
Expand Down Expand Up @@ -164,39 +164,36 @@ class L1GlobalTrigger : public edm::EDProducer
std::vector<unsigned int> m_triggerMaskVetoAlgoTrig;
std::vector<unsigned int> m_triggerMaskVetoTechTrig;

private:


L1GlobalTriggerPSB* m_gtPSB;
L1GlobalTriggerGTL* m_gtGTL;
L1GlobalTriggerFDL* m_gtFDL;

/// input tag for muon collection from GMT
edm::InputTag m_muGmtInputTag;
const edm::InputTag m_muGmtInputTag;

/// input tag for calorimeter collections from GCT
edm::InputTag m_caloGctInputTag;
const edm::InputTag m_caloGctInputTag;

/// input tag for CASTOR record
edm::InputTag m_castorInputTag;
const edm::InputTag m_castorInputTag;

/// input tag for technical triggers
std::vector<edm::InputTag> m_technicalTriggersInputTags;
const std::vector<edm::InputTag> m_technicalTriggersInputTags;

/// logical flag to produce the L1 GT DAQ readout record
bool m_produceL1GtDaqRecord;
const bool m_produceL1GtDaqRecord;

/// logical flag to produce the L1 GT EVM readout record
bool m_produceL1GtEvmRecord;
const bool m_produceL1GtEvmRecord;

/// logical flag to produce the L1 GT object map record
bool m_produceL1GtObjectMapRecord;
const bool m_produceL1GtObjectMapRecord;

/// logical flag to write the PSB content in the L1 GT DAQ record
bool m_writePsbL1GtDaqRecord;
const bool m_writePsbL1GtDaqRecord;

/// logical flag to read the technical trigger records
bool m_readTechnicalTriggerRecords;
const bool m_readTechnicalTriggerRecords;

/// number of "bunch crossing in the event" (BxInEvent) to be emulated
/// symmetric around L1Accept (BxInEvent = 0):
Expand All @@ -207,47 +204,44 @@ class L1GlobalTrigger : public edm::EDProducer
/// number of BXs in the event corresponding to alternative 0 and 1 in altNrBxBoard()
/// EmulateBxInEvent >= max(RecordLength[0], RecordLength[1])
/// negative values: take the numbers from event setup, from L1GtParameters
std::vector<int> m_recordLength;
const std::vector<int> m_recordLength;

/// alternative for number of BX per active board in GT DAQ record: 0 or 1
/// the position is identical with the active board bit
unsigned int m_alternativeNrBxBoardDaq;
const unsigned int m_alternativeNrBxBoardDaq;

/// alternative for number of BX per active board in GT EVM record: 0 or 1
/// the position is identical with the active board bit
unsigned int m_alternativeNrBxBoardEvm;
const unsigned int m_alternativeNrBxBoardEvm;

/// length of BST record (in bytes) from parameter set
int m_psBstLengthBytes;
const int m_psBstLengthBytes;

/// run algorithm triggers
/// if true, unprescaled (all prescale factors 1)
/// will overwrite the event setup
bool m_algorithmTriggersUnprescaled;
const bool m_algorithmTriggersUnprescaled;

/// if true, unmasked - all enabled (all trigger masks set to 0)
/// will overwrite the event setup
bool m_algorithmTriggersUnmasked;
const bool m_algorithmTriggersUnmasked;

/// run technical triggers
/// if true, unprescaled (all prescale factors 1)
/// will overwrite the event setup
bool m_technicalTriggersUnprescaled;
const bool m_technicalTriggersUnprescaled;

/// if true, unmasked - all enabled (all trigger masks set to 0)
/// will overwrite the event setup
bool m_technicalTriggersUnmasked;
const bool m_technicalTriggersUnmasked;

/// if true, veto unmasked - all enabled (all trigger veto masks set to 0)
/// will overwrite the event setup
bool m_technicalTriggersVetoUnmasked;


private:
const bool m_technicalTriggersVetoUnmasked;

/// verbosity level
int m_verbosity;
bool m_isDebugEnabled;
const int m_verbosity;
const bool m_isDebugEnabled;

};

Expand Down
3 changes: 0 additions & 3 deletions L1Trigger/GlobalTrigger/src/L1GlobalTriggerGTL.cc
Expand Up @@ -197,10 +197,7 @@ void L1GlobalTriggerGTL::run(
edm::ESHandle< L1GtTriggerMenu> l1GtMenu;
evSetup.get< L1GtTriggerMenuRcd>().get(l1GtMenu) ;
m_l1GtMenu = l1GtMenu.product();
(const_cast<L1GtTriggerMenu*>(m_l1GtMenu))->buildGtConditionMap();

m_l1GtMenuCacheID = l1GtMenuCacheID;

}

const std::vector<ConditionMap>& conditionMap = m_l1GtMenu->gtConditionMap();
Expand Down
Expand Up @@ -230,11 +230,8 @@ void L1GtTriggerMenuTester::retrieveL1EventSetup(const edm::EventSetup& evSetup)
edm::ESHandle<L1GtTriggerMenu> l1GtMenu;
evSetup.get<L1GtTriggerMenuRcd> ().get(l1GtMenu);
m_l1GtMenu = l1GtMenu.product();
(const_cast<L1GtTriggerMenu*> (m_l1GtMenu))->buildGtConditionMap();

m_algorithmMap = &(m_l1GtMenu->gtAlgorithmMap());
m_algorithmAliasMap = &(m_l1GtMenu->gtAlgorithmAliasMap());

m_technicalTriggerMap = &(m_l1GtMenu->gtTechnicalTriggerMap());

}
Expand Down
Expand Up @@ -2178,7 +2178,7 @@ bool L1GtTriggerMenuXmlParser::parseJetCounts(XERCES_CPP_NAMESPACE::DOMNode* nod

// get countIndex value and fill into structure
// they are expressed in base 10 (values: 0 - m_numberL1JetCounts)
char* endPtr = const_cast<char*>(type.c_str());
char* endPtr = nullptr;
long int typeInt = strtol(type.c_str(), &endPtr, 10); // base = 10

if (*endPtr != 0) {
Expand Down Expand Up @@ -2426,7 +2426,7 @@ bool L1GtTriggerMenuXmlParser::parseHfBitCounts(XERCES_CPP_NAMESPACE::DOMNode* n

// get countIndex value and fill into structure
// they are expressed in base 10
char* endPtr = const_cast<char*>(type.c_str());
char* endPtr = nullptr;
long int typeInt = strtol(type.c_str(), &endPtr, 10); // base = 10

if (*endPtr != 0) {
Expand Down Expand Up @@ -2558,7 +2558,7 @@ bool L1GtTriggerMenuXmlParser::parseHfRingEtSums(XERCES_CPP_NAMESPACE::DOMNode*

// get etSumIndex value and fill into structure
// they are expressed in base 10
char* endPtr = const_cast<char*>(type.c_str());
char* endPtr = nullptr;
long int typeInt = strtol(type.c_str(), &endPtr, 10); // base = 10

if (*endPtr != 0) {
Expand Down
12 changes: 4 additions & 8 deletions L1TriggerConfig/L1GtConfigProducers/src/L1GtVhdlWriterCore.cc
Expand Up @@ -847,18 +847,14 @@ bool L1GtVhdlWriterCore::processAlgorithmMap(std::vector< std::map<int, std::str
std::ostringstream newExpr;

// look for the condition on correct chip

std::vector<ConditionMap> * conditionMapCp = const_cast< std::vector<ConditionMap>* >(conditionMap_);

L1GtCondition* cond = (*conditionMapCp).at((algoIter->second).algoChipNumber())[conditions.at(i)];
ConditionMap const& chip = conditionMap_->at(algoIter->second.algoChipNumber());
L1GtCondition const* cond = (chip.find(conditions.at(i)) == chip.end()) ? nullptr : chip.at(conditions.at(i));

// check weather condition exists
if (cond!=NULL)
{
newExpr<<objType2Str_[(cond->objectType()).at(0)];

newExpr <<"_" << condType2Str_[cond->condType()] << "(";

newExpr << objType2Str_[(cond->objectType()).at(0)];
newExpr << "_" << condType2Str_[cond->condType()] << "(";
newExpr << conditionToIntegerMap_[conditions.at(i)] << ")";
dummy.findAndReplaceString(logicalExpr, conditions.at(i),
newExpr.str());
Expand Down
8 changes: 3 additions & 5 deletions PhysicsTools/PatAlgos/plugins/PATTriggerProducer.cc
Expand Up @@ -822,11 +822,9 @@ void PATTriggerProducer::produce( Event& iEvent, const EventSetup& iSetup )
l1GtUtils_.getL1GtRunCache( iEvent, iSetup, useL1EventSetup, useL1GtTriggerMenuLite );
ESHandle< L1GtTriggerMenu > handleL1GtTriggerMenu;
iSetup.get< L1GtTriggerMenuRcd >().get( handleL1GtTriggerMenu );
L1GtTriggerMenu l1GtTriggerMenu( *handleL1GtTriggerMenu );
const AlgorithmMap l1GtAlgorithms( l1GtTriggerMenu.gtAlgorithmMap() );
const AlgorithmMap l1GtTechTriggers( l1GtTriggerMenu.gtTechnicalTriggerMap() );
l1GtTriggerMenu.buildGtConditionMap();
const std::vector< ConditionMap > l1GtConditionsVector( l1GtTriggerMenu.gtConditionMap() );
auto const & l1GtAlgorithms = handleL1GtTriggerMenu->gtAlgorithmMap();
auto const & l1GtTechTriggers = handleL1GtTriggerMenu->gtTechnicalTriggerMap();
auto const & l1GtConditionsVector = handleL1GtTriggerMenu->gtConditionMap();
// cache conditions in one single condition map
ConditionMap l1GtConditions;
for ( size_t iCv = 0; iCv < l1GtConditionsVector.size(); ++iCv ) {
Expand Down

0 comments on commit 9a9ba47

Please sign in to comment.