ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetEventCnv
ITkPixelByteStreamCnv
src
ITkPixelHitSortingTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
ITkPixelHitSortingTool.h
"
6
#include "
InDetIdentifier/PixelID.h
"
7
#include "
PixelReadoutGeometry/PixelDetectorManager.h
"
8
#include "
InDetReadoutGeometry/SiDetectorElement.h
"
9
#include "
PixelReadoutGeometry/PixelModuleDesign.h
"
10
#include "
InDetRawData/PixelRDORawData.h
"
11
#include "
InDetRawData/Pixel1RawData.h
"
12
#include "
ITkPixel1RawData.h
"
13
#include "
InDetRawData/PixelRDO_Container.h
"
14
#include "
ITkPixelRDO_Container.h
"
15
#include "
ITkPixelCabling/ITkPixelCablingData.h
"
16
17
18
#include <map>
19
20
ITkPixelHitSortingTool::ITkPixelHitSortingTool
(
const
std::string&
type
,
const
std::string& name,
const
IInterface* parent) :
21
AthAlgTool
(
type
,name,parent)
22
{
23
//not much to construct as of now
24
}
25
26
27
StatusCode
ITkPixelHitSortingTool::initialize
(){
28
ATH_CHECK
(
m_pixelReadout
.retrieve());
29
ATH_CHECK
(
detStore
()->retrieve(
m_pixIdHelper
,
"PixelID"
));
30
ATH_CHECK
(
detStore
()->retrieve(
m_detManager
,
"ITkPixel"
));
31
return
StatusCode::SUCCESS;
32
}
33
34
template
<
class
ContainerType>
35
std::map<ITkPixelOnlineId, ITkPixLayout<uint16_t>>
ITkPixelHitSortingTool::sortRDOHits
(
const
ContainerType* rdoContainer,
const
ITkPixelCablingData
* cabling)
const
{
36
37
std::map<ITkPixelOnlineId, ITkPixLayout<uint16_t>> EventHitMaps;
38
39
for
(
const
auto
& RDO_Collection : *rdoContainer){
40
41
for
(
const
auto
*
const
rdo : *RDO_Collection) {
42
43
const
Identifier
rdoID = rdo->identify();
44
const
Identifier
waferID =
m_pixIdHelper
->wafer_id(rdoID);
45
46
const
uint16_t tot = rdo->getToT();
47
48
//This part will see changes. The PixelReadoutManager will be
49
//retired, and the chip <-> module translation will happen likely
50
//in PixelModuleDesign. Also, figuring out whether we're dealing
51
//with 25x100 or R0 modules can be greatly simplified.
52
//---------->
53
const
uint32_t chip =
m_pixelReadout
->getFE( rdoID, waferID);
54
uint32_t col =
m_pixelReadout
->getColumn( rdoID, waferID);
55
uint32_t row =
m_pixelReadout
->getRow( rdoID, waferID);
56
57
//find out if we're dealing with 25x100 sensors
58
const
InDetDD::SiDetectorElement
*element =
m_detManager
->getDetectorElement(waferID);
59
const
InDetDD::PixelModuleDesign
*p_design =
static_cast<
const
InDetDD::PixelModuleDesign
*
>
(&element->
design
());
60
const
uint
nChips = p_design->
numberOfCircuits
();
61
const
uint
rowsPerFE = p_design->
rowsPerCircuit
();
62
const
uint
colsPerFE = p_design->
columnsPerCircuit
();
63
bool
is25x100 = rowsPerFE == 768 && colsPerFE == 200;
64
ATH_MSG_DEBUG
(
"Module specs: nChips = "
<< nChips <<
", rows per FE = "
<< rowsPerFE <<
" cols per FE = "
<< colsPerFE);
65
//<----------
66
67
if
(is25x100){
68
//The bonding pattern as understood at the time of writing this code is
69
//that odd sensor rows (with even indices if numbered from 0) are bonded to the left and even (= odd indices) to the right.
70
col = 2 * col + (row + 1)% 2;
71
row = row / 2;
72
ATH_MSG_DEBUG
(
"Adding hit from 25x100 pixel"
);
73
}
74
else
if
(colsPerFE == 384 && rowsPerFE == 400){
75
//R0 EC modules are 90 degrees rotated, the readout manager doesn't know about it
76
std::swap
(col, row);
77
ATH_MSG_DEBUG
(
"Rotated chip - swapping col and row"
);
78
}
79
80
//Store ToT+1, reserve 0 for no hit.
81
//HitMap and encoder labels rows/cols from 0
82
83
//Data from a FE are identified by "DetectorResourceID", which is part
84
//of the header delimiting individual FE payloads within a ROD fragment
85
//payload. The DetectorResourceID is detector-defined. For pixels, it
86
//has an 'online part', containing chipID and information useful for decoding
87
//(chipID on/off). Then there's an offline-specific part
88
//composed - for convenience - of (offline) module ID. We can mask out
89
//the auxiliary online info to get the mapping from FE -> online ID
90
// offlineDetectorResourceID = chipID [2 MSB] | module ID [24 LSB]
91
//Furthermore, we need to know which ROB fragment the data will go to,
92
//hence we need the 'sourceID' (in eformat vocabulary), which identifies
93
//the DMA buffer on the FELIX machine that received the data. This is
94
//all provided by the cabling package, which gives
95
// offlineDetectorResourceID -> {DetectorResourceID, sourceID}
96
//mapping.
97
98
//ITkPixelCabling::ModuleInfo mi = cabling->onlineModuleInfo(waferID);
99
uint32_t offlineDetectorResourceID = (waferID.
get_identifier32
().get_compact() >> 8) | (chip << 30);
100
101
ITkPixelOnlineId
onlineID = cabling->onlineId(offlineDetectorResourceID);
102
103
//Found a valid ID?
104
if
(onlineID.
sourceID
() == 0xFFFFFFFF){
105
ATH_MSG_WARNING
(
"Cabling not found for module bec "
<< std::dec <<
m_pixIdHelper
->barrel_ec(waferID) <<
" ld "
<<
m_pixIdHelper
->layer_disk(waferID) <<
" eta "
<<
m_pixIdHelper
->eta_module(waferID) <<
" phi "
<<
m_pixIdHelper
->phi_module(waferID) <<
", proceeding with a dummy value"
);
106
onlineID =
ITkPixelOnlineId
(0x00170000 | (offlineDetectorResourceID & 0x0000FFFF), offlineDetectorResourceID | 0xF0000000);
107
}
108
109
ATH_MSG_DEBUG
(
" Chip: "
<< std::hex << onlineID << std::dec <<
" ID: "
<< chip <<
" col: "
<< col <<
" row: "
<< row <<
" ToT: "
<< tot <<
" eta_index = "
<<
m_pixIdHelper
->eta_index(rdoID) <<
" phi index = "
<<
m_pixIdHelper
->phi_index(rdoID) <<
" rowsPerFE = "
<< rowsPerFE <<
" colsPerFE = "
<< colsPerFE <<
"\n"
);
110
111
EventHitMaps[onlineID](col, row) = tot + 1;
112
113
};
114
};
115
116
return
EventHitMaps;
117
118
}
119
120
template
std::map<ITkPixelOnlineId, ITkPixLayout<uint16_t>>
ITkPixelHitSortingTool::sortRDOHits<ITkPixelRDO_Container>
(
const
ITkPixelRDO_Container
* rdoContainer,
const
ITkPixelCablingData
* cabling)
const
;
121
template
std::map<ITkPixelOnlineId, ITkPixLayout<uint16_t>>
ITkPixelHitSortingTool::sortRDOHits<PixelRDO_Container>
(
const
PixelRDO_Container
* rdoContainer,
const
ITkPixelCablingData
* cabling)
const
;
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x,...)
Definition
AthMsgStreamMacros.h:46
ITkPixel1RawData.h
ITkPixelCablingData.h
ITkPixelHitSortingTool.h
ITkPixelRDO_Container.h
ITkPixelRDO_Container
InDetRawDataContainer< InDetRawDataCollection< ITkPixelRDORawData > > ITkPixelRDO_Container
Definition
ITkPixelRDO_Container.h:22
uint
unsigned int uint
Definition
LArOFPhaseFill.cxx:19
Pixel1RawData.h
PixelDetectorManager.h
PixelID.h
This is an Identifier helper class for the Pixel subdetector.
PixelModuleDesign.h
PixelRDORawData.h
PixelRDO_Container.h
PixelRDO_Container
InDetRawDataContainer< InDetRawDataCollection< PixelRDORawData > > PixelRDO_Container
Definition
PixelRDO_Container.h:25
SiDetectorElement.h
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
ITkPixelCablingData
Definition
ITkPixelCablingData.h:127
ITkPixelHitSortingTool::m_pixelReadout
ServiceHandle< InDetDD::IPixelReadoutManager > m_pixelReadout
Definition
ITkPixelHitSortingTool.h:48
ITkPixelHitSortingTool::sortRDOHits
std::map< ITkPixelOnlineId, HitMap > sortRDOHits(const ContainerType *rdoContainer, const ITkPixelCablingData *cabling) const
ITkPixelHitSortingTool::ITkPixelHitSortingTool
ITkPixelHitSortingTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
ITkPixelHitSortingTool.cxx:20
ITkPixelHitSortingTool::initialize
StatusCode initialize()
Definition
ITkPixelHitSortingTool.cxx:27
ITkPixelHitSortingTool::m_pixIdHelper
const PixelID * m_pixIdHelper
Definition
ITkPixelHitSortingTool.h:50
ITkPixelHitSortingTool::m_detManager
const InDetDD::PixelDetectorManager * m_detManager
Definition
ITkPixelHitSortingTool.h:52
ITkPixelOnlineId
Definition
ITkPixelOnlineId.h:60
ITkPixelOnlineId::sourceID
std::uint32_t sourceID() const
Return the rod/rob Id.
Definition
ITkPixelOnlineId.cxx:20
Identifier::get_identifier32
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
InDetDD::PixelModuleDesign
Class used to describe the design of a module (diode segmentation and readout scheme).
Definition
PixelModuleDesign.h:45
InDetDD::PixelModuleDesign::rowsPerCircuit
int rowsPerCircuit() const
Number of cell rows per circuit:
Definition
PixelModuleDesign.h:326
InDetDD::PixelModuleDesign::numberOfCircuits
int numberOfCircuits() const
Total number of circuits:
Definition
PixelModuleDesign.h:306
InDetDD::PixelModuleDesign::columnsPerCircuit
int columnsPerCircuit() const
Number of cell columns per circuit:
Definition
PixelModuleDesign.h:321
InDetDD::SiDetectorElement
Class to hold geometrical description of a silicon detector element.
Definition
SiDetectorElement.h:109
InDetDD::SiDetectorElement::design
virtual const SiDetectorDesign & design() const override final
access to the local description (inline):
Identifier
Definition
IdentifierFieldParser.cxx:14
std::swap
void swap(ElementLinkVector< DOBJ > &lhs, ElementLinkVector< DOBJ > &rhs)
Definition
AthLinks/ElementLinkVector.h:484
type
Generated on
for ATLAS Offline Software by
1.17.0