Commit 5cb73353 authored by Carlos Moreno Martinez's avatar Carlos Moreno Martinez Committed by Edward Moyse
Browse files

Add new multiplicity algorithms to L1Topo simulation

parent c7b26496
......@@ -5,8 +5,8 @@
// TopoCore
// Created by Carlos Moreno on 05/05/20.
#ifndef __TopoCore__EMMultiplicity__
#define __TopoCore__EMMultiplicity__
#ifndef __TopoCore__eEmMultiplicity__
#define __TopoCore__eEmMultiplicity__
#include <iostream>
#include <vector>
......@@ -19,10 +19,10 @@ class TH2;
namespace TCS {
class EMMultiplicity : public CountingAlg {
class eEmMultiplicity : public CountingAlg {
public:
EMMultiplicity(const std::string & name);
virtual ~EMMultiplicity();
eEmMultiplicity(const std::string & name);
virtual ~eEmMultiplicity();
virtual StatusCode initialize() override;
......
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
// EmMultiplicity.h
// TopoCore
// Created by Carlos Moreno on 17/09/21.
#ifndef __TopoCore__eTauMultiplicity__
#define __TopoCore__eTauMultiplicity__
#include <iostream>
#include <vector>
#include "L1TopoInterfaces/CountingAlg.h"
#include "L1TopoEvent/TOBArray.h"
#include "TrigConfData/L1Threshold.h"
class TH2;
namespace TCS {
class eTauMultiplicity : public CountingAlg {
public:
eTauMultiplicity(const std::string & name);
virtual ~eTauMultiplicity();
virtual StatusCode initialize() override;
virtual StatusCode processBitCorrect( const TCS::InputTOBArray & input,
Count & count ) override final ;
virtual StatusCode process( const TCS::InputTOBArray & input,
Count & count ) override final ;
private:
TrigConf::L1Threshold const * m_threshold{nullptr};
};
}
#endif
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
// EmMultiplicity.h
// TopoCore
// Created by Carlos Moreno on 17/09/21.
#ifndef __TopoCore__jJetMultiplicity__
#define __TopoCore__jJetMultiplicity__
#include <iostream>
#include <vector>
#include "L1TopoInterfaces/CountingAlg.h"
#include "L1TopoEvent/TOBArray.h"
#include "TrigConfData/L1Threshold.h"
class TH2;
namespace TCS {
class jJetMultiplicity : public CountingAlg {
public:
jJetMultiplicity(const std::string & name);
virtual ~jJetMultiplicity();
virtual StatusCode initialize() override;
virtual StatusCode processBitCorrect( const TCS::InputTOBArray & input,
Count & count ) override final ;
virtual StatusCode process( const TCS::InputTOBArray & input,
Count & count ) override final ;
private:
TrigConf::L1Threshold const * m_threshold{nullptr};
};
}
#endif
......@@ -2,7 +2,7 @@
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
/*********************************
* EMMultiplicity.cpp
* eEmMultiplicity.cpp
* Created by Carlos Moreno on 05/06/20.
*
* @brief algorithm that computes the multiplicity for a specified list and ET threshold
......@@ -14,7 +14,7 @@
#include <cmath>
#include "L1TopoAlgorithms/EMMultiplicity.h"
#include "L1TopoAlgorithms/eEmMultiplicity.h"
#include "L1TopoCommon/Exception.h"
#include "L1TopoInterfaces/Count.h"
......@@ -22,12 +22,12 @@
#include "L1TopoEvent/eEmTOBArray.h"
#include "L1TopoEvent/GenericTOB.h"
REGISTER_ALG_TCS(EMMultiplicity)
REGISTER_ALG_TCS(eEmMultiplicity)
using namespace std;
TCS::EMMultiplicity::EMMultiplicity(const std::string & name) : CountingAlg(name)
TCS::eEmMultiplicity::eEmMultiplicity(const std::string & name) : CountingAlg(name)
{
......@@ -35,19 +35,19 @@ TCS::EMMultiplicity::EMMultiplicity(const std::string & name) : CountingAlg(name
}
TCS::EMMultiplicity::~EMMultiplicity(){}
TCS::eEmMultiplicity::~eEmMultiplicity(){}
TCS::StatusCode
TCS::EMMultiplicity::initialize() {
TCS::eEmMultiplicity::initialize() {
m_threshold = getThreshold();
// book histograms
std::string hname_accept = "hEMMultiplicity_accept_"+m_threshold->name();
std::string hname_accept = "heEmMultiplicity_accept_"+m_threshold->name();
bookHist(m_histAccept, hname_accept, "eta vs pT", 150, -100, 100, 30, 0., 20.);
hname_accept = "hEMMultiplicity_accept_counts_"+m_threshold->name();
hname_accept = "heEmMultiplicity_accept_counts_"+m_threshold->name();
bookHist(m_histAccept, hname_accept, "Counts", 15, 0., 10. );
return StatusCode::SUCCESS;
......@@ -56,7 +56,7 @@ TCS::EMMultiplicity::initialize() {
TCS::StatusCode
TCS::EMMultiplicity::processBitCorrect( const TCS::InputTOBArray & input,
TCS::eEmMultiplicity::processBitCorrect( const TCS::InputTOBArray & input,
Count & count)
{
......@@ -64,7 +64,7 @@ TCS::EMMultiplicity::processBitCorrect( const TCS::InputTOBArray & input,
}
TCS::StatusCode
TCS::EMMultiplicity::process( const TCS::InputTOBArray & input,
TCS::eEmMultiplicity::process( const TCS::InputTOBArray & input,
Count & count )
{
......
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
/*********************************
* eTauMultiplicity.cpp
* Created by Carlos Moreno on 05/06/20.
*
* @brief algorithm that computes the multiplicity for a specified list and ET threshold
* line 1: 0 or 1, line 1 and 2 : 2 or more, uses 2 bits
*
* @param NumberLeading MinET
**********************************/
#include <cmath>
#include "L1TopoAlgorithms/eTauMultiplicity.h"
#include "L1TopoCommon/Exception.h"
#include "L1TopoInterfaces/Count.h"
#include "L1TopoEvent/TOBArray.h"
#include "L1TopoEvent/eTauTOBArray.h"
#include "L1TopoEvent/GenericTOB.h"
REGISTER_ALG_TCS(eTauMultiplicity)
using namespace std;
TCS::eTauMultiplicity::eTauMultiplicity(const std::string & name) : CountingAlg(name)
{
setNumberOutputBits(12); //To-Do: Make this flexible to addapt to the menu. Each counting requires more than one bit
}
TCS::eTauMultiplicity::~eTauMultiplicity(){}
TCS::StatusCode
TCS::eTauMultiplicity::initialize() {
m_threshold = getThreshold();
// book histograms
std::string hname_accept = "heTauMultiplicity_accept_"+m_threshold->name();
bookHist(m_histAccept, hname_accept, "eta vs pT", 150, -100, 100, 30, 0., 20.);
hname_accept = "heTauMultiplicity_accept_counts_"+m_threshold->name();
bookHist(m_histAccept, hname_accept, "Counts", 15, 0., 10. );
return StatusCode::SUCCESS;
}
TCS::StatusCode
TCS::eTauMultiplicity::processBitCorrect( const TCS::InputTOBArray & input,
Count & count)
{
return process(input, count);
}
TCS::StatusCode
TCS::eTauMultiplicity::process( const TCS::InputTOBArray & input,
Count & count )
{
// Grab the threshold and cast it into the right type
auto eTAUThr = dynamic_cast<const TrigConf::L1Threshold_eTAU &>(*m_threshold);
// Grab inputs
const eTauTOBArray & etaus = dynamic_cast<const eTauTOBArray&>(input);
int counting = 0;
// loop over input TOBs
for(eTauTOBArray::const_iterator etau = etaus.begin();
etau != etaus.end();
++etau ) {
const GenericTOB gtob(**etau);
// Dividing by 4 standing for converting eta from 0.025 to 0.1 granularity as it is defined in the menu as 0.1 gran.
bool passed = gtob.Et() >= eTAUThr.thrValueCounts(gtob.eta()/4);
if (passed) {
counting++;
fillHist2D( m_histAccept[0], gtob.eta(), gtob.EtDouble() );
}
}
fillHist1D( m_histAccept[1], counting);
// Pass counting to TCS::Count object - output bits are composed there
count.setSizeCount(counting);
return TCS::StatusCode::SUCCESS;
}
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
/*********************************
* jJetMultiplicity.cpp
* Created by Carlos Moreno on 17/09/21.
*
* @brief algorithm that computes the multiplicity for a specified list and ET threshold
* line 1: 0 or 1, line 1 and 2 : 2 or more, uses 2 bits
*
* @param NumberLeading MinET
**********************************/
#include <cmath>
#include "L1TopoAlgorithms/jJetMultiplicity.h"
#include "L1TopoCommon/Exception.h"
#include "L1TopoInterfaces/Count.h"
#include "L1TopoEvent/TOBArray.h"
#include "L1TopoEvent/jJetTOBArray.h"
#include "L1TopoEvent/GenericTOB.h"
REGISTER_ALG_TCS(jJetMultiplicity)
using namespace std;
TCS::jJetMultiplicity::jJetMultiplicity(const std::string & name) : CountingAlg(name)
{
setNumberOutputBits(12); //To-Do: Make this flexible to addapt to the menu. Each counting requires more than one bit
}
TCS::jJetMultiplicity::~jJetMultiplicity(){}
TCS::StatusCode
TCS::jJetMultiplicity::initialize() {
m_threshold = getThreshold();
// book histograms
std::string hname_accept = "hjJetMultiplicity_accept_"+m_threshold->name();
bookHist(m_histAccept, hname_accept, "eta vs pT", 150, -100, 100, 30, 0., 20.);
hname_accept = "hjJetMultiplicity_accept_counts_"+m_threshold->name();
bookHist(m_histAccept, hname_accept, "Counts", 15, 0., 10. );
return StatusCode::SUCCESS;
}
TCS::StatusCode
TCS::jJetMultiplicity::processBitCorrect( const TCS::InputTOBArray & input,
Count & count)
{
return process(input, count);
}
TCS::StatusCode
TCS::jJetMultiplicity::process( const TCS::InputTOBArray & input,
Count & count )
{
cout << "CARLOS: processing threshold " << m_threshold->name() << endl;
// Grab the threshold and cast it into the right type
auto jJThr = dynamic_cast<const TrigConf::L1Threshold_jJ &>(*m_threshold);
// Grab inputs
const jJetTOBArray & jjets = dynamic_cast<const jJetTOBArray&>(input);
int counting = 0;
// loop over input TOBs
for(jJetTOBArray::const_iterator jjet = jjets.begin();
jjet != jjets.end();
++jjet ) {
const GenericTOB gtob(**jjet);
// Dividing by 4 standing for converting eta from 0.025 to 0.1 granularity as it is defined in the menu as 0.1 gran.
bool passed = gtob.Et() >= jJThr.thrValueCounts(gtob.eta()/4);
if (passed) {
counting++;
fillHist2D( m_histAccept[0], gtob.eta(), gtob.EtDouble() );
}
}
fillHist1D( m_histAccept[1], counting);
// Pass counting to TCS::Count object - output bits are composed there
count.setSizeCount(counting);
return TCS::StatusCode::SUCCESS;
}
......@@ -35,7 +35,7 @@ TCS::inputType(const std::string& input) {
if ( input == "jEM" || input == "jEMTobArray" || input == "jEmTobs" )
return TCS::CLUSTER;
if ( input == "eTau" || input == "eTauTobArray" || input == "eTauTobs" )
if ( input == "eTAU" || input == "eTauTobArray" || input == "eTauTobs" )
return TCS::ETAU;
if ( input == "jTau" || input == "jTauTobArray" || input == "jTauTobs" )
......@@ -44,7 +44,7 @@ TCS::inputType(const std::string& input) {
if ( input == "Jets" || input == "JetTobArray" )
return TCS::JET;
if ( input == "jJet" || input == "jJetTobArray" || input == "jJetTobs" )
if ( input == "jJ" || input == "jJetTobArray" || input == "jJetTobs" )
return TCS::JJET;
if ( input == "jLargeRJet" || input == "jLargeRJetTobArray" || input == "jLargeRJetTobs" )
......
......@@ -222,37 +222,37 @@ TCS::TopoSteeringStructure::setupFromMenu(const TrigConf::L1Menu& l1menu, bool l
for( auto & tl : l1conn.triggerLines(0, 0) ) {
const string & tlName = tl.name();
auto & algo = l1menu.algorithmFromTriggerline(tlName);
const string & tlName = tl.name();
auto & algo = l1menu.algorithmFromTriggerline(tlName);
if (algo.klass() != "EMMultiplicity") continue; // Only multiplicity for EMs are defined in the menu
if ( (algo.klass() != "eEmMultiplicity") && (algo.klass() != "eTauMultiplicity") ) continue; // Only available multiplicity algorithms so far
auto it = find(storedConn.begin(), storedConn.end(), algo.name());
if (it == storedConn.end()) { // Algorithm/Connector does not exist: create and store it
storedConn.push_back(algo.name());
if(debug)
cout << "L1TopoSteering: Multiplicity algo( " << algo.name() << " ) has as input " << algo.inputs().at(0) << endl;
CountingConnector * conn = new CountingConnector(algo.name(), algo.inputs().at(0), algo.klass()+"/"+algo.name(), algo.outputs().at(0));
conn->m_count.setNBits( tl.nbits() );
conn->m_count.setFirstBit( tl.startbit() );
if(tl.name() != "UNDEF")
conn->m_triggers.push_back(tl);
if(debug)
cout << "Adding count connector " << "[" << *conn << "]" << endl;
addCountingConnector( conn );
confMultAlgorithms.push_back( algo.name() );
}
} // Trigger Line
} // Optical connectors - multiplicities
} // Connector in l1board
auto it = find(storedConn.begin(), storedConn.end(), algo.name());
if (it == storedConn.end()) { // Algorithm/Connector does not exist: create and store it
storedConn.push_back(algo.name());
if(debug)
cout << "L1TopoSteering: Multiplicity algo( " << algo.name() << " ) has as input " << algo.inputs().at(0) << endl;
CountingConnector * conn = new CountingConnector(algo.name(), algo.inputs().at(0), algo.klass()+"/"+algo.name(), algo.outputs().at(0));
conn->m_count.setNBits( tl.nbits() );
conn->m_count.setFirstBit( tl.startbit() );
if(tl.name() != "UNDEF")
conn->m_triggers.push_back(tl);
if(debug)
cout << "Adding count connector " << "[" << *conn << "]" << endl;
addCountingConnector( conn );
confMultAlgorithms.push_back( algo.name() );
}
} // Trigger Line
} // Optical connectors - multiplicities
} // Connector in l1board
} // Board in l1menu
......@@ -357,7 +357,7 @@ TCS::TopoSteeringStructure::setupFromMenu(const TrigConf::L1Menu& l1menu, bool l
auto & l1algo = l1menu.algorithm(multAlgo, "MULTTOPO");
if (l1algo.klass() != "EMMultiplicity") continue; // Look at eEM multiplicities for now, missing inputs in the menu for the other types of thresholds
if ( (l1algo.klass() != "eEmMultiplicity") && (l1algo.klass() != "eTauMultiplicity") ) continue; // Only available multiplicities for now
ConfigurableAlg * alg = AlgFactory::instance().algorithm(l1algo.name());
......
......@@ -284,9 +284,9 @@ class MultiplicityAlgo(TopoAlgo):
return confObj
class EMMultiplicityAlgo(MultiplicityAlgo):
class eEmMultiplicityAlgo(MultiplicityAlgo):
def __init__(self, name, algoId, threshold, nbits, classtype ):
super(EMMultiplicityAlgo, self).__init__(classtype=classtype, name=name,
super(eEmMultiplicityAlgo, self).__init__(classtype=classtype, name=name,
algoId=algoId,
threshold = threshold,
input=None, output="%s" % threshold,
......
......@@ -3,7 +3,7 @@
from AthenaCommon.Logging import logging
log = logging.getLogger(__name__)
from ..Base.TopoAlgos import EMMultiplicityAlgo, TauMultiplicityAlgo, JetMultiplicityAlgo, XEMultiplicityAlgo
from ..Base.TopoAlgos import eEmMultiplicityAlgo, TauMultiplicityAlgo, JetMultiplicityAlgo, XEMultiplicityAlgo
class TopoAlgoDefMultiplicity(object):
"""
......@@ -23,16 +23,16 @@ class TopoAlgoDefMultiplicity(object):
]
for em in emThresholds_3bits:
alg = EMMultiplicityAlgo( name = em,
alg = eEmMultiplicityAlgo( name = em,
algoId = currentAlgoId,
threshold = em,
nbits = 3, classtype='EMMultiplicity')
nbits = 3, classtype='eEmMultiplicity')
tm.registerTopoAlgo(alg)
for em in emThresholds_2bits:
alg = EMMultiplicityAlgo( name = em,
alg = eEmMultiplicityAlgo( name = em,
algoId = currentAlgoId,
threshold = em,
nbits = 2, classtype='EMMultiplicity')
nbits = 2, classtype='eEmMultiplicity')
tm.registerTopoAlgo(alg)
etauThresholds_3bits = [ 'eTAU8', 'eTAU12', ]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment