Belle II Software development
CDCSimpleSimulation.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#pragma once
9
10#include <tracking/trackingUtilities/eventdata/hits/CDCWireHit.h>
11
12#include <tracking/trackingUtilities/utilities/VectorRange.h>
13
14#include <Math/Vector3D.h>
15
16#include <vector>
17#include <memory>
18
19namespace Belle2 {
24 namespace TrackingUtilities {
25
27 class CDCTrack;
28 class CDCTrajectory3D;
29 class Helix;
30 }
31
32 namespace TrackFindingCDC {
33
49
50 private:
51
53 struct SimpleSimHit {
54
60 size_t iMCTrack,
61 TrackingUtilities::ERightLeft rlInfo) :
62 m_wireHit(wireHit),
63 m_iMCTrack(iMCTrack),
64 m_rlInfo(rlInfo)
65 {}
66
72 size_t iMCTrack,
73 TrackingUtilities::ERightLeft rlInfo,
74 const ROOT::Math::XYZVector& pos3D,
75 double arcLength2D = NAN,
76 double trueDriftLength = NAN) :
77 m_wireHit(wireHit),
78 m_iMCTrack(iMCTrack),
79 m_rlInfo(rlInfo),
80 m_pos3D(pos3D),
81 m_arcLength2D(arcLength2D),
82 m_trueDriftLength(trueDriftLength)
83 {}
84
87
89 size_t m_iMCTrack;
90
92 TrackingUtilities::ERightLeft m_rlInfo;
93
95 ROOT::Math::XYZVector m_pos3D = m_wireHit.getRefPos3D();
96
98 double m_arcLength2D = NAN;
99
101 double m_trueDriftLength = NAN;
102 };
103
104 public:
106 TrackingUtilities::ConstVectorRange<TrackingUtilities::CDCWireHit> getWireHits() const;
107
108 public:
115 std::vector<TrackingUtilities::CDCTrack> simulate(const std::vector<TrackingUtilities::CDCTrajectory3D>& trajectories3D);
116
119
121 std::vector<TrackingUtilities::CDCTrack> loadPreparedEvent();
122
123 private:
125 std::vector<TrackingUtilities::CDCTrack> constructMCTracks(int nMCTracks, std::vector<SimpleSimHit> simpleSimHits);
126
128 std::vector<SimpleSimHit> createHits(const TrackingUtilities::Helix& globalHelix, double arcLength2DOffset) const;
129
131 std::vector<SimpleSimHit> createHitsForLayer(const CDC::CDCWire& nearWire,
132 const TrackingUtilities::Helix& globalHelix,
133 double arcLength2DOffset) const;
134
137 const TrackingUtilities::Helix& globalHelix,
138 double arcLength2DOffset) const;
139
140 public:
142 double getEventTime() const
143 { return m_eventTime; }
144
146 void setEventTime(double eventTime)
147 { m_eventTime = eventTime; }
148
150 void activateTOFDelay(bool activate = true)
151 { m_addTOFDelay = activate; }
152
154 void activateInWireSignalDelay(bool activate = true)
155 { m_addInWireSignalDelay = activate; }
156
159 { return m_maxNHitOnWire; }
160
162 void setMaxNHitOnWire(int maxNHitOnWire)
163 { m_maxNHitOnWire = maxNHitOnWire; }
164
165 private:
167 std::shared_ptr<const std::vector<TrackingUtilities::CDCWireHit> > m_sharedWireHits;
168
170 const double s_nominalDriftLengthVariance = 0.000169;
171
173 const double s_nominalPropSpeed = 27.25;
174
176 const double s_nominalDriftSpeed = 4e-3;
177
180
182 double m_eventTime = 0;
183
185 bool m_addTOFDelay = false;
186
189
190 // TODO: make them freely setable ?
193
196
199
202 };
203
204 }
206}
Class representing a sense wire in the central drift chamber.
Definition CDCWire.h:50
Class providing a simple simulation of the CDC mainly for quick unit test checks.
void activateTOFDelay(bool activate=true)
Activate the TOF time delay.
TrackingUtilities::ConstVectorRange< TrackingUtilities::CDCWireHit > getWireHits() const
Getter for the wire hits created in the simulation.
void setMaxNHitOnWire(int maxNHitOnWire)
Setter for the maximal number of hits that are allowed on each layer.
std::shared_ptr< const std::vector< TrackingUtilities::CDCWireHit > > m_sharedWireHits
Space for the memory of the generated wire hits.
std::vector< TrackingUtilities::CDCTrack > constructMCTracks(int nMCTracks, std::vector< SimpleSimHit > simpleSimHits)
Creates TrackingUtilities::CDCWireHits and uses them to construct the true TrackingUtilities::CDCTrac...
int getMaxNHitOnWire() const
Getter for the maximal number of hits that are allowed on each layer.
bool m_addInWireSignalDelay
Switch to activate the in wire signal delay.
double m_propSpeed
Electrical current propagation speed in the wires.
std::vector< SimpleSimHit > createHits(const TrackingUtilities::Helix &globalHelix, double arcLength2DOffset) const
Generate hits for the given helix in starting from the two dimensional arc length.
std::vector< TrackingUtilities::CDCTrack > simulate(const std::vector< TrackingUtilities::CDCTrajectory3D > &trajectories3D)
Propagates the trajectories through the CDC as without energy loss until they first leave the CDC.
void setEventTime(double eventTime)
Setter for a global event time offset.
double getEventTime() const
Getter for a global event time offset.
double m_driftLengthVariance
Variance by which the drift length should be smeared.
const double s_nominalPropSpeed
Default in wire signal propagation speed - 27.25 cm / ns.
void activateInWireSignalDelay(bool activate=true)
Activate the in wire signal delay.
bool m_addTOFDelay
Switch to activate the addition of the time of flight.
int m_maxNHitOnWire
Maximal number of hits allowed on each wire (0 means all).
const double s_nominalDriftLengthVariance
Default drift length variance.
double m_driftLengthSigma
Standard deviation by which the drift length should be smeared.
std::vector< TrackingUtilities::CDCTrack > loadPreparedEvent()
Fills the wire hits with a hard coded event from the real simulation.
SimpleSimHit createHitForCell(const CDC::CDCWire &wire, const TrackingUtilities::Helix &globalHelix, double arcLength2DOffset) const
Generate a hit for the given wire.
std::vector< SimpleSimHit > createHitsForLayer(const CDC::CDCWire &nearWire, const TrackingUtilities::Helix &globalHelix, double arcLength2DOffset) const
Generate connected hits for wires in the same layer close to the given wire.
double m_driftSpeed
Electron drift speed in the cdc gas.
const double s_nominalDriftSpeed
Default electron drift speed in cdc gas - 4 * 10^-3 cm / ns.
Class representing a sequence of three dimensional reconstructed hits.
Definition CDCTrack.h:37
Particle full three dimensional trajectory.
Class representing a hit wire in the central drift chamber.
Definition CDCWireHit.h:56
Extension of the generalized circle also caching the perigee coordinates.
Definition Helix.h:30
Abstract base class for different kinds of events.
Structure to accommodate information about the individual hits during the simulation.
double m_arcLength2D
Memory for the true two dimensional arc length on the helix to this hit.
SimpleSimHit(const TrackingUtilities::CDCWireHit &wireHit, size_t iMCTrack, TrackingUtilities::ERightLeft rlInfo)
Constructor from limited truth information Mainly used by the manually prepared event.
double m_trueDriftLength
Memory for the true drift length from the true position to the wire.
TrackingUtilities::ERightLeft m_rlInfo
Memory for the true right left passage information.
size_t m_iMCTrack
Memory for the true index of the track this hit is contained in.
ROOT::Math::XYZVector m_pos3D
Memory for the true position on the track closest to the wire.
TrackingUtilities::CDCWireHit m_wireHit
Memory for the wire hit instance that will be given to the reconstruction.
SimpleSimHit(const TrackingUtilities::CDCWireHit &wireHit, size_t iMCTrack, TrackingUtilities::ERightLeft rlInfo, const ROOT::Math::XYZVector &pos3D, double arcLength2D=NAN, double trueDriftLength=NAN)
Constructor from complete truth information.