1
/* This file is part of MAUS: http:// micewww.pp.rl.ac.uk:8080/projects/maus
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.
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.
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/>.
20
#ifndef COMMON_CPP_OPTICS_HIT_GENERATOR_MAP_HH
21
#define COMMON_CPP_OPTICS_HIT_GENERATOR_MAP_HH
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"
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
51
class TransferMapOpticsModel : public OpticsModel {
53
// ******************************
55
// ******************************
57
/* @brief initialize the generator using the configuration.
58
* @params configuration the configuration as a Json document
60
explicit TransferMapOpticsModel(const Json::Value & configuration);
62
~TransferMapOpticsModel();
68
// ******************************
69
// OpticsModel functions
70
// ******************************
72
CovarianceMatrix Transport(const CovarianceMatrix & covariances,
73
const double end_plane) const;
75
CovarianceMatrix Transport(const CovarianceMatrix & covariances,
76
const double start_plane,
77
const double end_plane) const;
79
PhaseSpaceVector Transport(const PhaseSpaceVector & vector,
80
const double end_plane) const;
82
PhaseSpaceVector Transport(const PhaseSpaceVector & vector,
83
const double start_plane,
84
const double end_plane) const;
87
const TransferMap * GenerateTransferMap(const double plane) const;
89
const dataCards * data_cards_;
90
const MiceMaterials * mice_materials_;
91
const MiceModule * mice_module_;
92
const Json::Value * maus_configuration_;
94
std::map<double, const TransferMap *> transfer_maps_;
95
MAUSPrimaryGeneratorAction::PGParticle reference_pgparticle_;
96
recon::global::TrackPoint reference_particle_;
98
PhaseSpaceVector deltas_;
100
TransferMapOpticsModel();
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.
107
const std::vector<recon::global::TrackPoint> BuildFirstPlaneHits();
109
/* @brief Identify simulated hits by station and add them to the mappings
110
* from station ID to hits recorded by that station.
112
void MapStationsToHits(
113
std::map<int, std::vector<recon::global::TrackPoint> > &
116
const TransferMap * FindTransferMap(const double end_plane) const;
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.
122
virtual const TransferMap * CalculateTransferMap(
123
const std::vector<recon::global::TrackPoint> & start_plane_hits,
124
const std::vector<recon::global::TrackPoint> & station_hits)
128
std::ostream& operator<<(std::ostream& out, const TransferMapOpticsModel& map);