Skip to content
Snippets Groups Projects
Commit 64f46d90 authored by Walter Lampl's avatar Walter Lampl
Browse files

Merge branch 'L1TopoBW' into 'master'

L1Topo BW Simulation Update-I

See merge request atlas/athena!42049
parents 487e1113 bb9b7bd2
No related branches found
No related tags found
No related merge requests found
Showing
with 1725 additions and 349 deletions
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "L1TopoAlgorithms/ExclusiveJets.h" #include "L1TopoAlgorithms/ExclusiveJets.h"
#include "L1TopoCommon/Exception.h" #include "L1TopoCommon/Exception.h"
#include "L1TopoInterfaces/Decision.h" #include "L1TopoInterfaces/Decision.h"
#include "L1TopoSimulationUtils/Kinematics.h"
REGISTER_ALG_TCS(ExclusiveJets) REGISTER_ALG_TCS(ExclusiveJets)
...@@ -113,8 +114,8 @@ TCS::ExclusiveJets::processBitCorrect( const std::vector<TCS::TOBArray const *> ...@@ -113,8 +114,8 @@ TCS::ExclusiveJets::processBitCorrect( const std::vector<TCS::TOBArray const *>
//In the ticket ATR-17320, pT_offline were defined as A*pT_L1+B, where A=1.4 and B=20 for run2 //In the ticket ATR-17320, pT_offline were defined as A*pT_L1+B, where A=1.4 and B=20 for run2
//A and B definition might change according to run3 configuration. //A and B definition might change according to run3 configuration.
double xi_1 = (1.4*parType_t((*tob1)->Et())+20.)*exp((*tob1)->etaDouble())+(1.4*parType_t((*tob2)->Et())+20.)*exp((*tob2)->etaDouble()); unsigned int xi_1 = TSU::Kinematics::calcXi1(*tob1,*tob2);
double xi_2 = (1.4*parType_t((*tob1)->Et())+20.)*exp(-1.*(*tob1)->etaDouble())+(1.4*parType_t((*tob2)->Et())+20.)*exp(-1.*(*tob2)->etaDouble()); unsigned int xi_2 = TSU::Kinematics::calcXi2(*tob1,*tob2);
const int eta1 = (*tob1)->eta(); const int eta1 = (*tob1)->eta();
const int eta2 = (*tob2)->eta(); const int eta2 = (*tob2)->eta();
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "L1TopoCommon/Exception.h" #include "L1TopoCommon/Exception.h"
#include "L1TopoInterfaces/Decision.h" #include "L1TopoInterfaces/Decision.h"
#include "L1TopoSimulationUtils/KFLUT.h" #include "L1TopoSimulationUtils/KFLUT.h"
#include "L1TopoSimulationUtils/Kinematics.h"
// Bitwise implementation utils // Bitwise implementation utils
#include "L1TopoSimulationUtils/L1TopoDataTypes.h" #include "L1TopoSimulationUtils/L1TopoDataTypes.h"
#include "L1TopoSimulationUtils/Trigo.h" #include "L1TopoSimulationUtils/Trigo.h"
...@@ -24,8 +25,6 @@ ...@@ -24,8 +25,6 @@
REGISTER_ALG_TCS(KalmanMETCorrection) REGISTER_ALG_TCS(KalmanMETCorrection)
using namespace std;
TCS::KalmanMETCorrection::KalmanMETCorrection(const std::string & name) : DecisionAlg(name) TCS::KalmanMETCorrection::KalmanMETCorrection(const std::string & name) : DecisionAlg(name)
{ {
defineParameter("InputWidth", 9); defineParameter("InputWidth", 9);
...@@ -107,11 +106,19 @@ TCS::KalmanMETCorrection::processBitCorrect( const std::vector<TCS::TOBArray con ...@@ -107,11 +106,19 @@ TCS::KalmanMETCorrection::processBitCorrect( const std::vector<TCS::TOBArray con
corrfactor = LUTobj.getcorrKF(ipt,jeta); corrfactor = LUTobj.getcorrKF(ipt,jeta);
// This part of the code has to be reviewed again for phase1 BW simulation // This part of the code has to be reviewed again for phase1 BW simulation
auto cosphi = TSU::L1TopoDataTypes<9,7>(TSU::Trigo::Cos.at(/*abs*/(parType_t((*tob)->phi())))); float cosphi;
auto sinphi = TSU::L1TopoDataTypes<9,7>(TSU::Trigo::Sin.at(/*abs*/(parType_t((*tob)->phi())))); float sinphi;
if (isLegacyTopo()){
summetx += (-1.)*(*tob)->Et()*float(cosphi)*corrfactor ; cosphi = TSU::Kinematics::calcCosLegacy((*tob)->phi());
summety += (-1.)*(*tob)->Et()*float(sinphi)*corrfactor ; sinphi = TSU::Kinematics::calcSinLegacy((*tob)->phi());
}
else {
cosphi = TSU::Kinematics::calcCos((*tob)->phi());
sinphi = TSU::Kinematics::calcSin((*tob)->phi());
}
summetx += (-1.)*(*tob)->Et()*cosphi*corrfactor ;
summety += (-1.)*(*tob)->Et()*sinphi*corrfactor ;
TRG_MSG_DEBUG("corr " << corrfactor); TRG_MSG_DEBUG("corr " << corrfactor);
...@@ -123,7 +130,7 @@ TCS::KalmanMETCorrection::processBitCorrect( const std::vector<TCS::TOBArray con ...@@ -123,7 +130,7 @@ TCS::KalmanMETCorrection::processBitCorrect( const std::vector<TCS::TOBArray con
KFmet = sqrt(summetx*summetx + summety*summety); KFmet = sqrt(summetx*summetx + summety*summety);
if (KFmet > 0 ) KFmetphi= TSU::Trigo::atan2(summetx,summety); if (KFmet > 0 ) KFmetphi=isLegacyTopo()?TSU::Trigo::atan2leg(summetx,summety):TSU::Trigo::atan2(summetx,summety);
for(unsigned int i=0; i<numberOutputBits(); ++i) { for(unsigned int i=0; i<numberOutputBits(); ++i) {
......
...@@ -49,7 +49,7 @@ TCS::MetSort::sortBitCorrect(const InputTOBArray & input, TOBArray & output) { ...@@ -49,7 +49,7 @@ TCS::MetSort::sortBitCorrect(const InputTOBArray & input, TOBArray & output) {
const MetTOBArray & mets = dynamic_cast<const MetTOBArray&>(input); const MetTOBArray & mets = dynamic_cast<const MetTOBArray&>(input);
int missingET = quadraticSumBW(mets[0].Ex(), mets[0].Ey()); int missingET = quadraticSumBW(mets[0].Ex(), mets[0].Ey());
int metphi = TSU::Trigo::atan2(mets[0].Ex(),mets[0].Ey()); int metphi = isLegacyTopo()?TSU::Trigo::atan2leg(mets[0].Ex(),mets[0].Ey()):TSU::Trigo::atan2(mets[0].Ex(),mets[0].Ey());
TRG_MSG_DEBUG("MET phi values " << metphi << " " ); TRG_MSG_DEBUG("MET phi values " << metphi << " " );
output.push_back( GenericTOB( missingET, 0, metphi ) ); output.push_back( GenericTOB( missingET, 0, metphi ) );
......
...@@ -101,7 +101,7 @@ int run(int argc, const char* argv[]) { ...@@ -101,7 +101,7 @@ int run(int argc, const char* argv[]) {
// read the menu // read the menu
TrigConf::L1Menu l1menu; TrigConf::L1Menu l1menu;
TrigConf::JsonFileLoader fileLoader; TrigConf::JsonFileLoader fileLoader;
fileLoader.loadFile(argv[1], l1menu); fileLoader.loadFile(argv[1], l1menu);
//TFile *f = new TFile(argc>=4 ? argv[3] : "L1TopoSimulation.root","RECREATE"); //TFile *f = new TFile(argc>=4 ? argv[3] : "L1TopoSimulation.root","RECREATE");
...@@ -122,7 +122,8 @@ fileLoader.loadFile(argv[1], l1menu); ...@@ -122,7 +122,8 @@ fileLoader.loadFile(argv[1], l1menu);
// instantiate steering // instantiate steering
TCS::TopoSteering steering; TCS::TopoSteering steering;
steering.setUseBitwise(false); steering.setUseBitwise(true);
steering.setLegacyMode(false);
steering.setupFromConfiguration(l1menu); steering.setupFromConfiguration(l1menu);
steering.setMsgLevel( msgLvl ); steering.setMsgLevel( msgLvl );
......
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#ifndef EXPO_H
#define EXPO_H
#include <string>
#include <vector>
#include <unordered_map>
#include "L1TopoSimulationUtils/L1TopoDataTypes.h"
namespace TSU {
struct Expo{
static const std::unordered_map<int,std::string> E;
};
}
#endif
/* /*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/ */
/********************************* /*********************************
* Hyperbolic.h * Hyperbolic.h
...@@ -15,11 +15,13 @@ ...@@ -15,11 +15,13 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <unordered_map>
#include "L1TopoSimulationUtils/L1TopoDataTypes.h" #include "L1TopoSimulationUtils/L1TopoDataTypes.h"
namespace TSU { namespace TSU {
struct Hyperbolic{ struct Hyperbolic{
static const std::vector<std::string> Cosh; static const std::unordered_map<unsigned,std::string> Coshleg;
static const std::unordered_map<unsigned,std::string> Cosh;
}; };
} }
#endif #endif
...@@ -22,12 +22,18 @@ namespace TSU { ...@@ -22,12 +22,18 @@ namespace TSU {
static unsigned int calcInvMassBWLegacy(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2); static unsigned int calcInvMassBWLegacy(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2);
static unsigned int calcTMassBWLegacy(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2); static unsigned int calcTMassBWLegacy(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2);
static unsigned int calcDeltaR2BWLegacy(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2); static unsigned int calcDeltaR2BWLegacy(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2);
static float calcCosLegacy(unsigned phi);
static float calcSinLegacy(unsigned phi);
static unsigned int calcDeltaPhiBW(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2); static unsigned int calcDeltaPhiBW(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2);
static unsigned int calcDeltaEtaBW(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2); static unsigned int calcDeltaEtaBW(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2);
static unsigned int calcInvMassBW(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2); static unsigned int calcInvMassBW(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2);
static unsigned int calcTMassBW(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2); static unsigned int calcTMassBW(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2);
static unsigned int calcDeltaR2BW(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2); static unsigned int calcDeltaR2BW(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2);
static unsigned int calcXi1(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2);
static unsigned int calcXi2(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2);
static float calcCos(unsigned phi);
static float calcSin(unsigned phi);
/** /**
@brief compute the sum in quadrature of two ints @brief compute the sum in quadrature of two ints
......
/* /*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/ */
/********************************* /*********************************
* Trigo.h * Trigo.h
...@@ -15,13 +15,17 @@ ...@@ -15,13 +15,17 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <unordered_map>
#include "L1TopoDataTypes.h" #include "L1TopoDataTypes.h"
namespace TSU { namespace TSU {
struct Trigo{ struct Trigo{
static const std::vector<std::string> Cos; static const std::unordered_map<unsigned,std::string> Cosleg;
static const std::vector<std::string> Sin; static const std::unordered_map<unsigned,std::string> Sinleg;
static int atan2(TSU::L1TopoDataTypes<16,0> x, TSU::L1TopoDataTypes<16,0> y); static const std::unordered_map<unsigned,std::string> Cos;
static const std::unordered_map<unsigned,std::string> Sin;
static int atan2leg(TSU::L1TopoDataTypes<16,0> x, TSU::L1TopoDataTypes<16,0> y);
static int atan2(TSU::L1TopoDataTypes<16,0> x, TSU::L1TopoDataTypes<16,0> y);
}; };
} }
#endif #endif
This diff is collapsed.
...@@ -83,6 +83,10 @@ void TCS::KFLUT::fillLUT(){ ...@@ -83,6 +83,10 @@ void TCS::KFLUT::fillLUT(){
LUTKF.push_back(v3); LUTKF.push_back(v3);
LUTKF.push_back(v4); LUTKF.push_back(v4);
//Correction for rounding when 7 decimal bit applied
for (auto &vet : LUTKF){
for (auto &veta : vet){
veta = std::round(veta*std::pow(2,7))/std::pow(2,7);
}
}
} }
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "L1TopoSimulationUtils/Hyperbolic.h" #include "L1TopoSimulationUtils/Hyperbolic.h"
#include "L1TopoSimulationUtils/L1TopoDataTypes.h" #include "L1TopoSimulationUtils/L1TopoDataTypes.h"
#include "L1TopoSimulationUtils/Trigo.h" #include "L1TopoSimulationUtils/Trigo.h"
#include "L1TopoSimulationUtils/Expo.h"
#include "L1TopoEvent/GenericTOB.h" #include "L1TopoEvent/GenericTOB.h"
...@@ -32,7 +33,7 @@ unsigned int TSU::Kinematics::calcDeltaEtaBWLegacy(const TCS::GenericTOB* tob1, ...@@ -32,7 +33,7 @@ unsigned int TSU::Kinematics::calcDeltaEtaBWLegacy(const TCS::GenericTOB* tob1,
unsigned int TSU::Kinematics::calcInvMassBWLegacy(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2){ unsigned int TSU::Kinematics::calcInvMassBWLegacy(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2){
auto bit_cosheta = TSU::L1TopoDataTypes<19,7>(TSU::Hyperbolic::Cosh.at(std::abs(tob1->eta() - tob2->eta()))); auto bit_cosheta = TSU::L1TopoDataTypes<19,7>(TSU::Hyperbolic::Coshleg.at(std::abs(tob1->eta() - tob2->eta())));
//In case of EM objects / jets / taus the phi angle goes between 0 and 64 while muons are between -32 and 32, applying a shift to keep delta-phi in the allowed range. //In case of EM objects / jets / taus the phi angle goes between 0 and 64 while muons are between -32 and 32, applying a shift to keep delta-phi in the allowed range.
int phi_tob1 = tob1->phi(); int phi_tob1 = tob1->phi();
int phi_tob2 = tob2->phi(); int phi_tob2 = tob2->phi();
...@@ -42,7 +43,7 @@ unsigned int TSU::Kinematics::calcInvMassBWLegacy(const TCS::GenericTOB* tob1, c ...@@ -42,7 +43,7 @@ unsigned int TSU::Kinematics::calcInvMassBWLegacy(const TCS::GenericTOB* tob1, c
if(phi_tob1 >= 32) phi_tob1 = phi_tob1-64; if(phi_tob1 >= 32) phi_tob1 = phi_tob1-64;
if(phi_tob2 >= 32) phi_tob2 = phi_tob2-64; if(phi_tob2 >= 32) phi_tob2 = phi_tob2-64;
} }
auto bit_cosphi = TSU::L1TopoDataTypes<9,7>(TSU::Trigo::Cos.at(std::abs( phi_tob1 - phi_tob2 ))); auto bit_cosphi = TSU::L1TopoDataTypes<9,7>(TSU::Trigo::Cosleg.at(std::abs( phi_tob1 - phi_tob2 )));
TSU::L1TopoDataTypes<11,0> bit_Et1(tob1->Et()); TSU::L1TopoDataTypes<11,0> bit_Et1(tob1->Et());
TSU::L1TopoDataTypes<11,0> bit_Et2(tob2->Et()); TSU::L1TopoDataTypes<11,0> bit_Et2(tob2->Et());
auto bit_invmass2 = bit_Et1*bit_Et2*(bit_cosheta - bit_cosphi)*2; auto bit_invmass2 = bit_Et1*bit_Et2*(bit_cosheta - bit_cosphi)*2;
...@@ -50,7 +51,7 @@ unsigned int TSU::Kinematics::calcInvMassBWLegacy(const TCS::GenericTOB* tob1, c ...@@ -50,7 +51,7 @@ unsigned int TSU::Kinematics::calcInvMassBWLegacy(const TCS::GenericTOB* tob1, c
} }
unsigned int TSU::Kinematics::calcTMassBWLegacy(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2) { unsigned int TSU::Kinematics::calcTMassBWLegacy(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2) {
auto bit_cosphi = TSU::L1TopoDataTypes<9,7>(TSU::Trigo::Cos.at(std::abs(tob1->phi() - tob2->phi()))); auto bit_cosphi = TSU::L1TopoDataTypes<9,7>(TSU::Trigo::Cosleg.at(std::abs(tob1->phi() - tob2->phi())));
TSU::L1TopoDataTypes<11,0> bit_Et1(tob1->Et()); TSU::L1TopoDataTypes<11,0> bit_Et1(tob1->Et());
TSU::L1TopoDataTypes<11,0> bit_Et2(tob2->Et()); TSU::L1TopoDataTypes<11,0> bit_Et2(tob2->Et());
TSU::L1TopoDataTypes<22,0> bit_tmass2 = 2*bit_Et1*bit_Et2*(1. - bit_cosphi); TSU::L1TopoDataTypes<22,0> bit_tmass2 = 2*bit_Et1*bit_Et2*(1. - bit_cosphi);
...@@ -70,6 +71,14 @@ unsigned int TSU::Kinematics::calcDeltaR2BWLegacy(const TCS::GenericTOB* tob1, c ...@@ -70,6 +71,14 @@ unsigned int TSU::Kinematics::calcDeltaR2BWLegacy(const TCS::GenericTOB* tob1, c
return bit_dr2; return bit_dr2;
} }
float TSU::Kinematics::calcCosLegacy(unsigned phi){
return float(TSU::L1TopoDataTypes<9,7>(TSU::Trigo::Cosleg.at(phi)));
}
float TSU::Kinematics::calcSinLegacy(unsigned phi){
return float(TSU::L1TopoDataTypes<9,7>(TSU::Trigo::Sinleg.at(phi)));
}
unsigned int TSU::Kinematics::calcDeltaPhiBW(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2){ unsigned int TSU::Kinematics::calcDeltaPhiBW(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2){
int dphiB = std::abs( tob1->phi() - tob2->phi() ); int dphiB = std::abs( tob1->phi() - tob2->phi() );
if(dphiB>64) if(dphiB>64)
...@@ -87,25 +96,26 @@ unsigned int TSU::Kinematics::calcDeltaEtaBW(const TCS::GenericTOB* tob1, const ...@@ -87,25 +96,26 @@ unsigned int TSU::Kinematics::calcDeltaEtaBW(const TCS::GenericTOB* tob1, const
unsigned int TSU::Kinematics::calcInvMassBW(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2){ unsigned int TSU::Kinematics::calcInvMassBW(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2){
auto bit_cosheta = TSU::L1TopoDataTypes<19,7>(TSU::Hyperbolic::Cosh.at(std::abs(tob1->eta() - tob2->eta()))); auto bit_cosheta = TSU::L1TopoDataTypes<14,10>(TSU::Hyperbolic::Cosh.at(100*std::abs(tob1->eta() - tob2->eta())));
//In case of EM objects / jets / taus the phi angle goes between 0 and 64 while muons are between -32 and 32, applying a shift to keep delta-phi in the allowed range. //In case of EM objects / jets / taus the phi angle goes between 0 and 64 while muons are between -32 and 32, applying a shift to keep delta-phi in the allowed range.
//those cases should happen only in mixed EM/jets/tau plus mu triggers, if both phi's are in [0,2pi] will not get in
int phi_tob1 = tob1->phi(); int phi_tob1 = tob1->phi();
int phi_tob2 = tob2->phi(); int phi_tob2 = tob2->phi();
//those cases should happen only in mixed EM/jets/tau plus mu triggers, if both phi's are in [0,2pi] will not get in
if ( std::abs(phi_tob1-phi_tob2)>=64 ) if ( std::abs(phi_tob1-phi_tob2)>=64 )
{ {
if(phi_tob1 >= 32) phi_tob1 = phi_tob1-64; if(phi_tob1 >= 32) phi_tob1 = phi_tob1-64;
if(phi_tob2 >= 32) phi_tob2 = phi_tob2-64; if(phi_tob2 >= 32) phi_tob2 = phi_tob2-64;
} }
auto bit_cosphi = TSU::L1TopoDataTypes<9,7>(TSU::Trigo::Cos.at(std::abs( phi_tob1 - phi_tob2 ))); auto bit_cosphi = TSU::L1TopoDataTypes<12,10>(TSU::Trigo::Cos.at(100*std::abs( phi_tob1 - phi_tob2 )));
TSU::L1TopoDataTypes<11,0> bit_Et1(tob1->Et()); TSU::L1TopoDataTypes<11,0> bit_Et1(tob1->Et());
TSU::L1TopoDataTypes<11,0> bit_Et2(tob2->Et()); TSU::L1TopoDataTypes<11,0> bit_Et2(tob2->Et());
auto bit_invmass2 = bit_Et1*bit_Et2*(bit_cosheta - bit_cosphi)*2; auto bit_invmass2 = bit_Et1*bit_Et2*(bit_cosheta - bit_cosphi)*2;
return int(bit_invmass2) ; return int(bit_invmass2) ;
} }
unsigned int TSU::Kinematics::calcTMassBW(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2) { unsigned int TSU::Kinematics::calcTMassBW(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2) {
auto bit_cosphi = TSU::L1TopoDataTypes<9,7>(TSU::Trigo::Cos.at(std::abs(tob1->phi() - tob2->phi()))); auto bit_cosphi = TSU::L1TopoDataTypes<12,10>(TSU::Trigo::Cos.at(100*std::abs(tob1->phi() - tob2->phi())));
TSU::L1TopoDataTypes<11,0> bit_Et1(tob1->Et()); TSU::L1TopoDataTypes<11,0> bit_Et1(tob1->Et());
TSU::L1TopoDataTypes<11,0> bit_Et2(tob2->Et()); TSU::L1TopoDataTypes<11,0> bit_Et2(tob2->Et());
TSU::L1TopoDataTypes<22,0> bit_tmass2 = 2*bit_Et1*bit_Et2*(1. - bit_cosphi); TSU::L1TopoDataTypes<22,0> bit_tmass2 = 2*bit_Et1*bit_Et2*(1. - bit_cosphi);
...@@ -153,6 +163,40 @@ unsigned long TSU::Kinematics::quadraticSumBW(int i1, int i2){ ...@@ -153,6 +163,40 @@ unsigned long TSU::Kinematics::quadraticSumBW(int i1, int i2){
return result; return result;
} }
unsigned int TSU::Kinematics::calcXi1(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2) {
double scale = 1.4; // this will be converted MeV and unsigned when unit is right
double shift = 20; // this will be converted MeV and unsigned when unit is right
TSU::L1TopoDataTypes<11,0> bit_Et1(static_cast<unsigned>(scale*tob1->Et()+shift));
TSU::L1TopoDataTypes<11,0> bit_Et2(static_cast<unsigned>(scale*tob2->Et()+shift));
auto bit_eeta1 = TSU::L1TopoDataTypes<20,10>(TSU::Expo::E.at(100*tob1->eta()));
auto bit_eeta2 = TSU::L1TopoDataTypes<20,10>(TSU::Expo::E.at(100*tob2->eta()));
auto xi_bit = bit_Et1*bit_eeta1+bit_Et2*bit_eeta2;
return int(xi_bit);
}
unsigned int TSU::Kinematics::calcXi2(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2) {
double scale = 1.4; // this will be converted MeV and unsigned when unit is right
double shift = 20; // this will be converted MeV and unsigned when unit is right
TSU::L1TopoDataTypes<11,0> bit_Et1(static_cast<unsigned>(scale*tob1->Et()+shift));
TSU::L1TopoDataTypes<11,0> bit_Et2(static_cast<unsigned>(scale*tob2->Et()+shift));
auto bit_eeta1 = TSU::L1TopoDataTypes<20,10>(TSU::Expo::E.at(-100*tob1->eta()));
auto bit_eeta2 = TSU::L1TopoDataTypes<20,10>(TSU::Expo::E.at(-100*tob2->eta()));
auto xi_bit = bit_Et1*bit_eeta1+bit_Et2*bit_eeta2;
return int(xi_bit);
}
float TSU::Kinematics::calcCos(unsigned phi){
return float(TSU::L1TopoDataTypes<12,10>(TSU::Trigo::Cos.at(100*phi)));
}
float TSU::Kinematics::calcSin(unsigned phi){
return float(TSU::L1TopoDataTypes<12,10>(TSU::Trigo::Sin.at(100*phi)));
}
/*------------------------------------------ NON-BITWISE --------------------------------------------------*/ /*------------------------------------------ NON-BITWISE --------------------------------------------------*/
unsigned int TSU::Kinematics::calcDeltaPhi(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2) { unsigned int TSU::Kinematics::calcDeltaPhi(const TCS::GenericTOB* tob1, const TCS::GenericTOB* tob2) {
......
This diff is collapsed.
** test1: L1TopoSimulationUtils cosh at different delta-eta values** ** test1: L1TopoSimulationUtils cosh at different delta-eta values**
delta eta: abs(0 - 23) = 23, cosh 000000001010000101 delta eta: abs(0 - 23) = 23, cosh 000000000001010000100110
delta eta: abs(0 - 23) = 23, cosh 000000001010000101 delta eta: abs(0 - 23) = 23, cosh 000000000001010000100110
delta eta: abs(0 - 24) = 24, cosh 000000001011000111 delta eta: abs(0 - 24) = 24, cosh 000000000001011000111010
** test2: L1TopoSimulationUtils KFLUT correction vs. et and eta** ** test2: L1TopoSimulationUtils KFLUT correction vs. et and eta**
et 4 [0], eta 2.4 [12] : 0.52 >>> et 4 [0], eta 2.4 [12] : 0.523438 >>>
et 12 [0], eta 2.4 [12] : 0.52 >>> et 12 [0], eta 2.4 [12] : 0.523438 >>>
et 4 [0], eta 2.6 [13] : 0.59 >>> et 4 [0], eta 2.6 [13] : 0.59375 >>>
et 12 [0], eta 2.6 [13] : 0.59 >>> et 12 [0], eta 2.6 [13] : 0.59375 >>>
et 4 [0], eta 2.9 [14] : 0.62 >>> et 4 [0], eta 2.9 [14] : 0.617188 >>>
et 12 [0], eta 2.9 [14] : 0.62 >>> et 12 [0], eta 2.9 [14] : 0.617188 >>>
et 4 [0], eta 3.1 [14] : 0.62 >>> et 4 [0], eta 3.1 [14] : 0.617188 >>>
et 12 [0], eta 3.1 [14] : 0.62 >>> et 12 [0], eta 3.1 [14] : 0.617188 >>>
** test3: L1TopoSimulationUtils KFLUT saturation** ** test3: L1TopoSimulationUtils KFLUT saturation**
This out_of_range is expected for ET values beyond 1024 : vector::_M_range_check: __n (which is 5) >= this->size() (which is 5) This out_of_range is expected for ET values beyond 1024 : vector::_M_range_check: __n (which is 5) >= this->size() (which is 5)
** test4: L1TopoSimulationUtils quadraticSumBW bitshift** ** test4: L1TopoSimulationUtils quadraticSumBW bitshift**
...@@ -46,4 +46,4 @@ This out_of_range is expected for ET values beyond 1024 : vector::_M_range_check ...@@ -46,4 +46,4 @@ This out_of_range is expected for ET values beyond 1024 : vector::_M_range_check
sum2(-32767, -32767) : std = 46339 bw = 46339 sum2(-32767, -32767) : std = 46339 bw = 46339
sum2(0, 65535) : std = 65535 bw = 65535 sum2(0, 65535) : std = 65535 bw = 65535
sum2(362, 65535) : std = 65535 bw = 65535 sum2(362, 65535) : std = 65535 bw = 65535
sum2(46340, 46340) : std = 65534 bw = 65534 sum2(46340, 46340) : std = 65534 bw = 65534
\ No newline at end of file
/* /*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/ */
/** /**
...@@ -39,9 +39,9 @@ void test1() ...@@ -39,9 +39,9 @@ void test1()
ClusterTOB cluster_fix0; // one cluster fixed at eta=0 ClusterTOB cluster_fix0; // one cluster fixed at eta=0
ClusterTOB cluster_var; // one cluster scanning eta values ClusterTOB cluster_var; // one cluster scanning eta values
for(double ieta : {23, int(23.5), 24}) { for(double ieta : {23., 23.5, 24.}) {
cluster_var.setEta(ieta); cluster_var.setEta(ieta);
auto cosh_val = TSU::Hyperbolic::Cosh.at(abs(cluster_fix0.eta() - cluster_var.eta())); auto cosh_val = TSU::Hyperbolic::Cosh.at(static_cast<int>(100*abs(cluster_fix0.eta() - cluster_var.eta())));
cout<<"delta eta: " cout<<"delta eta: "
<<" abs("<<cluster_fix0.eta()<<" - "<<cluster_var.eta()<<")" <<" abs("<<cluster_fix0.eta()<<" - "<<cluster_var.eta()<<")"
<<" = "<<abs(cluster_fix0.eta() - cluster_var.eta()) <<" = "<<abs(cluster_fix0.eta() - cluster_var.eta())
...@@ -55,24 +55,24 @@ void test2() ...@@ -55,24 +55,24 @@ void test2()
{ {
cout << "** test2: L1TopoSimulationUtils KFLUT correction vs. et and eta**\n"; cout << "** test2: L1TopoSimulationUtils KFLUT correction vs. et and eta**\n";
TCS::KFLUT kflut; TCS::KFLUT kflut;
// use roughly the center of the bins defined in KFLUT.cxx + one outsider // use roughly the center of the bins defined in KFLUT.cxx + one outsider
for(const double eta : {0.05, 0.2, 0.41, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.9, 3.1, 3.5}) { for(const double eta : {0.05, 0.2, 0.41, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.9, 3.1, 3.5}) {
for(const unsigned int et : {4, 12, 24, 48, 96, 360}) { for(const unsigned int et : {4, 12, 24, 48, 96, 360}) {
int iet = kflut.getetbin(et); int iet = kflut.getetbin(et);
int ieta = kflut.getetabin(std::abs(eta)); int ieta = kflut.getetabin(std::abs(eta));
double corrfactor = kflut.getcorrKF(iet, ieta); double corrfactor = kflut.getcorrKF(iet, ieta);
const bool large = corrfactor>+0.5; const bool large = corrfactor>+0.5;
const bool small = corrfactor<-0.5; const bool small = corrfactor<-0.5;
if(small or large) { if(small or large) {
cout<<" et "<<et<<" ["<<iet<<"], " cout<<" et "<<et<<" ["<<iet<<"], "
<<" eta "<<eta<<" ["<<ieta<<"] : " <<" eta "<<eta<<" ["<<ieta<<"] : "
<<corrfactor<<(large ? " >>>" : <<corrfactor<<(large ? " >>>" :
small ? " <<<" : small ? " <<<" :
"") "")
<<endl; <<endl;
} }
} // for(et) } // for(et)
} // for(eta) } // for(eta)
} }
...@@ -174,11 +174,10 @@ int test4() ...@@ -174,11 +174,10 @@ int test4()
int main() int main()
{ {
test1(); test1();
test2(); test2();
test3(); test3();
int result = test4(); int result = test4();
return result; return result;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment