ATLAS Offline Software
Tracking
TrkEvent
TrkParametersIdentificationHelpers
exe
TestTrkParametersIdentificationHelpers.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TrkParametersIdentificationHelpers/TrackParametersIdentificationHelper.h
"
6
7
#include <iostream>
8
#include <iomanip>
9
#include <bitset>
10
11
void
testBitField
(){
12
Trk::BitField<unsigned int>
field
(31,1);
13
TrackParametersIdentifier
id
=0;
14
unsigned
int
max
= -1;
15
std::cout <<
" starting loop "
<<
max
<< std::endl;
16
for
(
unsigned
int
i
=0;
i
<
max
;++
i
){
17
if
( !
field
.encode(
i
,
id
) ){
18
std::cout <<
" encoding failed for "
<<
i
<< std::endl;
19
break
;
20
}
21
unsigned
int
value
=
field
.decode(
id
);
22
std::cout <<
" i "
<< std::setw(3) <<
i
<<
" value "
<< std::setw(3) <<
value
<<
" "
<< std::bitset<32>(
i
) <<
" id "
<< std::bitset<32>(
id
) << std::endl;
23
}
24
}
25
26
void
testCalo
() {
27
28
Trk::TrackParametersIdHelper
helper
;
29
unsigned
int
good
= 0;
30
unsigned
int
bad
= 0;
31
unsigned
int
goodCalo = 0;
32
unsigned
int
badCalo = 0;
33
34
// loop over technologies
35
for
(
unsigned
int
tech =
AtlasDetDescr::fFirstAtlasDetTechnology
; tech <
AtlasDetDescr::fNumAtlasDetTechnologies
; ++tech ){
36
37
bool
isCalo = (tech >=
AtlasDetDescr::fFirstAtlasCaloTechnology
) && (tech <=
AtlasDetDescr::fLastAtlasCaloTechnology
);
38
39
// loop over samplings
40
for
(
unsigned
int
sample
=
CaloSampling::PreSamplerB
;
sample
<
CaloSampling::Unknown
; ++
sample
){
41
42
for
(
unsigned
int
isEntry = 0; isEntry < 2 ; ++isEntry ){
43
bool
entry
= isEntry == 1;
44
TrackParametersIdentifier
id
=
helper
.encode(
static_cast<
AtlasDetDescr::AtlasDetTechnology
>
(tech),
45
static_cast<
CaloSampling::CaloSample
>
(
sample
),
entry
);
46
AtlasDetDescr::AtlasDetTechnology
itech =
helper
.technology(
id
);
47
CaloSampling::CaloSample
isample =
helper
.caloSample(
id
);
48
bool
ientry =
helper
.isEntryToVolume(
id
);
49
bool
ivalid =
helper
.isValid(
id
);
50
bool
printDetails =
false
;
51
if
( !ivalid ||
sample
!= isample ||
entry
!= ientry ) {
52
++
bad
;
53
if
( isCalo ) {
54
std::cout <<
"WARNING bad decoding/encoding "
<< std::endl;
55
++badCalo;
56
printDetails =
true
;
57
}
58
}
else
{
59
++
good
;
60
if
( isCalo ) { ++goodCalo;
61
}
else
{
62
std::cout <<
" good but no calo!!! "
<< std::endl;
63
printDetails =
true
;
64
}
65
}
66
if
( printDetails ){
67
std::cout <<
" tech "
<< std::setw(4) << tech <<
" sample "
<< std::setw(4) <<
sample
<<
" isEntry "
<<
entry
<< std::endl
68
<<
" itech "
<< std::setw(4) << itech <<
" isample "
<< std::setw(4) << isample <<
" isEntry "
<< ientry
69
<<
" valid "
<< ivalid <<
" id "
<< std::bitset<32>(
id
) << std::endl;
70
}
71
}
72
}
73
}
74
std::cout <<
"all: good "
<<
good
<<
" bad "
<<
bad
<< std::endl;
75
std::cout <<
"calo: good "
<< goodCalo <<
" bad "
<< badCalo << std::endl;
76
77
}
78
79
80
int
main
() {
81
82
testBitField
();
83
testCalo
();
84
}
bad
@ bad
Definition:
SUSYToolsTester.cxx:100
GetLCDefs::Unknown
@ Unknown
Definition:
GetLCDefs.h:21
Trk::BitField< unsigned int >
max
constexpr double max()
Definition:
ap_fixedTest.cxx:33
athena.value
value
Definition:
athena.py:124
ReadOfcFromCool.field
field
Definition:
ReadOfcFromCool.py:48
AtlasDetDescr::fLastAtlasCaloTechnology
@ fLastAtlasCaloTechnology
Definition:
AtlasDetTechnology.h:46
runBeamSpotCalibration.helper
helper
Definition:
runBeamSpotCalibration.py:112
AtlasDetDescr::fFirstAtlasDetTechnology
@ fFirstAtlasDetTechnology
Definition:
AtlasDetTechnology.h:32
Trk::TrackParametersIdHelper
helper class to encode and decode a TrackParametersIdentifier
Definition:
TrackParametersIdHelper.h:18
FullCPAlgorithmsTest_eljob.sample
sample
Definition:
FullCPAlgorithmsTest_eljob.py:113
lumiFormat.i
int i
Definition:
lumiFormat.py:85
CaloSampling::CaloSample
CaloSample
Definition:
Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
AtlasDetDescr::fFirstAtlasCaloTechnology
@ fFirstAtlasCaloTechnology
Definition:
AtlasDetTechnology.h:40
AtlasDetDescr::AtlasDetTechnology
AtlasDetTechnology
Definition:
AtlasDetTechnology.h:28
AtlasDetDescr::fNumAtlasDetTechnologies
@ fNumAtlasDetTechnologies
Definition:
AtlasDetTechnology.h:57
TrackParametersIdentifier
unsigned int TrackParametersIdentifier
Definition:
TrackParametersIdHelper.h:13
GetAllXsec.entry
list entry
Definition:
GetAllXsec.py:132
ReadBchFromCool.good
good
Definition:
ReadBchFromCool.py:433
TrackParametersIdentificationHelper.h
CaloCell_ID_FCS::PreSamplerB
@ PreSamplerB
Definition:
FastCaloSim_CaloCell_ID.h:19
testBitField
void testBitField()
Definition:
TestTrkParametersIdentificationHelpers.cxx:11
testCalo
void testCalo()
Definition:
TestTrkParametersIdentificationHelpers.cxx:26
main
int main()
Definition:
TestTrkParametersIdentificationHelpers.cxx:80
Generated on Wed Jan 8 2025 21:18:13 for ATLAS Offline Software by
1.8.18