// GTrackChunk.hpp #ifndef GTrackChunk_H #define GTrackChunk_H // This chunk contains the reconstructed tracks (GTrack) for the event. // // The data in this chunk exists in one of two forms: // persistent: Ready for transfer to a persistent medium via D0OM. // active: Ready for user access. // // The persistent data is mutable, i.e. can be modified with const // methods. This is neccessary because d0_Object::deactivate() is const. #include "edm/AbsChunk.hpp" #include #include "gtr_evt/SurfaceRecorder.hpp" #ifndef __CINT__ #include "gtr_evt/GTrackChunk_ref.hpp" #include "gtrbase/GTrack.hpp" #include "d0cluster/ChunkClusterIndexConverter.hpp" #include "chunkptr/get_chunk_object.hpp" #endif class GTrack; class GTrackChunk : public edm::AbsChunk { // Macro required by AbsChunk. CHUNK_SETUP (GTrackChunk); public: // typedefs for the AbsChunk interface. typedef std::list RCPList; typedef std::list EnvList; typedef std::list ChunkList; private: // typedefs for the persistent data. // Index for each surface. typedef std::vector SurfIndexList; // Number of states for each global track. typedef std::vector StateCountList; // S for each state. typedef std::vector SList; // Vector and error parameters for each ETrack. typedef std::vector ETrackParamList; // Direction for each track. // D0OM chokes if I make this vector. typedef std::vector ForwardList; // Fit status values. typedef std::vector FitStatusList; // Chi-square values. typedef std::vector ChiSquareList; // Cluster pointer indices. //typedef std::vector ClusterList; typedef std::vector ClusterList; #ifndef __CINT__ public: // typedefs // Non-delete pointer returned by get_track(int) const. // typedef Ptr GTrackPtr; typedef const GTrack* GTrackPtr; // list of reconstructed tracks typedef std::vector TrackList; private: // flags indicating the data status // Flag indicating that active data is present. mutable bool _active; //! transient // Flag indicating that persistent data is present. mutable bool _persistent; //! transient // Flag indicating that links are set. mutable bool _links; private: // transient attributes // reconstructed tracks in transient form mutable TrackList _tracks; //! transient // Event pointer. // we store this because EDM only returns a bare pointer. mutable EventPtr _pevt; #endif private: // persistent attributes -- these must be mutable // Version indicating format of persistent data. // Used for schema evolution. mutable int _version; // Identifier lableling the type of tracks in the chunk (CFT, // CFT+SMT, w/ or w/o m.s., etc.). // Default is 0. mutable int _content_id; // Version of the cluster pointer indexer mutable int _cluster_indexer_version; // List of parent chunks. mutable ChunkList _parent_chunks; // List of cluster chunks used directly or used by ancestor // Gtrack chunks. mutable ChunkList _cluster_chunks; // Number of states in each global track. mutable StateCountList _state_counts; // S for each state. mutable SList _ss; // ETrack lists. mutable SurfIndexList _surf_indices; mutable SurfaceRecorder _surfs; mutable ETrackParamList _etrack_params; // Surface direction list. mutable ForwardList _forwards; // Fit status list. mutable FitStatusList _fit_statii; // Cluster pointer list. mutable ClusterList _clusters; // Chi-square list. mutable ChiSquareList _chi_squares; private: // methods // Set all the links in the active GTracks. void set_links() const; public: // methods // Default constructor. GTrackChunk(); #ifndef __CINT__ // Constructor from the list of tracks. // For safety, we copy the list. GTrackChunk(const ChunkList& parents, const ChunkList& clusters, const TrackList& tracksi, int content_id =0); #endif // RCP list (required by AbsChunk) RCPList rcps() const; // Environment list (required by AbsChunk). EnvList environment() const; // List of cluster chunks. ChunkList cluster_chunks() const; // Parent chunk list (required by AbsChunk). ChunkList parents() const; // Output stream. void printChunk(std::ostream& stream) const; // Return the event pointer. Fetch from subclass if not yet defined. // we need this because EDM presently returns Event* instead of // EventPtr. const EventPtr& get_event_ptr() const; // 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(); #ifndef __CINT__ // In order to reconstruct the cluster pointers (into parent // chunks), we must know the event. In the present event model // this information is not provided to the chunk, so users must // activate by hand using this method. void activate_with_event(const EventPtr& evt) const; #endif // 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; // Delete the active data. // This exists primarily for testing but may also be called // to save space. void delete_active_data(); // Return if the active data is peresent. bool is_active() const; // Return if the persistent data is present. bool is_persistent() const; #ifndef __CINT__ // Fetch the list of global tracks. // Data must be active. const TrackList& get_tracks() const; // Return a specific track. // Return null if index is out of range. // Warning: The returned track is deleted when the chunk is deleted! GTrackPtr get_track(int itrk) const; // Return a track for a D0 link. const GTrack& at(int itrk) const; // Return the content id. int get_content_id() const; #endif }; #ifndef __CINT__ // Specialization for extracting object from chunk. template<> GTrackChunk::GTrackPtr get_chunk_object(GTrackChunk::GTrackPtr pobj, edm::THandle pchk, const int& idx ); #endif #endif