Belle II Software development
BoostVectorCollectorModule.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 <tracking/modules/BoostVectorCollector/BoostVectorCollectorModule.h>
9
10#include <analysis/dataobjects/ParticleList.h>
11#include <mdst/dataobjects/PIDLikelihood.h>
12
13using namespace Belle2;
14
15#include <iostream>
16
17//-----------------------------------------------------------------
18// Register the Module
19//-----------------------------------------------------------------
20REG_MODULE(BoostVectorCollector);
21
22//-----------------------------------------------------------------
23// Implementation
24//-----------------------------------------------------------------
25
27 m_exp(-99), m_run(-99), m_evt(-99),
28 m_time(-99),
29 m_mu0_pid(-99), m_mu1_pid(-99)
30{
31 //Set module properties
32
33 setDescription("Collect data for BoostVector calibration algorithm using the momenta of the mu+mu- events");
35
36 addParam("Y4SPListName", m_Y4SPListName, "Name of the Y4S particle list", std::string("Upsilon(4S):IPDQM"));
37}
38
40{
41 B2INFO("Init of the trees");
42 TString objectName = "events";
43 //Data object creation --------------------------------------------------
44 TTree* tree = new TTree(objectName, "");
45
46 tree->Branch<int>("event", &m_evt);
47 tree->Branch<int>("exp", &m_exp);
48 tree->Branch<int>("run", &m_run);
49 tree->Branch<double>("time", &m_time);
50
51 tree->Branch<double>("mu0_pid", &m_mu0_pid);
52 tree->Branch<double>("mu1_pid", &m_mu1_pid);
53
54 tree->Branch<B2Vector3D>("mu0_p", &m_mu0_p);
55 tree->Branch<B2Vector3D>("mu1_p", &m_mu1_p);
56
57
58 // We register the objects so that our framework knows about them.
59 // Don't try and hold onto the pointers or fill these objects directly
60 // Use the getObjectPtr functions to access collector objects
61 registerObject<TTree>(objectName.Data(), tree);
62}
63
64
66{
67 m_evt = m_emd->getEvent();
68 m_run = m_emd->getRun();
69 m_exp = m_emd->getExperiment();
70 m_time = m_emd->getTime() / 1e9 / 3600.; //from ns to hours
71
72
74
75
76 if (!Y4SParticles.isValid() || abs(Y4SParticles->getPDGCode()) != 300553)
77 return;
78
79 if (Y4SParticles->getListSize() != 1)
80 return;
81
82 if (Y4SParticles->getParticle(0)->getDaughterIndices().size() != 2)
83 return;
84
85 const Particle* part0 = Y4SParticles->getParticle(0)->getDaughter(0);
86 const Particle* part1 = Y4SParticles->getParticle(0)->getDaughter(1);
87
88 // Get the mu/e PID
91
92 // get 3-vectors of the mu/e momenta
93 m_mu0_p = B2Vector3D(part0->getMomentum());
94 m_mu1_p = B2Vector3D(part1->getMomentum());
95
96
97 getObjectPtr<TTree>("events")->Fill();
98
99}
void prepare() override final
Initialize the module.
double m_mu1_pid
particle ID of mu/e separation second muon
std::string m_Y4SPListName
Name of the Y4S particle list.
B2Vector3D m_mu0_p
three momentum of first muon
void collect() override final
Event processor The filling of the tree.
double m_mu0_pid
particle ID of mu/e separation first muon
B2Vector3D m_mu1_p
three momentum of second muon
Calibration collector module base class.
StoreObjPtr< EventMetaData > m_emd
Current EventMetaData.
Provides a type-safe way to pass members of the chargedStableSet set.
Definition: Const.h:589
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
double getProbability(const Const::ChargedStable &p1, const Const::ChargedStable &p2, Const::PIDDetectorSet set=Const::PIDDetectorSet::set()) const
Return combined likelihood probability for a particle being p1 and not p2, assuming equal prior proba...
Class to store reconstructed particles.
Definition: Particle.h:75
const PIDLikelihood * getPIDLikelihood() const
Returns the pointer to the PIDLikelihood object that is related to the Track, which was used to creat...
Definition: Particle.cc:871
ROOT::Math::XYZVector getMomentum() const
Returns momentum vector.
Definition: Particle.h:560
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
bool isValid() const
Check whether the object was created.
Definition: StoreObjPtr.h:111
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:560
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
B2Vector3< double > B2Vector3D
typedef for common usage with double
Definition: B2Vector3.h:516
Abstract base class for different kinds of events.