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/trackFindingCDC/eventdata/hits/CDCWireHit.h>
11
12#include <tracking/trackFindingCDC/utilities/VectorRange.h>
13
14#include <tracking/trackFindingCDC/geometry/Vector3D.h>
15#include <vector>
16#include <memory>
17
18namespace Belle2 {
23 namespace TrackFindingCDC {
24
26 class CDCTrack;
27 class CDCTrajectory3D;
28 class Helix;
29
45
46 private:
47
49 struct SimpleSimHit {
50
55 SimpleSimHit(const CDCWireHit& wireHit,
56 size_t iMCTrack,
57 ERightLeft rlInfo) :
58 m_wireHit(wireHit),
59 m_iMCTrack(iMCTrack),
60 m_rlInfo(rlInfo)
61 {}
62
67 SimpleSimHit(const CDCWireHit& wireHit,
68 size_t iMCTrack,
69 ERightLeft rlInfo,
70 const Vector3D& pos3D,
71 double arcLength2D = NAN,
72 double trueDriftLength = NAN) :
73 m_wireHit(wireHit),
74 m_iMCTrack(iMCTrack),
75 m_rlInfo(rlInfo),
76 m_pos3D(pos3D),
77 m_arcLength2D(arcLength2D),
78 m_trueDriftLength(trueDriftLength)
79 {}
80
83
85 size_t m_iMCTrack;
86
89
92
94 double m_arcLength2D = NAN;
95
97 double m_trueDriftLength = NAN;
98 };
99
100 public:
103
104 public:
111 std::vector<CDCTrack> simulate(const std::vector<CDCTrajectory3D>& trajectories3D);
112
114 CDCTrack simulate(const CDCTrajectory3D& trajectory3D);
115
117 std::vector<CDCTrack> loadPreparedEvent();
118
119 private:
121 std::vector<CDCTrack> constructMCTracks(int nMCTracks, std::vector<SimpleSimHit> simpleSimHits);
122
124 std::vector<SimpleSimHit> createHits(const Helix& globalHelix, double arcLength2DOffset) const;
125
127 std::vector<SimpleSimHit> createHitsForLayer(const CDCWire& nearWire,
128 const Helix& globalHelix,
129 double arcLength2DOffset) const;
130
133 const Helix& globalHelix,
134 double arcLength2DOffset) const;
135
136 public:
138 double getEventTime() const
139 { return m_eventTime; }
140
142 void setEventTime(double eventTime)
143 { m_eventTime = eventTime; }
144
146 void activateTOFDelay(bool activate = true)
147 { m_addTOFDelay = activate; }
148
150 void activateInWireSignalDelay(bool activate = true)
151 { m_addInWireSignalDelay = activate; }
152
155 { return m_maxNHitOnWire; }
156
158 void setMaxNHitOnWire(int maxNHitOnWire)
159 { m_maxNHitOnWire = maxNHitOnWire; }
160
161 private:
163 std::shared_ptr<const std::vector<CDCWireHit> > m_sharedWireHits;
164
166 const double s_nominalDriftLengthVariance = 0.000169;
167
169 const double s_nominalPropSpeed = 27.25;
170
172 const double s_nominalDriftSpeed = 4e-3;
173
176
178 double m_eventTime = 0;
179
181 bool m_addTOFDelay = false;
182
185
186 // TODO: make them freely setable ?
189
192
195
198 };
199
200 }
202}
Class providing a simple simulation of the CDC mainly for quick unit test checks.
void activateTOFDelay(bool activate=true)
Activate the TOF time delay.
ConstVectorRange< 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::vector< CDCTrack > constructMCTracks(int nMCTracks, std::vector< SimpleSimHit > simpleSimHits)
Creates CDCWireHits and uses them to construct the true CDCTracks.
std::vector< CDCTrack > simulate(const std::vector< CDCTrajectory3D > &trajectories3D)
Propagates the trajectories through the CDC as without energy loss until they first leave the CDC.
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::shared_ptr< const std::vector< CDCWireHit > > m_sharedWireHits
Space for the memory of the generated wire hits.
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.
std::vector< SimpleSimHit > createHitsForLayer(const CDCWire &nearWire, const Helix &globalHelix, double arcLength2DOffset) const
Generate connected hits for wires in the same layer close to the given wire.
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.
SimpleSimHit createHitForCell(const CDCWire &wire, const Helix &globalHelix, double arcLength2DOffset) const
Generate a hit for the given wire.
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< CDCTrack > loadPreparedEvent()
Fills the wire hits with a hard coded event from the real simulation.
double m_driftSpeed
Electron drift speed in the cdc gas.
std::vector< SimpleSimHit > createHits(const Helix &globalHelix, double arcLength2DOffset) const
Generate hits for the given helix in starting from the two dimensional arc length.
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:41
Particle full three dimensional trajectory.
Class representing a hit wire in the central drift chamber.
Definition: CDCWireHit.h:55
const Vector3D & getRefPos3D() const
The three dimensional reference position of the underlying wire.
Definition: CDCWireHit.cc:217
Class representing a sense wire in the central drift chamber.
Definition: CDCWire.h:58
Extension of the generalized circle also caching the perigee coordinates.
Definition: Helix.h:28
A pair of iterators usable with the range base for loop.
Definition: Range.h:25
A three dimensional vector.
Definition: Vector3D.h:33
ERightLeft
Enumeration to represent the distinct possibilities of the right left passage.
Definition: ERightLeft.h:25
Abstract base class for different kinds of events.
Structure to accomdate information about the individual hits during the simluation.
Vector3D m_pos3D
Memory for the true position on the track closest to the wire.
double m_arcLength2D
Memory for the true two dimensional arc length on the helix to this hit.
CDCWireHit m_wireHit
Memory for the wire hit instance that will be given to the reconstruction.
ERightLeft m_rlInfo
Memory for the true right left passage information.
SimpleSimHit(const CDCWireHit &wireHit, size_t iMCTrack, 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.
SimpleSimHit(const CDCWireHit &wireHit, size_t iMCTrack, ERightLeft rlInfo, const Vector3D &pos3D, double arcLength2D=NAN, double trueDriftLength=NAN)
Constructor from complete truth information.
size_t m_iMCTrack
Memory for the true index of the track this hit is contained in.