Skip to content

Commit

Permalink
First commit of the L1TZDC folder, skeleton under L1Trigger, modeled …
Browse files Browse the repository at this point in the history
…after L1TCalorimeter

Updated naming scheme to remove Stage2 in the ZDC producer - also added contact info and dates in event of bugs/history issues

Stripped out everything except for digis in and etsums out

Removed a few leftover items causing compile failure from last stripdown of superfluous elements - need to fix the BuildFile.xml still

Added I think the only include statement needed for QIE10DataFrame

Added a test file l1ZDCProducerTest.py based on GM work here: https://github.com/ginnocen/UPCopenHFanalysis/tree/zdc_calibrationcode/zdc_calibration/newZDCAnalyzer/test

Initial copy of L1TStage2CaloAnlyzer to L1TZDCAnalyzer, just renaming the class, no internal changes (next commit attempt to strip down to etsums only)

Updated to a working producer that outputs dummy etsums and an analyzers that compiles, building a simple ttree for etsums per event - next step is to get the python running interfacing producer with analyzer, and replacing dummy et sums

Fixed both the L1TZDCAnalyzer for not filling the TTree, moved ET in names to Et, and fixed issues in the l1ZDCProducerTest python for not picking up the ETSums

Forgot to remove the bx checks from the last push in L1ZDCAnalyzer - remove for now but be ready to revert if this is important to L1 folks

Fixed two small errors in the L1TZDCAnalyzer and L1TZDCProducer, and added a README w/ build instructions under L1Trigger/L1TZDC

Fixed mistake in README

Updated the L1TZDCAnalyzer, Producer, and ProducerTest.py files under L1TZDC via ginnocen edits that can be found here: ginnocen@1554043 + the previous commit; in future we will try to switch to doing this properly by pull requests

Last build was successful which means we can increment to v0.1.0. Version up because working version with ZDCEtSum output, non-dummy. Next increment to v0.2.0 with lookup tables instead of hard-coded LUT and compatibility with CMSSW_13_2_0_pre3. Also modified README to reflect the latest build

First pass at adding ZDC LUT handling to CaloParamsHelper.h, L1TCaloStage2ParamsESProducer.cc, and caloParams_cfi.py

Updated for the changes ginnocen made in this commit ginnocen@5b8bc71 along with updated README instructions to tag v0.1.3 this will corresppond to - again, need to switch to proper PR system over linking git commits hack

Updated DataFormats/L1TGlobal/*/GlobalObject.* files for gtZDCP and gtZDCM - also updated the ZDC Producer to match the P/M convention for Plus/Minus rather than our existing choice of P/N for Positive/Negative

Fixed bug in l1ZDCProducerTest.py (left input as zdcEtSumsN instead of zdcEtSumsM, change to match convention), updated EtSum for kZDCP and kZDCM, updated L1TZDCProducer to use this new type, and readme to use this tag=zdcL1T_v0.1.5

Updating the L1TNtuples for a temp ZDCP and ZDCM etSums (not using the enum position of this etsum but rather as independent objects for speedy implementation

Modified caloParams so the LUTFile isnt empty and updated the README for latest build instructions getting the ZDCSums into the L1TNtuple

Large update to the ZDCProducer replacing hard-coded lut w/ py lut (toggleable for now); Analyzer fix (all bx except 4 off, plus N -> M in ZDC naming convention); createLUT for flattened file; l1ZDCProducerTest and a data dir for the python luts under L1TZDC

Small fixes for LUT + reduced bx from 10 to 5 (centered on bx 4, position of peak, for 2, 3, 4, 5, 6 in zdc output) - Analyzer nBX reduced to 5 (hardcoded), also LUT in caloParams now points to what we pull in under L1Trigger/L1TZDC/data - this is the set of changes for incrementing to v0.2.0

Updated README file to fix readability and add some common debug info

Still fixing README

Updated README for more info that was missing in build + fixed a bunch of typos

Updated README for git tag zdcL1T_latest to avoid future need for README updates

Collapsed ZDCP and ZDCM outputs of the L1TZDCProducer into a single ETSum; P and M now distinguished by kZDCP and kZDCM EtSum type id defined in the data format - also altered the test L1TZDCAnalyzer and the l1ZDCProducerTest.py file, checked the outputs looked unchanged when running with this update

Mass update for Upgrade tree and update to README for clearer instructions + modified for combining ZDC EtSums into one object

Commit after testing of zdcL1T branch for PR; tested on 2023.08.22 w/ CMSSW_13_3_x_2023-08-22-1100 i.e. latest daily. Two tests fail but inspecting log shows files were not accessible (even after double checking voms was done) - will request advice on PR

Updated files per initial comments on PR here: https://github.com/cms-sw/cmssw/pull/42634/files ; also attempted to fix in additional places as yet uncommented with similar issues

Fixes for code format issues flagged in git cmssw bot checks on last commit; just ran scram build code-format on the command line

Modifications for PR; mostly removal of comments no longer relevant, removal of functions not relevant, switching from cout to LogInfo, and switching to unique_ptr for handling caloParamsHelper

Removed unused iterator called counter from Producer, and changed a cout to edm::LogInfo inAnalyzer

Merging in PR from elfontan, cms-sw#42635, handling of the uGT side of the ZDC trigger; ran scram runtests, codechecks and code format before push; some change to L1TZDC code to fix residual differences between prs
  • Loading branch information
cfmcginn authored and missirol committed Aug 29, 2023
1 parent 19c1787 commit c7e16b9
Show file tree
Hide file tree
Showing 39 changed files with 1,834 additions and 27 deletions.
2 changes: 2 additions & 0 deletions DataFormats/L1TGlobal/interface/GlobalObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ namespace l1t {
gtCentrality6,
gtCentrality7,
gtExternal,
gtZDCP,
gtZDCM,
ObjNull
};

Expand Down
10 changes: 10 additions & 0 deletions DataFormats/L1TGlobal/src/GlobalObject.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ l1t::GlobalObject l1TGtObjectStringToEnum(const std::string& label) {
{"CENT6", gtCentrality6},
{"CENT7", gtCentrality7},
{"External", gtExternal},
{"ZDCP", gtZDCP},
{"ZDCM", gtZDCM},
{"ObjNull", ObjNull},
{nullptr, (GlobalObject)-1}};

Expand Down Expand Up @@ -200,6 +202,14 @@ std::string l1t::l1TGtObjectEnumToString(const GlobalObject& gtObject) {
gtObjectString = "External";
} break;

case gtZDCP: {
gtObjectString = "ZDCP";
} break;

case gtZDCM: {
gtObjectString = "ZDCM";
} break;

case ObjNull: {
gtObjectString = "ObjNull";
edm::LogInfo("L1TGlobal") << "\n ObjNull means no valid GlobalObject defined!";
Expand Down
2 changes: 2 additions & 0 deletions DataFormats/L1Trigger/interface/EtSum.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ namespace l1t {
kAsymHt,
kAsymEtHF,
kAsymHtHF,
kZDCP,
kZDCM,
kUninitialized
};

Expand Down
8 changes: 7 additions & 1 deletion L1Trigger/L1TCalorimeter/interface/CaloParamsHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ namespace l1t {
metHFPhiCalibration = 49,
layer1HCalFBUpper = 50,
layer1HCalFBLower = 51,
NUM_CALOPARAMNODES = 52
hiZDC = 52,
NUM_CALOPARAMNODES = 53
};

CaloParamsHelper() { pnode_.resize(NUM_CALOPARAMNODES); }
Expand Down Expand Up @@ -525,6 +526,11 @@ namespace l1t {
l1t::LUT const* q2LUT() const { return &pnode_[hiQ2].LUT_; }
void setQ2LUT(const l1t::LUT& lut) { pnode_[hiQ2].LUT_ = lut; }

// HI ZDC
l1t::LUT* zdcLUT() { return &pnode_[hiZDC].LUT_; }
l1t::LUT const* zdcLUT() const { return &pnode_[hiZDC].LUT_; }
void setZDCLUT(const l1t::LUT& lut) { pnode_[hiZDC].LUT_ = lut; }

// HI parameters
double etSumCentLower(unsigned centClass) const {
if (pnode_[etSumCentralityLower].dparams_.size() > centClass)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,12 @@ L1TCaloStage2ParamsESProducer::L1TCaloStage2ParamsESProducer(const edm::Paramete
std::shared_ptr<LUT> q2LUT(new LUT(q2LUTStream));
m_params_helper.setQ2LUT(*q2LUT);

// HI ZDC calibration LUT for trigger
edm::FileInPath zdcLUTFile = conf.getParameter<edm::FileInPath>("zdcLUTFile");
std::ifstream zdcLUTStream(zdcLUTFile.fullPath());
std::shared_ptr<LUT> zdcLUT(new LUT(zdcLUTStream));
m_params_helper.setZDCLUT(*zdcLUT);

// Layer 1 LUT specification
m_params_helper.setLayer1ECalScaleFactors(conf.getParameter<std::vector<double>>("layer1ECalScaleFactors"));
m_params_helper.setLayer1HCalScaleFactors(conf.getParameter<std::vector<double>>("layer1HCalScaleFactors"));
Expand Down
3 changes: 2 additions & 1 deletion L1Trigger/L1TCalorimeter/python/caloParams_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@
minimumBiasThresholds = cms.vint32(0, 0, 0, 0),
centralityLUTFile = cms.FileInPath("L1Trigger/L1TCalorimeter/data/centralityLUT_stage1.txt"),
q2LUTFile = cms.FileInPath("L1Trigger/L1TCalorimeter/data/q2LUT_stage1.txt"),

zdcLUTFile = cms.FileInPath("L1Trigger/L1TZDC/data/zdcLUT_HI_v0_1.txt"),

# HCal FB LUT
layer1HCalFBLUTUpper = cms.vuint32([
0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA,
Expand Down
12 changes: 9 additions & 3 deletions L1Trigger/L1TGlobal/interface/GlobalBoard.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,15 @@ namespace l1t {
const edm::EDGetTokenT<BXVector<l1t::Tau>>&,
const edm::EDGetTokenT<BXVector<l1t::Jet>>&,
const edm::EDGetTokenT<BXVector<l1t::EtSum>>&,
const edm::EDGetTokenT<BXVector<l1t::EtSum>>&,
const bool receiveEG,
const int nrL1EG,
const bool receiveTau,
const int nrL1Tau,
const bool receiveJet,
const int nrL1Jet,
const bool receiveEtSums);
const bool receiveEtSums,
const bool receiveZdcEtSums);

void receiveMuonObjectData(const edm::Event&,
const edm::EDGetTokenT<BXVector<l1t::Muon>>&,
Expand Down Expand Up @@ -161,10 +163,13 @@ namespace l1t {
/// pointer to Tau data list
inline const BXVector<const l1t::L1Candidate*>* getCandL1Tau() const { return m_candL1Tau; }

/// pointer to Tau data list
/// pointer to EtSum data list
inline const BXVector<const l1t::EtSum*>* getCandL1EtSum() const { return m_candL1EtSum; }

/// pointer to Tau data list
/// pointer to ZDC EtSum data list
inline const BXVector<const l1t::EtSum*>* getCandL1ZdcEtSum() const { return m_candL1ZdcEtSum; }

/// pointer to External data list
inline const BXVector<const GlobalExtBlk*>* getCandL1External() const { return m_candL1External; }

/* Drop individual EtSums for Now
Expand Down Expand Up @@ -226,6 +231,7 @@ namespace l1t {
BXVector<const l1t::L1Candidate*>* m_candL1Tau;
BXVector<const l1t::L1Candidate*>* m_candL1Jet;
BXVector<const l1t::EtSum*>* m_candL1EtSum;
BXVector<const l1t::EtSum*>* m_candL1ZdcEtSum;
BXVector<const GlobalExtBlk*>* m_candL1External;

// BXVector<const l1t::EtSum*>* m_candETM;
Expand Down
2 changes: 2 additions & 0 deletions L1Trigger/L1TGlobal/interface/GlobalDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ namespace l1t {
TypeMinBiasHFM0,
TypeMinBiasHFP1,
TypeMinBiasHFM1,
TypeZDCP,
TypeZDCM,
TypeETTem,
TypeExternal,
Type2corWithOverlapRemoval,
Expand Down
11 changes: 11 additions & 0 deletions L1Trigger/L1TGlobal/interface/TriggerMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "L1Trigger/L1TGlobal/interface/MuonShowerTemplate.h"
#include "L1Trigger/L1TGlobal/interface/CaloTemplate.h"
#include "L1Trigger/L1TGlobal/interface/EnergySumTemplate.h"
#include "L1Trigger/L1TGlobal/interface/ZdcEnergySumTemplate.h"
#include "L1Trigger/L1TGlobal/interface/ExternalTemplate.h"
#include "L1Trigger/L1TGlobal/interface/CorrelationTemplate.h"
#include "L1Trigger/L1TGlobal/interface/CorrelationThreeBodyTemplate.h"
Expand All @@ -57,6 +58,7 @@ class TriggerMenu {
const std::vector<std::vector<MuonShowerTemplate> >&,
const std::vector<std::vector<CaloTemplate> >&,
const std::vector<std::vector<EnergySumTemplate> >&,
const std::vector<std::vector<ZdcEnergySumTemplate> >&,
const std::vector<std::vector<ExternalTemplate> >&,
const std::vector<std::vector<CorrelationTemplate> >&,
const std::vector<std::vector<CorrelationThreeBodyTemplate> >&,
Expand Down Expand Up @@ -130,6 +132,14 @@ class TriggerMenu {

void setVecEnergySumTemplate(const std::vector<std::vector<EnergySumTemplate> >&);

//
inline const std::vector<std::vector<ZdcEnergySumTemplate> >& vecZdcEnergySumTemplate() const {
return m_vecZdcEnergySumTemplate;
}

void setVecZdcEnergySumTemplate(const std::vector<std::vector<ZdcEnergySumTemplate> >&);

//
inline const std::vector<std::vector<ExternalTemplate> >& vecExternalTemplate() const {
return m_vecExternalTemplate;
}
Expand Down Expand Up @@ -230,6 +240,7 @@ class TriggerMenu {
std::vector<std::vector<MuonShowerTemplate> > m_vecMuonShowerTemplate;
std::vector<std::vector<CaloTemplate> > m_vecCaloTemplate;
std::vector<std::vector<EnergySumTemplate> > m_vecEnergySumTemplate;
std::vector<std::vector<ZdcEnergySumTemplate> > m_vecZdcEnergySumTemplate;

std::vector<std::vector<ExternalTemplate> > m_vecExternalTemplate;

Expand Down
86 changes: 86 additions & 0 deletions L1Trigger/L1TGlobal/interface/ZdcEnergySumCondition.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#ifndef L1Trigger_L1TGlobal_ZdcEnergySumCondition_h
#define L1Trigger_L1TGlobal_ZdcEnergySumCondition_h

/**
* \class ZdcEnergySumCondition
*
*
* Description: evaluation of a CondZdcEnergySum condition.
*
* Implementation:
* <TODO: enter implementation details>
*
* \author: Vasile Mihai Ghete - HEPHY Vienna
*
*
*/

// system include files
#include <iosfwd>
#include <string>

// user include files
// base classes
#include "L1Trigger/L1TGlobal/interface/ConditionEvaluation.h"

// forward declarations
class GlobalCondition;
class ZdcEnergySumTemplate;

namespace l1t {

class L1Candidate;

class GlobalBoard;

// class declaration
class ZdcEnergySumCondition : public ConditionEvaluation {
public:
/// constructors
/// default
ZdcEnergySumCondition();

/// from base template condition (from event setup usually)
ZdcEnergySumCondition(const GlobalCondition*, const GlobalBoard*);

// copy constructor
ZdcEnergySumCondition(const ZdcEnergySumCondition&);

// destructor
~ZdcEnergySumCondition() override;

// assign operator
ZdcEnergySumCondition& operator=(const ZdcEnergySumCondition&);

public:
/// the core function to check if the condition matches
const bool evaluateCondition(const int bxEval) const override;

/// print condition
void print(std::ostream& myCout) const override;

public:
/// get / set the pointer to a L1GtCondition
inline const ZdcEnergySumTemplate* gtZdcEnergySumTemplate() const { return m_gtZdcEnergySumTemplate; }

void setGtZdcEnergySumTemplate(const ZdcEnergySumTemplate*);

/// get / set the pointer to uGt GlobalBoard
inline const GlobalBoard* getuGtB() const { return m_uGtB; }

void setuGtB(const GlobalBoard*);

private:
/// copy function for copy constructor and operator=
void copy(const ZdcEnergySumCondition& cp);

private:
/// pointer to a ZdcEnergySumTemplate
const ZdcEnergySumTemplate* m_gtZdcEnergySumTemplate;

/// pointer to uGt GlobalBoard, to be able to get the trigger objects
const GlobalBoard* m_uGtB;
};

} // namespace l1t
#endif
79 changes: 79 additions & 0 deletions L1Trigger/L1TGlobal/interface/ZdcEnergySumTemplate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#ifndef L1Trigger_L1TGlobal_ZdcEnergySumTemplate_h
#define L1Trigger_L1TGlobal_ZdcEnergySumTemplate_h

/**
* \class ZdcEnergySumTemplate
*
*
* Description: L1 Global Trigger energy-sum template.
*
* Implementation:
* <TODO: enter implementation details>
*
* \author: Vasile Mihai Ghete - HEPHY Vienna
*
* $Date$
* $Revision$
*
*/

// system include files
#include <string>
#include <iosfwd>

// user include files

// base class
#include "L1Trigger/L1TGlobal/interface/GlobalCondition.h"

// forward declarations

// class declaration
class ZdcEnergySumTemplate : public GlobalCondition {
public:
// constructor
ZdcEnergySumTemplate();

// constructor
ZdcEnergySumTemplate(const std::string&);

// constructor
ZdcEnergySumTemplate(const std::string&, const l1t::GtConditionType&);

// copy constructor
ZdcEnergySumTemplate(const ZdcEnergySumTemplate&);

// destructor
~ZdcEnergySumTemplate() override;

// assign operator
ZdcEnergySumTemplate& operator=(const ZdcEnergySumTemplate&);

public:
struct ObjectParameter {
unsigned int etLowThreshold;
unsigned int etHighThreshold;
};

public:
inline const std::vector<ObjectParameter>* objectParameter() const { return &m_objectParameter; }

/// set functions
void setConditionParameter(const std::vector<ObjectParameter>&);

/// print the condition
void print(std::ostream& myCout) const override;

/// output stream operator
friend std::ostream& operator<<(std::ostream&, const ZdcEnergySumTemplate&);

private:
/// copy function for copy constructor and operator=
void copy(const ZdcEnergySumTemplate& cp);

private:
/// variables containing the parameters
std::vector<ObjectParameter> m_objectParameter;
};

#endif
Loading

0 comments on commit c7e16b9

Please sign in to comment.