 |
Belle II Software
release-05-01-25
|
10 #include <tracking/trackFindingCDC/findlets/minimal/WireHitCreator.h>
12 #include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
13 #include <tracking/trackFindingCDC/eventdata/utils/FlightTimeEstimator.h>
15 #include <tracking/trackFindingCDC/findlets/minimal/EPreferredDirection.h>
17 #include <tracking/trackFindingCDC/topology/CDCWireTopology.h>
19 #include <tracking/trackFindingCDC/utilities/StringManipulation.h>
21 #include <cdc/translators/RealisticTDCCountTranslator.h>
22 #include <cdc/translators/LinearGlobalADCCountTranslator.h>
23 #include <cdc/geometry/CDCGeometryPar.h>
25 #include <cdc/dataobjects/CDCHit.h>
27 #include <framework/datastore/StoreArray.h>
28 #include <framework/core/ModuleParamList.templateDetails.h>
30 #include <mdst/dataobjects/MCParticle.h>
33 using namespace TrackFindingCDC;
40 return "Combines the geometrical information and the raw hit information into wire hits, "
41 "which can be used from all modules after that";
46 moduleParamList->
addParameter(prefixed(prefix,
"wirePosition"),
48 "Set of geometry parameters to be used in the track finding. "
49 "Either 'base', 'misaligned' or 'aligned'.",
52 moduleParamList->
addParameter(prefixed(prefix,
"ignoreWireSag"),
54 "Assume a wire sag coefficient of zero "
55 "such that the wires appear to be straight for "
59 moduleParamList->
addParameter(prefixed(prefix,
"flightTimeEstimation"),
61 "Option which flight direction should be assumed for "
62 "an initial time of flight estimation. Options are: "
63 "'none' (no TOF correction), "
68 moduleParamList->
addParameter(prefixed(prefix,
"triggerPoint"),
70 "Point relative to which the flight times are calculated",
73 moduleParamList->
addParameter(prefixed(prefix,
"useSuperLayers"),
75 "List of super layers to be used - mostly for debugging",
78 moduleParamList->
addParameter(prefixed(prefix,
"useSecondHits"),
80 "Use the second hit information in the track finding.",
83 moduleParamList->
addParameter(prefixed(prefix,
"useBadWires"),
85 "Also create the hits that are on bad wires.",
88 moduleParamList->
addParameter(prefixed(prefix,
"useDegreeSector"),
90 "To angles in degrees for which hits should be created - mostly for debugging",
93 moduleParamList->
addParameter(prefixed(prefix,
"useMCParticleIds"),
95 "Ids of the MC particles to use. Default does not look at the MCParticles - most for debugging",
123 }
catch (std::invalid_argument& e) {
166 if (not outputWireHits.empty())
return;
175 std::size_t nHits = hits.getEntries();
177 B2WARNING(
"Event with no hits");
178 outputWireHits.clear();
181 std::map<int, size_t> nHitsByMCParticleId;
183 outputWireHits.reserve(nHits);
184 for (
const CDCHit& hit : hits) {
196 nHitsByMCParticleId[mcParticleId]++;
201 if (not useMCParticleId)
continue;
204 WireID wireID(hit.getID());
206 B2WARNING(
"Skip invalid wire id " << hit.getID());
230 nHitsByMCParticleId[mcParticleId]++;
235 if (not useMCParticleId)
continue;
242 const double alpha = isIncoming ? M_PI : 0;
243 const double beta = 1;
244 const double flightTimeEstimate =
247 const double driftTime = tdcCountTranslator.
getDriftTime(hit.getTDCCount(),
252 const bool left =
false;
253 const bool right =
true;
254 const double theta = M_PI / 2;
256 const double leftRefDriftLength =
265 const double rightRefDriftLength =
274 const double refDriftLength =
275 (leftRefDriftLength + rightRefDriftLength) / 2.0;
277 const double leftRefDriftLengthVariance =
285 const double rightRefDriftLengthVariance =
293 const double refDriftLengthVariance =
294 (leftRefDriftLengthVariance + rightRefDriftLengthVariance) / 2.0;
296 const double leftRefChargeDeposit =
297 adcCountTranslator.
getCharge(hit.getADCCount(),
303 const double rightRefChargeDeposit =
304 adcCountTranslator.
getCharge(hit.getADCCount(),
310 const double refChargeDeposit =
311 (leftRefChargeDeposit + rightRefChargeDeposit) / 2.0;
313 outputWireHits.emplace_back(&hit, refDriftLength, refDriftLengthVariance, refChargeDeposit, driftTime);
316 std::sort(outputWireHits.begin(), outputWireHits.end());
319 for (
const std::pair<int, size_t> nHitsForMCParticleId : nHitsByMCParticleId) {
321 "MC particle " << nHitsForMCParticleId.first <<
" #hits "
322 << nHitsForMCParticleId.second);
Base class for translation of Drift Time into Drift Length.
virtual float getCharge(unsigned short adcCount=0, const WireID &wireID=WireID(), bool ambiguityDiscrimiator=false, float z=0, float theta=static_cast< float >(TMath::Pi()/2.))=0
Function, for which this actually was meant.
Class to identify a wire inside the CDC.
HepGeom::Vector3D< double > Vector3D
3D Vector
std::tuple< double, double > m_param_useDegreeSector
Parameter : Angular range in degrees for which hits should be unpacked.
EPreferredDirection m_flightTimeEstimation
Method for the initial time of flight estimation.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
WireHitCreator()
Default constructor.
virtual double getFlightTime2D(const Vector2D &, double, double=1) const
Default estimator for the flight time.
Translator mirroring the realistic Digitization.
const Vector2D & getRefPos2D() const
Getter for the wire reference position for 2D tracking Gives the wire's reference position projected ...
double y() const
Getter for the y coordinate.
bool isBetween(const Vector2D &lower, const Vector2D &upper) const
Checks if this vector is between two other vectors Between means here that when rotating the lower ve...
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
This class simply assumes a linear translation through (0,0)
double getRefZ() const
Getter for the wire reference z coordinate Gives the wire's reference z coordinate.
std::string getDescription() final
Short description of the findlet.
static CDCWireTopology & getInstance()
Getter for the singleton instance of the wire topology.
unsigned short getISuperLayer() const
Getter for Super-Layer.
virtual double getDriftLength(unsigned short tdcCount=0, const WireID &wireID=WireID(), double timeOfFlightEstimator=0., bool ambiguityDiscrimiator=false, double z=0, double alpha=0, double theta=static_cast< double >(TMath::Pi()/2.), unsigned short adcCount=0)=0
Function for getting a drift length estimation.
void initialize() final
Signals the beginning of the event processing.
bool isValidWireID(const WireID &wireID) const
Checks the validity of a wireID convinience object.
int getArrayIndex() const
Get 0-based index of the particle in the corresponding MCParticle list.
virtual double getDriftLengthResolution(double driftLength=0., const WireID &wireID=WireID(), bool ambiguityDiscrimiator=false, double z=0, double alpha=0, double theta=static_cast< double >(TMath::Pi()/2.))=0
Uncertainty corresponding to drift length from getDriftLength of this class.
void initialize() override
Receive and dispatch signal before the start of the event processing.
virtual double getDriftTime(unsigned short tdcCount, const WireID &wireID, double timeOfFlightEstimator, double z, unsigned short adcCount)=0
Get Drift time.
const CDCWire & getWire(const WireID &wireId) const
Getter for wire getter by wireID object.
std::array< Vector2D, 2 > m_useSector
Unit vectors denoting the sector for which hits should be created.
std::vector< int > m_param_useSuperLayers
Parameter : List of super layers to be used - mostly for debugging.
The Class for CDC Geometry Parameters.
static Vector2D Phi(const double phi)
Constucts a unit vector with azimuth angle equal to phi.
bool isBadWire(const WireID &wid)
Inquire if the wire is totally-dead.
std::string m_param_flightTimeEstimation
Parameter : Method for the initial time of flight estimation as string.
void addParameter(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
static CDCGeometryPar & Instance(const CDCGeometry *=nullptr)
Static method to get a reference to the CDCGeometryPar instance.
Abstract base class for different kinds of events.
void beginRun() override
Receive and dispatch signal for the beginning of a new run.
bool m_param_ignoreWireSag
Parameter : Switch to deactivate the sag of the wires for the concerns of the track finders.
bool m_param_useSecondHits
Parameter : If true, the second hit information will be used to create Wire Hits.
std::tuple< double, double, double > m_param_triggerPoint
Parameter : Location of the flight time zero.
static const double deg
degree to radians
std::array< bool, ISuperLayerUtil::c_N > m_useSuperLayers
Bits for the used super layers.
const WireID & getWireID() const
Getter for the wire id.
Vector3D m_triggerPoint
Central location of the flight time zero position. Usually the location of the trigger.
void reinitialize(EWirePosition wirePosition, bool ignoreWireSag)
Reload all geometry parameters form the CDCGeometryPar to adjust to changes in geometry.
static const FlightTimeEstimator & instance(std::unique_ptr< FlightTimeEstimator > replacement=nullptr)
Getter for the instance.
Abstract Base class for the ADC count translator.
Class representing a sense wire in the central drift chamber.
std::string m_param_wirePosition
Parameter : Geometry set to be used. Either "base", "misalign" or " aligned".
void beginRun() final
Signal the beginning of a new run.
EWirePosition m_wirePosition
Geometry set to be used.
std::unique_ptr< CDC::TDCCountTranslatorBase > m_tdcCountTranslator
TDC Count translator to be used to calculate the initial dirft length estiamtes.
A Class to store the Monte Carlo particle information.
Accessor to arrays stored in the data store.
The Module parameter list class.
bool m_param_useBadWires
Parameter : If true, the hits on bad wires are not ignored.
void apply(std::vector< CDCWireHit > &outputWireHits) final
Main algorithm creating the wire hits.
std::vector< int > m_param_useMCParticleIds
Parameter : Indices of the Monte Carlo particles for which hits should be used.
Class representating the sense wire arrangement in the whole of the central drift chamber.
~WireHitCreator()
Default destructor.
std::unique_ptr< CDC::ADCCountTranslatorBase > m_adcCountTranslator
ADC Count translator to be used to calculate the charge deposit in the drift cell.