ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetTruth
InDetTruthTools
src
PRD_TruthTrajectoryManipulatorID.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// PRD_TruthTrajectoryManipulatorID.cxx, (c) ATLAS Detector software
8
9
#include "
InDetTruthTools/PRD_TruthTrajectoryManipulatorID.h
"
10
#include "
InDetPrepRawData/SCT_Cluster.h
"
11
#include "
InDetPrepRawData/TRT_DriftCircle.h
"
12
#include "
InDetPrepRawData/PixelCluster.h
"
13
// DetectorDescription
14
#include "
AtlasDetDescr/AtlasDetectorID.h
"
15
// HepMC
16
#include "
AtlasHepMC/GenParticle.h
"
17
#include "
TruthUtils/MagicNumbers.h
"
18
19
InDet::PRD_TruthTrajectoryManipulatorID::PRD_TruthTrajectoryManipulatorID
(
const
std::string& t,
const
std::string& n,
const
IInterface* p) :
20
AthAlgTool
(t,n,p)
21
{
22
declareInterface<Trk::IPRD_TruthTrajectoryManipulator>(
this
);
23
}
24
25
StatusCode
InDet::PRD_TruthTrajectoryManipulatorID::initialize
() {
26
ATH_MSG_VERBOSE
(
"Initializing ..."
);
27
StatusCode
sc
=
detStore
()->retrieve(
m_atlasId
,
"AtlasID"
);
28
if
(
sc
.isFailure()) {
29
msg
(MSG::ERROR) <<
"Could not get AtlasID helper !"
<<
endmsg
;
30
return
StatusCode::FAILURE;
31
}
32
return
StatusCode::SUCCESS;
33
}
34
35
StatusCode
InDet::PRD_TruthTrajectoryManipulatorID::finalize
() {
36
ATH_MSG_VERBOSE
(
"Finalizing ..."
);
37
return
StatusCode::SUCCESS;
38
}
39
40
bool
InDet::PRD_TruthTrajectoryManipulatorID::manipulateTruthTrajectory
(
Trk::PRD_TruthTrajectory
&prdvec)
const
{
41
42
if
( !
HepMC::is_simulation_particle
(prdvec.
genParticle
)){
43
srand(
static_cast<
unsigned
int
>
( time(
nullptr
) ) );
// FIXME reproducibility issue?
44
const
int
pdg_id = (*prdvec.
genParticle
).pdg_id();
45
const
double
prob_pix = pdg_id == 2212 ? 4. : 0;
46
const
double
prob_sct = 4.375;
47
std::vector<const Trk::PrepRawData* >::iterator prdIter = prdvec.
prds
.begin();
48
std::vector<const Trk::PrepRawData* >::iterator prdIterE = prdvec.
prds
.end();
49
//should a better RNG be used?
50
while
( prdIter != prdIterE ){
51
if
(
m_atlasId
->is_pixel((*prdIter)->identify()) ){
52
//coverity[DC.WEAK_CRYPTO]
53
if
( prob_pix > 0 ? rand()%100 <= prob_pix :
false
){
54
prdIter = prdvec.
prds
.erase(prdIter);
55
prdIterE = prdvec.
prds
.end();
56
}
57
else
++ prdIter;
58
}
59
else
if
(
m_atlasId
->is_sct((*prdIter)->identify()) ){
60
//coverity[DC.WEAK_CRYPTO]
61
if
( rand()%100 <= prob_sct ){
62
prdIter = prdvec.
prds
.erase(prdIter);
63
prdIterE = prdvec.
prds
.end();
64
}
65
else
++ prdIter;
66
}
67
else
++ prdIter;
68
}
69
}
70
71
return
true
;
72
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
AtlasDetectorID.h
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
GenParticle.h
PixelCluster.h
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
MagicNumbers.h
PRD_TruthTrajectoryManipulatorID.h
SCT_Cluster.h
TRT_DriftCircle.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
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition
AthCommonMsg.h:24
InDet::PRD_TruthTrajectoryManipulatorID::manipulateTruthTrajectory
virtual bool manipulateTruthTrajectory(Trk::PRD_TruthTrajectory &) const
Interface method from IPRD_TruthTrajectoryManipulator.
Definition
PRD_TruthTrajectoryManipulatorID.cxx:40
InDet::PRD_TruthTrajectoryManipulatorID::m_atlasId
const AtlasDetectorID * m_atlasId
ID pixel helper.
Definition
PRD_TruthTrajectoryManipulatorID.h:45
InDet::PRD_TruthTrajectoryManipulatorID::initialize
StatusCode initialize()
Definition
PRD_TruthTrajectoryManipulatorID.cxx:25
InDet::PRD_TruthTrajectoryManipulatorID::PRD_TruthTrajectoryManipulatorID
PRD_TruthTrajectoryManipulatorID(const std::string &t, const std::string &n, const IInterface *p)
Definition
PRD_TruthTrajectoryManipulatorID.cxx:19
InDet::PRD_TruthTrajectoryManipulatorID::finalize
StatusCode finalize()
Definition
PRD_TruthTrajectoryManipulatorID.cxx:35
HepMC::is_simulation_particle
bool is_simulation_particle(const T &p)
Method to establish if a particle (or barcode) was created during the simulation (TODO update to be s...
Definition
MagicNumbers.h:322
Trk::PRD_TruthTrajectory
simple definitiion of a PRD_TruhtTrajectory
Definition
PRD_TruthTrajectory.h:27
Trk::PRD_TruthTrajectory::prds
std::vector< const Trk::PrepRawData * > prds
public members
Definition
PRD_TruthTrajectory.h:30
Trk::PRD_TruthTrajectory::genParticle
HepMC::ConstGenParticlePtr genParticle
Definition
PRD_TruthTrajectory.h:31
Generated on
for ATLAS Offline Software by
1.17.0