ATLAS Offline Software
jTowerMakerFromSuperCells.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #undef NDEBUG
6 
10 
12 
13 #include "L1CaloFEXSim/jTower.h"
15 
18 
19 #include "SGTools/TestStore.h"
20 
21 
22 #include <fstream>
23 
24 #define DEBUG_VHB 1
25 
26 
27 namespace LVL1 {
28 
30 
32 {
33 
34  ATH_CHECK( m_jTowerBuilderTool.retrieve() );
37 
38  return StatusCode::SUCCESS;
39 }
40 
41 
43 
44 
45  // STEP 0 - Make a fresh local jTowerContainer
46  std::unique_ptr<jTowerContainer> local_jTowerContainerRaw = std::make_unique<jTowerContainer>();
47 
48  // STEP 1 - Make some jTowers and fill the local container
49  m_jTowerBuilderTool->init(local_jTowerContainerRaw);
50 
51 
52  // STEP 2 - Do the supercell-tower mapping - put this information into the jTowerContainer
53  ATH_CHECK(m_jSuperCellTowerMapperTool->AssignSuperCellsToTowers(local_jTowerContainerRaw));
54  ATH_CHECK(m_jSuperCellTowerMapperTool->AssignTriggerTowerMapper(local_jTowerContainerRaw));
55 
56  //STEP 2.5 - Set up a file mapping if necessary (should only need to be done if the mapping changes, which should never happen unless major changes to the simulation are required)
57  // Only used for simulation experts. Contact one of us first
58  // With just one event should be enough to generate the file
59  if(false) {
60 
61  ATH_MSG_INFO("Writting the mapping for jFEX");
62  std::ofstream sc_tower_map;
63  sc_tower_map.open("./new_jfex_SCID.txt");
64  sc_tower_map << "# Simulation ID, 12 Scells (EMB or EMEC or FCAL1 layer) + 1 Scell (HEC or FCAL2/3 layer)" << "\n";
65 
66  for(const auto & jtower : *local_jTowerContainerRaw) {
67  sc_tower_map << jtower->OfflineID() << " ";
68 
69  std::vector<Identifier> vEM = jtower->getEMSCIDs();
70  for(const auto& SCellID : vEM) {
71  sc_tower_map << SCellID << " ";
72  }
73  for(unsigned int i=0; i<(12-vEM.size()); i++) {
74  sc_tower_map << "0xffffffffffffffff" << " ";
75  }
76 
77  std::vector<Identifier> vHAD = jtower->getHADSCIDs();
78  for(const auto& SCellID : vHAD) {
79  sc_tower_map << SCellID << " ";
80  }
81  if(vHAD.size()==0) {
82  sc_tower_map << "0xffffffffffffffff" << " ";
83  }
84  sc_tower_map << "\n";
85  }
86 
87  sc_tower_map.close();
88  }
89 
90  // STEP 3 - Write the completed jTowerContainer into StoreGate (move the local copy in memory)
92  ATH_CHECK(jTowerContainerSG.record(std::move( local_jTowerContainerRaw ) ) );
93 
94  // STEP 4 - Close and clean the event
96  m_jTowerBuilderTool->reset();
97 
98  return StatusCode::SUCCESS;
99 }
100 
101 } // end of LVL1 namespace
LVL1::jTowerMakerFromSuperCells::m_jTowerContainerSGKey
SG::WriteHandleKey< LVL1::jTowerContainer > m_jTowerContainerSGKey
Definition: jTowerMakerFromSuperCells.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
LVL1::jTowerMakerFromSuperCells::m_jTowerBuilderTool
ToolHandle< IjTowerBuilder > m_jTowerBuilderTool
Definition: jTowerMakerFromSuperCells.h:42
TriggerTowerContainer.h
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
jTowerBuilder.h
lumiFormat.i
int i
Definition: lumiFormat.py:92
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CaloCell_SuperCell_ID.h
Helper class for offline supercell identifiers.
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
LVL1::jTowerMakerFromSuperCells::m_jSuperCellTowerMapperTool
ToolHandle< IjSuperCellTowerMapper > m_jSuperCellTowerMapperTool
Definition: jTowerMakerFromSuperCells.h:43
LVL1::jTowerMakerFromSuperCells::initialize
virtual StatusCode initialize()
Definition: jTowerMakerFromSuperCells.cxx:31
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
LVL1::jTowerMakerFromSuperCells::execute
virtual StatusCode execute()
Definition: jTowerMakerFromSuperCells.cxx:42
AthAlgorithm
Definition: AthAlgorithm.h:47
TrigConf::name
Definition: HLTChainList.h:35
TestStore.h
Dummy event store, for regression tests.
jSuperCellTowerMapper.h
CaloCellContainer.h
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
LVL1::jTowerMakerFromSuperCells::jTowerMakerFromSuperCells
jTowerMakerFromSuperCells(const std::string &name, ISvcLocator *svc)
Definition: jTowerMakerFromSuperCells.cxx:29
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
CaloIdManager.h
jTowerMakerFromSuperCells.h
jTower.h