Belle II Software  release-05-02-19
VXDDedxPIDModule.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2012 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Jake Bennett, Christian Pulvermacher
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #ifndef VXDDEDXPIDMODULE_H
12 #define VXDDEDXPIDMODULE_H
13 
14 #include <framework/core/Module.h>
15 #include <framework/gearbox/Const.h>
16 #include <framework/datastore/StoreArray.h>
17 
18 #include <reconstruction/dataobjects/VXDDedxTrack.h>
19 #include <reconstruction/dataobjects/VXDDedxLikelihood.h>
20 #include <reconstruction/dataobjects/DedxConstants.h>
21 
22 #include <mdst/dataobjects/Track.h>
23 #include <mdst/dataobjects/MCParticle.h>
24 #include <tracking/dataobjects/RecoTrack.h>
25 #include <svd/dataobjects/SVDCluster.h>
26 #include <pxd/dataobjects/PXDCluster.h>
27 
28 #include <framework/database/DBObjPtr.h>
29 #include <reconstruction/dbobjects/DedxPDFs.h>
30 
31 #include <vector>
32 
33 
34 namespace Belle2 {
39  class HelixHelper;
40 
54  class VXDDedxPIDModule : public Module {
55 
56  public:
57 
60 
62  virtual ~VXDDedxPIDModule();
63 
65  virtual void initialize() override;
66 
69  virtual void event() override;
70 
72  virtual void terminate() override;
73 
74  private:
75 
76  // required input
80  // optional input
85  // output
91  int m_eventID;
93  int m_trackID;
94 
102  void calculateMeans(double* mean, double* truncatedMean, double* truncatedMeanErr, const std::vector<double>& dedx) const;
103 
105  static double getTraversedLength(const PXDCluster* hit, const HelixHelper* helix);
106 
108  static double getTraversedLength(const SVDCluster* hit, const HelixHelper* helix);
109 
111  template <class HitClass> void saveSiHits(VXDDedxTrack* track, const HelixHelper& helix, const std::vector<HitClass*>& hits) const;
112 
120  void savePXDLogLikelihood(double(&logl)[Const::ChargedStable::c_SetSize], double p, float dedx) const;
121 
129  void saveSVDLogLikelihood(double(&logl)[Const::ChargedStable::c_SetSize], double p, float dedx) const;
130 
132  bool detectorEnabled(Dedx::Detector d) const
133  {
134  return (d == Dedx::c_PXD and m_usePXD) or (d == Dedx::c_SVD and m_useSVD);
135  }
136 
138  void checkPDFs();
139 
140  // pdfs for PID
143  // parameters: full likelihood vs. truncated mean
144  bool m_useIndividualHits;
145  //no need to define highest and lowest truncated value as we laways remove highest 2 dE/dx values from 8 dE/dx value.
146 
147  //parameters: technical stuff
151  //parameters: which particles and detectors to use
153  bool m_usePXD;
154  bool m_useSVD;
156  //parameters: PDF configuration
159  };
161 } // Belle2 namespace
162 #endif
Belle2::Const::ChargedStable::c_SetSize
static const unsigned int c_SetSize
Number of elements (for use in array bounds etc.)
Definition: Const.h:491
Belle2::VXDDedxPIDModule::m_useSVD
bool m_useSVD
use SVD hits for likelihood
Definition: VXDDedxPIDModule.h:162
Belle2::VXDDedxPIDModule::m_trackDistanceThreshhold
double m_trackDistanceThreshhold
Use a faster helix parametrisation, with corrections as soon as the approximation is more than ....
Definition: VXDDedxPIDModule.h:156
Belle2::VXDDedxPIDModule::m_DBDedxPDFs
DBObjPtr< DedxPDFs > m_DBDedxPDFs
DB object for dedx:momentum PDFs.
Definition: VXDDedxPIDModule.h:149
Belle2::VXDDedxPIDModule::m_trackID
int m_trackID
counter for tracks in this event
Definition: VXDDedxPIDModule.h:101
Belle2::VXDDedxPIDModule::getTraversedLength
static double getTraversedLength(const PXDCluster *hit, const HelixHelper *helix)
returns traversed length through active medium of given PXDCluster.
Definition: VXDDedxPIDModule.cc:331
Belle2::VXDDedxPIDModule::m_eventID
int m_eventID
counter for events
Definition: VXDDedxPIDModule.h:99
Belle2::VXDDedxPIDModule::checkPDFs
void checkPDFs()
Check the pdfs for consistency everytime they change in the database.
Definition: VXDDedxPIDModule.cc:58
Belle2::HelixHelper
Helper class representing a helical track.
Definition: HelixHelper.h:39
Belle2::VXDDedxPIDModule::VXDDedxPIDModule
VXDDedxPIDModule()
Default constructor.
Definition: VXDDedxPIDModule.cc:32
Belle2::VXDDedxTrack
Debug output for VXDDedxPID module.
Definition: VXDDedxTrack.h:38
Belle2::VXDDedxPIDModule::m_recoTracks
StoreArray< RecoTrack > m_recoTracks
Required array of input RecoTracks.
Definition: VXDDedxPIDModule.h:86
Belle2::VXDDedxPIDModule::m_tracks
StoreArray< Track > m_tracks
Required array of Tracks.
Definition: VXDDedxPIDModule.h:85
Belle2::DBObjPtr
Class for accessing objects in the database.
Definition: DBObjPtr.h:31
Belle2::VXDDedxPIDModule::calculateMeans
void calculateMeans(double *mean, double *truncatedMean, double *truncatedMeanErr, const std::vector< double > &dedx) const
Save arithmetic and truncated mean for the 'dedx' values.
Definition: VXDDedxPIDModule.cc:292
Belle2::VXDDedxPIDModule::savePXDLogLikelihood
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'.
Definition: VXDDedxPIDModule.cc:437
Belle2::VXDDedxPIDModule::saveSiHits
void saveSiHits(VXDDedxTrack *track, const HelixHelper &helix, const std::vector< HitClass * > &hits) const
save energy loss and hit information from SVD/PXDHits to track
Definition: VXDDedxPIDModule.cc:373
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::VXDDedxPIDModule::m_onlyPrimaryParticles
bool m_onlyPrimaryParticles
Only save data for primary particles (as determined by MC truth)
Definition: VXDDedxPIDModule.h:160
Belle2::VXDDedxPIDModule::m_usePXD
bool m_usePXD
use PXD hits for likelihood
Definition: VXDDedxPIDModule.h:161
Belle2::VXDDedxPIDModule::m_dedxTracks
StoreArray< VXDDedxTrack > m_dedxTracks
Output array of VXDDedxTracks.
Definition: VXDDedxPIDModule.h:94
Belle2::VXDDedxPIDModule::m_useIndividualHits
bool m_useIndividualHits
Include PDF value for each hit in likelihood.
Definition: VXDDedxPIDModule.h:152
Belle2::PXDCluster
The PXD Cluster class This class stores all information about reconstructed PXD clusters The position...
Definition: PXDCluster.h:41
Belle2::VXDDedxPIDModule::terminate
virtual void terminate() override
End of the event processing.
Definition: VXDDedxPIDModule.cc:285
Belle2::VXDDedxPIDModule::m_mcparticles
StoreArray< MCParticle > m_mcparticles
Optional array of MCParticles.
Definition: VXDDedxPIDModule.h:89
Belle2::VXDDedxPIDModule::m_dedxLikelihoods
StoreArray< VXDDedxLikelihood > m_dedxLikelihoods
Output array of VXDDedxLikelihoods.
Definition: VXDDedxPIDModule.h:95
Belle2::VXDDedxPIDModule::detectorEnabled
bool detectorEnabled(Dedx::Detector d) const
should info from this detector be included in likelihood?
Definition: VXDDedxPIDModule.h:140
Belle2::SVDCluster
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
Definition: SVDCluster.h:38
Belle2::VXDDedxPIDModule::initialize
virtual void initialize() override
Initialize the module.
Definition: VXDDedxPIDModule.cc:120
Belle2::VXDDedxPIDModule::m_ignoreMissingParticles
bool m_ignoreMissingParticles
Ignore particles for which no PDFs are found.
Definition: VXDDedxPIDModule.h:165
Belle2::StoreArray
Accessor to arrays stored in the data store.
Definition: ECLMatchingPerformanceExpertModule.h:33
Belle2::VXDDedxPIDModule::m_svdClusters
StoreArray< SVDCluster > m_svdClusters
Optional array of SVDClusters.
Definition: VXDDedxPIDModule.h:90
Belle2::VXDDedxPIDModule::m_pxdClusters
StoreArray< PXDCluster > m_pxdClusters
Optional array of PXDClusters.
Definition: VXDDedxPIDModule.h:91
Belle2::VXDDedxPIDModule::m_enableDebugOutput
bool m_enableDebugOutput
Whether to save information on tracks and associated hits and dE/dx values in VXDDedxTrack objects.
Definition: VXDDedxPIDModule.h:157
Belle2::VXDDedxPIDModule::saveSVDLogLikelihood
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'.
Definition: VXDDedxPIDModule.cc:472
Belle2::VXDDedxPIDModule::~VXDDedxPIDModule
virtual ~VXDDedxPIDModule()
Destructor.
Definition: VXDDedxPIDModule.cc:56
Belle2::VXDDedxPIDModule::event
virtual void event() override
This method is called for each event.
Definition: VXDDedxPIDModule.cc:162