76 ATH_MSG_ERROR(
"No decoration prefix name provided for the output of TrackStateOnSurfaceDecorator! Use the variable DecorationPrefix to properly set a prefix.");
77 return StatusCode::FAILURE;
83 ATH_MSG_ERROR(
"No TrackParticle collection provided for TrackStateOnSurfaceDecorator!");
84 return StatusCode::FAILURE;
94 if (detStore()->retrieve(
m_idHelper,
"AtlasID").isFailure()) {
96 return StatusCode::FAILURE;
101 return StatusCode::FAILURE;
106 return StatusCode::FAILURE;
111 return StatusCode::FAILURE;
130 std::vector<std::string> decor_names{
"TrtPhaseTime"};
131 std::vector<SG::WriteDecorHandleKey<xAOD::EventInfo> > decor_key_out;
136 std::vector<std::string> names;
158 std::vector<std::string> names;
180 return StatusCode::SUCCESS;
186 return StatusCode::SUCCESS;
191 ATH_MSG_DEBUG(
"Adding TSOS decorations the track particles");
198 size_t nTracks = tracks->
size();
202 const std::vector<unsigned int>* pixelClusterOffsets{};
203 const std::vector<unsigned int>* sctClusterOffsets{};
204 const std::vector<unsigned int>* trtDCOffsets{};
222 StateContainer_t msosPixel{};
223 StateContainer_t msosSCT{};
224 StateContainer_t msosTRT{};
240 float trtPhase_time=0.;
244 trtPhase_time = trtPhase->getTime();
247 decorTRTPhase(*eventInfo) = trtPhase_time;
255 std::vector<bool> mask;
256 mask.assign(nTracks,
true);
258 std::vector<int>
entries = m_parser->evaluateAsVector();
259 unsigned int nEntries =
entries.size();
261 if (nTracks != nEntries ) {
262 ATH_MSG_ERROR(
"Sizes incompatible! Are you sure your selection string used ID TrackParticles?");
263 return StatusCode::FAILURE;
266 for (
unsigned int i=0; i<nTracks; ++i)
if (
entries[i]!=1) mask[i]=
false;
270 std::vector<SG::WriteDecorHandle<xAOD::TrackParticleContainer,float> > trackTRTFloatDecorators;
274 std::vector<SG::WriteDecorHandle<xAOD::TrackParticleContainer,float> >
277 unsigned i_track = 0;
278 for (
const auto *
const track : *tracks) {
288 if( !track->trackLink().isValid() || track->track() ==
nullptr ) {
298 std::vector< ElementLink< xAOD::TrackStateValidationContainer > > msosLink;
318 bool allExtrapolationsSucceded =
true;
323 ATH_MSG_VERBOSE(
"Start radius for extrapolating to layers: "<<startRadius);
326 std::unique_ptr<const Trk::TrackParameters> outputParamsIBL
338 std::unique_ptr<const Trk::TrackParameters> outputParamsBL
350 std::unique_ptr<const Trk::TrackParameters> outputParamsL1
362 std::unique_ptr<const Trk::TrackParameters> outputParamsL2
371 if (outputParamsIBL.get()) {
372 trackPixFloatDecorators[
kTrkIBLXDecor](*track) = outputParamsIBL->position().x();
373 trackPixFloatDecorators[
kTrkIBLYDecor](*track) = outputParamsIBL->position().y();
374 trackPixFloatDecorators[
kTrkIBLZDecor](*track) = outputParamsIBL->position().z();
377 allExtrapolationsSucceded =
false;
384 if (outputParamsBL.get()) {
385 trackPixFloatDecorators[
kTrkBLXDecor](*track) = outputParamsBL->position().x();
386 trackPixFloatDecorators[
kTrkBLYDecor](*track) = outputParamsBL->position().y();
387 trackPixFloatDecorators[
kTrkBLZDecor](*track) = outputParamsBL->position().z();
390 allExtrapolationsSucceded =
false;
397 if (outputParamsL1.get()) {
398 trackPixFloatDecorators[
kTrkL1XDecor](*track) = outputParamsL1->position().x();
399 trackPixFloatDecorators[
kTrkL1YDecor](*track) = outputParamsL1->position().y();
400 trackPixFloatDecorators[
kTrkL1ZDecor](*track) = outputParamsL1->position().z();
403 allExtrapolationsSucceded =
false;
410 if (outputParamsL2.get()) {
411 trackPixFloatDecorators[
kTrkL2XDecor](*track) = outputParamsL2->position().x();
412 trackPixFloatDecorators[
kTrkL2YDecor](*track) = outputParamsL2->position().y();
413 trackPixFloatDecorators[
kTrkL2ZDecor](*track) = outputParamsL2->position().z();
416 allExtrapolationsSucceded =
false;
422 if(!allExtrapolationsSucceded)
ATH_MSG_WARNING(
"At least one extrapolation to a Pixel layer failed!");
425 ATH_MSG_WARNING(
"No perigee TrackParameters found - filling positions on layers to (0,0,0)!");
443 std::vector<const Trk::TrackStateOnSurface*> tsoss;
448 tsoss.push_back(trackState);
451 std::unique_ptr<const Trk::TrackStates> holes;
454 for (
const auto *hole: *holes){
455 tsoss.push_back(hole);
459 stable_sort( tsoss.begin(), tsoss.end(), CompFunc );
466 for (
const auto& trackState: tsoss){
484 if(!trackState->surface().associatedDetectorElement()){
489 Identifier surfaceID = trackState->surface().associatedDetectorElement()->identify();
514 if( !isPixel && !isSCT && !isTRT ){
524 msosTRT->push_back( msos );
530 msosLink.push_back(elink);
534 msosSCT->push_back( msos );
540 msosLink.push_back(elink);
544 msosPixel->push_back( msos );
550 msosLink.push_back(elink);
575 double lTheta=-1000., lPhi=-1000.;
579 errDCAcc(*msos) = -1 ;
589 HitZAcc(*msos)=-3000;
591 rTrkWireAcc(*msos)=-1;
595 HitZAcc(*msos)=-3000;
597 rTrkWireAcc(*msos)=-1;
602 HitZAcc(*msos)=gp.z();
603 HitRAcc(*msos)=gp.perp();
604 rTrkWireAcc(*msos)= fabs(trackState->trackParameters()->parameters()[
Trk::driftRadius]);
605 lTheta = trackState->trackParameters()->parameters()[
Trk::theta];
606 lPhi = trackState->trackParameters()->parameters()[
Trk::phi];
611 rTrkWireAcc(*msos)=0;
618 if (prd_to_track_map_cptr) {
623 isSharedAcc(*msos) = isShared;
629 std::unique_ptr<const Trk::TrackParameters> extrap(
m_extrapolator->extrapolateTrack(ctx,*trkTrack,trackState->surface()) );
636 ATH_MSG_DEBUG(
" Original position " << tp->parameters()[0] <<
" " << tp->parameters()[1]);
637 ATH_MSG_DEBUG(
"Extrapolated position " << extrap->parameters()[0] <<
" " << extrap->parameters()[1]);
653 if (side && (isSCT || isPixel)) {
659 float trketacomp = mytrack.dot(myetaax);
660 float trkphicomp = mytrack.dot(myphiax);
661 float trknormcomp = mytrack.dot(mynormal);
663 ATH_MSG_DEBUG(
" Original incident angle " << trketacomp <<
" " << trkphicomp <<
" " << trknormcomp);
666 float trketacompX = metrack.dot(myetaax);
667 float trkphicompX = metrack.dot(myphiax);
668 float trknormcompX = metrack.dot(mynormal);
669 ATH_MSG_DEBUG(
"Extrapolated incident angle " << trketacompX <<
" " << trkphicompX <<
" " << trknormcompX);
671 msos->
setLocalAngles( atan2(trketacomp,trknormcomp), atan2(trkphicomp,trknormcomp) );
676 float trketacompX = metrack.dot(myetaax);
677 float trkphicompX = metrack.dot(myphiax);
678 float trknormcompX = metrack.dot(mynormal);
679 msos->
setLocalAngles( atan2(trketacompX,trknormcompX), atan2(trkphicompX,trknormcompX) );
684 if(!measurement) {
continue; }
686 if (isTRT && ( !trtDCOffsets || !trtDCs)) {
continue; }
687 if (isSCT && ( !sctClusterOffsets || !sctClusters)) {
continue; }
688 if (isPixel && (!pixelClusterOffsets || !pixelClusters)) {
continue; }
723 SiWidthAcc(*msos) = SiWidthAcc(*sctCluster);
724 firstStripAcc(*msos) = (rdoStripAcc(*sctCluster)).at(0);
726 SiWidthAcc(*msos) = -1;
727 firstStripAcc(*msos) = -1;
737 driftTimeAcc(*msos) = rtr->
drifttime(fabs(tp->parameters()[0]));
741 driftTimeAcc(*msos) = rtr->
drifttime(fabs(extrap->parameters()[0]));
751 std::optional<Trk::ResidualPull> biased;
752 std::optional<Trk::ResidualPull> unbiased;
759 if(unbiasedTp.get()) {
798 dectsos_msosLink( *track ) = msosLink;
804 return StatusCode::SUCCESS;
809 const std::vector<unsigned int>* offsets,
815 if( contIndex.
collHash() >= offsets->size() ){
820 unsigned int xaodIndex = offsets->at( contIndex.
collHash() ) + contIndex.
objIndex();
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
Helper class to provide constant type-safe access to aux data.
Helper class to provide type-safe access to aux data.
This is an Identifier helper class for the Pixel subdetector.
This is an Identifier helper class for the SCT subdetector.
Handle class for reading a decoration on an object.
Handle class for reading from StoreGate.
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Handle class for adding a decoration to an object.
This is an Identifier helper class for the TRT subdetector.
size_type size() const noexcept
Returns the number of elements in the collection.
const AtlasDetectorID * m_idHelper
Gaudi::Property< bool > m_storeSCT
SG::WriteHandleKey< xAOD::TrackStateValidationContainer > m_pixelMsosName
std::vector< SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > > m_trackPixFloatDecorKeys
SG::ReadHandleKey< ComTime > m_trtPhaseKey
ToolHandle< ITRT_CalDbTool > m_trtcaldbTool
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_containerName
SG::ReadHandleKey< xAOD::TrackMeasurementValidationContainer > m_trtDCName
std::vector< SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > > m_trackTRTFloatDecorKeys
std::vector< SG::WriteDecorHandleKey< xAOD::EventInfo > > m_trtPhaseDecorKey
Gaudi::Property< bool > m_addPRD
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_trackTSOSMOSLinkDecorKey
virtual StatusCode addBranches(const EventContext &ctx) const
Gaudi::Property< bool > m_storeTRT
Gaudi::Property< bool > m_storeHoles
ElementLink< xAOD::TrackMeasurementValidationContainer > buildElementLink(const Trk::PrepRawData *, const std::vector< unsigned int > *, const xAOD::TrackMeasurementValidationContainer *) const
SG::ReadHandleKey< Trk::PRDtoTrackMap > m_prdToTrackMap
Gaudi::Property< bool > m_addPulls
ToolHandle< Trk::IExtrapolator > m_extrapolator
SG::ReadHandleKey< std::vector< unsigned int > > m_pixelMapName
@ kTRTusedHits_noHT_divByLDecor
@ kTRTdEdx_noHT_divByLDecor
ToolHandle< ITRT_ToT_dEdx > m_TRTdEdxTool
Gaudi::Property< std::string > m_sgName
SG::ReadHandleKey< xAOD::TrackMeasurementValidationContainer > m_sctClustersName
SG::WriteHandleKey< xAOD::TrackStateValidationContainer > m_sctMsosName
ToolHandle< Trk::IUpdator > m_updator
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_SCTDetEleCollKey
SG::ReadHandleKey< xAOD::TrackMeasurementValidationContainer > m_pixelClustersName
Gaudi::Property< bool > m_storeOutliers
ToolHandle< Trk::ITrackHoleSearchTool > m_holeSearchTool
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
ToolHandle< Trk::IResidualPullCalculator > m_residualPullCalculator
StringProperty m_selectionString
SG::ReadHandleKey< std::vector< unsigned int > > m_trtMapName
Gaudi::Property< bool > m_addExtraEventInfo
Gaudi::Property< std::vector< float > > m_pixelLayerRadii
SG::ReadHandleKey< std::vector< unsigned int > > m_sctMapName
SG::WriteHandleKey< xAOD::TrackStateValidationContainer > m_trtMsosName
Gaudi::Property< bool > m_storePixel
ElementLink implementation for ROOT usage.
bool toPersistent()
Dummy function provinding the offline interface.
Identifiable container index to a contained object.
unsigned short objIndex() const
object index in collection
unsigned short collHash() const
Accessor to hash, obj index and combined index.
bool isValid() const
check that both fields are set
bool is_valid() const
Check if id is in a valid state.
value_type get_compact() const
Get the compact id.
Class to hold geometrical description of a silicon detector element.
Represents 'corrected' measurements from the TRT (for example, corrected for wire sag).
virtual const Amg::Vector3D & globalPosition() const override final
return the global position of this RIO_OnTrack
virtual const Trk::Surface & associatedSurface() const override final
returns the surface for the local to global transformation
Helper class to provide type-safe access to aux data.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Handle class for adding a decoration to an object.
Base class for rt-relations in the TRT.
virtual float drifttime(float radius) const =0
drifttime for given radius
Base class for all CompetingRIOsOnTack implementations, extends the common MeasurementBase.
unsigned int indexOfMaxAssignProb() const
Index of the ROT with the highest assignment probability.
virtual const RIO_OnTrack & rioOnTrack(unsigned int) const =0
returns the RIO_OnTrack (also known as ROT) objects depending on the integer.
Class for a CylinderSurface in the ATLAS detector.
This class is the pure abstract base class for all fittable tracking measurements.
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
bool isShared(const PrepRawData &prd) const
does this PRD belong to more than one track?
const Amg::Vector3D & momentum() const
Access method for the momentum.
virtual const S & associatedSurface() const override final
Access to the Surface method.
const IdentContIndex & getHashAndIndex() const
Class to handle RIO On Tracks ROT) for InDet and Muons, it inherits from the common MeasurementBase.
virtual const Trk::PrepRawData * prepRawData() const =0
returns the PrepRawData (also known as RIO) object to which this RIO_OnTrack is associated.
@ Biased
RP with track state including the hit.
@ Unbiased
RP with track state that has measurement not included.
const TrkDetElementBase * associatedDetectorElement() const
return associated Detector Element
const Amg::Vector3D & center() const
Returns the center position of the Surface.
ParticleHypothesis particleHypothesis() const
Returns the particle hypothesis used for Track fitting.
Class providing comparison function, or relational definition, for sorting MeasurementBase objects.
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
@ Outlier
This TSoS contains an outlier, that is, it contains a MeasurementBase/RIO_OnTrack which was not used ...
@ Hole
A hole on the track - this is defined in the following way.
const Trk::TrackStates * trackStateOnSurfaces() const
return a pointer to a const DataVector of const TrackStateOnSurfaces.
const TrackInfo & info() const
Returns a const ref to info of a const tracks.
const Perigee * perigeeParameters() const
return Perigee.
This is the base class for all tracking detector elements with read-out relevant information.
virtual const Surface & surface() const =0
Return surface associated with this detector element.
void setBiasedPull(float biasedPullX, float biasedPullY)
Sets the biased pull.
void setLocalPosition(float localX, float localY)
Sets the local position.
void setUnbiasedResidual(float unbiasedResidualX, float unbiasedResidualY)
Sets the unbiased residual.
void setDetType(char detType)
Sets the detector type.
void setBiasedResidual(float biasedResidualX, float biasedResidualY)
Sets the biased residual.
void setDetElementId(uint64_t detElementId)
Sets the detector element identifier.
void setType(int type)
Sets the type (measurement, outlier, hole).
void setLocalAngles(float localTheta, float localPhi)
Sets the local angles.
void setTrackMeasurementValidationLink(ElementLink< xAOD::TrackMeasurementValidationContainer > trackMeasurementValidationLink)
sets the link to the TrackMeasurementValidationContainer
ElementLink< xAOD::TrackMeasurementValidationContainer > trackMeasurementValidationLink() const
void setUnbiasedPull(float unbiasedPullX, float unbiasedPullY)
Sets the unbiased pull.
Eigen::Matrix< double, 3, 1 > Vector3D
std::vector< SG::WriteDecorHandle< T_Cont, T > > createDecorators(const std::vector< SG::WriteDecorHandleKey< T_Cont > > &keys, const EventContext &ctx)
void createDecoratorKeys(T_Parent &parent, const SG::ReadHandleKey< T_Cont > &container_key, const std::string &prefix, const std::vector< std::string > &decor_names, std::vector< SG::WriteDecorHandleKey< T_Cont > > &decor_out)
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
PropDirection
PropDirection, enum for direction of the propagation.
MaterialUpdateMode
This is a steering enum to force the material update it can be: (1) addNoise (-1) removeNoise Second ...
ParametersBase< TrackParametersDim, Charged > TrackParameters
TrackMeasurementValidation_v1 TrackMeasurementValidation
Reference the current persistent version:
TrackStateValidationContainer_v1 TrackStateValidationContainer
Definition of the current "TrackStateValidation container version".
EventInfo_v1 EventInfo
Definition of the latest event info version.
TrackStateValidation_v1 TrackStateValidation
Reference the current persistent version:
TrackStateValidationAuxContainer_v1 TrackStateValidationAuxContainer
Definition of the current TrackStateValidation auxiliary container.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
TrackMeasurementValidationContainer_v1 TrackMeasurementValidationContainer
Definition of the current "TrackMeasurementValidation container version".