Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pr91x l1t prescales from payloads rebased #18428

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -70,7 +70,8 @@
BPTXfilter = dict(
stage2 = cms.bool(True),
l1tAlgBlkInputTag = cms.InputTag("gtStage2Digis"),
l1tExtBlkInputTag = cms.InputTag("gtStage2Digis")
l1tExtBlkInputTag = cms.InputTag("gtStage2Digis"),
ReadPrescalesFromFile = cms.bool(True)
)
)

Expand Down
62 changes: 30 additions & 32 deletions L1Trigger/L1TGlobal/interface/L1TGlobalUtil.h
@@ -1,4 +1,4 @@
// L1TGlobalUtil: Utility class for parsing the L1 Trigger Menu
// L1TGlobalUtil: Utility class for parsing the L1 Trigger Menu

#ifndef L1TGlobal_L1TGlobalUtil_h
#define L1TGlobal_L1TGlobalUtil_h
Expand Down Expand Up @@ -48,7 +48,7 @@ class L1TGlobalUtil {
L1TGlobalUtil(edm::ParameterSet const& pset,
edm::ConsumesCollector&& iC,
T& module);

template <typename T>
L1TGlobalUtil(edm::ParameterSet const& pset,
edm::ConsumesCollector& iC,
Expand All @@ -75,8 +75,8 @@ class L1TGlobalUtil {
edm::InputTag const& l1tExtBlkInputTag);

/// destructor
virtual ~L1TGlobalUtil();
virtual ~L1TGlobalUtil();

static void fillDescription(edm::ParameterSetDescription & desc) {
L1TGlobalUtilHelper::fillDescription(desc);
}
Expand All @@ -103,16 +103,16 @@ class L1TGlobalUtil {
inline void setVerbosity(const int verbosity) {
m_verbosity = verbosity;
}

inline bool getFinalOR() const {return m_finalOR;}

// get the trigger bit from the name
const bool getAlgBitFromName(const std::string& AlgName, int& bit) const;

// get the name from the trigger bit
const bool getAlgNameFromBit(int& bit, std::string& AlgName) const;
// Access results for particular trigger bit

// Access results for particular trigger bit
const bool getInitialDecisionByBit(int& bit, bool& decision) const;
const bool getIntermDecisionByBit(int& bit, bool& decision) const;
const bool getFinalDecisionByBit(int& bit, bool& decision) const;
Expand All @@ -122,14 +122,11 @@ class L1TGlobalUtil {

// Access Masks:
// follows logic of uGT board:
// finalDecision[AlgBit]
// finalDecision[AlgBit]
// Final word is after application of prescales.
// A prescale = 0 effectively masks out the algorithm in the final decision word
//
// If vetoMask = true and Algorithm is true, the FINOR (final global decision) is forced to false (ie. event is vetoed)
// If vetoMask = false, algorithm cannot veto FINOR (final global decision)
const bool getMaskByBit(int& bit, bool& mask) const;
const bool getVetoMaskByBit(int& bit, bool& veto) const;
const bool getMaskByBit(int& bit, std::vector<int>& mask) const;

// Access results for particular trigger name
const bool getInitialDecisionByName(const std::string& algName, bool& decision) const;
Expand All @@ -140,8 +137,7 @@ class L1TGlobalUtil {
const bool getPrescaleByName(const std::string& algName, int& prescale) const;

// Access Masks (see note) above
const bool getMaskByName(const std::string& algName, bool& mask) const;
const bool getVetoMaskByName(const std::string& algName, bool& veto) const;
const bool getMaskByName(const std::string& algName, std::vector<int>& mask) const;

// Some inline commands to return the full vectors
inline const std::vector<std::pair<std::string, bool> >& decisionsInitial() { return m_decisionsInitial; }
Expand All @@ -152,8 +148,7 @@ class L1TGlobalUtil {
inline const std::vector<std::pair<std::string, int> >& prescales() { return m_prescales; }

// Access Masks (see note) above
inline const std::vector<std::pair<std::string, bool> >& masks() { return m_masks; }
inline const std::vector<std::pair<std::string, bool> >& vetoMasks() { return m_vetoMasks; }
inline const std::vector<std::pair<std::string, std::vector<int> > >& masks() { return m_masks; }

// Menu names
inline const std::string& gtTriggerMenuName() const {return m_l1GtMenu->getName();}
Expand All @@ -162,6 +157,7 @@ class L1TGlobalUtil {

// Prescale Column
inline unsigned int prescaleColumn() const {return m_PreScaleColumn;}
inline unsigned int numberOfPreScaleColumns() const {return m_numberOfPreScaleColumns;}

private:

Expand All @@ -179,35 +175,36 @@ class L1TGlobalUtil {


// prescale factors
bool m_readPrescalesFromFile;
const l1t::PrescalesVetosHelper* m_l1GtPrescalesVetoes;
unsigned long long m_l1GtPfAlgoCacheID;

// prescale or mask algo decisions
bool m_algorithmTriggersUnprescaled;
bool m_algorithmTriggersUnmasked;
bool m_algorithmTriggersUnmasked;

// prescales and masks
bool m_filledPrescales;

// algorithm maps
//const AlgorithmMap* m_algorithmMap;
const std::map<std::string, L1TUtmAlgorithm>* m_algorithmMap;

// Number of physics triggers
unsigned int m_numberPhysTriggers;

const unsigned int m_maxNumberPhysTriggers = 512;

//file and container for prescale factors
std::string m_preScaleFileName;
unsigned int m_PreScaleColumn;

unsigned int m_numberOfPreScaleColumns;

std::vector<std::vector<int> > m_initialPrescaleFactorsAlgoTrig;
const std::vector<std::vector<int> >* m_prescaleFactorsAlgoTrig;
std::vector<unsigned int> m_initialTriggerMaskAlgoTrig;
const std::vector<unsigned int>* m_triggerMaskAlgoTrig;
std::vector<int> m_initialTriggerMaskVetoAlgoTrig;
const std::vector<int>* m_triggerMaskVetoAlgoTrig;

// access to the results block from uGT
const std::map<int, std::vector<int> > m_initialTriggerMaskAlgoTrig;
const std::map<int, std::vector<int> >* m_triggerMaskAlgoTrig; // vector stores the BX
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why a pointer? (actually all of these being pointers seems to cause considerable problems in code clarify below)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used to point to either a const ref. returned by triggerAlgoBxMask() or the Masks returned from file (dummy for the moment).


// access to the results block from uGT
edm::Handle<BXVector<GlobalAlgBlk>> m_uGtAlgBlk;

// final OR
Expand All @@ -218,9 +215,8 @@ class L1TGlobalUtil {
std::vector<std::pair<std::string, bool> > m_decisionsInterm;
std::vector<std::pair<std::string, bool> > m_decisionsFinal;
std::vector<std::pair<std::string, int> > m_prescales;
std::vector<std::pair<std::string, bool> > m_masks;
std::vector<std::pair<std::string, bool> > m_vetoMasks;

std::vector<std::pair<std::string, std::vector<int> > > m_masks; // vector stores the bx's that are mask for given algo

/// verbosity level
int m_verbosity;

Expand All @@ -242,8 +238,9 @@ L1TGlobalUtil::L1TGlobalUtil(edm::ParameterSet const& pset,
m_l1tGlobalUtilHelper.reset(new L1TGlobalUtilHelper(pset,
iC,
module));
m_readPrescalesFromFile=m_l1tGlobalUtilHelper->readPrescalesFromFile();
}

template <typename T>
L1TGlobalUtil::L1TGlobalUtil(edm::ParameterSet const& pset,
edm::ConsumesCollector&& iC,
Expand All @@ -264,6 +261,7 @@ L1TGlobalUtil::L1TGlobalUtil(edm::ParameterSet const& pset,
module,
l1tAlgBlkInputTag,
l1tExtBlkInputTag));
m_readPrescalesFromFile=m_l1tGlobalUtilHelper->readPrescalesFromFile();
}
}
#endif
21 changes: 15 additions & 6 deletions L1Trigger/L1TGlobal/interface/L1TGlobalUtilHelper.h
Expand Up @@ -43,7 +43,7 @@ namespace l1t {
// Using this constructor will require InputTags to be specified in the configuration
L1TGlobalUtilHelper(edm::ParameterSet const& pset,
edm::ConsumesCollector& iC);

// Using this constructor will cause it to look for valid InputTags in
// the following ways in the specified order until they are found.
// 1. The configuration
Expand All @@ -53,7 +53,7 @@ namespace l1t {
L1TGlobalUtilHelper(edm::ParameterSet const& pset,
edm::ConsumesCollector& iC,
T& module);

// Using this constructor will cause it to look for valid InputTags in
// the following ways in the specified order until they are found.
// 1. The constructor arguments
Expand All @@ -66,18 +66,20 @@ namespace l1t {
T& module,
edm::InputTag const& l1tAlgBlkInputTag,
edm::InputTag const& l1tExtBlkInputTag);

// A module defining its fillDescriptions function might want to use this
static void fillDescription(edm::ParameterSetDescription & desc);

// Callback which will be registered with the Framework if the InputTags
// are not specified in the configuration or constructor arguments. It
// will get called for each product in the ProductRegistry.
void operator()(edm::BranchDescription const& branchDescription);

edm::InputTag const& l1tAlgBlkInputTag() const { return m_l1tAlgBlkInputTag; }
edm::InputTag const& l1tExtBlkInputTag() const { return m_l1tExtBlkInputTag; }


bool const& readPrescalesFromFile() const {return m_readPrescalesFromFile; }

edm::EDGetTokenT<GlobalAlgBlkBxCollection> const& l1tAlgBlkToken() const { return m_l1tAlgBlkToken; }
edm::EDGetTokenT<GlobalExtBlkBxCollection> const& l1tExtBlkToken() const { return m_l1tExtBlkToken; }

Expand All @@ -94,6 +96,8 @@ namespace l1t {
bool m_findL1TAlgBlk;
bool m_findL1TExtBlk;

bool m_readPrescalesFromFile;

bool m_foundPreferredL1TAlgBlk;
bool m_foundPreferredL1TExtBlk;

Expand Down Expand Up @@ -128,12 +132,17 @@ namespace l1t {
m_findL1TAlgBlk(false),
m_findL1TExtBlk(false),

m_readPrescalesFromFile(false),

m_foundPreferredL1TAlgBlk(false),
m_foundPreferredL1TExtBlk(false),

m_foundMultipleL1TAlgBlk(false),
m_foundMultipleL1TExtBlk(false) {

if (pset.existsAs<bool>("ReadPrescalesFromFile")) {
m_readPrescalesFromFile = pset.getParameter<bool>("ReadPrescalesFromFile");
}
// If the InputTags are not set to valid values by the arguments, then
// try to set them from the configuration.
if(m_l1tAlgBlkInputTag.label().empty() &&
Expand Down