8#include <svd/modules/svddEdxCalibrationCollector/SVDdEdxCollectorModule.h>
10#include <analysis/dataobjects/ParticleList.h>
11#include <analysis/VariableManager/Manager.h>
12#include <reconstruction/dataobjects/VXDDedxTrack.h>
13#include <mdst/dataobjects/Track.h>
14#include <mdst/dataobjects/TrackFitResult.h>
15#include <mdst/dataobjects/HitPatternVXD.h>
22using namespace Belle2::Variable;
37 setDescription(
"Collector module used to create the ROOT ntuples used to produce dE/dx calibration payloads");
48 B2INFO(
"Initialisation of the trees");
49 std::string objectNameLambda =
"Lambda";
50 std::string objectNameDstar =
"Dstar";
51 std::string objectNameGamma =
"Gamma";
52 std::string objectNameGeneric =
"Generic";
54 TTree* LambdaTree =
new TTree(objectNameLambda.c_str(),
"");
55 TTree* DstarTree =
new TTree(objectNameDstar.c_str(),
"");
56 TTree* GammaTree =
new TTree(objectNameGamma.c_str(),
"");
57 TTree* GenericTree =
new TTree(objectNameGeneric.c_str(),
"");
60 LambdaTree->Branch<
int>(
"event", &
m_evt);
61 LambdaTree->Branch<
int>(
"exp", &
m_exp);
62 LambdaTree->Branch<
int>(
"run", &
m_run);
63 LambdaTree->Branch<
double>(
"time", &
m_time);
65 DstarTree->Branch<
int>(
"event", &
m_evt);
66 DstarTree->Branch<
int>(
"exp", &
m_exp);
67 DstarTree->Branch<
int>(
"run", &
m_run);
68 DstarTree->Branch<
double>(
"time", &
m_time);
70 GammaTree->Branch<
int>(
"event", &
m_evt);
71 GammaTree->Branch<
int>(
"exp", &
m_exp);
72 GammaTree->Branch<
int>(
"run", &
m_run);
73 GammaTree->Branch<
double>(
"time", &
m_time);
86 LambdaTree->Branch<
double>(
"PionLambdaMomentum", &
m_pionLambdap);
95 DstarTree->Branch<
double>(
"D0InvM", &
m_InvMD0);
96 DstarTree->Branch<
double>(
"deltaM", &
m_DeltaM);
123 GammaTree->Branch<
double>(
"dr", &
m_drGamma);
159 const Track* track = particle->getTrack();
187 if (LambdaParticles->getListSize() > 0) {
188 for (
unsigned int iParticle = 0; iParticle < LambdaParticles->getListSize(); ++iParticle) {
190 std::vector<int> indicesLambda = LambdaParticles->getParticle(0)->getDaughterIndices();
191 if (indicesLambda.size() != 2)
193 const Particle* partLambda = LambdaParticles->getParticle(0);
194 const Particle* partPFromLambda = LambdaParticles->getParticle(0)->getDaughter(0);
195 const Particle* partPiFromLambda = LambdaParticles->getParticle(0)->getDaughter(1);
202 std::string(
"cosAngleBetweenMomentumAndVertexVector"))->function(partLambda));
205 if (!dedxTrackPFromLambda) {
220 else {
m_protonnSVDHits = trackFitPFromLambda->getHitPatternVXD().getNSVDHits();}
223 if (!dedxTrackPiFromLambda) {
244 if (DstarParticles->getListSize() > 0) {
245 for (
unsigned int iParticle = 0; iParticle < DstarParticles->getListSize(); ++iParticle) {
247 std::vector<int> indicesDstar = DstarParticles->getParticle(0)->getDaughterIndices();
248 if (indicesDstar.size() != 2)
251 const Particle* partDstar = DstarParticles->getParticle(0);
252 const Particle* partD0 = DstarParticles->getParticle(0)->getDaughter(0);
253 const Particle* partPiS = DstarParticles->getParticle(0)->getDaughter(1);
254 const Particle* partKFromD = DstarParticles->getParticle(0)->getDaughter(0)->getDaughter(0);
255 const Particle* partPiFromD = DstarParticles->getParticle(0)->getDaughter(0)->getDaughter(1);
266 std::string(
"cosAngleBetweenMomentumAndVertexVector"))->function(partD0));;
269 if (!dedxTrackKFromD) {
285 else {
m_kaonnSVDHits = trackFitKFromD->getHitPatternVXD().getNSVDHits();}
288 if (!dedxTrackPiFromD) {
304 else {
m_pionDnSVDHits = trackFitPiFromD->getHitPatternVXD().getNSVDHits();}
329 if (GammaParticles->getListSize() > 0) {
330 for (
unsigned int iParticle = 0; iParticle < GammaParticles->getListSize(); ++iParticle) {
331 std::vector<int> indicesGamma = GammaParticles->getParticle(0)->getDaughterIndices();
332 if (indicesGamma.size() != 2)
335 const Particle* partGamma = GammaParticles->getParticle(0);
336 const Particle* partE1FromGamma = GammaParticles->getParticle(0)->getDaughter(0);
337 const Particle* partE2FromGamma = GammaParticles->getParticle(0)->getDaughter(1);
345 std::string(
"cosAngleBetweenMomentumAndVertexVector"))->function(partGamma));
357 if (!dedxTrackE1FromGamma) {
372 if (!dedxTrackE2FromGamma) {
390 if (GenericParticles->getListSize() > 0) {
391 for (
unsigned int iParticle = 0; iParticle < GenericParticles->getListSize(); ++iParticle) {
393 const Particle* partGeneric = GenericParticles->getParticle(0);
399 if (!dedxTrackGeneric) {
void registerObject(std::string name, T *obj)
Register object with a name, takes ownership, do not access the pointer beyond prepare()
StoreObjPtr< EventMetaData > m_emd
Current EventMetaData.
CalibrationCollectorModule()
Constructor. Sets the default prefix for calibration dataobjects.
T * getObjectPtr(std::string name)
Calls the CalibObjManager to get the requested stored collector data.
static const double doubleNaN
quiet_NaN
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Class to store reconstructed particles.
const TrackFitResult * getTrackFitResult() const
Returns the pointer to the TrackFitResult that was used to create this Particle (ParticleType == c_Tr...
double getMomentumMagnitude() const
Returns momentum magnitude.
double getMass() const
Returns invariant mass (= nominal for FS particles)
double m_pionDnSVDHits
nSVDHits for the pion from the D0
double m_secondElectronSVDdEdx
SVD dE/dx response for the second electron.
double m_CosDirAngleLambda
Cosine of the angle between momentum and vertex vectors of Lambda candidates.
double m_pionDMomentum
momentum for the pion from the D0
void prepare() override final
Initialize the module.
double m_kaonSVDdEdx
SVD dE/dx response for the kaon from the D0.
double m_genericTrackMomentum
momentum for the generic track
double m_firstElectronSVDdEdxErr
SVD dE/dx uncertainty for the first electron.
double m_firstElectronMomentum
momentum for the first electron
double m_pionLambdadEdxTrackMomentum
momentum for the pion from the Lambda, taken from the VXDDedxTrack
double m_protonMomentum
momentum for the proton from the Lambda
double m_pionLambdap
momentum for the pion from the Lambda
double m_pionLambdaSVDdEdxErr
SVD dE/dx uncertainty for the pion from the Lambda.
SVDdEdxCollectorModule()
Constructor.
double m_pionLambdanSVDHits
nSVDHits for the pion from the Lambda
double m_kaondEdxTrackCosTheta
cosTheta for the kaon from the D0, taken from the VXDDedxTrack
std::string m_LambdaListName
Name of the Lambda particle list.
double m_drGamma
dr of converted photon candidates
double m_protonSVDdEdxErr
SVD dE/dx uncertainty for the proton from the Lambda.
double m_protonSVDdEdx
SVD dE/dx response for the proton from the Lambda.
double m_kaonSVDdEdxErr
SVD dE/dx uncertainty for the kaon from the D0.
double m_InvMDstar
Invariant mass of Dstar candidates.
double m_slowPionnSVDHits
nSVDHits for the pion from the Dstar
double m_firstElectrondEdxTrackCosTheta
cosTheta for the first electron, taken from the VXDDedxTrack
double m_genericTracknSVDHits
nSVDHits for the generic track
int m_genericTrackdEdxTrackNHits
number of hits for generic track, taken from the VXDDedxTrack
double m_InvMD0
Invariant mass of D0 candidates.
double m_protondEdxTrackMomentum
momentum for the proton from the Lambda, taken from the VXDDedxTrack
double m_slowPionMomentum
momentum for the pion from the Dstar
double m_secondElectronnSVDHits
nSVDHits for the second electron
double m_slowPionSVDdEdxErr
SVD dE/dx uncertainty for the pion from the Dstar.
double m_slowPiondEdxTrackMomentum
momentum for the pion from the Dstar, taken from the VXDDedxTrack
int m_pionLambdadEdxTrackNHits
number of hits for pion from the Lambda, taken from the VXDDedxTrack
double m_firstElectronnSVDHits
nSVDHits for the first electron
double m_slowPiondEdxTrackCosTheta
cosTheta for the pion from the Dstar, taken from the VXDDedxTrack
double m_slowPionSVDdEdx
SVD dE/dx response for the pion from the Dstar.
void collect() override final
Event processor.
double m_firstElectrondEdxTrackMomentum
momentum for the first electron, taken from the VXDDedxTrack
double m_secondElectronSVDdEdxErr
SVD dE/dx uncertainty for the second electron.
double m_CosDirAngleGamma
Cosine of the angle between momentum and vertex vectors of converted photon candidates.
double m_pionDdEdxTrackMomentum
momentum for the pion from the D0, taken from the VXDDedxTrack
std::string m_GenericListName
Name of the generic track particle list.
int m_slowPiondEdxTrackNHits
number of hits for pion from the Dstar, taken from the VXDDedxTrack
double m_pionLambdadEdxTrackCosTheta
cosTheta for the pion from the Lambda, taken from the VXDDedxTrack
double m_genericTrackdEdxTrackMomentum
momentum for the generic track, taken from the VXDDedxTrack
double m_DeltaM
deltaM = m(Dstar)-m(D0)
double m_InvMGamma
Invariant mass of converted photon candidates.
double m_pionDSVDdEdxErr
SVD dE/dx uncertainty for the pion from the D0.
int m_exp
experiment number
double m_kaonnSVDHits
nSVDHits for the kaon from the D0
double m_firstElectronSVDdEdx
SVD dE/dx response for the first electron.
double m_CosDirAngleD0
Cosine of the angle between momentum and vertex vectors of D0 candidates.
double m_genericTrackSVDdEdxErr
SVD dE/dx uncertainty for the generic track.
double m_protonnSVDHits
nSVDHits for the proton from the Lambda
int m_pionDdEdxTrackNHits
number of hits for pion from the D0, taken from the VXDDedxTrack
double m_secondElectrondEdxTrackCosTheta
cosTheta for the second electron, taken from the VXDDedxTrack
double m_protondEdxTrackCosTheta
cosTheta for the proton from the Lambda, taken from the VXDDedxTrack
double m_genericTrackSVDdEdx
SVD dE/dx for the generic track.
double m_InvMLambda
Invariant mass of Lambda candidates.
int m_protondEdxTrackNHits
number of hits for proton from the Lambda, taken from the VXDDedxTrack
double m_pionLambdaSVDdEdx
SVD dE/dx response for the pion from the Lambda.
std::string m_DstarListName
Name of the Dstar particle list.
double m_pionDdEdxTrackCosTheta
cosTheta for the pion from the D0, taken from the VXDDedxTrack
double m_pionDSVDdEdx
SVD dE/dx response for the pion from the D0.
double m_secondElectrondEdxTrackMomentum
momentum for the second electron, taken from the VXDDedxTrack
double m_kaondEdxTrackMomentum
momentum for the kaon from the D0, taken from the VXDDedxTrack
int m_firstElectrondEdxTrackNHits
number of hits for first electron, taken from the VXDDedxTrack
int m_kaondEdxTrackNHits
number of hits for kaon from the D0, taken from the VXDDedxTrack
int m_secondElectrondEdxTrackNHits
number of hits for second electron, taken from the VXDDedxTrack
std::string m_GammaListName
Name of the Gamma particle list.
double m_secondElectronMomentum
momentum for the second electron
double m_kaonMomentum
momentum for the kaon from the D0
double m_genericTrackdEdxTrackCosTheta
cosTheta for the generic track, taken from the VXDDedxTrack
Type-safe access to single objects in the data store.
bool isValid() const
Check whether the object was created.
Class that bundles various TrackFitResults.
Debug output for VXDDedxPID module.
double getCosTheta() const
Return cos(theta) for this yrack.
int size() const
Return the number of hits for this track.
double getMomentum() const
Return the momentum valid at the IP.
static Manager & Instance()
get singleton instance.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
double getDedxError(Const::EDetector detector) const
Get the error on the dE/dx truncated mean for given detector.
double getDedx(Const::EDetector detector) const
Get dE/dx truncated mean for given detector.
VXDDedxTrack const * getSVDDedxFromParticle(Particle const *particle)
SVD dEdx value from particle.
Abstract base class for different kinds of events.