Commit 32cc8fde authored by Joerg Stelzer's avatar Joerg Stelzer
Browse files

Generation of L1 menu for run 3 (Part I)

First version (fairly complete) to generate the Run 3 L1 Menu. Main
points:
* The L1Menu and L1TopoMenu have been merged
* There are three directories:
  - L1/Menu for the menu definition
  - L1/Config for the threshold and item definition and cabling layout, and
  - L1/Base for classes to hold the menu in place

Start assembling an MC_pp_v8 menu. The menu remains split into 2 files,
a file Menu_x that defines the items, and a file Menu_x_inputs, which
defines the configuration of the topo boards, muctpi and ctpin. A third
Menu file exists for the legacy inputs.
parent 7d288c48
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
// ExclusiveJets.h
// TopoCore
// Created by Carlos Moreno based on InvariantMassInclusive1 by Joerg Stelzer on 11/16/12.
#ifndef __TopoCore__ExclusiveJets__
#define __TopoCore__ExclusiveJets__
#include <iostream>
#include "L1TopoInterfaces/DecisionAlg.h"
namespace TCS {
class ExclusiveJets : public DecisionAlg {
public:
ExclusiveJets(const std::string & name);
virtual ~ExclusiveJets();
virtual StatusCode initialize() override final;
virtual StatusCode processBitCorrect( const std::vector<TCS::TOBArray const *> & input,
const std::vector<TCS::TOBArray *> & output,
Decision & decison ) override final;
virtual StatusCode process( const std::vector<TCS::TOBArray const *> & input,
const std::vector<TCS::TOBArray *> & output,
Decision & decison ) override final;
private:
parType_t p_NumberLeading1 = { 0 };
parType_t p_MinET1[6] = { 0 ,0,0,0,0,0};
parType_t p_XiMin[6] = { 0,0,0,0,0,0 };
parType_t p_XiMax[6] = { 0,0,0,0,0,0 };
TH1 * m_histAcceptExclusiveJets[6] = {};
TH1 * m_histRejectExclusiveJets[6] = {};
};
}
#endif
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
// InvariantMassDeltaPhiInclusive.h
// TopoCore
// Based on InvariantMassInclusive2 and DeltaPhiIncl2 by Joerg Stelzer on 19/02/2019. For questions contact atlas-trig-l1topo-algcom@cern.ch.
// TO DO size of the input list to be possbly refined
#ifndef __TopoCore__InvariantMassDeltaPhiInclusive__
#define __TopoCore__InvariantMassDeltaPhiInclusive__
#include "L1TopoInterfaces/DecisionAlg.h"
class TH2;
namespace TCS {
class InvariantMassDeltaPhiInclusive : public DecisionAlg {
public:
InvariantMassDeltaPhiInclusive(const std::string & name);
virtual ~InvariantMassDeltaPhiInclusive();
virtual StatusCode initialize() override final;
virtual StatusCode processBitCorrect( const std::vector<TCS::TOBArray const *> & input,
const std::vector<TCS::TOBArray *> & output,
Decision & decison ) override final;
virtual StatusCode process( const std::vector<TCS::TOBArray const *> & input,
const std::vector<TCS::TOBArray *> & output,
Decision & decison ) override final;
private:
parType_t p_NumberLeading1 = { 0 };
parType_t p_NumberLeading2 = { 0 };
parType_t p_InvMassMin[6] = { 0,0,0,0,0,0 };
parType_t p_InvMassMax[6] = { 0,0,0,0,0,0 };
parType_t p_MinET1[6] = { 0,0,0,0,0,0 };
parType_t p_MinET2[6] = { 0,0,0,0,0,0 };
parType_t p_ApplyEtaCut = { 0 };
parType_t p_MinEta1 = { 0 };
parType_t p_MaxEta1 = { 0 };
parType_t p_MinEta2 = { 0 };
parType_t p_MaxEta2 = { 0 };
parType_t p_DeltaPhiMin[6] = { 0,0,0,0,0,0 };
parType_t p_DeltaPhiMax[6] = { 0,0,0,0,0,0 };
TH1 * m_histAcceptM[6] = {};
TH1 * m_histRejectM[6] = {};
TH1 * m_histAcceptDPhi[6] = {};
TH1 * m_histRejectDPhi[6] = {};
TH2 * m_histAcceptEta1Eta2[6] = {};
TH2 * m_histRejectEta1Eta2[6] = {};
};
}
#endif
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
// InvariantMassInclusive1DeltaRSqrIncl1.h
// TopoCore
// Based on InvariantMassInclusive1 and DeltaRSqrIncl1 created by Joerg Stelzer and V Sorin. 01/03/2019.
// For questions contact atlas-trig-l1topo-algcom@cern.ch.
#ifndef __TopoCore__InvariantMassInclusive1DeltaRSqrIncl1__
#define __TopoCore__InvariantMassInclusive1DeltaRSqrIncl1__
#include "L1TopoInterfaces/DecisionAlg.h"
namespace TCS {
class InvariantMassInclusive1DeltaRSqrIncl1 : public DecisionAlg {
public:
InvariantMassInclusive1DeltaRSqrIncl1(const std::string & name);
virtual ~InvariantMassInclusive1DeltaRSqrIncl1();
virtual StatusCode initialize() override final;
virtual StatusCode processBitCorrect( const std::vector<TCS::TOBArray const *> & input,
const std::vector<TCS::TOBArray *> & output,
Decision & decison ) override final;
virtual StatusCode process( const std::vector<TCS::TOBArray const *> & input,
const std::vector<TCS::TOBArray *> & output,
Decision & decison ) override final;
private:
parType_t p_NumberLeading1 = { 0 };
parType_t p_NumberLeading2 = { 0 };
parType_t p_InvMassMin[6] = { 0,0,0,0,0,0 };
parType_t p_InvMassMax[6] = { 0,0,0,0,0,0 };
parType_t p_MinET1[6] = { 0,0,0,0,0,0 };
parType_t p_MinET2[6] = { 0,0,0,0,0,0 };
parType_t p_OneBarrel = { 0 };
parType_t p_DeltaRMin[6] = { 0,0,0,0,0,0 };
parType_t p_DeltaRMax[6] = { 0,0,0,0,0,0 };
TH1 * m_histAcceptM[6] = {};
TH1 * m_histRejectM[6] = {};
TH1 * m_histAcceptDR[6] = {};
TH1 * m_histRejectDR[6] = {};
};
}
#endif
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
// InvariantMassInclusive2DeltaRSqrIncl2.h
// TopoCore
// Based on InvariantMassInclusive2 and DeltaRSqrIncl2 created by Joerg Stelzer and V Sorin. 01/03/2019/
// For questions contact atlas-trig-l1topo-algcom@cern.ch.
#ifndef __TopoCore__InvariantMassInclusive2DeltaRSqrIncl2__
#define __TopoCore__InvariantMassInclusive2DeltaRSqrIncl2__
#include "L1TopoInterfaces/DecisionAlg.h"
class TH2;
namespace TCS {
class InvariantMassInclusive2DeltaRSqrIncl2 : public DecisionAlg {
public:
InvariantMassInclusive2DeltaRSqrIncl2(const std::string & name);
virtual ~InvariantMassInclusive2DeltaRSqrIncl2();
virtual StatusCode initialize() override final;
virtual StatusCode processBitCorrect( const std::vector<TCS::TOBArray const *> & input,
const std::vector<TCS::TOBArray *> & output,
Decision & decison ) override final;
virtual StatusCode process( const std::vector<TCS::TOBArray const *> & input,
const std::vector<TCS::TOBArray *> & output,
Decision & decison ) override final;
private:
parType_t p_NumberLeading1 = { 0 };
parType_t p_NumberLeading2 = { 0 };
parType_t p_InvMassMin[6] = { 0,0,0,0,0,0 };
parType_t p_InvMassMax[6] = { 0,0,0,0,0,0 };
parType_t p_MinET1[6] = { 0,0,0,0,0,0 };
parType_t p_MinET2[6] = { 0,0,0,0,0,0 };
parType_t p_ApplyEtaCut = { 0 };
parType_t p_MinEta1 = { 0 };
parType_t p_MaxEta1 = { 0 };
parType_t p_MinEta2 = { 0 };
parType_t p_MaxEta2 = { 0 };
parType_t p_DeltaRMin[6] = { 0,0,0,0,0,0 };
parType_t p_DeltaRMax[6] = { 0,0,0,0,0,0 };
TH1 * m_histAcceptM[6] = {};
TH1 * m_histRejectM[6] = {};
TH1 * m_histAcceptDR[6] = {};
TH1 * m_histRejectDR[6] = {};
TH2 * m_histAcceptEta1Eta2[6] = {};
TH2 * m_histRejectEta1Eta2[6] = {};
};
}
#endif
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
// InvariantMassThreeTOBsIncl.h
// TopoCore
// Created by Carlos Moreno based on InvariantMassInclusive1 by Joerg Stelzer on 11/16/12.
#ifndef __TopoCore__InvariantMassThreeTOBsIncl__
#define __TopoCore__InvariantMassThreeTOBsIncl__
#include <iostream>
#include "L1TopoInterfaces/DecisionAlg.h"
namespace TCS {
class InvariantMassThreeTOBsIncl : public DecisionAlg {
public:
InvariantMassThreeTOBsIncl(const std::string & name);
virtual ~InvariantMassThreeTOBsIncl();
virtual StatusCode initialize() override final;
virtual StatusCode processBitCorrect( const std::vector<TCS::TOBArray const *> & input,
const std::vector<TCS::TOBArray *> & output,
Decision & decison ) override final;
virtual StatusCode process( const std::vector<TCS::TOBArray const *> & input,
const std::vector<TCS::TOBArray *> & output,
Decision & decison ) override final;
private:
parType_t p_NumberLeading1 = { 0 };
parType_t p_InvMassMin[6] = {0, 0, 0,0,0,0};
parType_t p_InvMassMax[6] = {0, 0, 0,0,0,0};
parType_t p_MinET1[6] = { 0 ,0,0,0,0,0};
parType_t p_OneBarrel = { 0 };
TH1 * m_histAcceptINVThree[6] = {};
TH1 * m_histRejectINVThree[6] = {};
};
}
#endif
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
/*********************************
* ExclusiveJets.cxx
* Created by Carlos Moreno based on InvariantMassInclusive1 by V Sorin
*
* For questions contact atlas-trig-l1topo-algcom@cern.ch.
* @brief algorithm for exclusive jets acceptance
*
* @param NumberLeading
*
**********************************/
#include <cmath>
#include <string>
#include <iostream>
#include <sstream>
#include <vector>
#include "TH1F.h"
#include "TH2F.h"
#include "L1TopoAlgorithms/ExclusiveJets.h"
#include "L1TopoCommon/Exception.h"
#include "L1TopoInterfaces/Decision.h"
// Bitwise implementation utils
#include "L1TopoSimulationUtils/L1TopoDataTypes.h"
#include "L1TopoSimulationUtils/Trigo.h"
#include "L1TopoSimulationUtils/Hyperbolic.h"
#include "L1TopoSimulationUtils/Kinematics.h"
//
REGISTER_ALG_TCS(ExclusiveJets)
using namespace std;
TCS::ExclusiveJets::ExclusiveJets(const string & name) : DecisionAlg(name)
{
defineParameter("InputWidth", 3);
defineParameter("MaxTob", 0);
defineParameter("NumResultBits", 6);
defineParameter("MinXi", 0, 0);
defineParameter("MaxXi", 999, 0);
defineParameter("MinXi", 0, 1);
defineParameter("MaxXi", 999, 1);
defineParameter("MinXi", 0, 2);
defineParameter("MaxXi", 999, 2);
defineParameter("MinXi", 0, 3);
defineParameter("MaxXi", 999, 3);
defineParameter("MinXi", 0, 4);
defineParameter("MaxXi", 999, 4);
defineParameter("MinXi", 0, 5);
defineParameter("MaxXi", 999, 5);
defineParameter("MinET1",0,0);
defineParameter("MinET1",0,1);
defineParameter("MinET1",0,2);
defineParameter("MinET1",0,3);
defineParameter("MinET1",0,4);
defineParameter("MinET1",0,5);
setNumberOutputBits(6);
}
TCS::ExclusiveJets::~ExclusiveJets(){}
TCS::StatusCode
TCS::ExclusiveJets::initialize() {
if(parameter("MaxTob").value() > 0) {
p_NumberLeading1 = parameter("MaxTob").value();
} else {
p_NumberLeading1 = parameter("InputWidth").value();
}
for(unsigned int i=0; i<numberOutputBits(); ++i) {
p_XiMin[i] = parameter("MinXi", i).value();
p_XiMax[i] = parameter("MaxXi", i).value();
p_MinET1[i] = parameter("MinET1",i).value();
}
TRG_MSG_INFO("NumberLeading1 : " << p_NumberLeading1);
for(unsigned int i=0; i<numberOutputBits(); ++i) {
TRG_MSG_INFO("XiMin : " << p_XiMin[i]);
TRG_MSG_INFO("XiMax : " << p_XiMax[i]);
TRG_MSG_INFO("MinET1 : " << p_MinET1[i]);
}
TRG_MSG_INFO("number output : " << numberOutputBits());
for (unsigned int i=0; i<numberOutputBits();i++) {
const int buf_len = 512;
char hname_accept[buf_len], hname_reject[buf_len];
int xi_min = p_XiMin[i];
int xi_max = p_XiMax[i];
// mass histograms
snprintf(hname_accept, buf_len, "Accept_%s_%s_bit%d_%dM%d", name().c_str(), className().c_str(), i, xi_min, xi_max);
snprintf(hname_reject, buf_len, "Reject_%s_%s_bit%d_%dM%d", name().c_str(), className().c_str(), i, xi_min, xi_max);
registerHist(m_histAcceptExclusiveJets[i] = new TH1F(hname_accept, hname_accept, 100, 0.0, 2*xi_max));
registerHist(m_histRejectExclusiveJets[i] = new TH1F(hname_reject, hname_reject, 100, 0.0, 2*xi_max));
}
return StatusCode::SUCCESS;
}
TCS::StatusCode
TCS::ExclusiveJets::processBitCorrect( const vector<TCS::TOBArray const *> & input,
const vector<TCS::TOBArray *> & output,
Decision & decision ) // Not really bitwise, keep the name for the future
{
if(input.size() == 1) {
for( TOBArray::const_iterator tob1 = input[0]->begin();
tob1 != input[0]->end() && distance( input[0]->begin(), tob1) < p_NumberLeading1;
++tob1)
{
TCS::TOBArray::const_iterator tob2 = tob1; ++tob2;
for( ;
tob2 != input[0]->end() && distance( input[0]->begin(), tob2) < p_NumberLeading1;
++tob2) {
double xi_1 = (1.4*parType_t((*tob1)->Et())+20.)*exp(parType_t((*tob1)->eta()))+(1.4*parType_t((*tob2)->Et())+20.)*exp(parType_t((*tob2)->eta()));
double xi_2 = (1.4*parType_t((*tob1)->Et())+20.)*exp(-1.*parType_t((*tob1)->eta()))+(1.4*parType_t((*tob2)->Et())+20.)*exp(-1.*parType_t((*tob2)->eta()));
for(unsigned int i=0; i<numberOutputBits(); ++i) {
bool accept = false;
if( parType_t((*tob1)->Et()) <= p_MinET1[i]) continue; // ET cut
if( parType_t((*tob2)->Et()) <= p_MinET1[i]) continue; // ET cut
accept = (xi_1 >p_XiMin[i]) && (xi_1 < p_XiMax[i]) && (xi_2 > p_XiMin[i]) && (xi_2 < p_XiMax[i]); //
const bool fillAccept = fillHistos() and (fillHistosBasedOnHardware() ? getDecisionHardwareBit(i) : accept);
const bool fillReject = fillHistos() and not fillAccept;
const bool alreadyFilled = decision.bit(i);
if( accept ) {
decision.setBit(i, true);
output[i]->push_back( TCS::CompositeTOB(*tob1, *tob2) );
}
if(fillAccept and not alreadyFilled) {
m_histAcceptExclusiveJets[i]->Fill(xi_1);
} else if(fillReject) {
m_histRejectExclusiveJets[i]->Fill(xi_1);
}
TRG_MSG_INFO("Decision " << i << ": " << (accept?"pass":"fail") << " xi_1 = " << xi_1);
}
}
}
} else {
TCS_EXCEPTION("ExclusiveJets alg must have 1 input list, but got " << input.size());
}
return TCS::StatusCode::SUCCESS;
}
TCS::StatusCode
TCS::ExclusiveJets::process( const vector<TCS::TOBArray const *> & input,
const vector<TCS::TOBArray *> & output,
Decision & decision )
{
if(input.size() == 1) {
for( TOBArray::const_iterator tob1 = input[0]->begin();
tob1 != input[0]->end() && distance( input[0]->begin(), tob1) < p_NumberLeading1;
++tob1)
{
TCS::TOBArray::const_iterator tob2 = tob1; ++tob2;
for( ;
tob2 != input[0]->end() && distance( input[0]->begin(), tob2) < p_NumberLeading1;
++tob2) {
double xi_1 = (1.4*parType_t((*tob1)->Et())+20.)*exp(parType_t((*tob1)->eta()))+(1.4*parType_t((*tob2)->Et())+20.)*exp(parType_t((*tob2)->eta()));
double xi_2 = (1.4*parType_t((*tob1)->Et())+20.)*exp(-1.*parType_t((*tob1)->eta()))+(1.4*parType_t((*tob2)->Et())+20.)*exp(-1.*parType_t((*tob2)->eta()));
for(unsigned int i=0; i<numberOutputBits(); ++i) {
bool accept = false;
if( parType_t((*tob1)->Et()) <= p_MinET1[i]) continue; // ET cut
if( parType_t((*tob2)->Et()) <= p_MinET1[i]) continue; // ET cut
accept = (xi_1 > p_XiMin[i]) && (xi_1 < p_XiMax[i]) && (xi_2 > p_XiMin[i]) && (xi_2 < p_XiMax[i]); //
const bool fillAccept = fillHistos() and (fillHistosBasedOnHardware() ? getDecisionHardwareBit(i) : accept);
const bool fillReject = fillHistos() and not fillAccept;
const bool alreadyFilled = decision.bit(i);
if( accept ) {
decision.setBit(i, true);
output[i]->push_back( TCS::CompositeTOB(*tob1, *tob2) );
}
if(fillAccept and not alreadyFilled) {
m_histAcceptExclusiveJets[i]->Fill(xi_1);
} else if(fillReject) {
m_histRejectExclusiveJets[i]->Fill(xi_1);
}
TRG_MSG_INFO("Decision " << i << ": " << (accept?"pass":"fail") << " xi_1 = " << xi_1);
}
}
}
} else {
TCS_EXCEPTION("ExclusiveJets alg must have 1 input list, but got " << input.size());
}
return TCS::StatusCode::SUCCESS;
}
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
/*********************************
* InvariantMassDeltaPhiInclusive.cxx
* Based on V Sorin 2014 implementation of InvariantMassInclusive2. For questions contact atlas-trig-l1topo-algcom@cern.ch.
*
* @brief algorithm calculates the sqr of the INVMASS between two lists and applies invmass criteria. For pairs passing the INVMASS cut a further requirement based on DeltaPhi
* is applied, addressing ATR-19377
*
**********************************/
// TO DO size of the input list to be possbly refined
#include "L1TopoAlgorithms/InvariantMassDeltaPhiInclusive.h"
#include "L1TopoCommon/Exception.h"
#include "L1TopoInterfaces/Decision.h"
// Bitwise implementation utils
#include "L1TopoSimulationUtils/L1TopoDataTypes.h"
#include "L1TopoSimulationUtils/Trigo.h"
#include "L1TopoSimulationUtils/Hyperbolic.h"
#include "L1TopoSimulationUtils/Kinematics.h"
//
#include "TH1F.h"
#include "TH2F.h"
#include <cmath>
REGISTER_ALG_TCS(InvariantMassDeltaPhiInclusive)
using namespace std;
TCS::InvariantMassDeltaPhiInclusive::InvariantMassDeltaPhiInclusive(const std::string & name) : DecisionAlg(name)
{
defineParameter("InputWidth1", 9);
defineParameter("InputWidth2", 9);
defineParameter("MaxTob1", 0);
defineParameter("MaxTob2", 0);
defineParameter("NumResultBits", 6);
defineParameter("MinMSqr", 0, 0);
defineParameter("MaxMSqr", 999, 0);
defineParameter("MinMSqr", 0, 1);
defineParameter("MaxMSqr", 999, 1);
defineParameter("MinMSqr", 0, 2);
defineParameter("MaxMSqr", 999, 2);
defineParameter("MinMSqr", 0, 3);
defineParameter("MaxMSqr", 999, 3);
defineParameter("MinMSqr", 0, 4);
defineParameter("MaxMSqr", 999, 4);
defineParameter("MinMSqr", 0, 5);
defineParameter("MaxMSqr", 999, 5);
defineParameter("MinET1",0,0);
defineParameter("MinET2",0,0);
defineParameter("MinET1",0,1);
defineParameter("MinET2",0,1);
defineParameter("MinET1",0,2);
defineParameter("MinET2",0,2);
defineParameter("MinET1",0,3);
defineParameter("MinET2",0,3);
defineParameter("MinET1",0,4);
defineParameter("MinET2",0,4);
defineParameter("MinET1",0,5);
defineParameter("MinET2",0,5);
defineParameter("ApplyEtaCut", 0);
defineParameter("MinEta1", 0);
defineParameter("MaxEta1", 31);
defineParameter("MinEta2", 0);
defineParameter("MaxEta2", 31);
defineParameter("MinDeltaPhi", 0, 0);