11#include <framework/core/Module.h>
12#include <framework/gearbox/Const.h>
14#include <reconstruction/dataobjects/CDCDedxTrack.h>
15#include <reconstruction/dataobjects/CDCDedxLikelihood.h>
17#include <mdst/dataobjects/Track.h>
18#include <mdst/dataobjects/MCParticle.h>
19#include <mdst/dataobjects/EventLevelTriggerTimeInfo.h>
21#include <tracking/dataobjects/RecoTrack.h>
23#include <framework/datastore/StoreArray.h>
24#include <framework/database/DBObjPtr.h>
26#include <reconstruction/dbobjects/CDCDedxScaleFactor.h>
27#include <reconstruction/dbobjects/CDCDedxWireGain.h>
28#include <reconstruction/dbobjects/CDCDedxRunGain.h>
29#include <reconstruction/dbobjects/CDCDedxCosineCor.h>
30#include <reconstruction/dbobjects/CDCDedx2DCell.h>
31#include <reconstruction/dbobjects/CDCDedx1DCell.h>
32#include <reconstruction/dbobjects/CDCDedxADCNonLinearity.h>
33#include <reconstruction/dbobjects/CDCDedxCosineEdge.h>
34#include <reconstruction/dbobjects/CDCDedxMeanPars.h>
35#include <reconstruction/dbobjects/CDCDedxSigmaPars.h>
36#include <reconstruction/dbobjects/CDCDedxHadronCor.h>
37#include <reconstruction/dbobjects/CDCDedxInjectionTime.h>
38#include <cdc/dbobjects/CDCdEdxPDFs.h>
82 virtual void event()
override;
101 double meanCurve(
double* x,
double* par,
int version)
const;
104 double getMean(
double bg)
const;
107 double sigmaCurve(
double* x,
const double* par,
int version)
const;
110 double getSigma(
double dedx,
double nhit,
double cos,
double timereso)
const;
113 double I2D(
double cosTheta,
double I)
const;
116 double D2I(
double cosTheta,
double D)
const;
125 void calculateMeans(
double* mean,
double* truncatedMean,
double* truncatedMeanErr,
const std::vector<double>& dedx)
const;
Extract CDC dE/dx information from fitted tracks.
double I2D(double cosTheta, double I) const
hadron saturation parameterization part 1
double D2I(double cosTheta, double D) const
hadron saturation parameterization part 2
double getMean(double bg) const
calculate the predicted mean using the parameterized resolution
virtual ~CDCDedxPIDModule()
Destructor.
std::vector< double > m_hadronpars
hadron saturation parameters
DBObjPtr< CDCDedxRunGain > m_DBRunGain
Run gain DB object.
double sigmaCurve(double *x, const double *par, int version) const
parameterized resolution for predictions
DBObjPtr< CDCDedxMeanPars > m_DBMeanPars
dE/dx mean parameters
virtual void initialize() override
Initialize the module.
DBObjPtr< CDCDedxHadronCor > m_DBHadronCor
hadron saturation parameters
virtual void event() override
This method is called for each event.
double m_removeHighest
Portion of highest dE/dx values that should be discarded for truncated mean.
StoreArray< CDCDedxLikelihood > m_dedxLikelihoods
Output array of CDCDedxLikelihoods.
DBObjPtr< CDCDedxCosineEdge > m_DBCosEdgeCor
non-linearly ACD correction DB object
StoreArray< MCParticle > m_mcparticles
Optional array of input MCParticles.
void saveLookupLogl(double(&logl)[Const::ChargedStable::c_SetSize], double p, double dedx)
for all particles, save log-likelihood values into 'logl'.
DBObjPtr< CDCDedxADCNonLinearity > m_DBNonlADC
non-linearly ACD correction DB object
DBObjPtr< CDCDedx1DCell > m_DB1DCell
1D correction DB object
void checkPDFs()
Check the pdfs for consistency every time they change in the database.
virtual void terminate() override
End of the event processing.
void saveChiValue(double(&chi)[Const::ChargedStable::c_SetSize], double(&predmean)[Const::ChargedStable::c_SetSize], double(&predres)[Const::ChargedStable::c_SetSize], double p, double dedx, double cos, int nhit, double timereso) const
for all particles, save chi values into 'chi'.
double meanCurve(double *x, double *par, int version) const
parameterized beta-gamma curve for predicted means
std::vector< double > m_sigmapars
dE/dx resolution parameters
void calculateMeans(double *mean, double *truncatedMean, double *truncatedMeanErr, const std::vector< double > &dedx) const
Save arithmetic and truncated mean for the 'dedx' values.
DBObjPtr< CDCDedx2DCell > m_DB2DCell
2D correction DB object
double getSigma(double dedx, double nhit, double cos, double timereso) const
calculate the predicted resolution using the parameterized resolution
DBObjPtr< CDCDedxCosineCor > m_DBCosineCor
Electron saturation correction DB object.
bool m_ignoreMissingParticles
Ignore particles for which no PDFs are found.
StoreArray< Track > m_tracks
Required array of input Tracks.
int m_nLayerWires[9]
number of wires per layer: needed for wire gain calibration
CDCDedxPIDModule()
Default constructor.
bool m_onlyPrimaryParticles
Only save data for primary particles (as determined by MC truth)
DBObjPtr< CDCdEdxPDFs > m_DBDedxPDFs
DB object for dedx:momentum PDFs.
DBObjPtr< CDCDedxSigmaPars > m_DBSigmaPars
dE/dx resolution parameters
DBObjPtr< CDCDedxWireGain > m_DBWireGains
Wire gain DB object.
std::vector< double > m_meanpars
dE/dx mean parameters
bool m_backHalfCurlers
Whether to use the back half of curlers.
bool m_trackLevel
Whether to use track-level or hit-level MC.
StoreArray< RecoTrack > m_recoTracks
Required array of input RecoTracks.
bool m_useIndividualHits
Include PDF value for each hit in likelihood.
bool m_usePrediction
Whether to use parameterized means and resolutions or lookup tables.
double m_removeLowest
Portion of lowest dE/dx values that should be discarded for truncated mean.
StoreArray< CDCDedxTrack > m_dedxTracks
Output array of CDCDedxTracks.
bool m_enableDebugOutput
Whether to save information on tracks and associated hits and dE/dx values in DedxTrack objects.
DBObjPtr< CDCDedxInjectionTime > m_DBInjectTime
time gain/reso DB object
DBObjPtr< CDCDedxScaleFactor > m_DBScaleFactor
Scale factor to make electrons ~1.
static const unsigned int c_SetSize
Number of elements (for use in array bounds etc.)
Class for accessing objects in the database.
Accessor to arrays stored in the data store.
Abstract base class for different kinds of events.