Belle II Software development
PhysicsObjectsMiraBelleEcmsBBModule.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#include <dqm/modules/PhysicsObjectsMiraBelle/PhysicsObjectsMiraBelleEcmsBBModule.h>
9
10#include <analysis/variables/ContinuumSuppressionVariables.h>
11#include <analysis/utility/PCmsLabTransform.h>
12#include <framework/particledb/EvtGenDatabasePDG.h>
13#include <mdst/dataobjects/SoftwareTriggerResult.h>
14#include <framework/datastore/StoreObjPtr.h>
15#include <analysis/dataobjects/ParticleList.h>
16
17#include <TDirectory.h>
18#include <TH1D.h>
19
20using namespace Belle2;
21
22
23
24//-----------------------------------------------------------------
25// Register the Module
26//-----------------------------------------------------------------
27REG_MODULE(PhysicsObjectsMiraBelleEcmsBB);
28
29//-----------------------------------------------------------------
30// Implementation
31//-----------------------------------------------------------------
32
34{
35 //Set module properties
36 setDescription("Monitor of the CMS collision energy based on hadronic B decays");
38
39 addParam("TriggerIdentifier", m_triggerIdentifier,
40 "Trigger identifier string used to select events for the histograms", std::string("software_trigger_cut&skim&accept_btocharm"));
41 addParam("BmListName", m_BmListName, "Name of the B- particle list", std::string("B-:combined"));
42 addParam("B0ListName", m_B0ListName, "Name of the B0 particle list", std::string("B0:combined"));
43}
44
45
47{
48 REG_HISTOGRAM
49}
50
52{
53 TDirectory* oldDir = gDirectory;
54 oldDir->mkdir("PhysicsObjectsMiraBelleEcmsBB");
55 oldDir->cd("PhysicsObjectsMiraBelleEcmsBB");
56
57 const double cMBp = EvtGenDatabasePDG::Instance()->GetParticle("B+")->Mass();
58
59 // In the original ML-based analysis there are 40 bins for visualisation
60 // Since binned fit is used here, 80 bins are used instead.
61 // For simplicity, the same histogram lower bound (B+ mass) is used
62 m_hB0 = new TH1D("hB0", "", 80, cMBp, 5.37);
63 m_hBp = new TH1D("hBp", "", 80, cMBp, 5.37);
64 oldDir->cd();
65}
66
68{
69 if (m_hBp) m_hBp->Reset();
70 if (m_hB0) m_hB0->Reset();
71}
72
73
74
75
76
78{
80 if (!result.isValid()) {
81 B2WARNING("SoftwareTriggerResult object not available but needed to select events for the histograms.");
82 return;
83 }
84
85 const bool accepted = (result->getResult(m_triggerIdentifier) == SoftwareTriggerCutResult::c_accept);
86 if (accepted == false) return;
87
90
91 //put all the B candidates into the vector
92 std::vector<const Particle*> Bparts;
93
94 if (B0.isValid()) {
95 for (unsigned i = 0; i < B0->getListSize(); ++i)
96 if (B0->getParticle(i))
97 Bparts.push_back(B0->getParticle(i));
98 }
99 if (Bm.isValid()) {
100 for (unsigned i = 0; i < Bm->getListSize(); ++i)
101 if (Bm->getParticle(i))
102 Bparts.push_back(Bm->getParticle(i));
103 }
104
105
106 if (Bparts.size() == 0) return;
107
108 for (unsigned i = 0; i < Bparts.size(); ++i) {
109 const Particle* Bpart = Bparts[i];
110
111 const Particle* D = nullptr;
112 double dmDstar = std::numeric_limits<double>::quiet_NaN();
113
114 static const int c_PdgD0 = abs(EvtGenDatabasePDG::Instance()->GetParticle("D0")->PdgCode());
115 static const int c_PdgDplus = abs(EvtGenDatabasePDG::Instance()->GetParticle("D+")->PdgCode());
116
117 static const int c_PdgDstar0 = abs(EvtGenDatabasePDG::Instance()->GetParticle("D*0")->PdgCode());
118 static const int c_PdgDstarPlus = abs(EvtGenDatabasePDG::Instance()->GetParticle("D*+")->PdgCode());
119
120 //if D0 or D+ meson
121 if (abs(Bpart->getDaughter(0)->getPDGCode()) == c_PdgD0 || abs(Bpart->getDaughter(0)->getPDGCode()) == c_PdgDplus) {
122 D = Bpart->getDaughter(0);
123 } else if (abs(Bpart->getDaughter(0)->getPDGCode()) == c_PdgDstar0 || abs(Bpart->getDaughter(0)->getPDGCode()) == c_PdgDstarPlus) {
124 const Particle* Dstar = Bpart->getDaughter(0);
125 D = Dstar->getDaughter(0);
126 dmDstar = Dstar->getMass() - D->getMass();
127 } else {
128 B2INFO("No D meson found");
129 }
130 double mD = D ? D->getMass() : std::numeric_limits<double>::quiet_NaN();
131
132 //Convert mBC and deltaE to the Y4S reference
133 double pBcms = PCmsLabTransform::labToCms(Bpart->get4Vector()).P();
134 double mInv = Bpart->getMass();
135 double pdg = Bpart->getPDGCode();
136 double R2 = Variable::R2(Bpart);
137
138 //get mass of B+- or B0
139 double mB = EvtGenDatabasePDG::Instance()->GetParticle(abs(pdg))->Mass();
140
141
142 // Filling the histograms
143 if (c_mDmin < mD && mD < c_mDmax)
144 if (abs(mInv - mB) < c_mBwindow)
145 if (R2 < c_R2max)
146 if (std::isnan(dmDstar) || (c_dmDstarMin < dmDstar && dmDstar < c_dmDstarMax)) {
147 double eBC = sqrt(pBcms * pBcms + mB * mB); // beam constrained energy
148 if (abs(pdg) == 511) {
149 m_hB0->Fill(eBC);
150 } else {
151 m_hBp->Fill(eBC);
152 }
153 }
154 }
155}
static EvtGenDatabasePDG * Instance()
Instance method that loads the EvtGen table.
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
Definition: HistoModule.h:29
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:208
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition: Module.h:80
static ROOT::Math::PxPyPzMVector labToCms(const ROOT::Math::PxPyPzMVector &vec)
Transforms Lorentz vector into CM System.
Class to store reconstructed particles.
Definition: Particle.h:76
int getPDGCode(void) const
Returns PDG code.
Definition: Particle.h:465
ROOT::Math::PxPyPzEVector get4Vector() const
Returns Lorentz vector.
Definition: Particle.h:567
const Particle * getDaughter(unsigned i) const
Returns a pointer to the i-th daughter particle.
Definition: Particle.cc:662
double getMass() const
Returns invariant mass (= nominal for FS particles)
Definition: Particle.h:527
void initialize() override final
Register the histograms.
std::string m_B0ListName
List name for neutral B candidates.
static constexpr double c_mDmax
Maximal value of the D meson inv mass.
void defineHisto() override final
Initialize the histograms.
std::string m_triggerIdentifier
Trigger identifier string used to select events for the histograms.
void event() override final
Event processor Filling of the histograms.
static constexpr double c_mDmin
Minimal value of the D meson inv mass.
static constexpr double c_dmDstarMin
Minimal value of the m(D*)-(mD)
std::string m_BmListName
List name for charged B candidates.
static constexpr double c_dmDstarMax
Maximal value of the m(D*)-(mD)
void beginRun() override final
Reset the histograms.
static constexpr double c_mBwindow
Maximal deviation of B meson inv mass from PDG value.
static constexpr double c_R2max
Maximal allowed R2 value (to suppress continuum)
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:95
bool isValid() const
Check whether the object was created.
Definition: StoreObjPtr.h:110
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:559
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:649
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28
@ c_accept
Accept this event.
Abstract base class for different kinds of events.