diff --git a/Event/xAOD/xAODTracking/CMakeLists.txt b/Event/xAOD/xAODTracking/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e14e70b939d65acab737c4398b8390605eb4785 --- /dev/null +++ b/Event/xAOD/xAODTracking/CMakeLists.txt @@ -0,0 +1,55 @@ +################################################################################ +# Package: xAODTracking +################################################################################ + +# Declare the package name: +atlas_subdir( xAODTracking ) + +# Declare the package's dependencies: +atlas_depends_on_subdirs( PUBLIC + Control/AthContainers + Control/AthLinks + DetectorDescription/GeoPrimitives + Event/EventPrimitives + Event/xAOD/xAODBase + Event/xAOD/xAODCore + Tracking/TrkEvent/TrkNeutralParameters + Tracking/TrkEvent/TrkParameters + Tracking/TrkEvent/TrkTrack + Tracking/TrkEvent/VxVertex + PRIVATE + AtlasTest/TestTools ) + +# External dependencies: +find_package( Eigen ) +find_package( ROOT COMPONENTS Physics Core Tree MathCore Hist RIO pthread ) + +# Component(s) in the package: +atlas_add_library( xAODTracking + Root/*.cxx + PUBLIC_HEADERS xAODTracking + INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} + PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${EIGEN_LIBRARIES} AthContainers AthLinks GeoPrimitives EventPrimitives xAODBase xAODCore TrkNeutralParameters TrkParameters TrkTrack VxVertex + PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} TestTools ) + +atlas_add_dictionary( xAODTrackingDict + xAODTracking/xAODTrackingDict.h + xAODTracking/selection.xml + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} AthContainers AthLinks GeoPrimitives EventPrimitives xAODBase xAODCore TrkNeutralParameters TrkParameters TrkTrack VxVertex TestTools xAODTracking + EXTRA_FILES Root/dict/*.cxx ) + +atlas_add_test( xAODTracking_TrackParticle_test + SOURCES + test/xAODTracking_TrackParticle_test.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} AthContainers AthLinks GeoPrimitives EventPrimitives xAODBase xAODCore TrkNeutralParameters TrkParameters TrkTrack VxVertex TestTools xAODTracking ) + +atlas_add_test( xAODTracking_TrackParticlexAODHelpers_test + SOURCES + test/xAODTracking_TrackParticlexAODHelpers_test.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} AthContainers AthLinks GeoPrimitives EventPrimitives xAODBase xAODCore TrkNeutralParameters TrkParameters TrkTrack VxVertex TestTools xAODTracking + EXTRA_PATTERNS "^DEBUG" ) + diff --git a/Event/xAOD/xAODTracking/Root/SCTRawHitValidationAuxContainer_v1.cxx b/Event/xAOD/xAODTracking/Root/SCTRawHitValidationAuxContainer_v1.cxx new file mode 100644 index 0000000000000000000000000000000000000000..0cd4a40a3806d7904e3fd898d99512ee282fb551 --- /dev/null +++ b/Event/xAOD/xAODTracking/Root/SCTRawHitValidationAuxContainer_v1.cxx @@ -0,0 +1,14 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "xAODTracking/versions/SCTRawHitValidationAuxContainer_v1.h" + +namespace xAOD { + SCTRawHitValidationAuxContainer_v1::SCTRawHitValidationAuxContainer_v1() + : AuxContainerBase() + { + AUX_VARIABLE(identifier); + AUX_VARIABLE(dataword); + } +} diff --git a/Event/xAOD/xAODTracking/Root/SCTRawHitValidation_v1.cxx b/Event/xAOD/xAODTracking/Root/SCTRawHitValidation_v1.cxx new file mode 100644 index 0000000000000000000000000000000000000000..0bff0cc2dfc045e294857dc4a623e260402c40d2 --- /dev/null +++ b/Event/xAOD/xAODTracking/Root/SCTRawHitValidation_v1.cxx @@ -0,0 +1,58 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "xAODTracking/versions/SCTRawHitValidation_v1.h" + +// EDM include(s): +#include "xAODCore/AuxStoreAccessorMacros.h" + +namespace xAOD { + SCTRawHitValidation_v1::SCTRawHitValidation_v1() { } + + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(SCTRawHitValidation_v1, uint64_t, identifier, setIdentifier) + + static SG::AuxElement::Accessor<uint32_t> word_acc("dataword"); + void SCTRawHitValidation_v1::setWord(uint32_t new_word) { + word_acc(*this) = new_word; + } + + uint32_t SCTRawHitValidation_v1::getWord() const { + return word_acc(*this); + } + + // decode size of group of strips information + int SCTRawHitValidation_v1::getGroupSize() const { + return getWord() & 0x7FF; + } + + // decode strip information + int SCTRawHitValidation_v1::getStrip() const { + return (getWord() >> 11) & 0x7FF; + } + + // decode time bin information + int SCTRawHitValidation_v1::getTimeBin() const { + return (getWord() >> 22) & 0x7; + } + + // returns a word incoding the errors + int SCTRawHitValidation_v1::getErrors() const { + return (getWord() >> 25) & 0x7; + } + + // returns true if the time bin corresponding to the present BC is on + bool SCTRawHitValidation_v1::OnTime() const { + return (getWord() >> 23) & 0x1; + } + + // returns true if there is an error in the first hit's data + bool SCTRawHitValidation_v1::FirstHitError() const { + return (getWord() >> 29) & 0x1; + } + + // returns true if there is an error in the second hit's data + bool SCTRawHitValidation_v1::SecondHitError() const { + return (getWord() >> 30) & 0x1; + } +} // namespace xAOD diff --git a/Event/xAOD/xAODTracking/Root/Vertex_v1.cxx b/Event/xAOD/xAODTracking/Root/Vertex_v1.cxx index 011166181012831dac96df77e8a8fbae1577cccc..324ce8d2afc81730528cb4f6583467d27ab5bd2e 100644 --- a/Event/xAOD/xAODTracking/Root/Vertex_v1.cxx +++ b/Event/xAOD/xAODTracking/Root/Vertex_v1.cxx @@ -35,13 +35,27 @@ namespace xAOD { this->makePrivateStore( other ); } - Vertex_v1& Vertex_v1::operator=(const Vertex_v1& tp ){ - if(this == &tp) return *this; - - if( ( ! hasStore() ) && ( ! container() ) ) { - makePrivateStore(); - } - return *this; + Vertex_v1& Vertex_v1::operator=( const Vertex_v1& tp ) { + + // Check if anything needs to be done: + if( this == &tp ) { + return *this; + } + + // If the object doesn't have an auxiliary store yet, make a private + // one for it: + if( ( ! hasStore() ) && ( ! container() ) ) { + makePrivateStore(); + } + + // Invalidate the cache of the object: + resetCache(); + + // Now let the base class copy the auxiliary contents: + SG::AuxElement::operator=( tp ); + + // Return the object: + return *this; } Type::ObjectType Vertex_v1::type() const { diff --git a/Event/xAOD/xAODTracking/Root/dict/ContainerProxies.cxx b/Event/xAOD/xAODTracking/Root/dict/ContainerProxies.cxx index ac880c5e3f1a855fa867162e0fb2633e2c0ca088..a9013f6326fb5215d075cd21c0011449e525f89b 100644 --- a/Event/xAOD/xAODTracking/Root/dict/ContainerProxies.cxx +++ b/Event/xAOD/xAODTracking/Root/dict/ContainerProxies.cxx @@ -11,6 +11,7 @@ #include "xAODTracking/versions/VertexContainer_v1.h" #include "xAODTracking/versions/TrackMeasurementValidationContainer_v1.h" #include "xAODTracking/versions/TrackStateValidationContainer_v1.h" +#include "xAODTracking/versions/SCTRawHitValidationContainer_v1.h" // Set up the collection proxies: ADD_NS_DV_PROXY( xAOD, TrackParticleContainer_v1 ); @@ -18,3 +19,4 @@ ADD_NS_DV_PROXY( xAOD, NeutralParticleContainer_v1 ); ADD_NS_DV_PROXY( xAOD, VertexContainer_v1 ); ADD_NS_DV_PROXY( xAOD, TrackMeasurementValidationContainer_v1 ); ADD_NS_DV_PROXY( xAOD, TrackStateValidationContainer_v1 ); +ADD_NS_DV_PROXY( xAOD, SCTRawHitValidationContainer_v1 ); diff --git a/Event/xAOD/xAODTracking/test/ut_xaodtracking_vertex.cxx b/Event/xAOD/xAODTracking/test/ut_xaodtracking_vertex.cxx new file mode 100644 index 0000000000000000000000000000000000000000..addbcf21d27b0fe7be0d3899afae562bd2df7f3b --- /dev/null +++ b/Event/xAOD/xAODTracking/test/ut_xaodtracking_vertex.cxx @@ -0,0 +1,48 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id$ +// +// Unit tests for xAOD::Vertex. Should be extended with more tests later on. +// + +// System include(s): +#include <iostream> +#include <cmath> + +// Local include(s): +#include "xAODTracking/Vertex.h" + +/// Helper macro for evaluating logical tests +#define SIMPLE_ASSERT( EXP ) \ + do { \ + const bool result = EXP; \ + if( ! result ) { \ + std::cout << __FILE__ << ":" << __LINE__ \ + << " Expression \"" << #EXP << "\" failed the evaluation" \ + << std::endl; \ + return 1; \ + } \ + } while( 0 ) + +int main() { + + // Create the object to be tested: + xAOD::Vertex v; + v.makePrivateStore(); + + // Make some very simple setter/getter checks: + v.setFitQuality( 1.0, 5.0 ); + SIMPLE_ASSERT( std::abs( v.chiSquared() - 1.0 ) < 0.001 ); + SIMPLE_ASSERT( std::abs( v.numberDoF() - 5.0 ) < 0.001 ); + + // Test the deep copying of the class: + xAOD::Vertex copy; + copy = v; + SIMPLE_ASSERT( std::abs( copy.chiSquared() - 1.0 ) < 0.001 ); + SIMPLE_ASSERT( std::abs( copy.numberDoF() - 5.0 ) < 0.001 ); + + // Return gracefully: + return 0; +} diff --git a/Event/xAOD/xAODTracking/xAODTracking/SCTRawHitValidation.h b/Event/xAOD/xAODTracking/xAODTracking/SCTRawHitValidation.h new file mode 100644 index 0000000000000000000000000000000000000000..81ba7bce4bc385ac09ff752e9736dee09f1235b4 --- /dev/null +++ b/Event/xAOD/xAODTracking/xAODTracking/SCTRawHitValidation.h @@ -0,0 +1,16 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef XAODTRACKING_SCTRAWHITVALIDATION_H +#define XAODTRACKING_SCTRAWHITVALIDATION_H + +// Local include(s): +#include "versions/SCTRawHitValidation_v1.h" + +namespace xAOD { + /// Reference the current persistent version: + typedef SCTRawHitValidation_v1 SCTRawHitValidation; +} + +#endif // XAODTRACKING_SCTRAWHITVALIDATION_H diff --git a/Event/xAOD/xAODTracking/xAODTracking/SCTRawHitValidationAuxContainer.h b/Event/xAOD/xAODTracking/xAODTracking/SCTRawHitValidationAuxContainer.h new file mode 100644 index 0000000000000000000000000000000000000000..b977c784304bbcd053d8f0c421c7032304a16f98 --- /dev/null +++ b/Event/xAOD/xAODTracking/xAODTracking/SCTRawHitValidationAuxContainer.h @@ -0,0 +1,18 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef XAODTRACKING_SCTRAWHITVALIDATIONAUXCONTAINER_H +#define XAODTRACKING_SCTRAWHITVALIDATIONAUXCONTAINER_H + +#include "xAODTracking/versions/SCTRawHitValidationAuxContainer_v1.h" + +namespace xAOD { + typedef SCTRawHitValidationAuxContainer_v1 SCTRawHitValidationAuxContainer; +} + +// Set up a CLID for the container: +#include "xAODCore/CLASS_DEF.h" +CLASS_DEF(xAOD::SCTRawHitValidationAuxContainer, 1171743595, 1) + +#endif diff --git a/Event/xAOD/xAODTracking/xAODTracking/SCTRawHitValidationContainer.h b/Event/xAOD/xAODTracking/xAODTracking/SCTRawHitValidationContainer.h new file mode 100644 index 0000000000000000000000000000000000000000..a217ca64156f3daf4833d9e68a0fcf5338471f1a --- /dev/null +++ b/Event/xAOD/xAODTracking/xAODTracking/SCTRawHitValidationContainer.h @@ -0,0 +1,21 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef XAODTRACKING_SCTRAWHITVALIDATIONCONTAINER_H +#define XAODTRACKING_SCTRAWHITVALIDATIONCONTAINER_H + +// Local include(s): +#include "xAODTracking/SCTRawHitValidation.h" +#include "xAODTracking/versions/SCTRawHitValidationContainer_v1.h" + +namespace xAOD { + /// Definition of the current "SCTRawHitValidationContainer version" + typedef SCTRawHitValidationContainer_v1 SCTRawHitValidationContainer; +} + +// Set up a CLID for the container: +#include "xAODCore/CLASS_DEF.h" +CLASS_DEF(xAOD::SCTRawHitValidationContainer, 1314367244, 1) + +#endif // XAODTRACKING_SCTRAWHITVALIDATIONCONTAINER_H diff --git a/Event/xAOD/xAODTracking/xAODTracking/selection.xml b/Event/xAOD/xAODTracking/xAODTracking/selection.xml index 7658232098e2a875b8474a356195318cc58b395b..d15afb6ad96454fcab5b9bed251477159766fb0d 100644 --- a/Event/xAOD/xAODTracking/xAODTracking/selection.xml +++ b/Event/xAOD/xAODTracking/xAODTracking/selection.xml @@ -1,4 +1,3 @@ -<!-- $Id: selection.xml 575751 2013-12-16 16:45:36Z krasznaa $ --> <lcgdict> <!-- VERTEX DICTIONARIES --> @@ -111,6 +110,20 @@ <class name="std::vector<ElementLink<xAOD::NeutralParticleContainer_v1> >" /> <class name="std::vector<std::vector<ElementLink<xAOD::NeutralParticleContainer_v1> > >" /> + <!-- SCTRawHitValidation_v1 dictionaries: --> + <class name="xAOD::SCTRawHitValidationAuxContainer_v1" + id="788781DA-FE8A-414A-A72B-6E846094FCF8" /> + <class name="xAOD::SCTRawHitValidationContainer_v1" + id="4F8042A1-64B0-42AB-B0A4-C9716C15336A" /> + + <!-- Smart pointers to objects: --> + <class name="DataLink<xAOD::SCTRawHitValidationContainer_v1>" /> + <class name="std::vector<DataLink<xAOD::SCTRawHitValidationContainer_v1> >" /> + + <class name="ElementLink<xAOD::SCTRawHitValidationContainer_v1>" /> + <class name="std::vector<ElementLink<xAOD::SCTRawHitValidationContainer_v1> >" /> + <class name="std::vector<std::vector<ElementLink<xAOD::SCTRawHitValidationContainer_v1> > >" /> + <!-- TrackMeasurementValidation_v1 dictionaries: --> <class name="xAOD::TrackMeasurementValidation_v1"/> <class name="xAOD::TrackMeasurementValidationAuxContainer_v1" diff --git a/Event/xAOD/xAODTracking/xAODTracking/versions/SCTRawHitValidationAuxContainer_v1.h b/Event/xAOD/xAODTracking/xAODTracking/versions/SCTRawHitValidationAuxContainer_v1.h new file mode 100644 index 0000000000000000000000000000000000000000..67157be1e9c71c8251fcb2c90cce052f77522cc6 --- /dev/null +++ b/Event/xAOD/xAODTracking/xAODTracking/versions/SCTRawHitValidationAuxContainer_v1.h @@ -0,0 +1,31 @@ +// -*- C++ -*- + +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef XAODTRACKING_VERSIONS_SCTRAWHITVALIDATIONAUXCONTAINER_V1_H +#define XAODTRACKING_VERSIONS_SCTRAWHITVALIDATIONAUXCONTAINER_V1_H + +// System include(s): +#include <vector> + +// Core include(s): +#include "xAODCore/AuxContainerBase.h" +#include "AthLinks/ElementLink.h" + +namespace xAOD { + class SCTRawHitValidationAuxContainer_v1 : public AuxContainerBase { + public: + SCTRawHitValidationAuxContainer_v1(); + private: + std::vector<uint64_t> identifier; + std::vector<uint32_t> dataword; + }; +} + +// Set up StoreGate inheritance for the class +#include "xAODCore/BaseInfo.h" +SG_BASE(xAOD::SCTRawHitValidationAuxContainer_v1, xAOD::AuxContainerBase); + +#endif // XAODTRACKING_VERSIONS_SCTRAWHITVALIDATIONAUXCONTAINER_V1_H diff --git a/Event/xAOD/xAODTracking/xAODTracking/versions/SCTRawHitValidationContainer_v1.h b/Event/xAOD/xAODTracking/xAODTracking/versions/SCTRawHitValidationContainer_v1.h new file mode 100644 index 0000000000000000000000000000000000000000..5b302ee052aa71bb1744ec7ac9f132ada7e37ee6 --- /dev/null +++ b/Event/xAOD/xAODTracking/xAODTracking/versions/SCTRawHitValidationContainer_v1.h @@ -0,0 +1,19 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef XAODTRACKING_VERSIONS_SCTRAWHITVALIDATIONCONTAINER_V1_H +#define XAODTRACKING_VERSIONS_SCTRAWHITVALIDATIONCONTAINER_V1_H + +// Core include(s): +#include "AthContainers/DataVector.h" + +// Local include(s): +#include "xAODTracking/versions/SCTRawHitValidation_v1.h" + +namespace xAOD { + /// The container is a simple typedef for now + typedef DataVector<xAOD::SCTRawHitValidation_v1> SCTRawHitValidationContainer_v1; +} + +#endif // XAODTRACKING_VERSIONS_SCTRAWHITVALIDATIONCONTAINER_V1_H diff --git a/Event/xAOD/xAODTracking/xAODTracking/versions/SCTRawHitValidation_v1.h b/Event/xAOD/xAODTracking/xAODTracking/versions/SCTRawHitValidation_v1.h new file mode 100644 index 0000000000000000000000000000000000000000..559f906c79aa3136c8fc9d659b6e176783716227 --- /dev/null +++ b/Event/xAOD/xAODTracking/xAODTracking/versions/SCTRawHitValidation_v1.h @@ -0,0 +1,70 @@ +// -*- C++ -*- + +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef XAODTRACKING_VERSIONS_SCTRAWHITVALIDATION_V1_H +#define XAODTRACKING_VERSIONS_SCTRAWHITVALIDATION_V1_H + +// System include(s): +#include <vector> + +// Core include(s): +#include "AthContainers/AuxElement.h" + +namespace xAOD { + + /** Class describing an SCT Raw Data Object (RDO). + * + * @author Kilian Rosbach <kilian.rosbach@cern.ch> + */ + class SCTRawHitValidation_v1 : public SG::AuxElement { + public: + SCTRawHitValidation_v1(); + + /// set identifier of this RDO + void setIdentifier(uint64_t new_identifier); + + /// return identifier of this RDO + uint64_t identifier() const; + + /// set data word of this RDO + void setWord(uint32_t new_word); + + /** access data word of this RDO and properties encoded therein + * @{ + */ + /// return the data word + uint32_t getWord() const; + + /// return number of strips in this RDO (typically just 1) + int getGroupSize() const; + + /// return ID of (first) strip + int getStrip() const; + + /** Decode time bin information for the 3 consecutive bunch crossings. + * + * This information is stored in 3 bits where the most significant bit + * corresponds to BC-1. So the 3 bit pattern is: (BC-1), BC, (BC+1). + */ + int getTimeBin() const; + + /// return bitmask representing hit errors + int getErrors() const; + + /// check if the time bin corresponding to the present BC is on + bool OnTime() const; + + /// check if there is an error in the first hit's data + bool FirstHitError() const; + + /// check if there is an error in the second hit's data + bool SecondHitError() const; + /// @} + }; // end of the SCTRawHitValidation_v1 class definition + +} // end of the xAOD namespace + +#endif // XAODTRACKING_VERSIONS_SCTRAWHITVALIDATION_V1_H diff --git a/Event/xAOD/xAODTracking/xAODTracking/xAODTrackingDict.h b/Event/xAOD/xAODTracking/xAODTracking/xAODTrackingDict.h index 3b896ea57ac1947e9d12083990cc1336a910bc62..87f091405cf9e9a51e4eade01b1d0005f7a6378b 100644 --- a/Event/xAOD/xAODTracking/xAODTracking/xAODTrackingDict.h +++ b/Event/xAOD/xAODTracking/xAODTracking/xAODTrackingDict.h @@ -4,7 +4,6 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -// $Id: xAODTrackingDict.h 573808 2013-12-04 14:09:11Z salzburg $ #ifndef XAODTRACKING_XAODTRACKINGDICT_H #define XAODTRACKING_XAODTRACKINGDICT_H @@ -43,6 +42,13 @@ #include "xAODTracking/TrackingPrimitives.h" #include "xAODTracking/TrackParticlexAODHelpers.h" +#include "xAODTracking/SCTRawHitValidation.h" +#include "xAODTracking/SCTRawHitValidationContainer.h" +#include "xAODTracking/SCTRawHitValidationAuxContainer.h" +#include "xAODTracking/versions/SCTRawHitValidation_v1.h" +#include "xAODTracking/versions/SCTRawHitValidationContainer_v1.h" +#include "xAODTracking/versions/SCTRawHitValidationAuxContainer_v1.h" + namespace { struct GCCXML_DUMMY_INSTANTIATION_XAODTRACKING { xAOD::TrackParticleContainer_v1 c1; @@ -103,6 +109,15 @@ namespace { std::vector<std::vector<std::vector<float> > > vecDummyFltX; std::vector<std::vector<unsigned long> > vecDummyULX; + // Container(s): + xAOD::SCTRawHitValidationContainer_v1 c6; + // Data link(s): + DataLink< xAOD::SCTRawHitValidationContainer_v1 > rdodl1; + std::vector< DataLink< xAOD::SCTRawHitValidationContainer_v1 > > rdodl2; + // Element link(s): + ElementLink< xAOD::SCTRawHitValidationContainer > rdoel1; + std::vector< ElementLink< xAOD::SCTRawHitValidationContainer_v1 > > rdoel2; + std::vector< std::vector< ElementLink< xAOD::SCTRawHitValidationContainer_v1 > > > rdoel3; }; }