ATLAS Offline Software
Loading...
Searching...
No Matches
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
18
19InDet::PRD_TruthTrajectoryManipulatorID::PRD_TruthTrajectoryManipulatorID(const std::string& t, const std::string& n, const IInterface* p) :
20AthAlgTool(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;
47 std::vector<const Trk::PrepRawData* >::iterator prdIter = prdvec.prds.begin();
48 std::vector<const Trk::PrepRawData* >::iterator prdIterE = prdvec.prds.end();
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}
#define endmsg
#define ATH_MSG_VERBOSE(x)
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
static Double_t sc
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
const ServiceHandle< StoreGateSvc > & detStore() const
MsgStream & msg() const
virtual bool manipulateTruthTrajectory(Trk::PRD_TruthTrajectory &) const
Interface method from IPRD_TruthTrajectoryManipulator.
const AtlasDetectorID * m_atlasId
ID pixel helper.
PRD_TruthTrajectoryManipulatorID(const std::string &t, const std::string &n, const IInterface *p)
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...
simple definitiion of a PRD_TruhtTrajectory
std::vector< const Trk::PrepRawData * > prds
public members
HepMC::ConstGenParticlePtr genParticle