9#include <masterclass/modules/MasterClassModule.h>
10#include <mdst/dataobjects/PIDLikelihood.h>
11#include <analysis/dataobjects/Particle.h>
13#include <TDirectory.h>
30 setDescription(R
"DOC(Module to write out data in a format for Belle II masterclasses)DOC");
31 addParam("outputFileName",
m_filename,
"File name of root ntuple output.", std::string(
"masterclass.root"));
41 m_tree =
new TTree(
"T",
"Event Tree");
52 const double priors[] = {0.05, 0.05, 0.65, 0.24, 0.01, 0};
53 auto type = pid->getMostLikely(priors);
57 auto trackFit = track.getTrackFitResultWithClosestMass(type);
58 auto p = trackFit->getMomentum();
59 double m = type.getMass();
61 switch (type.getPDGCode()) {
62 case 11:
id = ELECTRON;
break;
63 case 13:
id = MUON;
break;
64 case 211:
id = PION;
break;
65 case 321:
id = KAON;
break;
66 case 2212:
id = PROTON;
break;
70 p.x(), p.y(), p.z(),
sqrt(m * m + p.Mag2()),
71 trackFit->getChargeSign(),
id,
84 if (
E < 0.1)
continue;
85 ROOT::Math::XYZVector p = cluster.getClusterPosition();
88 p.x(), p.y(), p.z(),
E,
The Class for Masterclass event parameters.
virtual void Clear(Option_t *="")
Clear the array of particles.
void AddTrack(float px, float py, float pz, float e, float charge, SIMPLEPID pid)
Add the track to the event.
void EventNo(int evtno)
Set the current event number.
Provides a type-safe way to pass members of the chargedStableSet set.
static DetectorSet set()
Accessor function for the set of valid detectors.
A class for sets of detector IDs whose content is limited to restricted set of valid detector IDs.
@ c_nPhotons
CR is split into n photons (N1)
TTree * m_tree
output tree
virtual void initialize() override
Register input and output data.
BEvent * m_event
output event object
StoreArray< ECLCluster > m_clusters
Cluster objects.
virtual void event() override
Write out particles.
virtual void terminate() override
Close ntuple.
StoreArray< Track > m_tracks
Track objects.
TFile * m_file
root ntuple file
MasterClassModule()
Constructor: Sets the description, the properties and the parameters of the module.
std::string m_filename
output file name
void setDescription(const std::string &description)
Sets the description of the module.
Class to collect log likelihoods from TOP, ARICH, dEdx, ECL and KLM aimed for output to mdst includes...
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 sqrt(double a)
sqrt for double
Abstract base class for different kinds of events.