Belle II Software development
VXDDedxPIDModule.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
9#pragma once
10
11#include <framework/core/Module.h>
12#include <framework/gearbox/Const.h>
13#include <framework/datastore/StoreArray.h>
14
15#include <reconstruction/dataobjects/VXDDedxTrack.h>
16#include <reconstruction/dataobjects/VXDDedxLikelihood.h>
17#include <reconstruction/dataobjects/DedxConstants.h>
18
19#include <mdst/dataobjects/Track.h>
20#include <mdst/dataobjects/MCParticle.h>
21#include <tracking/dataobjects/RecoTrack.h>
22#include <svd/dataobjects/SVDCluster.h>
23#include <pxd/dataobjects/PXDCluster.h>
24
25#include <framework/database/DBObjPtr.h>
26#include <svd/dbobjects/SVDdEdxPDFs.h>
27#include <pxd/dbobjects/PXDdEdxPDFs.h>
28
29#include <vector>
30
31
32namespace Belle2 {
37 class HelixHelper;
38
51 class VXDDedxPIDModule : public Module {
52
53 public:
54
57
59 virtual ~VXDDedxPIDModule();
60
62 virtual void initialize() override;
63
66 virtual void event() override;
67
69 virtual void terminate() override;
70
71 private:
72
73 // required input
77 // optional input
82 // output
91
99 void calculateMeans(double* mean, double* truncatedMean, double* truncatedMeanErr, const std::vector<double>& dedx) const;
100
102 static double getTraversedLength(const PXDCluster* hit, const HelixHelper* helix);
103
105 static double getTraversedLength(const SVDCluster* hit, const HelixHelper* helix);
106
108 template <class HitClass> void saveSiHits(VXDDedxTrack* track, const HelixHelper& helix, const std::vector<HitClass*>& hits) const;
109
116 void savePXDLogLikelihood(double(&logl)[Const::ChargedStable::c_SetSize], double p, float dedx) const;
117
124 void saveSVDLogLikelihood(double(&logl)[Const::ChargedStable::c_SetSize], double p, float dedx) const;
125
127 bool detectorEnabled(Dedx::Detector d) const
128 {
129 return (d == Dedx::c_PXD and m_usePXD) or (d == Dedx::c_SVD and m_useSVD);
130 }
131
133 void checkPDFs();
134
135 // pdfs for PID
139 // parameters: full likelihood vs. truncated mean
141 //no need to define highest and lowest truncated value as we laways remove highest 2 dE/dx values from 8 dE/dx value.
142
143 //parameters: technical stuff
146 //parameters: which particles and detectors to use
148 bool m_usePXD;
149 bool m_useSVD;
151 //parameters: PDF configuration
154 };
156} // Belle2 namespace
static const unsigned int c_SetSize
Number of elements (for use in array bounds etc.)
Definition: Const.h:615
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
Helper class representing a helical track.
Definition: HelixHelper.h:28
Base class for Modules.
Definition: Module.h:72
The PXD Cluster class This class stores all information about reconstructed PXD clusters The position...
Definition: PXDCluster.h:30
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
Definition: SVDCluster.h:29
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Extract dE/dx from fitted tracks.
void saveSVDLogLikelihood(double(&logl)[Const::ChargedStable::c_SetSize], double p, float dedx) const
for all particles in the SVD, save log-likelihood values into 'logl'.
DBObjPtr< SVDdEdxPDFs > m_SVDDedxPDFs
SVD DB object for dedx:momentum PDFs.
int m_trackID
counter for tracks in this event
virtual void initialize() override
Initialize the module.
StoreArray< SVDCluster > m_svdClusters
Optional array of SVDClusters.
bool m_usePXD
use PXD hits for likelihood
virtual void event() override
This method is called for each event.
StoreArray< MCParticle > m_mcparticles
Optional array of MCParticles.
StoreArray< VXDDedxLikelihood > m_dedxLikelihoods
Output array of VXDDedxLikelihoods.
void checkPDFs()
Check the pdfs for consistency every time they change in the database.
virtual void terminate() override
End of the event processing.
void saveSiHits(VXDDedxTrack *track, const HelixHelper &helix, const std::vector< HitClass * > &hits) const
save energy loss and hit information from SVD/PXDHits to track
DBObjPtr< PXDdEdxPDFs > m_PXDDedxPDFs
PXD DB object for dedx:momentum PDFs.
void calculateMeans(double *mean, double *truncatedMean, double *truncatedMeanErr, const std::vector< double > &dedx) const
Save arithmetic and truncated mean for the 'dedx' values.
StoreArray< VXDDedxTrack > m_dedxTracks
Output array of VXDDedxTracks.
virtual ~VXDDedxPIDModule()
Destructor.
int m_eventID
counter for events
bool m_useSVD
use SVD hits for likelihood
bool detectorEnabled(Dedx::Detector d) const
should info from this detector be included in likelihood?
bool m_ignoreMissingParticles
Ignore particles for which no PDFs are found.
StoreArray< Track > m_tracks
Required array of Tracks.
bool m_onlyPrimaryParticles
Only save data for primary particles (as determined by MC truth)
StoreArray< PXDCluster > m_pxdClusters
Optional array of PXDClusters.
static double getTraversedLength(const PXDCluster *hit, const HelixHelper *helix)
returns traversed length through active medium of given PXDCluster.
StoreArray< RecoTrack > m_recoTracks
Required array of input RecoTracks.
bool m_useIndividualHits
Include PDF value for each hit in likelihood.
VXDDedxPIDModule()
Default constructor.
double m_trackDistanceThreshhold
Use a faster helix parametrisation, with corrections as soon as the approximation is more than ....
void savePXDLogLikelihood(double(&logl)[Const::ChargedStable::c_SetSize], double p, float dedx) const
for all particles in the PXD, save log-likelihood values into 'logl'.
Debug output for VXDDedxPID module.
Definition: VXDDedxTrack.h:27
Abstract base class for different kinds of events.