Belle II Software  release-06-00-14
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 <framework/geometry/B2Vector3.h>
11 #include <analysis/dataobjects/ParticleList.h>
12 #include <mdst/dataobjects/PIDLikelihood.h>
13 
14 using namespace Belle2;
15 using namespace std;
16 
17 #include <iostream>
18 
19 //-----------------------------------------------------------------
20 // Register the Module
21 //-----------------------------------------------------------------
22 REG_MODULE(BoostVectorCollector)
23 
24 //-----------------------------------------------------------------
25 // Implementation
26 //-----------------------------------------------------------------
27 
29  m_exp(-99), m_run(-99), m_evt(-99),
30  m_time(-99),
31  m_mu0_pid(-99), m_mu1_pid(-99)
32 {
33  //Set module properties
34 
35  setDescription("Collect data for BoostVector calibration algorithm using the momenta of the mu+mu- events");
36  setPropertyFlags(c_ParallelProcessingCertified);
37 
38  addParam("Y4SPListName", m_Y4SPListName, "Name of the Y4S particle list", std::string("Upsilon(4S):IPDQM"));
39 }
40 
42 {
43  B2INFO("Init of the trees");
44  TString objectName = "events";
45  //Data object creation --------------------------------------------------
46  TTree* tree = new TTree(objectName, "");
47 
48  tree->Branch<int>("event", &m_evt);
49  tree->Branch<int>("exp", &m_exp);
50  tree->Branch<int>("run", &m_run);
51  tree->Branch<double>("time", &m_time);
52 
53  tree->Branch<double>("mu0_pid", &m_mu0_pid);
54  tree->Branch<double>("mu1_pid", &m_mu1_pid);
55 
56  tree->Branch<TVector3>("mu0_p", &m_mu0_p);
57  tree->Branch<TVector3>("mu1_p", &m_mu1_p);
58 
59 
60  // We register the objects so that our framework knows about them.
61  // Don't try and hold onto the pointers or fill these objects directly
62  // Use the getObjectPtr functions to access collector objects
63  registerObject<TTree>(objectName.Data(), tree);
64 }
65 
66 
68 {
69  m_evt = m_emd->getEvent();
70  m_run = m_emd->getRun();
71  m_exp = m_emd->getExperiment();
72  m_time = m_emd->getTime() / 1e9 / 3600.; //from ns to hours
73 
74 
75  StoreObjPtr<ParticleList> Y4SParticles(m_Y4SPListName);
76 
77 
78  if (!Y4SParticles.isValid() || abs(Y4SParticles->getPDGCode()) != 300553)
79  return;
80 
81  if (Y4SParticles->getListSize() != 1)
82  return;
83 
84 
85  std::vector<int> indxes = Y4SParticles->getParticle(0)->getDaughterIndices();
86  if (indxes.size() != 2) return;
87 
88  const Particle* part0 = Y4SParticles->getParticle(0)->getDaughter(0);
89  const Particle* part1 = Y4SParticles->getParticle(0)->getDaughter(1);
90 
91  // Get the mu/e PID
94 
95  // get 3-vectors of the mu/e momenta
96  m_mu0_p = part0->getMomentum();
97  m_mu1_p = part1->getMomentum();
98 
99 
100  getObjectPtr<TTree>("events")->Fill();
101 
102 }
This collects the track parameters and momenta of the mu+mu- events for calibration of the BoostVecto...
void prepare() override final
Initialize the module.
void collect() override final
Event processor The filling of the tree.
Calibration collector module base class.
Provides a type-safe way to pass members of the chargedStableSet set.
Definition: Const.h:470
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...
Definition: PIDLikelihood.h:83
Class to store reconstructed particles.
Definition: Particle.h:74
TVector3 getMomentum() const
Returns momentum vector.
Definition: Particle.h:488
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:840
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
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
Abstract base class for different kinds of events.