ATLAS Offline Software
L1CaloMatchCell2Tower.cxx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration.
3  */
21 #include "CaloEvent/CaloCell.h"
23 #include "CaloIdentifier/TileID.h"
25 #include "Identifier/Identifier.h"
27 
28 
29 using namespace LVL1;
30 
31 
33 {
35  ATH_CHECK( detStore()->retrieve (m_tileID, "TileID") );
36  ATH_CHECK( detStore()->retrieve (m_lvl1Helper, "CaloLVL1_ID") );
38  ATH_CHECK( m_ttSvc.retrieve() );
40  return StatusCode::SUCCESS;
41 }
42 
43 
45  Identifier& ttId1,
46  Identifier& ttId2) const
47 {
49  matchCell2Tower (**cabling, caloCell, ttId1, ttId2);
50 }
51 
52 
53 void L1CaloMatchCell2Tower::matchCell2Tower(const LArOnOffIdMapping& cabling,
54  const CaloCell* caloCell,
55  Identifier& ttId1,
56  Identifier& ttId2) const
57 {
58  const Identifier invalidId(0);
59  ttId1 = invalidId;
60  ttId2 = invalidId;
61  const Identifier cellId(caloCell->ID());
62 
63  const CaloCell_ID* caloCellHelper = m_caloMgr->getCaloCell_ID();
64 
65  // Tile cells
66  if (caloCellHelper->is_tile(cellId)) {
67 
68  int section = caloCellHelper->section(cellId);
69  int sample = caloCellHelper->sample(cellId);
70 
71  // gap detector - D4 & C10 cells
72  // both pmt of D4 belong to the same TT
73  if(section==3 && (sample==1 || sample==2) ) {
74  ttId1 = m_tileCablingService->cell2tt_id(cellId);
75 
76  // barrel & ext. barrel - D cells
77  } else if( (section==1 || section==2) && sample==2) {
78 
79  // special treatment of D-cells
80  // each pmt is affected to a different trigger tower
81  // each D-CaloCell is then added to 2 TT. This must ne taken into account when computing the TT energy
82  // from the CaloCells by dividing the D-cell energy by 2.
83  ttId1 = m_tileCablingService->pmt2tt_id(m_tileID->pmt_id(cellId, 0));
84  ttId2 = m_tileCablingService->pmt2tt_id(m_tileID->pmt_id(cellId, 1));
85 
86  // barrel & ext. barrel - A & BC cells
87  } else if( (section==1 || section==2) && (sample==0 || sample==1) ) {
88  ttId1 = m_tileCablingService->cell2tt_id(cellId);
89  }
90 
91  //LArg cells
92  } else {
93  //whichTTID ttId returns a layer_id, not a tower_id !
94  const Identifier layerId(m_ttSvc->whichTTID(cellId));
95 
96  // We are not calling here m_ttSvc->is_in_lvl1(cellId) but use directly its code for a performance reason
97  // By doing so we save a redundant and costly call to m_ttSvc->whichTTID()
98  bool lvl1(true);
99  if(caloCellHelper->is_em_barrel(cellId)) {
100  int samp=caloCellHelper->sampling(cellId);
101  if(samp==0) {
102  int eta=caloCellHelper->eta(cellId);
103  if(eta==60) {
104  lvl1 = false ;
105  }
106  }
107  } else {
108  if(m_lvl1Helper->is_hec(layerId)) {
109  int layer(m_lvl1Helper->layer(layerId));
110  if(layer == 3){
111  lvl1 = false ;
112  }
113  }
114  }
115 
116  if(lvl1) {
117  // check if the channel is connected
118  HWIdentifier channelID = cabling.createSignalChannelID(cellId);
119  if(cabling.isOnlineConnected(channelID)) {
120 
121  // As we don't want the layer information embedded in the identifier, we recreate a tower Id
122  ttId1 = m_lvl1Helper->tower_id( m_lvl1Helper->pos_neg_z(layerId), m_lvl1Helper->sampling(layerId), m_lvl1Helper->region(layerId), m_lvl1Helper->eta(layerId), m_lvl1Helper->phi(layerId));
123  }
124  }
125  }
126 
127 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
TileCablingService::pmt2tt_id
Identifier pmt2tt_id(const Identifier &id) const
Definition: TileCablingService.cxx:375
TileCablingService::getInstance
static const TileCablingService * getInstance()
get pointer to service instance
Definition: TileCablingService.cxx:24
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
ReadCellNoiseFromCool.cabling
cabling
Definition: ReadCellNoiseFromCool.py:154
LVL1::L1CaloMatchCell2Tower::matchCell2Tower
virtual void matchCell2Tower(const CaloCell *caloCell, Identifier &ttId1, Identifier &ttId2) const override
Definition: L1CaloMatchCell2Tower.cxx:44
CaloCell.h
CaloLVL1_ID::region
int region(const Identifier id) const
return region according to :
Definition: CaloLVL1_ID.h:647
L1CaloMatchCell2Tower.h
Map from calo cells to trigger towers.
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
CaloLVL1_ID::layer
int layer(const Identifier id) const
return layer according to :
Definition: CaloLVL1_ID.h:665
ReadCondHandle.h
LVL1::L1CaloMatchCell2Tower::m_lvl1Helper
const CaloLVL1_ID * m_lvl1Helper
Definition: L1CaloMatchCell2Tower.h:60
TileID.h
CaloLVL1_ID::is_hec
bool is_hec(const Identifier id) const
Test wether given tower or layer is part of the HEC.
Definition: CaloLVL1_ID.h:703
CaloLVL1_ID::phi
int phi(const Identifier id) const
return phi according to :
Definition: CaloLVL1_ID.h:659
FullCPAlgorithmsTest_eljob.sample
sample
Definition: FullCPAlgorithmsTest_eljob.py:100
TileCablingService.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
LVL1::L1CaloMatchCell2Tower::m_caloMgr
const CaloIdManager * m_caloMgr
Definition: L1CaloMatchCell2Tower.h:58
LVL1::L1CaloMatchCell2Tower::m_cablingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Definition: L1CaloMatchCell2Tower.h:67
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
CaloIdManager::getCaloCell_ID
const CaloCell_ID * getCaloCell_ID(void) const
Access to IdHelper.
Definition: CaloIdManager.cxx:63
CaloLVL1_ID::eta
int eta(const Identifier id) const
return eta according to :
Definition: CaloLVL1_ID.h:653
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
CaloCell::ID
Identifier ID() const
get ID (from cached data member) non-virtual and inline for fast access
Definition: CaloCell.h:279
CaloLVL1_ID::pos_neg_z
int pos_neg_z(const Identifier id) const
return pos_neg_z according to :
Definition: CaloLVL1_ID.h:635
LVL1::L1CaloMatchCell2Tower::initialize
virtual StatusCode initialize() override
Definition: L1CaloMatchCell2Tower.cxx:32
CaloLVL1_ID.h
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
LVL1::L1CaloMatchCell2Tower::m_ttSvc
ToolHandle< CaloTriggerTowerService > m_ttSvc
Definition: L1CaloMatchCell2Tower.h:64
Tile_Base_ID::pmt_id
Identifier pmt_id(const Identifier &any_id) const
Definition: Tile_Base_ID.cxx:640
LVL1::L1CaloMatchCell2Tower::m_tileCablingService
const TileCablingService * m_tileCablingService
Definition: L1CaloMatchCell2Tower.h:61
CaloLVL1_ID::sampling
int sampling(const Identifier id) const
return sampling according to :
Definition: CaloLVL1_ID.h:641
CaloIdManager.h
section
void section(const std::string &sec)
Definition: TestTriggerMenuAccess.cxx:22
CaloLVL1_ID::tower_id
Identifier tower_id(int pos_neg_z, int sampling, int region, int eta, int phi) const
build a tower identifier
Definition: CaloLVL1_ID.h:429
TileCablingService::cell2tt_id
Identifier cell2tt_id(const Identifier &id) const
Definition: TileCablingService.cxx:368
LVL1::L1CaloMatchCell2Tower::m_tileID
const TileID * m_tileID
Definition: L1CaloMatchCell2Tower.h:59