Commit 17d7779b authored by Tong Qiu's avatar Tong Qiu Committed by Johannes Elmsheuser
Browse files

Make L1Calo eFEXOutputCollection work with read and write handles

parent c320b523
......@@ -46,7 +46,7 @@ class eFEXDriver : public AthAlgorithm
SG::WriteHandleKey<LVL1::eTowerContainer> m_eTowerContainerSGKey {this, "MyETowers", "eTowerContainer", "MyETowers"};
//SG::WriteHandleKey<eFEXOutputCollection> m_eFEXOutputCollectionSGKey {this, "MyOutputs", "eFEXOutputCollection", "MyOutputs"};
SG::WriteHandleKey<eFEXOutputCollection> m_eFEXOutputCollectionSGKey {this, "MyOutputs", "eFEXOutputCollection", "MyOutputs"};
SG::ReadHandleKey<CaloCellContainer> m_scellsCollectionSGKey {this, "SCell", "SCell", "SCell"};
......
......@@ -47,7 +47,7 @@ namespace LVL1 {
virtual ~eFEXFPGA();
virtual StatusCode init(int id, int efexid) override ;
virtual StatusCode execute() override ;
virtual StatusCode execute(eFEXOutputCollection* inputOutputCollection) override ;
virtual void reset() override ;
virtual int getID() override {return m_id;}
......@@ -57,7 +57,6 @@ namespace LVL1 {
virtual std::vector <uint32_t> getEmTOBs() override ;
virtual std::vector <uint32_t> getTauTOBs() override ;
/** Internal data */
private:
static bool etSort (uint32_t i,uint32_t j) { return (((i >> 0 ) & 0xfff)>((j >> 0 ) & 0xfff)); }
......@@ -76,8 +75,6 @@ namespace LVL1 {
this, "MyETowers", "eTowerContainer",
"Input container for eTowers"};
//SG::ReadHandleKey<eFEXOutputCollection> m_eFEXFPGA_eFEXOutputCollectionKey {this, "MyOutputs", "eFEXOutputCollection", "Input container for eFEXOutputCollection"};
ToolHandle<IeFEXtauAlgo> m_eFEXtauAlgoTool {
this, "eFEXtauAlgoTool", "LVL1::eFEXtauAlgo",
"Tool that runs the eFEX tau algorithm"};
......
......@@ -46,8 +46,8 @@ public:
StatusCode finalize ();
private:
eFEXOutputCollection* m_eFEXOutputCollection; ///< a collection of the L1Calo eFex output
//std::shared_ptr<eFEXOutputCollection> m_eFEXOutputCollection;
/// @brief readhandle key for eFEXOutputCollection
SG::ReadHandleKey<LVL1::eFEXOutputCollection> m_eFEXOutputCollectionSGKey {this, "MyOutputs", "eFEXOutputCollection", "MyOutputs"};
int m_eg_nTOBs; ///< number of e-gamma tobs
bool m_load_truth_jet; ///< if load truth jets
......@@ -104,13 +104,13 @@ private:
TTree *m_myTree;
/// @brief save variables related to the e-gamma algorithm
StatusCode loadegAlgoVariables();
StatusCode loadegAlgoVariables(SG::ReadHandle<LVL1::eFEXOutputCollection>);
/// @brief save variables in the e-gamma TOB word
StatusCode loadegAlgoTOBs();
StatusCode loadegAlgoTOBs(SG::ReadHandle<LVL1::eFEXOutputCollection>);
/// @brief save variables related to the tau algorithm
StatusCode loadtauAlgoVariables();
StatusCode loadtauAlgoVariables(SG::ReadHandle<LVL1::eFEXOutputCollection>);
/// @brief save variables related to truth electrons
StatusCode loadTruthElectron();
......
......@@ -28,7 +28,7 @@ namespace LVL1 {
*/
public:
/// @brief constructor
eFEXOutputCollection() {};
eFEXOutputCollection();
/// @brief Destructor
~eFEXOutputCollection();
......@@ -61,30 +61,37 @@ namespace LVL1 {
void fill_tau();
/// @brief get total number of tau TOBs saved
int tau_size();
int tau_size() const;
/// @brief get total number of eg TOBs saved
int size();
int size() const;
/// @brief get all e-gamma related values the ith TOB
std::map<std::string, float>* get_eg(int);
std::map<std::string, float>* get_eg(int) const;
/// @brief get all tau related values the ith TOB
std::map<std::string, float>* get_tau(int);
std::map<std::string, float>* get_tau(int) const;
/// @brief add the eEFX number of a TOB
void addeFexNumber(int);
/// @brief get the eFEX numbers of all TOBs
std::vector<int> geteFexNumber();
std::vector<int> geteFexNumber() const;
/// @brief add a 32-bit e-gamma TOB word
void addEMtob(uint32_t);
/// @brief get all e-gamma TOB words of an event
std::vector<uint32_t> getEMtob();
std::vector<uint32_t> getEMtob() const;
/// @brief setting to true if ntuple output is needed
void setdooutput(bool);
/// @brief return to true if ntuple output is needed
bool getdooutput() const;
private:
bool m_dooutput; ///< if write Ntuple
std::vector<int> m_eFexNumber; ///< vector of eFEX numbers
std::vector<uint32_t> m_emtob; ///< vector of TOB words
/// e-gamma related values of a TOB
......
......@@ -20,6 +20,7 @@
#include "CaloEvent/CaloCellContainer.h"
#include "CaloIdentifier/CaloIdManager.h"
#include "CaloIdentifier/CaloCell_SuperCell_ID.h"
#include "L1CaloFEXSim/eFEXOutputCollection.h"
namespace LVL1 {
......@@ -55,7 +56,7 @@ namespace LVL1 {
virtual void SetTowersAndCells_SG(int tmp[10][18]) override;
virtual StatusCode NewExecute(int tmp[10][18]) override;
virtual StatusCode NewExecute(int tmp[10][18], eFEXOutputCollection* inputOutputCollection) override;
virtual std::vector<uint32_t> getEmTOBs() override;
virtual std::vector<uint32_t> getTauTOBs() override;
......
......@@ -55,14 +55,13 @@ namespace LVL1 {
/** standard Athena-Algorithm method */
virtual StatusCode finalize () override;
virtual StatusCode execute() override ;
virtual StatusCode execute(eFEXOutputCollection* inputOutputCollection) override ;
virtual void init() override ;
virtual void cleanup() override;
virtual int calcTowerID(int eta, int phi, int mod) override ;
virtual int calcTowerID(int eta, int phi, int mod) override;
/** Internal data */
private:
......
......@@ -62,4 +62,4 @@ log.info("Scheduling eFEXDriver")
athAlgSeq += CfgMgr.LVL1__eFEXDriver('MyeFEXDriver')
athAlgSeq += CfgMgr.LVL1__eFEXNtupleWriter('MyeFEXNtupleWriter')
log.info("==========================================================")
#######################################################
#######################################################
\ No newline at end of file
......@@ -87,7 +87,7 @@ StatusCode eFEXDriver::initialize()
// ATH_CHECK( m_eFakeTowerTool->init(inputfile) );
// }
//ATH_CHECK( m_eFEXOutputCollectionSGKey.initialize() );
ATH_CHECK( m_eFEXOutputCollectionSGKey.initialize() );
return StatusCode::SUCCESS;
......@@ -119,33 +119,18 @@ StatusCode eFEXDriver::finalize()
//eTowerContainer* local_eTowerContainerRaw = new eTowerContainer();
std::unique_ptr<eTowerContainer> local_eTowerContainerRaw = std::make_unique<eTowerContainer>();
// STEP 1 - Do some monitoring (code to exported in the future to another algorithm accessing only StoreGate and not appearing in this algorithm)
eFEXOutputCollection* my_eFEXOutputCollection = new eFEXOutputCollection();
bool savetob = true;
if(savetob)
{
StatusCode sctob = evtStore()->record(my_eFEXOutputCollection,"eFEXOutputCollection");
if(sctob == StatusCode::SUCCESS){}
else if (sctob == StatusCode::FAILURE){ATH_MSG_ERROR("Event " << m_numberOfEvents << " , Failed to put eFEXOutputCollection into Storegate.");}
/*
SG::WriteHandle<eFEXOutputCollection> eFEXOutputCollectionSG(m_eFEXOutputCollectionSGKey,ctx);
ATH_CHECK(eFEXOutputCollectionSG.record(std::make_unique<eFEXOutputCollection>()));
*/
}
// STEP 2 - Make some eTowers and fill the local container
// STEP 1 - Make some eTowers and fill the local container
ATH_CHECK( m_eTowerBuilderTool.retrieve() );
m_eTowerBuilderTool->init(local_eTowerContainerRaw);
local_eTowerContainerRaw->clearContainerMap();
local_eTowerContainerRaw->fillContainerMap();
// STEP 3 - Do the supercell-tower mapping - put this information into the eTowerContainer
// STEP 2 - Do the supercell-tower mapping - put this information into the eTowerContainer
ATH_CHECK( m_eSuperCellTowerMapperTool.retrieve() );
ATH_CHECK(m_eSuperCellTowerMapperTool->AssignSuperCellsToTowers(local_eTowerContainerRaw));
ATH_CHECK(m_eSuperCellTowerMapperTool->AssignTriggerTowerMapper(local_eTowerContainerRaw));
// STEP 3.5 - Set up a the first CSV file if necessary (should only need to be done if the mapping changes, which should never happen unless major changes to the simulation are required)
// STEP 2.5 - Set up a the first CSV file if necessary (should only need to be done if the mapping changes, which should never happen unless major changes to the simulation are required)
if(false){ // CSV CODE TO BE RE-INTRODUCED VERY SOON
if(m_numberOfEvents == 1){
std::ofstream sc_tower_map;
......@@ -177,17 +162,21 @@ StatusCode eFEXDriver::finalize()
// }
// STEP 4 - Write the completed eTowerContainer into StoreGate (move the local copy in memory)
// STEP 3 - Write the completed eTowerContainer into StoreGate (move the local copy in memory)
SG::WriteHandle<LVL1::eTowerContainer> eTowerContainerSG(m_eTowerContainerSGKey/*, ctx*/);
//std::unique_ptr<LVL1::eTowerContainer> my_eTowerContainerRaw(local_eTowerContainerRaw);
ATH_CHECK(eTowerContainerSG.record(std::move(/*my_eTowerContainerRaw*/local_eTowerContainerRaw)));
// STEP 5 - Set up the eFEXSysSim
// STEP 4 - Set up the eFEXSysSim
ATH_CHECK( m_eFEXSysSimTool.retrieve() );
m_eFEXSysSimTool->init();
// STEP 5 - Do some monitoring
eFEXOutputCollection* my_eFEXOutputCollection = new eFEXOutputCollection();
my_eFEXOutputCollection->setdooutput(true);
// STEP 6 - Run THE eFEXSysSim
ATH_CHECK(m_eFEXSysSimTool->execute());
ATH_CHECK(m_eFEXSysSimTool->execute(my_eFEXOutputCollection));
///STEP 6.5 - test the EDM
ATH_CHECK(testEDM());
......@@ -198,6 +187,11 @@ StatusCode eFEXDriver::finalize()
m_eSuperCellTowerMapperTool->reset();
m_eTowerBuilderTool->reset();
// STEP 8 - Write the completed eFEXOutputCollection into StoreGate (move the local copy in memory)
std::unique_ptr<eFEXOutputCollection> local_eFEXOutputCollection = std::unique_ptr<eFEXOutputCollection>(my_eFEXOutputCollection);
SG::WriteHandle<LVL1::eFEXOutputCollection> eFEXOutputCollectionSG(m_eFEXOutputCollectionSGKey);
ATH_CHECK(eFEXOutputCollectionSG.record(std::move(local_eFEXOutputCollection)));
ATH_MSG_DEBUG("Executed " << name() << ", closing event number " << m_numberOfEvents );
m_numberOfEvents++;
......
......@@ -58,7 +58,6 @@ StatusCode eFEXFPGA::initialize()
ATH_CHECK(m_eFEXFPGA_eTowerContainerKey.initialize());
ATH_CHECK(m_l1MenuKey.initialize());
//ATH_CHECK(m_eFEXFPGA_eFEXOutputCollectionKey.initialize());
return StatusCode::SUCCESS;
}
......@@ -79,7 +78,7 @@ void eFEXFPGA::reset(){
}
StatusCode eFEXFPGA::execute(){
StatusCode eFEXFPGA::execute(eFEXOutputCollection* inputOutputCollection){
m_emTobwords.clear();
m_tauTobwords.clear();
......@@ -89,21 +88,6 @@ StatusCode eFEXFPGA::execute(){
ATH_MSG_FATAL("Could not retrieve jk_eFEXFPGA_eTowerContainer " << m_eFEXFPGA_eTowerContainerKey.key() );
return StatusCode::FAILURE;
}
eFEXOutputCollection* eFEXOutputs;
// To be replaced soon but left here commented for information
/*
SG::ReadHandle<eFEXOutputCollection> jk_eFEXFPGA_eFEXOutputCollection(m_eFEXFPGA_eFEXOutputCollectionKey,ctx);
if(!jk_eFEXFPGA_eFEXOutputCollection.isValid()){
ATH_MSG_FATAL("Could not retrieve jk_eFEXFPGA_eFEXOutputCollection " << m_eFEXFPGA_eFEXOutputCollectionKey.key() );
return StatusCode::FAILURE;
}
*/
StatusCode sc_tobs = evtStore()->retrieve(eFEXOutputs, "eFEXOutputCollection");
if(sc_tobs == StatusCode::SUCCESS){ }
else if(sc_tobs == StatusCode::FAILURE) {ATH_MSG_DEBUG("\n---- eFEXegAlgo --------- Failed to find eFEXOutputCollection in eFEXFPGA"); }
// Retrieve the L1 menu configuration
SG::ReadHandle<TrigConf::L1Menu> l1Menu (m_l1MenuKey/*, ctx*/);
......@@ -195,29 +179,31 @@ StatusCode eFEXFPGA::execute(){
tmp_tob->setPhi(iphi);
// for plotting
eFEXOutputs->addeFexNumber(m_efexid);
eFEXOutputs->addEMtob(tobword);
eFEXOutputs->addValue_eg("WstotNum", tmp_tob->getWstotNum());
eFEXOutputs->addValue_eg("WstotDen", tmp_tob->getWstotDen());
eFEXOutputs->addValue_eg("RetaNum", tmp_tob->getRetaNum());
eFEXOutputs->addValue_eg("RetaDen", tmp_tob->getRetaDen());
eFEXOutputs->addValue_eg("RhadNum", tmp_tob->getRhadNum());
eFEXOutputs->addValue_eg("RhadDen", tmp_tob->getRhadDen());
eFEXOutputs->addValue_eg("haveSeed", m_eFEXegAlgoTool->hasSeed());
eFEXOutputs->addValue_eg("ET", m_eFEXegAlgoTool->getET());
float eta = 9999;
m_eFEXegAlgoTool->getRealEta(eta);
eFEXOutputs->addValue_eg("eta", eta);
float phi = 9999;
m_eFEXegAlgoTool->getRealPhi(phi);
eFEXOutputs->addValue_eg("phi", phi);
unsigned int em_et = 9999;
m_eFEXegAlgoTool->getCoreEMTowerET(em_et);
eFEXOutputs->addValue_eg("em", em_et);
unsigned int had_et = 9999;
m_eFEXegAlgoTool->getCoreHADTowerET(had_et);
eFEXOutputs->addValue_eg("had", had_et);
eFEXOutputs->fill_eg();
if (inputOutputCollection->getdooutput()) {
inputOutputCollection->addeFexNumber(m_efexid);
inputOutputCollection->addEMtob(tobword);
inputOutputCollection->addValue_eg("WstotNum", tmp_tob->getWstotNum());
inputOutputCollection->addValue_eg("WstotDen", tmp_tob->getWstotDen());
inputOutputCollection->addValue_eg("RetaNum", tmp_tob->getRetaNum());
inputOutputCollection->addValue_eg("RetaDen", tmp_tob->getRetaDen());
inputOutputCollection->addValue_eg("RhadNum", tmp_tob->getRhadNum());
inputOutputCollection->addValue_eg("RhadDen", tmp_tob->getRhadDen());
inputOutputCollection->addValue_eg("haveSeed", m_eFEXegAlgoTool->hasSeed());
inputOutputCollection->addValue_eg("ET", m_eFEXegAlgoTool->getET());
float eta = 9999;
m_eFEXegAlgoTool->getRealEta(eta);
inputOutputCollection->addValue_eg("eta", eta);
float phi = 9999;
m_eFEXegAlgoTool->getRealPhi(phi);
inputOutputCollection->addValue_eg("phi", phi);
unsigned int em_et = 9999;
m_eFEXegAlgoTool->getCoreEMTowerET(em_et);
inputOutputCollection->addValue_eg("em", em_et);
unsigned int had_et = 9999;
m_eFEXegAlgoTool->getCoreHADTowerET(had_et);
inputOutputCollection->addValue_eg("had", had_et);
inputOutputCollection->fill_eg();
}
}
}
......@@ -256,16 +242,18 @@ StatusCode eFEXFPGA::execute(){
if ( tobword != 0 ) m_tauTobwords.push_back(tobword);
// for plotting
eFEXOutputs->addValue_tau("isCentralTowerSeed", m_eFEXtauAlgoTool->isCentralTowerSeed());
eFEXOutputs->addValue_tau("Et", m_eFEXtauAlgoTool->getEt());
eFEXOutputs->addValue_tau("Eta", ieta);
eFEXOutputs->addValue_tau("Phi", iphi);
const LVL1::eTower * centerTower = jk_eFEXFPGA_eTowerContainer->findTower(m_eTowersIDs[iphi][ieta]);
eFEXOutputs->addValue_tau("FloatEta", centerTower->eta() * centerTower->getPosNeg());
eFEXOutputs->addValue_tau("FloatPhi", centerTower->phi());
eFEXOutputs->addValue_tau("Iso", m_eFEXtauAlgoTool->getIso());
eFEXOutputs->fill_tau();
if (inputOutputCollection->getdooutput()) {
inputOutputCollection->addValue_tau("isCentralTowerSeed", m_eFEXtauAlgoTool->isCentralTowerSeed());
inputOutputCollection->addValue_tau("Et", m_eFEXtauAlgoTool->getEt());
inputOutputCollection->addValue_tau("Eta", ieta);
inputOutputCollection->addValue_tau("Phi", iphi);
const LVL1::eTower * centerTower = jk_eFEXFPGA_eTowerContainer->findTower(m_eTowersIDs[iphi][ieta]);
inputOutputCollection->addValue_tau("FloatEta", centerTower->eta() * centerTower->getPosNeg());
inputOutputCollection->addValue_tau("FloatPhi", centerTower->phi());
inputOutputCollection->addValue_tau("Iso", m_eFEXtauAlgoTool->getIso());
inputOutputCollection->fill_tau();
}
}
}
......
......@@ -32,6 +32,8 @@ StatusCode LVL1::eFEXNtupleWriter::initialize () {
CHECK( histSvc.retrieve() );
m_myTree = new TTree("data","data");
CHECK( histSvc->regTree("/ANALYSIS/data",m_myTree) );
ATH_CHECK( m_eFEXOutputCollectionSGKey.initialize() );
m_load_truth_jet = false;
......@@ -86,17 +88,18 @@ StatusCode LVL1::eFEXNtupleWriter::initialize () {
}
StatusCode LVL1::eFEXNtupleWriter::execute () {
//ATH_MSG_DEBUG("==== eFEXNtupleWriter ============ execute()");
ServiceHandle<StoreGateSvc> evtStore("StoreGateSvc/StoreGateSvc", "arbitrary");
CHECK(evtStore.retrieve() );
m_eFEXOutputCollection = new eFEXOutputCollection();
//m_eFEXOutputCollection = std::make_shared<eFEXOutputCollection>();
CHECK(evtStore->retrieve(m_eFEXOutputCollection, "eFEXOutputCollection"));
SG::ReadHandle<LVL1::eFEXOutputCollection> eFEXOutputCollectionobj = SG::ReadHandle<LVL1::eFEXOutputCollection>(m_eFEXOutputCollectionSGKey/*,ctx*/);
if(!eFEXOutputCollectionobj.isValid()){
ATH_MSG_FATAL("Could not retrieve eFEXOutputCollection " << m_eFEXOutputCollectionSGKey.key());
return StatusCode::FAILURE;
}
if (!eFEXOutputCollectionobj->getdooutput()) {
return StatusCode::SUCCESS;
}
CHECK(loadegAlgoVariables());
CHECK(loadegAlgoTOBs());
CHECK(loadtauAlgoVariables());
CHECK(loadegAlgoVariables(eFEXOutputCollectionobj));
CHECK(loadegAlgoTOBs(eFEXOutputCollectionobj));
CHECK(loadtauAlgoVariables(eFEXOutputCollectionobj));
CHECK(loadTruthElectron());
CHECK(loadTruthTau());
if (m_load_truth_jet){
......@@ -104,7 +107,7 @@ StatusCode LVL1::eFEXNtupleWriter::execute () {
}
m_myTree->Fill();
m_eFEXOutputCollection->clear();
return StatusCode::SUCCESS;
}
......@@ -113,7 +116,7 @@ StatusCode LVL1::eFEXNtupleWriter::finalize () {
return StatusCode::SUCCESS;
}
StatusCode LVL1::eFEXNtupleWriter::loadtauAlgoVariables() {
StatusCode LVL1::eFEXNtupleWriter::loadtauAlgoVariables(SG::ReadHandle<LVL1::eFEXOutputCollection> eFEXOutputCollectionobj) {
m_tau_Iso.clear();
m_tau_Et.clear();
m_tau_Eta.clear();
......@@ -121,20 +124,20 @@ StatusCode LVL1::eFEXNtupleWriter::loadtauAlgoVariables() {
m_tau_floatEta.clear();
m_tau_floatPhi.clear();
m_tau_isCentralTowerSeed.clear();
for (int i = 0; i < m_eFEXOutputCollection->tau_size(); i++)
for (int i = 0; i < eFEXOutputCollectionobj->tau_size(); i++)
{
m_tau_isCentralTowerSeed.push_back((*(m_eFEXOutputCollection->get_tau(i)))["isCentralTowerSeed"]);
m_tau_Et.push_back((*(m_eFEXOutputCollection->get_tau(i)))["Et"]);
m_tau_Eta.push_back((*(m_eFEXOutputCollection->get_tau(i)))["Eta"]);
m_tau_Phi.push_back((*(m_eFEXOutputCollection->get_tau(i)))["Phi"]);
m_tau_floatEta.push_back((*(m_eFEXOutputCollection->get_tau(i)))["FloatEta"]);
m_tau_floatPhi.push_back((*(m_eFEXOutputCollection->get_tau(i)))["FloatPhi"]);
m_tau_Iso.push_back((*(m_eFEXOutputCollection->get_tau(i)))["Iso"]);
m_tau_isCentralTowerSeed.push_back((*(eFEXOutputCollectionobj->get_tau(i)))["isCentralTowerSeed"]);
m_tau_Et.push_back((*(eFEXOutputCollectionobj->get_tau(i)))["Et"]);
m_tau_Eta.push_back((*(eFEXOutputCollectionobj->get_tau(i)))["Eta"]);
m_tau_Phi.push_back((*(eFEXOutputCollectionobj->get_tau(i)))["Phi"]);
m_tau_floatEta.push_back((*(eFEXOutputCollectionobj->get_tau(i)))["FloatEta"]);
m_tau_floatPhi.push_back((*(eFEXOutputCollectionobj->get_tau(i)))["FloatPhi"]);
m_tau_Iso.push_back((*(eFEXOutputCollectionobj->get_tau(i)))["Iso"]);
}
return StatusCode::SUCCESS;
}
StatusCode LVL1::eFEXNtupleWriter::loadegAlgoVariables() {
StatusCode LVL1::eFEXNtupleWriter::loadegAlgoVariables(SG::ReadHandle<LVL1::eFEXOutputCollection> eFEXOutputCollectionobj) {
m_eg_ET.clear();
m_eg_WstotNum.clear();
m_eg_WstotDen.clear();
......@@ -149,10 +152,10 @@ StatusCode LVL1::eFEXNtupleWriter::loadegAlgoVariables() {
m_em.clear();
m_had.clear();
m_eg_nTOBs = m_eFEXOutputCollection->size();
for (int i = 0; i < m_eFEXOutputCollection->size(); i++)
m_eg_nTOBs = eFEXOutputCollectionobj->size();
for (int i = 0; i < eFEXOutputCollectionobj->size(); i++)
{
std::map<std::string, float> eFEXegvalue_tem = (*(m_eFEXOutputCollection->get_eg(i)));
std::map<std::string, float> eFEXegvalue_tem = (*(eFEXOutputCollectionobj->get_eg(i)));
m_eg_WstotNum.push_back(eFEXegvalue_tem["WstotNum"]);
m_eg_WstotDen.push_back(eFEXegvalue_tem["WstotDen"]);
m_eg_RetaNum.push_back(eFEXegvalue_tem["RetaNum"]);
......@@ -169,7 +172,7 @@ StatusCode LVL1::eFEXNtupleWriter::loadegAlgoVariables() {
return StatusCode::SUCCESS;
}
StatusCode LVL1::eFEXNtupleWriter::loadegAlgoTOBs() {
StatusCode LVL1::eFEXNtupleWriter::loadegAlgoTOBs(SG::ReadHandle<LVL1::eFEXOutputCollection> eFEXOutputCollectionobj) {
m_eg_TOB_FP.clear();
m_eg_TOB_Eta.clear();
m_eg_TOB_Phi.clear();
......@@ -181,9 +184,9 @@ StatusCode LVL1::eFEXNtupleWriter::loadegAlgoTOBs() {
m_eg_TOB_Max.clear();
m_eg_TOB_zeros.clear();
m_eg_TOB_energy.clear();
for (int i = 0; i < m_eFEXOutputCollection->size(); i++)
for (int i = 0; i < eFEXOutputCollectionobj->size(); i++)
{
uint32_t TOB = m_eFEXOutputCollection->getEMtob()[i];
uint32_t TOB = eFEXOutputCollectionobj->getEMtob()[i];
uint32_t FP = getbits(TOB, 1, 2);
uint32_t Eta = getbits(TOB, 3, 5);
uint32_t Phi = getbits(TOB, 6, 8);
......@@ -208,7 +211,7 @@ StatusCode LVL1::eFEXNtupleWriter::loadegAlgoTOBs() {
m_eg_TOB_zeros.push_back(zeros);
m_eg_TOB_energy.push_back(energy * 100);
}
m_eFex_number = m_eFEXOutputCollection->geteFexNumber();
m_eFex_number = eFEXOutputCollectionobj->geteFexNumber();
return StatusCode::SUCCESS;
}
......
......@@ -4,6 +4,10 @@
#include "L1CaloFEXSim/eFEXOutputCollection.h"
LVL1::eFEXOutputCollection::eFEXOutputCollection() {
m_dooutput = false;
}
LVL1::eFEXOutputCollection::~eFEXOutputCollection()
{
for (auto iValues : m_allvalues_eg) {
......@@ -50,24 +54,24 @@ void LVL1::eFEXOutputCollection::fill_tau()
m_values_tem_tau.clear();
}
int LVL1::eFEXOutputCollection::tau_size()
int LVL1::eFEXOutputCollection::tau_size() const
{
return m_allvalues_tau.size();
}
int LVL1::eFEXOutputCollection::size()
int LVL1::eFEXOutputCollection::size() const
{
return m_allvalues_eg.size();
}
std::map<std::string, float>* LVL1::eFEXOutputCollection::get_eg(int location)
std::map<std::string, float>* LVL1::eFEXOutputCollection::get_eg(int location) const
{
return m_allvalues_eg[location];
return m_allvalues_eg.at(location);
}
std::map<std::string, float>* LVL1::eFEXOutputCollection::get_tau(int location)
std::map<std::string, float>* LVL1::eFEXOutputCollection::get_tau(int location) const
{
return m_allvalues_tau[location];
return m_allvalues_tau.at(location);
}
void LVL1::eFEXOutputCollection::addeFexNumber(int efexnumber)
......@@ -75,7 +79,7 @@ void LVL1::eFEXOutputCollection::addeFexNumber(int efexnumber)
m_eFexNumber.push_back(efexnumber);
}
std::vector<int> LVL1::eFEXOutputCollection::geteFexNumber()
std::vector<int> LVL1::eFEXOutputCollection::geteFexNumber() const
{
return m_eFexNumber;
}
......@@ -85,7 +89,16 @@ void LVL1::eFEXOutputCollection::addEMtob(uint32_t emtob)
m_emtob.push_back(emtob);
}
std::vector<uint32_t> LVL1::eFEXOutputCollection::getEMtob()
std::vector<uint32_t> LVL1::eFEXOutputCollection::getEMtob() const
{
return m_emtob;
}
void LVL1::eFEXOutputCollection::setdooutput(bool input) {
m_dooutput = input;
}
bool LVL1::eFEXOutputCollection::getdooutput() const {
return m_dooutput;
}
\ No newline at end of file
......@@ -74,7 +74,7 @@ namespace LVL1 {
}
StatusCode eFEXSim::NewExecute(int tmp_eTowersIDs_subset[10][18]){
StatusCode eFEXSim::NewExecute(int tmp_eTowersIDs_subset[10][18], eFEXOutputCollection* inputOutputCollection){
m_emTobWords.clear();
m_tauTobWords.clear();
......@@ -93,7 +93,7 @@ StatusCode eFEXSim::NewExecute(int tmp_eTowersIDs_subset[10][18]){
}
ATH_CHECK(m_eFEXFPGATool->init(0, m_id));
m_eFEXFPGATool->SetTowersAndCells_SG(tmp_eTowersIDs_subset_FPGA);
ATH_CHECK(m_eFEXFPGATool->execute());
ATH_CHECK(m_eFEXFPGATool->execute(inputOutputCollection));
m_emTobWords.push_back(m_eFEXFPGATool->getEmTOBs());
m_tauTobWords.push_back(m_eFEXFPGATool->getTauTOBs());
m_eFEXFPGATool->reset();
......@@ -108,7 +108,7 @@ StatusCode eFEXSim::NewExecute(int tmp_eTowersIDs_subset[10][18]){
}
ATH_CHECK(m_eFEXFPGATool->init(1, m_id));
m_eFEXFPGATool->SetTowersAndCells_SG(tmp_eTowersIDs_subset_FPGA);
ATH_CHECK(m_eFEXFPGATool->execute());
ATH_CHECK