LSSTApplications  8.0.0.0+107,8.0.0.1+13,9.1+18,9.2,master-g084aeec0a4,master-g0aced2eed8+6,master-g15627eb03c,master-g28afc54ef9,master-g3391ba5ea0,master-g3d0fb8ae5f,master-g4432ae2e89+36,master-g5c3c32f3ec+17,master-g60f1e072bb+1,master-g6a3ac32d1b,master-g76a88a4307+1,master-g7bce1f4e06+57,master-g8ff4092549+31,master-g98e65bf68e,master-ga6b77976b1+53,master-gae20e2b580+3,master-gb584cd3397+53,master-gc5448b162b+1,master-gc54cf9771d,master-gc69578ece6+1,master-gcbf758c456+22,master-gcec1da163f+63,master-gcf15f11bcc,master-gd167108223,master-gf44c96c709
LSSTDataManagementBasePackage
Stages.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2008, 2009, 2010 LSST Corporation.
6  *
7  * This product includes software developed by the
8  * LSST Project (http://www.lsst.org/).
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the LSST License Statement and
21  * the GNU General Public License along with this program. If not,
22  * see <http://www.lsstcorp.org/LegalNotices/>.
23  */
24 
25 
33 #ifndef LSST_AP_STAGES_H
34 #define LSST_AP_STAGES_H
35 
36 #include <string>
37 #include <vector>
38 
39 #include "boost/noncopyable.hpp"
40 #include "boost/shared_ptr.hpp"
41 
42 #include "lsst/daf/base/Citizen.h"
44 #include "lsst/pex/policy/Policy.h"
45 
46 #include "lsst/afw/detection/DiaSource.h"
47 #include "lsst/afw/image/Filter.h"
48 #include "lsst/mops/MovingObjectPrediction.h"
49 
50 #include "Common.h"
51 #include "ChunkManager.h"
52 #include "CircularRegion.h"
53 #include "Results.h"
54 #include "SpatialUtil.h"
55 #include "Time.h"
56 #include "ZoneTypes.h"
57 
58 
59 namespace lsst { namespace ap {
60 
61 #ifndef SWIG
63  typedef lsst::afw::detection::DiaSource Entry;
64 };
65 #endif
66 
67 
71  private boost::noncopyable
72 {
73 public :
75  lsst::pex::policy::Policy::Ptr const policy,
77  std::string const & runId,
78  int const workerId,
79  int const numWorkers
80  );
81 
83 
84  void setDiaSources(boost::shared_ptr<lsst::afw::detection::PersistableDiaSourceVector> diaSources);
85 
86 #ifndef SWIG
87 
89 
94 
95  std::vector<int> const & getChunkIds() const {
96  return _chunkIds;
97  }
98  std::vector<ObjectChunk> const & getChunks() const {
99  return _chunks;
100  }
101  std::vector<int> & getChunkIds() {
102  return _chunkIds;
103  }
104  std::vector<ObjectChunk> & getChunks() {
105  return _chunks;
106  }
107 
109  return _objectIndex;
110  }
112  return _diaSourceIndex;
113  }
114 
115  void buildObjectIndex();
116 
119  }
120  CircularRegion const & getFov() const {
121  return _fov;
122  }
123  TimeSpec const & getDeadline() const {
124  return _deadline;
125  }
127  return _filter;
128  }
129 
130 #endif
131 
132  boost::shared_ptr<lsst::pex::policy::Policy> getPipelinePolicy() {
133  return _policy;
134  }
135  std::string const & getRunId() const {
136  return _runId;
137  }
138  double getMatchRadius() const {
139  return _matchRadius;
140  }
141  double getEllipseScalingFactor() const {
142  return _ellipseScalingFactor;
143  }
144  int getVisitId() const {
145  return _visitId;
146  }
147  int getFilterId() const {
148  return _filter.getId();
149  }
150  int getWorkerId() const {
151  return _workerId;
152  }
153  int getNumWorkers() const {
154  return _numWorkers;
155  }
156  bool debugSharedMemory() const {
157  return _debugSharedMemory;
158  }
159 
160 private :
161 
163  std::vector<int> _chunkIds;
164  std::vector<ObjectChunk> _chunks;
167  std::vector<lsst::afw::detection::DiaSource::Ptr> _diaSources;
168 
171  std::string _runId;
172  int _visitId;
173  double _matchRadius;
175  double _visitTime;
180 };
181 
182 
183 void initialize(std::string const & runId);
184 
185 void registerVisit(VisitProcessingContext & context);
186 
188 
190 
191 void matchDiaSources(
192  MatchPairVector & matches,
193  VisitProcessingContext & context
194 );
195 
196 void matchMops(
197  MatchPairVector & matches,
198  IdPairVector & newObjects,
199  VisitProcessingContext & context,
200  lsst::mops::MovingObjectPredictionVector & predictions
201 );
202 
204 
205 void failVisit(VisitProcessingContext & context);
206 
207 bool endVisit(VisitProcessingContext & context, bool const rollback);
208 
209 
210 }} // end of namespace lsst::ap
211 
212 #endif // LSST_AP_STAGES_H
213 
DiaSourceIndex _diaSourceIndex
Definition: Stages.h:166
A circular region of the unit sphere (sky).
Class for managing chunks of Object instances in shared memory.
VisitProcessingContext(lsst::pex::policy::Policy::Ptr const policy, lsst::daf::base::PropertySet::Ptr const event, std::string const &runId, int const workerId, int const numWorkers)
Definition: Stages.cc:534
Container for inter-stage association pipeline state.
Definition: Stages.h:69
Wraps the C library timespec struct.
Definition: Time.h:48
std::vector< int > & getChunkIds()
Definition: Stages.h:101
std::vector< int > _chunkIds
Definition: Stages.h:163
void storeSliceObjects(VisitProcessingContext &context)
Definition: Stages.cc:967
ZoneEntry< ObjectChunk > ObjectEntry
Definition: Stages.h:90
ZoneEntry< DiaSourceChunk > DiaSourceEntry
Definition: Stages.h:91
CircularRegion const & getFov() const
Definition: Stages.h:120
std::string const & getRunId() const
Definition: Stages.h:135
SharedObjectChunkManager::ObjectChunk ObjectChunk
Definition: Stages.h:88
boost::shared_ptr< PropertySet > Ptr
Definition: PropertySet.h:90
Contains spatial information for a single point used during cross-matching.
Definition: ZoneTypes.h:54
boost::shared_ptr< Policy > Ptr
Definition: Policy.h:172
void failVisit(VisitProcessingContext &context)
Definition: Stages.cc:1012
std::vector< int > const & getChunkIds() const
Definition: Stages.h:95
double getEllipseScalingFactor() const
Definition: Stages.h:141
lsst::afw::image::Filter getFilter() const
Definition: Stages.h:126
std::vector< MatchPair > MatchPairVector
A list of MatchPair instances.
Definition: Results.h:123
void initialize(std::string const &runId)
Definition: Stages.cc:644
ZoneStripeChunkDecomposition const & getDecomposition() const
Definition: Stages.h:117
void matchMops(MatchPairVector &matches, IdPairVector &newObjects, VisitProcessingContext &context, lsst::mops::MovingObjectPredictionVector &predictions)
Definition: Stages.cc:866
std::vector< ObjectChunk > & getChunks()
Definition: Stages.h:104
lsst::afw::image::Filter _filter
Definition: Stages.h:176
void setDiaSources(boost::shared_ptr< lsst::afw::detection::PersistableDiaSourceVector > diaSources)
Definition: Stages.cc:584
ZoneStripeChunkDecomposition const & getDecomposition() const
Definition: ZoneTypes.h:281
ZoneIndex< ObjectEntry > ObjectIndex
Definition: Stages.h:92
lsst::afw::detection::DiaSource Entry
Definition: Stages.h:63
void registerVisit(VisitProcessingContext &context)
Definition: Stages.cc:654
A decomposition of the unit sphere into zones, stripes, and chunks.
Definition: SpatialUtil.h:69
lsst::pex::policy::Policy::Ptr _policy
Definition: Stages.h:162
int getId() const
Definition: Filter.h:136
bool endVisit(VisitProcessingContext &context, bool const rollback)
Definition: Stages.cc:1028
Convenience wrapper for the C library timespec struct and a simple profiling class.
std::vector< IdPair > IdPairVector
A list of IdPair instances.
Definition: Results.h:125
Holds an integer identifier for an LSST filter.
Definition: Filter.h:107
void buildObjectIndex(VisitProcessingContext &context)
Definition: Stages.cc:775
ObjectIndex & getObjectIndex()
Definition: Stages.h:108
Master header file for the association pipeline.
std::vector< lsst::afw::detection::DiaSource::Ptr > _diaSources
Definition: Stages.h:167
std::vector< ObjectChunk > const & getChunks() const
Definition: Stages.h:98
double getMatchRadius() const
Definition: Stages.h:138
bool debugSharedMemory() const
Definition: Stages.h:156
TimeSpec const & getDeadline() const
Definition: Stages.h:123
Interface for PropertySet class.
Classes for zone entries, zones, and zone indexes.
boost::shared_ptr< lsst::pex::policy::Policy > getPipelinePolicy()
Definition: Stages.h:132
void matchDiaSources(MatchPairVector &matches, VisitProcessingContext &context)
Definition: Stages.cc:808
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:56
ZoneIndex< DiaSourceEntry > DiaSourceIndex
Definition: Stages.h:93
Class describing a circular region on the sky.
void loadSliceObjects(VisitProcessingContext &context)
Definition: Stages.cc:666
Persistable vectors for association pipeline results.
Class and helper functions related to spatial partitioning.
DiaSourceIndex & getDiaSourceIndex()
Definition: Stages.h:111
std::vector< ObjectChunk > _chunks
Definition: Stages.h:164
Class encapsulating an identifier for an LSST filter.