ATLAS Offline Software
PRD_TruthTrajectoryManipulatorID.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // PRD_TruthTrajectoryManipulatorID.cxx, (c) ATLAS Detector software
8 
13 // DetectorDescription
15 // HepMC
16 #include "AtlasHepMC/GenParticle.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 
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 
36  ATH_MSG_VERBOSE("Finalizing ...");
37  return StatusCode::SUCCESS;
38 }
39 
41 
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;
49 
50  while( prdIter != prdIterE ){
51  if( m_atlasId->is_pixel((*prdIter)->identify()) ){
52  if( prob_pix > 0 ? rand()%100 <= prob_pix : false ){
53  prdIter = prdvec.prds.erase(prdIter);
54  prdIterE = prdvec.prds.end();
55  }
56  else ++ prdIter;
57  }
58  else if( m_atlasId->is_sct((*prdIter)->identify()) ){
59  if( rand()%100 <= prob_sct ){
60  prdIter = prdvec.prds.erase(prdIter);
61  prdIterE = prdvec.prds.end();
62  }
63  else ++ prdIter;
64  }
65  else ++ prdIter;
66  }
67  }
68 
69  return true;
70 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
AtlasDetectorID::is_pixel
bool is_pixel(Identifier id) const
Definition: AtlasDetectorID.h:760
InDet::PRD_TruthTrajectoryManipulatorID::manipulateTruthTrajectory
virtual bool manipulateTruthTrajectory(Trk::PRD_TruthTrajectory &) const
Interface method from IPRD_TruthTrajectoryManipulator.
Definition: PRD_TruthTrajectoryManipulatorID.cxx:40
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
AtlasDetectorID::is_sct
bool is_sct(Identifier id) const
Definition: AtlasDetectorID.h:770
PixelCluster.h
Trk::PRD_TruthTrajectory::genParticle
HepMC::ConstGenParticlePtr genParticle
Definition: PRD_TruthTrajectory.h:31
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SCT_Cluster.h
GenParticle.h
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
AtlasDetectorID.h
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
LArG4FSStartPointFilter.rand
rand
Definition: LArG4FSStartPointFilter.py:80
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:299
beamspotman.n
n
Definition: beamspotman.py:731
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
PRD_TruthTrajectoryManipulatorID.h
TRT_DriftCircle.h
Trk::PRD_TruthTrajectory
Definition: PRD_TruthTrajectory.h:27
MagicNumbers.h
InDet::PRD_TruthTrajectoryManipulatorID::finalize
StatusCode finalize()
Definition: PRD_TruthTrajectoryManipulatorID.cxx:35
InDet::PRD_TruthTrajectoryManipulatorID::PRD_TruthTrajectoryManipulatorID
PRD_TruthTrajectoryManipulatorID(const std::string &t, const std::string &n, const IInterface *p)
Definition: PRD_TruthTrajectoryManipulatorID.cxx:19
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
AthAlgTool
Definition: AthAlgTool.h:26
Trk::PRD_TruthTrajectory::prds
std::vector< const Trk::PrepRawData * > prds
public members
Definition: PRD_TruthTrajectory.h:30
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