Skip to content
Snippets Groups Projects
Commit 91dc6699 authored by Matteo Negrini's avatar Matteo Negrini Committed by Adam Edward Barton
Browse files

First commit of BIS78 trigger simulation with containers in master (manual sweep from rel 21.3/9)

parent 76c426e4
No related branches found
No related tags found
6 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42417Draft: DIRE and VINCIA Base Fragments for Pythia 8.3,!41841First commit of BIS78 trigger simulation with containers in master (manual sweep from rel 21.3/9)
Showing
with 449 additions and 4 deletions
/*
Copyright (C) 2021-2020 CERN for the benefit of the ATLAS collaboration
*/
#ifndef RpcBis78_TRIGRAWDATA_H
#define RpcBis78_TRIGRAWDATA_H
#include "AthContainers/DataVector.h"
#include "AthenaKernel/CLASS_DEF.h"
#include "MuonRDO/RpcBis78_TrigRawDataSegment.h"
/*
This class is for BIS78 trigger simulation.
BIS78 trigger goes to TGC sector logic.
This is different from other BIS chambers of phase 2, in this case the
trigger is in the barrel logic. A different class may be needed.
*/
namespace Muon {
class RpcBis78_TrigRawData : public DataVector<Muon::RpcBis78_TrigRawDataSegment>
{
public:
RpcBis78_TrigRawData() = default;
RpcBis78_TrigRawData(uint16_t sectorId, uint16_t sideId, uint16_t bcId);
~RpcBis78_TrigRawData() = default;
uint16_t sectorId() const {return m_sectorId;}
uint16_t sideId() const {return m_sideId;}
uint16_t bcId() const {return m_bcId;}
private:
uint16_t m_sectorId{0}; // sector
uint16_t m_sideId{0}; // side
uint16_t m_bcId{0}; // BC-id
};
}
CLASS_DEF(Muon::RpcBis78_TrigRawData,168084830,1)
#endif /// RpcBis78_TRIGRAWDATA_H
/*
Copyright (C) 2021-2020 CERN for the benefit of the ATLAS collaboration
*/
#ifndef RpcBis78_TRIGRAWDATACONTAINER_H
#define RpcBis78_TRIGRAWDATACONTAINER_H
#include "AthContainers/DataVector.h"
#include "AthenaKernel/CLASS_DEF.h"
#include "MuonRDO/RpcBis78_TrigRawData.h"
/*
This class is for BIS78 trigger simulation.
BIS78 trigger goes to TGC sector logic.
This is different from other BIS chambers of phase 2, in this case the
trigger is in the barrel logic. A different class may be needed.
*/
namespace Muon {
class RpcBis78_TrigRawDataContainer : public DataVector<Muon::RpcBis78_TrigRawData> {
public:
RpcBis78_TrigRawDataContainer()=default;
~RpcBis78_TrigRawDataContainer() = default;
private:
};
}
CLASS_DEF(Muon::RpcBis78_TrigRawDataContainer,1340556290,1)
#endif /// RpcBis78_TRIGRAWDATACONTAINER_H
/*
Copyright (C) 2021-2020 CERN for the benefit of the ATLAS collaboration
*/
#ifndef RpcBis78_TRIGRAWDATASEGMENT_H
#define RpcBis78_TRIGRAWDATASEGMENT_H
#include "AthContainers/DataVector.h"
#include "AthenaKernel/CLASS_DEF.h"
/*
This class is for BIS78 trigger simulation.
BIS78 trigger goes to TGC sector logic.
This is different from other BIS chambers of phase 2, in this case the
trigger is in the barrel logic. A different class may be needed.
*/
namespace Muon {
class RpcBis78_TrigRawDataSegment
{
public:
RpcBis78_TrigRawDataSegment()=default;
RpcBis78_TrigRawDataSegment(uint8_t etaIndex, uint8_t phiIndex, uint8_t deltaEta, uint8_t deltaPhi,
uint8_t flag3over3Eta, uint8_t flag3over3Phi, uint32_t trigword );
~RpcBis78_TrigRawDataSegment() = default;
uint8_t etaIndex() const {return m_etaIndex;}
uint8_t phiIndex() const {return m_phiIndex;}
uint8_t deltaEta() const {return m_deltaEta;}
uint8_t deltaPhi() const {return m_deltaPhi;}
uint8_t flag3over3Eta() const {return m_flag3over3Eta;}
uint8_t flag3over3Phi() const {return m_flag3over3Phi;}
uint32_t trigword() const {return m_trigword;}
private:
uint8_t m_etaIndex{0}; // chamber eta index
uint8_t m_phiIndex{0}; // chamber phi index
uint8_t m_deltaEta{0}; // eta window for strip coincidence
uint8_t m_deltaPhi{0}; // phi window for strip coincidence
uint8_t m_flag3over3Eta{0}; // flag for coincidence in eta of 3 (flag=1) or 2 (flag=0) gaps
uint8_t m_flag3over3Phi{0}; // flag for coincidence in phi of 3 (flag=1) or 2 (flag=0) gaps
uint32_t m_trigword{0}; // trigger word
};
}
CLASS_DEF(Muon::RpcBis78_TrigRawDataSegment,126491670,1)
#endif /// RpcBis78_TRIGRAWDATASEGMENT_H
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
#include "MuonRDO/RpcBis78_TrigRawData.h"
Muon::RpcBis78_TrigRawData::RpcBis78_TrigRawData(uint16_t sectorId, uint16_t sideId, uint16_t bcId) :
DataVector<Muon::RpcBis78_TrigRawDataSegment>(),
m_sectorId(sectorId),
m_sideId(sideId),
m_bcId(bcId)
{
}
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
#include "MuonRDO/RpcBis78_TrigRawDataContainer.h"
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
#include "MuonRDO/RpcBis78_TrigRawDataSegment.h"
Muon::RpcBis78_TrigRawDataSegment::RpcBis78_TrigRawDataSegment(uint8_t etaIndex, uint8_t phiIndex,
uint8_t deltaEta, uint8_t deltaPhi,
uint8_t flag3over3Eta, uint8_t flag3over3Phi,
uint32_t trigword ) :
m_etaIndex(etaIndex),
m_phiIndex(phiIndex),
m_deltaEta(deltaEta),
m_deltaPhi(deltaPhi),
m_flag3over3Eta(flag3over3Eta),
m_flag3over3Phi(flag3over3Phi),
m_trigword(trigword)
{ }
......@@ -7,7 +7,7 @@ atlas_subdir( TrigT1RPCsteering )
atlas_add_component( TrigT1RPCsteering
src/*.cxx
src/components/*.cxx
LINK_LIBRARIES AthenaBaseComps AtlasHepMCLib GaudiKernel GeneratorObjects MuonDigitContainer MuonIdHelpersLib MuonReadoutGeometry RPC_CondCablingLib RPCcablingInterfaceLib TrigT1RPChardwareLib StoreGateLib TrigT1Interfaces TrigT1RPClogicLib )
LINK_LIBRARIES AthenaBaseComps AtlasHepMCLib GaudiKernel GeneratorObjects MuonDigitContainer MuonIdHelpersLib MuonRDO MuonReadoutGeometry RPC_CondCablingLib RPCcablingInterfaceLib TrigT1RPChardwareLib StoreGateLib TrigT1Interfaces TrigT1RPClogicLib )
# Install files from the package:
atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
......
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
#include "BIS78_triggerSimulation.h"
#include <iostream>
using namespace std;
/////////////////////////////////////////////////////////////////////////////
BIS78_triggerSimulation::BIS78_triggerSimulation()
{}
unsigned int BIS78_triggerSimulation::AddStrip(int sectoreta, int sectorphi, int igap, int mphi, int strip){
if (igap<1||igap>3) return false;
int side = 0;
if (sectoreta>0) side=1;
if (mphi==1){
m_strip_phi[side][sectorphi-1][igap-1].push_back(strip);
} else {
m_strip_eta[side][sectorphi-1][igap-1].push_back(strip);
}
return 0;
}
StatusCode BIS78_triggerSimulation::clear(){
for (int i=0; i<2; i++){ // 2 sides (0 or 1, just for BIS78, otherwise, for full BIS it should be the eta sector)
for (int j=0; j<8; j++){ // 8 sectors
for (int k=0;k<3; k++){ // 3 gas gaps
m_strip_eta[i][j][k].clear();
m_strip_phi[i][j][k].clear();
}
}
}
return StatusCode::SUCCESS;
}
void BIS78_triggerSimulation::build_trigRawData(Muon::RpcBis78_TrigRawDataContainer* trgContainer, uint8_t dstrip_phi, uint8_t dstrip_eta, uint16_t bcid)
// take the data from TrigT1RPC
{
uint8_t delta_strip_phi=dstrip_phi;
uint8_t delta_strip_eta=dstrip_eta;
for (int i=0; i<2; i++){ // i = side (0,1)
for (int j=0; j<8; j++){ // j = sector-1 (0,7)
uint16_t side=i;
uint16_t sector=j;
auto trgRawData=std::make_unique< Muon::RpcBis78_TrigRawData>(sector, side, bcid);
uint32_t trigword = 0;
unsigned int majority_eta=0; uint8_t position_eta=0;
unsigned int majority_phi=0; uint8_t position_phi=0;
// use middle gas gap as pilot
// SEARCH OF PHI COINCIDENCES
for (unsigned int istrip1=0; istrip1<m_strip_phi[i][j][1].size(); istrip1++){
unsigned int majority=0;
for (unsigned int istrip0=0; istrip0<m_strip_phi[i][j][0].size(); istrip0++){
if (std::abs(m_strip_phi[i][j][1].at(istrip1)-m_strip_phi[i][j][0].at(istrip0))<=delta_strip_phi) {
majority=1;
}
}
for (unsigned int istrip2=0; istrip2<m_strip_phi[i][j][2].size(); istrip2++){
if (std::abs(m_strip_phi[i][j][1].at(istrip1)-m_strip_phi[i][j][2].at(istrip2))<=delta_strip_phi) {
if (majority>0) {
majority=2;
} else {
majority=1;
}
}
}
if (majority > majority_phi) {
majority_phi=majority;
position_phi=m_strip_phi[i][j][1].at(istrip1);
}
}
if (majority_phi==0) { // try also combination first-last
for (unsigned int istrip0=0; istrip0<m_strip_phi[i][j][0].size(); istrip0++){
for (unsigned int istrip2=0; istrip2<m_strip_phi[i][j][2].size(); istrip2++){
if (std::abs(m_strip_phi[i][j][2].at(istrip2)-m_strip_phi[i][j][0].at(istrip0))<=delta_strip_phi) {
position_phi=m_strip_phi[i][j][0].at(istrip0);
majority_phi=1;
}
}
}
} // end of phi loop
// SEARCH OF ETA COINCIDENCES
for (unsigned int istrip1=0; istrip1<m_strip_eta[i][j][1].size(); istrip1++){
unsigned int majority=0;
for (unsigned int istrip0=0; istrip0<m_strip_eta[i][j][0].size(); istrip0++){
if (std::abs(m_strip_eta[i][j][1].at(istrip1)-m_strip_eta[i][j][0].at(istrip0))<=delta_strip_eta) {
majority=1;
}
}
for (unsigned int istrip2=0; istrip2<m_strip_eta[i][j][2].size(); istrip2++){
if (std::abs(m_strip_eta[i][j][1].at(istrip1)-m_strip_eta[i][j][2].at(istrip2))<=delta_strip_eta) {
if (majority>0) {
majority=2;
} else {
majority=1;
}
}
}
if (majority > majority_eta) {
majority_eta=majority;
position_eta=m_strip_eta[i][j][1].at(istrip1);
}
}
if (majority_eta==0) { // try also combination first-last
for (unsigned int istrip0=0; istrip0<m_strip_eta[i][j][0].size(); istrip0++){
for (unsigned int istrip2=0; istrip2<m_strip_eta[i][j][2].size(); istrip2++){
if (std::abs(m_strip_eta[i][j][2].at(istrip2)-m_strip_eta[i][j][0].at(istrip0))<=delta_strip_eta) {
position_eta=m_strip_eta[i][j][0].at(istrip0);
majority_eta=1;
}
}
}
} // end of eta loop
// Here one has to compute the trigword for each sector
// Content of the 24 bits word:
// - eta strip index -> 6 bits
// - phi strip index -> 6 bits
// - eta strip coincidence window -> 3 bits (NOT IMPLEMENTED YET: TO BE CHECKED WITH FIRMWARE)
// - phi strip coincidence window -> 3 bits (NOT IMPLEMENTED YET: TO BE CHECKED WITH FIRMWARE)
// - 3 over 3 gaps coincidence flag for eta/phi-> 2 bits
// - reserved -> 4 bits
uint8_t flag3o3_eta=0;
uint8_t flag3o3_phi=0;
if (majority_eta>0&&majority_phi>0){
if (majority_eta>1) flag3o3_eta=1;
if (majority_phi>1) flag3o3_phi=1;
// set the trigger word
trigword = ((position_eta & 0x3f) << 18)
+ ((position_phi & 0x3f) << 12 )
+ ((flag3o3_eta & 0x1) << 5 )
+ ((flag3o3_phi & 0x1) << 4 );
}
auto bis_segment= std::make_unique<Muon::RpcBis78_TrigRawDataSegment>(position_eta,position_phi,
delta_strip_eta,delta_strip_phi,
flag3o3_eta,flag3o3_phi,trigword );
trgRawData->push_back(std::move(bis_segment));
trgContainer->push_back(std::move(trgRawData));
}
}
}
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
#ifndef BIS78_triggerSimulation_h
#define BIS78_triggerSimulation_h
#include "AthenaBaseComps/AthAlgorithm.h"
#include "GaudiKernel/ServiceHandle.h"
#include "GaudiKernel/ToolHandle.h"
#include "MuonRDO/RpcBis78_TrigRawDataContainer.h"
#include <vector>
/*
This class is for BIS78 trigger simulation.
BIS78 trigger goes to TGC sector logic.
This is different from other BIS chambers of phase 2, in this case the
trigger is in the barrel logic. A different class may be needed.
*/
/////////////////////////////////////////////////////////////////////////////
class BIS78_triggerSimulation {
public:
BIS78_triggerSimulation ();
~BIS78_triggerSimulation() = default;
StatusCode clear();
void build_trigRawData(Muon::RpcBis78_TrigRawDataContainer* trgContainer, uint8_t dstrip_phi, uint8_t dstrip_eta, uint16_t bcid);
unsigned int AddStrip(int sectoreta, int sectorphi, int igap, int mphi, int strip);
private:
// These are to collect all the strip data
// The first index is the side (0 or 1) because it is just for BIS78 (otherwise, for full BIS, it should be the eta sector)
std::vector<int> m_strip_eta[2][8][3]; // side, sector, gasgap
std::vector<int> m_strip_phi[2][8][3]; // side, sector, gasgap
std::unique_ptr<Muon::RpcBis78_TrigRawDataContainer> m_bisTrgContainer;
};
#endif
......@@ -41,6 +41,7 @@ StatusCode TrigT1RPC::initialize(){
ATH_CHECK(m_rpcDigitKey.initialize());
ATH_CHECK(m_muctpiPhase1Key.initialize(m_useRun3Config));
ATH_CHECK(m_muctpiKey.initialize(!m_useRun3Config));
ATH_CHECK(m_bis78TrigKey.initialize());
ATH_CHECK(m_muDetMgrKey.initialize());
return StatusCode::SUCCESS;
}
......@@ -251,6 +252,22 @@ StatusCode TrigT1RPC::execute() {
}
// ******************* Start of BIS78 section *****************
// Now BIS78 Trigger
uint8_t dstrip_phi=1; // Delta phi for BIS78 coincidence
uint8_t dstrip_eta=1; // Delta eta for BIS78 coincidence
uint16_t bcid=0;
Muon::RpcBis78_TrigRawDataContainer* bis78RpcTrigData = nullptr;
SG::WriteHandle<Muon::RpcBis78_TrigRawDataContainer> wh_bis78RpcTrigData(m_bis78TrigKey);
ATH_CHECK(wh_bis78RpcTrigData.record(std::make_unique<Muon::RpcBis78_TrigRawDataContainer>()));
bis78RpcTrigData = wh_bis78RpcTrigData.ptr();
m_BIS78TrigSim.build_trigRawData(bis78RpcTrigData, dstrip_phi, dstrip_eta, bcid);
ATH_MSG_DEBUG ("put bis78TrgContainer into SG" ); //
ATH_MSG_DEBUG ( "TrigT1RPC terminated succesfully!" );
return StatusCode::SUCCESS;
......@@ -272,13 +289,17 @@ StatusCode TrigT1RPC::fill_RPCdata(RPCsimuData& data, const RpcCablingCondData*
}
const RpcDigitContainer* container = rh_rpcDigits.cptr();
// Cleanup the BIS78 strip data
CHECK( m_BIS78TrigSim.clear() );
int bisStationIndex=m_idHelperSvc->rpcIdHelper().stationNameIndex("BIS");
collection_iterator it1_coll= container->begin();
collection_iterator it2_coll= container->end();
for ( ; it1_coll!=it2_coll; ++it1_coll)
{
const RpcDigitCollection* rpcCollection = *it1_coll;
const RpcDigitCollection* rpcCollection = *it1_coll;
Identifier moduleId = rpcCollection->identify();
......@@ -315,8 +336,7 @@ StatusCode TrigT1RPC::fill_RPCdata(RPCsimuData& data, const RpcCablingCondData*
unsigned long int strip_code_cab = readCdo->strip_code_fromOffId(StationName,StationEta,StationPhi,
DoubletR,DoubletZ,DoubletP,GasGap,MeasuresPhi,Strip);
if(strip_code_cab) {
if(strip_code_cab) {
// Fill data for the Level-1 RPC digit
float xyz[4];
xyz[1] = pos.x()/10.;//coo[0]; //RPC strip x coordinate
......@@ -353,6 +373,17 @@ StatusCode TrigT1RPC::fill_RPCdata(RPCsimuData& data, const RpcCablingCondData*
<< std::setw(11) << pos.z() );
}
// This section fills the BIS strip data
if (stationType == bisStationIndex) {
ATH_MSG_DEBUG ( "Filling BIS strip data: StationName=" << StationName << " StationEta=" << StationEta
<< " StationPhi=" << StationPhi<< " MeasuresPhi=" << MeasuresPhi
<< " Strip=" << Strip<< " GasGap=" << GasGap
<< " Time=" <<rpcDigit->time() );
m_BIS78TrigSim.AddStrip(StationEta, StationPhi, GasGap, MeasuresPhi, Strip);
}
}
}
std::string id = m_idHelperSvc->rpcIdHelper().show_to_string(moduleId);
......
......@@ -30,6 +30,8 @@
#include "RPCcablingInterface/IRPCcablingServerSvc.h"
#include "BIS78_triggerSimulation.h"
/////////////////////////////////////////////////////////////////////////////
class TrigT1RPC : public AthAlgorithm {
......@@ -72,6 +74,8 @@ private:
BooleanProperty m_useRun3Config{this,"useRun3Config",false}; // flag for using switch between Run3 and Run2 configurations
StatusCode fill_RPCdata(RPCsimuData&, const RpcCablingCondData* readCdo, const MuonGM::MuonDetectorManager* muDetMgr);
BIS78_triggerSimulation m_BIS78TrigSim;
private:
SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_muDetMgrKey {this, "DetectorManagerKey", "MuonDetectorManager", "Key of input MuonDetectorManager condition data"};
......@@ -82,6 +86,7 @@ private:
SG::ReadHandleKey<RpcDigitContainer> m_rpcDigitKey{this, "RPCDigitContainer", "RPC_DIGITS", "RPC Digit Input Container"};
SG::WriteHandleKey<LVL1MUONIF::Lvl1MuCTPIInput> m_muctpiKey{this, "MuctpiLocationRPC", "L1MuctpiStoreRPC", "Location of muctpi for Rpc"};
SG::WriteHandleKey<LVL1MUONIF::Lvl1MuCTPIInputPhase1> m_muctpiPhase1Key{this, "MuctpiPhase1LocationRPC", "L1MuctpiStoreRPC", "Location of muctpiPhase1 for Rpc"};
SG::WriteHandleKey<Muon::RpcBis78_TrigRawDataContainer> m_bis78TrigKey{this, "BIS78TrigContainerLocation", "BIS78TrigContainer", "Location of BIS78 Rpc"};
ServiceHandle <IRPCcablingServerSvc> m_cabling_getter;
const IRPCcablingSvc* m_cabling;
......
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