10#include <ecl/modules/eclChargedPIDDataAnalysisExpert/ECLChargedPIDDataAnalysisModule.h>
11#include <framework/datastore/RelationVector.h>
12#include <framework/logging/Logger.h>
13#include <framework/gearbox/Const.h>
15#include <mdst/dataobjects/MCParticle.h>
16#include <mdst/dataobjects/Track.h>
17#include <ecl/dataobjects/ECLShower.h>
109 setDescription(
"This module produces an ntuple with ECL-related quantities starting from mdst");
111 "set true if you want to save the information in a root file named by parameter 'rootFileName'",
114 "fileName used for root file where info are saved. Will be ignored if parameter 'writeToRoot' is false (standard)",
115 string(
"eclChargedPID"));
124 B2INFO(
"[ECLChargedPIDDataAnalysis Module]: Starting initialization of ECLChargedPIDDataAnalysis Module.");
132 n1_tree =
new TTree(
"n1_tree",
"ECL Charged PID tree: N1 Hypothesis");
168 n2_tree =
new TTree(
"n2_tree",
"ECL Charged PID tree: N2 Hypothesis");
203 B2INFO(
"[ECLChargedPIDDataAnalysis Module]: Initialization of ECLChargedPIDDataAnalysis Module completed.");
209 B2DEBUG(1,
" ++++++++++++++ ECLChargedPIDDataAnalysisModule");
295 n1_mcPdg->push_back(imcpart.getPDG());
296 if (imcpart.getMother() !=
nullptr)
n1_mcMothPdg->push_back(imcpart.getMother()->getPDG());
299 n1_mcP->push_back(imcpart.getMomentum().R());
300 n1_mcTheta->push_back(imcpart.getMomentum().Theta());
301 n1_mcPhi->push_back(imcpart.getMomentum().Phi());
303 n2_mcPdg->push_back(imcpart.getPDG());
304 if (imcpart.getMother() !=
nullptr)
n2_mcMothPdg->push_back(imcpart.getMother()->getPDG());
307 n2_mcP->push_back(imcpart.getMomentum().R());
308 n2_mcTheta->push_back(imcpart.getMomentum().Theta());
309 n2_mcPhi->push_back(imcpart.getMomentum().Phi());
313 int index_max_mom = -1;
315 for (
const auto& itrk : imcpart.getRelationsFrom<
Track>()) {
318 if (atrkF ==
nullptr)
continue;
321 index_max_mom = index;
325 if (index_max_mom == -1)
continue;
328 const auto itrack = imcpart.getRelationsFrom<
Track>()[index_max_mom];
336 n1_trkPdg->push_back(atrkF->getParticleType().getPDGCode());
338 n1_trkP->push_back(atrkF->getMomentum().R());
339 n1_trkTheta->push_back(atrkF->getMomentum().Theta());
340 n1_trkPhi->push_back(atrkF->getMomentum().Phi());
342 n2_trkPdg->push_back(atrkF->getParticleType().getPDGCode());
344 n2_trkP->push_back(atrkF->getMomentum().R());
345 n2_trkTheta->push_back(atrkF->getMomentum().Theta());
346 n2_trkPhi->push_back(atrkF->getMomentum().Phi());
350 int jndex1_max_e = -1;
352 for (
const auto& i1sh : itrack->getRelationsTo<
ECLShower>()) {
355 if (i1sh.getHypothesisId() != 5)
continue;
357 if (abs(i1sh.getTime()) > i1sh.getDeltaTime99())
continue;
358 if (i1sh.getEnergy() > max_e1) {
359 max_e1 = i1sh.getEnergy();
360 jndex1_max_e = jndex1;
364 int jndex2_max_e = -1;
366 for (
const auto& i2sh : itrack->getRelationsTo<
ECLShower>()) {
369 if (i2sh.getHypothesisId() != 6)
continue;
371 if (abs(i2sh.getTime()) > i2sh.getDeltaTime99())
continue;
372 if (i2sh.getEnergy() > max_e2) {
373 max_e2 = i2sh.getEnergy();
374 jndex2_max_e = jndex2;
379 if (jndex1_max_e != -1) {
380 const auto i1shower = itrack->getRelationsTo<
ECLShower>()[jndex1_max_e];
391 n1_eclEoP->push_back((i1shower->getEnergy()) / (atrkF->getMomentum().R()));
394 if (jndex2_max_e != -1) {
395 const auto i2shower = itrack->getRelationsTo<
ECLShower>()[jndex2_max_e];
406 n2_eclEoP->push_back((i2shower->getEnergy()) / (atrkF->getMomentum().R()));
static const ChargedStable pion
charged pion particle
std::string m_rootFileName
name of the root file
virtual const char * eclShowerArrayName() const
Default name ECLShower.
std::vector< int > * n1_trkPdg
Track PDG code.
std::vector< double > * n1_trkPhi
Track azimuthal direction.
StoreArray< ECLShower > m_eclShowers
Store array: ECLShower.
bool m_writeToRoot
if true, a rootFile named by m_rootFileName will be filled with info
int n1_iExperiment
Experiment number.
std::vector< double > * n2_eclShowerAbsZernike40
Shower Zernike40 Moment.
virtual void initialize() override
Initializes the Module.
int n2_iEvent
Event number.
int n1_eclShowerMultip
Number of ECLShowers per event.
virtual void event() override
Called once for each event.
std::vector< int > * n2_mcMothPdg
MCParticle mother particle PDG code.
std::vector< int > * n2_trkCharge
Track charge.
std::vector< double > * n2_mcP
MCParticle momentum.
std::vector< double > * n2_eclShowerEnergy
Shower Energy.
TTree * n2_tree
Root tree and file for saving the output.
std::vector< int > * n1_eclShowerHypothesisId
Shower Particle Hypothesis ID.
int n2_mcMultip
Multiplicity of MCParticles.
int n2_eclShowerMultip
Number of ECLShowers per event.
std::vector< double > * n1_mcP
MCParticle momentum.
std::vector< double > * n2_eclShowerR
Shower R.
virtual void terminate() override
Termination action.
std::vector< double > * n2_mcTheta
MCParticle Theta.
TTree * n1_tree
Root tree and file for saving the output.
int n2_iExperiment
Experiment number.
ECLChargedPIDDataAnalysisModule()
Constructor of the module.
std::vector< double > * n1_eclShowerEnergy
Shower Energy.
int n1_mcMultip
Multiplicity of MCParticles.
std::vector< double > * n1_mcPhi
MCParticle Phi.
std::vector< double > * n1_eclShowerAbsZernike51
Shower Zernike51 Moment.
std::vector< int > * n1_mcMothPdg
MCParticle mother particle PDG code.
std::vector< double > * n1_eclShowerR
Shower R.
std::vector< double > * n2_eclEoP
ECL Shower Energy on Track Momentum.
virtual ~ECLChargedPIDDataAnalysisModule() override
Destructor of the module.
std::vector< double > * n2_trkPhi
Track azimuthal direction.
std::vector< double > * n1_trkTheta
Track polar direction.
std::vector< double > * n1_mcEnergy
MCParticle energyx.
std::vector< int > * n2_mcPdg
MCParticle PDG code.
std::vector< double > * n1_eclShowerAbsZernike40
Shower Zernike40 Moment.
std::vector< double > * n1_eclEoP
ECL Shower Energy on Track Momentum.
std::vector< int > * n1_mcPdg
MCParticle PDG code.
std::vector< int > * n1_trkCharge
Track charge.
int n2_trkMultip
Track Multiplicity.
std::vector< double > * n2_eclShowerTheta
Shower Theta.
std::vector< double > * n2_eclShowerPhi
Shower Phi.
StoreArray< MCParticle > m_mcParticles
MCParticles StoreArray.
std::vector< double > * n2_trkTheta
Track polar direction.
std::vector< double > * n2_mcPhi
MCParticle Phi.
std::vector< double > * n1_eclShowerTheta
Shower Theta.
std::vector< double > * n2_trkP
Track momentum.
std::vector< double > * n1_trkP
Track momentum.
std::vector< int > * n2_trkPdg
Track PDG code.
std::vector< double > * n2_eclShowerAbsZernike51
Shower Zernike51 Moment.
TFile * m_rootFilePtr
members of ECLReconstructor Module
int n1_trkMultip
Track Multiplicity.
std::vector< double > * n2_mcEnergy
MCParticle energyx.
StoreObjPtr< EventMetaData > m_EventMetaData
Event metadata.
std::vector< int > * n2_eclShowerHypothesisId
Shower Particle Hypothesis ID.
std::vector< double > * n1_mcTheta
MCParticle Theta.
std::vector< double > * n1_eclShowerPhi
Shower Phi.
int n1_iEvent
Event number.
Class to store ECL Showers.
A Class to store the Monte Carlo particle information.
@ c_Initial
bit 5: Particle is initial such as e+ or e- and not going to Geant4
@ c_PrimaryParticle
bit 0: Particle is primary particle.
@ c_IsVirtual
bit 4: Particle is virtual and not going to Geant4.
void setDescription(const std::string &description)
Sets the description of the module.
Values of the result of a track fit with a given particle hypothesis.
ROOT::Math::XYZVector getMomentum() const
Getter for vector of momentum at closest approach of track in r/phi projection.
Class that bundles various TrackFitResults.
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.
Abstract base class for different kinds of events.