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 <tracking/trackingUtilities/geometry/Vector3D.h>
15#include <vector>
16#include <memory>
17
18namespace Belle2 {
23 namespace TrackingUtilities {
24
26 class CDCTrack;
27 class CDCTrajectory3D;
28 class Helix;
29 }
30
31 namespace TrackFindingCDC {
32
48
49 private:
50
52 struct SimpleSimHit {
53
59 size_t iMCTrack,
60 TrackingUtilities::ERightLeft rlInfo) :
61 m_wireHit(wireHit),
62 m_iMCTrack(iMCTrack),
63 m_rlInfo(rlInfo)
64 {}
65
71 size_t iMCTrack,
72 TrackingUtilities::ERightLeft rlInfo,
73 const TrackingUtilities::Vector3D& pos3D,
74 double arcLength2D = NAN,
75 double trueDriftLength = NAN) :
76 m_wireHit(wireHit),
77 m_iMCTrack(iMCTrack),
78 m_rlInfo(rlInfo),
79 m_pos3D(pos3D),
80 m_arcLength2D(arcLength2D),
81 m_trueDriftLength(trueDriftLength)
82 {}
83
86
88 size_t m_iMCTrack;
89
91 TrackingUtilities::ERightLeft m_rlInfo;
92
95
97 double m_arcLength2D = NAN;
98
100 double m_trueDriftLength = NAN;
101 };
102
103 public:
105 TrackingUtilities::ConstVectorRange<TrackingUtilities::CDCWireHit> getWireHits() const;
106
107 public:
114 std::vector<TrackingUtilities::CDCTrack> simulate(const std::vector<TrackingUtilities::CDCTrajectory3D>& trajectories3D);
115
118
120 std::vector<TrackingUtilities::CDCTrack> loadPreparedEvent();
121
122 private:
124 std::vector<TrackingUtilities::CDCTrack> constructMCTracks(int nMCTracks, std::vector<SimpleSimHit> simpleSimHits);
125
127 std::vector<SimpleSimHit> createHits(const TrackingUtilities::Helix& globalHelix, double arcLength2DOffset) const;
128
130 std::vector<SimpleSimHit> createHitsForLayer(const CDC::CDCWire& nearWire,
131 const TrackingUtilities::Helix& globalHelix,
132 double arcLength2DOffset) const;
133
136 const TrackingUtilities::Helix& globalHelix,
137 double arcLength2DOffset) const;
138
139 public:
141 double getEventTime() const
142 { return m_eventTime; }
143
145 void setEventTime(double eventTime)
146 { m_eventTime = eventTime; }
147
149 void activateTOFDelay(bool activate = true)
150 { m_addTOFDelay = activate; }
151
153 void activateInWireSignalDelay(bool activate = true)
154 { m_addInWireSignalDelay = activate; }
155
158 { return m_maxNHitOnWire; }
159
161 void setMaxNHitOnWire(int maxNHitOnWire)
162 { m_maxNHitOnWire = maxNHitOnWire; }
163
164 private:
166 std::shared_ptr<const std::vector<TrackingUtilities::CDCWireHit> > m_sharedWireHits;
167
169 const double s_nominalDriftLengthVariance = 0.000169;
170
172 const double s_nominalPropSpeed = 27.25;
173
175 const double s_nominalDriftSpeed = 4e-3;
176
179
181 double m_eventTime = 0;
182
184 bool m_addTOFDelay = false;
185
188
189 // TODO: make them freely setable ?
192
195
198
201 };
202
203 }
205}
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:39
Particle full three dimensional trajectory.
Class representing a hit wire in the central drift chamber.
Definition CDCWireHit.h:58
Extension of the generalized circle also caching the perigee coordinates.
Definition Helix.h:28
A three dimensional vector.
Definition Vector3D.h:34
Abstract base class for different kinds of events.
Structure to accommodate information about the individual hits during the simulation.
SimpleSimHit(const TrackingUtilities::CDCWireHit &wireHit, size_t iMCTrack, TrackingUtilities::ERightLeft rlInfo, const TrackingUtilities::Vector3D &pos3D, double arcLength2D=NAN, double trueDriftLength=NAN)
Constructor from complete truth information.
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.
TrackingUtilities::CDCWireHit m_wireHit
Memory for the wire hit instance that will be given to the reconstruction.
TrackingUtilities::Vector3D m_pos3D
Memory for the true position on the track closest to the wire.