//***************************************************** // Class : VertexCollChunk.hpp // // Author: M. Narain - F. Stichelbaut // // Purpose: Defines the concrete calls which contains the // Vertex Chunk. It inherits from AbsChunk. // It is a collection of vertices. // // Date : 14-FEB-1998 : Creation of class // // Modify: 12-FEB-1999: Moved to vertex_evt package // 2-OCT-2001 : added constructor with rcpIDs and chunkIDs only (SP) //***************************************************** #ifndef VERTEXCOLLCHUNK_HPP #define VERTEXCOLLCHUNK_HPP #include "edm/AbsChunk.hpp" #include "edm/THandle.hpp" #include "edm/LinkIndex.hpp" #include "identifiers/ChunkID.hpp" #include "identifiers/RCPID.hpp" #include "identifiers/EnvID.hpp" #include "vertexutil/VertexColl.hpp" #include "vertexutil/VertexID.hpp" #include "vertexutil/VertexType.hpp" #include #include // Persistence #include "d0om/d0_Object.hpp" #include "d0om/d0_Ref.hpp" #ifndef __CINT__ #include "vertexutil/VertexColl_ref.hpp" #include "vertexutil/Vertex_ref.hpp" #include "vertex_evt/VertexCollChunk_ref.hpp" #endif /** Vertex collection chunk class. This is a chunk containing the collection of fitted vertices. */ namespace vertex{ class VertexCollChunk : public edm::AbsChunk { CHUNK_SETUP(VertexCollChunk); public: /**@name Methods */ //@{ /// VertexIndex typedef edm::LinkIndex VertexIndex; /// Default constructor VertexCollChunk(); /// Constructor with default ID and RCP information for all VertexCollChunk VertexCollChunk(const std::list& rcpIDs, const std::list& parents, const vertex::VertexType vertexType); /// Constructor with default ID and RCP information for all VertexCollChunk VertexCollChunk(const edm::RCPID& vertexRecoID, const edm::RCPID& vertexAlgID, const edm::RCPID& trackSelAlgID, const vertex::VertexType vertexType, const std::string vertexName, const edm::EnvID& envID); /// Full constructor (adds info to above default ID/RCP info) VertexCollChunk(const VertexCollChunk& collChunk, const std::vector& parentChunkID, VertexColl& vcoll); /// Full constructor - includes ID and Vertex information /** This is the full constructor for a VertexCollChunk. The ID information of the RCPs, chunks and environmental data used to construct the vertex along with the collection of a given type of vertex is stored in this chunk. @param vertexRecoID The ID of the VertexReco RCP. @param vertexAlgID The ID of the RCP used by the vertex algorithm. @param trackSelAlgID The ID of the RCP used by the track selector. @param vertexType The type of vertex : primary or secondary. @param envID ID of the environmental data. @param parentChunkID IDs of the parent Chunk eg. {\bf GTrack} chunk. @param vcoll Collection of vertices constructed by this vertexreco package. */ VertexCollChunk(const edm::RCPID& vertexRecoID, const edm::RCPID& vertexAlgID, const edm::RCPID& trackSelAlgID, const vertex::VertexType vertexType, const std::string vertexName, const edm::EnvID& envID, const std::vector& parentChunkID, VertexColl& vcoll); /// Destructor ~VertexCollChunk(); // Following functions are from parent class AbsChunk /// Return IDs of concrete input chunks used in the generation of this chunk std::list parents() const; /// Return a list of IDs of all RCPs used in creating this chunk std::list rcps() const; /// Return a list of IDs of environmental data used while generating the chunk std::list environment() const; /// Print VertexCollChunk to stream void printChunk(std::ostream& out) const; /// Print essential information in VertexCollChunk to stream void outputChunk(std::ostream& out) const; // Member functions specific to VertexCollChunk /// Retrieve VertexReco ID. edm::RCPID get_vertexRecoID() const; /// Retrieve VertexAlg ID. edm::RCPID get_vertexAlgID() const; /// Retrieve TrackSelAlg ID. edm::RCPID get_trackSelAlgID() const; /// Retrieve IDs of parent Chunks. std::vector get_parentChunkID() const; /// Retrieve VertexEnv ID. edm::EnvID get_vertexEnvID() const; /// Set Chunk IDs of parent Chunks . void set_parentChunkID(const std::vector& id); /// Retrieve vertex type vertex::VertexType get_vertexType() const; /// Retrieve the name of the vertex std::string get_vertexName() const; /// Retrieve number of vertices in this VertexCollChunk. int get_numVertices() const; /// Retrieve the vertex collection (vector) in this chunk. VertexColl get_vertexColl() const; /// Retrieve the pointer(reference) to the vertex collection in this chunk. const VertexColl* get_pvertexColl() const; VertexColl& get_VertexColl(){ return _vcoll;} /// Retrieve a single instance of the vertex [index] Vertex& get_vertex(int index) const; /// Retrieve a single instance of the vertex [index], required by LinkPtr Vertex& at(int index) const; /// Retrieve the LinkIndex of the vertex VertexIndex get_vertexIndex(int index) const; /// Retrieve the LinkIndex of the vertices (vector) in this Chunk. std::vector get_vertexIndex() const; /// Retrieve the IDs of the vertices (vector) in this Chunk. std::vector get_vertexID(); /// Retrieve a single instance of the VertexID in this Chunk. VertexID get_vertexID(int index); /** Construct active data and delete persistent data. Either active or persistent data should be present. Active data is not constructed if it is already present. Called by d0om immediately after persistent data is read in. */ void activate(); /** Construct persistent data. Either active or persistent data should be present. Persistent data is not constructed if it is already present. Called by d0om before data is written. */ void deactivate() const; /// Return if the active data is present. bool is_active() const; /// Return if the persistent data is present. bool is_persistent() const; /// Return version number int version() const {return _version;} //@} private: /**@name Attributes */ //@{ // These data are fixed for each instance of VertexReco /// The ID of the control RCP for vertexreco package edm::RCPID _vertexRecoID; /// The ID of the RCP used by the vertex algorithm edm::RCPID _vertexAlgID; /// The ID of the RCP used by the track selector algorithm edm::RCPID _trackSelAlgID; /// The ID of the RCP used by UnpThumbNailPkg /// null if not created from ThumbNail edm::RCPID _unpThumbNailID; /// The type of vertex vertex::VertexType _vertexType; /// The name of the Vertex std::string _vertexName; /// The ID of the environmental variables used edm::EnvID _envID; // Vary event by event /// The ID of the parent Chunk e.g. {\bf GTrack} chunk std::vector _parentChunkID; /// Collection of {\bf Vertex} objects. mutable VertexColl _vcoll; /// ID of the Vertices mutable std::vector _vertexID; //! transient /// Flag indicating that active data are present. mutable bool _active; //! transient /// Flag indicating that persistent data are present. mutable bool _persistent; //! transient /** doLinks() gets called whenever chunk contents are accessed to activate LinkIndex objects */ void doLinks() const; #ifndef __CINT__ /// Flag indicating Links active or Not mutable bool _linksDone; //! transient #endif /// function to create VertexIDs for this chunk std::vector makeVertexID(); /// Version control int _version; //@} }; }//namespace #endif //VERTEXCOLLCHUNK_HPP