Belle II Software  release-08-01-10
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 <reconstruction/dbobjects/DedxPDFs.h>
27 
28 #include <vector>
29 
30 
31 namespace Belle2 {
36  class HelixHelper;
37 
50  class VXDDedxPIDModule : public Module {
51 
52  public:
53 
56 
58  virtual ~VXDDedxPIDModule();
59 
61  virtual void initialize() override;
62 
65  virtual void event() override;
66 
68  virtual void terminate() override;
69 
70  private:
71 
72  // required input
76  // optional input
81  // output
87  int m_eventID;
89  int m_trackID;
90 
98  void calculateMeans(double* mean, double* truncatedMean, double* truncatedMeanErr, const std::vector<double>& dedx) const;
99 
101  static double getTraversedLength(const PXDCluster* hit, const HelixHelper* helix);
102 
104  static double getTraversedLength(const SVDCluster* hit, const HelixHelper* helix);
105 
107  template <class HitClass> void saveSiHits(VXDDedxTrack* track, const HelixHelper& helix, const std::vector<HitClass*>& hits) const;
108 
115  void savePXDLogLikelihood(double(&logl)[Const::ChargedStable::c_SetSize], double p, float dedx) const;
116 
123  void saveSVDLogLikelihood(double(&logl)[Const::ChargedStable::c_SetSize], double p, float dedx) const;
124 
126  bool detectorEnabled(Dedx::Detector d) const
127  {
128  return (d == Dedx::c_PXD and m_usePXD) or (d == Dedx::c_SVD and m_useSVD);
129  }
130 
132  void checkPDFs();
133 
134  // pdfs for PID
137  // parameters: full likelihood vs. truncated mean
139  //no need to define highest and lowest truncated value as we laways remove highest 2 dE/dx values from 8 dE/dx value.
140 
141  //parameters: technical stuff
144  //parameters: which particles and detectors to use
146  bool m_usePXD;
147  bool m_useSVD;
149  //parameters: PDF configuration
152  };
154 } // Belle2 namespace
static const unsigned int c_SetSize
Number of elements (for use in array bounds etc.)
Definition: Const.h:606
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'.
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 everytime 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
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'.
DBObjPtr< DedxPDFs > m_DBDedxPDFs
DB object for dedx:momentum PDFs.
Debug output for VXDDedxPID module.
Definition: VXDDedxTrack.h:27
Abstract base class for different kinds of events.