|
ATLAS Offline Software
|
Go to the documentation of this file.
37 #include "GaudiKernel/IPartPropSvc.h"
42 const float FPGATrackSim_PT_TRUTHMIN = 400.;
43 const float FPGATrackSim_Z_TRUTHMIN = 2300.;
59 IPartPropSvc* partPropSvc =
nullptr;
60 ATH_CHECK(service(
"PartPropSvc", partPropSvc));
81 return StatusCode::SUCCESS;
86 return StatusCode::SUCCESS;
100 event_info.
setLB(eventInfo->lumiBlock());
101 event_info.
setBCID(eventInfo->bcid());
116 std::vector <FPGATrackSimCluster>
clusters;
123 std::vector <FPGATrackSimTruthTrack> truth;
128 std::vector <FPGATrackSimOfflineTrack>
offline;
137 return StatusCode::SUCCESS;
144 ATH_MSG_DEBUG(
"read Offline tracks, size= " << offlineTracksHandle->size());
150 tmpOfflineTrack.
setQOverPt(trackParticle->pt() > 0 ? trackParticle->charge() / trackParticle->pt() : 0);
151 tmpOfflineTrack.
setEta(trackParticle->eta());
152 tmpOfflineTrack.
setPhi(trackParticle->phi());
153 tmpOfflineTrack.
setD0(trackParticle->d0());
154 tmpOfflineTrack.
setZ0(trackParticle->z0());
156 const Trk::TrackStates* trackStates = trackParticle->track()->trackStateOnSurfaces();
157 if (trackStates ==
nullptr) {
159 return StatusCode::FAILURE;
162 if (tsos ==
nullptr)
continue;
165 if (tsos->trackParameters() !=
nullptr &&
166 tsos->trackParameters()->associatedSurface().associatedDetectorElement() !=
nullptr &&
167 tsos->trackParameters()->associatedSurface().associatedDetectorElement()->identify() != 0
191 tmpOfflineHit.
setLocY(-99999.9);
193 tmpOfflineTrack.
addHit(tmpOfflineHit);
197 offline.push_back(tmpOfflineTrack);
201 return StatusCode::SUCCESS;
211 unsigned int hitIndex = 0
u;
216 return StatusCode::SUCCESS;
229 if (pixel_rdoCollection ==
nullptr) {
continue; }
242 hitIndexMap[rdoId] = hitIndex;
247 hitIndexMap[tmpId] = hitIndex;
254 InDetSimDataCollection::const_iterator iter(pixelSDOHandle->find(rdoId));
255 if (
nCells > 1 && iter == pixelSDOHandle->end()) {
257 for (
int ii = 0; ii <
nCells && iter == pixelSDOHandle->end(); ++ii) {
262 if (iter != pixelSDOHandle->end())
getTruthInformation(iter, parentMask, bestExtcode, bestParent);
275 else if (barrel_ec == 2)
277 else if (barrel_ec == -2)
290 tmpSGhit.
setToT(pixelRawData->getToT());
299 unsigned int id2, barcode2;
307 tmpSGhit.
setBarcodePt(
static_cast<unsigned long>(std::ceil(bestParent ? bestParent->momentum().perp() : 0.)));
320 return StatusCode::SUCCESS;
330 if (SCT_Collection ==
nullptr) {
continue; }
332 const Identifier rdoId = sctRawData->identify();
336 std::pair<Amg::Vector3D, Amg::Vector3D> endsOfStrip = sielement->
endsOfStrip(LocalPos);
338 hitIndexMap[rdoId] = hitIndex;
346 InDetSimDataCollection::const_iterator iter(stripSDOHandle->find(rdoId));
348 if (iter != stripSDOHandle->end())
getTruthInformation(iter, parentMask, bestExtcode, bestParent);
360 else if (barrel_ec == 2)
362 else if (barrel_ec == -2)
381 unsigned int id2, barcode2;
389 tmpSGhit.
setBarcodePt(
static_cast<unsigned long>(std::ceil(bestParent ? bestParent->momentum().perp() : 0.)));
391 tmpSGhit.
setX(0.5 * (endsOfStrip.first.x() + endsOfStrip.second.x()));
392 tmpSGhit.
setY(0.5 * (endsOfStrip.first.y() + endsOfStrip.second.y()));
393 tmpSGhit.
setZ(0.5 * (endsOfStrip.first.z() + endsOfStrip.second.z()));
406 return StatusCode::SUCCESS;
412 unsigned int pixelClusterIndex = 0;
417 if (pixelClusterCollection ==
nullptr) {
429 for (
const Identifier& rdoId : cluster->rdoList()) {
435 InDetSimDataCollection::const_iterator iter(pixelSDOHandle->find(rdoId));
437 if (
nCells > 1 && iter == pixelSDOHandle->end()) {
439 for (
int ii = 0; ii <
nCells && iter == pixelSDOHandle->end(); ++ii) {
444 if (iter != pixelSDOHandle->end())
getTruthInformation(iter, parentMask, bestExtcode, bestParent);
447 pixelClusterIndexMap[theId] = pixelClusterIndex;
452 return StatusCode::SUCCESS;
465 if (pixelClusterCollection ==
nullptr) {
469 const int size = pixelClusterCollection->size();
478 for (
const Identifier& rdoId : cluster->rdoList()) {
483 InDetSimDataCollection::const_iterator iter(pixelSDOHandle->find(rdoId));
485 if (
nCells > 1 && iter == pixelSDOHandle->end()) {
487 for (
int ii = 0; ii <
nCells && iter == pixelSDOHandle->end(); ++ii) {
492 if (iter != pixelSDOHandle->end())
getTruthInformation(iter, parentMask, bestExtcode, bestParent);
507 clusterEquiv.
setX(globalPos.x());
508 clusterEquiv.
setY(globalPos.y());
509 clusterEquiv.
setZ(globalPos.z());
516 else if (barrel_ec == 2)
518 else if (barrel_ec == -2)
527 clusterEquiv.
setPhiWidth(cluster->width().colRow()[1]);
528 clusterEquiv.
setEtaWidth(cluster->width().colRow()[0]);
538 unsigned int id2, barcode2;
547 clusterEquiv.
setBarcodePt(
static_cast<unsigned long>(std::ceil(bestParent ? bestParent->momentum().perp() : 0.)));
562 if (SCT_Collection ==
nullptr) {
continue; }
564 const Identifier rdoId = sctRawData->identify();
576 InDetSimDataCollection::const_iterator iter(stripSDOHandle->find(rdoId));
578 if (iter != stripSDOHandle->end())
getTruthInformation(iter, parentMask, bestExtcode, bestParent);
594 else if (barrel_ec == 2)
596 else if (barrel_ec == -2)
606 clusterEquiv.
setPhiWidth(sctRawData->getGroupSize());
616 unsigned int id2, barcode2;
624 clusterEquiv.
setBarcodePt(
static_cast<unsigned long>(std::ceil(bestParent ? bestParent->momentum().perp() : 0.)));
632 return StatusCode::SUCCESS;
639 ATH_MSG_DEBUG(
"Dump truth tracks, size " << simTracksHandle->size());
642 for (
unsigned int ievt = 0; ievt < simTracksHandle->size(); ++ievt) {
643 const HepMC::GenEvent* genEvent = simTracksHandle->at(ievt);
645 HepGeom::Point3D<double> primaryVtx(0., 0., 0.);
650 primaryVtx.set(spv->position().x(),
652 spv->position().z());
653 ATH_MSG_DEBUG(
"using signal process vertex for eventIndex " << ievt <<
":"
654 << primaryVtx.x() <<
"\t" << primaryVtx.y() <<
"\t" << primaryVtx.z());
656 for (
const auto&
particle: *genEvent) {
657 const int pdgcode =
particle->pdg_id();
659 if (
particle->production_vertex() ==
nullptr) {
667 float charge = pd->charge();
668 if (pdgcode < 0)
charge *= -1.;
669 if (std::abs(
charge) < 0.5) {
689 const double track_truth_d0 = tP ? tP->parameters()[
Trk::d0] : 999.;
690 const double track_truth_phi = tP ? tP->parameters()[
Trk::phi] : 999.;
691 const double track_truth_p = (tP && fabs(tP->parameters()[
Trk::qOverP]) > 1.e-8) ?
693 const double track_truth_x0 = tP ? tP->
position().x() : 999.;
694 const double track_truth_y0 = tP ? tP->
position().y() : 999.;
695 const double track_truth_z0 = tP ? tP->parameters()[
Trk::z0] : 999.;
696 const double track_truth_q = tP ? tP->
charge() : 0.;
697 const double track_truth_sinphi = tP ?
std::sin(tP->parameters()[
Trk::phi]) : -1.;
698 const double track_truth_cosphi = tP ?
std::cos(tP->parameters()[
Trk::phi]) : -1.;
699 const double track_truth_sintheta = tP ?
std::sin(tP->parameters()[
Trk::theta]) : -1.;
700 const double track_truth_costheta = tP ?
std::cos(tP->parameters()[
Trk::theta]) : -1.;
701 double truth_d0corr = track_truth_d0 - (primaryVtx.y() *
cos(track_truth_phi) - primaryVtx.x() *
sin(track_truth_phi));
702 double truth_zvertex = 0.;
703 const HepGeom::Point3D<double> startVertex(
particle->production_vertex()->position().x(),
particle->production_vertex()->position().y(),
particle->production_vertex()->position().z());
706 if (std::abs(truth_d0corr) > 2.) {
isPrimary =
false; }
710 const HepGeom::Point3D<double> startVertex(
particle->production_vertex()->position().x(),
particle->production_vertex()->position().y(),
particle->production_vertex()->position().z());
711 if (std::abs(startVertex.z() - truth_zvertex) > 100.) {
isPrimary =
false; }
713 HepGeom::Point3D<double> endVertex(
particle->end_vertex()->position().x(),
particle->end_vertex()->position().y(),
particle->end_vertex()->position().z());
714 if (endVertex.perp() < FPGATrackSim_PT_TRUTHMIN && std::abs(endVertex.z()) < FPGATrackSim_Z_TRUTHMIN) {
isPrimary =
false; }
726 tmpSGTrack.
setVtxX(track_truth_x0);
727 tmpSGTrack.
setVtxY(track_truth_y0);
728 tmpSGTrack.
setVtxZ(track_truth_z0);
729 tmpSGTrack.
setD0(track_truth_d0);
730 tmpSGTrack.
setZ0(track_truth_z0);
731 tmpSGTrack.
setVtxZ(primaryVtx.z());
732 tmpSGTrack.
setQ(track_truth_q);
733 tmpSGTrack.
setPX(track_truth_p * (track_truth_cosphi * track_truth_sintheta));
734 tmpSGTrack.
setPY(track_truth_p * (track_truth_sinphi * track_truth_sintheta));
735 tmpSGTrack.
setPZ(track_truth_p * track_truth_costheta);
739 unsigned int id2, barcode2;
747 truth.push_back(tmpSGTrack);
752 return StatusCode::SUCCESS;
761 const std::vector<InDetSimData::Deposit>& deposits(sdo.
getdeposits());
766 if (!particleLink.
isValid()) {
continue; }
767 const float genEta = particleLink->momentum().pseudoRapidity();
768 const float genPt = particleLink->momentum().perp();
774 if (std::fabs(genEta) >
m_maxEta) {
continue; }
776 if (bestParent ==
nullptr || bestParent->momentum().perp() < genPt) {
777 bestParent = particleLink.
cptr();
def retrieve(aClass, aKey=None)
bool is_pixel(Identifier id) const
long getEventIndex() const
void addHit(FPGATrackSimOfflineHit s)
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
int phi_index(const Identifier &id) const
SiCellId connectedCell(const SiCellId cellId, int number) const
Get the cell ids sharing the readout for this cell.
virtual SiDetectorElement * getDetectorElement(const Identifier &id) const =0
access to individual elements using Identifier or IdentiferHash
void uniqueID(barcode_type &id, barcode_type &barcode) const
Return the GenParticle id/barcode.
double charge() const
Returns the charge.
const std::vector< Deposit > & getdeposits() const
void setBCID(const int &val)
void setEtaIndex(unsigned v)
bool is_sct(Identifier id) const
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
const Amg::Vector3D & position() const
Access method for the position.
Eigen::Matrix< double, 2, 1 > Vector2D
void setIdentifierHash(unsigned v)
float getBarcodePt() const
virtual SiLocalPosition localPositionOfCell(const SiCellId &cellId) const =0
readout or diode id -> position.
void setClusterID(int clus)
void setBarcode(unsigned long v)
void setRunNumber(const unsigned long &val)
void setBarcode(unsigned long v)
void setEtaWidth(unsigned v)
void setTrackNumber(int track)
virtual SiCellId connectedCell(const SiReadoutCellId &readoutId, int number) const =0
readout id -> id of connected diodes.
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
int phi_module(const Identifier &id) const
unsigned long getBarcode() const
int barcode() const
Return the barcode of the target particle.
bool empty() const
Test if the key is blank.
void setClusterEquiv(const FPGATrackSimHit &input)
void setDetectorZone(DetectorZone detZone)
@ u
Enums for curvilinear frames.
virtual IdentifierHash identifyHash() const override final
identifier hash (inline)
void setextendedLevel1ID(const unsigned int &val)
size_t nTruthTracks() const
Trk::PrepRawDataCollection< InDet::SiCluster > SiClusterCollection
size_t nOfflineClusters() const
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
HepMC::ConstGenParticlePtr cptr() const
Dereference.
void setDetType(SiliconTech detType)
a link optimized in size for a GenParticle in a McEventCollection
void setEventNumber(const unsigned long &val)
bool is_barrel(const Identifier &id) const
Test for barrel - WARNING: id MUST be pixel id, otherwise answer is not accurate. Use SiliconID for g...
virtual SiCellId cellIdFromIdentifier(const Identifier &identifier) const override final
SiCellId from Identifier.
int numberOfConnectedCells(const SiCellId cellId) const
Test if readout cell has more than one diode associated with it.
void setPhiIndex(unsigned v)
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...
setRawEt setRawPhi nCells
::StatusCode StatusCode
StatusCode definition for legacy code.
Persistent representation of a link.
int row(const Identifier &id) const
virtual Identifier identifierFromCellId(const SiCellId &cellId) const override final
Identifier <-> SiCellId (ie strip number or pixel eta_index,phi_index) Identifier from SiCellId (ie s...
std::pair< unsigned long, unsigned long > Barcode
void addOfflineTrack(const FPGATrackSimOfflineTrack &t)
void setEventIndex(int v)
int eta_index(const Identifier &id) const
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
bool isValid() const
Validity check.
void setPhiModule(unsigned v)
size_t nOfflineTracks() const
int layer_disk(const Identifier &id) const
index_type eventIndex() const
Return the event number of the referenced GenEvent.
std::pair< Amg::Vector3D, Amg::Vector3D > endsOfStrip(const Amg::Vector2D &position) const
Special method for SCT to retrieve the two ends of a "strip" Returned coordinates are in global frame...
void setLayerDisk(unsigned v)
const GenParticle * ConstGenParticlePtr
int eta_module(const Identifier &id) const
void maximize(const FPGATrackSimMultiTruth::Barcode &code, const FPGATrackSimMultiTruth::Weight &weight)
represents the track state (measurement, material, fit parameters and quality) at a surface.
: FPGATrackSim-specific class to represent an hit in the detector.
double charge(const T &p)
int layer_disk(const Identifier &id) const
void setPhiWidth(unsigned v)
StatusCode initialize(bool used=true)
Eigen::Matrix< double, 3, 1 > Vector3D
void setEventIndex(long v)
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
void addTruthTrack(const FPGATrackSimTruthTrack &t)
void setaverageInteractionsPerCrossing(const int &val)
Amg::Vector2D rawLocalPositionOfCell(const SiCellId &cellId) const
Returns position (center) of cell.
bool isStable(const T &p)
void setlevel1TriggerType(const unsigned int &val)
int strip(const Identifier &id) const
HepGeom::Point3D< double > globalPosition(const HepGeom::Point3D< double > &localPos) const
transform a reconstruction local position into a global position (inline):
int eta_module(const Identifier &id) const
void addOfflineCluster(const FPGATrackSimCluster &c)
virtual Identifier identify() const final
return the identifier -extends MeasurementBase
void setQOverPt(double v)
void setIsBarrel(bool is)
int side(const Identifier &id) const
void setactualInteractionsPerCrossing(const int &val)
const HepMC::GenVertex * ConstGenVertexPtr
Class describing a TrackParticle.
void setTruth(const FPGATrackSimMultiTruth &v)
void setParentageMask(unsigned long v)
std::pair< HepMcParticleLink, float > Deposit
virtual const SiDetectorDesign & design() const override final
access to the local description (inline):
int phi_module(const Identifier &id) const
void eventIndex(index_type &index, index_type &position) const
Return the event index/position.
void setBarcodePt(float v)
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
void setLB(const int &val)
@ isPrimary
true if matched track has a hit in first or second pixel layer
bool is_barrel(const Identifier &id) const
Test for barrel - WARNING: id MUST be sct id, otherwise answer is not accurate. Use SiliconID for gen...
void setHitType(HitType type)
GenVertex * signal_process_vertex(const GenEvent *e)