~mwinter4/maus/ckov-update

« back to all changes in this revision

Viewing changes to src/common_cpp/Optics/TransferMapOpticsModel.hh

  • Committer: Chris Rogers
  • Date: 2012-11-23 11:19:42 UTC
  • mfrom: (659.1.50 release-candidate)
  • Revision ID: chris.rogers@stfc.ac.uk-20121123111942-5wi23zn7zx396q2d
Tags: MAUS-v0.4.1
MAUS-v0.4.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of MAUS: http://  micewww.pp.rl.ac.uk:8080/projects/maus
 
2
 * 
 
3
 * MAUS is free software: you can redistribute it and/or modify
 
4
 * it under the terms of the GNU General Public License as published by
 
5
 * the Free Software Foundation, either version 3 of the License, or
 
6
 * (at your option) any later version.
 
7
 * 
 
8
 * MAUS is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU General Public License for more details.
 
12
 * 
 
13
 * You should have received a copy of the GNU General Public License
 
14
 * along with MAUS.  If not, see <http://  www.gnu.org/licenses/>.
 
15
 */
 
16
 
 
17
/* Author: Peter Lane
 
18
 */
 
19
 
 
20
#ifndef COMMON_CPP_OPTICS_HIT_GENERATOR_MAP_HH
 
21
#define COMMON_CPP_OPTICS_HIT_GENERATOR_MAP_HH
 
22
 
 
23
#include <ostream>
 
24
#include <vector>
 
25
#include <map>
 
26
 
 
27
#include "Interface/Squeal.hh"
 
28
#include "Simulation/MAUSPrimaryGeneratorAction.hh"
 
29
#include "src/common_cpp/Optics/OpticsModel.hh"
 
30
#include "src/common_cpp/Optics/PhaseSpaceVector.hh"
 
31
#include "Recon/Global/TrackPoint.hh"
 
32
 
 
33
class dataCards;
 
34
class MiceMaterials;
 
35
class MiceModule;
 
36
 
 
37
namespace Json {
 
38
  class Value;
 
39
}
 
40
 
 
41
namespace MAUS {
 
42
 
 
43
class TransferMap;
 
44
 
 
45
/** @class TransferMapOpticsModel simulates test particles through MICE and
 
46
 *  generates intermediate hits which are then used to build optics model
 
47
 *  transfer maps. This is a virtual base class for TransferMap based optics
 
48
 *  models. The derived classes must implement CalculateTransferMap() which is
 
49
 *  called by Build().
 
50
 */
 
51
class TransferMapOpticsModel : public OpticsModel {
 
52
 public:
 
53
  // ******************************
 
54
  //  Constructors
 
55
  // ******************************
 
56
 
 
57
  /* @brief initialize the generator using the configuration.
 
58
   * @params configuration the configuration as a Json document
 
59
   */
 
60
  explicit TransferMapOpticsModel(const Json::Value & configuration);
 
61
 
 
62
  ~TransferMapOpticsModel();
 
63
 
 
64
  /* @brief 
 
65
   */
 
66
  void Build();
 
67
 
 
68
  // ******************************
 
69
  //  OpticsModel functions
 
70
  // ******************************
 
71
 
 
72
  CovarianceMatrix Transport(const CovarianceMatrix & covariances,
 
73
                                     const double end_plane) const;
 
74
 
 
75
  CovarianceMatrix Transport(const CovarianceMatrix & covariances,
 
76
                                     const double start_plane,
 
77
                                     const double end_plane) const;
 
78
 
 
79
  PhaseSpaceVector Transport(const PhaseSpaceVector & vector,
 
80
                                     const double end_plane) const;
 
81
 
 
82
  PhaseSpaceVector Transport(const PhaseSpaceVector & vector,
 
83
                                     const double start_plane,
 
84
                                     const double end_plane) const;
 
85
 
 
86
 protected:
 
87
  const TransferMap * GenerateTransferMap(const double plane) const;
 
88
 
 
89
  const dataCards * data_cards_;
 
90
  const MiceMaterials * mice_materials_;
 
91
  const MiceModule * mice_module_;
 
92
  const Json::Value * maus_configuration_;
 
93
 
 
94
  std::map<double, const TransferMap *> transfer_maps_;
 
95
  MAUSPrimaryGeneratorAction::PGParticle reference_pgparticle_;
 
96
  recon::global::TrackPoint reference_particle_;
 
97
  double time_offset_;
 
98
  PhaseSpaceVector deltas_;
 
99
 
 
100
  TransferMapOpticsModel();
 
101
 
 
102
  /* @brief Build a set of TrackPoints displaced from the start plane
 
103
   * reference trajectory by a configuration-specified amount in one of the six
 
104
   * phase space coordinates. The set is used as test particles to extrapolate
 
105
   * transfer matrices to other detector station planes.
 
106
   */
 
107
  const std::vector<recon::global::TrackPoint> BuildFirstPlaneHits();
 
108
 
 
109
  /* @brief Identify simulated hits by station and add them to the mappings
 
110
   * from station ID to hits recorded by that station.
 
111
   */
 
112
  void MapStationsToHits(
 
113
      std::map<int, std::vector<recon::global::TrackPoint> > &
 
114
        station_hits);
 
115
 
 
116
  const TransferMap * FindTransferMap(const double end_plane) const;
 
117
 
 
118
  /* @brief called by Build() to calculate transfer maps between the start plane
 
119
   * and the station planes. The returned pointer points to a newly allocated
 
120
   * TranferMap. The caller assumes all responsibility for the allocated memory.
 
121
   */
 
122
  virtual const TransferMap * CalculateTransferMap(
 
123
      const std::vector<recon::global::TrackPoint> & start_plane_hits,
 
124
      const std::vector<recon::global::TrackPoint> & station_hits)
 
125
      const = 0;
 
126
};
 
127
 
 
128
std::ostream& operator<<(std::ostream& out, const TransferMapOpticsModel& map);
 
129
}  // namespace MAUS
 
130
 
 
131
#endif